public inbox for linux-rockchip@lists.infradead.org
 help / color / mirror / Atom feed
From: neil.armstrong@linaro.org
To: Andy Yan <andyshrk@163.com>
Cc: "Cristian Ciocaltea" <cristian.ciocaltea@collabora.com>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"Andrzej Hajda" <andrzej.hajda@intel.com>,
	"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>,
	"Heiko Stübner" <heiko@sntech.de>,
	"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>,
	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 13/14] drm/bridge: synopsys: Add DW HDMI QP TX controller driver
Date: Fri, 14 Jun 2024 10:39:05 +0200	[thread overview]
Message-ID: <37e7b6a5-5345-48cb-996f-c50ec935cded@linaro.org> (raw)
In-Reply-To: <2d8e9235.68f3.19015881d35.Coremail.andyshrk@163.com>

On 14/06/2024 08:56, Andy Yan wrote:
> 
> 
> 
> 
> 
> 
> 
> Hi Neil,
> 
> At 2024-06-05 19:48:09, "Neil Armstrong" <neil.armstrong@linaro.org> wrote:
>> On 05/06/2024 12:11, Cristian Ciocaltea wrote:
>>> On 6/5/24 12:34 AM, Cristian Ciocaltea wrote:
>>>> On 6/4/24 11:41 PM, Sam Ravnborg wrote:
>>>>> Hi Cristian.
>>>>>
>>>>> On Tue, Jun 04, 2024 at 10:32:04PM +0300, Cristian Ciocaltea wrote:
>>>>>> Hi Sam,
>>>>>>
>>>>>> On 6/1/24 5:32 PM, Sam Ravnborg wrote:
>>>>>>> Hi Cristian,
>>>>>>>
>>>>>>> a few drive-by comments below.
>>>>>>>
>>>>>>> 	Sam
>>>>>>>
>>>>>>>
>>>>>>>> +
>>>>>>>> +static const struct drm_connector_funcs dw_hdmi_qp_connector_funcs = {
>>>>>>>> +	.fill_modes = drm_helper_probe_single_connector_modes,
>>>>>>>> +	.detect = dw_hdmi_connector_detect,
>>>>>>>> +	.destroy = drm_connector_cleanup,
>>>>>>>> +	.force = dw_hdmi_qp_connector_force,
>>>>>>>> +	.reset = drm_atomic_helper_connector_reset,
>>>>>>>> +	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
>>>>>>>> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>>>>>>>> +};
>>>>>>>> +
>>>>>>>> +static int dw_hdmi_qp_bridge_attach(struct drm_bridge *bridge,
>>>>>>>> +				    enum drm_bridge_attach_flags flags)
>>>>>>>> +{
>>>>>>>> +	struct dw_hdmi *hdmi = bridge->driver_private;
>>>>>>>> +
>>>>>>>> +	if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
>>>>>>>> +		return drm_bridge_attach(bridge->encoder, hdmi->next_bridge,
>>>>>>>> +					 bridge, flags);
>>>>>>>> +
>>>>>>>> +	return dw_hdmi_connector_create(hdmi, &dw_hdmi_qp_connector_funcs);
>>>>>>>> +}
>>>>>>>
>>>>>>> Are there any users left that requires the display driver to create the
>>>>>>> connector?
>>>>>>> In other words - could this driver fail if DRM_BRIDGE_ATTACH_NO_CONNECTOR
>>>>>>> is not passed and drop dw_hdmi_connector_create()?
>>>>>>>
>>>>>>> I did not try to verify this - just a naive question.
>>>>>>
>>>>>> I've just tested this and it doesn't work - dw_hdmi_connector_create()
>>>>>> is still needed.
>>>>>
>>>>> Hmm, seems the display driver or some other bridge driver fails to
>>>>> support "DRM_BRIDGE_ATTACH_NO_CONNECTOR".
>>>>> what other drivers are involved?
>>>>
>>>> Could it be related to the glue driver (updated in the next patch) which
>>>> is also responsible for setting up the encoder?
>>>>
>>>>> Note that my comments here should be seen as potential future
>>>>> improvements, and do not block the patch from being used.
>>>>
>>>> Thanks for the heads up! Will try to get back to this soon and investigate.
>>>    
>>> IIUC, modern bridges should not create the connector but rely on display
>>> drivers to take care of, which in this case is the VOP2 driver. However,
>>> it also handles some of the older SoCs relying on the non-QP variant of
>>> DW HDMI IP. Hence the existing dw-hdmi driver would be also impacted in
>>> order to come up with a proper solution.
>>>
>>> A quick check shows there are several users of this IP:
>>>
>>> $ git grep -E '= dw_hdmi_(bind|probe)\('
>>> drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c:    hdmi->dw_hdmi = dw_hdmi_probe(pdev, plat_data);
>>> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c:      hdmi = dw_hdmi_probe(pdev, plat_data);
>>> drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c:        hdmi->hdmi = dw_hdmi_probe(pdev, match->data);
>>> drivers/gpu/drm/ingenic/ingenic-dw-hdmi.c:      hdmi = dw_hdmi_probe(pdev, &ingenic_dw_hdmi_plat_data);
>>> drivers/gpu/drm/meson/meson_dw_hdmi.c:  meson_dw_hdmi->hdmi = dw_hdmi_probe(pdev, &meson_dw_hdmi->dw_plat_data);
>>> drivers/gpu/drm/renesas/rcar-du/rcar_dw_hdmi.c: hdmi = dw_hdmi_probe(pdev, &rcar_dw_hdmi_plat_data);
>>> drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c:            hdmi->hdmi = dw_hdmi_bind(pdev, encoder, plat_data);
>>> drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c:  hdmi->hdmi = dw_hdmi_bind(pdev, encoder, plat_data);
>>>
>>> I didn't check which display drivers would be involved, I'd guess there
>>> are quite a few of them as well. So it seems this ends up being a pretty
>>> complex task.
>>
>> If this would be a brand new driver, then it should only support DRM_BRIDGE_ATTACH_NO_CONNECTOR,
>> so you should not create a connector from the driver.
>>
>> The fact dw-hdmi accepts an attach without the flag is for legacy purpose
>> since some DRM drivers haven't switched to DRM_BRIDGE_ATTACH_NO_CONNECTOR yes,
>> but it's a requirement for new bridges so at some point you'll need to make
>> sure the rockchip glue and drm driver supports DRM_BRIDGE_ATTACH_NO_CONNECTOR.
>>
>> This will greatly simplify the driver!
> 
> Based on the previous discussion, the DW HDMI QP drivers will be implemented like this:
> 
> Core bridge library:
>   drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
> Rockchip platform specific glue:
> drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> 
> As a new bridge driver should only support DRM_BRIDGE_ATTACH_NO_CONNECTOR,
> Is it acceptable if we implement the connector at  the rockchip glue dw_hdmi_qp-rockchip.c ?
> 
> Our current combination is a bit complex:
> The display controller driver is  drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ,which shared
> by rk3568, rk3588 and some upcoming soc like rk3528/rk3562.
> 
> For rk3588, we have totally new HDMI、DP、DSI2  IP, they need brand new bridge driver that
> should only support DRM_BRIDGE_ATTACH_NO_CONNECTOR, and there is also an eDP on rk3588
> use analogix_dp_core.c that create connector by analogix_dp bridge。
> 
> For  rk3568, the HDMI/eDP/DSI IP are based on old IP, the corresponding drivers are dw-hdmi,analogix_dp
> and dw-mipi-dsi, they both create drm connector by it's bridge driver. And rk3528/rk3562 are like this too。
> 
> So if we can create drm_connector at glue side (such as dw_hdmi_qp-rockchip.c), let the interface driver decide
> if it should create drm_connector or not will make the vop2 driver simpler。

