All of lore.kernel.org
 help / color / mirror / Atom feed
From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
To: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Enric Balletbo Serra <eballetbo@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Collabora Kernel ML <kernel@collabora.com>,
	Nicolas Boichat <drinkcat@chromium.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	David Airlie <airlied@linux.ie>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"moderated list:ARM/Mediatek SoC support" 
	<linux-mediatek@lists.infradead.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v4 7/7] drm/mediatek: mtk_dsi: Create connector for bridges
Date: Thu, 14 May 2020 19:12:55 +0200	[thread overview]
Message-ID: <37191700-5832-2931-5764-7f7fddd023b9@collabora.com> (raw)
In-Reply-To: <CAAOTY__b6V12fS2xTKGjB1fQTfRjX7AQyBqDPXzshfhkjjSkeQ@mail.gmail.com>

Hi Chun-Kuang,

On 14/5/20 18:44, Chun-Kuang Hu wrote:
> Hi, Enric:
> 
> Enric Balletbo i Serra <enric.balletbo@collabora.com> 於 2020年5月14日 週四 下午11:42寫道:
>>
>> Hi Chun-Kuang,
>>
>> On 14/5/20 16:28, Chun-Kuang Hu wrote:
>>> Hi, Enric:
>>>
>>> Enric Balletbo Serra <eballetbo@gmail.com> 於 2020年5月14日 週四 上午12:41寫道:
>>>>
>>>> Hi Chun-Kuang,
>>>>
>>>> Missatge de Enric Balletbo i Serra <enric.balletbo@collabora.com> del
>>>> dia dv., 1 de maig 2020 a les 17:25:
>>>>>
>>>>> Use the drm_bridge_connector helper to create a connector for pipelines
>>>>> that use drm_bridge. This allows splitting connector operations across
>>>>> multiple bridges when necessary, instead of having the last bridge in
>>>>> the chain creating the connector and handling all connector operations
>>>>> internally.
>>>>>
>>>>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>>>>> Acked-by: Sam Ravnborg <sam@ravnborg.org>
>>>>
>>>> A gentle ping on this, I think that this one is the only one that
>>>> still needs a review in the series.
>>>
>>> This is what I reply in patch v3:
>>>
>>
>> Sorry for missing this.
>>
>>> I think the panel is wrapped into next_bridge here,
>>>
>>
>> Yes, you can have for example:
>>
>> 1. drm_bridge (mtk_dsi) -> drm_bridge (ps8640 - dsi-to-edp) -> drm_panel_bridge
>> (edp panel)
>>
>> or a
>>
>> 2. drm_bridge (mtk_dsi)-> drm_panel_bridge (dsi panel)
>>
>> The _first_ one is my use case
>>
>>> if (panel) {
>>
>> This handles the second case, where you attach a dsi panel.
>>
>>>     dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);
>>>
>>> so the next_bridge is a panel_bridge, in its attach function
>>> panel_bridge_attach(),
>>> according to the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR, if not exist,
>>> it would create connector and attach connector to panel.
>>>
>>> I'm not sure this flag would exist or not, but for both case, it's strange.
>>> If exist, you create connector in this patch but no where to attach
>>> connector to panel.
>>
>> Yes, in fact, this is transitional patch needed, as once I converted mtk_dpi,
>> mtk_dsi and mtk_hdmi to the new drm_bridge API the drm_bridge_connector_init()
>> will be done in mtk_drm_drv. We will need to call drm_bridge_connector_init for
>> dpi and dsi pipes and remove that call from mtk_dsi and mtk_dpi drivers. The
>> graphic controller driver should create connectors and CRTCs, as example you can
>> take a look at drivers/gpu/drm/omapdrm/omap_drv.c
>>
> 
> I have such question because I've reviewed omap's driver. In omap's
> driver, after it call drm_bridge_connector_init(), it does this:
> 
> if (pipe->output->panel) {
> ret = drm_panel_attach(pipe->output->panel,
>       pipe->connector);
> if (ret < 0)
> return ret;
> }
> 
> In this patch, you does not do this.
> 

I see, so yes, I am probably missing call drm_panel_attach in case there is a
direct panel attached. Thanks for pointing it.

I'll send a new version adding the drm_panel_attach call.

