linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mediatek: Set default value for Panel Orientation connector prop.
@ 2021-10-22 17:24 Mark Yacoub
  2021-10-26  1:13 ` Sean Paul
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Mark Yacoub @ 2021-10-22 17:24 UTC (permalink / raw)
  To: linux-mediatek
  Cc: seanpaul, Mark Yacoub, Mark Yacoub, Chun-Kuang Hu, Philipp Zabel,
	David Airlie, Daniel Vetter, Matthias Brugger, dri-devel,
	linux-arm-kernel, linux-kernel

From: Mark Yacoub <markyacoub@google.com>

[Why]
Creating the prop uses UNKNOWN as the initial value, which is not a
supported value if the props is to be supported.

[How]
Set the panel orientation default value to NORMAL right after creating
the prop.

Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <markyacoub@chromium.org>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ad7157660afa..b7c2528a8f41c 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 		DRM_ERROR("Unable to init panel orientation\n");
 		goto err_cleanup_encoder;
 	}
+	drm_connector_set_panel_orientation(dsi->connector,
+					    DRM_MODE_PANEL_ORIENTATION_NORMAL);
 
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
-- 
2.33.0.1079.g6e70778dc9-goog


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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] mediatek: Set default value for Panel Orientation connector prop.
  2021-10-22 17:24 [PATCH] mediatek: Set default value for Panel Orientation connector prop Mark Yacoub
@ 2021-10-26  1:13 ` Sean Paul
  2021-12-14 15:13   ` Mark Yacoub
  2021-12-29 18:39 ` [PATCH v2] drm/mediatek: " Mark Yacoub
  2021-12-29 18:44 ` Mark Yacoub
  2 siblings, 1 reply; 11+ messages in thread
From: Sean Paul @ 2021-10-26  1:13 UTC (permalink / raw)
  To: Mark Yacoub
  Cc: linux-mediatek, seanpaul, Mark Yacoub, Chun-Kuang Hu,
	Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	dri-devel, linux-arm-kernel, linux-kernel

On Fri, Oct 22, 2021 at 01:24:03PM -0400, Mark Yacoub wrote:
> From: Mark Yacoub <markyacoub@google.com>
> 
> [Why]
> Creating the prop uses UNKNOWN as the initial value, which is not a
> supported value if the props is to be supported.
> 
> [How]
> Set the panel orientation default value to NORMAL right after creating
> the prop.

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> 
> Tested on Jacuzzi(MTK)
> Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}
> 
> Signed-off-by: Mark Yacoub <markyacoub@chromium.org>
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index 0ad7157660afa..b7c2528a8f41c 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
>  		DRM_ERROR("Unable to init panel orientation\n");
>  		goto err_cleanup_encoder;
>  	}
> +	drm_connector_set_panel_orientation(dsi->connector,
> +					    DRM_MODE_PANEL_ORIENTATION_NORMAL);
>  
>  	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>  
> -- 
> 2.33.0.1079.g6e70778dc9-goog
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] mediatek: Set default value for Panel Orientation connector prop.
  2021-10-26  1:13 ` Sean Paul
@ 2021-12-14 15:13   ` Mark Yacoub
  2021-12-15 16:14     ` Chun-Kuang Hu
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Yacoub @ 2021-12-14 15:13 UTC (permalink / raw)
  To: Sean Paul
  Cc: linux-mediatek, seanpaul, Mark Yacoub, Chun-Kuang Hu,
	Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	dri-devel, linux-arm-kernel, linux-kernel

Hey CK, can we have this merged?
Thank you!

