Re: [PATCH v4 0/8] Add a panel API to return panel orientation

From: Sam Ravnborg
Date: Mon Jun 06 2022 - 15:28:51 EST


Hi Hsin-Yi,
thanks for this nice series.

On Mon, Jun 06, 2022 at 11:24:23PM +0800, Hsin-Yi Wang wrote:
> Panels usually call drm_connector_set_panel_orientation(), which is
> later than drm/kms driver calling drm_dev_register(). This leads to a
> WARN()[1].
>
> The orientation property is known earlier. For example, some panels
> parse the property through device tree during probe.
>
> The series add a panel API drm_panel_get_orientation() for drm/kms
> drivers. The drivers can use the API to get panel's orientation, so they
> can call drm_connector_set_panel_orientation() before drm_dev_register().
>
> Panel needs to implement .get_orientation callback to return the property.

The following comment appears in every panel driver:
+ /*
+ * drm drivers are expected to call drm_panel_get_orientation() to get
+ * panel's orientation then drm_connector_set_panel_orientation() to
+ * set the property before drm_dev_register(). Otherwise there will be
+ * a WARN_ON if orientation is set after drm is registered.
+ */

Please move it to the drm_panel c or h file, it is noise to add it to
all panel drivers.

Sam