drm/mediatek: Config orientation property if panel provides it
Subsystems (4)
PATCH 1/2 drm/mediatek: Config orientation property if panel provides it
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.
---
This patch is to solve the same problem as [1]
[1] https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/
--- drivers/gpu/drm/mediatek/mtk_dsi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/gpu/drm/mediatek/mtk_dsi.c +13 -0
@@ -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)
Signature · 1 line
2.36.1.124.g0e6072fb45-goog
PATCH 2/2 arm64: dts: mt8183: Add panel rotation
krane, kakadu, and kodama boards have a default panel rotation.
--- arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +1 -0
@@ -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>;
Signature · 1 line
2.36.1.124.g0e6072fb45-goog
Re: [PATCH 2/2] arm64: dts: mt8183: Add panel rotation
Quoted 7 lines · Hsin-Yi Wang
krane, kakadu, and kodama boards have a default panel rotation.
Signed-off-by Hsin-Yi Wang <[email protected]>Reviewed-by Enric Balletbo i Serra <[email protected]>---
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.
Quoted 18 lines
arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 + 1 file changed, 1 insertion(+)arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +1
-1@@ -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
Matthias Brugger
maintainerRe: [PATCH 2/2] arm64: dts: mt8183: Add panel rotation
Hi Hsin-Yi Wang,
Quoted 9 lines · Hsin-Yi Wang
Quoted 7 lines · Hsin-Yi Wang
krane, kakadu, and kodama boards have a default panel rotation.
Signed-off-by Hsin-Yi Wang <[email protected]>Reviewed-by Enric Balletbo i Serra <[email protected]>---
Quoted 8 lines
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
Quoted 20 lines
Thanks.
Quoted 18 lines
arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 + 1 file changed, 1 insertion(+)arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +1
-1@@ -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
Re: [PATCH 2/2] arm64: dts: mt8183: Add panel rotation
Quoted 22 lines · Matthias Brugger
Hi Hsin-Yi Wang,
Quoted 9 lines · Hsin-Yi Wang
Quoted 7 lines · Hsin-Yi Wang
krane, kakadu, and kodama boards have a default panel rotation.
Signed-off-by Hsin-Yi Wang <[email protected]>Reviewed-by Enric Balletbo i Serra <[email protected]>---
Quoted 8 lines
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.
Quoted 3 lines
I had a look on Linux next (next-20220617) and wasn't able to find the
mtk_dsi.cchanges. What is the status of this?
The mtk_dsi change got dropped. The latest is this series:
https://lore.kernel.org/lkml/[email protected]/,
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.
Quoted 23 lines
Regards,
MatthiasQuoted 20 lines
Thanks.
Quoted 18 lines
arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 + 1 file changed, 1 insertion(+)arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +1
-1@@ -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
Matthias Brugger
maintainerRe: [PATCH 2/2] arm64: dts: mt8183: Add panel rotation
Quoted 24 lines · Hsin-Yi Wang
Quoted 22 lines · Matthias Brugger
Hi Hsin-Yi Wang,
Quoted 17 lines · Hsin-Yi Wang
Quoted 7 lines · Hsin-Yi Wang
krane, kakadu, and kodama boards have a default panel rotation.
Signed-off-by Hsin-Yi Wang <[email protected]>Reviewed-by Enric Balletbo i Serra <[email protected]>---
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.
Quoted 7 lines
Quoted 3 lines
I had a look on Linux next (next-20220617) and wasn't able to find the
mtk_dsi.cchanges. What is the status of this?The
mtk_dsichange got dropped. The latest is this series:
https://lore.kernel.org/lkml/[email protected]/,
still waiting to be picked or others' comments.
I saw this got merged, so merging this patch now.
Thanks!
Quoted 27 lines
If the dts patch is picked without the drm series, there will be a WARN, but won't affect boot or display up.
Quoted 23 lines
Regards,
MatthiasQuoted 20 lines
Thanks.
Quoted 18 lines
arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 + 1 file changed, 1 insertion(+)arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +1
-1@@ -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