2022-06-08 10:40:52

by Hsin-Yi Wang

[permalink] [raw]
Subject: [PATCH v6 0/8] Add a panel API to set orientation properly

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_connector_set_orientation_from_panel()
for drm/kms drivers. The drivers can call the API to set panel's
orientation before drm_dev_register().

Panel needs to implement .get_orientation callback to return the property.

[1] https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/

Hsin-Yi Wang (8):
drm/panel: Add an API to allow drm to set orientation from panel
drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback
drm/panel: panel-edp: Implement .get_orientation callback
drm/panel: lvds: Implement .get_orientation callback
drm/panel: panel-simple: Implement .get_orientation callback
drm/panel: ili9881c: Implement .get_orientation callback
drm/panel: elida-kd35t133: Implement .get_orientation callback
drm: Config orientation property if panel provides it

drivers/gpu/drm/bridge/panel.c | 36 +++++++++++++++++++
drivers/gpu/drm/drm_bridge_connector.c | 8 ++++-
drivers/gpu/drm/drm_connector.c | 32 +++++++++++++++++
.../gpu/drm/panel/panel-boe-tv101wum-nl6.c | 12 +++++++
drivers/gpu/drm/panel/panel-edp.c | 13 ++++++-
drivers/gpu/drm/panel/panel-elida-kd35t133.c | 12 +++++++
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 12 +++++++
drivers/gpu/drm/panel/panel-lvds.c | 13 +++++++
drivers/gpu/drm/panel/panel-simple.c | 14 +++++++-
include/drm/drm_bridge.h | 3 ++
include/drm/drm_connector.h | 4 +++
include/drm/drm_panel.h | 9 +++++
12 files changed, 165 insertions(+), 3 deletions(-)

--
2.36.1.255.ge46751e96f-goog


2022-06-08 10:41:04

by Hsin-Yi Wang

