Skip to content

Commit 843ca41

Browse files
committed
drm/panel: Add and initialise an orientation field to drm_panel
Current usage of drm_connector_set_panel_orientation is from a panel's get_modes call. However if the panel orientation property doesn't exist on the connector at this point, then drm_mode_object triggers WARNs as the connector is already registered. Add an orientation variable to struct drm_panel and initialise it from drm_panel_init. panel_bridge_attach can then create the property before the connector is registered. Signed-off-by: Dave Stevenson <[email protected]>
1 parent e6dd932 commit 843ca41

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

drivers/gpu/drm/bridge/panel.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ static int panel_bridge_attach(struct drm_bridge *bridge,
7979
return ret;
8080
}
8181

82+
/* set up connector's "panel orientation" property */
83+
drm_connector_set_panel_orientation(&panel_bridge->connector,
84+
panel_bridge->panel->orientation);
85+
8286
drm_connector_attach_encoder(&panel_bridge->connector,
8387
bridge->encoder);
8488

drivers/gpu/drm/drm_panel.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ void drm_panel_init(struct drm_panel *panel, struct device *dev,
6161
panel->dev = dev;
6262
panel->funcs = funcs;
6363
panel->connector_type = connector_type;
64+
#ifdef CONFIG_OF
65+
{
66+
int ret;
67+
68+
ret = of_drm_get_panel_orientation(dev->of_node,
69+
&panel->orientation);
70+
if (ret) {
71+
DRM_DEV_ERROR(panel->dev, "%pOF: failed to get orientation %d\n",
72+
dev->of_node, ret);
73+
panel->orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
74+
}
75+
}
76+
#else
77+
panel->orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
78+
#endif
6479
}
6580
EXPORT_SYMBOL(drm_panel_init);
6681

include/drm/drm_panel.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@ struct drm_panel {
165165
*/
166166
int connector_type;
167167

168+
/**
169+
* @orientation:
170+
*
171+
* Panel orientation at initialisation. This is used to initialise the
172+
* drm_connector property for panel orientation.
173+
*/
174+
enum drm_panel_orientation orientation;
175+
168176
/**
169177
* @list:
170178
*

0 commit comments

Comments
 (0)