>>> If not exist, the next_brige would create one connector and this brige
>>> would create another connector.
>>>
>>> I think in your case, mtk_dsi does not directly connect to a panel, so
>>
>> Exactly
>>
>>> I need a exact explain. Or someone could test this on a
>>> directly-connect-panel platform.
>>
>> I don't think I am breaking this use case but AFAICS there is no users in
>> mainline that directly connect a panel using the mediatek driver. As I said my
>> use case is the other so I can't really test. Do you know anyone that can test this?
> 
> I'm not sure who can test this, but [1], which is sent by YT Shen in a
> series, is a patch to support dsi command mode so dsi could directly
> connect to panel.
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/mediatek?h=v5.7-rc5&id=21898816831fc60c92dd634ab4316a24da7eb4af
> 
> It's better that someone could test this case, but if no one would
> test this, I could also accept a good-look patch.
> 
> Regards,
> Chun-Kuang.
> 
>>
>> Thanks,
>>  Enric
>>
>>>
>>> Regards,
>>> Chun-Kuang.
>>>
>>>>
>>>> Thanks,
>>>>  Enric
>>>>
>>>>> ---
>>>>>
>>>>> Changes in v4: None
>>>>> Changes in v3:
>>>>> - Move the bridge.type line to the patch that adds drm_bridge support. (Laurent Pinchart)
>>>>>
>>>>> Changes in v2: None
>>>>>
>>>>>  drivers/gpu/drm/mediatek/mtk_dsi.c | 13 ++++++++++++-
>>>>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
>>>>> index 4f3bd095c1ee..471fcafdf348 100644
>>>>> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
>>>>> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
>>>>> @@ -17,6 +17,7 @@
>>>>>
>>>>>  #include <drm/drm_atomic_helper.h>
>>>>>  #include <drm/drm_bridge.h>
>>>>> +#include <drm/drm_bridge_connector.h>
>>>>>  #include <drm/drm_mipi_dsi.h>
>>>>>  #include <drm/drm_of.h>
>>>>>  #include <drm/drm_panel.h>
>>>>> @@ -183,6 +184,7 @@ struct mtk_dsi {
>>>>>         struct drm_encoder encoder;
>>>>>         struct drm_bridge bridge;
>>>>>         struct drm_bridge *next_bridge;
>>>>> +       struct drm_connector *connector;
>>>>>         struct phy *phy;
>>>>>
>>>>>         void __iomem *regs;
>>>>> @@ -977,10 +979,19 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
>>>>>          */
>>>>>         dsi->encoder.possible_crtcs = 1;
>>>>>
>>>>> -       ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, 0);
>>>>> +       ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL,
>>>>> +                               DRM_BRIDGE_ATTACH_NO_CONNECTOR);
>>>>>         if (ret)
>>>>>                 goto err_cleanup_encoder;
>>>>>
>>>>> +       dsi->connector = drm_bridge_connector_init(drm, &dsi->encoder);
>>>>> +       if (IS_ERR(dsi->connector)) {
>>>>> +               DRM_ERROR("Unable to create bridge connector\n");
>>>>> +               ret = PTR_ERR(dsi->connector);
>>>>> +               goto err_cleanup_encoder;
>>>>> +       }
>>>>> +       drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>>>>> +
>>>>>         return 0;
>>>>>
>>>>>  err_cleanup_encoder:
>>>>> --
>>>>> 2.26.2
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Linux-mediatek mailing list
>>>>> Linux-mediatek@lists.infradead.org
>>>>> http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
To: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Nicolas Boichat <drinkcat@chromium.org>,
	Daniel Vetter <daniel@ffwll.ch>,
	Enric Balletbo Serra <eballetbo@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	David Airlie <airlied@linux.ie>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Collabora Kernel ML <kernel@collabora.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v4 7/7] drm/mediatek: mtk_dsi: Create connector for bridges
Date: Thu, 14 May 2020 19:12:55 +0200	[thread overview]
Message-ID: <37191700-5832-2931-5764-7f7fddd023b9@collabora.com> (raw)
In-Reply-To: <CAAOTY__b6V12fS2xTKGjB1fQTfRjX7AQyBqDPXzshfhkjjSkeQ@mail.gmail.com>

Hi Chun-Kuang,