I think you should start migration to drm_bridge_connector instead of hacking dw_hdmi_qp-rockchip.c into
fitting into DRM_BRIDGE_ATTACH_NO_CONNECTOR.

You'll add technical dept, and the migration will be even harder afterwards.

But in any case, bridge/synopsys/dw-hdmi-qp.c and rockchip/dw_hdmi_qp-rockchip.c should be send
in two separate patchsets, so how rockchip DRM_BRIDGE_ATTACH_NO_CONNECTOR is a different story.

Neil

> 
> 
> 
> 
> 
>>
>> Neil
>>
>>>
>>> Cristian


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  parent reply	other threads:[~2024-06-14  8:39 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-01 13:12 [PATCH 00/14] Add initial support for the Rockchip RK3588 HDMI TX Controller Cristian Ciocaltea
2024-06-01 13:12 ` [PATCH 01/14] drm/bridge: dw-hdmi: Simplify clock handling Cristian Ciocaltea
2024-06-01 13:12 ` [PATCH 02/14] drm/bridge: dw-hdmi: Add dw-hdmi-common.h header Cristian Ciocaltea
2024-06-01 13:12 ` [PATCH 03/14] drm/bridge: dw-hdmi: Commonize dw_hdmi_i2c_adapter() Cristian Ciocaltea
2024-06-01 13:12 ` [PATCH 04/14] drm/bridge: dw-hdmi: Factor out AVI infoframe setup Cristian Ciocaltea
2024-06-01 13:12 ` [PATCH 05/14] drm/bridge: dw-hdmi: Factor out vmode setup Cristian Ciocaltea
2024-06-01 13:12 ` [PATCH 06/14] drm/bridge: dw-hdmi: Factor out hdmi_data_info setup Cristian Ciocaltea
2024-06-01 13:12 ` [PATCH 07/14] drm/bridge: dw-hdmi: Commonize dw_hdmi_connector_create() Cristian Ciocaltea
2024-06-01 13:12 ` [PATCH 08/14] drm/rockchip: dw_hdmi: Use modern drm_device based logging Cristian Ciocaltea
2024-06-01 13:12 ` [PATCH 09/14] drm/rockchip: dw_hdmi: Simplify clock handling Cristian Ciocaltea
2024-06-01 13:12 ` [PATCH 10/14] drm/rockchip: dw_hdmi: Use devm_regulator_get_enable() Cristian Ciocaltea
2024-06-01 13:12 ` [PATCH 11/14] drm/rockchip: dw_hdmi: Drop superfluous assignments of mpll_cfg, cur_ctr and phy_config Cristian Ciocaltea
2024-06-01 13:12 ` [PATCH 12/14] dt-bindings: display: rockchip,dw-hdmi: Add compatible for RK3588 Cristian Ciocaltea
2024-06-05 23:22   ` Rob Herring
2024-06-06 11:51     ` Cristian Ciocaltea
2024-06-06 14:58       ` Rob Herring
2024-06-06 19:28         ` Cristian Ciocaltea
2024-07-29  2:04       ` Andy Yan
2024-06-01 13:12 ` [PATCH 13/14] drm/bridge: synopsys: Add DW HDMI QP TX controller driver Cristian Ciocaltea
2024-06-01 14:32   ` Sam Ravnborg
2024-06-04 19:32     ` Cristian Ciocaltea
2024-06-04 20:41       ` Sam Ravnborg
2024-06-04 21:34         ` Cristian Ciocaltea
2024-06-05 10:11           ` Cristian Ciocaltea
2024-06-05 11:48             ` Neil Armstrong
2024-06-05 13:57               ` Cristian Ciocaltea
2024-06-14  6:56               ` Andy Yan
2024-06-14  8:34                 ` Maxime Ripard
2024-06-14  8:39                 ` neil.armstrong [this message]
2024-06-05 14:48   ` Heiko Stübner
2024-06-05 19:58     ` Luis de Arquer
2024-06-05 22:16       ` Heiko Stübner
2024-06-06  9:53     ` Cristian Ciocaltea
2024-06-06 10:16       ` Heiko Stübner
2024-06-06 11:32         ` Cristian Ciocaltea
2024-06-01 13:12 ` [PATCH 14/14] drm/rockchip: dw_hdmi: Add basic RK3588 support Cristian Ciocaltea
2024-06-01 14:50   ` kernel test robot
2024-06-01 17:15   ` kernel test robot
2024-06-01 16:32 ` [PATCH 00/14] Add initial support for the Rockchip RK3588 HDMI TX Controller Dmitry Baryshkov
2024-06-04 19:44   ` Cristian Ciocaltea
2024-06-04 23:49     ` Dmitry Baryshkov
2024-06-02  7:59 ` Piotr Oniszczuk
2024-06-04 19:59   ` Cristian Ciocaltea
2024-06-03  8:55 ` Neil Armstrong
2024-06-03 12:14   ` Andy Yan
2024-06-03 13:03     ` Heiko Stuebner
2024-06-03 13:08       ` neil.armstrong
2024-06-04 20:33         ` Cristian Ciocaltea
2024-06-05  9:25           ` Andy Yan
2024-06-05  9:28             ` neil.armstrong
2024-06-05  9:39               ` Maxime Ripard
2024-06-05  9:49                 ` Andy Yan
2024-06-05 11:20                   ` Cristian Ciocaltea
2024-06-03 16:22       ` Maxime Ripard
2024-07-14 19:03 ` Piotr Oniszczuk

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=37e7b6a5-5345-48cb-996f-c50ec935cded@linaro.org \
    --to=neil.armstrong@linaro.org \
    --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=andyshrk@163.com \
    --cc=conor+dt@kernel.org \
    --cc=cristian.ciocaltea@collabora.com \
    --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=rfoss@kernel.org \
    --cc=robh@kernel.org \
    --cc=sam@ravnborg.org \
    --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