[permalink] [raw]
Subject: [PATCH v6 3/8] drm/panel: panel-edp: Implement .get_orientation callback

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Douglas Anderson <[email protected]>
---
drivers/gpu/drm/panel/panel-edp.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index c96014464355..ee622c1dd532 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -586,7 +586,10 @@ static int panel_edp_get_modes(struct drm_panel *panel,
else if (!num)
dev_warn(p->base.dev, "No display modes\n");

- /* set up connector's "panel orientation" property */
+ /*
+ * TODO: Remove once all drm drivers call
+ * drm_connector_set_orientation_from_panel()
+ */
drm_connector_set_panel_orientation(connector, p->orientation);

return num;
@@ -609,6 +612,13 @@ static int panel_edp_get_timings(struct drm_panel *panel,
return p->desc->num_timings;
}

+static enum drm_panel_orientation panel_edp_get_orientation(struct drm_panel *panel)
+{
+ struct panel_edp *p = to_panel_edp(panel);
+
+ return p->orientation;
+}
+
static int detected_panel_show(struct seq_file *s, void *data)
{
struct drm_panel *panel = s->private;
@@ -637,6 +647,7 @@ static const struct drm_panel_funcs panel_edp_funcs = {
.prepare = panel_edp_prepare,
.enable = panel_edp_enable,
.get_modes = panel_edp_get_modes,
+ .get_orientation = panel_edp_get_orientation,
.get_timings = panel_edp_get_timings,
.debugfs_init = panel_edp_debugfs_init,
};
--
2.36.1.255.ge46751e96f-goog

2022-06-08 10:41:30

by Hsin-Yi Wang

[permalink] [raw]
Subject: [PATCH v6 7/8] drm/panel: elida-kd35t133: Implement .get_orientation callback

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Douglas Anderson <[email protected]>
---
drivers/gpu/drm/panel/panel-elida-kd35t133.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 80227617a4d6..fa613d1d7a8f 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -217,15 +217,27 @@ static int kd35t133_get_modes(struct drm_panel *panel,
connector->display_info.width_mm = mode->width_mm;
connector->display_info.height_mm = mode->height_mm;
drm_mode_probed_add(connector, mode);
+ /*
+ * TODO: Remove once all drm drivers call
+ * drm_connector_set_orientation_from_panel()
+ */
drm_connector_set_panel_orientation(connector, ctx->orientation);

return 1;
}

+static enum drm_panel_orientation kd35t133_get_orientation(struct drm_panel *panel)
+{
+ struct kd35t133 *ctx = panel_to_kd35t133(panel);
+
+ return ctx->orientation;
+}
+
static const struct drm_panel_funcs kd35t133_funcs = {
.unprepare = kd35t133_unprepare,
.prepare = kd35t133_prepare,
.get_modes = kd35t133_get_modes,
+ .get_orientation = kd35t133_get_orientation,
};

static int kd35t133_probe(struct mipi_dsi_device *dsi)
--
2.36.1.255.ge46751e96f-goog

2022-06-08 10:41:37

by Hsin-Yi Wang

[permalink] [raw]
Subject: [PATCH v6 4/8] drm/panel: lvds: Implement .get_orientation callback

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Reviewed-by: Douglas Anderson <[email protected]>
---
drivers/gpu/drm/panel/panel-lvds.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index f11252fb00fe..7a4fedc63e8e 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -99,15 +99,28 @@ static int panel_lvds_get_modes(struct drm_panel *panel,
drm_display_info_set_bus_formats(&connector->display_info,
&lvds->bus_format, 1);
connector->display_info.bus_flags = lvds->bus_flags;
+
+ /*
+ * TODO: Remove once all drm drivers call
+ * drm_connector_set_orientation_from_panel()
+ */
drm_connector_set_panel_orientation(connector, lvds->orientation);

return 1;
}

+static enum drm_panel_orientation panel_lvds_get_orientation(struct drm_panel *panel)
+{
+ struct panel_lvds *lvds = to_panel_lvds(panel);
+
+ return lvds->orientation;
+}
+
static const struct drm_panel_funcs panel_lvds_funcs = {
.unprepare = panel_lvds_unprepare,
.prepare = panel_lvds_prepare,
.get_modes = panel_lvds_get_modes,
+ .get_orientation = panel_lvds_get_orientation,
};

static int panel_lvds_parse_dt(struct panel_lvds *lvds)
--
2.36.1.255.ge46751e96f-goog

2022-06-08 21:13:56

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH v6 3/8] drm/panel: panel-edp: Implement .get_orientation callback

Quoting Hsin-Yi Wang (2022-06-08 02:48:11)
> To return the orientation property to drm/kms driver.
>
> Signed-off-by: Hsin-Yi Wang <[email protected]>
> Reviewed-by: Hans de Goede <[email protected]>
> Reviewed-by: Douglas Anderson <[email protected]>
> ---

Reviewed-by: Stephen Boyd <[email protected]>

2022-06-08 21:26:50

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH v6 7/8] drm/panel: elida-kd35t133: Implement .get_orientation callback

Quoting Hsin-Yi Wang (2022-06-08 02:48:15)
> To return the orientation property to drm/kms driver.
>
> Signed-off-by: Hsin-Yi Wang <[email protected]>
> Reviewed-by: Hans de Goede <[email protected]>
> Reviewed-by: Douglas Anderson <[email protected]>
> ---

Reviewed-by: Stephen Boyd <[email protected]>

2022-06-08 21:44:44

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH v6 4/8] drm/panel: lvds: Implement .get_orientation callback

Quoting Hsin-Yi Wang (2022-06-08 02:48:12)
> To return the orientation property to drm/kms driver.
>
> Signed-off-by: Hsin-Yi Wang <[email protected]>
> Reviewed-by: Hans de Goede <[email protected]>
> Reviewed-by: Douglas Anderson <[email protected]>
> ---

Reviewed-by: Stephen Boyd <[email protected]>