On Mon, Oct 25, 2021 at 9:13 PM Sean Paul <sean@poorly.run> wrote:
>
> On Fri, Oct 22, 2021 at 01:24:03PM -0400, Mark Yacoub wrote:
> > From: Mark Yacoub <markyacoub@chromium.org>
> >
> > [Why]
> > Creating the prop uses UNKNOWN as the initial value, which is not a
> > supported value if the props is to be supported.
> >
> > [How]
> > Set the panel orientation default value to NORMAL right after creating
> > the prop.
>
> Reviewed-by: Sean Paul <seanpaul@chromium.org>
>
> >
> > Tested on Jacuzzi(MTK)
> > Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}
> >
> > Signed-off-by: Mark Yacoub <markyacoub@chromium.org>
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index 0ad7157660afa..b7c2528a8f41c 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
> >               DRM_ERROR("Unable to init panel orientation\n");
> >               goto err_cleanup_encoder;
> >       }
> > +     drm_connector_set_panel_orientation(dsi->connector,
> > +                                         DRM_MODE_PANEL_ORIENTATION_NORMAL);
> >
> >       drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> >
> > --
> > 2.33.0.1079.g6e70778dc9-goog
> >
>
> --
> Sean Paul, Software Engineer, Google / Chromium OS

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] mediatek: Set default value for Panel Orientation connector prop.
  2021-12-14 15:13   ` Mark Yacoub
@ 2021-12-15 16:14     ` Chun-Kuang Hu
  2021-12-15 17:25       ` Mark Yacoub
  0 siblings, 1 reply; 11+ messages in thread
From: Chun-Kuang Hu @ 2021-12-15 16:14 UTC (permalink / raw)
  To: Mark Yacoub
  Cc: Sean Paul, moderated list:ARM/Mediatek SoC support, Sean Paul,
	Mark Yacoub, Chun-Kuang Hu, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, DRI Development, Linux ARM,
	linux-kernel

Hi, Mark:

Mark Yacoub <markyacoub@chromium.org> 於 2021年12月14日 週二 下午11:13寫道:
>
> Hey CK, can we have this merged?
> Thank you!
>
> On Mon, Oct 25, 2021 at 9:13 PM Sean Paul <sean@poorly.run> wrote:
> >
> > On Fri, Oct 22, 2021 at 01:24:03PM -0400, Mark Yacoub wrote:
> > > From: Mark Yacoub <markyacoub@chromium.org>
> > >
> > > [Why]
> > > Creating the prop uses UNKNOWN as the initial value, which is not a
> > > supported value if the props is to be supported.
> > >
> > > [How]
> > > Set the panel orientation default value to NORMAL right after creating
> > > the prop.
> >
> > Reviewed-by: Sean Paul <seanpaul@chromium.org>
> >
> > >
> > > Tested on Jacuzzi(MTK)
> > > Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}
> > >
> > > Signed-off-by: Mark Yacoub <markyacoub@chromium.org>
> > > ---
> > >  drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > index 0ad7157660afa..b7c2528a8f41c 100644
> > > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > @@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
> > >               DRM_ERROR("Unable to init panel orientation\n");
> > >               goto err_cleanup_encoder;
> > >       }
> > > +     drm_connector_set_panel_orientation(dsi->connector,
> > > +                                         DRM_MODE_PANEL_ORIENTATION_NORMAL);

In drm_connector_set_panel_orientation() [1], I find that the
orientation could be set only once. Once you set it to normal, it
could not be set to other orientation. Right?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/drm_connector.c?h=v5.16-rc5#n2302

Regards,
Chun-Kuang.

> > >
> > >       drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> > >
> > > --
> > > 2.33.0.1079.g6e70778dc9-goog
> > >
> >
> > --
> > Sean Paul, Software Engineer, Google / Chromium OS

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] mediatek: Set default value for Panel Orientation connector prop.
  2021-12-15 16:14     ` Chun-Kuang Hu
@ 2021-12-15 17:25       ` Mark Yacoub
  2021-12-16 16:53         ` Chun-Kuang Hu
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Yacoub @ 2021-12-15 17:25 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Sean Paul, moderated list:ARM/Mediatek SoC support, Sean Paul,
	Mark Yacoub, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, DRI Development, Linux ARM, linux-kernel