On 14/5/20 18:44, Chun-Kuang Hu wrote:
> Hi, Enric:
> 
> Enric Balletbo i Serra <enric.balletbo@collabora.com> 於 2020年5月14日 週四 下午11:42寫道:
>>
>> Hi Chun-Kuang,
>>
>> On 14/5/20 16:28, Chun-Kuang Hu wrote:
>>> Hi, Enric:
>>>
>>> Enric Balletbo Serra <eballetbo@gmail.com> 於 2020年5月14日 週四 上午12:41寫道:
>>>>
>>>> Hi Chun-Kuang,
>>>>
>>>> Missatge de Enric Balletbo i Serra <enric.balletbo@collabora.com> del
>>>> dia dv., 1 de maig 2020 a les 17:25:
>>>>>
>>>>> Use the drm_bridge_connector helper to create a connector for pipelines
>>>>> that use drm_bridge. This allows splitting connector operations across
>>>>> multiple bridges when necessary, instead of having the last bridge in
>>>>> the chain creating the connector and handling all connector operations
>>>>> internally.
>>>>>
>>>>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>>>>> Acked-by: Sam Ravnborg <sam@ravnborg.org>
>>>>
>>>> A gentle ping on this, I think that this one is the only one that
>>>> still needs a review in the series.
>>>
>>> This is what I reply in patch v3:
>>>
>>
>> Sorry for missing this.
>>
>>> I think the panel is wrapped into next_bridge here,
>>>
>>
>> Yes, you can have for example:
>>
>> 1. drm_bridge (mtk_dsi) -> drm_bridge (ps8640 - dsi-to-edp) -> drm_panel_bridge
>> (edp panel)
>>
>> or a
>>
>> 2. drm_bridge (mtk_dsi)-> drm_panel_bridge (dsi panel)
>>
>> The _first_ one is my use case
>>
>>> if (panel) {
>>
>> This handles the second case, where you attach a dsi panel.
>>
>>>     dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);
>>>
>>> so the next_bridge is a panel_bridge, in its attach function
>>> panel_bridge_attach(),
>>> according to the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR, if not exist,
>>> it would create connector and attach connector to panel.
>>>
>>> I'm not sure this flag would exist or not, but for both case, it's strange.
>>> If exist, you create connector in this patch but no where to attach
>>> connector to panel.
>>
>> Yes, in fact, this is transitional patch needed, as once I converted mtk_dpi,
>> mtk_dsi and mtk_hdmi to the new drm_bridge API the drm_bridge_connector_init()
>> will be done in mtk_drm_drv. We will need to call drm_bridge_connector_init for
>> dpi and dsi pipes and remove that call from mtk_dsi and mtk_dpi drivers. The
>> graphic controller driver should create connectors and CRTCs, as example you can
>> take a look at drivers/gpu/drm/omapdrm/omap_drv.c
>>
> 
> I have such question because I've reviewed omap's driver. In omap's
> driver, after it call drm_bridge_connector_init(), it does this:
> 
> if (pipe->output->panel) {
> ret = drm_panel_attach(pipe->output->panel,
>       pipe->connector);
> if (ret < 0)
> return ret;
> }
> 
> In this patch, you does not do this.
> 

I see, so yes, I am probably missing call drm_panel_attach in case there is a
direct panel attached. Thanks for pointing it.

I'll send a new version adding the drm_panel_attach call.

