From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
To: "Heiko Stübner" <heiko@sntech.de>,
"Andrzej Hajda" <andrzej.hajda@intel.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Robert Foss" <rfoss@kernel.org>,
"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
"Jonas Karlman" <jonas@kwiboo.se>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Sandy Huang" <hjc@rock-chips.com>,
"Andy Yan" <andy.yan@rock-chips.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Mark Yao" <markyao0591@gmail.com>,
"Sascha Hauer" <s.hauer@pengutronix.de>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
kernel@collabora.com, Alexandre ARNOUD <aarnoud@me.com>,
Luis de Arquer <ldearquer@gmail.com>,
Algea Cao <algea.cao@rock-chips.com>
Subject: Re: [PATCH v6 3/3] drm/rockchip: Add basic RK3588 HDMI output support
Date: Sat, 14 Sep 2024 21:28:59 +0300 [thread overview]
Message-ID: <4766d230-c9c3-414d-a954-3b0c890e7e08@collabora.com> (raw)
In-Reply-To: <2376712.1SvkZsmPdQ@diego>
On 9/10/24 10:08 PM, Heiko Stübner wrote:
> Am Freitag, 6. September 2024, 03:17:42 CEST schrieb Cristian Ciocaltea:
>> The RK3588 SoC family integrates the newer Synopsys DesignWare HDMI 2.1
>> Quad-Pixel (QP) TX controller IP and a HDMI/eDP TX Combo PHY based on a
>> Samsung IP block.
>>
>> Add just the basic support for now, i.e. RGB output up to 4K@60Hz,
>> without audio, CEC or any of the HDMI 2.1 specific features.
>>
>> Co-developed-by: Algea Cao <algea.cao@rock-chips.com>
>> Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
>> Tested-by: Heiko Stuebner <heiko@sntech.de>
>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
>
> [...]
>
>> diff --git a/drivers/gpu/drm/rockchip/Makefile b/drivers/gpu/drm/rockchip/Makefile
>> index 3ff7b21c0414..3eab662a5a1d 100644
>> --- a/drivers/gpu/drm/rockchip/Makefile
>> +++ b/drivers/gpu/drm/rockchip/Makefile
>> @@ -11,6 +11,7 @@ rockchipdrm-$(CONFIG_ROCKCHIP_VOP) += rockchip_drm_vop.o rockchip_vop_reg.o
>
>> +static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
>> + void *data)
>> +{
>> + static const char * const clk_names[] = {
>> + "pclk", "earc", "aud", "hdp", "hclk_vo1",
>> + "ref" /* keep "ref" last */
>> + };
>
> [...]
>
>> + for (i = 0; i < ARRAY_SIZE(clk_names); i++) {
>> + clk = devm_clk_get_enabled(hdmi->dev, clk_names[i]);
>> +
>> + if (IS_ERR(clk)) {
>> + ret = PTR_ERR(clk);
>> + if (ret != -EPROBE_DEFER)
>> + drm_err(hdmi, "Failed to get %s clock: %d\n",
>> + clk_names[i], ret);
>> + return ret;
>> + }
>> + }
>> + hdmi->ref_clk = clk;
>
> How about using devm_clk_bulk_get_all_enable() for everything except the
> refclk and a separate call to devm_clk_get_enabled() for that refclk .
This helper seems to be partially broken as it doesn't return the number of
clocks stored in the clk_bulk_data table referenced by the clks argument,
meaning it's not possible to iterate these clocks. I provided a new helper
[1] as a possible fix.
If that gets accepted, we could rewrite this as:
ret = devm_clk_bulk_get_all_enabled(hdmi->dev, &clks);
if (ret < 0) {
drm_err(hdmi, "Failed to get clocks: %d\n", ret);
return ret;
}
for (i = 0; i < ret; i++) {
if (!strcmp(clks[i].id, "ref")) {
hdmi->ref_clk = clks[1].clk;
break;
}
}
if (!hdmi->ref_clk) {
drm_err(hdmi, "Missing ref clock\n");
return -EINVAL;
}
> That hdmi->ref_clk just accidentially falls out of that loop at the end
> looks somewhat strange, so getting and keeping that refclk
> separately would make this look cleaner.
I've added /* keep "ref" last */ comment above, but I agree it's not really
the best approach.
I'm going to submit v7 in the meantime, as this was the last remaining open
topic on my list. I guess we can figure this out afterwards.
Thanks,
Cristian
[1] https://lore.kernel.org/lkml/20240914-clk_bulk_ena_fix-v1-0-ce3537585c06@collabora.com/
next prev parent reply other threads:[~2024-09-14 18:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-06 1:17 [PATCH v6 0/3] Add initial support for the Rockchip RK3588 HDMI TX Controller Cristian Ciocaltea
2024-09-06 1:17 ` [PATCH v6 1/3] drm/bridge: synopsys: Add DW HDMI QP TX Controller support library Cristian Ciocaltea
2024-09-09 15:13 ` Maxime Ripard
2024-09-14 19:12 ` Cristian Ciocaltea
2024-09-23 8:19 ` Maxime Ripard
2024-09-06 1:17 ` [PATCH v6 2/3] dt-bindings: display: rockchip: Add schema for RK3588 HDMI TX Controller Cristian Ciocaltea
2024-09-06 7:40 ` Krzysztof Kozlowski
2024-09-10 15:46 ` Cristian Ciocaltea
2024-09-06 1:17 ` [PATCH v6 3/3] drm/rockchip: Add basic RK3588 HDMI output support Cristian Ciocaltea
2024-09-09 0:42 ` kernel test robot
2024-09-10 11:27 ` Heiko Stübner
2024-09-10 12:06 ` Cristian Ciocaltea
2024-09-10 15:07 ` Heiko Stübner
2024-09-10 15:21 ` Heiko Stübner
2024-09-10 15:41 ` Cristian Ciocaltea
2024-09-10 16:39 ` Heiko Stübner
2024-09-10 20:49 ` Heiko Stübner
2024-09-11 1:51 ` Cristian Ciocaltea
2024-09-10 19:08 ` Heiko Stübner
2024-09-14 18:28 ` Cristian Ciocaltea [this message]
2024-09-15 6:13 ` Heiko Stuebner
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=4766d230-c9c3-414d-a954-3b0c890e7e08@collabora.com \
--to=cristian.ciocaltea@collabora.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=aarnoud@me.com \
--cc=airlied@gmail.com \
--cc=algea.cao@rock-chips.com \
--cc=andrzej.hajda@intel.com \
--cc=andy.yan@rock-chips.com \
--cc=conor+dt@kernel.org \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kernel@collabora.com \
--cc=krzk+dt@kernel.org \
--cc=ldearquer@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=markyao0591@gmail.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®