Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Damon Ding <damon.ding@rock-chips.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org,
	rfoss@kernel.org, Laurent.pinchart@ideasonboard.com,
	jonas@kwiboo.se, jernej.skrabec@gmail.com,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
	jingoohan1@gmail.com, inki.dae@samsung.com,
	sw0312.kim@samsung.com, kyungmin.park@samsung.com,
	krzk@kernel.org, alim.akhtar@samsung.com, hjc@rock-chips.com,
	heiko@sntech.de, andy.yan@rock-chips.com, dianders@chromium.org,
	m.szyprowski@samsung.com, luca.ceresoli@bootlin.com,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v5 10/17] drm/bridge: analogix_dp: Apply drm_bridge_connector helper
Date: Thu, 25 Sep 2025 15:33:45 +0800	[thread overview]
Message-ID: <7babd32a-6b20-4e4b-9c40-594520a183bb@rock-chips.com> (raw)
In-Reply-To: <ykj7xrnpagbtftr7wt2vkyc4d4u4k5nmxsir433jzz7lhc3oq3@gaq4kicsrlpr>

Hi Dmitry,

On 9/25/2025 11:37 AM, Dmitry Baryshkov wrote:
> On Wed, Sep 24, 2025 at 05:14:57PM +0800, Damon Ding wrote:
>> Hi Dmitry,
>>
>> On 9/12/2025 7:03 PM, Dmitry Baryshkov wrote:
>>> On Fri, Sep 12, 2025 at 04:58:39PM +0800, Damon Ding wrote:
>>>> Apply drm_bridge_connector helper for Analogix DP driver.
>>>>
>>>> The following changes have been made:
>>>> - Apply drm_bridge_connector helper to get rid of &drm_connector_funcs
>>>>     and &drm_connector_helper_funcs.
>>>> - Remove unnecessary parameter struct drm_connector* for callback
>>>>     &analogix_dp_plat_data.attach.
>>>> - Remove &analogix_dp_device.connector.
>>>> - Convert analogix_dp_atomic_check()/analogix_dp_detect() to
>>>>     &drm_bridge_funcs.atomic_check()/&drm_bridge_funcs.detect().
>>>> - Split analogix_dp_get_modes() into &drm_bridge_funcs.get_modes() and
>>>>     &drm_bridge_funcs.edid_read().
>>>>
>>>> Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
>>>>
>>>> ------
>>>>
>>>> Changes in v2:
>>>> - For &drm_bridge.ops, remove DRM_BRIDGE_OP_HPD and add
>>>>     DRM_BRIDGE_OP_EDID.
>>>> - Add analogix_dp_bridge_edid_read().
>>>> - Move &analogix_dp_plat_data.skip_connector deletion to the previous
>>>>     patches.
>>>>
>>>> Changes in v3:
>>>> - Rebase with the new devm_drm_bridge_alloc() related commit
>>>>     48f05c3b4b70 ("drm/bridge: analogix_dp: Use devm_drm_bridge_alloc()
>>>>     API").
>>>> - Expand the commit message.
>>>> - Call drm_bridge_get_modes() in analogix_dp_bridge_get_modes() if the
>>>>     bridge is available.
>>>> - Remove unnecessary parameter struct drm_connector* for callback
>>>>     &analogix_dp_plat_data.attach.
>>>> - In order to decouple the connector driver and the bridge driver, move
>>>>     the bridge connector initilization to the Rockchip and Exynos sides.
>>>>
>>>> Changes in v4:
>>>> - Expand analogix_dp_bridge_detect() parameters to &drm_bridge and
>>>>     &drm_connector.
>>>> - Rename the &analogix_dp_plat_data.bridge to
>>>>     &analogix_dp_plat_data.next_bridge.
>>>>
>>>> Changes in v5:
>>>> - Set the flag fo drm_bridge_attach() to DRM_BRIDGE_ATTACH_NO_CONNECTOR
>>>>     for next bridge attachment of Exynos side.
>>>> - Distinguish the &drm_bridge->ops of Analogix bridge based on whether
>>>>     the downstream device is a panel, a bridge or neither.
>>>> - Remove the calls to &analogix_dp_plat_data.get_modes().
>>>> ---
>>>>    .../drm/bridge/analogix/analogix_dp_core.c    | 151 ++++++++----------
>>>>    .../drm/bridge/analogix/analogix_dp_core.h    |   1 -
>>>>    drivers/gpu/drm/exynos/exynos_dp.c            |  25 +--
>>>>    .../gpu/drm/rockchip/analogix_dp-rockchip.c   |  11 +-
>>>>    include/drm/bridge/analogix_dp.h              |   3 +-
>>>>    5 files changed, 95 insertions(+), 96 deletions(-)
>>>>
>>>> @@ -1532,6 +1487,7 @@ EXPORT_SYMBOL_GPL(analogix_dp_resume);
>>>>    int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev)
>>>>    {
>>>> +	struct drm_bridge *bridge = &dp->bridge;
>>>>    	int ret;
>>>>    	dp->drm_dev = drm_dev;
>>>> @@ -1545,7 +1501,23 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev)
>>>>    		return ret;
>>>>    	}
>>>> -	ret = drm_bridge_attach(dp->encoder, &dp->bridge, NULL, 0);
>>>> +	if (dp->plat_data->panel)
>>>> +		/* If the next is a panel, the EDID parsing is checked by the panel driver */
>>>> +		bridge->ops = DRM_BRIDGE_OP_MODES | DRM_BRIDGE_OP_DETECT;
>>>> +	else if (dp->plat_data->next_bridge)
>>>> +		/* If the next is a bridge, the supported operations depend on the next bridge */
>>>> +		bridge->ops = 0;
>>>
>>> And what if the next bridge is dp_connector without a separate HPD pin?
>>
>> This case was indeed not taken into account.
>>
>> If the next is a bridge, it should be better to set DRM_BRIDGE_OP_DETECT and
>> return connector_status_connected in analogix_dp_bridge_detect(). This
>> ensures the connection status remains connected for both the dp-connector
>> and the bridges without DRM_BRIDGE_OP_DETECT.
> 
> Maybe OP_EDID | OP_DETECT? I think, we need to fix drm_bridge_connector
> to stop preferring OP_EDID bridges over OP_MODES if the latter one is
> enountered later in the chain. In other words inside
> drm_bridge_connector_init() clear bridge_edid if OP_MODES is encountered
> and vice versa. This way you can always declare OP_EDID here (after
> converting to panel bridge) and then letting panel's OP_MODES take over
> mode declaration. Would you please include such a patch in the next
> iteration?
> 