>>> If not exist, the next_brige would create one connector and this brige
>>> would create another connector.
>>>
>>> I think in your case, mtk_dsi does not directly connect to a panel, so
>>
>> Exactly
>>
>>> I need a exact explain. Or someone could test this on a
>>> directly-connect-panel platform.
>>
>> I don't think I am breaking this use case but AFAICS there is no users in
>> mainline that directly connect a panel using the mediatek driver. As I said my
>> use case is the other so I can't really test. Do you know anyone that can test this?
> 
> I'm not sure who can test this, but [1], which is sent by YT Shen in a
> series, is a patch to support dsi command mode so dsi could directly
> connect to panel.
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/mediatek?h=v5.7-rc5&id=21898816831fc60c92dd634ab4316a24da7eb4af
> 
> It's better that someone could test this case, but if no one would
> test this, I could also accept a good-look patch.
> 
> Regards,
> Chun-Kuang.
> 
>>
>> Thanks,
>>  Enric
>>
>>>
>>> Regards,
>>> Chun-Kuang.
>>>
>>>>
>>>> Thanks,
>>>>  Enric
>>>>
>>>>> ---
>>>>>
>>>>> Changes in v4: None
>>>>> Changes in v3:
>>>>> - Move the bridge.type line to the patch that adds drm_bridge support. (Laurent Pinchart)
>>>>>
>>>>> Changes in v2: None
>>>>>
>>>>>  drivers/gpu/drm/mediatek/mtk_dsi.c | 13 ++++++++++++-
>>>>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
>>>>> index 4f3bd095c1ee..471fcafdf348 100644
>>>>> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
>>>>> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
>>>>> @@ -17,6 +17,7 @@
>>>>>
>>>>>  #include <drm/drm_atomic_helper.h>
>>>>>  #include <drm/drm_bridge.h>
>>>>> +#include <drm/drm_bridge_connector.h>
>>>>>  #include <drm/drm_mipi_dsi.h>
>>>>>  #include <drm/drm_of.h>
>>>>>  #include <drm/drm_panel.h>
>>>>> @@ -183,6 +184,7 @@ struct mtk_dsi {
>>>>>         struct drm_encoder encoder;
>>>>>         struct drm_bridge bridge;
>>>>>         struct drm_bridge *next_bridge;
>>>>> +       struct drm_connector *connector;
>>>>>         struct phy *phy;
>>>>>
>>>>>         void __iomem *regs;
>>>>> @@ -977,10 +979,19 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
>>>>>          */
>>>>>         dsi->encoder.possible_crtcs = 1;
>>>>>
>>>>> -       ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, 0);
>>>>> +       ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL,
>>>>> +                               DRM_BRIDGE_ATTACH_NO_CONNECTOR);
>>>>>         if (ret)
>>>>>                 goto err_cleanup_encoder;
>>>>>
>>>>> +       dsi->connector = drm_bridge_connector_init(drm, &dsi->encoder);
>>>>> +       if (IS_ERR(dsi->connector)) {
>>>>> +               DRM_ERROR("Unable to create bridge connector\n");
>>>>> +               ret = PTR_ERR(dsi->connector);
>>>>> +               goto err_cleanup_encoder;
>>>>> +       }
>>>>> +       drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>>>>> +
>>>>>         return 0;
>>>>>
>>>>>  err_cleanup_encoder:
>>>>> --
>>>>> 2.26.2
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Linux-mediatek mailing list
>>>>> Linux-mediatek@lists.infradead.org
>>>>> http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

WARNING: multiple messages have this Message-ID (diff)
From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
To: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Nicolas Boichat <drinkcat@chromium.org>,
	Daniel Vetter <daniel@ffwll.ch>,
	Enric Balletbo Serra <eballetbo@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	David Airlie <airlied@linux.ie>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Collabora Kernel ML <kernel@collabora.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v4 7/7] drm/mediatek: mtk_dsi: Create connector for bridges
Date: Thu, 14 May 2020 19:12:55 +0200	[thread overview]
Message-ID: <37191700-5832-2931-5764-7f7fddd023b9@collabora.com> (raw)
In-Reply-To: <CAAOTY__b6V12fS2xTKGjB1fQTfRjX7AQyBqDPXzshfhkjjSkeQ@mail.gmail.com>

Hi Chun-Kuang,

On 14/5/20 18:44, Chun-Kuang Hu wrote:
> Hi, Enric:
> 
> Enric Balletbo i Serra <enric.balletbo@collabora.com> 於 2020年5月14日 週四 下午11:42寫道:
>>
>> Hi Chun-Kuang,
>>
>> On 14/5/20 16:28, Chun-Kuang Hu wrote:
>>> Hi, Enric:
>>>
>>> Enric Balletbo Serra <eballetbo@gmail.com> 於 2020年5月14日 週四 上午12:41寫道:
>>>>
>>>> Hi Chun-Kuang,
>>>>
>>>> Missatge de Enric Balletbo i Serra <enric.balletbo@collabora.com> del
>>>> dia dv., 1 de maig 2020 a les 17:25:
>>>>>
>>>>> Use the drm_bridge_connector helper to create a connector for pipelines
>>>>> that use drm_bridge. This allows splitting connector operations across
>>>>> multiple bridges when necessary, instead of having the last bridge in
>>>>> the chain creating the connector and handling all connector operations
>>>>> internally.
>>>>>
>>>>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>>>>> Acked-by: Sam Ravnborg <sam@ravnborg.org>
>>>>
>>>> A gentle ping on this, I think that this one is the only one that
>>>> still needs a review in the series.
>>>
>>> This is what I reply in patch v3:
>>>
>>
>> Sorry for missing this.
>>
>>> I think the panel is wrapped into next_bridge here,
>>>
>>
>> Yes, you can have for example:
>>
>> 1. drm_bridge (mtk_dsi) -> drm_bridge (ps8640 - dsi-to-edp) -> drm_panel_bridge
>> (edp panel)
>>
>> or a
>>
>> 2. drm_bridge (mtk_dsi)-> drm_panel_bridge (dsi panel)
>>
>> The _first_ one is my use case
>>
>>> if (panel) {
>>
>> This handles the second case, where you attach a dsi panel.
>>
>>>     dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);
>>>
>>> so the next_bridge is a panel_bridge, in its attach function
>>> panel_bridge_attach(),
>>> according to the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR, if not exist,
>>> it would create connector and attach connector to panel.
>>>
>>> I'm not sure this flag would exist or not, but for both case, it's strange.
>>> If exist, you create connector in this patch but no where to attach
>>> connector to panel.
>>
>> Yes, in fact, this is transitional patch needed, as once I converted mtk_dpi,
>> mtk_dsi and mtk_hdmi to the new drm_bridge API the drm_bridge_connector_init()
>> will be done in mtk_drm_drv. We will need to call drm_bridge_connector_init for
>> dpi and dsi pipes and remove that call from mtk_dsi and mtk_dpi drivers. The
>> graphic controller driver should create connectors and CRTCs, as example you can
>> take a look at drivers/gpu/drm/omapdrm/omap_drv.c
>>
> 
> I have such question because I've reviewed omap's driver. In omap's
> driver, after it call drm_bridge_connector_init(), it does this:
> 
> if (pipe->output->panel) {
> ret = drm_panel_attach(pipe->output->panel,
>       pipe->connector);
> if (ret < 0)
> return ret;
> }
> 
> In this patch, you does not do this.
> 