On Wed, Dec 15, 2021 at 11:14 AM Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
>
> Hi, Mark:
>
> Mark Yacoub <markyacoub@chromium.org> 於 2021年12月14日 週二 下午11:13寫道:
> >
> > Hey CK, can we have this merged?
> > Thank you!
> >
> > On Mon, Oct 25, 2021 at 9:13 PM Sean Paul <sean@poorly.run> wrote:
> > >
> > > On Fri, Oct 22, 2021 at 01:24:03PM -0400, Mark Yacoub wrote:
> > > > From: Mark Yacoub <markyacoub@chromium.org>
> > > >
> > > > [Why]
> > > > Creating the prop uses UNKNOWN as the initial value, which is not a
> > > > supported value if the props is to be supported.
> > > >
> > > > [How]
> > > > Set the panel orientation default value to NORMAL right after creating
> > > > the prop.
> > >
> > > Reviewed-by: Sean Paul <seanpaul@chromium.org>
> > >
> > > >
> > > > Tested on Jacuzzi(MTK)
> > > > Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}
> > > >
> > > > Signed-off-by: Mark Yacoub <markyacoub@chromium.org>
> > > > ---
> > > >  drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
> > > >  1 file changed, 2 insertions(+)
> > > >
> > > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > index 0ad7157660afa..b7c2528a8f41c 100644
> > > > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > @@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
> > > >               DRM_ERROR("Unable to init panel orientation\n");
> > > >               goto err_cleanup_encoder;
> > > >       }
> > > > +     drm_connector_set_panel_orientation(dsi->connector,
> > > > +                                         DRM_MODE_PANEL_ORIENTATION_NORMAL);
>
> In drm_connector_set_panel_orientation() [1], I find that the
> orientation could be set only once. Once you set it to normal, it
> could not be set to other orientation. Right?
>
Hello,
Yeah this looks true, and makes sense according to the documentation:
https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-kms.html#:~:text=one%20standardized%20property%3A-,panel%20orientation%3A,-On%20some%20devices

Panel orientation has to do with the how the hardware is mounted, in
contrast with the Rotation property. All the HW we have right now has
a normal panel orientation so it makes sense to be set this way. Among
other drivers, panel orientation is always set right after the
property is initialized.

> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/drm_connector.c?h=v5.16-rc5#n2302
>
> Regards,
> Chun-Kuang.
>
> > > >
> > > >       drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> > > >
> > > > --
> > > > 2.33.0.1079.g6e70778dc9-goog
> > > >
> > >
> > > --
> > > Sean Paul, Software Engineer, Google / Chromium OS

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] mediatek: Set default value for Panel Orientation connector prop.
  2021-12-15 17:25       ` Mark Yacoub
@ 2021-12-16 16:53         ` Chun-Kuang Hu
  2021-12-16 18:29           ` Mark Yacoub
  0 siblings, 1 reply; 11+ messages in thread
From: Chun-Kuang Hu @ 2021-12-16 16:53 UTC (permalink / raw)
  To: Mark Yacoub
  Cc: Chun-Kuang Hu, Sean Paul,
	moderated list:ARM/Mediatek SoC support, Sean Paul, Mark Yacoub,
	Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	DRI Development, Linux ARM, linux-kernel

Hi, Mark:

Mark Yacoub <markyacoub@chromium.org> 於 2021年12月16日 週四 上午1:25寫道:
>
> On Wed, Dec 15, 2021 at 11:14 AM Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
> >
> > Hi, Mark:
> >
> > Mark Yacoub <markyacoub@chromium.org> 於 2021年12月14日 週二 下午11:13寫道:
> > >
> > > Hey CK, can we have this merged?
> > > Thank you!
> > >
> > > On Mon, Oct 25, 2021 at 9:13 PM Sean Paul <sean@poorly.run> wrote:
> > > >
> > > > On Fri, Oct 22, 2021 at 01:24:03PM -0400, Mark Yacoub wrote:
> > > > > From: Mark Yacoub <markyacoub@chromium.org>
> > > > >
> > > > > [Why]
> > > > > Creating the prop uses UNKNOWN as the initial value, which is not a
> > > > > supported value if the props is to be supported.
> > > > >
> > > > > [How]
> > > > > Set the panel orientation default value to NORMAL right after creating
> > > > > the prop.
> > > >
> > > > Reviewed-by: Sean Paul <seanpaul@chromium.org>
> > > >
> > > > >
> > > > > Tested on Jacuzzi(MTK)
> > > > > Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}
> > > > >
> > > > > Signed-off-by: Mark Yacoub <markyacoub@chromium.org>
> > > > > ---
> > > > >  drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
> > > > >  1 file changed, 2 insertions(+)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > index 0ad7157660afa..b7c2528a8f41c 100644
> > > > > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > @@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
> > > > >               DRM_ERROR("Unable to init panel orientation\n");
> > > > >               goto err_cleanup_encoder;
> > > > >       }
> > > > > +     drm_connector_set_panel_orientation(dsi->connector,
> > > > > +                                         DRM_MODE_PANEL_ORIENTATION_NORMAL);
> >
> > In drm_connector_set_panel_orientation() [1], I find that the
> > orientation could be set only once. Once you set it to normal, it
> > could not be set to other orientation. Right?
> >
> Hello,
> Yeah this looks true, and makes sense according to the documentation:
> https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-kms.html#:~:text=one%20standardized%20property%3A-,panel%20orientation%3A,-On%20some%20devices
>
> Panel orientation has to do with the how the hardware is mounted, in
> contrast with the Rotation property. All the HW we have right now has
> a normal panel orientation so it makes sense to be set this way. Among

Many evidence [1], [2], [3], show that Chromebook plan to have other
orientation on mt8183, so I think you should consider this.

[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20210409045314.3420733-2-hsinyi@chromium.org/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c?h=v5.16-rc5#n1474
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane-sku176.dts?h=v5.16-rc5#n22

Regards,
Chun-Kuang.



> other drivers, panel orientation is always set right after the
> property is initialized.
>
> > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/drm_connector.c?h=v5.16-rc5#n2302
> >
> > Regards,
> > Chun-Kuang.
> >
> > > > >
> > > > >       drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> > > > >
> > > > > --
> > > > > 2.33.0.1079.g6e70778dc9-goog
> > > > >
> > > >
> > > > --
> > > > Sean Paul, Software Engineer, Google / Chromium OS

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] mediatek: Set default value for Panel Orientation connector prop.
  2021-12-16 16:53         ` Chun-Kuang Hu