I see. Following your suggestions, the logic will be:

1.If the later bridge declares OP_MODES and 
&drm_bridge_connector.bridge_edid already exists, the 
&drm_bridge_connector.bridge_edid should be set to NULL.
2.If the later bridge declares OP_EDID and 
&drm_bridge_connector.bridge_modes already exists, the 
&drm_bridge_connector.bridge_modes should be set to NULL.
3.If the later bridge declares both OP_EDID and OP_MODES, set 
&drm_bridge_connector.bridge_modes and &drm_bridge_connector.bridge_edid 
to it(preserving the existing behavior).

I will add a new commit with necessary code comments to implement this 
in v6.

>>
>>>
>>>> +	else
>>>> +		/* In DP mode, the EDID parsing and HPD detection should be supported */
>>>> +		bridge->ops = DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_DETECT;
>>>> +
>>>> +	bridge->of_node = dp->dev->of_node;
>>>> +	bridge->type = DRM_MODE_CONNECTOR_eDP;
>>>> +	ret = devm_drm_bridge_add(dp->dev, &dp->bridge);
>>>> +	if (ret)
>>>> +		goto err_unregister_aux;
>>>> +
>>>> +	ret = drm_bridge_attach(dp->encoder, bridge, NULL, 0);
>>>>    	if (ret) {
>>>>    		DRM_ERROR("failed to create bridge (%d)\n", ret);
>>>>    		goto err_unregister_aux;
>>>
>>

Best regards,
Damon


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

  reply	other threads:[~2025-09-25  7:33 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20250912085902eucas1p2b611b4afd6b453c161753f50386a6d01@eucas1p2.samsung.com>
2025-09-12  8:58 ` [PATCH v5 00/17] Apply drm_bridge_connector and panel_bridge helper for the Analogix DP driver Damon Ding
2025-09-12  8:58   ` [PATCH v5 01/17] drm/bridge: analogix_dp: Formalize the struct analogix_dp_device Damon Ding
2025-09-12  8:58   ` [PATCH v5 02/17] drm/bridge: analogix_dp: Move &drm_bridge_funcs.mode_set to &drm_bridge_funcs.atomic_enable Damon Ding
2025-09-12  8:58   ` [PATCH v5 03/17] drm/bridge: analogix_dp: Add &analogix_dp_plat_data.next_bridge Damon Ding
2025-09-12  8:58   ` [PATCH v5 04/17] drm/exynos: exynos_dp: Remove &exynos_dp_device.ptn_bridge Damon Ding
2025-09-12  8:58   ` [PATCH v5 05/17] drm/exynos: exynos_dp: Remove unused &exynos_dp_device.connector Damon Ding
2025-09-12  8:58   ` [PATCH v5 06/17] drm/bridge: analogix_dp: Remove redundant &analogix_dp_plat_data.skip_connector Damon Ding
2025-09-12  8:58   ` [PATCH v5 07/17] drm/exynos: exynos_dp: Add legacy bridge to parse the display-timings node Damon Ding
2025-09-12 10:51     ` Dmitry Baryshkov
2025-09-24  7:58       ` Damon Ding
2025-09-12  8:58   ` [PATCH v5 08/17] drm/bridge: analogix_dp: Move the color format check to .atomic_check() for Rockchip platforms Damon Ding
2025-09-12  8:58   ` [PATCH v5 09/17] drm/bridge: analogix_dp: Remove unused &analogix_dp_plat_data.get_modes() Damon Ding
2025-09-12  8:58   ` [PATCH v5 10/17] drm/bridge: analogix_dp: Apply drm_bridge_connector helper Damon Ding
2025-09-12 11:03     ` Dmitry Baryshkov
2025-09-24  9:14       ` Damon Ding
2025-09-25  3:37         ` Dmitry Baryshkov
2025-09-25  7:33           ` Damon Ding [this message]
2025-09-25 22:21             ` Dmitry Baryshkov
2025-09-12  8:58   ` [PATCH v5 11/17] drm/bridge: analogix_dp: Add new API analogix_dp_finish_probe() Damon Ding
2025-09-12 11:04     ` Dmitry Baryshkov
2025-09-12  8:58   ` [PATCH v5 12/17] drm/rockchip: analogix_dp: Apply analogix_dp_finish_probe() Damon Ding
2025-09-12  8:58   ` [PATCH v5 13/17] drm/rockchip: analogix_dp: Apply &analogix_dp_plat_data.attach() to attach next bridge Damon Ding
2025-09-12 11:05     ` Dmitry Baryshkov
2025-09-25  2:11       ` Damon Ding
2025-09-12  8:58   ` [PATCH v5 14/17] drm/exynos: exynos_dp: Apply analogix_dp_finish_probe() Damon Ding
2025-09-12  8:58   ` [PATCH v5 15/17] drm/bridge: analogix_dp: Remove panel disabling and enabling in analogix_dp_set_bridge() Damon Ding
2025-09-12 11:09     ` Dmitry Baryshkov
2025-09-25  2:19       ` Damon Ding
2025-09-12  8:58   ` [PATCH v5 16/17] drm/bridge: analogix_dp: Remove bridge disabing and panel unpreparing in analogix_dp_unbind() Damon Ding
2025-09-12 11:06     ` Dmitry Baryshkov
2025-09-12  9:56   ` [PATCH v5 00/17] Apply drm_bridge_connector and panel_bridge helper for the Analogix DP driver Marek Szyprowski
2025-09-12 10:36     ` Damon Ding
2025-09-12 11:07   ` Dmitry Baryshkov

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=7babd32a-6b20-4e4b-9c40-594520a183bb@rock-chips.com \
    --to=damon.ding@rock-chips.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=alim.akhtar@samsung.com \
    --cc=andrzej.hajda@intel.com \
    --cc=andy.yan@rock-chips.com \
    --cc=dianders@chromium.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=inki.dae@samsung.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jingoohan1@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=m.szyprowski@samsung.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=sw0312.kim@samsung.com \
    --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