I see, so yes, I am probably missing call drm_panel_attach in case there is a
direct panel attached. Thanks for pointing it.

I'll send a new version adding the drm_panel_attach call.

>>> If not exist, the next_brige would create one connector and this brige
>>> would create another connector.
>>>
>>> I think in your case, mtk_dsi does not directly connect to a panel, so
>>
>> Exactly
>>
>>> I need a exact explain. Or someone could test this on a
>>> directly-connect-panel platform.
>>
>> I don't think I am breaking this use case but AFAICS there is no users in
>> mainline that directly connect a panel using the mediatek driver. As I said my
>> use case is the other so I can't really test. Do you know anyone that can test this?
> 
> I'm not sure who can test this, but [1], which is sent by YT Shen in a
> series, is a patch to support dsi command mode so dsi could directly
> connect to panel.
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/mediatek?h=v5.7-rc5&id=21898816831fc60c92dd634ab4316a24da7eb4af
> 
> It's better that someone could test this case, but if no one would
> test this, I could also accept a good-look patch.
> 
> Regards,
> Chun-Kuang.
> 
>>
>> Thanks,
>>  Enric
>>
>>>
>>> Regards,
>>> Chun-Kuang.
>>>
>>>>
>>>> Thanks,
>>>>  Enric
>>>>
>>>>> ---
>>>>>
>>>>> Changes in v4: None
>>>>> Changes in v3:
>>>>> - Move the bridge.type line to the patch that adds drm_bridge support. (Laurent Pinchart)
>>>>>
>>>>> Changes in v2: None
>>>>>
>>>>>  drivers/gpu/drm/mediatek/mtk_dsi.c | 13 ++++++++++++-
>>>>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
>>>>> index 4f3bd095c1ee..471fcafdf348 100644
>>>>> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
>>>>> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
>>>>> @@ -17,6 +17,7 @@
>>>>>
>>>>>  #include <drm/drm_atomic_helper.h>
>>>>>  #include <drm/drm_bridge.h>
>>>>> +#include <drm/drm_bridge_connector.h>
>>>>>  #include <drm/drm_mipi_dsi.h>
>>>>>  #include <drm/drm_of.h>
>>>>>  #include <drm/drm_panel.h>
>>>>> @@ -183,6 +184,7 @@ struct mtk_dsi {
>>>>>         struct drm_encoder encoder;
>>>>>         struct drm_bridge bridge;
>>>>>         struct drm_bridge *next_bridge;
>>>>> +       struct drm_connector *connector;
>>>>>         struct phy *phy;
>>>>>
>>>>>         void __iomem *regs;
>>>>> @@ -977,10 +979,19 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
>>>>>          */
>>>>>         dsi->encoder.possible_crtcs = 1;
>>>>>
>>>>> -       ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, 0);
>>>>> +       ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL,
>>>>> +                               DRM_BRIDGE_ATTACH_NO_CONNECTOR);
>>>>>         if (ret)
>>>>>                 goto err_cleanup_encoder;
>>>>>
>>>>> +       dsi->connector = drm_bridge_connector_init(drm, &dsi->encoder);
>>>>> +       if (IS_ERR(dsi->connector)) {
>>>>> +               DRM_ERROR("Unable to create bridge connector\n");
>>>>> +               ret = PTR_ERR(dsi->connector);
>>>>> +               goto err_cleanup_encoder;
>>>>> +       }
>>>>> +       drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>>>>> +
>>>>>         return 0;
>>>>>
>>>>>  err_cleanup_encoder:
>>>>> --
>>>>> 2.26.2
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Linux-mediatek mailing list
>>>>> Linux-mediatek@lists.infradead.org
>>>>> http://lists.infradead.org/mailman/listinfo/linux-mediatek

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
To: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Nicolas Boichat <drinkcat@chromium.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	David Airlie <airlied@linux.ie>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Collabora Kernel ML <kernel@collabora.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v4 7/7] drm/mediatek: mtk_dsi: Create connector for bridges
Date: Thu, 14 May 2020 19:12:55 +0200	[thread overview]
Message-ID: <37191700-5832-2931-5764-7f7fddd023b9@collabora.com> (raw)
In-Reply-To: <CAAOTY__b6V12fS2xTKGjB1fQTfRjX7AQyBqDPXzshfhkjjSkeQ@mail.gmail.com>