@ 2021-12-16 18:29           ` Mark Yacoub
  0 siblings, 0 replies; 11+ messages in thread
From: Mark Yacoub @ 2021-12-16 18:29 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Sean Paul, moderated list:ARM/Mediatek SoC support, Sean Paul,
	Mark Yacoub, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, DRI Development, Linux ARM, linux-kernel

This makes sense. Thanks for pointing that out I wasn't aware of it.
I'll take a closer look and try to come up with something better.

Thanks Chun-Kuang!

On Thu, Dec 16, 2021 at 11:53 AM Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
>
> Hi, Mark:
>
> Mark Yacoub <markyacoub@chromium.org> 於 2021年12月16日 週四 上午1:25寫道:
> >
> > On Wed, Dec 15, 2021 at 11:14 AM Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
> > >
> > > Hi, Mark:
> > >
> > > Mark Yacoub <markyacoub@chromium.org> 於 2021年12月14日 週二 下午11:13寫道:
> > > >
> > > > Hey CK, can we have this merged?
> > > > Thank you!
> > > >
> > > > On Mon, Oct 25, 2021 at 9:13 PM Sean Paul <sean@poorly.run> wrote:
> > > > >
> > > > > On Fri, Oct 22, 2021 at 01:24:03PM -0400, Mark Yacoub wrote:
> > > > > > From: Mark Yacoub <markyacoub@chromium.org>
> > > > > >
> > > > > > [Why]
> > > > > > Creating the prop uses UNKNOWN as the initial value, which is not a
> > > > > > supported value if the props is to be supported.
> > > > > >
> > > > > > [How]
> > > > > > Set the panel orientation default value to NORMAL right after creating
> > > > > > the prop.
> > > > >
> > > > > Reviewed-by: Sean Paul <seanpaul@chromium.org>
> > > > >
> > > > > >
> > > > > > Tested on Jacuzzi(MTK)
> > > > > > Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}
> > > > > >
> > > > > > Signed-off-by: Mark Yacoub <markyacoub@chromium.org>
> > > > > > ---
> > > > > >  drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
> > > > > >  1 file changed, 2 insertions(+)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > > index 0ad7157660afa..b7c2528a8f41c 100644
> > > > > > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > > @@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
> > > > > >               DRM_ERROR("Unable to init panel orientation\n");
> > > > > >               goto err_cleanup_encoder;
> > > > > >       }
> > > > > > +     drm_connector_set_panel_orientation(dsi->connector,
> > > > > > +                                         DRM_MODE_PANEL_ORIENTATION_NORMAL);
> > >
> > > In drm_connector_set_panel_orientation() [1], I find that the
> > > orientation could be set only once. Once you set it to normal, it
> > > could not be set to other orientation. Right?
> > >
> > Hello,
> > Yeah this looks true, and makes sense according to the documentation:
> > https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-kms.html#:~:text=one%20standardized%20property%3A-,panel%20orientation%3A,-On%20some%20devices
> >
> > Panel orientation has to do with the how the hardware is mounted, in
> > contrast with the Rotation property. All the HW we have right now has
> > a normal panel orientation so it makes sense to be set this way. Among
>
> Many evidence [1], [2], [3], show that Chromebook plan to have other
> orientation on mt8183, so I think you should consider this.
>
> [1] https://patchwork.kernel.org/project/linux-mediatek/patch/20210409045314.3420733-2-hsinyi@chromium.org/
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c?h=v5.16-rc5#n1474
> [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane-sku176.dts?h=v5.16-rc5#n22
>
> Regards,
> Chun-Kuang.
>
>
>
> > other drivers, panel orientation is always set right after the
> > property is initialized.
> >
> > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/drm_connector.c?h=v5.16-rc5#n2302
> > >
> > > Regards,
> > > Chun-Kuang.
> > >
> > > > > >
> > > > > >       drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> > > > > >
> > > > > > --
> > > > > > 2.33.0.1079.g6e70778dc9-goog
> > > > > >
> > > > >
> > > > > --
> > > > > Sean Paul, Software Engineer, Google / Chromium OS

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2] drm/mediatek: Set default value for Panel Orientation connector prop.
  2021-10-22 17:24 [PATCH] mediatek: Set default value for Panel Orientation connector prop Mark Yacoub
  2021-10-26  1:13 ` Sean Paul
@ 2021-12-29 18:39 ` Mark Yacoub
  2021-12-29 18:44 ` Mark Yacoub
  2 siblings, 0 replies; 11+ messages in thread
From: Mark Yacoub @ 2021-12-29 18:39 UTC (permalink / raw)
  To: linux-mediatek
  Cc: seanpaul, chunkuang.hu, p.zabel, matthias.bgg, jason-jh.lin,
	tzungbi, Mark Yacoub, David Airlie, Daniel Vetter, dri-devel,
	linux-arm-kernel, linux-kernel

[Why]
Creating the prop uses UNKNOWN as the initial value, which is not a
supported value if the prop is to be supported.

[How]
Set the panel orientation default value to NORMAL right after creating
the prop if no DSI panel exists.
Panels have their own orientations, and panel orientation can't be
overriden once initialized to a value.

v1:
Set panel orientation only if DSI panel does not exist.

Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <markyacoub@chromium.org>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ad7157660afa..7cf71705775f0 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1040,6 +1040,13 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 		goto err_cleanup_encoder;
 	}
 
+	// A drm_panel can have its own orientation. If there is no panel, set the
+	// orientation to NORMAL.
+	if (!dsi->panel) {
+		drm_connector_set_panel_orientation(
+			dsi->connector, DRM_MODE_PANEL_ORIENTATION_NORMAL);
+	}
+
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
 	return 0;
-- 
2.34.1.448.ga2b2bfdf31-goog


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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2] drm/mediatek: Set default value for Panel Orientation connector prop.
  2021-10-22 17:24 [PATCH] mediatek: Set default value for Panel Orientation connector prop Mark Yacoub
  2021-10-26  1:13 ` Sean Paul
  2021-12-29 18:39 ` [PATCH v2] drm/mediatek: " Mark Yacoub
@ 2021-12-29 18:44 ` Mark Yacoub
  2022-01-03 12:39   ` Chun-Kuang Hu
  2022-01-05 21:23   ` [PATCH v3] " Mark Yacoub
  2 siblings, 2 replies; 11+ messages in thread
From: Mark Yacoub @ 2021-12-29 18:44 UTC (permalink / raw)
  To: linux-mediatek
  Cc: seanpaul, chunkuang.hu, p.zabel, matthias.bgg, jason-jh.lin,
	tzungbi, Mark Yacoub, David Airlie, Daniel Vetter, dri-devel,
	linux-arm-kernel, linux-kernel

[Why]
Creating the prop uses UNKNOWN as the initial value, which is not a
supported value if the prop is to be supported.

[How]
Set the panel orientation default value to NORMAL right after creating
the prop if no DSI panel exists.
Panels have their own orientations, and panel orientation can't be
overriden once initialized to a value.

v1:
Set panel orientation only if DSI panel does not exist.

Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <markyacoub@chromium.org>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ad7157660afa..9d33dd93118e0 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1040,6 +1040,13 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 		goto err_cleanup_encoder;
 	}
 
+	/* A drm_panel can have its own orientation. If there is no panel, set the
+	 * orientation to NORMAL. */
+	if (!dsi->panel) {
+		drm_connector_set_panel_orientation(
+			dsi->connector, DRM_MODE_PANEL_ORIENTATION_NORMAL);
+	}
+
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
 	return 0;
-- 
2.34.1.448.ga2b2bfdf31-goog


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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] drm/mediatek: Set default value for Panel Orientation connector prop.
  2021-12-29 18:44 ` Mark Yacoub
@ 2022-01-03 12:39   ` Chun-Kuang Hu
  2022-01-05 21:23   ` [PATCH v3] " Mark Yacoub
  1 sibling, 0 replies; 11+ messages in thread
From: Chun-Kuang Hu @ 2022-01-03 12:39 UTC (permalink / raw)
  To: Mark Yacoub
  Cc: moderated list:ARM/Mediatek SoC support, Sean Paul,
	Chun-Kuang Hu, Philipp Zabel, Matthias Brugger, Jason-JH Lin,
	tzungbi, David Airlie, Daniel Vetter, DRI Development, Linux ARM,
	linux-kernel

Hi, Mark:

Mark Yacoub <markyacoub@chromium.org> 於 2021年12月30日 週四 上午2:44寫道:
>
> [Why]
> Creating the prop uses UNKNOWN as the initial value, which is not a
> supported value if the prop is to be supported.
>
> [How]
> Set the panel orientation default value to NORMAL right after creating
> the prop if no DSI panel exists.
> Panels have their own orientations, and panel orientation can't be
> overriden once initialized to a value.
>
> v1:
> Set panel orientation only if DSI panel does not exist.
>
> Tested on Jacuzzi(MTK)
> Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}
>
> Signed-off-by: Mark Yacoub <markyacoub@chromium.org>
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index 0ad7157660afa..9d33dd93118e0 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -1040,6 +1040,13 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
>                 goto err_cleanup_encoder;
>         }
>
> +       /* A drm_panel can have its own orientation. If there is no panel, set the
> +        * orientation to NORMAL. */
> +       if (!dsi->panel) {

Please send patch based on latest kernel version. In latest kernel
version, struct mtk_dsi{} has no member 'panel'.

Regards,
Chun-Kuang.

> +               drm_connector_set_panel_orientation(
> +                       dsi->connector, DRM_MODE_PANEL_ORIENTATION_NORMAL);
> +       }
> +
>         drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>
>         return 0;
> --
> 2.34.1.448.ga2b2bfdf31-goog
>

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v3] drm/mediatek: Set default value for Panel Orientation connector prop.
  2021-12-29 18:44 ` Mark Yacoub
  2022-01-03 12:39   ` Chun-Kuang Hu
