linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/mediatek: Config orientation property if panel provides it
@ 2022-05-30 11:30 Hsin-Yi Wang
  2022-05-30 11:30 ` [PATCH 2/2] arm64: dts: mt8183: Add panel rotation Hsin-Yi Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Hsin-Yi Wang @ 2022-05-30 11:30 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, dri-devel, linux-mediatek, Rob Clark,
	Stephen Boyd, Douglas Anderson, Rob Herring, linux-arm-kernel,
	linux-kernel

Panel orientation property should be set before drm_dev_register().
Mediatek drm driver calls drm_dev_register() in .bind(). However, most
panels sets orientation property relatively late, mostly in .get_modes()
callback, since this is when they are able to get the connector and
binds the orientation property to it, though the value should be known
when the panel is probed.

Let the drm driver check if the remote end point is a panel and if it
contains the orientation property. If it does, set it before
drm_dev_register() is called.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
This patch is to solve the same problem as [1]
[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20220530081910.3947168-2-hsinyi@chromium.org/
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index d9f10a33e6fa..091107f97ccc 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -198,6 +198,7 @@ struct mtk_dsi {
 
 	unsigned long mode_flags;
 	enum mipi_dsi_pixel_format format;
+	enum drm_panel_orientation orientation;
 	unsigned int lanes;
 	struct videomode vm;
 	struct mtk_phy_timing phy_timing;
@@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 		ret = PTR_ERR(dsi->connector);
 		goto err_cleanup_encoder;
 	}
+
+	if (dsi->orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
+		drm_connector_set_panel_orientation(dsi->connector, dsi->orientation);
+
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
 	return 0;
@@ -836,6 +841,14 @@ 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);
+	struct drm_panel *panel;
+
+	/* Read panel orientation if existed */
+	dsi->orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+	ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &panel, NULL);
+	if (!ret && panel && panel->dev) {
+		of_drm_get_panel_orientation(panel->dev->of_node, &dsi->orientation);
+	}
 
 	ret = mtk_dsi_encoder_init(drm, dsi);
 	if (ret)
-- 
2.36.1.124.g0e6072fb45-goog


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

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

* [PATCH 2/2] arm64: dts: mt8183: Add panel rotation
  2022-05-30 11:30 [PATCH 1/2] drm/mediatek: Config orientation property if panel provides it Hsin-Yi Wang
@ 2022-05-30 11:30 ` Hsin-Yi Wang
  2022-06-06 15:29   ` Hsin-Yi Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Hsin-Yi Wang @ 2022-05-30 11:30 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, dri-devel, linux-mediatek, Rob Clark,
	Stephen Boyd, Douglas Anderson, Rob Herring, linux-arm-kernel,
	linux-kernel

krane, kakadu, and kodama boards have a default panel rotation.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
index 8d5bf73a9099..f0dd5a06629d 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
@@ -276,6 +276,7 @@ panel: panel@0 {
 		avee-supply = <&ppvarp_lcd>;
 		pp1800-supply = <&pp1800_lcd>;
 		backlight = <&backlight_lcd0>;
+		rotation = <270>;
 		port {
 			panel_in: endpoint {
 				remote-endpoint = <&dsi_out>;
-- 
2.36.1.124.g0e6072fb45-goog


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

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

* Re: [PATCH 2/2] arm64: dts: mt8183: Add panel rotation
  2022-05-30 11:30 ` [PATCH 2/2] arm64: dts: mt8183: Add panel rotation Hsin-Yi Wang
@ 2022-06-06 15:29   ` Hsin-Yi Wang
  2022-06-17 14:10     ` Matthias Brugger
  0 siblings, 1 reply; 7+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:29 UTC (permalink / raw)
  To: Chun-Kuang Hu, Matthias Brugger
  Cc: Hans de Goede, Philipp Zabel, David Airlie, Daniel Vetter,
	dri-devel, linux-mediatek, Rob Clark, Stephen Boyd,
	Douglas Anderson, Rob Herring, linux-arm-kernel, linux-kernel

On Mon, May 30, 2022 at 7:30 PM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
>
> krane, kakadu, and kodama boards have a default panel rotation.
>
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---

Hi Matthias,

The series ("Add a panel API to return panel orientation") might land
in drm-misc. With this series applied, we can add this patch to give
the correct default orientation for mt8183 kukui devices.
I didn't send this patch again with the series, since they might land
in different trees.

Thanks.

