694e2a0082feca83c2f5159f304c83afde8573c1
[openwrt/openwrt.git] /
1 From b882872e4391bf38d8cb7fb2544d6941f297b57d Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 1 Feb 2022 12:20:20 +0000
4 Subject: [PATCH 1051/1085] drm/panel: Add and initialise an orientation field
5 to drm_panel from OF
6
7 "rotation" is listed as a standard property of panels in panel-common.yaml,
8 therefore it would be logical to process that from within the core
9 code should a panel driver not implement the get_orientation hook.
10
11 Call of_drm_get_panel_orientation from
12 drm_connector_set_orientation_from_panel to get that information.
13
14 This removes the need for any boiler-plate in panel drivers for calling
15 drm_connector_set_orientation_from_panel or
16 drm_connector_set_panel_orientation.
17
18 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
19 ---
20 drivers/gpu/drm/drm_connector.c | 9 +++++++--
21 1 file changed, 7 insertions(+), 2 deletions(-)
22
23 --- a/drivers/gpu/drm/drm_connector.c
24 +++ b/drivers/gpu/drm/drm_connector.c
25 @@ -2697,10 +2697,15 @@ int drm_connector_set_orientation_from_p
26 {
27 enum drm_panel_orientation orientation;
28
29 - if (panel && panel->funcs && panel->funcs->get_orientation)
30 + if (panel && panel->funcs && panel->funcs->get_orientation) {
31 orientation = panel->funcs->get_orientation(panel);
32 - else
33 + } else {
34 orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
35 + if (panel) {
36 + of_drm_get_panel_orientation(panel->dev->of_node,
37 + &orientation);
38 + }
39 + }
40
41 return drm_connector_set_panel_orientation(connector, orientation);
42 }