@ 2022-01-05 21:23   ` Mark Yacoub
  1 sibling, 0 replies; 11+ messages in thread
From: Mark Yacoub @ 2022-01-05 21:23 UTC (permalink / raw)
  To: linux-mediatek
  Cc: seanpaul, markyacoub, markyacoub, chunkuang.hu, p.zabel,
	matthias.bgg, jason-jh.lin, tzungbi, David Airlie, Daniel Vetter,
	dri-devel, linux-arm-kernel, linux-kernel

[Why]
Creating the prop uses UNKNOWN as the initial value, which is not a
supported value if the prop is to be supported.

[How]
Set the panel orientation default value to NORMAL right after creating
the prop if no DSI panel exists.
Panels have their own orientations, and panel orientation can't be
overriden once initialized to a value.

v2:
Move to the latest code where struct mtk_dsi{} has no member 'panel'.
v1:
Set panel orientation only if DSI panel does not exist.

Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <markyacoub@chromium.org>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 5d90d2eb00193..9e1d4e297ca48 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -941,8 +941,10 @@ static const struct mipi_dsi_host_ops mtk_dsi_ops = {
 	.transfer = mtk_dsi_host_transfer,
 };
 
-static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
+static int mtk_dsi_encoder_init(struct device *dev, struct drm_device *drm)
 {
+	struct mtk_dsi *dsi = dev_get_drvdata(dev);
+	struct drm_panel *panel;
 	int ret;
 
 	ret = drm_simple_encoder_init(drm, &dsi->encoder,
@@ -967,6 +969,15 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 	}
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
+	ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &panel,
+					  &dsi->next_bridge);
+	/* A drm_panel can have its own orientation. If there is no panel, set the
+	 * orientation to NORMAL. */
+	if (ret || !panel) {
+		drm_connector_set_panel_orientation(
+			dsi->connector, DRM_MODE_PANEL_ORIENTATION_NORMAL);
+	}
+
 	return 0;
 
 err_cleanup_encoder:
@@ -976,11 +987,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 
 static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
 {
-	int ret;
 	struct drm_device *drm = data;
-	struct mtk_dsi *dsi = dev_get_drvdata(dev);
-
-	ret = mtk_dsi_encoder_init(drm, dsi);
+	int ret = mtk_dsi_encoder_init(dev, drm);
 	if (ret)
 		return ret;
 
-- 
2.34.1.448.ga2b2bfdf31-goog


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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-01-05 21:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22 17:24 [PATCH] mediatek: Set default value for Panel Orientation connector prop Mark Yacoub
2021-10-26  1:13 ` Sean Paul
2021-12-14 15:13   ` Mark Yacoub
2021-12-15 16:14     ` Chun-Kuang Hu
2021-12-15 17:25       ` Mark Yacoub
2021-12-16 16:53         ` Chun-Kuang Hu
2021-12-16 18:29           ` Mark Yacoub
2021-12-29 18:39 ` [PATCH v2] drm/mediatek: " Mark Yacoub
2021-12-29 18:44 ` Mark Yacoub
2022-01-03 12:39   ` Chun-Kuang Hu
2022-01-05 21:23   ` [PATCH v3] " Mark Yacoub

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).