>  arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
> index 8d5bf73a9099..f0dd5a06629d 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
> @@ -276,6 +276,7 @@ panel: panel@0 {
>                 avee-supply = <&ppvarp_lcd>;
>                 pp1800-supply = <&pp1800_lcd>;
>                 backlight = <&backlight_lcd0>;
> +               rotation = <270>;
>                 port {
>                         panel_in: endpoint {
>                                 remote-endpoint = <&dsi_out>;
> --
> 2.36.1.124.g0e6072fb45-goog
>

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

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

* Re: [PATCH 2/2] arm64: dts: mt8183: Add panel rotation
  2022-06-06 15:29   ` Hsin-Yi Wang
@ 2022-06-17 14:10     ` Matthias Brugger
  2022-06-17 14:25       ` Hsin-Yi Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Matthias Brugger @ 2022-06-17 14:10 UTC (permalink / raw)
  To: Hsin-Yi Wang, Chun-Kuang Hu
  Cc: Hans de Goede, Philipp Zabel, David Airlie, Daniel Vetter,
	dri-devel, linux-mediatek, Rob Clark, Stephen Boyd,
	Douglas Anderson, Rob Herring, linux-arm-kernel, linux-kernel

Hi Hsin-Yi Wang,

On 06/06/2022 17:29, Hsin-Yi Wang wrote:
> On Mon, May 30, 2022 at 7:30 PM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
>>
>> krane, kakadu, and kodama boards have a default panel rotation.
>>
>> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
>> Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>> Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>> ---
> 
> Hi Matthias,
> 
> The series ("Add a panel API to return panel orientation") might land
> in drm-misc. With this series applied, we can add this patch to give
> the correct default orientation for mt8183 kukui devices.
> I didn't send this patch again with the series, since they might land
> in different trees.
> 

I had a look on Linux next (next-20220617) and wasn't able to find the mtk_dsi.c 
changes. What is the status of this?

Regards,
Matthias

> Thanks.
> 
>>   arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
>> index 8d5bf73a9099..f0dd5a06629d 100644
>> --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
>> +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
>> @@ -276,6 +276,7 @@ panel: panel@0 {
>>                  avee-supply = <&ppvarp_lcd>;
>>                  pp1800-supply = <&pp1800_lcd>;
>>                  backlight = <&backlight_lcd0>;
>> +               rotation = <270>;
>>                  port {
>>                          panel_in: endpoint {
>>                                  remote-endpoint = <&dsi_out>;
>> --
>> 2.36.1.124.g0e6072fb45-goog
>>

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

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

* Re: [PATCH 2/2] arm64: dts: mt8183: Add panel rotation
  2022-06-17 14:10     ` Matthias Brugger
@ 2022-06-17 14:25       ` Hsin-Yi Wang
  2022-07-07 14:53         ` Matthias Brugger
  0 siblings, 1 reply; 7+ messages in thread
From: Hsin-Yi Wang @ 2022-06-17 14:25 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: Chun-Kuang Hu, Hans de Goede, Philipp Zabel, David Airlie,
	Daniel Vetter, dri-devel, linux-mediatek, Rob Clark,
	Stephen Boyd, Douglas Anderson, Rob Herring, linux-arm-kernel,
	linux-kernel

On Fri, Jun 17, 2022 at 10:10 PM Matthias Brugger
<matthias.bgg@gmail.com> wrote:
>
> Hi Hsin-Yi Wang,
>
> On 06/06/2022 17:29, Hsin-Yi Wang wrote:
> > On Mon, May 30, 2022 at 7:30 PM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
> >>
> >> krane, kakadu, and kodama boards have a default panel rotation.
> >>
> >> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> >> Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> >> Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> >> ---
> >
> > Hi Matthias,
> >
> > The series ("Add a panel API to return panel orientation") might land
> > in drm-misc. With this series applied, we can add this patch to give
> > the correct default orientation for mt8183 kukui devices.
> > I didn't send this patch again with the series, since they might land
> > in different trees.
> >
>
> I had a look on Linux next (next-20220617) and wasn't able to find the mtk_dsi.c
> changes. What is the status of this?
>
The mtk_dsi change got dropped. The latest is this series:
https://lore.kernel.org/lkml/20220609072722.3488207-1-hsinyi@chromium.org/,
still waiting to be picked or others' comments.

If the dts patch is picked without the drm series, there will be a
WARN, but won't affect boot or display up.


> Regards,
> Matthias
>
> > Thanks.
> >
> >>   arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 +
> >>   1 file changed, 1 insertion(+)
> >>
> >> diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
> >> index 8d5bf73a9099..f0dd5a06629d 100644
> >> --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
> >> +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
> >> @@ -276,6 +276,7 @@ panel: panel@0 {
> >>                  avee-supply = <&ppvarp_lcd>;
> >>                  pp1800-supply = <&pp1800_lcd>;
> >>                  backlight = <&backlight_lcd0>;
> >> +               rotation = <270>;
> >>                  port {
> >>                          panel_in: endpoint {
> >>                                  remote-endpoint = <&dsi_out>;
> >> --
> >> 2.36.1.124.g0e6072fb45-goog
> >>

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

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

* Re: [PATCH 2/2] arm64: dts: mt8183: Add panel rotation
  2022-06-17 14:25       ` Hsin-Yi Wang
@ 2022-07-07 14:53         ` Matthias Brugger
  0 siblings, 0 replies; 7+ messages in thread
From: Matthias Brugger @ 2022-07-07 14:53 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Philipp Zabel, David Airlie,
	Daniel Vetter, dri-devel, linux-mediatek, Rob Clark,
	Stephen Boyd, Douglas Anderson, Rob Herring, linux-arm-kernel,
	linux-kernel



On 17/06/2022 16:25, Hsin-Yi Wang wrote:
> On Fri, Jun 17, 2022 at 10:10 PM Matthias Brugger
> <matthias.bgg@gmail.com> wrote:
>>
>> Hi Hsin-Yi Wang,
>>
>> On 06/06/2022 17:29, Hsin-Yi Wang wrote:
>>> On Mon, May 30, 2022 at 7:30 PM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
>>>>
>>>> krane, kakadu, and kodama boards have a default panel rotation.
>>>>
>>>> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
>>>> Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>>>> Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>>>> ---
>>>
>>> Hi Matthias,
>>>
>>> The series ("Add a panel API to return panel orientation") might land
>>> in drm-misc. With this series applied, we can add this patch to give
>>> the correct default orientation for mt8183 kukui devices.
>>> I didn't send this patch again with the series, since they might land
>>> in different trees.
>>>
>>
>> I had a look on Linux next (next-20220617) and wasn't able to find the mtk_dsi.c
>> changes. What is the status of this?
>>
> The mtk_dsi change got dropped. The latest is this series:
> https://lore.kernel.org/lkml/20220609072722.3488207-1-hsinyi@chromium.org/,
> still waiting to be picked or others' comments.
> 

I saw this got merged, so merging this patch now.

Thanks!

> If the dts patch is picked without the drm series, there will be a
> WARN, but won't affect boot or display up.
> 
> 
>> Regards,
>> Matthias
>>
>>> Thanks.
>>>
>>>>    arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 +
>>>>    1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
>>>> index 8d5bf73a9099..f0dd5a06629d 100644
>>>> --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
>>>> +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
>>>> @@ -276,6 +276,7 @@ panel: panel@0 {
>>>>                   avee-supply = <&ppvarp_lcd>;
>>>>                   pp1800-supply = <&pp1800_lcd>;
>>>>                   backlight = <&backlight_lcd0>;
>>>> +               rotation = <270>;
>>>>                   port {
>>>>                           panel_in: endpoint {
>>>>                                   remote-endpoint = <&dsi_out>;
>>>> --
>>>> 2.36.1.124.g0e6072fb45-goog
>>>>

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

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

* [PATCH 2/2] arm64: dts: mt8183: Add panel rotation
  2021-04-09  4:53 [PATCH 1/2] drm/mediatek: set panel orientation before drm_dev_register() Hsin-Yi Wang
@ 2021-04-09  4:53 ` Hsin-Yi Wang
  0 siblings, 0 replies; 7+ messages in thread
From: Hsin-Yi Wang @ 2021-04-09  4:53 UTC (permalink / raw)
  To: Chun-Kuang Hu, Matthias Brugger, Enric Balletbo i Serra
  Cc: Philipp Zabel, David Airlie, Daniel Vetter, dri-devel,
	linux-mediatek, linux-arm-kernel, linux-kernel, Rob Herring,
	devicetree

krane, kakadu, and kodama boards have a default panel rotation.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
 arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
index ff56bcfa3370..793cc9501337 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
@@ -263,6 +263,7 @@ panel: panel@0 {
 		avee-supply = <&ppvarp_lcd>;
 		pp1800-supply = <&pp1800_lcd>;
 		backlight = <&backlight_lcd0>;
+		rotation = <270>;
 		port {
 			panel_in: endpoint {
 				remote-endpoint = <&dsi_out>;
-- 
2.31.1.295.g9ea45b61b8-goog


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

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

end of thread, other threads:[~2022-07-07 14:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-30 11:30 [PATCH 1/2] drm/mediatek: Config orientation property if panel provides it Hsin-Yi Wang
2022-05-30 11:30 ` [PATCH 2/2] arm64: dts: mt8183: Add panel rotation Hsin-Yi Wang
2022-06-06 15:29   ` Hsin-Yi Wang
2022-06-17 14:10     ` Matthias Brugger
2022-06-17 14:25       ` Hsin-Yi Wang
2022-07-07 14:53         ` Matthias Brugger
  -- strict thread matches above, loose matches on Subject: below --
2021-04-09  4:53 [PATCH 1/2] drm/mediatek: set panel orientation before drm_dev_register() Hsin-Yi Wang
2021-04-09  4:53 ` [PATCH 2/2] arm64: dts: mt8183: Add panel rotation Hsin-Yi Wang

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).