Hi Chun-Kuang,

On 14/5/20 18:44, Chun-Kuang Hu wrote:
> Hi, Enric:
> 
> Enric Balletbo i Serra <enric.balletbo@collabora.com> 於 2020年5月14日 週四 下午11:42寫道:
>>
>> Hi Chun-Kuang,
>>
>> On 14/5/20 16:28, Chun-Kuang Hu wrote:
>>> Hi, Enric:
>>>
>>> Enric Balletbo Serra <eballetbo@gmail.com> 於 2020年5月14日 週四 上午12:41寫道:
>>>>
>>>> Hi Chun-Kuang,
>>>>
>>>> Missatge de Enric Balletbo i Serra <enric.balletbo@collabora.com> del
>>>> dia dv., 1 de maig 2020 a les 17:25:
>>>>>
>>>>> Use the drm_bridge_connector helper to create a connector for pipelines
>>>>> that use drm_bridge. This allows splitting connector operations across
>>>>> multiple bridges when necessary, instead of having the last bridge in
>>>>> the chain creating the connector and handling all connector operations
>>>>> internally.
>>>>>
>>>>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>>>>> Acked-by: Sam Ravnborg <sam@ravnborg.org>
>>>>
>>>> A gentle ping on this, I think that this one is the only one that
>>>> still needs a review in the series.
>>>
>>> This is what I reply in patch v3:
>>>
>>
>> Sorry for missing this.
>>
>>> I think the panel is wrapped into next_bridge here,
>>>
>>
>> Yes, you can have for example:
>>
>> 1. drm_bridge (mtk_dsi) -> drm_bridge (ps8640 - dsi-to-edp) -> drm_panel_bridge
>> (edp panel)
>>
>> or a
>>
>> 2. drm_bridge (mtk_dsi)-> drm_panel_bridge (dsi panel)
>>
>> The _first_ one is my use case
>>
>>> if (panel) {
>>
>> This handles the second case, where you attach a dsi panel.
>>
>>>     dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);
>>>
>>> so the next_bridge is a panel_bridge, in its attach function
>>> panel_bridge_attach(),
>>> according to the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR, if not exist,
>>> it would create connector and attach connector to panel.
>>>
>>> I'm not sure this flag would exist or not, but for both case, it's strange.
>>> If exist, you create connector in this patch but no where to attach
>>> connector to panel.
>>
>> Yes, in fact, this is transitional patch needed, as once I converted mtk_dpi,
>> mtk_dsi and mtk_hdmi to the new drm_bridge API the drm_bridge_connector_init()
>> will be done in mtk_drm_drv. We will need to call drm_bridge_connector_init for
>> dpi and dsi pipes and remove that call from mtk_dsi and mtk_dpi drivers. The
>> graphic controller driver should create connectors and CRTCs, as example you can
>> take a look at drivers/gpu/drm/omapdrm/omap_drv.c
>>
> 
> I have such question because I've reviewed omap's driver. In omap's
> driver, after it call drm_bridge_connector_init(), it does this:
> 
> if (pipe->output->panel) {
> ret = drm_panel_attach(pipe->output->panel,
>       pipe->connector);
> if (ret < 0)
> return ret;
> }
> 
> In this patch, you does not do this.
> 

I see, so yes, I am probably missing call drm_panel_attach in case there is a
direct panel attached. Thanks for pointing it.

I'll send a new version adding the drm_panel_attach call.

>>> If not exist, the next_brige would create one connector and this brige
>>> would create another connector.
>>>
>>> I think in your case, mtk_dsi does not directly connect to a panel, so
>>
>> Exactly
>>
>>> I need a exact explain. Or someone could test this on a
>>> directly-connect-panel platform.
>>
>> I don't think I am breaking this use case but AFAICS there is no users in
>> mainline that directly connect a panel using the mediatek driver. As I said my
>> use case is the other so I can't really test. Do you know anyone that can test this?
> 
> I'm not sure who can test this, but [1], which is sent by YT Shen in a
> series, is a patch to support dsi command mode so dsi could directly
> connect to panel.
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/mediatek?h=v5.7-rc5&id=21898816831fc60c92dd634ab4316a24da7eb4af
> 
> It's better that someone could test this case, but if no one would
> test this, I could also accept a good-look patch.
> 
> Regards,
> Chun-Kuang.
> 
>>
>> Thanks,
>>  Enric
>>
>>>
>>> Regards,
>>> Chun-Kuang.
>>>
>>>>
>>>> Thanks,
>>>>  Enric
>>>>
>>>>> ---
>>>>>
>>>>> Changes in v4: None
>>>>> Changes in v3:
>>>>> - Move the bridge.type line to the patch that adds drm_bridge support. (Laurent Pinchart)
>>>>>
>>>>> Changes in v2: None
>>>>>
>>>>>  drivers/gpu/drm/mediatek/mtk_dsi.c | 13 ++++++++++++-
>>>>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
>>>>> index 4f3bd095c1ee..471fcafdf348 100644
>>>>> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
>>>>> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
>>>>> @@ -17,6 +17,7 @@
>>>>>
>>>>>  #include <drm/drm_atomic_helper.h>
>>>>>  #include <drm/drm_bridge.h>
>>>>> +#include <drm/drm_bridge_connector.h>
>>>>>  #include <drm/drm_mipi_dsi.h>
>>>>>  #include <drm/drm_of.h>
>>>>>  #include <drm/drm_panel.h>
>>>>> @@ -183,6 +184,7 @@ struct mtk_dsi {
>>>>>         struct drm_encoder encoder;
>>>>>         struct drm_bridge bridge;
>>>>>         struct drm_bridge *next_bridge;
>>>>> +       struct drm_connector *connector;
>>>>>         struct phy *phy;
>>>>>
>>>>>         void __iomem *regs;
>>>>> @@ -977,10 +979,19 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
>>>>>          */
>>>>>         dsi->encoder.possible_crtcs = 1;
>>>>>
>>>>> -       ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, 0);
>>>>> +       ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL,
>>>>> +                               DRM_BRIDGE_ATTACH_NO_CONNECTOR);
>>>>>         if (ret)
>>>>>                 goto err_cleanup_encoder;
>>>>>
>>>>> +       dsi->connector = drm_bridge_connector_init(drm, &dsi->encoder);
>>>>> +       if (IS_ERR(dsi->connector)) {
>>>>> +               DRM_ERROR("Unable to create bridge connector\n");
>>>>> +               ret = PTR_ERR(dsi->connector);
>>>>> +               goto err_cleanup_encoder;
>>>>> +       }
>>>>> +       drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>>>>> +
>>>>>         return 0;
>>>>>
>>>>>  err_cleanup_encoder:
>>>>> --
>>>>> 2.26.2
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Linux-mediatek mailing list
>>>>> Linux-mediatek@lists.infradead.org
>>>>> http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-05-14 17:13 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 15:23 [PATCH v4 0/7] Convert mtk-dsi to drm_bridge API and get EDID for ps8640 bridge Enric Balletbo i Serra
2020-05-01 15:23 ` Enric Balletbo i Serra
2020-05-01 15:23 ` Enric Balletbo i Serra
2020-05-01 15:23 ` Enric Balletbo i Serra
2020-05-01 15:23 ` [PATCH v4 1/7] drm/bridge: ps8640: Get the EDID from eDP control Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23 ` [PATCH v4 2/7] drm/bridge_connector: Set default status connected for eDP connectors Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23 ` [PATCH v4 3/7] drm/mediatek: mtk_dsi: Rename bridge to next_bridge Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-02  1:23   ` Chun-Kuang Hu
2020-05-02  1:23     ` Chun-Kuang Hu
2020-05-02  1:23     ` Chun-Kuang Hu
2020-05-02  1:23     ` Chun-Kuang Hu
2020-05-01 15:23 ` [PATCH v4 4/7] drm/mediatek: mtk_dsi: Convert to bridge driver Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-02  1:22   ` Chun-Kuang Hu
2020-05-02  1:22     ` Chun-Kuang Hu
2020-05-02  1:22     ` Chun-Kuang Hu
2020-05-02  1:22     ` Chun-Kuang Hu
2020-05-01 15:23 ` [PATCH v4 5/7] drm/mediatek: mtk_dsi: Use simple encoder Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23 ` [PATCH v4 6/7] drm/mediatek: mtk_dsi: Use the drm_panel_bridge API Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23 ` [PATCH v4 7/7] drm/mediatek: mtk_dsi: Create connector for bridges Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-01 15:23   ` Enric Balletbo i Serra
2020-05-13 16:40   ` Enric Balletbo Serra
2020-05-13 16:40     ` Enric Balletbo Serra
2020-05-13 16:40     ` Enric Balletbo Serra
2020-05-13 16:40     ` Enric Balletbo Serra
2020-05-14 14:28     ` Chun-Kuang Hu
2020-05-14 14:28       ` Chun-Kuang Hu
2020-05-14 14:28       ` Chun-Kuang Hu
2020-05-14 14:28       ` Chun-Kuang Hu
2020-05-14 15:42       ` Enric Balletbo i Serra
2020-05-14 15:42         ` Enric Balletbo i Serra
2020-05-14 15:42         ` Enric Balletbo i Serra
2020-05-14 15:42         ` Enric Balletbo i Serra
2020-05-14 16:44         ` Chun-Kuang Hu
2020-05-14 16:44           ` Chun-Kuang Hu
2020-05-14 16:44           ` Chun-Kuang Hu
2020-05-14 16:44           ` Chun-Kuang Hu
2020-05-14 17:12           ` Enric Balletbo i Serra [this message]
2020-05-14 17:12             ` Enric Balletbo i Serra
2020-05-14 17:12             ` Enric Balletbo i Serra
2020-05-14 17:12             ` Enric Balletbo i Serra
2020-05-14 17:35             ` Enric Balletbo i Serra
2020-05-14 17:35               ` Enric Balletbo i Serra
2020-05-14 17:35               ` Enric Balletbo i Serra
2020-05-14 17:35               ` Enric Balletbo i Serra
2020-05-14 20:55               ` Laurent Pinchart
2020-05-14 20:55                 ` Laurent Pinchart
2020-05-14 20:55                 ` Laurent Pinchart
2020-05-14 20:55                 ` Laurent Pinchart
2020-05-16 10:10               ` Chun-Kuang Hu
2020-05-16 10:10                 ` Chun-Kuang Hu
2020-05-16 10:10                 ` Chun-Kuang Hu
2020-05-16 10:10                 ` Chun-Kuang Hu
2020-05-18 17:11                 ` Enric Balletbo Serra
2020-05-18 17:11                   ` Enric Balletbo Serra
2020-05-18 17:11                   ` Enric Balletbo Serra
2020-05-18 17:11                   ` Enric Balletbo Serra
2020-05-18 17:48                   ` Sam Ravnborg
2020-05-18 17:48                     ` Sam Ravnborg
2020-05-18 17:48                     ` Sam Ravnborg
2020-05-18 17:48                     ` Sam Ravnborg
2020-08-24 19:01 ` [PATCH v4 0/7] Convert mtk-dsi to drm_bridge API and get EDID for ps8640 bridge Bilal Wasim
2020-08-24 19:01   ` Bilal Wasim
2020-08-26  8:24   ` Enric Balletbo i Serra
2020-08-26  8:24     ` Enric Balletbo i Serra

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=37191700-5832-2931-5764-7f7fddd023b9@collabora.com \
    --to=enric.balletbo@collabora.com \
    --cc=airlied@linux.ie \
    --cc=chunkuang.hu@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=drinkcat@chromium.org \
    --cc=eballetbo@gmail.com \
    --cc=hsinyi@chromium.org \
    --cc=kernel@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.