From: Philipp Zabel <p.zabel@pengutronix.de>
To: Markus Schneider-Pargmann <msp@baylibre.com>,
Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Sam Ravnborg <sam@ravnborg.org>,
dri-devel@lists.freedesktop.org,
linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v1 6/6] drm/mediatek: Add mt8195 DisplayPort driver
Date: Tue, 07 Sep 2021 10:47:41 +0200 [thread overview]
Message-ID: <116f1a0283f43f97fdcfc4949e8b3c9cccc08d34.camel@pengutronix.de> (raw)
In-Reply-To: <20210906193529.718845-7-msp@baylibre.com>
Hi Markus,
On Mon, 2021-09-06 at 21:35 +0200, Markus Schneider-Pargmann wrote:
> This patch adds a DisplayPort driver for the Mediatek mt8195 SoC.
>
> It supports both functional units on the mt8195, the embedded
> DisplayPort as well as the external DisplayPort units. It offers
> hot-plug-detection, audio up to 8 channels, and DisplayPort 1.4 with up
> to 4 lanes.
>
> This driver is based on an initial version by
> Jason-JH.Lin <jason-jh.lin@mediatek.com>.
>
> Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
> ---
[...]
> diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
> new file mode 100644
> index 000000000000..1bd07c8d2f69
> --- /dev/null
> +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> @@ -0,0 +1,2881 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2019 MediaTek Inc.
> + * Copyright (c) 2021 BayLibre
> + */
> +
[...]
> +#include <linux/component.h>
[...]
> +#include <linux/extcon.h>
> +#include <linux/extcon-provider.h>
[...]
> +#include <linux/kthread.h>
> +#include <linux/mfd/syscon.h>
[...]
> +#include <linux/of_gpio.h>
> +#include <linux/of_graph.h>
[...]
> +#include <linux/phy/phy.h>
The list of included headers could be pruned a bit, from a quick look it
seems like neither of these are actually used.
[...]
> +static void mtk_dp_ssc_enable(struct mtk_dp *mtk_dp, bool enable)
> +{
> + mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE, DP_PWR_STATE_BANDGAP,
> + DP_PWR_STATE_MASK);
> + mtk_dp_update_bits(mtk_dp, DP_PHY_DIG_PLL_CTL_1,
> + enable ? TPLL_SSC_EN : 0, TPLL_SSC_EN);
> + mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> + DP_PWR_STATE_BANDGAP_TPLL_LANE, DP_PWR_STATE_MASK);
> +
> + udelay(50);
Can usleep_range() be used here? Same for the other delays.
[...]
> +static void mtk_dp_hpd_sink_event(struct mtk_dp *mtk_dp)
> +{
[...]
> +
> + if (DP_GET_SINK_COUNT(sink_count) &&
> + (link_status[2] & DP_DOWNSTREAM_PORT_STATUS_CHANGED)) {
> + mtk_dp->train_info.check_cap_count = 0;
> + kfree(mtk_dp->edid);
> + mtk_dp->edid = NULL;
Should this be protect by a lock? This looks like it could race with the
access in mtk_dp_edid_parse_audio_capabilities() or mtk_dp_get_edid()
[...]
> +static int mtk_dp_train_handler(struct mtk_dp *mtk_dp)
> +{
> + int ret = 0;
> +
> + ret = mtk_dp_train_hpd_handle(mtk_dp);
> +
> + if (!mtk_dp->train_info.cable_plugged_in)
> + return -ENODEV;
> +
> + if (mtk_dp->train_state == MTK_DP_TRAIN_STATE_NORMAL)
> + return ret;
> +
> + switch (mtk_dp->train_state) {
[...]
> + case MTK_DP_TRAIN_STATE_TRAINING:
> + ret = mtk_dp_train_start(mtk_dp);
> + if (!ret) {
> + mtk_dp_video_mute(mtk_dp, true);
> + mtk_dp_audio_mute(mtk_dp, true);
> + mtk_dp->train_state = MTK_DP_TRAIN_STATE_CHECKTIMING;
> + mtk_dp_fec_enable(mtk_dp, mtk_dp->has_fec);
> + } else if (ret != -EAGAIN)
> + mtk_dp->train_state = MTK_DP_TRAIN_STATE_DPIDLE;
A small whitespace issue and missing braces.
Consider running this through checkpatch.pl --strict once for style
issues.
[...]
> +static irqreturn_t mtk_dp_hpd_event(int hpd, void *dev)
> +{
> + struct mtk_dp *mtk_dp = dev;
> + uint32_t irq_status;
> +
> + irq_status = mtk_dp_read(mtk_dp, MTK_DP_TOP_IRQ_STATUS);
> +
> + if (!irq_status)
> + return IRQ_HANDLED;
This check seems superfluous given that only the
RGS_IRQ_STATUS_TRANSMITTER bit is checked right below:
> + if (irq_status & RGS_IRQ_STATUS_TRANSMITTER)
> + return mtk_dp_hpd_isr_handler(mtk_dp);
> +
> + return IRQ_HANDLED;
> +}
[...]
> +static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge,
> + struct drm_connector *connector)
> +{
> + struct mtk_dp *mtk_dp = mtk_dp_from_bridge(bridge);
> + bool pre_enabled = mtk_dp->pre_enabled;
> +
> + if (mtk_dp->edid)
> + kfree(mtk_dp->edid);
Unnecessary check, kfree() accepts NULL.
regards
Philipp
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2021-09-07 8:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-06 19:35 [PATCH v1 0/6] drm/mediatek: Add mt8195 DisplayPort driver Markus Schneider-Pargmann
2021-09-06 19:35 ` [PATCH v1 1/6] dt-bindings: mediatek,dpi: Add mt8195 dpintf Markus Schneider-Pargmann
2021-09-06 20:14 ` Sam Ravnborg
2021-09-09 12:49 ` Markus Schneider-Pargmann
2021-09-06 19:35 ` [PATCH v1 2/6] dt-bindings: mediatek,dp: Add Display Port binding Markus Schneider-Pargmann
2021-09-06 19:35 ` [PATCH v1 3/6] drm/edid: Add cea_sad helpers for freq/length Markus Schneider-Pargmann
2021-09-06 20:19 ` Sam Ravnborg
2021-09-07 7:38 ` Markus Schneider-Pargmann
2021-09-06 19:35 ` [PATCH v1 4/6] video/hdmi: Add audio_infoframe packing for DP Markus Schneider-Pargmann
2021-09-06 20:30 ` Sam Ravnborg
2021-09-07 8:59 ` Markus Schneider-Pargmann
2021-09-06 19:35 ` [PATCH v1 5/6] drm/mediatek: dpi: Add dpintf support Markus Schneider-Pargmann
2021-09-06 19:35 ` [PATCH v1 6/6] drm/mediatek: Add mt8195 DisplayPort driver Markus Schneider-Pargmann
2021-09-06 20:39 ` Sam Ravnborg
2021-09-09 12:45 ` Markus Schneider-Pargmann
2021-09-07 8:47 ` Philipp Zabel [this message]
2021-09-09 9:16 ` Markus Schneider-Pargmann
2021-09-09 23:37 ` Chun-Kuang Hu
2021-09-10 5:36 ` Markus Schneider-Pargmann
2021-09-13 23:25 ` Chun-Kuang Hu
2021-09-17 13:33 ` Markus Schneider-Pargmann
2021-09-17 14:36 ` Chun-Kuang Hu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=116f1a0283f43f97fdcfc4949e8b3c9cccc08d34.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=chunkuang.hu@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=msp@baylibre.com \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox