Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v1 0/26] drm/panel infrastructure + backlight update
@ 2019-12-02 19:32 Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 01/26] drm/drm_panel: no error when no callback Sam Ravnborg
                   ` (26 more replies)
  0 siblings, 27 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, linux-samsung-soc,
	linux-rockchip, Tomi Valkeinen, Jagan Teki, NXP Linux Team,
	Jitao Shi, Pengutronix Kernel Team, Maarten Lankhorst,
	Maxime Ripard, linux-mediatek, Abhinav Kumar, linux-tegra,
	Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

This patchset include a couple of different
things - all related to panels.

- The panel callbacks are optional - so drop error if
  callback is not present.
 
- Add support for backlight in drm_panel.
  This allows us to make much simpler backlight
  support to most panels.
  The patchset include conversion of most of the
  trivial cases.

- Drop drm_connector from drm_panel.
  This change required many changes to most
  panels and many bridges and display drivers.
  This is by far the most invasive change in this patchset.

- Drop the unused get_timings() callback.
  No users, so no need to keep it around.

With this patchset drm_panel_(attach|detach) are nop's
but they are kept for now.

A few of these patches has been sent out before - but versioning
started again from v1 - as the most patches are new.

I have tested the panel-simple changes, and thus some
of the infrastructure changes.
The testing was done on an earlier iteration - and I ended
up submitting this as Laurent and others started to depend on it.
Jitao has a patch to add more callbacks, and I wanted the
simplification of the callbacks before we add more callbacks.

	Sam


Sam Ravnborg (26):
      drm/drm_panel: no error when no callback
      drm/panel: add backlight support
      drm/panel: simple: use drm_panel backlight support
      drm: get drm_bridge_panel connector via helper
      drm/panel: add drm_connector argument to get_modes()
      drm/panel: decouple connector from drm_panel
      drm/panel: remove get_timings
      drm/panel: drop drm_device from drm_panel
      drm/panel: feiyang-fy07024di26a30d: use drm_panel backlight support
      drm/panel: ilitek-ili9881c: use drm_panel backlight support
      drm/panel: innolux-p079zca: use drm_panel backlight support
      drm/panel: kingdisplay-kd097d04: use drm_panel backlight support
      drm/panel: lvds: use drm_panel backlight support
      drm/panel: olimex-lcd-olinuxino: use drm_panel backlight support
      drm/panel: osd-osd101t2587-53ts: use drm_panel backlight support
      drm/panel: panasonic-vvx10f034n00: use drm_panel backlight support
      drm/panel: raydium-rm68200: use drm_panel backlight support
      drm/panel: rocktech-jh057n00900: use drm_panel backlight support
      drm/panel: ronbo-rb070d30: use drm_panel backlight support
      drm/panel: seiko-43wvf1g: use drm_panel backlight support
      drm/panel: sharp-lq101r1sx01: use drm_panel backlight support
      drm/panel: sharp-ls043t1le01: use drm_panel backlight support
      drm/panel: sitronix-st7701: use drm_panel backlight support
      drm/panel: sitronix-st7789v: use drm_panel backlight support
      drm/panel: tpo-td028ttec1: use drm_panel backlight support
      drm/panel: tpo-tpg110: use drm_panel backlight support

 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c |   2 +-
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |   2 +-
 drivers/gpu/drm/bridge/panel.c                     |  18 +++-
 drivers/gpu/drm/bridge/parade-ps8622.c             |   2 +-
 drivers/gpu/drm/bridge/tc358764.c                  |   2 +-
 drivers/gpu/drm/bridge/tc358767.c                  |   2 +-
 drivers/gpu/drm/bridge/ti-sn65dsi86.c              |   2 +-
 drivers/gpu/drm/drm_panel.c                        |  96 ++++++++++++++----
 drivers/gpu/drm/exynos/exynos_drm_dpi.c            |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c            |   2 +-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c          |   2 +-
 drivers/gpu/drm/imx/imx-ldb.c                      |   2 +-
 drivers/gpu/drm/imx/parallel-display.c             |   2 +-
 drivers/gpu/drm/mediatek/mtk_dsi.c                 |   2 +-
 .../gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c    |   2 +-
 drivers/gpu/drm/msm/dsi/dsi_manager.c              |   2 +-
 drivers/gpu/drm/mxsfb/mxsfb_out.c                  |   2 +-
 drivers/gpu/drm/omapdrm/omap_connector.c           |   3 +-
 drivers/gpu/drm/panel/panel-arm-versatile.c        |   6 +-
 .../gpu/drm/panel/panel-feiyang-fy07024di26a30d.c  |  16 ++-
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c       |  20 ++--
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c      |  29 ++----
 drivers/gpu/drm/panel/panel-innolux-p079zca.c      |  45 +++------
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c     |  11 ++-
 drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c |  43 +++-----
 drivers/gpu/drm/panel/panel-lg-lb035q02.c          |   6 +-
 drivers/gpu/drm/panel/panel-lg-lg4573.c            |  12 +--
 drivers/gpu/drm/panel/panel-lvds.c                 |  46 ++-------
 drivers/gpu/drm/panel/panel-nec-nl8048hl11.c       |   6 +-
 drivers/gpu/drm/panel/panel-novatek-nt39016.c      |   6 +-
 drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c |  27 ++---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c   |  11 ++-
 drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c |  37 +++----
 .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c   |  58 +++--------
 .../gpu/drm/panel/panel-raspberrypi-touchscreen.c  |   9 +-
 drivers/gpu/drm/panel/panel-raydium-rm67191.c      |   8 +-
 drivers/gpu/drm/panel/panel-raydium-rm68200.c      |  26 +++--
 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c |  35 +++----
 drivers/gpu/drm/panel/panel-ronbo-rb070d30.c       |  31 ++----
 drivers/gpu/drm/panel/panel-samsung-ld9040.c       |   4 +-
 drivers/gpu/drm/panel/panel-samsung-s6d16d0.c      |   6 +-
 drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c      |   6 +-
 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c   |   6 +-
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c      |   6 +-
 drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c      |   4 +-
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c        |  72 +++-----------
 drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c    |  34 +++----
 drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c    |   6 +-
 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c    |  33 +++----
 drivers/gpu/drm/panel/panel-simple.c               | 110 ++++++---------------
 drivers/gpu/drm/panel/panel-sitronix-st7701.c      |  23 ++---
 drivers/gpu/drm/panel/panel-sitronix-st7789v.c     |  49 ++-------
 drivers/gpu/drm/panel/panel-sony-acx565akm.c       |   6 +-
 drivers/gpu/drm/panel/panel-tpo-td028ttec1.c       |  20 ++--
 drivers/gpu/drm/panel/panel-tpo-td043mtea1.c       |   6 +-
 drivers/gpu/drm/panel/panel-tpo-tpg110.c           |  26 ++---
 drivers/gpu/drm/panel/panel-truly-nt35597.c        |   4 +-
 drivers/gpu/drm/pl111/pl111_drv.c                  |   2 +-
 drivers/gpu/drm/rcar-du/rcar_lvds.c                |   2 +-
 drivers/gpu/drm/rockchip/rockchip_lvds.c           |   2 +-
 drivers/gpu/drm/sti/sti_dvo.c                      |   2 +-
 drivers/gpu/drm/sun4i/sun4i_lvds.c                 |   2 +-
 drivers/gpu/drm/sun4i/sun4i_rgb.c                  |   2 +-
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c             |   2 +-
 drivers/gpu/drm/tegra/output.c                     |   2 +-
 drivers/gpu/drm/tve200/tve200_drv.c                |   2 +-
 include/drm/drm_bridge.h                           |   1 +
 include/drm/drm_panel.h                            |  49 ++++-----
 68 files changed, 460 insertions(+), 664 deletions(-)



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 01/26] drm/drm_panel: no error when no callback
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
@ 2019-12-02 19:32 ` Sam Ravnborg
  2019-12-03  6:24   ` Laurent Pinchart
  2019-12-02 19:32 ` [PATCH v1 02/26] drm/panel: add backlight support Sam Ravnborg
                   ` (25 subsequent siblings)
  26 siblings, 1 reply; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

The callbacks in drm_panel_funcs are optional, so do not
return an error just because no callback is assigned.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/drm_panel.c | 35 +++++++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index ed7985c0535a..2d59cdd05e50 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -151,10 +151,13 @@ EXPORT_SYMBOL(drm_panel_detach);
  */
 int drm_panel_prepare(struct drm_panel *panel)
 {
-	if (panel && panel->funcs && panel->funcs->prepare)
+	if (!panel)
+		return -EINVAL;
+
+	if (panel->funcs && panel->funcs->prepare)
 		return panel->funcs->prepare(panel);
 
-	return panel ? -ENOSYS : -EINVAL;
+	return 0;
 }
 EXPORT_SYMBOL(drm_panel_prepare);
 
@@ -171,10 +174,13 @@ EXPORT_SYMBOL(drm_panel_prepare);
  */
 int drm_panel_unprepare(struct drm_panel *panel)
 {
-	if (panel && panel->funcs && panel->funcs->unprepare)
+	if (!panel)
+		return -EINVAL;
+
+	if (panel->funcs && panel->funcs->unprepare)
 		return panel->funcs->unprepare(panel);
 
-	return panel ? -ENOSYS : -EINVAL;
+	return 0;
 }
 EXPORT_SYMBOL(drm_panel_unprepare);
 
@@ -190,10 +196,13 @@ EXPORT_SYMBOL(drm_panel_unprepare);
  */
 int drm_panel_enable(struct drm_panel *panel)
 {
-	if (panel && panel->funcs && panel->funcs->enable)
+	if (!panel)
+		return -EINVAL;
+
+	if (panel->funcs && panel->funcs->enable)
 		return panel->funcs->enable(panel);
 
-	return panel ? -ENOSYS : -EINVAL;
+	return 0;
 }
 EXPORT_SYMBOL(drm_panel_enable);
 
@@ -209,10 +218,13 @@ EXPORT_SYMBOL(drm_panel_enable);
  */
 int drm_panel_disable(struct drm_panel *panel)
 {
-	if (panel && panel->funcs && panel->funcs->disable)
+	if (!panel)
+		return -EINVAL;
+
+	if (panel->funcs && panel->funcs->disable)
 		return panel->funcs->disable(panel);
 
-	return panel ? -ENOSYS : -EINVAL;
+	return 0;
 }
 EXPORT_SYMBOL(drm_panel_disable);
 
@@ -228,10 +240,13 @@ EXPORT_SYMBOL(drm_panel_disable);
  */
 int drm_panel_get_modes(struct drm_panel *panel)
 {
-	if (panel && panel->funcs && panel->funcs->get_modes)
+	if (!panel)
+		return -EINVAL;
+
+	if (panel->funcs && panel->funcs->get_modes)
 		return panel->funcs->get_modes(panel);
 
-	return panel ? -ENOSYS : -EINVAL;
+	return 0;
 }
 EXPORT_SYMBOL(drm_panel_get_modes);
 
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 02/26] drm/panel: add backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 01/26] drm/drm_panel: no error when no callback Sam Ravnborg
@ 2019-12-02 19:32 ` Sam Ravnborg
  2019-12-03  6:32   ` Laurent Pinchart
  2019-12-02 19:32 ` [PATCH v1 03/26] drm/panel: simple: use drm_panel " Sam Ravnborg
                   ` (24 subsequent siblings)
  26 siblings, 1 reply; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg, Maxime Ripard,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Panels often supports backlight as specified in a device tree.
Update the drm_panel infrastructure to support this to
simplify the drivers.

With this the panel driver just needs to add the following to the
probe() function:

    err = drm_panel_of_backlight(panel);
    if (err)
            return err;

Then drm_panel will handle all the rest.

v2:
- Drop test of CONFIG_DRM_PANEL in header-file (Laurent)
- do not enable backlight if ->enable() returns an error

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/drm_panel.c | 49 +++++++++++++++++++++++++++++++++++--
 include/drm/drm_panel.h     | 23 +++++++++++++++++
 2 files changed, 70 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index 2d59cdd05e50..35609c90e467 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -21,6 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+#include <linux/backlight.h>
 #include <linux/err.h>
 #include <linux/module.h>
 
@@ -196,13 +197,18 @@ EXPORT_SYMBOL(drm_panel_unprepare);
  */
 int drm_panel_enable(struct drm_panel *panel)
 {
+	int ret = 0;
+
 	if (!panel)
 		return -EINVAL;
 
 	if (panel->funcs && panel->funcs->enable)
-		return panel->funcs->enable(panel);
+		ret = panel->funcs->enable(panel);
 
-	return 0;
+	if (ret >= 0)
+		backlight_enable(panel->backlight);
+
+	return ret;
 }
 EXPORT_SYMBOL(drm_panel_enable);
 
@@ -221,6 +227,8 @@ int drm_panel_disable(struct drm_panel *panel)
 	if (!panel)
 		return -EINVAL;
 
+	backlight_disable(panel->backlight);
+
 	if (panel->funcs && panel->funcs->disable)
 		return panel->funcs->disable(panel);
 
@@ -289,6 +297,43 @@ struct drm_panel *of_drm_find_panel(const struct device_node *np)
 EXPORT_SYMBOL(of_drm_find_panel);
 #endif
 
+#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
+/**
+ * drm_panel_of_backlight - use backlight device node for backlight
+ * @panel: DRM panel
+ *
+ * Use this function to enable backlight handling if your panel
+ * uses device tree and has a backlight handle.
+ *
+ * When panel is enabled backlight will be enabled after a
+ * successfull call to &drm_panel_funcs.enable()
+ *
+ * When panel is disabled backlight will be disabled before the
+ * call to &drm_panel_funcs.disable().
+ *
+ * A typical implementation for a panel driver supporting device tree
+ * will call this function and then backlight just works.
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int drm_panel_of_backlight(struct drm_panel *panel)
+{
+	struct backlight_device *backlight;
+
+	if (!panel || !panel->dev)
+		return -EINVAL;
+
+	backlight = devm_of_find_backlight(panel->dev);
+
+	if (IS_ERR(backlight))
+                return PTR_ERR(backlight);
+
+	panel->backlight = backlight;
+	return 0;
+}
+EXPORT_SYMBOL(drm_panel_of_backlight);
+#endif
+
 MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
 MODULE_DESCRIPTION("DRM panel infrastructure");
 MODULE_LICENSE("GPL and additional rights");
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index ce8da64022b4..d30c98567384 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -28,6 +28,7 @@
 #include <linux/errno.h>
 #include <linux/list.h>
 
+struct backlight_device;
 struct device_node;
 struct drm_connector;
 struct drm_device;
@@ -59,6 +60,10 @@ struct display_timing;
  *
  * To save power when no video data is transmitted, a driver can power down
  * the panel. This is the job of the .unprepare() function.
+ *
+ * Backlight can be handled automatically if configured using
+ * drm_panel_of_backlight(). Then the driver do not need to implement the
+ * functionality to enable/disable backlight.
  */
 struct drm_panel_funcs {
 	/**
@@ -132,6 +137,15 @@ struct drm_panel {
 	 */
 	struct device *dev;
 
+	/**
+	 * @backlight:
+	 *
+	 * Backlight device, used to turn on backlight after
+	 * the call to enable(), and to turn off
+	 * backlight before call to disable().
+	 */
+	struct backlight_device *backlight;
+
 	/**
 	 * @funcs:
 	 *
@@ -183,4 +197,13 @@ static inline struct drm_panel *of_drm_find_panel(const struct device_node *np)
 }
 #endif
 
+#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
+int drm_panel_of_backlight(struct drm_panel *panel);
+#else
+static inline int drm_panel_of_backlight(struct drm_panel *panel)
+{
+	return -EINVAL;
+}
+#endif
+
 #endif
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 03/26] drm/panel: simple: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 01/26] drm/drm_panel: no error when no callback Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 02/26] drm/panel: add backlight support Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-03  6:39   ` Laurent Pinchart
  2019-12-02 19:32 ` [PATCH v1 04/26] drm: get drm_bridge_panel connector via helper Sam Ravnborg
                   ` (23 subsequent siblings)
  26 siblings, 1 reply; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use drm_panel infrastructure for backlight.
Replace direct calls with drm_panel_*() calls
to utilize the drm_panel support.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/panel/panel-simple.c | 50 ++++++----------------------
 1 file changed, 11 insertions(+), 39 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 72f69709f349..a5df6d6dd455 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -21,7 +21,6 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
@@ -105,7 +104,6 @@ struct panel_simple {
 
 	const struct panel_desc *desc;
 
-	struct backlight_device *backlight;
 	struct regulator *supply;
 	struct i2c_adapter *ddc;
 
@@ -236,12 +234,6 @@ static int panel_simple_disable(struct drm_panel *panel)
 	if (!p->enabled)
 		return 0;
 
-	if (p->backlight) {
-		p->backlight->props.power = FB_BLANK_POWERDOWN;
-		p->backlight->props.state |= BL_CORE_FBBLANK;
-		backlight_update_status(p->backlight);
-	}
-
 	if (p->desc->delay.disable)
 		msleep(p->desc->delay.disable);
 
@@ -307,12 +299,6 @@ static int panel_simple_enable(struct drm_panel *panel)
 	if (p->desc->delay.enable)
 		msleep(p->desc->delay.enable);
 
-	if (p->backlight) {
-		p->backlight->props.state &= ~BL_CORE_FBBLANK;
-		p->backlight->props.power = FB_BLANK_UNBLANK;
-		backlight_update_status(p->backlight);
-	}
-
 	p->enabled = true;
 
 	return 0;
@@ -414,9 +400,9 @@ static void panel_simple_parse_panel_timing_node(struct device *dev,
 
 static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
 {
-	struct device_node *backlight, *ddc;
 	struct panel_simple *panel;
 	struct display_timing dt;
+	struct device_node *ddc;
 	int err;
 
 	panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
@@ -442,24 +428,13 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
 		return err;
 	}
 
-	backlight = of_parse_phandle(dev->of_node, "backlight", 0);
-	if (backlight) {
-		panel->backlight = of_find_backlight_by_node(backlight);
-		of_node_put(backlight);
-
-		if (!panel->backlight)
-			return -EPROBE_DEFER;
-	}
-
 	ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
 	if (ddc) {
 		panel->ddc = of_find_i2c_adapter_by_node(ddc);
 		of_node_put(ddc);
 
-		if (!panel->ddc) {
-			err = -EPROBE_DEFER;
-			goto free_backlight;
-		}
+		if (!panel->ddc)
+			return -EPROBE_DEFER;
 	}
 
 	if (!of_get_display_timing(dev->of_node, "panel-timing", &dt))
@@ -468,6 +443,10 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
 	drm_panel_init(&panel->base, dev, &panel_simple_funcs,
 		       desc->connector_type);
 
+	err = drm_panel_of_backlight(&panel->base);
+	if (err)
+		goto free_ddc;
+
 	err = drm_panel_add(&panel->base);
 	if (err < 0)
 		goto free_ddc;
@@ -479,9 +458,6 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
 free_ddc:
 	if (panel->ddc)
 		put_device(&panel->ddc->dev);
-free_backlight:
-	if (panel->backlight)
-		put_device(&panel->backlight->dev);
 
 	return err;
 }
@@ -491,16 +467,12 @@ static int panel_simple_remove(struct device *dev)
 	struct panel_simple *panel = dev_get_drvdata(dev);
 
 	drm_panel_remove(&panel->base);
-
-	panel_simple_disable(&panel->base);
-	panel_simple_unprepare(&panel->base);
+	drm_panel_disable(&panel->base);
+	drm_panel_unprepare(&panel->base);
 
 	if (panel->ddc)
 		put_device(&panel->ddc->dev);
 
-	if (panel->backlight)
-		put_device(&panel->backlight->dev);
-
 	return 0;
 }
 
@@ -508,8 +480,8 @@ static void panel_simple_shutdown(struct device *dev)
 {
 	struct panel_simple *panel = dev_get_drvdata(dev);
 
-	panel_simple_disable(&panel->base);
-	panel_simple_unprepare(&panel->base);
+	drm_panel_disable(&panel->base);
+	drm_panel_unprepare(&panel->base);
 }
 
 static const struct drm_display_mode ampire_am_480272h3tmqw_t01h_mode = {
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 04/26] drm: get drm_bridge_panel connector via helper
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (2 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 03/26] drm/panel: simple: use drm_panel " Sam Ravnborg
@ 2019-12-02 19:32 ` Sam Ravnborg
  2019-12-03  6:44   ` Laurent Pinchart
  2019-12-03 13:22   ` Linus Walleij
  2019-12-02 19:32 ` [PATCH v1 05/26] drm/panel: add drm_connector argument to get_modes() Sam Ravnborg
                   ` (22 subsequent siblings)
  26 siblings, 2 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Laurent Pinchart, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Jonas Karlman, Maarten Lankhorst, Maxime Ripard, linux-mediatek,
	Abhinav Kumar, linux-tegra, Sean Paul, linux-arm-kernel,
	Jernej Skrabec, Purism Kernel Team, Eric Anholt,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

The drm_connector created by drm_panel_bridge was accessed
via drm_panel.connector.
Avoid the detour around drm_panel by providing a simple get method.
This avoids direct access to the connector field in drm_panel in
the two users.

Update pl111 and tve200 to use the new helper.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Cc: Eric Anholt <eric@anholt.net>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/bridge/panel.c      | 16 ++++++++++++++++
 drivers/gpu/drm/pl111/pl111_drv.c   |  2 +-
 drivers/gpu/drm/tve200/tve200_drv.c |  2 +-
 include/drm/drm_bridge.h            |  1 +
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
index f4e293e7cf64..c5e27b81588a 100644
--- a/drivers/gpu/drm/bridge/panel.c
+++ b/drivers/gpu/drm/bridge/panel.c
@@ -289,3 +289,19 @@ struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,
 	return bridge;
 }
 EXPORT_SYMBOL(devm_drm_panel_bridge_add_typed);
+
+/**
+ * drm_panel_bridge_connector - return pointer to connector
+ *
+ * drm_panel_bridge creates the connector.
+ * This function gives external access to the connector.
+ *
+ * Returns: Pointer to drm_conneector
+ */
+struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge)
+{
+	struct panel_bridge * panel_bridge;
+	panel_bridge = drm_bridge_to_panel_bridge(bridge);
+
+	return &panel_bridge->connector;
+}
diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c
index 63dfcda04147..aa8aa8d9e405 100644
--- a/drivers/gpu/drm/pl111/pl111_drv.c
+++ b/drivers/gpu/drm/pl111/pl111_drv.c
@@ -166,7 +166,7 @@ static int pl111_modeset_init(struct drm_device *dev)
 	priv->bridge = bridge;
 	if (panel) {
 		priv->panel = panel;
-		priv->connector = panel->connector;
+		priv->connector = drm_panel_bridge_connector(bridge);
 	}
 
 	ret = pl111_display_init(dev);
diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c
index 954b09c948eb..00ba9e5ce130 100644
--- a/drivers/gpu/drm/tve200/tve200_drv.c
+++ b/drivers/gpu/drm/tve200/tve200_drv.c
@@ -110,7 +110,7 @@ static int tve200_modeset_init(struct drm_device *dev)
 	}
 
 	priv->panel = panel;
-	priv->connector = panel->connector;
+	priv->connector = drm_panel_bridge_connector(bridge);
 	priv->bridge = bridge;
 
 	dev_info(dev->dev, "attached to panel %s\n",
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index c0a2286a81e9..9a4902accfe5 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -438,6 +438,7 @@ struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev,
 struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,
 						   struct drm_panel *panel,
 						   u32 connector_type);
+struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge);
 #endif
 
 #endif
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 05/26] drm/panel: add drm_connector argument to get_modes()
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (3 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 04/26] drm: get drm_bridge_panel connector via helper Sam Ravnborg
@ 2019-12-02 19:32 ` Sam Ravnborg
  2019-12-03  6:50   ` Laurent Pinchart
                     ` (2 more replies)
  2019-12-02 19:32 ` [PATCH v1 07/26] drm/panel: remove get_timings Sam Ravnborg
                   ` (21 subsequent siblings)
  26 siblings, 3 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, Stefan Mavrodiev, linux-rockchip,
	Tomi Valkeinen, Jagan Teki, Robert Chiras, Guido Günther,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Today the bridge creates the drm_connector, but that is planned
to be moved to the display drivers.
To facilitate this, update drm_panel_funcs.get_modes() to
take drm_connector as an argument.
All panel drivers implementing get_modes() are updated.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Stefan Mavrodiev <stefan@olimex.com>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: "Guido Günther" <agx@sigxcpu.org>
Cc: Purism Kernel Team <kernel@puri.sm>
---
 drivers/gpu/drm/drm_panel.c                   |  2 +-
 drivers/gpu/drm/panel/panel-arm-versatile.c   |  4 +--
 .../drm/panel/panel-feiyang-fy07024di26a30d.c |  4 +--
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c  |  5 ++--
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c |  8 +++---
 drivers/gpu/drm/panel/panel-innolux-p079zca.c | 13 +++++----
 .../gpu/drm/panel/panel-jdi-lt070me05000.c    |  9 ++++---
 .../drm/panel/panel-kingdisplay-kd097d04.c    | 11 ++++----
 drivers/gpu/drm/panel/panel-lg-lb035q02.c     |  4 +--
 drivers/gpu/drm/panel/panel-lg-lg4573.c       |  8 +++---
 drivers/gpu/drm/panel/panel-lvds.c            |  4 +--
 drivers/gpu/drm/panel/panel-nec-nl8048hl11.c  |  4 +--
 drivers/gpu/drm/panel/panel-novatek-nt39016.c |  4 +--
 .../drm/panel/panel-olimex-lcd-olinuxino.c    |  4 +--
 .../gpu/drm/panel/panel-orisetech-otm8009a.c  |  9 ++++---
 .../drm/panel/panel-osd-osd101t2587-53ts.c    |  9 ++++---
 .../drm/panel/panel-panasonic-vvx10f034n00.c  |  9 ++++---
 .../drm/panel/panel-raspberrypi-touchscreen.c |  4 +--
 drivers/gpu/drm/panel/panel-raydium-rm67191.c |  6 ++---
 drivers/gpu/drm/panel/panel-raydium-rm68200.c |  9 ++++---
 .../drm/panel/panel-rocktech-jh057n00900.c    |  9 ++++---
 drivers/gpu/drm/panel/panel-ronbo-rb070d30.c  | 10 +++----
 drivers/gpu/drm/panel/panel-samsung-ld9040.c  |  4 +--
 drivers/gpu/drm/panel/panel-samsung-s6d16d0.c |  4 +--
 drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c |  4 +--
 .../gpu/drm/panel/panel-samsung-s6e63j0x03.c  |  4 +--
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c |  4 +--
 drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c |  4 +--
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c   |  9 ++++---
 .../gpu/drm/panel/panel-sharp-lq101r1sx01.c   |  9 ++++---
 .../gpu/drm/panel/panel-sharp-ls037v7dw01.c   |  4 +--
 .../gpu/drm/panel/panel-sharp-ls043t1le01.c   |  9 ++++---
 drivers/gpu/drm/panel/panel-simple.c          | 27 ++++++++++---------
 drivers/gpu/drm/panel/panel-sitronix-st7701.c |  9 ++++---
 .../gpu/drm/panel/panel-sitronix-st7789v.c    |  8 +++---
 drivers/gpu/drm/panel/panel-sony-acx565akm.c  |  4 +--
 drivers/gpu/drm/panel/panel-tpo-td028ttec1.c  |  4 +--
 drivers/gpu/drm/panel/panel-tpo-td043mtea1.c  |  4 +--
 drivers/gpu/drm/panel/panel-tpo-tpg110.c      |  4 +--
 drivers/gpu/drm/panel/panel-truly-nt35597.c   |  4 +--
 include/drm/drm_panel.h                       |  3 ++-
 41 files changed, 141 insertions(+), 130 deletions(-)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index 35609c90e467..9927e28d93e6 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -252,7 +252,7 @@ int drm_panel_get_modes(struct drm_panel *panel)
 		return -EINVAL;
 
 	if (panel->funcs && panel->funcs->get_modes)
-		return panel->funcs->get_modes(panel);
+		return panel->funcs->get_modes(panel, panel->connector);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/panel/panel-arm-versatile.c b/drivers/gpu/drm/panel/panel-arm-versatile.c
index a0574dc03e16..41aa91f60979 100644
--- a/drivers/gpu/drm/panel/panel-arm-versatile.c
+++ b/drivers/gpu/drm/panel/panel-arm-versatile.c
@@ -260,9 +260,9 @@ static int versatile_panel_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int versatile_panel_get_modes(struct drm_panel *panel)
+static int versatile_panel_get_modes(struct drm_panel *panel,
+				     struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct versatile_panel *vpanel = to_versatile_panel(panel);
 	struct drm_display_mode *mode;
 
diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
index 98f184b81187..37d6b7390954 100644
--- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
+++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
@@ -162,9 +162,9 @@ static const struct drm_display_mode feiyang_default_mode = {
 	.type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
 };
 
-static int feiyang_get_modes(struct drm_panel *panel)
+static int feiyang_get_modes(struct drm_panel *panel,
+			     struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct feiyang *ctx = panel_to_feiyang(panel);
 	struct drm_display_mode *mode;
 
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
index 24955bec1958..8fd4c0521841 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
@@ -641,9 +641,9 @@ static const struct drm_display_mode itu_r_bt_656_720_mode = {
 	.flags = 0,
 };
 
-static int ili9322_get_modes(struct drm_panel *panel)
+static int ili9322_get_modes(struct drm_panel *panel,
+			     struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct ili9322 *ili = panel_to_ili9322(panel);
 	struct drm_display_mode *mode;
 	struct drm_display_info *info;
@@ -655,7 +655,6 @@ static int ili9322_get_modes(struct drm_panel *panel)
 		info->bus_flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE;
 	else
 		info->bus_flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE;
-
 	if (ili->conf->de_active_high)
 		info->bus_flags |= DRM_BUS_FLAG_DE_HIGH;
 	else
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index e8789e460a16..1c67a668d6bf 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -387,9 +387,9 @@ static const struct drm_display_mode bananapi_default_mode = {
 	.vtotal		= 1280 + 10 + 10 + 20,
 };
 
-static int ili9881c_get_modes(struct drm_panel *panel)
+static int ili9881c_get_modes(struct drm_panel *panel,
+			      struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct ili9881c *ctx = panel_to_ili9881c(panel);
 	struct drm_display_mode *mode;
 
@@ -407,8 +407,8 @@ static int ili9881c_get_modes(struct drm_panel *panel)
 	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
 	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.width_mm = 62;
-	panel->connector->display_info.height_mm = 110;
+	connector->display_info.width_mm = 62;
+	connector->display_info.height_mm = 110;
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
index 83df1ac4211f..facf1bab2532 100644
--- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c
+++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
@@ -403,7 +403,8 @@ static const struct panel_desc innolux_p097pfg_panel_desc = {
 	.sleep_mode_delay = 100, /* T15 */
 };
 
-static int innolux_panel_get_modes(struct drm_panel *panel)
+static int innolux_panel_get_modes(struct drm_panel *panel,
+				   struct drm_connector *connector)
 {
 	struct innolux_panel *innolux = to_innolux_panel(panel);
 	const struct drm_display_mode *m = innolux->desc->mode;
@@ -418,13 +419,11 @@ static int innolux_panel_get_modes(struct drm_panel *panel)
 
 	drm_mode_set_name(mode);
 
-	drm_mode_probed_add(panel->connector, mode);
+	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.width_mm =
-			innolux->desc->size.width;
-	panel->connector->display_info.height_mm =
-			innolux->desc->size.height;
-	panel->connector->display_info.bpc = innolux->desc->bpc;
+	connector->display_info.width_mm = innolux->desc->size.width;
+	connector->display_info.height_mm = innolux->desc->size.height;
+	connector->display_info.bpc = innolux->desc->bpc;
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
index 56364a93f0b8..e6b650a64fdb 100644
--- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -300,7 +300,8 @@ static const struct drm_display_mode default_mode = {
 		.flags = 0,
 };
 
-static int jdi_panel_get_modes(struct drm_panel *panel)
+static int jdi_panel_get_modes(struct drm_panel *panel,
+			       struct drm_connector *connector)
 {
 	struct drm_display_mode *mode;
 	struct jdi_panel *jdi = to_jdi_panel(panel);
@@ -316,10 +317,10 @@ static int jdi_panel_get_modes(struct drm_panel *panel)
 
 	drm_mode_set_name(mode);
 
-	drm_mode_probed_add(panel->connector, mode);
+	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.width_mm = 95;
-	panel->connector->display_info.height_mm = 151;
+	connector->display_info.width_mm = 95;
+	connector->display_info.height_mm = 151;
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
index 45f96556ec8c..e6f53d56daf9 100644
--- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
+++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
@@ -333,7 +333,8 @@ static const struct drm_display_mode default_mode = {
 	.vrefresh = 60,
 };
 
-static int kingdisplay_panel_get_modes(struct drm_panel *panel)
+static int kingdisplay_panel_get_modes(struct drm_panel *panel,
+				       struct drm_connector *connector)
 {
 	struct drm_display_mode *mode;
 
@@ -347,11 +348,11 @@ static int kingdisplay_panel_get_modes(struct drm_panel *panel)
 
 	drm_mode_set_name(mode);
 
-	drm_mode_probed_add(panel->connector, mode);
+	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.width_mm = 147;
-	panel->connector->display_info.height_mm = 196;
-	panel->connector->display_info.bpc = 8;
+	connector->display_info.width_mm = 147;
+	connector->display_info.height_mm = 196;
+	connector->display_info.bpc = 8;
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-lg-lb035q02.c b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
index 7a1385e834f0..7a3bd4d80c79 100644
--- a/drivers/gpu/drm/panel/panel-lg-lb035q02.c
+++ b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
@@ -141,9 +141,9 @@ static const struct drm_display_mode lb035q02_mode = {
 	.height_mm = 53,
 };
 
-static int lb035q02_get_modes(struct drm_panel *panel)
+static int lb035q02_get_modes(struct drm_panel *panel,
+			      struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_duplicate(panel->drm, &lb035q02_mode);
diff --git a/drivers/gpu/drm/panel/panel-lg-lg4573.c b/drivers/gpu/drm/panel/panel-lg-lg4573.c
index db4865a4c2b9..fc6572b4e2f9 100644
--- a/drivers/gpu/drm/panel/panel-lg-lg4573.c
+++ b/drivers/gpu/drm/panel/panel-lg-lg4573.c
@@ -209,9 +209,9 @@ static const struct drm_display_mode default_mode = {
 	.vrefresh = 60,
 };
 
-static int lg4573_get_modes(struct drm_panel *panel)
+static int lg4573_get_modes(struct drm_panel *panel,
+			    struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
@@ -227,8 +227,8 @@ static int lg4573_get_modes(struct drm_panel *panel)
 	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
 	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.width_mm = 61;
-	panel->connector->display_info.height_mm = 103;
+	connector->display_info.width_mm = 61;
+	connector->display_info.height_mm = 103;
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index 2405f26e5d31..f6d58a60e514 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -106,10 +106,10 @@ static int panel_lvds_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int panel_lvds_get_modes(struct drm_panel *panel)
+static int panel_lvds_get_modes(struct drm_panel *panel,
+				struct drm_connector *connector)
 {
 	struct panel_lvds *lvds = to_panel_lvds(panel);
-	struct drm_connector *connector = lvds->panel.connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_create(lvds->panel.drm);
diff --git a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
index fd593532ab23..a6ccdb09aace 100644
--- a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
+++ b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
@@ -123,9 +123,9 @@ static const struct drm_display_mode nl8048_mode = {
 	.height_mm = 53,
 };
 
-static int nl8048_get_modes(struct drm_panel *panel)
+static int nl8048_get_modes(struct drm_panel *panel,
+			    struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_duplicate(panel->drm, &nl8048_mode);
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt39016.c b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
index 60ccedce530c..91ea49c05611 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt39016.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
@@ -206,11 +206,11 @@ static int nt39016_disable(struct drm_panel *drm_panel)
 	return 0;
 }
 
-static int nt39016_get_modes(struct drm_panel *drm_panel)
+static int nt39016_get_modes(struct drm_panel *drm_panel,
+			     struct drm_connector *connector)
 {
 	struct nt39016 *panel = to_nt39016(drm_panel);
 	const struct nt39016_panel_info *panel_info = panel->panel_info;
-	struct drm_connector *connector = drm_panel->connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_duplicate(drm_panel->drm, &panel_info->display_mode);
diff --git a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
index 8738ef1b66dc..2b7e0dfebc5e 100644
--- a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
+++ b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
@@ -141,10 +141,10 @@ static int lcd_olinuxino_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int lcd_olinuxino_get_modes(struct drm_panel *panel)
+static int lcd_olinuxino_get_modes(struct drm_panel *panel,
+				   struct drm_connector *connector)
 {
 	struct lcd_olinuxino *lcd = to_lcd_olinuxino(panel);
-	struct drm_connector *connector = lcd->panel.connector;
 	struct lcd_olinuxino_info *lcd_info = &lcd->eeprom.info;
 	struct drm_device *drm = lcd->panel.drm;
 	struct lcd_olinuxino_mode *lcd_mode;
diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index bf1f928b215f..4e1606c79072 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -349,7 +349,8 @@ static int otm8009a_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int otm8009a_get_modes(struct drm_panel *panel)
+static int otm8009a_get_modes(struct drm_panel *panel,
+			      struct drm_connector *connector)
 {
 	struct drm_display_mode *mode;
 
@@ -364,10 +365,10 @@ static int otm8009a_get_modes(struct drm_panel *panel)
 	drm_mode_set_name(mode);
 
 	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
-	drm_mode_probed_add(panel->connector, mode);
+	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.width_mm = mode->width_mm;
-	panel->connector->display_info.height_mm = mode->height_mm;
+	connector->display_info.width_mm = mode->width_mm;
+	connector->display_info.height_mm = mode->height_mm;
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
index 2b40913899d8..b3e010288c10 100644
--- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
+++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
@@ -112,7 +112,8 @@ static const struct drm_display_mode default_mode_osd101t2587 = {
 	.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
 };
 
-static int osd101t2587_panel_get_modes(struct drm_panel *panel)
+static int osd101t2587_panel_get_modes(struct drm_panel *panel,
+				       struct drm_connector *connector)
 {
 	struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel);
 	struct drm_display_mode *mode;
@@ -128,10 +129,10 @@ static int osd101t2587_panel_get_modes(struct drm_panel *panel)
 
 	drm_mode_set_name(mode);
 
-	drm_mode_probed_add(panel->connector, mode);
+	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.width_mm = 217;
-	panel->connector->display_info.height_mm = 136;
+	connector->display_info.width_mm = 217;
+	connector->display_info.height_mm = 136;
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
index 664605071d34..19a6eb4637c8 100644
--- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
+++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
@@ -166,7 +166,8 @@ static const struct drm_display_mode default_mode = {
 	.vrefresh = 60,
 };
 
-static int wuxga_nt_panel_get_modes(struct drm_panel *panel)
+static int wuxga_nt_panel_get_modes(struct drm_panel *panel,
+				    struct drm_connector *connector)
 {
 	struct drm_display_mode *mode;
 
@@ -180,10 +181,10 @@ static int wuxga_nt_panel_get_modes(struct drm_panel *panel)
 
 	drm_mode_set_name(mode);
 
-	drm_mode_probed_add(panel->connector, mode);
+	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.width_mm = 217;
-	panel->connector->display_info.height_mm = 136;
+	connector->display_info.width_mm = 217;
+	connector->display_info.height_mm = 136;
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
index 09824e92fc78..732b7111395e 100644
--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
@@ -311,9 +311,9 @@ static int rpi_touchscreen_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int rpi_touchscreen_get_modes(struct drm_panel *panel)
+static int rpi_touchscreen_get_modes(struct drm_panel *panel,
+				     struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct drm_device *drm = panel->drm;
 	unsigned int i, num = 0;
 	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
index fd67fc6185c4..123bb68cfcb7 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
@@ -436,9 +436,9 @@ static int rad_panel_disable(struct drm_panel *panel)
 	return 0;
 }
 
-static int rad_panel_get_modes(struct drm_panel *panel)
+static int rad_panel_get_modes(struct drm_panel *panel,
+			       struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
@@ -451,7 +451,7 @@ static int rad_panel_get_modes(struct drm_panel *panel)
 
 	drm_mode_set_name(mode);
 	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
-	drm_mode_probed_add(panel->connector, mode);
+	drm_mode_probed_add(connector, mode);
 
 	connector->display_info.width_mm = mode->width_mm;
 	connector->display_info.height_mm = mode->height_mm;
diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
index 994e855721f4..66fa975308ec 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
@@ -335,7 +335,8 @@ static int rm68200_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int rm68200_get_modes(struct drm_panel *panel)
+static int rm68200_get_modes(struct drm_panel *panel,
+			     struct drm_connector *connector)
 {
 	struct drm_display_mode *mode;
 
@@ -350,10 +351,10 @@ static int rm68200_get_modes(struct drm_panel *panel)
 	drm_mode_set_name(mode);
 
 	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
-	drm_mode_probed_add(panel->connector, mode);
+	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.width_mm = mode->width_mm;
-	panel->connector->display_info.height_mm = mode->height_mm;
+	connector->display_info.width_mm = mode->width_mm;
+	connector->display_info.height_mm = mode->height_mm;
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
index 31234b79d3b1..b2d61cab3cad 100644
--- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
+++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
@@ -230,7 +230,8 @@ static const struct drm_display_mode default_mode = {
 	.height_mm   = 130,
 };
 
-static int jh057n_get_modes(struct drm_panel *panel)
+static int jh057n_get_modes(struct drm_panel *panel,
+			    struct drm_connector *connector)
 {
 	struct jh057n *ctx = panel_to_jh057n(panel);
 	struct drm_display_mode *mode;
@@ -246,9 +247,9 @@ static int jh057n_get_modes(struct drm_panel *panel)
 	drm_mode_set_name(mode);
 
 	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
-	panel->connector->display_info.width_mm = mode->width_mm;
-	panel->connector->display_info.height_mm = mode->height_mm;
-	drm_mode_probed_add(panel->connector, mode);
+	connector->display_info.width_mm = mode->width_mm;
+	connector->display_info.height_mm = mode->height_mm;
+	drm_mode_probed_add(connector, mode);
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
index 170a5cda21b9..57a462ce221e 100644
--- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
+++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
@@ -120,9 +120,9 @@ static const struct drm_display_mode default_mode = {
 	.height_mm	= 85,
 };
 
-static int rb070d30_panel_get_modes(struct drm_panel *panel)
+static int rb070d30_panel_get_modes(struct drm_panel *panel,
+				    struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);
 	struct drm_display_mode *mode;
 	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
@@ -140,9 +140,9 @@ static int rb070d30_panel_get_modes(struct drm_panel *panel)
 	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
 	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.bpc = 8;
-	panel->connector->display_info.width_mm = mode->width_mm;
-	panel->connector->display_info.height_mm = mode->height_mm;
+	connector->display_info.bpc = 8;
+	connector->display_info.width_mm = mode->width_mm;
+	connector->display_info.height_mm = mode->height_mm;
 	drm_display_info_set_bus_formats(&connector->display_info,
 					 &bus_format, 1);
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-ld9040.c b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
index 250809ba37c7..3c52f15f7a1c 100644
--- a/drivers/gpu/drm/panel/panel-samsung-ld9040.c
+++ b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
@@ -261,9 +261,9 @@ static int ld9040_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int ld9040_get_modes(struct drm_panel *panel)
+static int ld9040_get_modes(struct drm_panel *panel,
+			    struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct ld9040 *ctx = panel_to_ld9040(panel);
 	struct drm_display_mode *mode;
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
index e3a0397e953e..71939ab757b1 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
@@ -143,9 +143,9 @@ static int s6d16d0_disable(struct drm_panel *panel)
 	return 0;
 }
 
-static int s6d16d0_get_modes(struct drm_panel *panel)
+static int s6d16d0_get_modes(struct drm_panel *panel,
+			     struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_duplicate(panel->drm, &samsung_s6d16d0_mode);
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
index 938ab72c5540..8e0236ba6145 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
@@ -645,9 +645,9 @@ static const struct s6e3ha2_panel_desc samsung_s6e3hf2 = {
 	.type = HF2_TYPE,
 };
 
-static int s6e3ha2_get_modes(struct drm_panel *panel)
+static int s6e3ha2_get_modes(struct drm_panel *panel,
+			     struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
 	struct drm_display_mode *mode;
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
index a60635e9226d..c939d5bde4f0 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
@@ -400,9 +400,9 @@ static int s6e63j0x03_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int s6e63j0x03_get_modes(struct drm_panel *panel)
+static int s6e63j0x03_get_modes(struct drm_panel *panel,
+				struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
index ba01af0b14fd..1d099092e754 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
@@ -362,9 +362,9 @@ static int s6e63m0_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int s6e63m0_get_modes(struct drm_panel *panel)
+static int s6e63m0_get_modes(struct drm_panel *panel,
+			     struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
index dbced6501204..8a028d2bd0d6 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
@@ -920,9 +920,9 @@ static int s6e8aa0_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int s6e8aa0_get_modes(struct drm_panel *panel)
+static int s6e8aa0_get_modes(struct drm_panel *panel,
+			     struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct s6e8aa0 *ctx = panel_to_s6e8aa0(panel);
 	struct drm_display_mode *mode;
 
diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
index b3619ba443bd..b878930b17e4 100644
--- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
+++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
@@ -56,9 +56,9 @@ static inline struct seiko_panel *to_seiko_panel(struct drm_panel *panel)
 	return container_of(panel, struct seiko_panel, base);
 }
 
-static int seiko_panel_get_fixed_modes(struct seiko_panel *panel)
+static int seiko_panel_get_fixed_modes(struct seiko_panel *panel,
+				       struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->base.connector;
 	struct drm_device *drm = panel->base.drm;
 	struct drm_display_mode *mode;
 	unsigned int i, num = 0;
@@ -208,12 +208,13 @@ static int seiko_panel_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int seiko_panel_get_modes(struct drm_panel *panel)
+static int seiko_panel_get_modes(struct drm_panel *panel,
+				 struct drm_connector *connector)
 {
 	struct seiko_panel *p = to_seiko_panel(panel);
 
 	/* add hard-coded panel modes */
-	return seiko_panel_get_fixed_modes(p);
+	return seiko_panel_get_fixed_modes(p, connector);
 }
 
 static int seiko_panel_get_timings(struct drm_panel *panel,
diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
index 5e136c3ba185..e797b700661a 100644
--- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
@@ -278,7 +278,8 @@ static const struct drm_display_mode default_mode = {
 	.vrefresh = 60,
 };
 
-static int sharp_panel_get_modes(struct drm_panel *panel)
+static int sharp_panel_get_modes(struct drm_panel *panel,
+				 struct drm_connector *connector)
 {
 	struct drm_display_mode *mode;
 
@@ -292,10 +293,10 @@ static int sharp_panel_get_modes(struct drm_panel *panel)
 
 	drm_mode_set_name(mode);
 
-	drm_mode_probed_add(panel->connector, mode);
+	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.width_mm = 217;
-	panel->connector->display_info.height_mm = 136;
+	connector->display_info.width_mm = 217;
+	connector->display_info.height_mm = 136;
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
index eeab7998c7de..7103a945f0e8 100644
--- a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
@@ -100,9 +100,9 @@ static const struct drm_display_mode ls037v7dw01_mode = {
 	.height_mm = 75,
 };
 
-static int ls037v7dw01_get_modes(struct drm_panel *panel)
+static int ls037v7dw01_get_modes(struct drm_panel *panel,
+				 struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_duplicate(panel->drm, &ls037v7dw01_mode);
diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
index b963ba4ab589..85ae6cffdbfb 100644
--- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
@@ -210,7 +210,8 @@ static const struct drm_display_mode default_mode = {
 	.vrefresh = 60,
 };
 
-static int sharp_nt_panel_get_modes(struct drm_panel *panel)
+static int sharp_nt_panel_get_modes(struct drm_panel *panel,
+				    struct drm_connector *connector)
 {
 	struct drm_display_mode *mode;
 
@@ -224,10 +225,10 @@ static int sharp_nt_panel_get_modes(struct drm_panel *panel)
 
 	drm_mode_set_name(mode);
 
-	drm_mode_probed_add(panel->connector, mode);
+	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.width_mm = 54;
-	panel->connector->display_info.height_mm = 95;
+	connector->display_info.width_mm = 54;
+	connector->display_info.height_mm = 95;
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index a5df6d6dd455..d6299fe6d276 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -117,9 +117,9 @@ static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
 	return container_of(panel, struct panel_simple, base);
 }
 
-static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel)
+static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel,
+						   struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->base.connector;
 	struct drm_device *drm = panel->base.drm;
 	struct drm_display_mode *mode;
 	unsigned int i, num = 0;
@@ -150,9 +150,9 @@ static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel)
 	return num;
 }
 
-static unsigned int panel_simple_get_display_modes(struct panel_simple *panel)
+static unsigned int panel_simple_get_display_modes(struct panel_simple *panel,
+						   struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->base.connector;
 	struct drm_device *drm = panel->base.drm;
 	struct drm_display_mode *mode;
 	unsigned int i, num = 0;
@@ -181,9 +181,9 @@ static unsigned int panel_simple_get_display_modes(struct panel_simple *panel)
 	return num;
 }
 
-static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
+static int panel_simple_get_non_edid_modes(struct panel_simple *panel,
+					   struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->base.connector;
 	struct drm_device *drm = panel->base.drm;
 	struct drm_display_mode *mode;
 	bool has_override = panel->override_mode.type;
@@ -204,7 +204,7 @@ static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
 
 	/* Only add timings if override was not there or failed to validate */
 	if (num == 0 && panel->desc->num_timings)
-		num = panel_simple_get_timings_modes(panel);
+		num = panel_simple_get_timings_modes(panel, connector);
 
 	/*
 	 * Only add fixed modes if timings/override added no mode.
@@ -214,7 +214,7 @@ static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
 	 */
 	WARN_ON(panel->desc->num_timings && panel->desc->num_modes);
 	if (num == 0)
-		num = panel_simple_get_display_modes(panel);
+		num = panel_simple_get_display_modes(panel, connector);
 
 	connector->display_info.bpc = panel->desc->bpc;
 	connector->display_info.width_mm = panel->desc->size.width;
@@ -304,23 +304,24 @@ static int panel_simple_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int panel_simple_get_modes(struct drm_panel *panel)
+static int panel_simple_get_modes(struct drm_panel *panel,
+				  struct drm_connector *connector)
 {
 	struct panel_simple *p = to_panel_simple(panel);
 	int num = 0;
 
 	/* probe EDID if a DDC bus is available */
 	if (p->ddc) {
-		struct edid *edid = drm_get_edid(panel->connector, p->ddc);
-		drm_connector_update_edid_property(panel->connector, edid);
+		struct edid *edid = drm_get_edid(connector, p->ddc);
+		drm_connector_update_edid_property(connector, edid);
 		if (edid) {
-			num += drm_add_edid_modes(panel->connector, edid);
+			num += drm_add_edid_modes(connector, edid);
 			kfree(edid);
 		}
 	}
 
 	/* add hard-coded panel modes */
-	num += panel_simple_get_non_edid_modes(p);
+	num += panel_simple_get_non_edid_modes(p, connector);
 
 	return num;
 }
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
index ee3f23f45755..3ed3b1d6d82d 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
@@ -264,7 +264,8 @@ static int st7701_unprepare(struct drm_panel *panel)
 	return 0;
 }
 
-static int st7701_get_modes(struct drm_panel *panel)
+static int st7701_get_modes(struct drm_panel *panel,
+			    struct drm_connector *connector)
 {
 	struct st7701 *st7701 = panel_to_st7701(panel);
 	const struct drm_display_mode *desc_mode = st7701->desc->mode;
@@ -280,10 +281,10 @@ static int st7701_get_modes(struct drm_panel *panel)
 	}
 
 	drm_mode_set_name(mode);
-	drm_mode_probed_add(panel->connector, mode);
+	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.width_mm = desc_mode->width_mm;
-	panel->connector->display_info.height_mm = desc_mode->height_mm;
+	connector->display_info.width_mm = desc_mode->width_mm;
+	connector->display_info.height_mm = desc_mode->height_mm;
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
index 108a85bb6667..836b01331505 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
@@ -170,9 +170,9 @@ static const struct drm_display_mode default_mode = {
 	.vrefresh = 60,
 };
 
-static int st7789v_get_modes(struct drm_panel *panel)
+static int st7789v_get_modes(struct drm_panel *panel,
+			     struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
@@ -188,8 +188,8 @@ static int st7789v_get_modes(struct drm_panel *panel)
 	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
 	drm_mode_probed_add(connector, mode);
 
-	panel->connector->display_info.width_mm = 61;
-	panel->connector->display_info.height_mm = 103;
+	connector->display_info.width_mm = 61;
+	connector->display_info.height_mm = 103;
 
 	return 1;
 }
diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
index d6387d8f88a3..841dc73c443d 100644
--- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c
+++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
@@ -521,9 +521,9 @@ static const struct drm_display_mode acx565akm_mode = {
 	.height_mm = 46,
 };
 
-static int acx565akm_get_modes(struct drm_panel *panel)
+static int acx565akm_get_modes(struct drm_panel *panel,
+			       struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_duplicate(panel->drm, &acx565akm_mode);
diff --git a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
index c44d6a65c0aa..5230176bd8e6 100644
--- a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
+++ b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
@@ -287,9 +287,9 @@ static const struct drm_display_mode td028ttec1_mode = {
 	.height_mm = 58,
 };
 
-static int td028ttec1_get_modes(struct drm_panel *panel)
+static int td028ttec1_get_modes(struct drm_panel *panel,
+				struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_duplicate(panel->drm, &td028ttec1_mode);
diff --git a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
index 621b65feec07..716f8ed1cc45 100644
--- a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
+++ b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
@@ -346,9 +346,9 @@ static const struct drm_display_mode td043mtea1_mode = {
 	.height_mm = 56,
 };
 
-static int td043mtea1_get_modes(struct drm_panel *panel)
+static int td043mtea1_get_modes(struct drm_panel *panel,
+				struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct drm_display_mode *mode;
 
 	mode = drm_mode_duplicate(panel->drm, &td043mtea1_mode);
diff --git a/drivers/gpu/drm/panel/panel-tpo-tpg110.c b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
index 1a5418ae2ccf..e74cd9d418cf 100644
--- a/drivers/gpu/drm/panel/panel-tpo-tpg110.c
+++ b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
@@ -384,9 +384,9 @@ static int tpg110_enable(struct drm_panel *panel)
  * presents the mode that is configured for the system under use,
  * and which is detected by reading the registers of the display.
  */
-static int tpg110_get_modes(struct drm_panel *panel)
+static int tpg110_get_modes(struct drm_panel *panel,
+			    struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct tpg110 *tpg = to_tpg110(panel);
 	struct drm_display_mode *mode;
 
diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c b/drivers/gpu/drm/panel/panel-truly-nt35597.c
index 0feea2456e14..012ca62bf30e 100644
--- a/drivers/gpu/drm/panel/panel-truly-nt35597.c
+++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c
@@ -454,9 +454,9 @@ static int truly_nt35597_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int truly_nt35597_get_modes(struct drm_panel *panel)
+static int truly_nt35597_get_modes(struct drm_panel *panel,
+				   struct drm_connector *connector)
 {
-	struct drm_connector *connector = panel->connector;
 	struct truly_nt35597 *ctx = panel_to_ctx(panel);
 	struct drm_display_mode *mode;
 	const struct nt35597_config *config;
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index d30c98567384..a5f7199807f2 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -100,7 +100,8 @@ struct drm_panel_funcs {
 	 * Add modes to the connector that the panel is attached to and
 	 * return the number of modes added.
 	 */
-	int (*get_modes)(struct drm_panel *panel);
+	int (*get_modes)(struct drm_panel *panel,
+			 struct drm_connector *connector);
 
 	/**
 	 * @get_timings:
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 07/26] drm/panel: remove get_timings
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (4 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 05/26] drm/panel: add drm_connector argument to get_modes() Sam Ravnborg
@ 2019-12-02 19:32 ` Sam Ravnborg
  2019-12-03  7:02   ` Laurent Pinchart
  2019-12-03  7:46   ` Maxime Ripard
  2019-12-02 19:32 ` [PATCH v1 08/26] drm/panel: drop drm_device from drm_panel Sam Ravnborg
                   ` (20 subsequent siblings)
  26 siblings, 2 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Laurent Pinchart, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

There was no users - so remove it.
The callback was implemented in two drivers - deleted.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 18 ------------------
 drivers/gpu/drm/panel/panel-simple.c        | 18 ------------------
 include/drm/drm_panel.h                     |  9 ---------
 3 files changed, 45 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
index b878930b17e4..3bcba64235c4 100644
--- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
+++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
@@ -217,30 +217,12 @@ static int seiko_panel_get_modes(struct drm_panel *panel,
 	return seiko_panel_get_fixed_modes(p, connector);
 }
 
-static int seiko_panel_get_timings(struct drm_panel *panel,
-				    unsigned int num_timings,
-				    struct display_timing *timings)
-{
-	struct seiko_panel *p = to_seiko_panel(panel);
-	unsigned int i;
-
-	if (p->desc->num_timings < num_timings)
-		num_timings = p->desc->num_timings;
-
-	if (timings)
-		for (i = 0; i < num_timings; i++)
-			timings[i] = p->desc->timings[i];
-
-	return p->desc->num_timings;
-}
-
 static const struct drm_panel_funcs seiko_panel_funcs = {
 	.disable = seiko_panel_disable,
 	.unprepare = seiko_panel_unprepare,
 	.prepare = seiko_panel_prepare,
 	.enable = seiko_panel_enable,
 	.get_modes = seiko_panel_get_modes,
-	.get_timings = seiko_panel_get_timings,
 };
 
 static int seiko_panel_probe(struct device *dev,
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index d6299fe6d276..e225791a6fb2 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -326,30 +326,12 @@ static int panel_simple_get_modes(struct drm_panel *panel,
 	return num;
 }
 
-static int panel_simple_get_timings(struct drm_panel *panel,
-				    unsigned int num_timings,
-				    struct display_timing *timings)
-{
-	struct panel_simple *p = to_panel_simple(panel);
-	unsigned int i;
-
-	if (p->desc->num_timings < num_timings)
-		num_timings = p->desc->num_timings;
-
-	if (timings)
-		for (i = 0; i < num_timings; i++)
-			timings[i] = p->desc->timings[i];
-
-	return p->desc->num_timings;
-}
-
 static const struct drm_panel_funcs panel_simple_funcs = {
 	.disable = panel_simple_disable,
 	.unprepare = panel_simple_unprepare,
 	.prepare = panel_simple_prepare,
 	.enable = panel_simple_enable,
 	.get_modes = panel_simple_get_modes,
-	.get_timings = panel_simple_get_timings,
 };
 
 #define PANEL_SIMPLE_BOUNDS_CHECK(to_check, bounds, field) \
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 4fd61cb9eb93..c4e82b9ce586 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -102,15 +102,6 @@ struct drm_panel_funcs {
 	 */
 	int (*get_modes)(struct drm_panel *panel,
 			 struct drm_connector *connector);
-
-	/**
-	 * @get_timings:
-	 *
-	 * Copy display timings into the provided array and return
-	 * the number of display timings available.
-	 */
-	int (*get_timings)(struct drm_panel *panel, unsigned int num_timings,
-			   struct display_timing *timings);
 };
 
 /**
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 08/26] drm/panel: drop drm_device from drm_panel
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (5 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 07/26] drm/panel: remove get_timings Sam Ravnborg
@ 2019-12-02 19:32 ` Sam Ravnborg
  2019-12-03  7:15   ` Laurent Pinchart
  2019-12-03 13:27   ` Linus Walleij
  2019-12-02 19:32 ` [PATCH v1 09/26] drm/panel: feiyang-fy07024di26a30d: use drm_panel backlight support Sam Ravnborg
                   ` (19 subsequent siblings)
  26 siblings, 2 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Laurent Pinchart, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, Stefan Mavrodiev, linux-rockchip,
	Tomi Valkeinen, Jagan Teki, Robert Chiras, Guido Günther,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

The panel drivers used drm_panel.drm for two purposes:
1) Argument to drm_mode_duplicate()
2) drm->dev was used in error messages

The first usage is replaced with drm_connector.dev
- drm_connector is already connected to a drm_device
  and we have a valid connector

The second usage is replaced with drm_panel.dev
- this makes drivers more consistent in their dev argument
  used for dev_err() and friends

With these replacements there are no more uses of drm_panel.drm,
so it is removed from struct drm_panel.
With this change drm_panel_attach() and drm_panel_detach()
no logner has any use as they are empty functions.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Stefan Mavrodiev <stefan@olimex.com>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: "Guido Günther" <agx@sigxcpu.org>
Cc: Purism Kernel Team <kernel@puri.sm>
---
 drivers/gpu/drm/drm_panel.c                       |  6 ------
 drivers/gpu/drm/panel/panel-arm-versatile.c       |  2 +-
 .../gpu/drm/panel/panel-feiyang-fy07024di26a30d.c |  2 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c      | 15 ++++++++-------
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c     |  2 +-
 drivers/gpu/drm/panel/panel-innolux-p079zca.c     |  6 +++---
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c    |  2 +-
 .../gpu/drm/panel/panel-kingdisplay-kd097d04.c    |  6 +++---
 drivers/gpu/drm/panel/panel-lg-lb035q02.c         |  2 +-
 drivers/gpu/drm/panel/panel-lg-lg4573.c           |  4 ++--
 drivers/gpu/drm/panel/panel-lvds.c                |  2 +-
 drivers/gpu/drm/panel/panel-nec-nl8048hl11.c      |  2 +-
 drivers/gpu/drm/panel/panel-novatek-nt39016.c     |  2 +-
 .../gpu/drm/panel/panel-olimex-lcd-olinuxino.c    |  5 ++---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c  |  2 +-
 .../gpu/drm/panel/panel-osd-osd101t2587-53ts.c    |  4 ++--
 .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c  |  4 ++--
 .../gpu/drm/panel/panel-raspberrypi-touchscreen.c |  5 ++---
 drivers/gpu/drm/panel/panel-raydium-rm67191.c     |  2 +-
 drivers/gpu/drm/panel/panel-raydium-rm68200.c     |  2 +-
 .../gpu/drm/panel/panel-rocktech-jh057n00900.c    |  2 +-
 drivers/gpu/drm/panel/panel-ronbo-rb070d30.c      |  2 +-
 drivers/gpu/drm/panel/panel-samsung-s6d16d0.c     |  2 +-
 drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c     |  2 +-
 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c  |  2 +-
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c     |  2 +-
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c       |  9 ++++-----
 drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c   |  4 ++--
 drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c   |  2 +-
 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c   |  4 ++--
 drivers/gpu/drm/panel/panel-simple.c              | 15 ++++++---------
 drivers/gpu/drm/panel/panel-sitronix-st7701.c     |  2 +-
 drivers/gpu/drm/panel/panel-sitronix-st7789v.c    |  4 ++--
 drivers/gpu/drm/panel/panel-sony-acx565akm.c      |  2 +-
 drivers/gpu/drm/panel/panel-tpo-td028ttec1.c      |  2 +-
 drivers/gpu/drm/panel/panel-tpo-td043mtea1.c      |  2 +-
 drivers/gpu/drm/panel/panel-tpo-tpg110.c          |  2 +-
 include/drm/drm_panel.h                           |  7 -------
 38 files changed, 63 insertions(+), 81 deletions(-)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index fd428b6d25b0..eab79366bf1a 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -113,11 +113,6 @@ EXPORT_SYMBOL(drm_panel_remove);
  */
 int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)
 {
-	if (panel->drm)
-		return -EBUSY;
-
-	panel->drm = connector->dev;
-
 	return 0;
 }
 EXPORT_SYMBOL(drm_panel_attach);
@@ -134,7 +129,6 @@ EXPORT_SYMBOL(drm_panel_attach);
  */
 void drm_panel_detach(struct drm_panel *panel)
 {
-	panel->drm = NULL;
 }
 EXPORT_SYMBOL(drm_panel_detach);
 
diff --git a/drivers/gpu/drm/panel/panel-arm-versatile.c b/drivers/gpu/drm/panel/panel-arm-versatile.c
index 41aa91f60979..41444a73c980 100644
--- a/drivers/gpu/drm/panel/panel-arm-versatile.c
+++ b/drivers/gpu/drm/panel/panel-arm-versatile.c
@@ -270,7 +270,7 @@ static int versatile_panel_get_modes(struct drm_panel *panel,
 	connector->display_info.height_mm = vpanel->panel_type->height_mm;
 	connector->display_info.bus_flags = vpanel->panel_type->bus_flags;
 
-	mode = drm_mode_duplicate(panel->drm, &vpanel->panel_type->mode);
+	mode = drm_mode_duplicate(connector->dev, &vpanel->panel_type->mode);
 	drm_mode_set_name(mode);
 	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
 
diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
index 37d6b7390954..0157d1844e3e 100644
--- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
+++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
@@ -168,7 +168,7 @@ static int feiyang_get_modes(struct drm_panel *panel,
 	struct feiyang *ctx = panel_to_feiyang(panel);
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &feiyang_default_mode);
+	mode = drm_mode_duplicate(connector->dev, &feiyang_default_mode);
 	if (!mode) {
 		DRM_DEV_ERROR(&ctx->dsi->dev, "failed to add mode %ux%ux@%u\n",
 			      feiyang_default_mode.hdisplay,
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
index 8fd4c0521841..5717135c9278 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
@@ -645,6 +645,7 @@ static int ili9322_get_modes(struct drm_panel *panel,
 			     struct drm_connector *connector)
 {
 	struct ili9322 *ili = panel_to_ili9322(panel);
+	struct drm_device *drm = connector->dev;
 	struct drm_display_mode *mode;
 	struct drm_display_info *info;
 
@@ -662,26 +663,26 @@ static int ili9322_get_modes(struct drm_panel *panel,
 
 	switch (ili->input) {
 	case ILI9322_INPUT_SRGB_DUMMY_320X240:
-		mode = drm_mode_duplicate(panel->drm, &srgb_320x240_mode);
+		mode = drm_mode_duplicate(drm, &srgb_320x240_mode);
 		break;
 	case ILI9322_INPUT_SRGB_DUMMY_360X240:
-		mode = drm_mode_duplicate(panel->drm, &srgb_360x240_mode);
+		mode = drm_mode_duplicate(drm, &srgb_360x240_mode);
 		break;
 	case ILI9322_INPUT_PRGB_THROUGH:
 	case ILI9322_INPUT_PRGB_ALIGNED:
-		mode = drm_mode_duplicate(panel->drm, &prgb_320x240_mode);
+		mode = drm_mode_duplicate(drm, &prgb_320x240_mode);
 		break;
 	case ILI9322_INPUT_YUV_640X320_YCBCR:
-		mode = drm_mode_duplicate(panel->drm, &yuv_640x320_mode);
+		mode = drm_mode_duplicate(drm, &yuv_640x320_mode);
 		break;
 	case ILI9322_INPUT_YUV_720X360_YCBCR:
-		mode = drm_mode_duplicate(panel->drm, &yuv_720x360_mode);
+		mode = drm_mode_duplicate(drm, &yuv_720x360_mode);
 		break;
 	case ILI9322_INPUT_ITU_R_BT656_720X360_YCBCR:
-		mode = drm_mode_duplicate(panel->drm, &itu_r_bt_656_720_mode);
+		mode = drm_mode_duplicate(drm, &itu_r_bt_656_720_mode);
 		break;
 	case ILI9322_INPUT_ITU_R_BT656_640X320_YCBCR:
-		mode = drm_mode_duplicate(panel->drm, &itu_r_bt_656_640_mode);
+		mode = drm_mode_duplicate(drm, &itu_r_bt_656_640_mode);
 		break;
 	default:
 		mode = NULL;
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index 1c67a668d6bf..31e5a4e67750 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -393,7 +393,7 @@ static int ili9881c_get_modes(struct drm_panel *panel,
 	struct ili9881c *ctx = panel_to_ili9881c(panel);
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &bananapi_default_mode);
+	mode = drm_mode_duplicate(connector->dev, &bananapi_default_mode);
 	if (!mode) {
 		dev_err(&ctx->dsi->dev, "failed to add mode %ux%ux@%u\n",
 			bananapi_default_mode.hdisplay,
diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
index facf1bab2532..b9de37a8a0c5 100644
--- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c
+++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
@@ -211,7 +211,7 @@ static int innolux_panel_enable(struct drm_panel *panel)
 
 	ret = backlight_enable(innolux->backlight);
 	if (ret) {
-		DRM_DEV_ERROR(panel->drm->dev,
+		DRM_DEV_ERROR(panel->dev,
 			      "Failed to enable backlight %d\n", ret);
 		return ret;
 	}
@@ -410,9 +410,9 @@ static int innolux_panel_get_modes(struct drm_panel *panel,
 	const struct drm_display_mode *m = innolux->desc->mode;
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, m);
+	mode = drm_mode_duplicate(connector->dev, m);
 	if (!mode) {
-		DRM_DEV_ERROR(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
+		DRM_DEV_ERROR(panel->dev, "failed to add mode %ux%ux@%u\n",
 			      m->hdisplay, m->vdisplay, m->vrefresh);
 		return -ENOMEM;
 	}
diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
index e6b650a64fdb..4bfd8c877c8e 100644
--- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -307,7 +307,7 @@ static int jdi_panel_get_modes(struct drm_panel *panel,
 	struct jdi_panel *jdi = to_jdi_panel(panel);
 	struct device *dev = &jdi->dsi->dev;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
 		dev_err(dev, "failed to add mode %ux%ux@%u\n",
 			default_mode.hdisplay, default_mode.vdisplay,
diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
index e6f53d56daf9..353ee6caa01c 100644
--- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
+++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
@@ -310,7 +310,7 @@ static int kingdisplay_panel_enable(struct drm_panel *panel)
 
 	ret = backlight_enable(kingdisplay->backlight);
 	if (ret) {
-		DRM_DEV_ERROR(panel->drm->dev,
+		DRM_DEV_ERROR(panel->dev,
 			      "Failed to enable backlight %d\n", ret);
 		return ret;
 	}
@@ -338,9 +338,9 @@ static int kingdisplay_panel_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
-		DRM_DEV_ERROR(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
+		DRM_DEV_ERROR(panel->dev, "failed to add mode %ux%ux@%u\n",
 			      default_mode.hdisplay, default_mode.vdisplay,
 			      default_mode.vrefresh);
 		return -ENOMEM;
diff --git a/drivers/gpu/drm/panel/panel-lg-lb035q02.c b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
index 7a3bd4d80c79..e90efeaba4ad 100644
--- a/drivers/gpu/drm/panel/panel-lg-lb035q02.c
+++ b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
@@ -146,7 +146,7 @@ static int lb035q02_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &lb035q02_mode);
+	mode = drm_mode_duplicate(connector->dev, &lb035q02_mode);
 	if (!mode)
 		return -ENOMEM;
 
diff --git a/drivers/gpu/drm/panel/panel-lg-lg4573.c b/drivers/gpu/drm/panel/panel-lg-lg4573.c
index fc6572b4e2f9..20235ff0bbc4 100644
--- a/drivers/gpu/drm/panel/panel-lg-lg4573.c
+++ b/drivers/gpu/drm/panel/panel-lg-lg4573.c
@@ -214,9 +214,9 @@ static int lg4573_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
+		dev_err(panel->dev, "failed to add mode %ux%ux@%u\n",
 			default_mode.hdisplay, default_mode.vdisplay,
 			default_mode.vrefresh);
 		return -ENOMEM;
diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index f6d58a60e514..5e40b674bb15 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -112,7 +112,7 @@ static int panel_lvds_get_modes(struct drm_panel *panel,
 	struct panel_lvds *lvds = to_panel_lvds(panel);
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_create(lvds->panel.drm);
+	mode = drm_mode_create(connector->dev);
 	if (!mode)
 		return 0;
 
diff --git a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
index a6ccdb09aace..c4f83f6384e1 100644
--- a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
+++ b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
@@ -128,7 +128,7 @@ static int nl8048_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &nl8048_mode);
+	mode = drm_mode_duplicate(connector->dev, &nl8048_mode);
 	if (!mode)
 		return -ENOMEM;
 
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt39016.c b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
index 91ea49c05611..a470810f7dbe 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt39016.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
@@ -213,7 +213,7 @@ static int nt39016_get_modes(struct drm_panel *drm_panel,
 	const struct nt39016_panel_info *panel_info = panel->panel_info;
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(drm_panel->drm, &panel_info->display_mode);
+	mode = drm_mode_duplicate(connector->dev, &panel_info->display_mode);
 	if (!mode)
 		return -ENOMEM;
 
diff --git a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
index 2b7e0dfebc5e..e553e584399b 100644
--- a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
+++ b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
@@ -146,7 +146,6 @@ static int lcd_olinuxino_get_modes(struct drm_panel *panel,
 {
 	struct lcd_olinuxino *lcd = to_lcd_olinuxino(panel);
 	struct lcd_olinuxino_info *lcd_info = &lcd->eeprom.info;
-	struct drm_device *drm = lcd->panel.drm;
 	struct lcd_olinuxino_mode *lcd_mode;
 	struct drm_display_mode *mode;
 	u32 i, num = 0;
@@ -155,9 +154,9 @@ static int lcd_olinuxino_get_modes(struct drm_panel *panel,
 		lcd_mode = (struct lcd_olinuxino_mode *)
 			   &lcd->eeprom.reserved[i * sizeof(*lcd_mode)];
 
-		mode = drm_mode_create(drm);
+		mode = drm_mode_create(connector->dev);
 		if (!mode) {
-			dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
+			dev_err(panel->dev, "failed to add mode %ux%u@%u\n",
 				lcd_mode->hactive,
 				lcd_mode->vactive,
 				lcd_mode->refresh);
diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index 4e1606c79072..bb0c992171e8 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -354,7 +354,7 @@ static int otm8009a_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
 		DRM_ERROR("failed to add mode %ux%ux@%u\n",
 			  default_mode.hdisplay, default_mode.vdisplay,
diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
index b3e010288c10..2734b4835dfa 100644
--- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
+++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
@@ -118,9 +118,9 @@ static int osd101t2587_panel_get_modes(struct drm_panel *panel,
 	struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel);
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, osd101t2587->default_mode);
+	mode = drm_mode_duplicate(connector->dev, osd101t2587->default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
+		dev_err(panel->dev, "failed to add mode %ux%ux@%u\n",
 			osd101t2587->default_mode->hdisplay,
 			osd101t2587->default_mode->vdisplay,
 			osd101t2587->default_mode->vrefresh);
diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
index 19a6eb4637c8..579ac0d86ea4 100644
--- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
+++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
@@ -171,9 +171,9 @@ static int wuxga_nt_panel_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
+		dev_err(panel->dev, "failed to add mode %ux%ux@%u\n",
 				default_mode.hdisplay, default_mode.vdisplay,
 				default_mode.vrefresh);
 		return -ENOMEM;
diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
index 732b7111395e..7d8bc12a3008 100644
--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
@@ -314,7 +314,6 @@ static int rpi_touchscreen_enable(struct drm_panel *panel)
 static int rpi_touchscreen_get_modes(struct drm_panel *panel,
 				     struct drm_connector *connector)
 {
-	struct drm_device *drm = panel->drm;
 	unsigned int i, num = 0;
 	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
 
@@ -322,9 +321,9 @@ static int rpi_touchscreen_get_modes(struct drm_panel *panel,
 		const struct drm_display_mode *m = &rpi_touchscreen_modes[i];
 		struct drm_display_mode *mode;
 
-		mode = drm_mode_duplicate(drm, m);
+		mode = drm_mode_duplicate(connector->dev, m);
 		if (!mode) {
-			dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
+			dev_err(panel->dev, "failed to add mode %ux%u@%u\n",
 				m->hdisplay, m->vdisplay, m->vrefresh);
 			continue;
 		}
diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
index 123bb68cfcb7..313637d53d28 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
@@ -441,7 +441,7 @@ static int rad_panel_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
 		DRM_DEV_ERROR(panel->dev, "failed to add mode %ux%ux@%u\n",
 			      default_mode.hdisplay, default_mode.vdisplay,
diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
index 66fa975308ec..d6a03328e594 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
@@ -340,7 +340,7 @@ static int rm68200_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
 		DRM_ERROR("failed to add mode %ux%ux@%u\n",
 			  default_mode.hdisplay, default_mode.vdisplay,
diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
index b2d61cab3cad..3a4f1c0fce86 100644
--- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
+++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
@@ -236,7 +236,7 @@ static int jh057n_get_modes(struct drm_panel *panel,
 	struct jh057n *ctx = panel_to_jh057n(panel);
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
 		DRM_DEV_ERROR(ctx->dev, "Failed to add mode %ux%u@%u\n",
 			      default_mode.hdisplay, default_mode.vdisplay,
diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
index 57a462ce221e..746a3a221100 100644
--- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
+++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
@@ -127,7 +127,7 @@ static int rb070d30_panel_get_modes(struct drm_panel *panel,
 	struct drm_display_mode *mode;
 	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
 		DRM_DEV_ERROR(&ctx->dsi->dev,
 			      "Failed to add mode " DRM_MODE_FMT "\n",
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
index 71939ab757b1..2150043dcf6b 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
@@ -148,7 +148,7 @@ static int s6d16d0_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &samsung_s6d16d0_mode);
+	mode = drm_mode_duplicate(connector->dev, &samsung_s6d16d0_mode);
 	if (!mode) {
 		DRM_ERROR("bad mode or failed to add mode\n");
 		return -EINVAL;
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
index 8e0236ba6145..36ebd5a4ac7b 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
@@ -651,7 +651,7 @@ static int s6e3ha2_get_modes(struct drm_panel *panel,
 	struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, ctx->desc->mode);
+	mode = drm_mode_duplicate(connector->dev, ctx->desc->mode);
 	if (!mode) {
 		DRM_ERROR("failed to add mode %ux%ux@%u\n",
 			ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
index c939d5bde4f0..a3570e0a90a8 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
@@ -405,7 +405,7 @@ static int s6e63j0x03_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
 		DRM_ERROR("failed to add mode %ux%ux@%u\n",
 			default_mode.hdisplay, default_mode.vdisplay,
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
index 1d099092e754..a5f76eb4fa25 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
@@ -367,7 +367,7 @@ static int s6e63m0_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
 		DRM_ERROR("failed to add mode %ux%ux@%u\n",
 			  default_mode.hdisplay, default_mode.vdisplay,
diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
index 3bcba64235c4..4b345a242b3f 100644
--- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
+++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
@@ -59,7 +59,6 @@ static inline struct seiko_panel *to_seiko_panel(struct drm_panel *panel)
 static int seiko_panel_get_fixed_modes(struct seiko_panel *panel,
 				       struct drm_connector *connector)
 {
-	struct drm_device *drm = panel->base.drm;
 	struct drm_display_mode *mode;
 	unsigned int i, num = 0;
 
@@ -71,9 +70,9 @@ static int seiko_panel_get_fixed_modes(struct seiko_panel *panel,
 		struct videomode vm;
 
 		videomode_from_timing(dt, &vm);
-		mode = drm_mode_create(drm);
+		mode = drm_mode_create(connector->dev);
 		if (!mode) {
-			dev_err(drm->dev, "failed to add mode %ux%u\n",
+			dev_err(panel->base.dev, "failed to add mode %ux%u\n",
 				dt->hactive.typ, dt->vactive.typ);
 			continue;
 		}
@@ -92,9 +91,9 @@ static int seiko_panel_get_fixed_modes(struct seiko_panel *panel,
 	for (i = 0; i < panel->desc->num_modes; i++) {
 		const struct drm_display_mode *m = &panel->desc->modes[i];
 
-		mode = drm_mode_duplicate(drm, m);
+		mode = drm_mode_duplicate(connector->dev, m);
 		if (!mode) {
-			dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
+			dev_err(panel->base.dev, "failed to add mode %ux%u@%u\n",
 				m->hdisplay, m->vdisplay, m->vrefresh);
 			continue;
 		}
diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
index e797b700661a..17d406f49c3d 100644
--- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
@@ -283,9 +283,9 @@ static int sharp_panel_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
+		dev_err(panel->dev, "failed to add mode %ux%ux@%u\n",
 			default_mode.hdisplay, default_mode.vdisplay,
 			default_mode.vrefresh);
 		return -ENOMEM;
diff --git a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
index 7103a945f0e8..1cf3f02435c1 100644
--- a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
@@ -105,7 +105,7 @@ static int ls037v7dw01_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &ls037v7dw01_mode);
+	mode = drm_mode_duplicate(connector->dev, &ls037v7dw01_mode);
 	if (!mode)
 		return -ENOMEM;
 
diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
index 85ae6cffdbfb..7995cf5a9fc4 100644
--- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
@@ -215,9 +215,9 @@ static int sharp_nt_panel_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
+		dev_err(panel->dev, "failed to add mode %ux%ux@%u\n",
 				default_mode.hdisplay, default_mode.vdisplay,
 				default_mode.vrefresh);
 		return -ENOMEM;
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index e225791a6fb2..73e00288c00c 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -120,7 +120,6 @@ static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
 static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel,
 						   struct drm_connector *connector)
 {
-	struct drm_device *drm = panel->base.drm;
 	struct drm_display_mode *mode;
 	unsigned int i, num = 0;
 
@@ -129,9 +128,9 @@ static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel,
 		struct videomode vm;
 
 		videomode_from_timing(dt, &vm);
-		mode = drm_mode_create(drm);
+		mode = drm_mode_create(connector->dev);
 		if (!mode) {
-			dev_err(drm->dev, "failed to add mode %ux%u\n",
+			dev_err(panel->base.dev, "failed to add mode %ux%u\n",
 				dt->hactive.typ, dt->vactive.typ);
 			continue;
 		}
@@ -153,16 +152,15 @@ static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel,
 static unsigned int panel_simple_get_display_modes(struct panel_simple *panel,
 						   struct drm_connector *connector)
 {
-	struct drm_device *drm = panel->base.drm;
 	struct drm_display_mode *mode;
 	unsigned int i, num = 0;
 
 	for (i = 0; i < panel->desc->num_modes; i++) {
 		const struct drm_display_mode *m = &panel->desc->modes[i];
 
-		mode = drm_mode_duplicate(drm, m);
+		mode = drm_mode_duplicate(connector->dev, m);
 		if (!mode) {
-			dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
+			dev_err(panel->base.dev, "failed to add mode %ux%u@%u\n",
 				m->hdisplay, m->vdisplay, m->vrefresh);
 			continue;
 		}
@@ -184,7 +182,6 @@ static unsigned int panel_simple_get_display_modes(struct panel_simple *panel,
 static int panel_simple_get_non_edid_modes(struct panel_simple *panel,
 					   struct drm_connector *connector)
 {
-	struct drm_device *drm = panel->base.drm;
 	struct drm_display_mode *mode;
 	bool has_override = panel->override_mode.type;
 	unsigned int num = 0;
@@ -193,12 +190,12 @@ static int panel_simple_get_non_edid_modes(struct panel_simple *panel,
 		return 0;
 
 	if (has_override) {
-		mode = drm_mode_duplicate(drm, &panel->override_mode);
+		mode = drm_mode_duplicate(connector->dev, &panel->override_mode);
 		if (mode) {
 			drm_mode_probed_add(connector, mode);
 			num = 1;
 		} else {
-			dev_err(drm->dev, "failed to add override mode\n");
+			dev_err(panel->base.dev, "failed to add override mode\n");
 		}
 	}
 
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
index 3ed3b1d6d82d..c08a865a2a93 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
@@ -271,7 +271,7 @@ static int st7701_get_modes(struct drm_panel *panel,
 	const struct drm_display_mode *desc_mode = st7701->desc->mode;
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, desc_mode);
+	mode = drm_mode_duplicate(connector->dev, desc_mode);
 	if (!mode) {
 		DRM_DEV_ERROR(&st7701->dsi->dev,
 			      "failed to add mode %ux%ux@%u\n",
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
index 836b01331505..ebefe2f4c26b 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
@@ -175,9 +175,9 @@ static int st7789v_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, &default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
+		dev_err(panel->dev, "failed to add mode %ux%ux@%u\n",
 			default_mode.hdisplay, default_mode.vdisplay,
 			default_mode.vrefresh);
 		return -ENOMEM;
diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
index 841dc73c443d..5c4b6f6e5c2d 100644
--- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c
+++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
@@ -526,7 +526,7 @@ static int acx565akm_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &acx565akm_mode);
+	mode = drm_mode_duplicate(connector->dev, &acx565akm_mode);
 	if (!mode)
 		return -ENOMEM;
 
diff --git a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
index 5230176bd8e6..37252590b541 100644
--- a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
+++ b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
@@ -292,7 +292,7 @@ static int td028ttec1_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &td028ttec1_mode);
+	mode = drm_mode_duplicate(connector->dev, &td028ttec1_mode);
 	if (!mode)
 		return -ENOMEM;
 
diff --git a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
index 716f8ed1cc45..75f1f1f1b6de 100644
--- a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
+++ b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
@@ -351,7 +351,7 @@ static int td043mtea1_get_modes(struct drm_panel *panel,
 {
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(panel->drm, &td043mtea1_mode);
+	mode = drm_mode_duplicate(connector->dev, &td043mtea1_mode);
 	if (!mode)
 		return -ENOMEM;
 
diff --git a/drivers/gpu/drm/panel/panel-tpo-tpg110.c b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
index e74cd9d418cf..bee213ea1a42 100644
--- a/drivers/gpu/drm/panel/panel-tpo-tpg110.c
+++ b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
@@ -394,7 +394,7 @@ static int tpg110_get_modes(struct drm_panel *panel,
 	connector->display_info.height_mm = tpg->height;
 	connector->display_info.bus_flags = tpg->panel_mode->bus_flags;
 
-	mode = drm_mode_duplicate(panel->drm, &tpg->panel_mode->mode);
+	mode = drm_mode_duplicate(connector->dev, &tpg->panel_mode->mode);
 	drm_mode_set_name(mode);
 	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
 
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index c4e82b9ce586..95e941c31c3b 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -108,13 +108,6 @@ struct drm_panel_funcs {
  * struct drm_panel - DRM panel object
  */
 struct drm_panel {
-	/**
-	 * @drm:
-	 *
-	 * DRM device owning the panel.
-	 */
-	struct drm_device *drm;
-
 	/**
 	 * @dev:
 	 *
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 09/26] drm/panel: feiyang-fy07024di26a30d: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (6 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 08/26] drm/panel: drop drm_device from drm_panel Sam Ravnborg
@ 2019-12-02 19:32 ` Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 10/26] drm/panel: ilitek-ili9881c: " Sam Ravnborg
                   ` (18 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
index 0157d1844e3e..95b789ab9d29 100644
--- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
+++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
@@ -9,7 +9,6 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 
-#include <linux/backlight.h>
 #include <linux/gpio/consumer.h>
 #include <linux/delay.h>
 #include <linux/module.h>
@@ -22,7 +21,6 @@ struct feiyang {
 	struct drm_panel	panel;
 	struct mipi_dsi_device	*dsi;
 
-	struct backlight_device	*backlight;
 	struct regulator	*dvdd;
 	struct regulator	*avdd;
 	struct gpio_desc	*reset;
@@ -102,7 +100,6 @@ static int feiyang_enable(struct drm_panel *panel)
 	msleep(200);
 
 	mipi_dsi_dcs_set_display_on(ctx->dsi);
-	backlight_enable(ctx->backlight);
 
 	return 0;
 }
@@ -111,7 +108,6 @@ static int feiyang_disable(struct drm_panel *panel)
 {
 	struct feiyang *ctx = panel_to_feiyang(panel);
 
-	backlight_disable(ctx->backlight);
 	return mipi_dsi_dcs_set_display_off(ctx->dsi);
 }
 
@@ -225,9 +221,9 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *dsi)
 		return PTR_ERR(ctx->reset);
 	}
 
-	ctx->backlight = devm_of_find_backlight(&dsi->dev);
-	if (IS_ERR(ctx->backlight))
-		return PTR_ERR(ctx->backlight);
+	ret = drm_panel_of_backlight(&ctx->panel);
+	if (ret)
+		return ret;
 
 	ret = drm_panel_add(&ctx->panel);
 	if (ret < 0)
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 10/26] drm/panel: ilitek-ili9881c: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (7 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 09/26] drm/panel: feiyang-fy07024di26a30d: use drm_panel backlight support Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 11/26] drm/panel: innolux-p079zca: " Sam Ravnborg
                   ` (17 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index 31e5a4e67750..f54077c216a3 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -3,7 +3,6 @@
  * Copyright (C) 2017-2018, Bootlin
  */
 
-#include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/err.h>
@@ -25,7 +24,6 @@ struct ili9881c {
 	struct drm_panel	panel;
 	struct mipi_dsi_device	*dsi;
 
-	struct backlight_device *backlight;
 	struct regulator	*power;
 	struct gpio_desc	*reset;
 };
@@ -348,7 +346,6 @@ static int ili9881c_enable(struct drm_panel *panel)
 	msleep(120);
 
 	mipi_dsi_dcs_set_display_on(ctx->dsi);
-	backlight_enable(ctx->backlight);
 
 	return 0;
 }
@@ -357,7 +354,6 @@ static int ili9881c_disable(struct drm_panel *panel)
 {
 	struct ili9881c *ctx = panel_to_ili9881c(panel);
 
-	backlight_disable(ctx->backlight);
 	return mipi_dsi_dcs_set_display_off(ctx->dsi);
 }
 
@@ -423,7 +419,6 @@ static const struct drm_panel_funcs ili9881c_funcs = {
 
 static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
 {
-	struct device_node *np;
 	struct ili9881c *ctx;
 	int ret;
 
@@ -448,14 +443,9 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
 		return PTR_ERR(ctx->reset);
 	}
 
-	np = of_parse_phandle(dsi->dev.of_node, "backlight", 0);
-	if (np) {
-		ctx->backlight = of_find_backlight_by_node(np);
-		of_node_put(np);
-
-		if (!ctx->backlight)
-			return -EPROBE_DEFER;
-	}
+	ret = drm_panel_of_backlight(&ctx->panel);
+	if (ret)
+		return ret;
 
 	ret = drm_panel_add(&ctx->panel);
 	if (ret < 0)
@@ -475,9 +465,6 @@ static int ili9881c_dsi_remove(struct mipi_dsi_device *dsi)
 	mipi_dsi_detach(dsi);
 	drm_panel_remove(&ctx->panel);
 
-	if (ctx->backlight)
-		put_device(&ctx->backlight->dev);
-
 	return 0;
 }
 
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 11/26] drm/panel: innolux-p079zca: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (8 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 10/26] drm/panel: ilitek-ili9881c: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 12/26] drm/panel: kingdisplay-kd097d04: " Sam Ravnborg
                   ` (16 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/panel/panel-innolux-p079zca.c | 28 ++++++-------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
index b9de37a8a0c5..7419f1f0acee 100644
--- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c
+++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
@@ -3,7 +3,6 @@
  * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
  */
 
-#include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
@@ -52,7 +51,6 @@ struct innolux_panel {
 	struct mipi_dsi_device *link;
 	const struct panel_desc *desc;
 
-	struct backlight_device *backlight;
 	struct regulator_bulk_data *supplies;
 	struct gpio_desc *enable_gpio;
 
@@ -72,8 +70,6 @@ static int innolux_panel_disable(struct drm_panel *panel)
 	if (!innolux->enabled)
 		return 0;
 
-	backlight_disable(innolux->backlight);
-
 	innolux->enabled = false;
 
 	return 0;
@@ -204,18 +200,10 @@ static int innolux_panel_prepare(struct drm_panel *panel)
 static int innolux_panel_enable(struct drm_panel *panel)
 {
 	struct innolux_panel *innolux = to_innolux_panel(panel);
-	int ret;
 
 	if (innolux->enabled)
 		return 0;
 
-	ret = backlight_enable(innolux->backlight);
-	if (ret) {
-		DRM_DEV_ERROR(panel->dev,
-			      "Failed to enable backlight %d\n", ret);
-		return ret;
-	}
-
 	innolux->enabled = true;
 
 	return 0;
@@ -482,13 +470,13 @@ static int innolux_panel_add(struct mipi_dsi_device *dsi,
 		innolux->enable_gpio = NULL;
 	}
 
-	innolux->backlight = devm_of_find_backlight(dev);
-	if (IS_ERR(innolux->backlight))
-		return PTR_ERR(innolux->backlight);
-
 	drm_panel_init(&innolux->base, dev, &innolux_panel_funcs,
 		       DRM_MODE_CONNECTOR_DSI);
 
+	err = drm_panel_of_backlight(&innolux->base);
+	if (err)
+		return err;
+
 	err = drm_panel_add(&innolux->base);
 	if (err < 0)
 		return err;
@@ -526,12 +514,12 @@ static int innolux_panel_remove(struct mipi_dsi_device *dsi)
 	struct innolux_panel *innolux = mipi_dsi_get_drvdata(dsi);
 	int err;
 
-	err = innolux_panel_unprepare(&innolux->base);
+	err = drm_panel_unprepare(&innolux->base);
 	if (err < 0)
 		DRM_DEV_ERROR(&dsi->dev, "failed to unprepare panel: %d\n",
 			      err);
 
-	err = innolux_panel_disable(&innolux->base);
+	err = drm_panel_disable(&innolux->base);
 	if (err < 0)
 		DRM_DEV_ERROR(&dsi->dev, "failed to disable panel: %d\n", err);
 
@@ -549,8 +537,8 @@ static void innolux_panel_shutdown(struct mipi_dsi_device *dsi)
 {
 	struct innolux_panel *innolux = mipi_dsi_get_drvdata(dsi);
 
-	innolux_panel_unprepare(&innolux->base);
-	innolux_panel_disable(&innolux->base);
+	drm_panel_unprepare(&innolux->base);
+	drm_panel_disable(&innolux->base);
 }
 
 static struct mipi_dsi_driver innolux_panel_driver = {
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 12/26] drm/panel: kingdisplay-kd097d04: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (9 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 11/26] drm/panel: innolux-p079zca: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 13/26] drm/panel: lvds: " Sam Ravnborg
                   ` (15 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 .../drm/panel/panel-kingdisplay-kd097d04.c    | 28 ++++++-------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
index 353ee6caa01c..bac1a2a06c92 100644
--- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
+++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
@@ -3,7 +3,6 @@
  * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
  */
 
-#include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
@@ -23,7 +22,6 @@ struct kingdisplay_panel {
 	struct drm_panel base;
 	struct mipi_dsi_device *link;
 
-	struct backlight_device *backlight;
 	struct regulator *supply;
 	struct gpio_desc *enable_gpio;
 
@@ -191,8 +189,6 @@ static int kingdisplay_panel_disable(struct drm_panel *panel)
 	if (!kingdisplay->enabled)
 		return 0;
 
-	backlight_disable(kingdisplay->backlight);
-
 	err = mipi_dsi_dcs_set_display_off(kingdisplay->link);
 	if (err < 0)
 		DRM_DEV_ERROR(panel->dev, "failed to set display off: %d\n",
@@ -303,18 +299,10 @@ static int kingdisplay_panel_prepare(struct drm_panel *panel)
 static int kingdisplay_panel_enable(struct drm_panel *panel)
 {
 	struct kingdisplay_panel *kingdisplay = to_kingdisplay_panel(panel);
-	int ret;
 
 	if (kingdisplay->enabled)
 		return 0;
 
-	ret = backlight_enable(kingdisplay->backlight);
-	if (ret) {
-		DRM_DEV_ERROR(panel->dev,
-			      "Failed to enable backlight %d\n", ret);
-		return ret;
-	}
-
 	kingdisplay->enabled = true;
 
 	return 0;
@@ -388,13 +376,13 @@ static int kingdisplay_panel_add(struct kingdisplay_panel *kingdisplay)
 		kingdisplay->enable_gpio = NULL;
 	}
 
-	kingdisplay->backlight = devm_of_find_backlight(dev);
-	if (IS_ERR(kingdisplay->backlight))
-		return PTR_ERR(kingdisplay->backlight);
-
 	drm_panel_init(&kingdisplay->base, &kingdisplay->link->dev,
 		       &kingdisplay_panel_funcs, DRM_MODE_CONNECTOR_DSI);
 
+	err = drm_panel_of_backlight(&kingdisplay->base);
+	if (err)
+		return err;
+
 	return drm_panel_add(&kingdisplay->base);
 }
 
@@ -432,12 +420,12 @@ static int kingdisplay_panel_remove(struct mipi_dsi_device *dsi)
 	struct kingdisplay_panel *kingdisplay = mipi_dsi_get_drvdata(dsi);
 	int err;
 
-	err = kingdisplay_panel_unprepare(&kingdisplay->base);
+	err = drm_panel_unprepare(&kingdisplay->base);
 	if (err < 0)
 		DRM_DEV_ERROR(&dsi->dev, "failed to unprepare panel: %d\n",
 			      err);
 
-	err = kingdisplay_panel_disable(&kingdisplay->base);
+	err = drm_panel_disable(&kingdisplay->base);
 	if (err < 0)
 		DRM_DEV_ERROR(&dsi->dev, "failed to disable panel: %d\n", err);
 
@@ -455,8 +443,8 @@ static void kingdisplay_panel_shutdown(struct mipi_dsi_device *dsi)
 {
 	struct kingdisplay_panel *kingdisplay = mipi_dsi_get_drvdata(dsi);
 
-	kingdisplay_panel_unprepare(&kingdisplay->base);
-	kingdisplay_panel_disable(&kingdisplay->base);
+	drm_panel_unprepare(&kingdisplay->base);
+	drm_panel_disable(&kingdisplay->base);
 }
 
 static struct mipi_dsi_driver kingdisplay_panel_driver = {
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 13/26] drm/panel: lvds: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (10 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 12/26] drm/panel: kingdisplay-kd097d04: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-03  7:16   ` Laurent Pinchart
  2019-12-02 19:32 ` [PATCH v1 14/26] drm/panel: olimex-lcd-olinuxino: " Sam Ravnborg
                   ` (14 subsequent siblings)
  26 siblings, 1 reply; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/panel/panel-lvds.c | 40 ++++--------------------------
 1 file changed, 5 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index 5e40b674bb15..5ce3f4a2b7a1 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -8,7 +8,6 @@
  * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  */
 
-#include <linux/backlight.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/of_platform.h>
@@ -34,7 +33,6 @@ struct panel_lvds {
 	unsigned int bus_format;
 	bool data_mirror;
 
-	struct backlight_device *backlight;
 	struct regulator *supply;
 
 	struct gpio_desc *enable_gpio;
@@ -46,19 +44,6 @@ static inline struct panel_lvds *to_panel_lvds(struct drm_panel *panel)
 	return container_of(panel, struct panel_lvds, panel);
 }
 
-static int panel_lvds_disable(struct drm_panel *panel)
-{
-	struct panel_lvds *lvds = to_panel_lvds(panel);
-
-	if (lvds->backlight) {
-		lvds->backlight->props.power = FB_BLANK_POWERDOWN;
-		lvds->backlight->props.state |= BL_CORE_FBBLANK;
-		backlight_update_status(lvds->backlight);
-	}
-
-	return 0;
-}
-
 static int panel_lvds_unprepare(struct drm_panel *panel)
 {
 	struct panel_lvds *lvds = to_panel_lvds(panel);
@@ -93,19 +78,6 @@ static int panel_lvds_prepare(struct drm_panel *panel)
 	return 0;
 }
 
-static int panel_lvds_enable(struct drm_panel *panel)
-{
-	struct panel_lvds *lvds = to_panel_lvds(panel);
-
-	if (lvds->backlight) {
-		lvds->backlight->props.state &= ~BL_CORE_FBBLANK;
-		lvds->backlight->props.power = FB_BLANK_UNBLANK;
-		backlight_update_status(lvds->backlight);
-	}
-
-	return 0;
-}
-
 static int panel_lvds_get_modes(struct drm_panel *panel,
 				struct drm_connector *connector)
 {
@@ -132,10 +104,8 @@ static int panel_lvds_get_modes(struct drm_panel *panel,
 }
 
 static const struct drm_panel_funcs panel_lvds_funcs = {
-	.disable = panel_lvds_disable,
 	.unprepare = panel_lvds_unprepare,
 	.prepare = panel_lvds_prepare,
-	.enable = panel_lvds_enable,
 	.get_modes = panel_lvds_get_modes,
 };
 
@@ -242,10 +212,6 @@ static int panel_lvds_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	lvds->backlight = devm_of_find_backlight(lvds->dev);
-	if (IS_ERR(lvds->backlight))
-		return PTR_ERR(lvds->backlight);
-
 	/*
 	 * TODO: Handle all power supplies specified in the DT node in a generic
 	 * way for panels that don't care about power supply ordering. LVDS
@@ -257,6 +223,10 @@ static int panel_lvds_probe(struct platform_device *pdev)
 	drm_panel_init(&lvds->panel, lvds->dev, &panel_lvds_funcs,
 		       DRM_MODE_CONNECTOR_LVDS);
 
+	ret = drm_panel_of_backlight(&lvds->panel);
+	if (ret)
+		return ret;
+
 	ret = drm_panel_add(&lvds->panel);
 	if (ret < 0)
 		return ret;
@@ -271,7 +241,7 @@ static int panel_lvds_remove(struct platform_device *pdev)
 
 	drm_panel_remove(&lvds->panel);
 
-	panel_lvds_disable(&lvds->panel);
+	drm_panel_disable(&lvds->panel);
 
 	return 0;
 }
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 14/26] drm/panel: olimex-lcd-olinuxino: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (11 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 13/26] drm/panel: lvds: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 15/26] drm/panel: osd-osd101t2587-53ts: " Sam Ravnborg
                   ` (13 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, Stefan Mavrodiev, linux-rockchip,
	Tomi Valkeinen, Jagan Teki, NXP Linux Team, Jitao Shi,
	Pengutronix Kernel Team, Maarten Lankhorst, Maxime Ripard,
	linux-mediatek, Abhinav Kumar, linux-tegra, Sean Paul,
	linux-arm-kernel, Purism Kernel Team, linux-renesas-soc,
	Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Stefan Mavrodiev <stefan@olimex.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 .../gpu/drm/panel/panel-olimex-lcd-olinuxino.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
index e553e584399b..09deb99981a4 100644
--- a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
+++ b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
@@ -6,7 +6,6 @@
  *   Author: Stefan Mavrodiev <stefan@olimex.com>
  */
 
-#include <linux/backlight.h>
 #include <linux/crc32.h>
 #include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
@@ -68,7 +67,6 @@ struct lcd_olinuxino {
 	bool prepared;
 	bool enabled;
 
-	struct backlight_device *backlight;
 	struct regulator *supply;
 	struct gpio_desc *enable_gpio;
 
@@ -87,8 +85,6 @@ static int lcd_olinuxino_disable(struct drm_panel *panel)
 	if (!lcd->enabled)
 		return 0;
 
-	backlight_disable(lcd->backlight);
-
 	lcd->enabled = false;
 
 	return 0;
@@ -134,8 +130,6 @@ static int lcd_olinuxino_enable(struct drm_panel *panel)
 	if (lcd->enabled)
 		return 0;
 
-	backlight_enable(lcd->backlight);
-
 	lcd->enabled = true;
 
 	return 0;
@@ -283,13 +277,13 @@ static int lcd_olinuxino_probe(struct i2c_client *client,
 	if (IS_ERR(lcd->enable_gpio))
 		return PTR_ERR(lcd->enable_gpio);
 
-	lcd->backlight = devm_of_find_backlight(dev);
-	if (IS_ERR(lcd->backlight))
-		return PTR_ERR(lcd->backlight);
-
 	drm_panel_init(&lcd->panel, dev, &lcd_olinuxino_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
 
+	ret = drm_panel_of_backlight(&lcd->panel);
+	if (ret)
+		return ret;
+
 	return drm_panel_add(&lcd->panel);
 }
 
@@ -299,8 +293,8 @@ static int lcd_olinuxino_remove(struct i2c_client *client)
 
 	drm_panel_remove(&panel->panel);
 
-	lcd_olinuxino_disable(&panel->panel);
-	lcd_olinuxino_unprepare(&panel->panel);
+	drm_panel_disable(&panel->panel);
+	drm_panel_unprepare(&panel->panel);
 
 	return 0;
 }
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 15/26] drm/panel: osd-osd101t2587-53ts: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (12 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 14/26] drm/panel: olimex-lcd-olinuxino: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 16/26] drm/panel: panasonic-vvx10f034n00: " Sam Ravnborg
                   ` (12 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 .../drm/panel/panel-osd-osd101t2587-53ts.c    | 24 +++++++------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
index 2734b4835dfa..3a0229d60095 100644
--- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
+++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
@@ -4,7 +4,6 @@
  *  Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
  */
 
-#include <linux/backlight.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/regulator/consumer.h>
@@ -20,7 +19,6 @@ struct osd101t2587_panel {
 	struct drm_panel base;
 	struct mipi_dsi_device *dsi;
 
-	struct backlight_device *backlight;
 	struct regulator *supply;
 
 	bool prepared;
@@ -42,8 +40,6 @@ static int osd101t2587_panel_disable(struct drm_panel *panel)
 	if (!osd101t2587->enabled)
 		return 0;
 
-	backlight_disable(osd101t2587->backlight);
-
 	ret = mipi_dsi_shutdown_peripheral(osd101t2587->dsi);
 
 	osd101t2587->enabled = false;
@@ -91,8 +87,6 @@ static int osd101t2587_panel_enable(struct drm_panel *panel)
 	if (ret)
 		return ret;
 
-	backlight_enable(osd101t2587->backlight);
-
 	osd101t2587->enabled = true;
 
 	return ret;
@@ -158,18 +152,19 @@ MODULE_DEVICE_TABLE(of, osd101t2587_of_match);
 static int osd101t2587_panel_add(struct osd101t2587_panel *osd101t2587)
 {
 	struct device *dev = &osd101t2587->dsi->dev;
+	int ret;
 
 	osd101t2587->supply = devm_regulator_get(dev, "power");
 	if (IS_ERR(osd101t2587->supply))
 		return PTR_ERR(osd101t2587->supply);
 
-	osd101t2587->backlight = devm_of_find_backlight(dev);
-	if (IS_ERR(osd101t2587->backlight))
-		return PTR_ERR(osd101t2587->backlight);
-
 	drm_panel_init(&osd101t2587->base, &osd101t2587->dsi->dev,
 		       &osd101t2587_panel_funcs, DRM_MODE_CONNECTOR_DSI);
 
+	ret = drm_panel_of_backlight(&osd101t2587->base);
+	if (ret)
+		return ret;
+
 	return drm_panel_add(&osd101t2587->base);
 }
 
@@ -215,12 +210,11 @@ static int osd101t2587_panel_remove(struct mipi_dsi_device *dsi)
 	struct osd101t2587_panel *osd101t2587 = mipi_dsi_get_drvdata(dsi);
 	int ret;
 
-	ret = osd101t2587_panel_disable(&osd101t2587->base);
+	ret = drm_panel_disable(&osd101t2587->base);
 	if (ret < 0)
 		dev_warn(&dsi->dev, "failed to disable panel: %d\n", ret);
 
-	osd101t2587_panel_unprepare(&osd101t2587->base);
-
+	drm_panel_unprepare(&osd101t2587->base);
 	drm_panel_remove(&osd101t2587->base);
 
 	ret = mipi_dsi_detach(dsi);
@@ -234,8 +228,8 @@ static void osd101t2587_panel_shutdown(struct mipi_dsi_device *dsi)
 {
 	struct osd101t2587_panel *osd101t2587 = mipi_dsi_get_drvdata(dsi);
 
-	osd101t2587_panel_disable(&osd101t2587->base);
-	osd101t2587_panel_unprepare(&osd101t2587->base);
+	drm_panel_disable(&osd101t2587->base);
+	drm_panel_unprepare(&osd101t2587->base);
 }
 
 static struct mipi_dsi_driver osd101t2587_panel_driver = {
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 16/26] drm/panel: panasonic-vvx10f034n00: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (13 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 15/26] drm/panel: osd-osd101t2587-53ts: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 17/26] drm/panel: raydium-rm68200: " Sam Ravnborg
                   ` (11 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 .../drm/panel/panel-panasonic-vvx10f034n00.c  | 45 +++----------------
 1 file changed, 6 insertions(+), 39 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
index 579ac0d86ea4..4e15bff5a1b5 100644
--- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
+++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
@@ -7,7 +7,6 @@
  * Based on AUO panel driver by Rob Clark <robdclark@gmail.com>
  */
 
-#include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -31,7 +30,6 @@ struct wuxga_nt_panel {
 	struct drm_panel base;
 	struct mipi_dsi_device *dsi;
 
-	struct backlight_device *backlight;
 	struct regulator *supply;
 
 	bool prepared;
@@ -62,12 +60,6 @@ static int wuxga_nt_panel_disable(struct drm_panel *panel)
 
 	mipi_ret = mipi_dsi_shutdown_peripheral(wuxga_nt->dsi);
 
-	if (wuxga_nt->backlight) {
-		wuxga_nt->backlight->props.power = FB_BLANK_POWERDOWN;
-		wuxga_nt->backlight->props.state |= BL_CORE_FBBLANK;
-		bl_ret = backlight_update_status(wuxga_nt->backlight);
-	}
-
 	wuxga_nt->enabled = false;
 
 	return mipi_ret ? mipi_ret : bl_ret;
@@ -142,12 +134,6 @@ static int wuxga_nt_panel_enable(struct drm_panel *panel)
 	if (wuxga_nt->enabled)
 		return 0;
 
-	if (wuxga_nt->backlight) {
-		wuxga_nt->backlight->props.power = FB_BLANK_UNBLANK;
-		wuxga_nt->backlight->props.state &= ~BL_CORE_FBBLANK;
-		backlight_update_status(wuxga_nt->backlight);
-	}
-
 	wuxga_nt->enabled = true;
 
 	return 0;
@@ -206,7 +192,6 @@ MODULE_DEVICE_TABLE(of, wuxga_nt_of_match);
 static int wuxga_nt_panel_add(struct wuxga_nt_panel *wuxga_nt)
 {
 	struct device *dev = &wuxga_nt->dsi->dev;
-	struct device_node *np;
 	int ret;
 
 	wuxga_nt->mode = &default_mode;
@@ -215,38 +200,20 @@ static int wuxga_nt_panel_add(struct wuxga_nt_panel *wuxga_nt)
 	if (IS_ERR(wuxga_nt->supply))
 		return PTR_ERR(wuxga_nt->supply);
 
-	np = of_parse_phandle(dev->of_node, "backlight", 0);
-	if (np) {
-		wuxga_nt->backlight = of_find_backlight_by_node(np);
-		of_node_put(np);
-
-		if (!wuxga_nt->backlight)
-			return -EPROBE_DEFER;
-	}
-
 	drm_panel_init(&wuxga_nt->base, &wuxga_nt->dsi->dev,
 		       &wuxga_nt_panel_funcs, DRM_MODE_CONNECTOR_DSI);
 
-	ret = drm_panel_add(&wuxga_nt->base);
-	if (ret < 0)
-		goto put_backlight;
-
-	return 0;
-
-put_backlight:
-	if (wuxga_nt->backlight)
-		put_device(&wuxga_nt->backlight->dev);
+	ret = drm_panel_of_backlight(&wuxga_nt->base);
+	if (ret)
+		return ret;
 
-	return ret;
+	return drm_panel_add(&wuxga_nt->base);
 }
 
 static void wuxga_nt_panel_del(struct wuxga_nt_panel *wuxga_nt)
 {
 	if (wuxga_nt->base.dev)
 		drm_panel_remove(&wuxga_nt->base);
-
-	if (wuxga_nt->backlight)
-		put_device(&wuxga_nt->backlight->dev);
 }
 
 static int wuxga_nt_panel_probe(struct mipi_dsi_device *dsi)
@@ -281,7 +248,7 @@ static int wuxga_nt_panel_remove(struct mipi_dsi_device *dsi)
 	struct wuxga_nt_panel *wuxga_nt = mipi_dsi_get_drvdata(dsi);
 	int ret;
 
-	ret = wuxga_nt_panel_disable(&wuxga_nt->base);
+	ret = drm_panel_disable(&wuxga_nt->base);
 	if (ret < 0)
 		dev_err(&dsi->dev, "failed to disable panel: %d\n", ret);
 
@@ -298,7 +265,7 @@ static void wuxga_nt_panel_shutdown(struct mipi_dsi_device *dsi)
 {
 	struct wuxga_nt_panel *wuxga_nt = mipi_dsi_get_drvdata(dsi);
 
-	wuxga_nt_panel_disable(&wuxga_nt->base);
+	drm_panel_disable(&wuxga_nt->base);
 }
 
 static struct mipi_dsi_driver wuxga_nt_panel_driver = {
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 17/26] drm/panel: raydium-rm68200: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (14 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 16/26] drm/panel: panasonic-vvx10f034n00: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 18/26] drm/panel: rocktech-jh057n00900: " Sam Ravnborg
                   ` (10 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/panel/panel-raydium-rm68200.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
index d6a03328e594..e8982948e0ea 100644
--- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c
+++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
@@ -6,9 +6,9 @@
  *          Yannick Fertre <yannick.fertre@st.com>
  */
 
-#include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/regulator/consumer.h>
 
@@ -78,7 +78,6 @@ struct rm68200 {
 	struct drm_panel panel;
 	struct gpio_desc *reset_gpio;
 	struct regulator *supply;
-	struct backlight_device *backlight;
 	bool prepared;
 	bool enabled;
 };
@@ -242,8 +241,6 @@ static int rm68200_disable(struct drm_panel *panel)
 	if (!ctx->enabled)
 		return 0;
 
-	backlight_disable(ctx->backlight);
-
 	ctx->enabled = false;
 
 	return 0;
@@ -328,8 +325,6 @@ static int rm68200_enable(struct drm_panel *panel)
 	if (ctx->enabled)
 		return 0;
 
-	backlight_enable(ctx->backlight);
-
 	ctx->enabled = true;
 
 	return 0;
@@ -392,10 +387,6 @@ static int rm68200_probe(struct mipi_dsi_device *dsi)
 		return ret;
 	}
 
-	ctx->backlight = devm_of_find_backlight(dev);
-	if (IS_ERR(ctx->backlight))
-		return PTR_ERR(ctx->backlight);
-
 	mipi_dsi_set_drvdata(dsi, ctx);
 
 	ctx->dev = dev;
@@ -408,6 +399,10 @@ static int rm68200_probe(struct mipi_dsi_device *dsi)
 	drm_panel_init(&ctx->panel, dev, &rm68200_drm_funcs,
 		       DRM_MODE_CONNECTOR_DSI);
 
+	ret = drm_panel_of_backlight(&ctx->panel);
+	if (ret)
+		return ret;
+
 	drm_panel_add(&ctx->panel);
 
 	ret = mipi_dsi_attach(dsi);
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 18/26] drm/panel: rocktech-jh057n00900: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (15 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 17/26] drm/panel: raydium-rm68200: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-04 12:04   ` Guido Günther
  2019-12-02 19:32 ` [PATCH v1 19/26] drm/panel: ronbo-rb070d30: " Sam Ravnborg
                   ` (9 subsequent siblings)
  26 siblings, 1 reply; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	Guido Günther, NXP Linux Team, Jitao Shi,
	Pengutronix Kernel Team, Maarten Lankhorst, Maxime Ripard,
	linux-mediatek, Abhinav Kumar, linux-tegra, Sean Paul,
	linux-arm-kernel, Purism Kernel Team, linux-renesas-soc,
	Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver.
While touching the include files sort them
and divide them up in blocks.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: "Guido Günther" <agx@sigxcpu.org>
Cc: Purism Kernel Team <kernel@puri.sm>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 .../drm/panel/panel-rocktech-jh057n00900.c    | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
index 3a4f1c0fce86..38ff742bc120 100644
--- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
+++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
@@ -5,20 +5,22 @@
  * Copyright (C) Purism SPC 2019
  */
 
-#include <drm/drm_mipi_dsi.h>
-#include <drm/drm_modes.h>
-#include <drm/drm_panel.h>
-#include <drm/drm_print.h>
-#include <linux/backlight.h>
 #include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/media-bus-format.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/regulator/consumer.h>
+
 #include <video/display_timing.h>
 #include <video/mipi_display.h>
 
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
+#include <drm/drm_panel.h>
+#include <drm/drm_print.h>
+
 #define DRV_NAME "panel-rocktech-jh057n00900"
 
 /* Manufacturer specific Commands send via DSI */
@@ -47,7 +49,6 @@ struct jh057n {
 	struct device *dev;
 	struct drm_panel panel;
 	struct gpio_desc *reset_gpio;
-	struct backlight_device *backlight;
 	struct regulator *vcc;
 	struct regulator *iovcc;
 	bool prepared;
@@ -152,7 +153,7 @@ static int jh057n_enable(struct drm_panel *panel)
 		return ret;
 	}
 
-	return backlight_enable(ctx->backlight);
+	return 0;
 }
 
 static int jh057n_disable(struct drm_panel *panel)
@@ -160,7 +161,6 @@ static int jh057n_disable(struct drm_panel *panel)
 	struct jh057n *ctx = panel_to_jh057n(panel);
 	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
 
-	backlight_disable(ctx->backlight);
 	return mipi_dsi_dcs_set_display_off(dsi);
 }
 
@@ -321,10 +321,6 @@ static int jh057n_probe(struct mipi_dsi_device *dsi)
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO |
 		MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_VIDEO_SYNC_PULSE;
 
-	ctx->backlight = devm_of_find_backlight(dev);
-	if (IS_ERR(ctx->backlight))
-		return PTR_ERR(ctx->backlight);
-
 	ctx->vcc = devm_regulator_get(dev, "vcc");
 	if (IS_ERR(ctx->vcc)) {
 		ret = PTR_ERR(ctx->vcc);
@@ -347,6 +343,10 @@ static int jh057n_probe(struct mipi_dsi_device *dsi)
 	drm_panel_init(&ctx->panel, dev, &jh057n_drm_funcs,
 		       DRM_MODE_CONNECTOR_DSI);
 
+	ret = drm_panel_of_backlight(&ctx->panel);
+	if (ret)
+		return ret;
+
 	drm_panel_add(&ctx->panel);
 
 	ret = mipi_dsi_attach(dsi);
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 19/26] drm/panel: ronbo-rb070d30: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (16 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 18/26] drm/panel: rocktech-jh057n00900: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 20/26] drm/panel: seiko-43wvf1g: " Sam Ravnborg
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/panel/panel-ronbo-rb070d30.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
index 746a3a221100..ef18559e237e 100644
--- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
+++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
@@ -7,7 +7,6 @@
  * This file based on panel-ilitek-ili9881c.c
  */
 
-#include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/err.h>
@@ -29,7 +28,6 @@
 struct rb070d30_panel {
 	struct drm_panel panel;
 	struct mipi_dsi_device *dsi;
-	struct backlight_device *backlight;
 	struct regulator *supply;
 
 	struct {
@@ -84,22 +82,13 @@ static int rb070d30_panel_enable(struct drm_panel *panel)
 	if (ret)
 		return ret;
 
-	ret = backlight_enable(ctx->backlight);
-	if (ret)
-		goto out;
-
 	return 0;
-
-out:
-	mipi_dsi_dcs_enter_sleep_mode(ctx->dsi);
-	return ret;
 }
 
 static int rb070d30_panel_disable(struct drm_panel *panel)
 {
 	struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);
 
-	backlight_disable(ctx->backlight);
 	return mipi_dsi_dcs_enter_sleep_mode(ctx->dsi);
 }
 
@@ -208,11 +197,9 @@ static int rb070d30_panel_dsi_probe(struct mipi_dsi_device *dsi)
 		return PTR_ERR(ctx->gpios.shlr);
 	}
 
-	ctx->backlight = devm_of_find_backlight(&dsi->dev);
-	if (IS_ERR(ctx->backlight)) {
-		DRM_DEV_ERROR(&dsi->dev, "Couldn't get our backlight\n");
-		return PTR_ERR(ctx->backlight);
-	}
+	ret = drm_panel_of_backlight(&ctx->panel);
+	if (ret)
+		return ret;
 
 	ret = drm_panel_add(&ctx->panel);
 	if (ret < 0)
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 20/26] drm/panel: seiko-43wvf1g: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (17 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 19/26] drm/panel: ronbo-rb070d30: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 21/26] drm/panel: sharp-lq101r1sx01: " Sam Ravnborg
                   ` (7 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 36 ++++-----------------
 1 file changed, 6 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
index 4b345a242b3f..e7e00b23c975 100644
--- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
+++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
@@ -6,7 +6,6 @@
  * Based on Panel Simple driver by Thierry Reding <treding@nvidia.com>
  */
 
-#include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -46,7 +45,6 @@ struct seiko_panel {
 	bool prepared;
 	bool enabled;
 	const struct seiko_panel_desc *desc;
-	struct backlight_device *backlight;
 	struct regulator *dvdd;
 	struct regulator *avdd;
 };
@@ -127,12 +125,6 @@ static int seiko_panel_disable(struct drm_panel *panel)
 	if (!p->enabled)
 		return 0;
 
-	if (p->backlight) {
-		p->backlight->props.power = FB_BLANK_POWERDOWN;
-		p->backlight->props.state |= BL_CORE_FBBLANK;
-		backlight_update_status(p->backlight);
-	}
-
 	p->enabled = false;
 
 	return 0;
@@ -196,12 +188,6 @@ static int seiko_panel_enable(struct drm_panel *panel)
 	if (p->enabled)
 		return 0;
 
-	if (p->backlight) {
-		p->backlight->props.state &= ~BL_CORE_FBBLANK;
-		p->backlight->props.power = FB_BLANK_UNBLANK;
-		backlight_update_status(p->backlight);
-	}
-
 	p->enabled = true;
 
 	return 0;
@@ -227,7 +213,6 @@ static const struct drm_panel_funcs seiko_panel_funcs = {
 static int seiko_panel_probe(struct device *dev,
 					const struct seiko_panel_desc *desc)
 {
-	struct device_node *backlight;
 	struct seiko_panel *panel;
 	int err;
 
@@ -247,18 +232,13 @@ static int seiko_panel_probe(struct device *dev,
 	if (IS_ERR(panel->avdd))
 		return PTR_ERR(panel->avdd);
 
-	backlight = of_parse_phandle(dev->of_node, "backlight", 0);
-	if (backlight) {
-		panel->backlight = of_find_backlight_by_node(backlight);
-		of_node_put(backlight);
-
-		if (!panel->backlight)
-			return -EPROBE_DEFER;
-	}
-
 	drm_panel_init(&panel->base, dev, &seiko_panel_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
 
+	err = drm_panel_of_backlight(&panel->base);
+	if (err)
+		return err;
+
 	err = drm_panel_add(&panel->base);
 	if (err < 0)
 		return err;
@@ -273,11 +253,7 @@ static int seiko_panel_remove(struct platform_device *pdev)
 	struct seiko_panel *panel = dev_get_drvdata(&pdev->dev);
 
 	drm_panel_remove(&panel->base);
-
-	seiko_panel_disable(&panel->base);
-
-	if (panel->backlight)
-		put_device(&panel->backlight->dev);
+	drm_panel_disable(&panel->base);
 
 	return 0;
 }
@@ -286,7 +262,7 @@ static void seiko_panel_shutdown(struct platform_device *pdev)
 {
 	struct seiko_panel *panel = dev_get_drvdata(&pdev->dev);
 
-	seiko_panel_disable(&panel->base);
+	drm_panel_disable(&panel->base);
 }
 
 static const struct display_timing seiko_43wvf1g_timing = {
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 21/26] drm/panel: sharp-lq101r1sx01: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (18 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 20/26] drm/panel: seiko-43wvf1g: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 22/26] drm/panel: sharp-ls043t1le01: " Sam Ravnborg
                   ` (6 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 .../gpu/drm/panel/panel-sharp-lq101r1sx01.c   | 21 +++++++------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
index 17d406f49c3d..b5d1977221a7 100644
--- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
@@ -3,7 +3,6 @@
  * Copyright (C) 2014 NVIDIA Corporation
  */
 
-#include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
@@ -23,7 +22,6 @@ struct sharp_panel {
 	struct mipi_dsi_device *link1;
 	struct mipi_dsi_device *link2;
 
-	struct backlight_device *backlight;
 	struct regulator *supply;
 
 	bool prepared;
@@ -94,8 +92,6 @@ static int sharp_panel_disable(struct drm_panel *panel)
 	if (!sharp->enabled)
 		return 0;
 
-	backlight_disable(sharp->backlight);
-
 	sharp->enabled = false;
 
 	return 0;
@@ -258,8 +254,6 @@ static int sharp_panel_enable(struct drm_panel *panel)
 	if (sharp->enabled)
 		return 0;
 
-	backlight_enable(sharp->backlight);
-
 	sharp->enabled = true;
 
 	return 0;
@@ -317,7 +311,7 @@ MODULE_DEVICE_TABLE(of, sharp_of_match);
 
 static int sharp_panel_add(struct sharp_panel *sharp)
 {
-	struct device *dev = &sharp->link1->dev;
+	int ret;
 
 	sharp->mode = &default_mode;
 
@@ -325,14 +319,13 @@ static int sharp_panel_add(struct sharp_panel *sharp)
 	if (IS_ERR(sharp->supply))
 		return PTR_ERR(sharp->supply);
 
-	sharp->backlight = devm_of_find_backlight(dev);
-
-	if (IS_ERR(sharp->backlight))
-		return PTR_ERR(sharp->backlight);
-
 	drm_panel_init(&sharp->base, &sharp->link1->dev, &sharp_panel_funcs,
 		       DRM_MODE_CONNECTOR_DSI);
 
+	ret = drm_panel_of_backlight(&sharp->base);
+	if (ret)
+		return ret;
+
 	return drm_panel_add(&sharp->base);
 }
 
@@ -408,7 +401,7 @@ static int sharp_panel_remove(struct mipi_dsi_device *dsi)
 		return 0;
 	}
 
-	err = sharp_panel_disable(&sharp->base);
+	err = drm_panel_disable(&sharp->base);
 	if (err < 0)
 		dev_err(&dsi->dev, "failed to disable panel: %d\n", err);
 
@@ -429,7 +422,7 @@ static void sharp_panel_shutdown(struct mipi_dsi_device *dsi)
 	if (!sharp)
 		return;
 
-	sharp_panel_disable(&sharp->base);
+	drm_panel_disable(&sharp->base);
 }
 
 static struct mipi_dsi_driver sharp_panel_driver = {
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 22/26] drm/panel: sharp-ls043t1le01: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (19 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 21/26] drm/panel: sharp-lq101r1sx01: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 23/26] drm/panel: sitronix-st7701: " Sam Ravnborg
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 .../gpu/drm/panel/panel-sharp-ls043t1le01.c   | 20 +++++++------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
index 7995cf5a9fc4..b60c4db1ed6d 100644
--- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
@@ -7,7 +7,6 @@
  * Based on AUO panel driver by Rob Clark <robdclark@gmail.com>
  */
 
-#include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
@@ -25,7 +24,6 @@ struct sharp_nt_panel {
 	struct drm_panel base;
 	struct mipi_dsi_device *dsi;
 
-	struct backlight_device *backlight;
 	struct regulator *supply;
 	struct gpio_desc *reset_gpio;
 
@@ -107,8 +105,6 @@ static int sharp_nt_panel_disable(struct drm_panel *panel)
 	if (!sharp_nt->enabled)
 		return 0;
 
-	backlight_disable(sharp_nt->backlight);
-
 	sharp_nt->enabled = false;
 
 	return 0;
@@ -190,8 +186,6 @@ static int sharp_nt_panel_enable(struct drm_panel *panel)
 	if (sharp_nt->enabled)
 		return 0;
 
-	backlight_enable(sharp_nt->backlight);
-
 	sharp_nt->enabled = true;
 
 	return 0;
@@ -244,6 +238,7 @@ static const struct drm_panel_funcs sharp_nt_panel_funcs = {
 static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)
 {
 	struct device *dev = &sharp_nt->dsi->dev;
+	int ret;
 
 	sharp_nt->mode = &default_mode;
 
@@ -260,14 +255,13 @@ static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)
 		gpiod_set_value(sharp_nt->reset_gpio, 0);
 	}
 
-	sharp_nt->backlight = devm_of_find_backlight(dev);
-
-	if (IS_ERR(sharp_nt->backlight))
-		return PTR_ERR(sharp_nt->backlight);
-
 	drm_panel_init(&sharp_nt->base, &sharp_nt->dsi->dev,
 		       &sharp_nt_panel_funcs, DRM_MODE_CONNECTOR_DSI);
 
+	ret = drm_panel_of_backlight(&sharp_nt->base);
+	if (ret)
+		return ret;
+
 	return drm_panel_add(&sharp_nt->base);
 }
 
@@ -309,7 +303,7 @@ static int sharp_nt_panel_remove(struct mipi_dsi_device *dsi)
 	struct sharp_nt_panel *sharp_nt = mipi_dsi_get_drvdata(dsi);
 	int ret;
 
-	ret = sharp_nt_panel_disable(&sharp_nt->base);
+	ret = drm_panel_disable(&sharp_nt->base);
 	if (ret < 0)
 		dev_err(&dsi->dev, "failed to disable panel: %d\n", ret);
 
@@ -326,7 +320,7 @@ static void sharp_nt_panel_shutdown(struct mipi_dsi_device *dsi)
 {
 	struct sharp_nt_panel *sharp_nt = mipi_dsi_get_drvdata(dsi);
 
-	sharp_nt_panel_disable(&sharp_nt->base);
+	drm_panel_disable(&sharp_nt->base);
 }
 
 static const struct of_device_id sharp_nt_of_match[] = {
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 23/26] drm/panel: sitronix-st7701: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (20 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 22/26] drm/panel: sharp-ls043t1le01: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 24/26] drm/panel: sitronix-st7789v: " Sam Ravnborg
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/panel/panel-sitronix-st7701.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
index c08a865a2a93..4b4f2558e3b4 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
@@ -9,7 +9,6 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 
-#include <linux/backlight.h>
 #include <linux/gpio/consumer.h>
 #include <linux/delay.h>
 #include <linux/module.h>
@@ -103,7 +102,6 @@ struct st7701 {
 	struct mipi_dsi_device *dsi;
 	const struct st7701_panel_desc *desc;
 
-	struct backlight_device *backlight;
 	struct regulator_bulk_data *supplies;
 	struct gpio_desc *reset;
 	unsigned int sleep_delay;
@@ -223,7 +221,6 @@ static int st7701_enable(struct drm_panel *panel)
 	struct st7701 *st7701 = panel_to_st7701(panel);
 
 	ST7701_DSI(st7701, MIPI_DCS_SET_DISPLAY_ON, 0x00);
-	backlight_enable(st7701->backlight);
 
 	return 0;
 }
@@ -232,7 +229,6 @@ static int st7701_disable(struct drm_panel *panel)
 {
 	struct st7701 *st7701 = panel_to_st7701(panel);
 
-	backlight_disable(st7701->backlight);
 	ST7701_DSI(st7701, MIPI_DCS_SET_DISPLAY_OFF, 0x00);
 
 	return 0;
@@ -366,10 +362,6 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi)
 		return PTR_ERR(st7701->reset);
 	}
 
-	st7701->backlight = devm_of_find_backlight(&dsi->dev);
-	if (IS_ERR(st7701->backlight))
-		return PTR_ERR(st7701->backlight);
-
 	drm_panel_init(&st7701->panel, &dsi->dev, &st7701_funcs,
 		       DRM_MODE_CONNECTOR_DSI);
 
@@ -384,6 +376,10 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi)
 	 */
 	st7701->sleep_delay = 120 + desc->panel_sleep_delay;
 
+	ret = drm_panel_of_backlight(&st7701->panel);
+	if (ret)
+		return ret;
+
 	ret = drm_panel_add(&st7701->panel);
 	if (ret < 0)
 		return ret;
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 24/26] drm/panel: sitronix-st7789v: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (21 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 23/26] drm/panel: sitronix-st7701: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-02 19:32 ` [PATCH v1 25/26] drm/panel: tpo-td028ttec1: " Sam Ravnborg
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 .../gpu/drm/panel/panel-sitronix-st7789v.c    | 37 ++-----------------
 1 file changed, 4 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
index ebefe2f4c26b..cc02c54c1b2e 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
@@ -3,7 +3,6 @@
  * Copyright (C) 2017 Free Electrons
  */
 
-#include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
@@ -116,7 +115,6 @@ struct st7789v {
 	struct drm_panel panel;
 	struct spi_device *spi;
 	struct gpio_desc *reset;
-	struct backlight_device *backlight;
 	struct regulator *power;
 };
 
@@ -323,12 +321,6 @@ static int st7789v_enable(struct drm_panel *panel)
 {
 	struct st7789v *ctx = panel_to_st7789v(panel);
 
-	if (ctx->backlight) {
-		ctx->backlight->props.state &= ~BL_CORE_FBBLANK;
-		ctx->backlight->props.power = FB_BLANK_UNBLANK;
-		backlight_update_status(ctx->backlight);
-	}
-
 	return st7789v_write_command(ctx, MIPI_DCS_SET_DISPLAY_ON);
 }
 
@@ -339,12 +331,6 @@ static int st7789v_disable(struct drm_panel *panel)
 
 	ST7789V_TEST(ret, st7789v_write_command(ctx, MIPI_DCS_SET_DISPLAY_OFF));
 
-	if (ctx->backlight) {
-		ctx->backlight->props.power = FB_BLANK_POWERDOWN;
-		ctx->backlight->props.state |= BL_CORE_FBBLANK;
-		backlight_update_status(ctx->backlight);
-	}
-
 	return 0;
 }
 
@@ -370,7 +356,6 @@ static const struct drm_panel_funcs st7789v_drm_funcs = {
 
 static int st7789v_probe(struct spi_device *spi)
 {
-	struct device_node *backlight;
 	struct st7789v *ctx;
 	int ret;
 
@@ -394,26 +379,15 @@ static int st7789v_probe(struct spi_device *spi)
 		return PTR_ERR(ctx->reset);
 	}
 
-	backlight = of_parse_phandle(spi->dev.of_node, "backlight", 0);
-	if (backlight) {
-		ctx->backlight = of_find_backlight_by_node(backlight);
-		of_node_put(backlight);
-
-		if (!ctx->backlight)
-			return -EPROBE_DEFER;
-	}
+	ret = drm_panel_of_backlight(&ctx->panel);
+	if (ret)
+		return ret;
 
 	ret = drm_panel_add(&ctx->panel);
 	if (ret < 0)
-		goto err_free_backlight;
+		return ret;
 
 	return 0;
-
-err_free_backlight:
-	if (ctx->backlight)
-		put_device(&ctx->backlight->dev);
-
-	return ret;
 }
 
 static int st7789v_remove(struct spi_device *spi)
@@ -422,9 +396,6 @@ static int st7789v_remove(struct spi_device *spi)
 
 	drm_panel_remove(&ctx->panel);
 
-	if (ctx->backlight)
-		put_device(&ctx->backlight->dev);
-
 	return 0;
 }
 
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 25/26] drm/panel: tpo-td028ttec1: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (22 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 24/26] drm/panel: sitronix-st7789v: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-03  7:16   ` Laurent Pinchart
  2019-12-02 19:32 ` [PATCH v1 26/26] drm/panel: tpo-tpg110: " Sam Ravnborg
                   ` (2 subsequent siblings)
  26 siblings, 1 reply; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/panel/panel-tpo-td028ttec1.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
index 37252590b541..cf29405a2dbe 100644
--- a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
+++ b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
@@ -17,7 +17,6 @@
  * H. Nikolaus Schaller <hns@goldelico.com>
  */
 
-#include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/spi/spi.h>
@@ -83,7 +82,6 @@ struct td028ttec1_panel {
 	struct drm_panel panel;
 
 	struct spi_device *spi;
-	struct backlight_device *backlight;
 };
 
 #define to_td028ttec1_device(p) container_of(p, struct td028ttec1_panel, panel)
@@ -243,8 +241,6 @@ static int td028ttec1_enable(struct drm_panel *panel)
 	if (ret)
 		return ret;
 
-	backlight_enable(lcd->backlight);
-
 	return 0;
 }
 
@@ -252,8 +248,6 @@ static int td028ttec1_disable(struct drm_panel *panel)
 {
 	struct td028ttec1_panel *lcd = to_td028ttec1_device(panel);
 
-	backlight_disable(lcd->backlight);
-
 	jbt_ret_write_0(lcd, JBT_REG_DISPLAY_OFF, NULL);
 
 	return 0;
@@ -334,10 +328,6 @@ static int td028ttec1_probe(struct spi_device *spi)
 	spi_set_drvdata(spi, lcd);
 	lcd->spi = spi;
 
-	lcd->backlight = devm_of_find_backlight(&spi->dev);
-	if (IS_ERR(lcd->backlight))
-		return PTR_ERR(lcd->backlight);
-
 	spi->mode = SPI_MODE_3;
 	spi->bits_per_word = 9;
 
@@ -350,6 +340,10 @@ static int td028ttec1_probe(struct spi_device *spi)
 	drm_panel_init(&lcd->panel, &lcd->spi->dev, &td028ttec1_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
 
+	ret = drm_panel_of_backlight(&lcd->panel);
+	if (ret)
+		return ret;
+
 	return drm_panel_add(&lcd->panel);
 }
 
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH v1 26/26] drm/panel: tpo-tpg110: use drm_panel backlight support
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (23 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 25/26] drm/panel: tpo-td028ttec1: " Sam Ravnborg
@ 2019-12-02 19:32 ` " Sam Ravnborg
  2019-12-03 13:20   ` Linus Walleij
  2019-12-02 19:59 ` [PATCH v1 0/26] drm/panel infrastructure + backlight update Jeffrey Hugo
  2019-12-03  7:24 ` Laurent Pinchart
  26 siblings, 1 reply; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 19:32 UTC (permalink / raw)
  To: dri-devel, Thierry Reding, Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen, Jagan Teki,
	NXP Linux Team, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Use the backlight support in drm_panel to simplify the driver

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/panel/panel-tpo-tpg110.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-tpo-tpg110.c b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
index bee213ea1a42..8472d018c16f 100644
--- a/drivers/gpu/drm/panel/panel-tpo-tpg110.c
+++ b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
@@ -14,13 +14,13 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 
-#include <linux/backlight.h>
 #include <linux/bitops.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
 
@@ -76,10 +76,6 @@ struct tpg110 {
 	 * @panel: the DRM panel instance for this device
 	 */
 	struct drm_panel panel;
-	/**
-	 * @backlight: backlight for this panel
-	 */
-	struct backlight_device *backlight;
 	/**
 	 * @panel_type: the panel mode as detected
 	 */
@@ -356,8 +352,6 @@ static int tpg110_disable(struct drm_panel *panel)
 	val &= ~TPG110_CTRL2_PM;
 	tpg110_write_reg(tpg, TPG110_CTRL2_PM, val);
 
-	backlight_disable(tpg->backlight);
-
 	return 0;
 }
 
@@ -366,8 +360,6 @@ static int tpg110_enable(struct drm_panel *panel)
 	struct tpg110 *tpg = to_tpg110(panel);
 	u8 val;
 
-	backlight_enable(tpg->backlight);
-
 	/* Take chip out of standby */
 	val = tpg110_read_reg(tpg, TPG110_CTRL2_PM);
 	val |= TPG110_CTRL2_PM;
@@ -432,11 +424,6 @@ static int tpg110_probe(struct spi_device *spi)
 	if (ret)
 		DRM_DEV_ERROR(dev, "no panel height specified\n");
 
-	/* Look for some optional backlight */
-	tpg->backlight = devm_of_find_backlight(dev);
-	if (IS_ERR(tpg->backlight))
-		return PTR_ERR(tpg->backlight);
-
 	/* This asserts the GRESTB signal, putting the display into reset */
 	tpg->grestb = devm_gpiod_get(dev, "grestb", GPIOD_OUT_HIGH);
 	if (IS_ERR(tpg->grestb)) {
@@ -459,6 +446,11 @@ static int tpg110_probe(struct spi_device *spi)
 
 	drm_panel_init(&tpg->panel, dev, &tpg110_drm_funcs,
 		       DRM_MODE_CONNECTOR_DPI);
+
+	ret = drm_panel_of_backlight(&tpg->panel);
+	if (ret)
+		return ret;
+
 	spi_set_drvdata(spi, tpg);
 
 	return drm_panel_add(&tpg->panel);
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 0/26] drm/panel infrastructure + backlight update
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (24 preceding siblings ...)
  2019-12-02 19:32 ` [PATCH v1 26/26] drm/panel: tpo-tpg110: " Sam Ravnborg
@ 2019-12-02 19:59 ` Jeffrey Hugo
  2019-12-02 20:48   ` Sam Ravnborg
  2019-12-03  7:24 ` Laurent Pinchart
  26 siblings, 1 reply; 54+ messages in thread
From: Jeffrey Hugo @ 2019-12-02 19:59 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Thierry Reding, Laurent Pinchart,
	Benjamin Gaignard, linux-samsung-soc, Abhinav Kumar,
	linux-rockchip, Tomi Valkeinen, NXP Linux Team, Jagan Teki,
	Jitao Shi, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	linux-mediatek, open list:DRM PANEL DRIVERS, linux-tegra,
	Sean Paul, Linux ARM, Purism Kernel Team, linux-renesas-soc,
	Boris Brezillon, Pengutronix Kernel Team

On Mon, Dec 2, 2019 at 12:33 PM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> This patchset include a couple of different
> things - all related to panels.
>
> - The panel callbacks are optional - so drop error if
>   callback is not present.
>
> - Add support for backlight in drm_panel.
>   This allows us to make much simpler backlight
>   support to most panels.
>   The patchset include conversion of most of the
>   trivial cases.
>
> - Drop drm_connector from drm_panel.
>   This change required many changes to most
>   panels and many bridges and display drivers.
>   This is by far the most invasive change in this patchset.
>
> - Drop the unused get_timings() callback.
>   No users, so no need to keep it around.
>
> With this patchset drm_panel_(attach|detach) are nop's
> but they are kept for now.
>
> A few of these patches has been sent out before - but versioning
> started again from v1 - as the most patches are new.
>
> I have tested the panel-simple changes, and thus some
> of the infrastructure changes.
> The testing was done on an earlier iteration - and I ended
> up submitting this as Laurent and others started to depend on it.
> Jitao has a patch to add more callbacks, and I wanted the
> simplification of the callbacks before we add more callbacks.
>
>         Sam
>
>
> Sam Ravnborg (26):
>       drm/drm_panel: no error when no callback
>       drm/panel: add backlight support
>       drm/panel: simple: use drm_panel backlight support
>       drm: get drm_bridge_panel connector via helper
>       drm/panel: add drm_connector argument to get_modes()
>       drm/panel: decouple connector from drm_panel
>       drm/panel: remove get_timings
>       drm/panel: drop drm_device from drm_panel
>       drm/panel: feiyang-fy07024di26a30d: use drm_panel backlight support
>       drm/panel: ilitek-ili9881c: use drm_panel backlight support
>       drm/panel: innolux-p079zca: use drm_panel backlight support
>       drm/panel: kingdisplay-kd097d04: use drm_panel backlight support
>       drm/panel: lvds: use drm_panel backlight support
>       drm/panel: olimex-lcd-olinuxino: use drm_panel backlight support
>       drm/panel: osd-osd101t2587-53ts: use drm_panel backlight support
>       drm/panel: panasonic-vvx10f034n00: use drm_panel backlight support
>       drm/panel: raydium-rm68200: use drm_panel backlight support
>       drm/panel: rocktech-jh057n00900: use drm_panel backlight support
>       drm/panel: ronbo-rb070d30: use drm_panel backlight support
>       drm/panel: seiko-43wvf1g: use drm_panel backlight support
>       drm/panel: sharp-lq101r1sx01: use drm_panel backlight support
>       drm/panel: sharp-ls043t1le01: use drm_panel backlight support
>       drm/panel: sitronix-st7701: use drm_panel backlight support
>       drm/panel: sitronix-st7789v: use drm_panel backlight support
>       drm/panel: tpo-td028ttec1: use drm_panel backlight support
>       drm/panel: tpo-tpg110: use drm_panel backlight support
>
>  drivers/gpu/drm/bridge/analogix/analogix-anx6345.c |   2 +-
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |   2 +-
>  drivers/gpu/drm/bridge/panel.c                     |  18 +++-
>  drivers/gpu/drm/bridge/parade-ps8622.c             |   2 +-
>  drivers/gpu/drm/bridge/tc358764.c                  |   2 +-
>  drivers/gpu/drm/bridge/tc358767.c                  |   2 +-
>  drivers/gpu/drm/bridge/ti-sn65dsi86.c              |   2 +-
>  drivers/gpu/drm/drm_panel.c                        |  96 ++++++++++++++----
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c            |   2 +-
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c            |   2 +-
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c          |   2 +-
>  drivers/gpu/drm/imx/imx-ldb.c                      |   2 +-
>  drivers/gpu/drm/imx/parallel-display.c             |   2 +-
>  drivers/gpu/drm/mediatek/mtk_dsi.c                 |   2 +-
>  .../gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c    |   2 +-
>  drivers/gpu/drm/msm/dsi/dsi_manager.c              |   2 +-

How come the diff stat in the cover letter here indicates a change to
this file, yet I cannot find a change to this file in any of the
patches?  What am I missing?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 0/26] drm/panel infrastructure + backlight update
  2019-12-02 19:59 ` [PATCH v1 0/26] drm/panel infrastructure + backlight update Jeffrey Hugo
@ 2019-12-02 20:48   ` Sam Ravnborg
  2019-12-02 20:51     ` Jeffrey Hugo
  0 siblings, 1 reply; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-02 20:48 UTC (permalink / raw)
  To: Jeffrey Hugo
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Thierry Reding, Laurent Pinchart,
	Benjamin Gaignard, linux-samsung-soc, Abhinav Kumar,
	linux-rockchip, Tomi Valkeinen, NXP Linux Team, Jagan Teki,
	Jitao Shi, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	linux-mediatek, open list:DRM PANEL DRIVERS, linux-tegra,
	Sean Paul, Linux ARM, Purism Kernel Team, linux-renesas-soc,
	Boris Brezillon, Pengutronix Kernel Team

Hi Jeffrey.

> >  drivers/gpu/drm/msm/dsi/dsi_manager.c              |   2 +-
> 
> How come the diff stat in the cover letter here indicates a change to
> this file, yet I cannot find a change to this file in any of the
> patches?  What am I missing?

This file is patched in "[PATCH v1 06/26] drm/panel: decouple connector
from drm_panel"

See: https://lists.freedesktop.org/archives/dri-devel/2019-December/247186.html

The above patch touches a lot of files/drivers so it was cc: to
a lot of people. Maybe is was considered as spam?
 
	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 0/26] drm/panel infrastructure + backlight update
  2019-12-02 20:48   ` Sam Ravnborg
@ 2019-12-02 20:51     ` Jeffrey Hugo
  0 siblings, 0 replies; 54+ messages in thread
From: Jeffrey Hugo @ 2019-12-02 20:51 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, Stefan Agner,
	Andrzej Hajda, Thierry Reding, Laurent Pinchart,
	Benjamin Gaignard, linux-samsung-soc, Abhinav Kumar,
	linux-rockchip, Tomi Valkeinen, NXP Linux Team, Jagan Teki,
	Jitao Shi, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	linux-mediatek, open list:DRM PANEL DRIVERS, linux-tegra,
	Sean Paul, Linux ARM, Purism Kernel Team, linux-renesas-soc,
	Boris Brezillon, Pengutronix Kernel Team

On Mon, Dec 2, 2019 at 1:48 PM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Jeffrey.
>
> > >  drivers/gpu/drm/msm/dsi/dsi_manager.c              |   2 +-
> >
> > How come the diff stat in the cover letter here indicates a change to
> > this file, yet I cannot find a change to this file in any of the
> > patches?  What am I missing?
>
> This file is patched in "[PATCH v1 06/26] drm/panel: decouple connector
> from drm_panel"
>
> See: https://lists.freedesktop.org/archives/dri-devel/2019-December/247186.html
>
> The above patch touches a lot of files/drivers so it was cc: to
> a lot of people. Maybe is was considered as spam?

Interesting.  I missed that I didn't have patch 6 in the series in my
inbox.  Its also not in my spam box.  I wonder where it went.

Thanks for the direct link to the patch.  I saw no concerns.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 01/26] drm/drm_panel: no error when no callback
  2019-12-02 19:32 ` [PATCH v1 01/26] drm/drm_panel: no error when no callback Sam Ravnborg
@ 2019-12-03  6:24   ` Laurent Pinchart
  0 siblings, 0 replies; 54+ messages in thread
From: Laurent Pinchart @ 2019-12-03  6:24 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Benjamin Gaignard, Stefan Agner,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen,
	NXP Linux Team, Jagan Teki, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Hi Sam,

Thank you for the patch.

On Mon, Dec 02, 2019 at 08:32:05PM +0100, Sam Ravnborg wrote:
> The callbacks in drm_panel_funcs are optional, so do not
> return an error just because no callback is assigned.

Unless I'm mistaken the callbacks are not documented as optional. Should
this be fixed too ?

> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_panel.c | 35 +++++++++++++++++++++++++----------
>  1 file changed, 25 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index ed7985c0535a..2d59cdd05e50 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -151,10 +151,13 @@ EXPORT_SYMBOL(drm_panel_detach);
>   */
>  int drm_panel_prepare(struct drm_panel *panel)
>  {
> -	if (panel && panel->funcs && panel->funcs->prepare)
> +	if (!panel)
> +		return -EINVAL;
> +
> +	if (panel->funcs && panel->funcs->prepare)
>  		return panel->funcs->prepare(panel);
>  
> -	return panel ? -ENOSYS : -EINVAL;
> +	return 0;
>  }
>  EXPORT_SYMBOL(drm_panel_prepare);
>  
> @@ -171,10 +174,13 @@ EXPORT_SYMBOL(drm_panel_prepare);
>   */
>  int drm_panel_unprepare(struct drm_panel *panel)
>  {
> -	if (panel && panel->funcs && panel->funcs->unprepare)
> +	if (!panel)
> +		return -EINVAL;
> +
> +	if (panel->funcs && panel->funcs->unprepare)
>  		return panel->funcs->unprepare(panel);
>  
> -	return panel ? -ENOSYS : -EINVAL;
> +	return 0;
>  }
>  EXPORT_SYMBOL(drm_panel_unprepare);
>  
> @@ -190,10 +196,13 @@ EXPORT_SYMBOL(drm_panel_unprepare);
>   */
>  int drm_panel_enable(struct drm_panel *panel)
>  {
> -	if (panel && panel->funcs && panel->funcs->enable)
> +	if (!panel)
> +		return -EINVAL;
> +
> +	if (panel->funcs && panel->funcs->enable)
>  		return panel->funcs->enable(panel);
>  
> -	return panel ? -ENOSYS : -EINVAL;
> +	return 0;
>  }
>  EXPORT_SYMBOL(drm_panel_enable);
>  
> @@ -209,10 +218,13 @@ EXPORT_SYMBOL(drm_panel_enable);
>   */
>  int drm_panel_disable(struct drm_panel *panel)
>  {
> -	if (panel && panel->funcs && panel->funcs->disable)
> +	if (!panel)
> +		return -EINVAL;
> +
> +	if (panel->funcs && panel->funcs->disable)
>  		return panel->funcs->disable(panel);
>  
> -	return panel ? -ENOSYS : -EINVAL;
> +	return 0;
>  }
>  EXPORT_SYMBOL(drm_panel_disable);
>  
> @@ -228,10 +240,13 @@ EXPORT_SYMBOL(drm_panel_disable);
>   */
>  int drm_panel_get_modes(struct drm_panel *panel)
>  {
> -	if (panel && panel->funcs && panel->funcs->get_modes)
> +	if (!panel)
> +		return -EINVAL;
> +
> +	if (panel->funcs && panel->funcs->get_modes)
>  		return panel->funcs->get_modes(panel);

Should get_modes() be optional ? As far as I can tell all the panel
drivers in drivers/gpu/drm/panel/ implement it, and I'm not sure to see
how a panel could be usable if it can't return its mode.

On the other hand you return 0 if the callback isn't implemented, which
doesn't mean success here, so I suppose that's fine, but I don't think
we should document .get_modes() as being optional.

With these issues addressed (if they need to be),

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  
> -	return panel ? -ENOSYS : -EINVAL;
> +	return 0;
>  }
>  EXPORT_SYMBOL(drm_panel_get_modes);
>  

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 02/26] drm/panel: add backlight support
  2019-12-02 19:32 ` [PATCH v1 02/26] drm/panel: add backlight support Sam Ravnborg
@ 2019-12-03  6:32   ` Laurent Pinchart
  0 siblings, 0 replies; 54+ messages in thread
From: Laurent Pinchart @ 2019-12-03  6:32 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Benjamin Gaignard, Stefan Agner,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen,
	NXP Linux Team, Jagan Teki, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Maxime Ripard, Sean Paul, linux-arm-kernel,
	Purism Kernel Team, linux-renesas-soc, Boris Brezillon,
	Daniel Vetter

Hi Sam,

Thank you for the patch.

On Mon, Dec 02, 2019 at 08:32:06PM +0100, Sam Ravnborg wrote:
> Panels often supports backlight as specified in a device tree.
> Update the drm_panel infrastructure to support this to
> simplify the drivers.
> 
> With this the panel driver just needs to add the following to the
> probe() function:
> 
>     err = drm_panel_of_backlight(panel);
>     if (err)
>             return err;
> 
> Then drm_panel will handle all the rest.
> 
> v2:
> - Drop test of CONFIG_DRM_PANEL in header-file (Laurent)
> - do not enable backlight if ->enable() returns an error
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_panel.c | 49 +++++++++++++++++++++++++++++++++++--
>  include/drm/drm_panel.h     | 23 +++++++++++++++++
>  2 files changed, 70 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index 2d59cdd05e50..35609c90e467 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -21,6 +21,7 @@
>   * DEALINGS IN THE SOFTWARE.
>   */
>  
> +#include <linux/backlight.h>
>  #include <linux/err.h>
>  #include <linux/module.h>
>  
> @@ -196,13 +197,18 @@ EXPORT_SYMBOL(drm_panel_unprepare);
>   */
>  int drm_panel_enable(struct drm_panel *panel)
>  {
> +	int ret = 0;
> +
>  	if (!panel)
>  		return -EINVAL;
>  
>  	if (panel->funcs && panel->funcs->enable)
> -		return panel->funcs->enable(panel);
> +		ret = panel->funcs->enable(panel);
>  
> -	return 0;
> +	if (ret >= 0)


I'd write

	if (panel->funcs && panel->funcs->enable) {
		ret = panel->funcs->enable(panel);
		if (ret < 0)
			return ret;
	}

and then handle the backlight with one less indentation level.


> +		backlight_enable(panel->backlight);

What is backlight_enable() returns an error ? Should we at least log
that ?

> +
> +	return ret;
>  }
>  EXPORT_SYMBOL(drm_panel_enable);
>  
> @@ -221,6 +227,8 @@ int drm_panel_disable(struct drm_panel *panel)
>  	if (!panel)
>  		return -EINVAL;
>  
> +	backlight_disable(panel->backlight);
> +
>  	if (panel->funcs && panel->funcs->disable)
>  		return panel->funcs->disable(panel);
>  
> @@ -289,6 +297,43 @@ struct drm_panel *of_drm_find_panel(const struct device_node *np)
>  EXPORT_SYMBOL(of_drm_find_panel);
>  #endif
>  
> +#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
> +/**
> + * drm_panel_of_backlight - use backlight device node for backlight
> + * @panel: DRM panel
> + *
> + * Use this function to enable backlight handling if your panel
> + * uses device tree and has a backlight handle.

s/handle/phandle/

> + *
> + * When panel is enabled backlight will be enabled after a

s/panel/the panel/

> + * successfull call to &drm_panel_funcs.enable()
> + *
> + * When panel is disabled backlight will be disabled before the

Same here.

> + * call to &drm_panel_funcs.disable().
> + *
> + * A typical implementation for a panel driver supporting device tree
> + * will call this function and then backlight just works.

How about

"will call this function at probe time. Backlight will then be handled
transparently without requiring any intervention from the driver at
runtime."

> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int drm_panel_of_backlight(struct drm_panel *panel)
> +{
> +	struct backlight_device *backlight;
> +
> +	if (!panel || !panel->dev)
> +		return -EINVAL;
> +
> +	backlight = devm_of_find_backlight(panel->dev);
> +
> +	if (IS_ERR(backlight))
> +                return PTR_ERR(backlight);
> +
> +	panel->backlight = backlight;
> +	return 0;
> +}
> +EXPORT_SYMBOL(drm_panel_of_backlight);
> +#endif
> +
>  MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
>  MODULE_DESCRIPTION("DRM panel infrastructure");
>  MODULE_LICENSE("GPL and additional rights");
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index ce8da64022b4..d30c98567384 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -28,6 +28,7 @@
>  #include <linux/errno.h>
>  #include <linux/list.h>
>  
> +struct backlight_device;
>  struct device_node;
>  struct drm_connector;
>  struct drm_device;
> @@ -59,6 +60,10 @@ struct display_timing;
>   *
>   * To save power when no video data is transmitted, a driver can power down
>   * the panel. This is the job of the .unprepare() function.
> + *
> + * Backlight can be handled automatically if configured using
> + * drm_panel_of_backlight(). Then the driver do not need to implement the

s/do not/does not/

> + * functionality to enable/disable backlight.
>   */
>  struct drm_panel_funcs {
>  	/**
> @@ -132,6 +137,15 @@ struct drm_panel {
>  	 */
>  	struct device *dev;
>  
> +	/**
> +	 * @backlight:
> +	 *
> +	 * Backlight device, used to turn on backlight after
> +	 * the call to enable(), and to turn off
> +	 * backlight before call to disable().

s/before call/before the call/

or maybe simpler


s/before call to disable()/before disable()/

(and 'after enable()' above in that case).

Should you mention that this field shall not be set directly by drivers,
but is set by drm_panel_of_backlight() instead ?

You can also reflow the text to reach the 80 columns limit :-)

> +	 */
> +	struct backlight_device *backlight;
> +
>  	/**
>  	 * @funcs:
>  	 *
> @@ -183,4 +197,13 @@ static inline struct drm_panel *of_drm_find_panel(const struct device_node *np)
>  }
>  #endif
>  
> +#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
> +int drm_panel_of_backlight(struct drm_panel *panel);
> +#else
> +static inline int drm_panel_of_backlight(struct drm_panel *panel)
> +{
> +	return -EINVAL;

Shouldn't you return 0 instead ? Otherwise panel driver that can support
backlight will all fail to probe if CONFIG_BACKLIGHT_CLASS_DEVICE is
disabled.

> +}
> +#endif
> +
>  #endif

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 03/26] drm/panel: simple: use drm_panel backlight support
  2019-12-02 19:32 ` [PATCH v1 03/26] drm/panel: simple: use drm_panel " Sam Ravnborg
@ 2019-12-03  6:39   ` Laurent Pinchart
  0 siblings, 0 replies; 54+ messages in thread
From: Laurent Pinchart @ 2019-12-03  6:39 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Benjamin Gaignard, Stefan Agner,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen,
	NXP Linux Team, Jagan Teki, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Hi Sam,

Thank you for the patch.

On Mon, Dec 02, 2019 at 08:32:07PM +0100, Sam Ravnborg wrote:
> Use drm_panel infrastructure for backlight.
> Replace direct calls with drm_panel_*() calls
> to utilize the drm_panel support.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> ---
>  drivers/gpu/drm/panel/panel-simple.c | 50 ++++++----------------------
>  1 file changed, 11 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index 72f69709f349..a5df6d6dd455 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -21,7 +21,6 @@
>   * DEALINGS IN THE SOFTWARE.
>   */
>  
> -#include <linux/backlight.h>
>  #include <linux/delay.h>
>  #include <linux/gpio/consumer.h>
>  #include <linux/module.h>
> @@ -105,7 +104,6 @@ struct panel_simple {
>  
>  	const struct panel_desc *desc;
>  
> -	struct backlight_device *backlight;
>  	struct regulator *supply;
>  	struct i2c_adapter *ddc;
>  
> @@ -236,12 +234,6 @@ static int panel_simple_disable(struct drm_panel *panel)
>  	if (!p->enabled)
>  		return 0;
>  
> -	if (p->backlight) {
> -		p->backlight->props.power = FB_BLANK_POWERDOWN;
> -		p->backlight->props.state |= BL_CORE_FBBLANK;
> -		backlight_update_status(p->backlight);
> -	}
> -
>  	if (p->desc->delay.disable)
>  		msleep(p->desc->delay.disable);
>  
> @@ -307,12 +299,6 @@ static int panel_simple_enable(struct drm_panel *panel)
>  	if (p->desc->delay.enable)
>  		msleep(p->desc->delay.enable);
>  
> -	if (p->backlight) {
> -		p->backlight->props.state &= ~BL_CORE_FBBLANK;
> -		p->backlight->props.power = FB_BLANK_UNBLANK;
> -		backlight_update_status(p->backlight);
> -	}
> -
>  	p->enabled = true;
>  
>  	return 0;
> @@ -414,9 +400,9 @@ static void panel_simple_parse_panel_timing_node(struct device *dev,
>  
>  static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
>  {
> -	struct device_node *backlight, *ddc;
>  	struct panel_simple *panel;
>  	struct display_timing dt;
> +	struct device_node *ddc;
>  	int err;
>  
>  	panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
> @@ -442,24 +428,13 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
>  		return err;
>  	}
>  
> -	backlight = of_parse_phandle(dev->of_node, "backlight", 0);
> -	if (backlight) {
> -		panel->backlight = of_find_backlight_by_node(backlight);
> -		of_node_put(backlight);
> -
> -		if (!panel->backlight)
> -			return -EPROBE_DEFER;
> -	}
> -
>  	ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
>  	if (ddc) {
>  		panel->ddc = of_find_i2c_adapter_by_node(ddc);
>  		of_node_put(ddc);
>  
> -		if (!panel->ddc) {
> -			err = -EPROBE_DEFER;
> -			goto free_backlight;
> -		}
> +		if (!panel->ddc)
> +			return -EPROBE_DEFER;
>  	}
>  
>  	if (!of_get_display_timing(dev->of_node, "panel-timing", &dt))
> @@ -468,6 +443,10 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
>  	drm_panel_init(&panel->base, dev, &panel_simple_funcs,
>  		       desc->connector_type);
>  
> +	err = drm_panel_of_backlight(&panel->base);
> +	if (err)
> +		goto free_ddc;
> +
>  	err = drm_panel_add(&panel->base);
>  	if (err < 0)
>  		goto free_ddc;
> @@ -479,9 +458,6 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
>  free_ddc:
>  	if (panel->ddc)
>  		put_device(&panel->ddc->dev);
> -free_backlight:
> -	if (panel->backlight)
> -		put_device(&panel->backlight->dev);
>  
>  	return err;
>  }
> @@ -491,16 +467,12 @@ static int panel_simple_remove(struct device *dev)
>  	struct panel_simple *panel = dev_get_drvdata(dev);
>  
>  	drm_panel_remove(&panel->base);
> -
> -	panel_simple_disable(&panel->base);
> -	panel_simple_unprepare(&panel->base);
> +	drm_panel_disable(&panel->base);
> +	drm_panel_unprepare(&panel->base);
>  
>  	if (panel->ddc)
>  		put_device(&panel->ddc->dev);
>  
> -	if (panel->backlight)
> -		put_device(&panel->backlight->dev);
> -
>  	return 0;
>  }
>  
> @@ -508,8 +480,8 @@ static void panel_simple_shutdown(struct device *dev)
>  {
>  	struct panel_simple *panel = dev_get_drvdata(dev);
>  
> -	panel_simple_disable(&panel->base);
> -	panel_simple_unprepare(&panel->base);
> +	drm_panel_disable(&panel->base);
> +	drm_panel_unprepare(&panel->base);

Without your panel double-disable protection series, you risk disabling
the backlight twice. I think backlight_disable() will work fine, but you
may want to double-check.

With this checked (and possibly addressed if needed),

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  }
>  
>  static const struct drm_display_mode ampire_am_480272h3tmqw_t01h_mode = {

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 04/26] drm: get drm_bridge_panel connector via helper
  2019-12-02 19:32 ` [PATCH v1 04/26] drm: get drm_bridge_panel connector via helper Sam Ravnborg
@ 2019-12-03  6:44   ` Laurent Pinchart
  2019-12-03 13:22   ` Linus Walleij
  1 sibling, 0 replies; 54+ messages in thread
From: Laurent Pinchart @ 2019-12-03  6:44 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Benjamin Gaignard, Stefan Agner,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen,
	NXP Linux Team, Jagan Teki, Jitao Shi, Pengutronix Kernel Team,
	Jonas Karlman, Maarten Lankhorst, Maxime Ripard, linux-mediatek,
	Abhinav Kumar, linux-tegra, Sean Paul, linux-arm-kernel,
	Jernej Skrabec, Purism Kernel Team, Eric Anholt,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Hi Sam,

Thank you for the patch.

On Mon, Dec 02, 2019 at 08:32:08PM +0100, Sam Ravnborg wrote:
> The drm_connector created by drm_panel_bridge was accessed
> via drm_panel.connector.
> Avoid the detour around drm_panel by providing a simple get method.
> This avoids direct access to the connector field in drm_panel in
> the two users.

You may want to add that this is needed to prepare for removal of
drm_panel.connector.

> Update pl111 and tve200 to use the new helper.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Andrzej Hajda <a.hajda@samsung.com>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: Jonas Karlman <jonas@kwiboo.se>
> Cc: Jernej Skrabec <jernej.skrabec@siol.net>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>  drivers/gpu/drm/bridge/panel.c      | 16 ++++++++++++++++
>  drivers/gpu/drm/pl111/pl111_drv.c   |  2 +-
>  drivers/gpu/drm/tve200/tve200_drv.c |  2 +-
>  include/drm/drm_bridge.h            |  1 +
>  4 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
> index f4e293e7cf64..c5e27b81588a 100644
> --- a/drivers/gpu/drm/bridge/panel.c
> +++ b/drivers/gpu/drm/bridge/panel.c
> @@ -289,3 +289,19 @@ struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,
>  	return bridge;
>  }
>  EXPORT_SYMBOL(devm_drm_panel_bridge_add_typed);
> +
> +/**
> + * drm_panel_bridge_connector - return pointer to connector

Maybe "return the connector for the panel bridge" ?

> + *
> + * drm_panel_bridge creates the connector.
> + * This function gives external access to the connector.
> + *
> + * Returns: Pointer to drm_conneector

s/drm_conneector/drm_connector/

> + */
> +struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge)
> +{
> +	struct panel_bridge * panel_bridge;

s/\* panel_bridge/*panel_bridge/

There's also a missing blank line, didn't checkpatch warn about this ?

With those small issues fixed,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +	panel_bridge = drm_bridge_to_panel_bridge(bridge);
> +
> +	return &panel_bridge->connector;
> +}
> diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c
> index 63dfcda04147..aa8aa8d9e405 100644
> --- a/drivers/gpu/drm/pl111/pl111_drv.c
> +++ b/drivers/gpu/drm/pl111/pl111_drv.c
> @@ -166,7 +166,7 @@ static int pl111_modeset_init(struct drm_device *dev)
>  	priv->bridge = bridge;
>  	if (panel) {
>  		priv->panel = panel;
> -		priv->connector = panel->connector;
> +		priv->connector = drm_panel_bridge_connector(bridge);
>  	}
>  
>  	ret = pl111_display_init(dev);
> diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c
> index 954b09c948eb..00ba9e5ce130 100644
> --- a/drivers/gpu/drm/tve200/tve200_drv.c
> +++ b/drivers/gpu/drm/tve200/tve200_drv.c
> @@ -110,7 +110,7 @@ static int tve200_modeset_init(struct drm_device *dev)
>  	}
>  
>  	priv->panel = panel;
> -	priv->connector = panel->connector;
> +	priv->connector = drm_panel_bridge_connector(bridge);
>  	priv->bridge = bridge;
>  
>  	dev_info(dev->dev, "attached to panel %s\n",
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index c0a2286a81e9..9a4902accfe5 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
> @@ -438,6 +438,7 @@ struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev,
>  struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,
>  						   struct drm_panel *panel,
>  						   u32 connector_type);
> +struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge);
>  #endif
>  
>  #endif

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 05/26] drm/panel: add drm_connector argument to get_modes()
  2019-12-02 19:32 ` [PATCH v1 05/26] drm/panel: add drm_connector argument to get_modes() Sam Ravnborg
@ 2019-12-03  6:50   ` Laurent Pinchart
  2019-12-03 13:25   ` Linus Walleij
  2019-12-04 12:08   ` Guido Günther
  2 siblings, 0 replies; 54+ messages in thread
From: Laurent Pinchart @ 2019-12-03  6:50 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Benjamin Gaignard, Stefan Agner,
	linux-samsung-soc, Stefan Mavrodiev, linux-rockchip,
	Tomi Valkeinen, NXP Linux Team, Robert Chiras,
	Guido Günther, Jagan Teki, Jitao Shi,
	Pengutronix Kernel Team, Maarten Lankhorst, Maxime Ripard,
	linux-mediatek, Abhinav Kumar, linux-tegra, Sean Paul,
	linux-arm-kernel, Purism Kernel Team, linux-renesas-soc,
	Boris Brezillon, Daniel Vetter

Hi Sam,

Thank you for the patch.

On Mon, Dec 02, 2019 at 08:32:09PM +0100, Sam Ravnborg wrote:
> Today the bridge creates the drm_connector, but that is planned
> to be moved to the display drivers.
> To facilitate this, update drm_panel_funcs.get_modes() to
> take drm_connector as an argument.
> All panel drivers implementing get_modes() are updated.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Stefan Mavrodiev <stefan@olimex.com>
> Cc: Robert Chiras <robert.chiras@nxp.com>
> Cc: "Guido Günther" <agx@sigxcpu.org>
> Cc: Purism Kernel Team <kernel@puri.sm>
> ---
>  drivers/gpu/drm/drm_panel.c                   |  2 +-
>  drivers/gpu/drm/panel/panel-arm-versatile.c   |  4 +--
>  .../drm/panel/panel-feiyang-fy07024di26a30d.c |  4 +--
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c  |  5 ++--
>  drivers/gpu/drm/panel/panel-ilitek-ili9881c.c |  8 +++---
>  drivers/gpu/drm/panel/panel-innolux-p079zca.c | 13 +++++----
>  .../gpu/drm/panel/panel-jdi-lt070me05000.c    |  9 ++++---
>  .../drm/panel/panel-kingdisplay-kd097d04.c    | 11 ++++----
>  drivers/gpu/drm/panel/panel-lg-lb035q02.c     |  4 +--
>  drivers/gpu/drm/panel/panel-lg-lg4573.c       |  8 +++---
>  drivers/gpu/drm/panel/panel-lvds.c            |  4 +--
>  drivers/gpu/drm/panel/panel-nec-nl8048hl11.c  |  4 +--
>  drivers/gpu/drm/panel/panel-novatek-nt39016.c |  4 +--
>  .../drm/panel/panel-olimex-lcd-olinuxino.c    |  4 +--
>  .../gpu/drm/panel/panel-orisetech-otm8009a.c  |  9 ++++---
>  .../drm/panel/panel-osd-osd101t2587-53ts.c    |  9 ++++---
>  .../drm/panel/panel-panasonic-vvx10f034n00.c  |  9 ++++---
>  .../drm/panel/panel-raspberrypi-touchscreen.c |  4 +--
>  drivers/gpu/drm/panel/panel-raydium-rm67191.c |  6 ++---
>  drivers/gpu/drm/panel/panel-raydium-rm68200.c |  9 ++++---
>  .../drm/panel/panel-rocktech-jh057n00900.c    |  9 ++++---
>  drivers/gpu/drm/panel/panel-ronbo-rb070d30.c  | 10 +++----
>  drivers/gpu/drm/panel/panel-samsung-ld9040.c  |  4 +--
>  drivers/gpu/drm/panel/panel-samsung-s6d16d0.c |  4 +--
>  drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c |  4 +--
>  .../gpu/drm/panel/panel-samsung-s6e63j0x03.c  |  4 +--
>  drivers/gpu/drm/panel/panel-samsung-s6e63m0.c |  4 +--
>  drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c |  4 +--
>  drivers/gpu/drm/panel/panel-seiko-43wvf1g.c   |  9 ++++---
>  .../gpu/drm/panel/panel-sharp-lq101r1sx01.c   |  9 ++++---
>  .../gpu/drm/panel/panel-sharp-ls037v7dw01.c   |  4 +--
>  .../gpu/drm/panel/panel-sharp-ls043t1le01.c   |  9 ++++---
>  drivers/gpu/drm/panel/panel-simple.c          | 27 ++++++++++---------
>  drivers/gpu/drm/panel/panel-sitronix-st7701.c |  9 ++++---
>  .../gpu/drm/panel/panel-sitronix-st7789v.c    |  8 +++---
>  drivers/gpu/drm/panel/panel-sony-acx565akm.c  |  4 +--
>  drivers/gpu/drm/panel/panel-tpo-td028ttec1.c  |  4 +--
>  drivers/gpu/drm/panel/panel-tpo-td043mtea1.c  |  4 +--
>  drivers/gpu/drm/panel/panel-tpo-tpg110.c      |  4 +--
>  drivers/gpu/drm/panel/panel-truly-nt35597.c   |  4 +--
>  include/drm/drm_panel.h                       |  3 ++-
>  41 files changed, 141 insertions(+), 130 deletions(-)

Wow that's lots of manual changes.

> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index 35609c90e467..9927e28d93e6 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -252,7 +252,7 @@ int drm_panel_get_modes(struct drm_panel *panel)
>  		return -EINVAL;
>  
>  	if (panel->funcs && panel->funcs->get_modes)
> -		return panel->funcs->get_modes(panel);
> +		return panel->funcs->get_modes(panel, panel->connector);
>  
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-arm-versatile.c b/drivers/gpu/drm/panel/panel-arm-versatile.c
> index a0574dc03e16..41aa91f60979 100644
> --- a/drivers/gpu/drm/panel/panel-arm-versatile.c
> +++ b/drivers/gpu/drm/panel/panel-arm-versatile.c
> @@ -260,9 +260,9 @@ static int versatile_panel_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int versatile_panel_get_modes(struct drm_panel *panel)
> +static int versatile_panel_get_modes(struct drm_panel *panel,
> +				     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct versatile_panel *vpanel = to_versatile_panel(panel);
>  	struct drm_display_mode *mode;
>  
> diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> index 98f184b81187..37d6b7390954 100644
> --- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> +++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> @@ -162,9 +162,9 @@ static const struct drm_display_mode feiyang_default_mode = {
>  	.type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
>  };
>  
> -static int feiyang_get_modes(struct drm_panel *panel)
> +static int feiyang_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct feiyang *ctx = panel_to_feiyang(panel);
>  	struct drm_display_mode *mode;
>  
> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> index 24955bec1958..8fd4c0521841 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> @@ -641,9 +641,9 @@ static const struct drm_display_mode itu_r_bt_656_720_mode = {
>  	.flags = 0,
>  };
>  
> -static int ili9322_get_modes(struct drm_panel *panel)
> +static int ili9322_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct ili9322 *ili = panel_to_ili9322(panel);
>  	struct drm_display_mode *mode;
>  	struct drm_display_info *info;
> @@ -655,7 +655,6 @@ static int ili9322_get_modes(struct drm_panel *panel)
>  		info->bus_flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE;
>  	else
>  		info->bus_flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE;
> -

This change is unrelated and unneeded in my opinion.

>  	if (ili->conf->de_active_high)
>  		info->bus_flags |= DRM_BUS_FLAG_DE_HIGH;
>  	else
> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> index e8789e460a16..1c67a668d6bf 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> @@ -387,9 +387,9 @@ static const struct drm_display_mode bananapi_default_mode = {
>  	.vtotal		= 1280 + 10 + 10 + 20,
>  };
>  
> -static int ili9881c_get_modes(struct drm_panel *panel)
> +static int ili9881c_get_modes(struct drm_panel *panel,
> +			      struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct ili9881c *ctx = panel_to_ili9881c(panel);
>  	struct drm_display_mode *mode;
>  
> @@ -407,8 +407,8 @@ static int ili9881c_get_modes(struct drm_panel *panel)
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>  	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 62;
> -	panel->connector->display_info.height_mm = 110;
> +	connector->display_info.width_mm = 62;
> +	connector->display_info.height_mm = 110;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> index 83df1ac4211f..facf1bab2532 100644
> --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> @@ -403,7 +403,8 @@ static const struct panel_desc innolux_p097pfg_panel_desc = {
>  	.sleep_mode_delay = 100, /* T15 */
>  };
>  
> -static int innolux_panel_get_modes(struct drm_panel *panel)
> +static int innolux_panel_get_modes(struct drm_panel *panel,
> +				   struct drm_connector *connector)
>  {
>  	struct innolux_panel *innolux = to_innolux_panel(panel);
>  	const struct drm_display_mode *m = innolux->desc->mode;
> @@ -418,13 +419,11 @@ static int innolux_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm =
> -			innolux->desc->size.width;
> -	panel->connector->display_info.height_mm =
> -			innolux->desc->size.height;
> -	panel->connector->display_info.bpc = innolux->desc->bpc;
> +	connector->display_info.width_mm = innolux->desc->size.width;
> +	connector->display_info.height_mm = innolux->desc->size.height;
> +	connector->display_info.bpc = innolux->desc->bpc;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> index 56364a93f0b8..e6b650a64fdb 100644
> --- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> +++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> @@ -300,7 +300,8 @@ static const struct drm_display_mode default_mode = {
>  		.flags = 0,
>  };
>  
> -static int jdi_panel_get_modes(struct drm_panel *panel)
> +static int jdi_panel_get_modes(struct drm_panel *panel,
> +			       struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  	struct jdi_panel *jdi = to_jdi_panel(panel);
> @@ -316,10 +317,10 @@ static int jdi_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 95;
> -	panel->connector->display_info.height_mm = 151;
> +	connector->display_info.width_mm = 95;
> +	connector->display_info.height_mm = 151;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> index 45f96556ec8c..e6f53d56daf9 100644
> --- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> +++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> @@ -333,7 +333,8 @@ static const struct drm_display_mode default_mode = {
>  	.vrefresh = 60,
>  };
>  
> -static int kingdisplay_panel_get_modes(struct drm_panel *panel)
> +static int kingdisplay_panel_get_modes(struct drm_panel *panel,
> +				       struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  
> @@ -347,11 +348,11 @@ static int kingdisplay_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 147;
> -	panel->connector->display_info.height_mm = 196;
> -	panel->connector->display_info.bpc = 8;
> +	connector->display_info.width_mm = 147;
> +	connector->display_info.height_mm = 196;
> +	connector->display_info.bpc = 8;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-lg-lb035q02.c b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> index 7a1385e834f0..7a3bd4d80c79 100644
> --- a/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> +++ b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> @@ -141,9 +141,9 @@ static const struct drm_display_mode lb035q02_mode = {
>  	.height_mm = 53,
>  };
>  
> -static int lb035q02_get_modes(struct drm_panel *panel)
> +static int lb035q02_get_modes(struct drm_panel *panel,
> +			      struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &lb035q02_mode);
> diff --git a/drivers/gpu/drm/panel/panel-lg-lg4573.c b/drivers/gpu/drm/panel/panel-lg-lg4573.c
> index db4865a4c2b9..fc6572b4e2f9 100644
> --- a/drivers/gpu/drm/panel/panel-lg-lg4573.c
> +++ b/drivers/gpu/drm/panel/panel-lg-lg4573.c
> @@ -209,9 +209,9 @@ static const struct drm_display_mode default_mode = {
>  	.vrefresh = 60,
>  };
>  
> -static int lg4573_get_modes(struct drm_panel *panel)
> +static int lg4573_get_modes(struct drm_panel *panel,
> +			    struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> @@ -227,8 +227,8 @@ static int lg4573_get_modes(struct drm_panel *panel)
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>  	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 61;
> -	panel->connector->display_info.height_mm = 103;
> +	connector->display_info.width_mm = 61;
> +	connector->display_info.height_mm = 103;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
> index 2405f26e5d31..f6d58a60e514 100644
> --- a/drivers/gpu/drm/panel/panel-lvds.c
> +++ b/drivers/gpu/drm/panel/panel-lvds.c
> @@ -106,10 +106,10 @@ static int panel_lvds_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int panel_lvds_get_modes(struct drm_panel *panel)
> +static int panel_lvds_get_modes(struct drm_panel *panel,
> +				struct drm_connector *connector)
>  {
>  	struct panel_lvds *lvds = to_panel_lvds(panel);
> -	struct drm_connector *connector = lvds->panel.connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_create(lvds->panel.drm);
> diff --git a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> index fd593532ab23..a6ccdb09aace 100644
> --- a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> +++ b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> @@ -123,9 +123,9 @@ static const struct drm_display_mode nl8048_mode = {
>  	.height_mm = 53,
>  };
>  
> -static int nl8048_get_modes(struct drm_panel *panel)
> +static int nl8048_get_modes(struct drm_panel *panel,
> +			    struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &nl8048_mode);
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt39016.c b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> index 60ccedce530c..91ea49c05611 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> @@ -206,11 +206,11 @@ static int nt39016_disable(struct drm_panel *drm_panel)
>  	return 0;
>  }
>  
> -static int nt39016_get_modes(struct drm_panel *drm_panel)
> +static int nt39016_get_modes(struct drm_panel *drm_panel,
> +			     struct drm_connector *connector)
>  {
>  	struct nt39016 *panel = to_nt39016(drm_panel);
>  	const struct nt39016_panel_info *panel_info = panel->panel_info;
> -	struct drm_connector *connector = drm_panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(drm_panel->drm, &panel_info->display_mode);
> diff --git a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> index 8738ef1b66dc..2b7e0dfebc5e 100644
> --- a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> +++ b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> @@ -141,10 +141,10 @@ static int lcd_olinuxino_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int lcd_olinuxino_get_modes(struct drm_panel *panel)
> +static int lcd_olinuxino_get_modes(struct drm_panel *panel,
> +				   struct drm_connector *connector)
>  {
>  	struct lcd_olinuxino *lcd = to_lcd_olinuxino(panel);
> -	struct drm_connector *connector = lcd->panel.connector;
>  	struct lcd_olinuxino_info *lcd_info = &lcd->eeprom.info;
>  	struct drm_device *drm = lcd->panel.drm;
>  	struct lcd_olinuxino_mode *lcd_mode;
> diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> index bf1f928b215f..4e1606c79072 100644
> --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> @@ -349,7 +349,8 @@ static int otm8009a_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int otm8009a_get_modes(struct drm_panel *panel)
> +static int otm8009a_get_modes(struct drm_panel *panel,
> +			      struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  
> @@ -364,10 +365,10 @@ static int otm8009a_get_modes(struct drm_panel *panel)
>  	drm_mode_set_name(mode);
>  
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = mode->width_mm;
> -	panel->connector->display_info.height_mm = mode->height_mm;
> +	connector->display_info.width_mm = mode->width_mm;
> +	connector->display_info.height_mm = mode->height_mm;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> index 2b40913899d8..b3e010288c10 100644
> --- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> +++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> @@ -112,7 +112,8 @@ static const struct drm_display_mode default_mode_osd101t2587 = {
>  	.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
>  };
>  
> -static int osd101t2587_panel_get_modes(struct drm_panel *panel)
> +static int osd101t2587_panel_get_modes(struct drm_panel *panel,
> +				       struct drm_connector *connector)
>  {
>  	struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel);
>  	struct drm_display_mode *mode;
> @@ -128,10 +129,10 @@ static int osd101t2587_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 217;
> -	panel->connector->display_info.height_mm = 136;
> +	connector->display_info.width_mm = 217;
> +	connector->display_info.height_mm = 136;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> index 664605071d34..19a6eb4637c8 100644
> --- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> +++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> @@ -166,7 +166,8 @@ static const struct drm_display_mode default_mode = {
>  	.vrefresh = 60,
>  };
>  
> -static int wuxga_nt_panel_get_modes(struct drm_panel *panel)
> +static int wuxga_nt_panel_get_modes(struct drm_panel *panel,
> +				    struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  
> @@ -180,10 +181,10 @@ static int wuxga_nt_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 217;
> -	panel->connector->display_info.height_mm = 136;
> +	connector->display_info.width_mm = 217;
> +	connector->display_info.height_mm = 136;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> index 09824e92fc78..732b7111395e 100644
> --- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> @@ -311,9 +311,9 @@ static int rpi_touchscreen_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int rpi_touchscreen_get_modes(struct drm_panel *panel)
> +static int rpi_touchscreen_get_modes(struct drm_panel *panel,
> +				     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_device *drm = panel->drm;
>  	unsigned int i, num = 0;
>  	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
> diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> index fd67fc6185c4..123bb68cfcb7 100644
> --- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> +++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> @@ -436,9 +436,9 @@ static int rad_panel_disable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int rad_panel_get_modes(struct drm_panel *panel)
> +static int rad_panel_get_modes(struct drm_panel *panel,
> +			       struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> @@ -451,7 +451,7 @@ static int rad_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
>  	connector->display_info.width_mm = mode->width_mm;
>  	connector->display_info.height_mm = mode->height_mm;
> diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
> index 994e855721f4..66fa975308ec 100644
> --- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c
> +++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
> @@ -335,7 +335,8 @@ static int rm68200_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int rm68200_get_modes(struct drm_panel *panel)
> +static int rm68200_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  
> @@ -350,10 +351,10 @@ static int rm68200_get_modes(struct drm_panel *panel)
>  	drm_mode_set_name(mode);
>  
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = mode->width_mm;
> -	panel->connector->display_info.height_mm = mode->height_mm;
> +	connector->display_info.width_mm = mode->width_mm;
> +	connector->display_info.height_mm = mode->height_mm;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> index 31234b79d3b1..b2d61cab3cad 100644
> --- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> +++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> @@ -230,7 +230,8 @@ static const struct drm_display_mode default_mode = {
>  	.height_mm   = 130,
>  };
>  
> -static int jh057n_get_modes(struct drm_panel *panel)
> +static int jh057n_get_modes(struct drm_panel *panel,
> +			    struct drm_connector *connector)
>  {
>  	struct jh057n *ctx = panel_to_jh057n(panel);
>  	struct drm_display_mode *mode;
> @@ -246,9 +247,9 @@ static int jh057n_get_modes(struct drm_panel *panel)
>  	drm_mode_set_name(mode);
>  
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> -	panel->connector->display_info.width_mm = mode->width_mm;
> -	panel->connector->display_info.height_mm = mode->height_mm;
> -	drm_mode_probed_add(panel->connector, mode);
> +	connector->display_info.width_mm = mode->width_mm;
> +	connector->display_info.height_mm = mode->height_mm;
> +	drm_mode_probed_add(connector, mode);
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> index 170a5cda21b9..57a462ce221e 100644
> --- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> +++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> @@ -120,9 +120,9 @@ static const struct drm_display_mode default_mode = {
>  	.height_mm	= 85,
>  };
>  
> -static int rb070d30_panel_get_modes(struct drm_panel *panel)
> +static int rb070d30_panel_get_modes(struct drm_panel *panel,
> +				    struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);
>  	struct drm_display_mode *mode;
>  	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
> @@ -140,9 +140,9 @@ static int rb070d30_panel_get_modes(struct drm_panel *panel)
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>  	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.bpc = 8;
> -	panel->connector->display_info.width_mm = mode->width_mm;
> -	panel->connector->display_info.height_mm = mode->height_mm;
> +	connector->display_info.bpc = 8;
> +	connector->display_info.width_mm = mode->width_mm;
> +	connector->display_info.height_mm = mode->height_mm;
>  	drm_display_info_set_bus_formats(&connector->display_info,
>  					 &bus_format, 1);
>  
> diff --git a/drivers/gpu/drm/panel/panel-samsung-ld9040.c b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
> index 250809ba37c7..3c52f15f7a1c 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-ld9040.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
> @@ -261,9 +261,9 @@ static int ld9040_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int ld9040_get_modes(struct drm_panel *panel)
> +static int ld9040_get_modes(struct drm_panel *panel,
> +			    struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct ld9040 *ctx = panel_to_ld9040(panel);
>  	struct drm_display_mode *mode;
>  
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> index e3a0397e953e..71939ab757b1 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> @@ -143,9 +143,9 @@ static int s6d16d0_disable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int s6d16d0_get_modes(struct drm_panel *panel)
> +static int s6d16d0_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &samsung_s6d16d0_mode);
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> index 938ab72c5540..8e0236ba6145 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> @@ -645,9 +645,9 @@ static const struct s6e3ha2_panel_desc samsung_s6e3hf2 = {
>  	.type = HF2_TYPE,
>  };
>  
> -static int s6e3ha2_get_modes(struct drm_panel *panel)
> +static int s6e3ha2_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
>  	struct drm_display_mode *mode;
>  
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> index a60635e9226d..c939d5bde4f0 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> @@ -400,9 +400,9 @@ static int s6e63j0x03_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int s6e63j0x03_get_modes(struct drm_panel *panel)
> +static int s6e63j0x03_get_modes(struct drm_panel *panel,
> +				struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> index ba01af0b14fd..1d099092e754 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> @@ -362,9 +362,9 @@ static int s6e63m0_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int s6e63m0_get_modes(struct drm_panel *panel)
> +static int s6e63m0_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> index dbced6501204..8a028d2bd0d6 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> @@ -920,9 +920,9 @@ static int s6e8aa0_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int s6e8aa0_get_modes(struct drm_panel *panel)
> +static int s6e8aa0_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct s6e8aa0 *ctx = panel_to_s6e8aa0(panel);
>  	struct drm_display_mode *mode;
>  
> diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> index b3619ba443bd..b878930b17e4 100644
> --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> @@ -56,9 +56,9 @@ static inline struct seiko_panel *to_seiko_panel(struct drm_panel *panel)
>  	return container_of(panel, struct seiko_panel, base);
>  }
>  
> -static int seiko_panel_get_fixed_modes(struct seiko_panel *panel)
> +static int seiko_panel_get_fixed_modes(struct seiko_panel *panel,
> +				       struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->base.connector;
>  	struct drm_device *drm = panel->base.drm;
>  	struct drm_display_mode *mode;
>  	unsigned int i, num = 0;
> @@ -208,12 +208,13 @@ static int seiko_panel_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int seiko_panel_get_modes(struct drm_panel *panel)
> +static int seiko_panel_get_modes(struct drm_panel *panel,
> +				 struct drm_connector *connector)
>  {
>  	struct seiko_panel *p = to_seiko_panel(panel);
>  
>  	/* add hard-coded panel modes */
> -	return seiko_panel_get_fixed_modes(p);
> +	return seiko_panel_get_fixed_modes(p, connector);
>  }
>  
>  static int seiko_panel_get_timings(struct drm_panel *panel,
> diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> index 5e136c3ba185..e797b700661a 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> @@ -278,7 +278,8 @@ static const struct drm_display_mode default_mode = {
>  	.vrefresh = 60,
>  };
>  
> -static int sharp_panel_get_modes(struct drm_panel *panel)
> +static int sharp_panel_get_modes(struct drm_panel *panel,
> +				 struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  
> @@ -292,10 +293,10 @@ static int sharp_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 217;
> -	panel->connector->display_info.height_mm = 136;
> +	connector->display_info.width_mm = 217;
> +	connector->display_info.height_mm = 136;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> index eeab7998c7de..7103a945f0e8 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> @@ -100,9 +100,9 @@ static const struct drm_display_mode ls037v7dw01_mode = {
>  	.height_mm = 75,
>  };
>  
> -static int ls037v7dw01_get_modes(struct drm_panel *panel)
> +static int ls037v7dw01_get_modes(struct drm_panel *panel,
> +				 struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &ls037v7dw01_mode);
> diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> index b963ba4ab589..85ae6cffdbfb 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> @@ -210,7 +210,8 @@ static const struct drm_display_mode default_mode = {
>  	.vrefresh = 60,
>  };
>  
> -static int sharp_nt_panel_get_modes(struct drm_panel *panel)
> +static int sharp_nt_panel_get_modes(struct drm_panel *panel,
> +				    struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  
> @@ -224,10 +225,10 @@ static int sharp_nt_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 54;
> -	panel->connector->display_info.height_mm = 95;
> +	connector->display_info.width_mm = 54;
> +	connector->display_info.height_mm = 95;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index a5df6d6dd455..d6299fe6d276 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -117,9 +117,9 @@ static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
>  	return container_of(panel, struct panel_simple, base);
>  }
>  
> -static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel)
> +static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel,
> +						   struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->base.connector;
>  	struct drm_device *drm = panel->base.drm;
>  	struct drm_display_mode *mode;
>  	unsigned int i, num = 0;
> @@ -150,9 +150,9 @@ static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel)
>  	return num;
>  }
>  
> -static unsigned int panel_simple_get_display_modes(struct panel_simple *panel)
> +static unsigned int panel_simple_get_display_modes(struct panel_simple *panel,
> +						   struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->base.connector;
>  	struct drm_device *drm = panel->base.drm;
>  	struct drm_display_mode *mode;
>  	unsigned int i, num = 0;
> @@ -181,9 +181,9 @@ static unsigned int panel_simple_get_display_modes(struct panel_simple *panel)
>  	return num;
>  }
>  
> -static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
> +static int panel_simple_get_non_edid_modes(struct panel_simple *panel,
> +					   struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->base.connector;
>  	struct drm_device *drm = panel->base.drm;
>  	struct drm_display_mode *mode;
>  	bool has_override = panel->override_mode.type;
> @@ -204,7 +204,7 @@ static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
>  
>  	/* Only add timings if override was not there or failed to validate */
>  	if (num == 0 && panel->desc->num_timings)
> -		num = panel_simple_get_timings_modes(panel);
> +		num = panel_simple_get_timings_modes(panel, connector);
>  
>  	/*
>  	 * Only add fixed modes if timings/override added no mode.
> @@ -214,7 +214,7 @@ static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
>  	 */
>  	WARN_ON(panel->desc->num_timings && panel->desc->num_modes);
>  	if (num == 0)
> -		num = panel_simple_get_display_modes(panel);
> +		num = panel_simple_get_display_modes(panel, connector);
>  
>  	connector->display_info.bpc = panel->desc->bpc;
>  	connector->display_info.width_mm = panel->desc->size.width;
> @@ -304,23 +304,24 @@ static int panel_simple_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int panel_simple_get_modes(struct drm_panel *panel)
> +static int panel_simple_get_modes(struct drm_panel *panel,
> +				  struct drm_connector *connector)
>  {
>  	struct panel_simple *p = to_panel_simple(panel);
>  	int num = 0;
>  
>  	/* probe EDID if a DDC bus is available */
>  	if (p->ddc) {
> -		struct edid *edid = drm_get_edid(panel->connector, p->ddc);
> -		drm_connector_update_edid_property(panel->connector, edid);
> +		struct edid *edid = drm_get_edid(connector, p->ddc);
> +		drm_connector_update_edid_property(connector, edid);
>  		if (edid) {
> -			num += drm_add_edid_modes(panel->connector, edid);
> +			num += drm_add_edid_modes(connector, edid);
>  			kfree(edid);
>  		}
>  	}
>  
>  	/* add hard-coded panel modes */
> -	num += panel_simple_get_non_edid_modes(p);
> +	num += panel_simple_get_non_edid_modes(p, connector);
>  
>  	return num;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> index ee3f23f45755..3ed3b1d6d82d 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> @@ -264,7 +264,8 @@ static int st7701_unprepare(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int st7701_get_modes(struct drm_panel *panel)
> +static int st7701_get_modes(struct drm_panel *panel,
> +			    struct drm_connector *connector)
>  {
>  	struct st7701 *st7701 = panel_to_st7701(panel);
>  	const struct drm_display_mode *desc_mode = st7701->desc->mode;
> @@ -280,10 +281,10 @@ static int st7701_get_modes(struct drm_panel *panel)
>  	}
>  
>  	drm_mode_set_name(mode);
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = desc_mode->width_mm;
> -	panel->connector->display_info.height_mm = desc_mode->height_mm;
> +	connector->display_info.width_mm = desc_mode->width_mm;
> +	connector->display_info.height_mm = desc_mode->height_mm;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> index 108a85bb6667..836b01331505 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> @@ -170,9 +170,9 @@ static const struct drm_display_mode default_mode = {
>  	.vrefresh = 60,
>  };
>  
> -static int st7789v_get_modes(struct drm_panel *panel)
> +static int st7789v_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> @@ -188,8 +188,8 @@ static int st7789v_get_modes(struct drm_panel *panel)
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>  	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 61;
> -	panel->connector->display_info.height_mm = 103;
> +	connector->display_info.width_mm = 61;
> +	connector->display_info.height_mm = 103;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> index d6387d8f88a3..841dc73c443d 100644
> --- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> +++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> @@ -521,9 +521,9 @@ static const struct drm_display_mode acx565akm_mode = {
>  	.height_mm = 46,
>  };
>  
> -static int acx565akm_get_modes(struct drm_panel *panel)
> +static int acx565akm_get_modes(struct drm_panel *panel,
> +			       struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &acx565akm_mode);
> diff --git a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> index c44d6a65c0aa..5230176bd8e6 100644
> --- a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> +++ b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> @@ -287,9 +287,9 @@ static const struct drm_display_mode td028ttec1_mode = {
>  	.height_mm = 58,
>  };
>  
> -static int td028ttec1_get_modes(struct drm_panel *panel)
> +static int td028ttec1_get_modes(struct drm_panel *panel,
> +				struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &td028ttec1_mode);
> diff --git a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> index 621b65feec07..716f8ed1cc45 100644
> --- a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> +++ b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> @@ -346,9 +346,9 @@ static const struct drm_display_mode td043mtea1_mode = {
>  	.height_mm = 56,
>  };
>  
> -static int td043mtea1_get_modes(struct drm_panel *panel)
> +static int td043mtea1_get_modes(struct drm_panel *panel,
> +				struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &td043mtea1_mode);
> diff --git a/drivers/gpu/drm/panel/panel-tpo-tpg110.c b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> index 1a5418ae2ccf..e74cd9d418cf 100644
> --- a/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> +++ b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> @@ -384,9 +384,9 @@ static int tpg110_enable(struct drm_panel *panel)
>   * presents the mode that is configured for the system under use,
>   * and which is detected by reading the registers of the display.
>   */
> -static int tpg110_get_modes(struct drm_panel *panel)
> +static int tpg110_get_modes(struct drm_panel *panel,
> +			    struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct tpg110 *tpg = to_tpg110(panel);
>  	struct drm_display_mode *mode;
>  
> diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c b/drivers/gpu/drm/panel/panel-truly-nt35597.c
> index 0feea2456e14..012ca62bf30e 100644
> --- a/drivers/gpu/drm/panel/panel-truly-nt35597.c
> +++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c
> @@ -454,9 +454,9 @@ static int truly_nt35597_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int truly_nt35597_get_modes(struct drm_panel *panel)
> +static int truly_nt35597_get_modes(struct drm_panel *panel,
> +				   struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct truly_nt35597 *ctx = panel_to_ctx(panel);
>  	struct drm_display_mode *mode;
>  	const struct nt35597_config *config;
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index d30c98567384..a5f7199807f2 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -100,7 +100,8 @@ struct drm_panel_funcs {
>  	 * Add modes to the connector that the panel is attached to and
>  	 * return the number of modes added.

You should update the documentation:

	 * Add panel modes to the given connector and return the number of modes
	 * added.

With these small issues addressed,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> -	int (*get_modes)(struct drm_panel *panel);
> +	int (*get_modes)(struct drm_panel *panel,
> +			 struct drm_connector *connector);
>  
>  	/**
>  	 * @get_timings:

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 07/26] drm/panel: remove get_timings
  2019-12-02 19:32 ` [PATCH v1 07/26] drm/panel: remove get_timings Sam Ravnborg
@ 2019-12-03  7:02   ` Laurent Pinchart
  2019-12-03  7:46   ` Maxime Ripard
  1 sibling, 0 replies; 54+ messages in thread
From: Laurent Pinchart @ 2019-12-03  7:02 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Benjamin Gaignard, Stefan Agner,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen,
	NXP Linux Team, Jagan Teki, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Hi Sam,

Thank you for the patch.

On Mon, Dec 02, 2019 at 08:32:11PM +0100, Sam Ravnborg wrote:
> There was no users - so remove it.
> The callback was implemented in two drivers - deleted.

This looks good to me, so

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

but I'll let Thierry decide if he prefers keeping it.

> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>  drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 18 ------------------
>  drivers/gpu/drm/panel/panel-simple.c        | 18 ------------------
>  include/drm/drm_panel.h                     |  9 ---------
>  3 files changed, 45 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> index b878930b17e4..3bcba64235c4 100644
> --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> @@ -217,30 +217,12 @@ static int seiko_panel_get_modes(struct drm_panel *panel,
>  	return seiko_panel_get_fixed_modes(p, connector);
>  }
>  
> -static int seiko_panel_get_timings(struct drm_panel *panel,
> -				    unsigned int num_timings,
> -				    struct display_timing *timings)
> -{
> -	struct seiko_panel *p = to_seiko_panel(panel);
> -	unsigned int i;
> -
> -	if (p->desc->num_timings < num_timings)
> -		num_timings = p->desc->num_timings;
> -
> -	if (timings)
> -		for (i = 0; i < num_timings; i++)
> -			timings[i] = p->desc->timings[i];
> -
> -	return p->desc->num_timings;
> -}
> -
>  static const struct drm_panel_funcs seiko_panel_funcs = {
>  	.disable = seiko_panel_disable,
>  	.unprepare = seiko_panel_unprepare,
>  	.prepare = seiko_panel_prepare,
>  	.enable = seiko_panel_enable,
>  	.get_modes = seiko_panel_get_modes,
> -	.get_timings = seiko_panel_get_timings,
>  };
>  
>  static int seiko_panel_probe(struct device *dev,
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index d6299fe6d276..e225791a6fb2 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -326,30 +326,12 @@ static int panel_simple_get_modes(struct drm_panel *panel,
>  	return num;
>  }
>  
> -static int panel_simple_get_timings(struct drm_panel *panel,
> -				    unsigned int num_timings,
> -				    struct display_timing *timings)
> -{
> -	struct panel_simple *p = to_panel_simple(panel);
> -	unsigned int i;
> -
> -	if (p->desc->num_timings < num_timings)
> -		num_timings = p->desc->num_timings;
> -
> -	if (timings)
> -		for (i = 0; i < num_timings; i++)
> -			timings[i] = p->desc->timings[i];
> -
> -	return p->desc->num_timings;
> -}
> -
>  static const struct drm_panel_funcs panel_simple_funcs = {
>  	.disable = panel_simple_disable,
>  	.unprepare = panel_simple_unprepare,
>  	.prepare = panel_simple_prepare,
>  	.enable = panel_simple_enable,
>  	.get_modes = panel_simple_get_modes,
> -	.get_timings = panel_simple_get_timings,
>  };
>  
>  #define PANEL_SIMPLE_BOUNDS_CHECK(to_check, bounds, field) \
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index 4fd61cb9eb93..c4e82b9ce586 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -102,15 +102,6 @@ struct drm_panel_funcs {
>  	 */
>  	int (*get_modes)(struct drm_panel *panel,
>  			 struct drm_connector *connector);
> -
> -	/**
> -	 * @get_timings:
> -	 *
> -	 * Copy display timings into the provided array and return
> -	 * the number of display timings available.
> -	 */
> -	int (*get_timings)(struct drm_panel *panel, unsigned int num_timings,
> -			   struct display_timing *timings);
>  };
>  
>  /**

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 08/26] drm/panel: drop drm_device from drm_panel
  2019-12-02 19:32 ` [PATCH v1 08/26] drm/panel: drop drm_device from drm_panel Sam Ravnborg
@ 2019-12-03  7:15   ` Laurent Pinchart
  2019-12-03 13:27   ` Linus Walleij
  1 sibling, 0 replies; 54+ messages in thread
From: Laurent Pinchart @ 2019-12-03  7:15 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Benjamin Gaignard, Stefan Agner,
	linux-samsung-soc, Stefan Mavrodiev, linux-rockchip,
	Tomi Valkeinen, NXP Linux Team, Robert Chiras,
	Guido Günther, Jagan Teki, Jitao Shi,
	Pengutronix Kernel Team, Maarten Lankhorst, Maxime Ripard,
	linux-mediatek, Abhinav Kumar, linux-tegra, Sean Paul,
	linux-arm-kernel, Purism Kernel Team, linux-renesas-soc,
	Boris Brezillon, Daniel Vetter

Hi Sam,

Thank you for the patch.

On Mon, Dec 02, 2019 at 08:32:12PM +0100, Sam Ravnborg wrote:
> The panel drivers used drm_panel.drm for two purposes:
> 1) Argument to drm_mode_duplicate()
> 2) drm->dev was used in error messages
> 
> The first usage is replaced with drm_connector.dev
> - drm_connector is already connected to a drm_device
>   and we have a valid connector
> 
> The second usage is replaced with drm_panel.dev
> - this makes drivers more consistent in their dev argument
>   used for dev_err() and friends
> 
> With these replacements there are no more uses of drm_panel.drm,
> so it is removed from struct drm_panel.
> With this change drm_panel_attach() and drm_panel_detach()
> no logner has any use as they are empty functions.

s/logner has/longer have/

> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Stefan Mavrodiev <stefan@olimex.com>
> Cc: Robert Chiras <robert.chiras@nxp.com>
> Cc: "Guido Günther" <agx@sigxcpu.org>
> Cc: Purism Kernel Team <kernel@puri.sm>
> ---
>  drivers/gpu/drm/drm_panel.c                       |  6 ------
>  drivers/gpu/drm/panel/panel-arm-versatile.c       |  2 +-
>  .../gpu/drm/panel/panel-feiyang-fy07024di26a30d.c |  2 +-
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c      | 15 ++++++++-------
>  drivers/gpu/drm/panel/panel-ilitek-ili9881c.c     |  2 +-
>  drivers/gpu/drm/panel/panel-innolux-p079zca.c     |  6 +++---
>  drivers/gpu/drm/panel/panel-jdi-lt070me05000.c    |  2 +-
>  .../gpu/drm/panel/panel-kingdisplay-kd097d04.c    |  6 +++---
>  drivers/gpu/drm/panel/panel-lg-lb035q02.c         |  2 +-
>  drivers/gpu/drm/panel/panel-lg-lg4573.c           |  4 ++--
>  drivers/gpu/drm/panel/panel-lvds.c                |  2 +-
>  drivers/gpu/drm/panel/panel-nec-nl8048hl11.c      |  2 +-
>  drivers/gpu/drm/panel/panel-novatek-nt39016.c     |  2 +-
>  .../gpu/drm/panel/panel-olimex-lcd-olinuxino.c    |  5 ++---
>  drivers/gpu/drm/panel/panel-orisetech-otm8009a.c  |  2 +-
>  .../gpu/drm/panel/panel-osd-osd101t2587-53ts.c    |  4 ++--
>  .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c  |  4 ++--
>  .../gpu/drm/panel/panel-raspberrypi-touchscreen.c |  5 ++---
>  drivers/gpu/drm/panel/panel-raydium-rm67191.c     |  2 +-
>  drivers/gpu/drm/panel/panel-raydium-rm68200.c     |  2 +-
>  .../gpu/drm/panel/panel-rocktech-jh057n00900.c    |  2 +-
>  drivers/gpu/drm/panel/panel-ronbo-rb070d30.c      |  2 +-
>  drivers/gpu/drm/panel/panel-samsung-s6d16d0.c     |  2 +-
>  drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c     |  2 +-
>  drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c  |  2 +-
>  drivers/gpu/drm/panel/panel-samsung-s6e63m0.c     |  2 +-
>  drivers/gpu/drm/panel/panel-seiko-43wvf1g.c       |  9 ++++-----
>  drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c   |  4 ++--
>  drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c   |  2 +-
>  drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c   |  4 ++--
>  drivers/gpu/drm/panel/panel-simple.c              | 15 ++++++---------
>  drivers/gpu/drm/panel/panel-sitronix-st7701.c     |  2 +-
>  drivers/gpu/drm/panel/panel-sitronix-st7789v.c    |  4 ++--
>  drivers/gpu/drm/panel/panel-sony-acx565akm.c      |  2 +-
>  drivers/gpu/drm/panel/panel-tpo-td028ttec1.c      |  2 +-
>  drivers/gpu/drm/panel/panel-tpo-td043mtea1.c      |  2 +-
>  drivers/gpu/drm/panel/panel-tpo-tpg110.c          |  2 +-
>  include/drm/drm_panel.h                           |  7 -------
>  38 files changed, 63 insertions(+), 81 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index fd428b6d25b0..eab79366bf1a 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -113,11 +113,6 @@ EXPORT_SYMBOL(drm_panel_remove);
>   */
>  int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)

Should the connector argument be removed ?

>  {
> -	if (panel->drm)
> -		return -EBUSY;
> -
> -	panel->drm = connector->dev;
> -
>  	return 0;
>  }
>  EXPORT_SYMBOL(drm_panel_attach);
> @@ -134,7 +129,6 @@ EXPORT_SYMBOL(drm_panel_attach);
>   */
>  void drm_panel_detach(struct drm_panel *panel)
>  {
> -	panel->drm = NULL;
>  }
>  EXPORT_SYMBOL(drm_panel_detach);

If those functions are empty, should they be removed ? This and removal
of the connector parameter could be done in a separate patch.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> diff --git a/drivers/gpu/drm/panel/panel-arm-versatile.c b/drivers/gpu/drm/panel/panel-arm-versatile.c
> index 41aa91f60979..41444a73c980 100644
> --- a/drivers/gpu/drm/panel/panel-arm-versatile.c
> +++ b/drivers/gpu/drm/panel/panel-arm-versatile.c
> @@ -270,7 +270,7 @@ static int versatile_panel_get_modes(struct drm_panel *panel,
>  	connector->display_info.height_mm = vpanel->panel_type->height_mm;
>  	connector->display_info.bus_flags = vpanel->panel_type->bus_flags;
>  
> -	mode = drm_mode_duplicate(panel->drm, &vpanel->panel_type->mode);
> +	mode = drm_mode_duplicate(connector->dev, &vpanel->panel_type->mode);
>  	drm_mode_set_name(mode);
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>  
> diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> index 37d6b7390954..0157d1844e3e 100644
> --- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> +++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> @@ -168,7 +168,7 @@ static int feiyang_get_modes(struct drm_panel *panel,
>  	struct feiyang *ctx = panel_to_feiyang(panel);
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &feiyang_default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &feiyang_default_mode);
>  	if (!mode) {
>  		DRM_DEV_ERROR(&ctx->dsi->dev, "failed to add mode %ux%ux@%u\n",
>  			      feiyang_default_mode.hdisplay,
> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> index 8fd4c0521841..5717135c9278 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> @@ -645,6 +645,7 @@ static int ili9322_get_modes(struct drm_panel *panel,
>  			     struct drm_connector *connector)
>  {
>  	struct ili9322 *ili = panel_to_ili9322(panel);
> +	struct drm_device *drm = connector->dev;
>  	struct drm_display_mode *mode;
>  	struct drm_display_info *info;
>  
> @@ -662,26 +663,26 @@ static int ili9322_get_modes(struct drm_panel *panel,
>  
>  	switch (ili->input) {
>  	case ILI9322_INPUT_SRGB_DUMMY_320X240:
> -		mode = drm_mode_duplicate(panel->drm, &srgb_320x240_mode);
> +		mode = drm_mode_duplicate(drm, &srgb_320x240_mode);
>  		break;
>  	case ILI9322_INPUT_SRGB_DUMMY_360X240:
> -		mode = drm_mode_duplicate(panel->drm, &srgb_360x240_mode);
> +		mode = drm_mode_duplicate(drm, &srgb_360x240_mode);
>  		break;
>  	case ILI9322_INPUT_PRGB_THROUGH:
>  	case ILI9322_INPUT_PRGB_ALIGNED:
> -		mode = drm_mode_duplicate(panel->drm, &prgb_320x240_mode);
> +		mode = drm_mode_duplicate(drm, &prgb_320x240_mode);
>  		break;
>  	case ILI9322_INPUT_YUV_640X320_YCBCR:
> -		mode = drm_mode_duplicate(panel->drm, &yuv_640x320_mode);
> +		mode = drm_mode_duplicate(drm, &yuv_640x320_mode);
>  		break;
>  	case ILI9322_INPUT_YUV_720X360_YCBCR:
> -		mode = drm_mode_duplicate(panel->drm, &yuv_720x360_mode);
> +		mode = drm_mode_duplicate(drm, &yuv_720x360_mode);
>  		break;
>  	case ILI9322_INPUT_ITU_R_BT656_720X360_YCBCR:
> -		mode = drm_mode_duplicate(panel->drm, &itu_r_bt_656_720_mode);
> +		mode = drm_mode_duplicate(drm, &itu_r_bt_656_720_mode);
>  		break;
>  	case ILI9322_INPUT_ITU_R_BT656_640X320_YCBCR:
> -		mode = drm_mode_duplicate(panel->drm, &itu_r_bt_656_640_mode);
> +		mode = drm_mode_duplicate(drm, &itu_r_bt_656_640_mode);
>  		break;
>  	default:
>  		mode = NULL;
> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> index 1c67a668d6bf..31e5a4e67750 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> @@ -393,7 +393,7 @@ static int ili9881c_get_modes(struct drm_panel *panel,
>  	struct ili9881c *ctx = panel_to_ili9881c(panel);
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &bananapi_default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &bananapi_default_mode);
>  	if (!mode) {
>  		dev_err(&ctx->dsi->dev, "failed to add mode %ux%ux@%u\n",
>  			bananapi_default_mode.hdisplay,
> diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> index facf1bab2532..b9de37a8a0c5 100644
> --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> @@ -211,7 +211,7 @@ static int innolux_panel_enable(struct drm_panel *panel)
>  
>  	ret = backlight_enable(innolux->backlight);
>  	if (ret) {
> -		DRM_DEV_ERROR(panel->drm->dev,
> +		DRM_DEV_ERROR(panel->dev,
>  			      "Failed to enable backlight %d\n", ret);
>  		return ret;
>  	}
> @@ -410,9 +410,9 @@ static int innolux_panel_get_modes(struct drm_panel *panel,
>  	const struct drm_display_mode *m = innolux->desc->mode;
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, m);
> +	mode = drm_mode_duplicate(connector->dev, m);
>  	if (!mode) {
> -		DRM_DEV_ERROR(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
> +		DRM_DEV_ERROR(panel->dev, "failed to add mode %ux%ux@%u\n",
>  			      m->hdisplay, m->vdisplay, m->vrefresh);
>  		return -ENOMEM;
>  	}
> diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> index e6b650a64fdb..4bfd8c877c8e 100644
> --- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> +++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> @@ -307,7 +307,7 @@ static int jdi_panel_get_modes(struct drm_panel *panel,
>  	struct jdi_panel *jdi = to_jdi_panel(panel);
>  	struct device *dev = &jdi->dsi->dev;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
>  		dev_err(dev, "failed to add mode %ux%ux@%u\n",
>  			default_mode.hdisplay, default_mode.vdisplay,
> diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> index e6f53d56daf9..353ee6caa01c 100644
> --- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> +++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> @@ -310,7 +310,7 @@ static int kingdisplay_panel_enable(struct drm_panel *panel)
>  
>  	ret = backlight_enable(kingdisplay->backlight);
>  	if (ret) {
> -		DRM_DEV_ERROR(panel->drm->dev,
> +		DRM_DEV_ERROR(panel->dev,
>  			      "Failed to enable backlight %d\n", ret);
>  		return ret;
>  	}
> @@ -338,9 +338,9 @@ static int kingdisplay_panel_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
> -		DRM_DEV_ERROR(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
> +		DRM_DEV_ERROR(panel->dev, "failed to add mode %ux%ux@%u\n",
>  			      default_mode.hdisplay, default_mode.vdisplay,
>  			      default_mode.vrefresh);
>  		return -ENOMEM;
> diff --git a/drivers/gpu/drm/panel/panel-lg-lb035q02.c b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> index 7a3bd4d80c79..e90efeaba4ad 100644
> --- a/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> +++ b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> @@ -146,7 +146,7 @@ static int lb035q02_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &lb035q02_mode);
> +	mode = drm_mode_duplicate(connector->dev, &lb035q02_mode);
>  	if (!mode)
>  		return -ENOMEM;
>  
> diff --git a/drivers/gpu/drm/panel/panel-lg-lg4573.c b/drivers/gpu/drm/panel/panel-lg-lg4573.c
> index fc6572b4e2f9..20235ff0bbc4 100644
> --- a/drivers/gpu/drm/panel/panel-lg-lg4573.c
> +++ b/drivers/gpu/drm/panel/panel-lg-lg4573.c
> @@ -214,9 +214,9 @@ static int lg4573_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
> -		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
> +		dev_err(panel->dev, "failed to add mode %ux%ux@%u\n",
>  			default_mode.hdisplay, default_mode.vdisplay,
>  			default_mode.vrefresh);
>  		return -ENOMEM;
> diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
> index f6d58a60e514..5e40b674bb15 100644
> --- a/drivers/gpu/drm/panel/panel-lvds.c
> +++ b/drivers/gpu/drm/panel/panel-lvds.c
> @@ -112,7 +112,7 @@ static int panel_lvds_get_modes(struct drm_panel *panel,
>  	struct panel_lvds *lvds = to_panel_lvds(panel);
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_create(lvds->panel.drm);
> +	mode = drm_mode_create(connector->dev);
>  	if (!mode)
>  		return 0;
>  
> diff --git a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> index a6ccdb09aace..c4f83f6384e1 100644
> --- a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> +++ b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> @@ -128,7 +128,7 @@ static int nl8048_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &nl8048_mode);
> +	mode = drm_mode_duplicate(connector->dev, &nl8048_mode);
>  	if (!mode)
>  		return -ENOMEM;
>  
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt39016.c b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> index 91ea49c05611..a470810f7dbe 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> @@ -213,7 +213,7 @@ static int nt39016_get_modes(struct drm_panel *drm_panel,
>  	const struct nt39016_panel_info *panel_info = panel->panel_info;
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(drm_panel->drm, &panel_info->display_mode);
> +	mode = drm_mode_duplicate(connector->dev, &panel_info->display_mode);
>  	if (!mode)
>  		return -ENOMEM;
>  
> diff --git a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> index 2b7e0dfebc5e..e553e584399b 100644
> --- a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> +++ b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> @@ -146,7 +146,6 @@ static int lcd_olinuxino_get_modes(struct drm_panel *panel,
>  {
>  	struct lcd_olinuxino *lcd = to_lcd_olinuxino(panel);
>  	struct lcd_olinuxino_info *lcd_info = &lcd->eeprom.info;
> -	struct drm_device *drm = lcd->panel.drm;
>  	struct lcd_olinuxino_mode *lcd_mode;
>  	struct drm_display_mode *mode;
>  	u32 i, num = 0;
> @@ -155,9 +154,9 @@ static int lcd_olinuxino_get_modes(struct drm_panel *panel,
>  		lcd_mode = (struct lcd_olinuxino_mode *)
>  			   &lcd->eeprom.reserved[i * sizeof(*lcd_mode)];
>  
> -		mode = drm_mode_create(drm);
> +		mode = drm_mode_create(connector->dev);
>  		if (!mode) {
> -			dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
> +			dev_err(panel->dev, "failed to add mode %ux%u@%u\n",
>  				lcd_mode->hactive,
>  				lcd_mode->vactive,
>  				lcd_mode->refresh);
> diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> index 4e1606c79072..bb0c992171e8 100644
> --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> @@ -354,7 +354,7 @@ static int otm8009a_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
>  		DRM_ERROR("failed to add mode %ux%ux@%u\n",
>  			  default_mode.hdisplay, default_mode.vdisplay,
> diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> index b3e010288c10..2734b4835dfa 100644
> --- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> +++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> @@ -118,9 +118,9 @@ static int osd101t2587_panel_get_modes(struct drm_panel *panel,
>  	struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel);
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, osd101t2587->default_mode);
> +	mode = drm_mode_duplicate(connector->dev, osd101t2587->default_mode);
>  	if (!mode) {
> -		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
> +		dev_err(panel->dev, "failed to add mode %ux%ux@%u\n",
>  			osd101t2587->default_mode->hdisplay,
>  			osd101t2587->default_mode->vdisplay,
>  			osd101t2587->default_mode->vrefresh);
> diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> index 19a6eb4637c8..579ac0d86ea4 100644
> --- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> +++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> @@ -171,9 +171,9 @@ static int wuxga_nt_panel_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
> -		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
> +		dev_err(panel->dev, "failed to add mode %ux%ux@%u\n",
>  				default_mode.hdisplay, default_mode.vdisplay,
>  				default_mode.vrefresh);
>  		return -ENOMEM;
> diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> index 732b7111395e..7d8bc12a3008 100644
> --- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> @@ -314,7 +314,6 @@ static int rpi_touchscreen_enable(struct drm_panel *panel)
>  static int rpi_touchscreen_get_modes(struct drm_panel *panel,
>  				     struct drm_connector *connector)
>  {
> -	struct drm_device *drm = panel->drm;
>  	unsigned int i, num = 0;
>  	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
>  
> @@ -322,9 +321,9 @@ static int rpi_touchscreen_get_modes(struct drm_panel *panel,
>  		const struct drm_display_mode *m = &rpi_touchscreen_modes[i];
>  		struct drm_display_mode *mode;
>  
> -		mode = drm_mode_duplicate(drm, m);
> +		mode = drm_mode_duplicate(connector->dev, m);
>  		if (!mode) {
> -			dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
> +			dev_err(panel->dev, "failed to add mode %ux%u@%u\n",
>  				m->hdisplay, m->vdisplay, m->vrefresh);
>  			continue;
>  		}
> diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> index 123bb68cfcb7..313637d53d28 100644
> --- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> +++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> @@ -441,7 +441,7 @@ static int rad_panel_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
>  		DRM_DEV_ERROR(panel->dev, "failed to add mode %ux%ux@%u\n",
>  			      default_mode.hdisplay, default_mode.vdisplay,
> diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
> index 66fa975308ec..d6a03328e594 100644
> --- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c
> +++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
> @@ -340,7 +340,7 @@ static int rm68200_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
>  		DRM_ERROR("failed to add mode %ux%ux@%u\n",
>  			  default_mode.hdisplay, default_mode.vdisplay,
> diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> index b2d61cab3cad..3a4f1c0fce86 100644
> --- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> +++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> @@ -236,7 +236,7 @@ static int jh057n_get_modes(struct drm_panel *panel,
>  	struct jh057n *ctx = panel_to_jh057n(panel);
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
>  		DRM_DEV_ERROR(ctx->dev, "Failed to add mode %ux%u@%u\n",
>  			      default_mode.hdisplay, default_mode.vdisplay,
> diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> index 57a462ce221e..746a3a221100 100644
> --- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> +++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> @@ -127,7 +127,7 @@ static int rb070d30_panel_get_modes(struct drm_panel *panel,
>  	struct drm_display_mode *mode;
>  	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
>  		DRM_DEV_ERROR(&ctx->dsi->dev,
>  			      "Failed to add mode " DRM_MODE_FMT "\n",
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> index 71939ab757b1..2150043dcf6b 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> @@ -148,7 +148,7 @@ static int s6d16d0_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &samsung_s6d16d0_mode);
> +	mode = drm_mode_duplicate(connector->dev, &samsung_s6d16d0_mode);
>  	if (!mode) {
>  		DRM_ERROR("bad mode or failed to add mode\n");
>  		return -EINVAL;
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> index 8e0236ba6145..36ebd5a4ac7b 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> @@ -651,7 +651,7 @@ static int s6e3ha2_get_modes(struct drm_panel *panel,
>  	struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, ctx->desc->mode);
> +	mode = drm_mode_duplicate(connector->dev, ctx->desc->mode);
>  	if (!mode) {
>  		DRM_ERROR("failed to add mode %ux%ux@%u\n",
>  			ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay,
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> index c939d5bde4f0..a3570e0a90a8 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> @@ -405,7 +405,7 @@ static int s6e63j0x03_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
>  		DRM_ERROR("failed to add mode %ux%ux@%u\n",
>  			default_mode.hdisplay, default_mode.vdisplay,
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> index 1d099092e754..a5f76eb4fa25 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> @@ -367,7 +367,7 @@ static int s6e63m0_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
>  		DRM_ERROR("failed to add mode %ux%ux@%u\n",
>  			  default_mode.hdisplay, default_mode.vdisplay,
> diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> index 3bcba64235c4..4b345a242b3f 100644
> --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> @@ -59,7 +59,6 @@ static inline struct seiko_panel *to_seiko_panel(struct drm_panel *panel)
>  static int seiko_panel_get_fixed_modes(struct seiko_panel *panel,
>  				       struct drm_connector *connector)
>  {
> -	struct drm_device *drm = panel->base.drm;
>  	struct drm_display_mode *mode;
>  	unsigned int i, num = 0;
>  
> @@ -71,9 +70,9 @@ static int seiko_panel_get_fixed_modes(struct seiko_panel *panel,
>  		struct videomode vm;
>  
>  		videomode_from_timing(dt, &vm);
> -		mode = drm_mode_create(drm);
> +		mode = drm_mode_create(connector->dev);
>  		if (!mode) {
> -			dev_err(drm->dev, "failed to add mode %ux%u\n",
> +			dev_err(panel->base.dev, "failed to add mode %ux%u\n",
>  				dt->hactive.typ, dt->vactive.typ);
>  			continue;
>  		}
> @@ -92,9 +91,9 @@ static int seiko_panel_get_fixed_modes(struct seiko_panel *panel,
>  	for (i = 0; i < panel->desc->num_modes; i++) {
>  		const struct drm_display_mode *m = &panel->desc->modes[i];
>  
> -		mode = drm_mode_duplicate(drm, m);
> +		mode = drm_mode_duplicate(connector->dev, m);
>  		if (!mode) {
> -			dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
> +			dev_err(panel->base.dev, "failed to add mode %ux%u@%u\n",
>  				m->hdisplay, m->vdisplay, m->vrefresh);
>  			continue;
>  		}
> diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> index e797b700661a..17d406f49c3d 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> @@ -283,9 +283,9 @@ static int sharp_panel_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
> -		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
> +		dev_err(panel->dev, "failed to add mode %ux%ux@%u\n",
>  			default_mode.hdisplay, default_mode.vdisplay,
>  			default_mode.vrefresh);
>  		return -ENOMEM;
> diff --git a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> index 7103a945f0e8..1cf3f02435c1 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> @@ -105,7 +105,7 @@ static int ls037v7dw01_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &ls037v7dw01_mode);
> +	mode = drm_mode_duplicate(connector->dev, &ls037v7dw01_mode);
>  	if (!mode)
>  		return -ENOMEM;
>  
> diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> index 85ae6cffdbfb..7995cf5a9fc4 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> @@ -215,9 +215,9 @@ static int sharp_nt_panel_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
> -		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
> +		dev_err(panel->dev, "failed to add mode %ux%ux@%u\n",
>  				default_mode.hdisplay, default_mode.vdisplay,
>  				default_mode.vrefresh);
>  		return -ENOMEM;
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index e225791a6fb2..73e00288c00c 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -120,7 +120,6 @@ static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
>  static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel,
>  						   struct drm_connector *connector)
>  {
> -	struct drm_device *drm = panel->base.drm;
>  	struct drm_display_mode *mode;
>  	unsigned int i, num = 0;
>  
> @@ -129,9 +128,9 @@ static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel,
>  		struct videomode vm;
>  
>  		videomode_from_timing(dt, &vm);
> -		mode = drm_mode_create(drm);
> +		mode = drm_mode_create(connector->dev);
>  		if (!mode) {
> -			dev_err(drm->dev, "failed to add mode %ux%u\n",
> +			dev_err(panel->base.dev, "failed to add mode %ux%u\n",
>  				dt->hactive.typ, dt->vactive.typ);
>  			continue;
>  		}
> @@ -153,16 +152,15 @@ static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel,
>  static unsigned int panel_simple_get_display_modes(struct panel_simple *panel,
>  						   struct drm_connector *connector)
>  {
> -	struct drm_device *drm = panel->base.drm;
>  	struct drm_display_mode *mode;
>  	unsigned int i, num = 0;
>  
>  	for (i = 0; i < panel->desc->num_modes; i++) {
>  		const struct drm_display_mode *m = &panel->desc->modes[i];
>  
> -		mode = drm_mode_duplicate(drm, m);
> +		mode = drm_mode_duplicate(connector->dev, m);
>  		if (!mode) {
> -			dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
> +			dev_err(panel->base.dev, "failed to add mode %ux%u@%u\n",
>  				m->hdisplay, m->vdisplay, m->vrefresh);
>  			continue;
>  		}
> @@ -184,7 +182,6 @@ static unsigned int panel_simple_get_display_modes(struct panel_simple *panel,
>  static int panel_simple_get_non_edid_modes(struct panel_simple *panel,
>  					   struct drm_connector *connector)
>  {
> -	struct drm_device *drm = panel->base.drm;
>  	struct drm_display_mode *mode;
>  	bool has_override = panel->override_mode.type;
>  	unsigned int num = 0;
> @@ -193,12 +190,12 @@ static int panel_simple_get_non_edid_modes(struct panel_simple *panel,
>  		return 0;
>  
>  	if (has_override) {
> -		mode = drm_mode_duplicate(drm, &panel->override_mode);
> +		mode = drm_mode_duplicate(connector->dev, &panel->override_mode);
>  		if (mode) {
>  			drm_mode_probed_add(connector, mode);
>  			num = 1;
>  		} else {
> -			dev_err(drm->dev, "failed to add override mode\n");
> +			dev_err(panel->base.dev, "failed to add override mode\n");
>  		}
>  	}
>  
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> index 3ed3b1d6d82d..c08a865a2a93 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> @@ -271,7 +271,7 @@ static int st7701_get_modes(struct drm_panel *panel,
>  	const struct drm_display_mode *desc_mode = st7701->desc->mode;
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, desc_mode);
> +	mode = drm_mode_duplicate(connector->dev, desc_mode);
>  	if (!mode) {
>  		DRM_DEV_ERROR(&st7701->dsi->dev,
>  			      "failed to add mode %ux%ux@%u\n",
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> index 836b01331505..ebefe2f4c26b 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> @@ -175,9 +175,9 @@ static int st7789v_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &default_mode);
> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>  	if (!mode) {
> -		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
> +		dev_err(panel->dev, "failed to add mode %ux%ux@%u\n",
>  			default_mode.hdisplay, default_mode.vdisplay,
>  			default_mode.vrefresh);
>  		return -ENOMEM;
> diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> index 841dc73c443d..5c4b6f6e5c2d 100644
> --- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> +++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> @@ -526,7 +526,7 @@ static int acx565akm_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &acx565akm_mode);
> +	mode = drm_mode_duplicate(connector->dev, &acx565akm_mode);
>  	if (!mode)
>  		return -ENOMEM;
>  
> diff --git a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> index 5230176bd8e6..37252590b541 100644
> --- a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> +++ b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> @@ -292,7 +292,7 @@ static int td028ttec1_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &td028ttec1_mode);
> +	mode = drm_mode_duplicate(connector->dev, &td028ttec1_mode);
>  	if (!mode)
>  		return -ENOMEM;
>  
> diff --git a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> index 716f8ed1cc45..75f1f1f1b6de 100644
> --- a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> +++ b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> @@ -351,7 +351,7 @@ static int td043mtea1_get_modes(struct drm_panel *panel,
>  {
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(panel->drm, &td043mtea1_mode);
> +	mode = drm_mode_duplicate(connector->dev, &td043mtea1_mode);
>  	if (!mode)
>  		return -ENOMEM;
>  
> diff --git a/drivers/gpu/drm/panel/panel-tpo-tpg110.c b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> index e74cd9d418cf..bee213ea1a42 100644
> --- a/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> +++ b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> @@ -394,7 +394,7 @@ static int tpg110_get_modes(struct drm_panel *panel,
>  	connector->display_info.height_mm = tpg->height;
>  	connector->display_info.bus_flags = tpg->panel_mode->bus_flags;
>  
> -	mode = drm_mode_duplicate(panel->drm, &tpg->panel_mode->mode);
> +	mode = drm_mode_duplicate(connector->dev, &tpg->panel_mode->mode);
>  	drm_mode_set_name(mode);
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>  
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index c4e82b9ce586..95e941c31c3b 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -108,13 +108,6 @@ struct drm_panel_funcs {
>   * struct drm_panel - DRM panel object
>   */
>  struct drm_panel {
> -	/**
> -	 * @drm:
> -	 *
> -	 * DRM device owning the panel.
> -	 */
> -	struct drm_device *drm;
> -
>  	/**
>  	 * @dev:
>  	 *

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 13/26] drm/panel: lvds: use drm_panel backlight support
  2019-12-02 19:32 ` [PATCH v1 13/26] drm/panel: lvds: " Sam Ravnborg
@ 2019-12-03  7:16   ` Laurent Pinchart
  0 siblings, 0 replies; 54+ messages in thread
From: Laurent Pinchart @ 2019-12-03  7:16 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Benjamin Gaignard, Stefan Agner,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen,
	NXP Linux Team, Jagan Teki, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Hi Sam,

Thank you for the patch.

On Mon, Dec 02, 2019 at 08:32:17PM +0100, Sam Ravnborg wrote:
> Use the backlight support in drm_panel to simplify the driver
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/panel/panel-lvds.c | 40 ++++--------------------------
>  1 file changed, 5 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
> index 5e40b674bb15..5ce3f4a2b7a1 100644
> --- a/drivers/gpu/drm/panel/panel-lvds.c
> +++ b/drivers/gpu/drm/panel/panel-lvds.c
> @@ -8,7 +8,6 @@
>   * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
>   */
>  
> -#include <linux/backlight.h>
>  #include <linux/gpio/consumer.h>
>  #include <linux/module.h>
>  #include <linux/of_platform.h>
> @@ -34,7 +33,6 @@ struct panel_lvds {
>  	unsigned int bus_format;
>  	bool data_mirror;
>  
> -	struct backlight_device *backlight;
>  	struct regulator *supply;
>  
>  	struct gpio_desc *enable_gpio;
> @@ -46,19 +44,6 @@ static inline struct panel_lvds *to_panel_lvds(struct drm_panel *panel)
>  	return container_of(panel, struct panel_lvds, panel);
>  }
>  
> -static int panel_lvds_disable(struct drm_panel *panel)
> -{
> -	struct panel_lvds *lvds = to_panel_lvds(panel);
> -
> -	if (lvds->backlight) {
> -		lvds->backlight->props.power = FB_BLANK_POWERDOWN;
> -		lvds->backlight->props.state |= BL_CORE_FBBLANK;
> -		backlight_update_status(lvds->backlight);
> -	}
> -
> -	return 0;
> -}
> -
>  static int panel_lvds_unprepare(struct drm_panel *panel)
>  {
>  	struct panel_lvds *lvds = to_panel_lvds(panel);
> @@ -93,19 +78,6 @@ static int panel_lvds_prepare(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int panel_lvds_enable(struct drm_panel *panel)
> -{
> -	struct panel_lvds *lvds = to_panel_lvds(panel);
> -
> -	if (lvds->backlight) {
> -		lvds->backlight->props.state &= ~BL_CORE_FBBLANK;
> -		lvds->backlight->props.power = FB_BLANK_UNBLANK;
> -		backlight_update_status(lvds->backlight);
> -	}
> -
> -	return 0;
> -}
> -
>  static int panel_lvds_get_modes(struct drm_panel *panel,
>  				struct drm_connector *connector)
>  {
> @@ -132,10 +104,8 @@ static int panel_lvds_get_modes(struct drm_panel *panel,
>  }
>  
>  static const struct drm_panel_funcs panel_lvds_funcs = {
> -	.disable = panel_lvds_disable,
>  	.unprepare = panel_lvds_unprepare,
>  	.prepare = panel_lvds_prepare,
> -	.enable = panel_lvds_enable,
>  	.get_modes = panel_lvds_get_modes,
>  };
>  
> @@ -242,10 +212,6 @@ static int panel_lvds_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> -	lvds->backlight = devm_of_find_backlight(lvds->dev);
> -	if (IS_ERR(lvds->backlight))
> -		return PTR_ERR(lvds->backlight);
> -
>  	/*
>  	 * TODO: Handle all power supplies specified in the DT node in a generic
>  	 * way for panels that don't care about power supply ordering. LVDS
> @@ -257,6 +223,10 @@ static int panel_lvds_probe(struct platform_device *pdev)
>  	drm_panel_init(&lvds->panel, lvds->dev, &panel_lvds_funcs,
>  		       DRM_MODE_CONNECTOR_LVDS);
>  
> +	ret = drm_panel_of_backlight(&lvds->panel);
> +	if (ret)
> +		return ret;
> +
>  	ret = drm_panel_add(&lvds->panel);
>  	if (ret < 0)
>  		return ret;
> @@ -271,7 +241,7 @@ static int panel_lvds_remove(struct platform_device *pdev)
>  
>  	drm_panel_remove(&lvds->panel);
>  
> -	panel_lvds_disable(&lvds->panel);
> +	drm_panel_disable(&lvds->panel);
>  
>  	return 0;
>  }

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 25/26] drm/panel: tpo-td028ttec1: use drm_panel backlight support
  2019-12-02 19:32 ` [PATCH v1 25/26] drm/panel: tpo-td028ttec1: " Sam Ravnborg
@ 2019-12-03  7:16   ` Laurent Pinchart
  0 siblings, 0 replies; 54+ messages in thread
From: Laurent Pinchart @ 2019-12-03  7:16 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Benjamin Gaignard, Stefan Agner,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen,
	NXP Linux Team, Jagan Teki, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Hi Sam,

Thank you for the patch.

On Mon, Dec 02, 2019 at 08:32:29PM +0100, Sam Ravnborg wrote:
> Use the backlight support in drm_panel to simplify the driver
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/panel/panel-tpo-td028ttec1.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> index 37252590b541..cf29405a2dbe 100644
> --- a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> +++ b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> @@ -17,7 +17,6 @@
>   * H. Nikolaus Schaller <hns@goldelico.com>
>   */
>  
> -#include <linux/backlight.h>
>  #include <linux/delay.h>
>  #include <linux/module.h>
>  #include <linux/spi/spi.h>
> @@ -83,7 +82,6 @@ struct td028ttec1_panel {
>  	struct drm_panel panel;
>  
>  	struct spi_device *spi;
> -	struct backlight_device *backlight;
>  };
>  
>  #define to_td028ttec1_device(p) container_of(p, struct td028ttec1_panel, panel)
> @@ -243,8 +241,6 @@ static int td028ttec1_enable(struct drm_panel *panel)
>  	if (ret)
>  		return ret;
>  
> -	backlight_enable(lcd->backlight);
> -
>  	return 0;
>  }
>  
> @@ -252,8 +248,6 @@ static int td028ttec1_disable(struct drm_panel *panel)
>  {
>  	struct td028ttec1_panel *lcd = to_td028ttec1_device(panel);
>  
> -	backlight_disable(lcd->backlight);
> -
>  	jbt_ret_write_0(lcd, JBT_REG_DISPLAY_OFF, NULL);
>  
>  	return 0;
> @@ -334,10 +328,6 @@ static int td028ttec1_probe(struct spi_device *spi)
>  	spi_set_drvdata(spi, lcd);
>  	lcd->spi = spi;
>  
> -	lcd->backlight = devm_of_find_backlight(&spi->dev);
> -	if (IS_ERR(lcd->backlight))
> -		return PTR_ERR(lcd->backlight);
> -
>  	spi->mode = SPI_MODE_3;
>  	spi->bits_per_word = 9;
>  
> @@ -350,6 +340,10 @@ static int td028ttec1_probe(struct spi_device *spi)
>  	drm_panel_init(&lcd->panel, &lcd->spi->dev, &td028ttec1_funcs,
>  		       DRM_MODE_CONNECTOR_DPI);
>  
> +	ret = drm_panel_of_backlight(&lcd->panel);
> +	if (ret)
> +		return ret;
> +
>  	return drm_panel_add(&lcd->panel);
>  }
>  

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 0/26] drm/panel infrastructure + backlight update
  2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
                   ` (25 preceding siblings ...)
  2019-12-02 19:59 ` [PATCH v1 0/26] drm/panel infrastructure + backlight update Jeffrey Hugo
@ 2019-12-03  7:24 ` Laurent Pinchart
  2019-12-03  8:33   ` Sam Ravnborg
  26 siblings, 1 reply; 54+ messages in thread
From: Laurent Pinchart @ 2019-12-03  7:24 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Benjamin Gaignard, Stefan Agner,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen,
	NXP Linux Team, Jagan Teki, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Hi Sam,

On Mon, Dec 02, 2019 at 08:32:04PM +0100, Sam Ravnborg wrote:
> This patchset include a couple of different
> things - all related to panels.
> 
> - The panel callbacks are optional - so drop error if
>   callback is not present.
>  
> - Add support for backlight in drm_panel.
>   This allows us to make much simpler backlight
>   support to most panels.
>   The patchset include conversion of most of the
>   trivial cases.
> 
> - Drop drm_connector from drm_panel.
>   This change required many changes to most
>   panels and many bridges and display drivers.
>   This is by far the most invasive change in this patchset.
> 
> - Drop the unused get_timings() callback.
>   No users, so no need to keep it around.
> 
> With this patchset drm_panel_(attach|detach) are nop's
> but they are kept for now.
> 
> A few of these patches has been sent out before - but versioning
> started again from v1 - as the most patches are new.
> 
> I have tested the panel-simple changes, and thus some
> of the infrastructure changes.
> The testing was done on an earlier iteration - and I ended
> up submitting this as Laurent and others started to depend on it.
> Jitao has a patch to add more callbacks, and I wanted the
> simplification of the callbacks before we add more callbacks.

Great series !!! Thanks for working on this.

> Sam Ravnborg (26):
>       drm/drm_panel: no error when no callback
>       drm/panel: add backlight support
>       drm/panel: simple: use drm_panel backlight support
>       drm: get drm_bridge_panel connector via helper
>       drm/panel: add drm_connector argument to get_modes()
>       drm/panel: decouple connector from drm_panel
>       drm/panel: remove get_timings
>       drm/panel: drop drm_device from drm_panel
>       drm/panel: feiyang-fy07024di26a30d: use drm_panel backlight support
>       drm/panel: ilitek-ili9881c: use drm_panel backlight support
>       drm/panel: innolux-p079zca: use drm_panel backlight support
>       drm/panel: kingdisplay-kd097d04: use drm_panel backlight support
>       drm/panel: lvds: use drm_panel backlight support
>       drm/panel: olimex-lcd-olinuxino: use drm_panel backlight support
>       drm/panel: osd-osd101t2587-53ts: use drm_panel backlight support
>       drm/panel: panasonic-vvx10f034n00: use drm_panel backlight support
>       drm/panel: raydium-rm68200: use drm_panel backlight support
>       drm/panel: rocktech-jh057n00900: use drm_panel backlight support
>       drm/panel: ronbo-rb070d30: use drm_panel backlight support
>       drm/panel: seiko-43wvf1g: use drm_panel backlight support
>       drm/panel: sharp-lq101r1sx01: use drm_panel backlight support
>       drm/panel: sharp-ls043t1le01: use drm_panel backlight support
>       drm/panel: sitronix-st7701: use drm_panel backlight support
>       drm/panel: sitronix-st7789v: use drm_panel backlight support
>       drm/panel: tpo-td028ttec1: use drm_panel backlight support
>       drm/panel: tpo-tpg110: use drm_panel backlight support

For patches 09/26 to 26/26,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> 
>  drivers/gpu/drm/bridge/analogix/analogix-anx6345.c |   2 +-
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |   2 +-
>  drivers/gpu/drm/bridge/panel.c                     |  18 +++-
>  drivers/gpu/drm/bridge/parade-ps8622.c             |   2 +-
>  drivers/gpu/drm/bridge/tc358764.c                  |   2 +-
>  drivers/gpu/drm/bridge/tc358767.c                  |   2 +-
>  drivers/gpu/drm/bridge/ti-sn65dsi86.c              |   2 +-
>  drivers/gpu/drm/drm_panel.c                        |  96 ++++++++++++++----
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c            |   2 +-
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c            |   2 +-
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c          |   2 +-
>  drivers/gpu/drm/imx/imx-ldb.c                      |   2 +-
>  drivers/gpu/drm/imx/parallel-display.c             |   2 +-
>  drivers/gpu/drm/mediatek/mtk_dsi.c                 |   2 +-
>  .../gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c    |   2 +-
>  drivers/gpu/drm/msm/dsi/dsi_manager.c              |   2 +-
>  drivers/gpu/drm/mxsfb/mxsfb_out.c                  |   2 +-
>  drivers/gpu/drm/omapdrm/omap_connector.c           |   3 +-
>  drivers/gpu/drm/panel/panel-arm-versatile.c        |   6 +-
>  .../gpu/drm/panel/panel-feiyang-fy07024di26a30d.c  |  16 ++-
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c       |  20 ++--
>  drivers/gpu/drm/panel/panel-ilitek-ili9881c.c      |  29 ++----
>  drivers/gpu/drm/panel/panel-innolux-p079zca.c      |  45 +++------
>  drivers/gpu/drm/panel/panel-jdi-lt070me05000.c     |  11 ++-
>  drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c |  43 +++-----
>  drivers/gpu/drm/panel/panel-lg-lb035q02.c          |   6 +-
>  drivers/gpu/drm/panel/panel-lg-lg4573.c            |  12 +--
>  drivers/gpu/drm/panel/panel-lvds.c                 |  46 ++-------
>  drivers/gpu/drm/panel/panel-nec-nl8048hl11.c       |   6 +-
>  drivers/gpu/drm/panel/panel-novatek-nt39016.c      |   6 +-
>  drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c |  27 ++---
>  drivers/gpu/drm/panel/panel-orisetech-otm8009a.c   |  11 ++-
>  drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c |  37 +++----
>  .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c   |  58 +++--------
>  .../gpu/drm/panel/panel-raspberrypi-touchscreen.c  |   9 +-
>  drivers/gpu/drm/panel/panel-raydium-rm67191.c      |   8 +-
>  drivers/gpu/drm/panel/panel-raydium-rm68200.c      |  26 +++--
>  drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c |  35 +++----
>  drivers/gpu/drm/panel/panel-ronbo-rb070d30.c       |  31 ++----
>  drivers/gpu/drm/panel/panel-samsung-ld9040.c       |   4 +-
>  drivers/gpu/drm/panel/panel-samsung-s6d16d0.c      |   6 +-
>  drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c      |   6 +-
>  drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c   |   6 +-
>  drivers/gpu/drm/panel/panel-samsung-s6e63m0.c      |   6 +-
>  drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c      |   4 +-
>  drivers/gpu/drm/panel/panel-seiko-43wvf1g.c        |  72 +++-----------
>  drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c    |  34 +++----
>  drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c    |   6 +-
>  drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c    |  33 +++----
>  drivers/gpu/drm/panel/panel-simple.c               | 110 ++++++---------------
>  drivers/gpu/drm/panel/panel-sitronix-st7701.c      |  23 ++---
>  drivers/gpu/drm/panel/panel-sitronix-st7789v.c     |  49 ++-------
>  drivers/gpu/drm/panel/panel-sony-acx565akm.c       |   6 +-
>  drivers/gpu/drm/panel/panel-tpo-td028ttec1.c       |  20 ++--
>  drivers/gpu/drm/panel/panel-tpo-td043mtea1.c       |   6 +-
>  drivers/gpu/drm/panel/panel-tpo-tpg110.c           |  26 ++---
>  drivers/gpu/drm/panel/panel-truly-nt35597.c        |   4 +-
>  drivers/gpu/drm/pl111/pl111_drv.c                  |   2 +-
>  drivers/gpu/drm/rcar-du/rcar_lvds.c                |   2 +-
>  drivers/gpu/drm/rockchip/rockchip_lvds.c           |   2 +-
>  drivers/gpu/drm/sti/sti_dvo.c                      |   2 +-
>  drivers/gpu/drm/sun4i/sun4i_lvds.c                 |   2 +-
>  drivers/gpu/drm/sun4i/sun4i_rgb.c                  |   2 +-
>  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c             |   2 +-
>  drivers/gpu/drm/tegra/output.c                     |   2 +-
>  drivers/gpu/drm/tve200/tve200_drv.c                |   2 +-
>  include/drm/drm_bridge.h                           |   1 +
>  include/drm/drm_panel.h                            |  49 ++++-----
>  68 files changed, 460 insertions(+), 664 deletions(-)

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 07/26] drm/panel: remove get_timings
  2019-12-02 19:32 ` [PATCH v1 07/26] drm/panel: remove get_timings Sam Ravnborg
  2019-12-03  7:02   ` Laurent Pinchart
@ 2019-12-03  7:46   ` Maxime Ripard
  2019-12-03  8:18     ` Laurent Pinchart
                       ` (2 more replies)
  1 sibling, 3 replies; 54+ messages in thread
From: Maxime Ripard @ 2019-12-03  7:46 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Laurent Pinchart,
	Benjamin Gaignard, linux-samsung-soc, linux-rockchip,
	Tomi Valkeinen, NXP Linux Team, Jagan Teki, Jitao Shi,
	Daniel Vetter, Maarten Lankhorst, Abhinav Kumar, linux-mediatek,
	Stefan Agner, linux-tegra, Sean Paul, linux-arm-kernel,
	Purism Kernel Team, linux-renesas-soc, Boris Brezillon,
	Pengutronix Kernel Team

[-- Attachment #1.1: Type: text/plain, Size: 3589 bytes --]

Hi,

On Mon, Dec 02, 2019 at 08:32:11PM +0100, Sam Ravnborg wrote:
> There was no users - so remove it.
> The callback was implemented in two drivers - deleted.
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>  drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 18 ------------------
>  drivers/gpu/drm/panel/panel-simple.c        | 18 ------------------
>  include/drm/drm_panel.h                     |  9 ---------
>  3 files changed, 45 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> index b878930b17e4..3bcba64235c4 100644
> --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> @@ -217,30 +217,12 @@ static int seiko_panel_get_modes(struct drm_panel *panel,
>  	return seiko_panel_get_fixed_modes(p, connector);
>  }
>
> -static int seiko_panel_get_timings(struct drm_panel *panel,
> -				    unsigned int num_timings,
> -				    struct display_timing *timings)
> -{
> -	struct seiko_panel *p = to_seiko_panel(panel);
> -	unsigned int i;
> -
> -	if (p->desc->num_timings < num_timings)
> -		num_timings = p->desc->num_timings;
> -
> -	if (timings)
> -		for (i = 0; i < num_timings; i++)
> -			timings[i] = p->desc->timings[i];
> -
> -	return p->desc->num_timings;
> -}
> -
>  static const struct drm_panel_funcs seiko_panel_funcs = {
>  	.disable = seiko_panel_disable,
>  	.unprepare = seiko_panel_unprepare,
>  	.prepare = seiko_panel_prepare,
>  	.enable = seiko_panel_enable,
>  	.get_modes = seiko_panel_get_modes,
> -	.get_timings = seiko_panel_get_timings,
>  };

If anything, I think we should grow the usage of timings and / or make
it usable by everyone.

Using only the mode as we do currently has a bunch of shortcomings as
almost no encoder will be able to provide the typical pixel clock, and
that situation leads to multiple things:

  - If someone working on one encoder wants to upstream a panel they
    have tested, chances are this will not be the typical pixel clock
    / timings being used but rather the one that will match what that
    SoC is capable of. Trouble comes when a second user comes in with
    a different encoder and different capabilities, and then we have a
    maintainance fight over which timing is the true timing (with a
    significant chance that none of them are).

  - If we can't match the pixel clock, we currently have no easy way
    to make the usual measures of reducing / growing the porches and
    blankings areas to match the pixel clock we can provide, since we
    don't have an easy way to get the tolerance on those timings for a
    given panel. There's some ad hoc solutions on some drivers (I
    think vc4 has that?) to ignore the panel and just play around with
    the timings, but I think this should be generalised.

Timings solves the first case since we have the operating range now
and not a single set of timings, and it solves the second since we can
use that range to take those measures instead of taking a shot in the
dark.

I appreciate that it's pretty far from where we are today, but
removing the get_timings means that all the timings already defined in
the panel drivers are becoming useless too, and that eventually it
will get removed.

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 07/26] drm/panel: remove get_timings
  2019-12-03  7:46   ` Maxime Ripard
@ 2019-12-03  8:18     ` Laurent Pinchart
  2019-12-03  8:39     ` Sam Ravnborg
  2019-12-03 15:20     ` Linus Walleij
  2 siblings, 0 replies; 54+ messages in thread
From: Laurent Pinchart @ 2019-12-03  8:18 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Benjamin Gaignard, Sam Ravnborg,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen,
	NXP Linux Team, Jagan Teki, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Abhinav Kumar, linux-mediatek, Stefan Agner,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Hi Maxime,

On Tue, Dec 03, 2019 at 08:46:59AM +0100, Maxime Ripard wrote:
> On Mon, Dec 02, 2019 at 08:32:11PM +0100, Sam Ravnborg wrote:
> > There was no users - so remove it.
> > The callback was implemented in two drivers - deleted.
> >
> > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> > Cc: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <mripard@kernel.org>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > ---
> >  drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 18 ------------------
> >  drivers/gpu/drm/panel/panel-simple.c        | 18 ------------------
> >  include/drm/drm_panel.h                     |  9 ---------
> >  3 files changed, 45 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> > index b878930b17e4..3bcba64235c4 100644
> > --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> > +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> > @@ -217,30 +217,12 @@ static int seiko_panel_get_modes(struct drm_panel *panel,
> >  	return seiko_panel_get_fixed_modes(p, connector);
> >  }
> >
> > -static int seiko_panel_get_timings(struct drm_panel *panel,
> > -				    unsigned int num_timings,
> > -				    struct display_timing *timings)
> > -{
> > -	struct seiko_panel *p = to_seiko_panel(panel);
> > -	unsigned int i;
> > -
> > -	if (p->desc->num_timings < num_timings)
> > -		num_timings = p->desc->num_timings;
> > -
> > -	if (timings)
> > -		for (i = 0; i < num_timings; i++)
> > -			timings[i] = p->desc->timings[i];
> > -
> > -	return p->desc->num_timings;
> > -}
> > -
> >  static const struct drm_panel_funcs seiko_panel_funcs = {
> >  	.disable = seiko_panel_disable,
> >  	.unprepare = seiko_panel_unprepare,
> >  	.prepare = seiko_panel_prepare,
> >  	.enable = seiko_panel_enable,
> >  	.get_modes = seiko_panel_get_modes,
> > -	.get_timings = seiko_panel_get_timings,
> >  };
> 
> If anything, I think we should grow the usage of timings and / or make
> it usable by everyone.
> 
> Using only the mode as we do currently has a bunch of shortcomings as
> almost no encoder will be able to provide the typical pixel clock, and
> that situation leads to multiple things:
> 
>   - If someone working on one encoder wants to upstream a panel they
>     have tested, chances are this will not be the typical pixel clock
>     / timings being used but rather the one that will match what that
>     SoC is capable of. Trouble comes when a second user comes in with
>     a different encoder and different capabilities, and then we have a
>     maintainance fight over which timing is the true timing (with a
>     significant chance that none of them are).
> 
>   - If we can't match the pixel clock, we currently have no easy way
>     to make the usual measures of reducing / growing the porches and
>     blankings areas to match the pixel clock we can provide, since we
>     don't have an easy way to get the tolerance on those timings for a
>     given panel. There's some ad hoc solutions on some drivers (I
>     think vc4 has that?) to ignore the panel and just play around with
>     the timings, but I think this should be generalised.
> 
> Timings solves the first case since we have the operating range now
> and not a single set of timings, and it solves the second since we can
> use that range to take those measures instead of taking a shot in the
> dark.
> 
> I appreciate that it's pretty far from where we are today, but
> removing the get_timings means that all the timings already defined in
> the panel drivers are becoming useless too, and that eventually it
> will get removed.

I agree with you.

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 0/26] drm/panel infrastructure + backlight update
  2019-12-03  7:24 ` Laurent Pinchart
@ 2019-12-03  8:33   ` Sam Ravnborg
  0 siblings, 0 replies; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-03  8:33 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Benjamin Gaignard, Stefan Agner,
	linux-samsung-soc, linux-rockchip, Tomi Valkeinen,
	NXP Linux Team, Jagan Teki, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Hi Laurent.

> > This patchset include a couple of different
> > things - all related to panels.
> > 
> > - The panel callbacks are optional - so drop error if
> >   callback is not present.
> >  
> > - Add support for backlight in drm_panel.
> >   This allows us to make much simpler backlight
> >   support to most panels.
> >   The patchset include conversion of most of the
> >   trivial cases.
> > 
> > - Drop drm_connector from drm_panel.
> >   This change required many changes to most
> >   panels and many bridges and display drivers.
> >   This is by far the most invasive change in this patchset.
> > 
> > - Drop the unused get_timings() callback.
> >   No users, so no need to keep it around.
> > 
> > With this patchset drm_panel_(attach|detach) are nop's
> > but they are kept for now.
> > 
> > A few of these patches has been sent out before - but versioning
> > started again from v1 - as the most patches are new.
> > 
> > I have tested the panel-simple changes, and thus some
> > of the infrastructure changes.
> > The testing was done on an earlier iteration - and I ended
> > up submitting this as Laurent and others started to depend on it.
> > Jitao has a patch to add more callbacks, and I wanted the
> > simplification of the callbacks before we add more callbacks.
> 
> Great series !!! Thanks for working on this.
And likewise - thanks for the detailed reviews!

I have a patch to remove drm_panel_(attach|detach),
but they was not included because there is also a patchset floating
that add more functionality to these.

I will address the feedback, it looked all straighforward, and post
an updated series.

> drm/panel: remove get_timings
I will drop this patch as we may need this later.

	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 07/26] drm/panel: remove get_timings
  2019-12-03  7:46   ` Maxime Ripard
  2019-12-03  8:18     ` Laurent Pinchart
@ 2019-12-03  8:39     ` Sam Ravnborg
  2019-12-04  8:05       ` Maxime Ripard
  2019-12-03 15:20     ` Linus Walleij
  2 siblings, 1 reply; 54+ messages in thread
From: Sam Ravnborg @ 2019-12-03  8:39 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Laurent Pinchart,
	Benjamin Gaignard, linux-samsung-soc, linux-rockchip,
	Tomi Valkeinen, NXP Linux Team, Jagan Teki, Jitao Shi,
	Daniel Vetter, Maarten Lankhorst, Abhinav Kumar, linux-mediatek,
	Stefan Agner, linux-tegra, Sean Paul, linux-arm-kernel,
	Purism Kernel Team, linux-renesas-soc, Boris Brezillon,
	Pengutronix Kernel Team

Hi Maxime.

On Tue, Dec 03, 2019 at 08:46:59AM +0100, Maxime Ripard wrote:
> Hi,
> 
> On Mon, Dec 02, 2019 at 08:32:11PM +0100, Sam Ravnborg wrote:
> > There was no users - so remove it.
> > The callback was implemented in two drivers - deleted.
> >
> > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> > Cc: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <mripard@kernel.org>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > ---
> >  drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 18 ------------------
> >  drivers/gpu/drm/panel/panel-simple.c        | 18 ------------------
> >  include/drm/drm_panel.h                     |  9 ---------
> >  3 files changed, 45 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> > index b878930b17e4..3bcba64235c4 100644
> > --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> > +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> > @@ -217,30 +217,12 @@ static int seiko_panel_get_modes(struct drm_panel *panel,
> >  	return seiko_panel_get_fixed_modes(p, connector);
> >  }
> >
> > -static int seiko_panel_get_timings(struct drm_panel *panel,
> > -				    unsigned int num_timings,
> > -				    struct display_timing *timings)
> > -{
> > -	struct seiko_panel *p = to_seiko_panel(panel);
> > -	unsigned int i;
> > -
> > -	if (p->desc->num_timings < num_timings)
> > -		num_timings = p->desc->num_timings;
> > -
> > -	if (timings)
> > -		for (i = 0; i < num_timings; i++)
> > -			timings[i] = p->desc->timings[i];
> > -
> > -	return p->desc->num_timings;
> > -}
> > -
> >  static const struct drm_panel_funcs seiko_panel_funcs = {
> >  	.disable = seiko_panel_disable,
> >  	.unprepare = seiko_panel_unprepare,
> >  	.prepare = seiko_panel_prepare,
> >  	.enable = seiko_panel_enable,
> >  	.get_modes = seiko_panel_get_modes,
> > -	.get_timings = seiko_panel_get_timings,
> >  };
> 
> If anything, I think we should grow the usage of timings and / or make
> it usable by everyone.
> 
> Using only the mode as we do currently has a bunch of shortcomings as
> almost no encoder will be able to provide the typical pixel clock, and
> that situation leads to multiple things:
> 
>   - If someone working on one encoder wants to upstream a panel they
>     have tested, chances are this will not be the typical pixel clock
>     / timings being used but rather the one that will match what that
>     SoC is capable of. Trouble comes when a second user comes in with
>     a different encoder and different capabilities, and then we have a
>     maintainance fight over which timing is the true timing (with a
>     significant chance that none of them are).
> 
>   - If we can't match the pixel clock, we currently have no easy way
>     to make the usual measures of reducing / growing the porches and
>     blankings areas to match the pixel clock we can provide, since we
>     don't have an easy way to get the tolerance on those timings for a
>     given panel. There's some ad hoc solutions on some drivers (I
>     think vc4 has that?) to ignore the panel and just play around with
>     the timings, but I think this should be generalised.
> 
> Timings solves the first case since we have the operating range now
> and not a single set of timings, and it solves the second since we can
> use that range to take those measures instead of taking a shot in the
> dark.
> 
> I appreciate that it's pretty far from where we are today, but
> removing the get_timings means that all the timings already defined in
> the panel drivers are becoming useless too, and that eventually it
> will get removed.

Thanks for this nice explanation. I will drop the patch,
and add an entry to my TODO list to look closer at this later.
There are things to improve in this area.

So the conclusion is more work rather than removing code :-)

	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 26/26] drm/panel: tpo-tpg110: use drm_panel backlight support
  2019-12-02 19:32 ` [PATCH v1 26/26] drm/panel: tpo-tpg110: " Sam Ravnborg
@ 2019-12-03 13:20   ` Linus Walleij
  0 siblings, 0 replies; 54+ messages in thread
From: Linus Walleij @ 2019-12-03 13:20 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, open list:DRM PANEL DRIVERS,
	Andrzej Hajda, Thierry Reding, Laurent Pinchart,
	Benjamin Gaignard, Stefan Agner, linux-samsung-soc,
	open list:ARM/Rockchip SoC...,
	Tomi Valkeinen, NXP Linux Team, Jagan Teki, Jitao Shi,
	Pengutronix Kernel Team, Maarten Lankhorst, Maxime Ripard,
	moderated list:ARM/Mediatek SoC support, Abhinav Kumar,
	linux-tegra, Sean Paul, Linux ARM, Purism Kernel Team,
	Linux-Renesas, Boris Brezillon, Daniel Vetter

On Mon, Dec 2, 2019 at 8:33 PM Sam Ravnborg <sam@ravnborg.org> wrote:

> Use the backlight support in drm_panel to simplify the driver
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Thanks for cleaning all of this up!

Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 04/26] drm: get drm_bridge_panel connector via helper
  2019-12-02 19:32 ` [PATCH v1 04/26] drm: get drm_bridge_panel connector via helper Sam Ravnborg
  2019-12-03  6:44   ` Laurent Pinchart
@ 2019-12-03 13:22   ` Linus Walleij
  1 sibling, 0 replies; 54+ messages in thread
From: Linus Walleij @ 2019-12-03 13:22 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, open list:DRM PANEL DRIVERS,
	Andrzej Hajda, Thierry Reding, Laurent Pinchart,
	Benjamin Gaignard, Stefan Agner, linux-samsung-soc,
	open list:ARM/Rockchip SoC...,
	Tomi Valkeinen, NXP Linux Team, Jagan Teki, Jitao Shi,
	Pengutronix Kernel Team, Jonas Karlman, Maarten Lankhorst,
	Maxime Ripard, moderated list:ARM/Mediatek SoC support,
	Abhinav Kumar, linux-tegra, Sean Paul, Linux ARM, Jernej Skrabec,
	Purism Kernel Team, Eric Anholt, Linux-Renesas, Boris Brezillon,
	Daniel Vetter

On Mon, Dec 2, 2019 at 8:33 PM Sam Ravnborg <sam@ravnborg.org> wrote:

> The drm_connector created by drm_panel_bridge was accessed
> via drm_panel.connector.
> Avoid the detour around drm_panel by providing a simple get method.
> This avoids direct access to the connector field in drm_panel in
> the two users.
>
> Update pl111 and tve200 to use the new helper.
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Andrzej Hajda <a.hajda@samsung.com>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: Jonas Karlman <jonas@kwiboo.se>
> Cc: Jernej Skrabec <jernej.skrabec@siol.net>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>

With the little issues found by Laurent fixed:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 05/26] drm/panel: add drm_connector argument to get_modes()
  2019-12-02 19:32 ` [PATCH v1 05/26] drm/panel: add drm_connector argument to get_modes() Sam Ravnborg
  2019-12-03  6:50   ` Laurent Pinchart
@ 2019-12-03 13:25   ` Linus Walleij
  2019-12-04 12:08   ` Guido Günther
  2 siblings, 0 replies; 54+ messages in thread
From: Linus Walleij @ 2019-12-03 13:25 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Guido Günther,
	open list:DRM PANEL DRIVERS, Andrzej Hajda, Thierry Reding,
	Laurent Pinchart, Benjamin Gaignard, Stefan Agner,
	linux-samsung-soc, Stefan Mavrodiev,
	open list:ARM/Rockchip SoC...,
	Tomi Valkeinen, NXP Linux Team, Robert Chiras, Jagan Teki,
	Jitao Shi, Pengutronix Kernel Team, Maarten Lankhorst,
	Maxime Ripard, moderated list:ARM/Mediatek SoC support,
	Abhinav Kumar, linux-tegra, Sean Paul, Linux ARM,
	Purism Kernel Team, Linux-Renesas, Boris Brezillon,
	Daniel Vetter

On Mon, Dec 2, 2019 at 8:33 PM Sam Ravnborg <sam@ravnborg.org> wrote:

> Today the bridge creates the drm_connector, but that is planned
> to be moved to the display drivers.
> To facilitate this, update drm_panel_funcs.get_modes() to
> take drm_connector as an argument.
> All panel drivers implementing get_modes() are updated.
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Stefan Mavrodiev <stefan@olimex.com>
> Cc: Robert Chiras <robert.chiras@nxp.com>
> Cc: "Guido Günther" <agx@sigxcpu.org>
> Cc: Purism Kernel Team <kernel@puri.sm>

This looks reasonable to me.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 08/26] drm/panel: drop drm_device from drm_panel
  2019-12-02 19:32 ` [PATCH v1 08/26] drm/panel: drop drm_device from drm_panel Sam Ravnborg
  2019-12-03  7:15   ` Laurent Pinchart
@ 2019-12-03 13:27   ` Linus Walleij
  1 sibling, 0 replies; 54+ messages in thread
From: Linus Walleij @ 2019-12-03 13:27 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Guido Günther,
	open list:DRM PANEL DRIVERS, Andrzej Hajda, Thierry Reding,
	Laurent Pinchart, Benjamin Gaignard, Stefan Agner,
	linux-samsung-soc, Stefan Mavrodiev,
	open list:ARM/Rockchip SoC...,
	Tomi Valkeinen, NXP Linux Team, Robert Chiras, Jagan Teki,
	Jitao Shi, Pengutronix Kernel Team, Maarten Lankhorst,
	Maxime Ripard, moderated list:ARM/Mediatek SoC support,
	Abhinav Kumar, linux-tegra, Sean Paul, Linux ARM,
	Purism Kernel Team, Linux-Renesas, Boris Brezillon,
	Daniel Vetter

On Mon, Dec 2, 2019 at 8:33 PM Sam Ravnborg <sam@ravnborg.org> wrote:

> The panel drivers used drm_panel.drm for two purposes:
> 1) Argument to drm_mode_duplicate()
> 2) drm->dev was used in error messages
>
> The first usage is replaced with drm_connector.dev
> - drm_connector is already connected to a drm_device
>   and we have a valid connector
>
> The second usage is replaced with drm_panel.dev
> - this makes drivers more consistent in their dev argument
>   used for dev_err() and friends
>
> With these replacements there are no more uses of drm_panel.drm,
> so it is removed from struct drm_panel.
> With this change drm_panel_attach() and drm_panel_detach()
> no logner has any use as they are empty functions.
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Stefan Mavrodiev <stefan@olimex.com>
> Cc: Robert Chiras <robert.chiras@nxp.com>
> Cc: "Guido Günther" <agx@sigxcpu.org>
> Cc: Purism Kernel Team <kernel@puri.sm>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 07/26] drm/panel: remove get_timings
  2019-12-03  7:46   ` Maxime Ripard
  2019-12-03  8:18     ` Laurent Pinchart
  2019-12-03  8:39     ` Sam Ravnborg
@ 2019-12-03 15:20     ` Linus Walleij
  2019-12-04  8:16       ` Maxime Ripard
  2 siblings, 1 reply; 54+ messages in thread
From: Linus Walleij @ 2019-12-03 15:20 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Neil Armstrong, David Airlie, open list:DRM PANEL DRIVERS,
	Andrzej Hajda, Thierry Reding, Laurent Pinchart,
	Benjamin Gaignard, Sam Ravnborg, linux-samsung-soc,
	open list:ARM/Rockchip SoC...,
	Tomi Valkeinen, NXP Linux Team, Jagan Teki, Jitao Shi,
	Pengutronix Kernel Team, Maarten Lankhorst, Abhinav Kumar,
	moderated list:ARM/Mediatek SoC support, Stefan Agner,
	linux-tegra, Sean Paul, Linux ARM, Purism Kernel Team,
	Linux-Renesas, Boris Brezillon, Daniel Vetter

Hi Maxime,

On Tue, Dec 3, 2019 at 8:47 AM Maxime Ripard <mripard@kernel.org> wrote:

> Using only the mode as we do currently has a bunch of shortcomings as
> almost no encoder will be able to provide the typical pixel clock, and
> that situation leads to multiple things:
>
>   - If someone working on one encoder wants to upstream a panel they
>     have tested, chances are this will not be the typical pixel clock
>     / timings being used but rather the one that will match what that
>     SoC is capable of. Trouble comes when a second user comes in with
>     a different encoder and different capabilities, and then we have a
>     maintainance fight over which timing is the true timing (with a
>     significant chance that none of them are).
>
>   - If we can't match the pixel clock, we currently have no easy way
>     to make the usual measures of reducing / growing the porches and
>     blankings areas to match the pixel clock we can provide, since we
>     don't have an easy way to get the tolerance on those timings for a
>     given panel. There's some ad hoc solutions on some drivers (I
>     think vc4 has that?) to ignore the panel and just play around with
>     the timings, but I think this should be generalised.

I've been confused with these things as they look today and it seems
the whole struct drm_display_mode could need some improvement?

If .clock is supposed to be htotal * vtotal * vrefresh, what is the
.clock doing there anyway.

Sadly I am too inexperienced to realize where the tolerances should
be stated, but I guess just stating that hsync_start etc are typical,
then specify some tolerance for each would help a bit?

On the DSI displays in video mode there is also this EOL area
which seems to be where the logic is normally just idling for a
while, that can be adjusted on some hardware as well, but
I don't quite understand it admittedly. Sometimes I wonder if
anyone really understands DSI... :/

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 07/26] drm/panel: remove get_timings
  2019-12-03  8:39     ` Sam Ravnborg
@ 2019-12-04  8:05       ` Maxime Ripard
  0 siblings, 0 replies; 54+ messages in thread
From: Maxime Ripard @ 2019-12-04  8:05 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Laurent Pinchart,
	Benjamin Gaignard, linux-samsung-soc, linux-rockchip,
	Tomi Valkeinen, NXP Linux Team, Jagan Teki, Jitao Shi,
	Daniel Vetter, Maarten Lankhorst, Abhinav Kumar, linux-mediatek,
	Stefan Agner, linux-tegra, Sean Paul, linux-arm-kernel,
	Purism Kernel Team, linux-renesas-soc, Boris Brezillon,
	Pengutronix Kernel Team

[-- Attachment #1.1: Type: text/plain, Size: 4314 bytes --]

On Tue, Dec 03, 2019 at 09:39:36AM +0100, Sam Ravnborg wrote:
> On Tue, Dec 03, 2019 at 08:46:59AM +0100, Maxime Ripard wrote:
> > Hi,
> >
> > On Mon, Dec 02, 2019 at 08:32:11PM +0100, Sam Ravnborg wrote:
> > > There was no users - so remove it.
> > > The callback was implemented in two drivers - deleted.
> > >
> > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > > Cc: Thierry Reding <thierry.reding@gmail.com>
> > > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> > > Cc: Sam Ravnborg <sam@ravnborg.org>
> > > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > > Cc: Maxime Ripard <mripard@kernel.org>
> > > Cc: David Airlie <airlied@linux.ie>
> > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > ---
> > >  drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 18 ------------------
> > >  drivers/gpu/drm/panel/panel-simple.c        | 18 ------------------
> > >  include/drm/drm_panel.h                     |  9 ---------
> > >  3 files changed, 45 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> > > index b878930b17e4..3bcba64235c4 100644
> > > --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> > > +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> > > @@ -217,30 +217,12 @@ static int seiko_panel_get_modes(struct drm_panel *panel,
> > >  	return seiko_panel_get_fixed_modes(p, connector);
> > >  }
> > >
> > > -static int seiko_panel_get_timings(struct drm_panel *panel,
> > > -				    unsigned int num_timings,
> > > -				    struct display_timing *timings)
> > > -{
> > > -	struct seiko_panel *p = to_seiko_panel(panel);
> > > -	unsigned int i;
> > > -
> > > -	if (p->desc->num_timings < num_timings)
> > > -		num_timings = p->desc->num_timings;
> > > -
> > > -	if (timings)
> > > -		for (i = 0; i < num_timings; i++)
> > > -			timings[i] = p->desc->timings[i];
> > > -
> > > -	return p->desc->num_timings;
> > > -}
> > > -
> > >  static const struct drm_panel_funcs seiko_panel_funcs = {
> > >  	.disable = seiko_panel_disable,
> > >  	.unprepare = seiko_panel_unprepare,
> > >  	.prepare = seiko_panel_prepare,
> > >  	.enable = seiko_panel_enable,
> > >  	.get_modes = seiko_panel_get_modes,
> > > -	.get_timings = seiko_panel_get_timings,
> > >  };
> >
> > If anything, I think we should grow the usage of timings and / or make
> > it usable by everyone.
> >
> > Using only the mode as we do currently has a bunch of shortcomings as
> > almost no encoder will be able to provide the typical pixel clock, and
> > that situation leads to multiple things:
> >
> >   - If someone working on one encoder wants to upstream a panel they
> >     have tested, chances are this will not be the typical pixel clock
> >     / timings being used but rather the one that will match what that
> >     SoC is capable of. Trouble comes when a second user comes in with
> >     a different encoder and different capabilities, and then we have a
> >     maintainance fight over which timing is the true timing (with a
> >     significant chance that none of them are).
> >
> >   - If we can't match the pixel clock, we currently have no easy way
> >     to make the usual measures of reducing / growing the porches and
> >     blankings areas to match the pixel clock we can provide, since we
> >     don't have an easy way to get the tolerance on those timings for a
> >     given panel. There's some ad hoc solutions on some drivers (I
> >     think vc4 has that?) to ignore the panel and just play around with
> >     the timings, but I think this should be generalised.
> >
> > Timings solves the first case since we have the operating range now
> > and not a single set of timings, and it solves the second since we can
> > use that range to take those measures instead of taking a shot in the
> > dark.
> >
> > I appreciate that it's pretty far from where we are today, but
> > removing the get_timings means that all the timings already defined in
> > the panel drivers are becoming useless too, and that eventually it
> > will get removed.
>
> Thanks for this nice explanation. I will drop the patch,
> and add an entry to my TODO list to look closer at this later.
> There are things to improve in this area.
>
> So the conclusion is more work rather than removing code :-)

Yeah, unfortunately.. :)

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 07/26] drm/panel: remove get_timings
  2019-12-03 15:20     ` Linus Walleij
@ 2019-12-04  8:16       ` Maxime Ripard
  2019-12-04  8:23         ` Laurent Pinchart
  0 siblings, 1 reply; 54+ messages in thread
From: Maxime Ripard @ 2019-12-04  8:16 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Neil Armstrong, David Airlie, open list:DRM PANEL DRIVERS,
	Andrzej Hajda, Thierry Reding, Laurent Pinchart,
	Benjamin Gaignard, Sam Ravnborg, linux-samsung-soc,
	open list:ARM/Rockchip SoC...,
	Tomi Valkeinen, NXP Linux Team, Jagan Teki, Jitao Shi,
	Pengutronix Kernel Team, Maarten Lankhorst, Abhinav Kumar,
	moderated list:ARM/Mediatek SoC support, Stefan Agner,
	linux-tegra, Sean Paul, Linux ARM, Purism Kernel Team,
	Linux-Renesas, Boris Brezillon, Daniel Vetter

[-- Attachment #1.1: Type: text/plain, Size: 3017 bytes --]

Hi Linus,

On Tue, Dec 03, 2019 at 04:20:24PM +0100, Linus Walleij wrote:
> On Tue, Dec 3, 2019 at 8:47 AM Maxime Ripard <mripard@kernel.org> wrote:
>
> > Using only the mode as we do currently has a bunch of shortcomings as
> > almost no encoder will be able to provide the typical pixel clock, and
> > that situation leads to multiple things:
> >
> >   - If someone working on one encoder wants to upstream a panel they
> >     have tested, chances are this will not be the typical pixel clock
> >     / timings being used but rather the one that will match what that
> >     SoC is capable of. Trouble comes when a second user comes in with
> >     a different encoder and different capabilities, and then we have a
> >     maintainance fight over which timing is the true timing (with a
> >     significant chance that none of them are).
> >
> >   - If we can't match the pixel clock, we currently have no easy way
> >     to make the usual measures of reducing / growing the porches and
> >     blankings areas to match the pixel clock we can provide, since we
> >     don't have an easy way to get the tolerance on those timings for a
> >     given panel. There's some ad hoc solutions on some drivers (I
> >     think vc4 has that?) to ignore the panel and just play around with
> >     the timings, but I think this should be generalised.
>
> I've been confused with these things as they look today and it seems
> the whole struct drm_display_mode could need some improvement?
>
> If .clock is supposed to be htotal * vtotal * vrefresh, what is the
> .clock doing there anyway.

It's one thing I wonder as well. I guess it's just more convenient for
everyone, since it's exposed by the VESA modes (iirc) and a lot of
drivers really care about the clock.

> Sadly I am too inexperienced to realize where the tolerances should
> be stated, but I guess just stating that hsync_start etc are typical,
> then specify some tolerance for each would help a bit?

The timings structure discussed in the patch that started this
discussion is actually doing this nicely, you have for each timing the
minimum, typical and maximum value. The current issue with it though
is that it's pretty difficult to use it, since it's not really tied to
any of the panel code (or DRM helpers). The only driver that was
supporting it was omapdrm and it was removed recently.

If we really wanted to support it, one path forward I can see would be
to make the timings structure the primary one, and only use
drm_display_mode for userspace facing code, and generate it from the
timings. This would be a pretty invasive change though...

> On the DSI displays in video mode there is also this EOL area
> which seems to be where the logic is normally just idling for a
> while, that can be adjusted on some hardware as well, but
> I don't quite understand it admittedly. Sometimes I wonder if
> anyone really understands DSI... :/

I'm not aware of any EOL area in MIPI-DSI that would make the hardware
idle, don't you mean LP-11?

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 07/26] drm/panel: remove get_timings
  2019-12-04  8:16       ` Maxime Ripard
@ 2019-12-04  8:23         ` Laurent Pinchart
  0 siblings, 0 replies; 54+ messages in thread
From: Laurent Pinchart @ 2019-12-04  8:23 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Neil Armstrong, David Airlie, Linus Walleij,
	open list:DRM PANEL DRIVERS, Andrzej Hajda, Thierry Reding,
	Benjamin Gaignard, Sam Ravnborg, linux-samsung-soc,
	open list:ARM/Rockchip SoC...,
	Tomi Valkeinen, NXP Linux Team, Jagan Teki, Jitao Shi,
	Pengutronix Kernel Team, Maarten Lankhorst, Abhinav Kumar,
	moderated list:ARM/Mediatek SoC support, Stefan Agner,
	linux-tegra, Sean Paul, Linux ARM, Purism Kernel Team,
	Linux-Renesas, Boris Brezillon, Daniel Vetter

Hi Maxime,

On Wed, Dec 04, 2019 at 09:16:50AM +0100, Maxime Ripard wrote:
> On Tue, Dec 03, 2019 at 04:20:24PM +0100, Linus Walleij wrote:
> > On Tue, Dec 3, 2019 at 8:47 AM Maxime Ripard wrote:
> >
> > > Using only the mode as we do currently has a bunch of shortcomings as
> > > almost no encoder will be able to provide the typical pixel clock, and
> > > that situation leads to multiple things:
> > >
> > >   - If someone working on one encoder wants to upstream a panel they
> > >     have tested, chances are this will not be the typical pixel clock
> > >     / timings being used but rather the one that will match what that
> > >     SoC is capable of. Trouble comes when a second user comes in with
> > >     a different encoder and different capabilities, and then we have a
> > >     maintainance fight over which timing is the true timing (with a
> > >     significant chance that none of them are).
> > >
> > >   - If we can't match the pixel clock, we currently have no easy way
> > >     to make the usual measures of reducing / growing the porches and
> > >     blankings areas to match the pixel clock we can provide, since we
> > >     don't have an easy way to get the tolerance on those timings for a
> > >     given panel. There's some ad hoc solutions on some drivers (I
> > >     think vc4 has that?) to ignore the panel and just play around with
> > >     the timings, but I think this should be generalised.
> >
> > I've been confused with these things as they look today and it seems
> > the whole struct drm_display_mode could need some improvement?
> >
> > If .clock is supposed to be htotal * vtotal * vrefresh, what is the
> > .clock doing there anyway.
> 
> It's one thing I wonder as well. I guess it's just more convenient for
> everyone, since it's exposed by the VESA modes (iirc) and a lot of
> drivers really care about the clock.

My understanding is that the clock is the authoritative parameter, while
vrefresh is offered as a convenience to avoid calculating it manually
through drivers.

> > Sadly I am too inexperienced to realize where the tolerances should
> > be stated, but I guess just stating that hsync_start etc are typical,
> > then specify some tolerance for each would help a bit?
> 
> The timings structure discussed in the patch that started this
> discussion is actually doing this nicely, you have for each timing the
> minimum, typical and maximum value. The current issue with it though
> is that it's pretty difficult to use it, since it's not really tied to
> any of the panel code (or DRM helpers). The only driver that was
> supporting it was omapdrm and it was removed recently.
> 
> If we really wanted to support it, one path forward I can see would be
> to make the timings structure the primary one, and only use
> drm_display_mode for userspace facing code, and generate it from the
> timings. This would be a pretty invasive change though...
> 
> > On the DSI displays in video mode there is also this EOL area
> > which seems to be where the logic is normally just idling for a
> > while, that can be adjusted on some hardware as well, but
> > I don't quite understand it admittedly. Sometimes I wonder if
> > anyone really understands DSI... :/
> 
> I'm not aware of any EOL area in MIPI-DSI that would make the hardware
> idle, don't you mean LP-11?

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 18/26] drm/panel: rocktech-jh057n00900: use drm_panel backlight support
  2019-12-02 19:32 ` [PATCH v1 18/26] drm/panel: rocktech-jh057n00900: " Sam Ravnborg
@ 2019-12-04 12:04   ` Guido Günther
  0 siblings, 0 replies; 54+ messages in thread
From: Guido Günther @ 2019-12-04 12:04 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Laurent Pinchart,
	Benjamin Gaignard, Stefan Agner, linux-samsung-soc,
	linux-rockchip, Tomi Valkeinen, NXP Linux Team, Jagan Teki,
	Jitao Shi, Pengutronix Kernel Team, Maarten Lankhorst,
	Maxime Ripard, linux-mediatek, Abhinav Kumar, linux-tegra,
	Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Hi,
On Mon, Dec 02, 2019 at 08:32:22PM +0100, Sam Ravnborg wrote:
> Use the backlight support in drm_panel to simplify the driver.
> While touching the include files sort them
> and divide them up in blocks.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: "Guido Günther" <agx@sigxcpu.org>
> Cc: Purism Kernel Team <kernel@puri.sm>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> ---
>  .../drm/panel/panel-rocktech-jh057n00900.c    | 24 +++++++++----------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> index 3a4f1c0fce86..38ff742bc120 100644
> --- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> +++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> @@ -5,20 +5,22 @@
>   * Copyright (C) Purism SPC 2019
>   */
>  
> -#include <drm/drm_mipi_dsi.h>
> -#include <drm/drm_modes.h>
> -#include <drm/drm_panel.h>
> -#include <drm/drm_print.h>
> -#include <linux/backlight.h>
>  #include <linux/debugfs.h>
>  #include <linux/delay.h>
>  #include <linux/gpio/consumer.h>
>  #include <linux/media-bus-format.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/module.h>
>  #include <linux/regulator/consumer.h>
> +
>  #include <video/display_timing.h>
>  #include <video/mipi_display.h>
>  
> +#include <drm/drm_mipi_dsi.h>
> +#include <drm/drm_modes.h>
> +#include <drm/drm_panel.h>
> +#include <drm/drm_print.h>
> +
>  #define DRV_NAME "panel-rocktech-jh057n00900"
>  
>  /* Manufacturer specific Commands send via DSI */
> @@ -47,7 +49,6 @@ struct jh057n {
>  	struct device *dev;
>  	struct drm_panel panel;
>  	struct gpio_desc *reset_gpio;
> -	struct backlight_device *backlight;
>  	struct regulator *vcc;
>  	struct regulator *iovcc;
>  	bool prepared;
> @@ -152,7 +153,7 @@ static int jh057n_enable(struct drm_panel *panel)
>  		return ret;
>  	}
>  
> -	return backlight_enable(ctx->backlight);
> +	return 0;
>  }
>  
>  static int jh057n_disable(struct drm_panel *panel)
> @@ -160,7 +161,6 @@ static int jh057n_disable(struct drm_panel *panel)
>  	struct jh057n *ctx = panel_to_jh057n(panel);
>  	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
>  
> -	backlight_disable(ctx->backlight);
>  	return mipi_dsi_dcs_set_display_off(dsi);
>  }
>  
> @@ -321,10 +321,6 @@ static int jh057n_probe(struct mipi_dsi_device *dsi)
>  	dsi->mode_flags = MIPI_DSI_MODE_VIDEO |
>  		MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_VIDEO_SYNC_PULSE;
>  
> -	ctx->backlight = devm_of_find_backlight(dev);
> -	if (IS_ERR(ctx->backlight))
> -		return PTR_ERR(ctx->backlight);
> -
>  	ctx->vcc = devm_regulator_get(dev, "vcc");
>  	if (IS_ERR(ctx->vcc)) {
>  		ret = PTR_ERR(ctx->vcc);
> @@ -347,6 +343,10 @@ static int jh057n_probe(struct mipi_dsi_device *dsi)
>  	drm_panel_init(&ctx->panel, dev, &jh057n_drm_funcs,
>  		       DRM_MODE_CONNECTOR_DSI);
>  
> +	ret = drm_panel_of_backlight(&ctx->panel);
> +	if (ret)
> +		return ret;
> +
>  	drm_panel_add(&ctx->panel);
>  
>  	ret = mipi_dsi_attach(dsi);

Reviewed-by: Guido Günther <agx@sigxcpu.org> 

> -- 
> 2.20.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 05/26] drm/panel: add drm_connector argument to get_modes()
  2019-12-02 19:32 ` [PATCH v1 05/26] drm/panel: add drm_connector argument to get_modes() Sam Ravnborg
  2019-12-03  6:50   ` Laurent Pinchart
  2019-12-03 13:25   ` Linus Walleij
@ 2019-12-04 12:08   ` Guido Günther
  2019-12-04 13:11     ` Laurent Pinchart
  2 siblings, 1 reply; 54+ messages in thread
From: Guido Günther @ 2019-12-04 12:08 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Laurent Pinchart,
	Benjamin Gaignard, Stefan Agner, linux-samsung-soc,
	Stefan Mavrodiev, linux-rockchip, Tomi Valkeinen, NXP Linux Team,
	Robert Chiras, Jagan Teki, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Hi Sam,
On Mon, Dec 02, 2019 at 08:32:09PM +0100, Sam Ravnborg wrote:
> Today the bridge creates the drm_connector, but that is planned
> to be moved to the display drivers.

Do you have a reference for that move at hand?
Cheers,
 -- Guido

> To facilitate this, update drm_panel_funcs.get_modes() to
> take drm_connector as an argument.
> All panel drivers implementing get_modes() are updated.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Stefan Mavrodiev <stefan@olimex.com>
> Cc: Robert Chiras <robert.chiras@nxp.com>
> Cc: "Guido Günther" <agx@sigxcpu.org>
> Cc: Purism Kernel Team <kernel@puri.sm>
> ---
>  drivers/gpu/drm/drm_panel.c                   |  2 +-
>  drivers/gpu/drm/panel/panel-arm-versatile.c   |  4 +--
>  .../drm/panel/panel-feiyang-fy07024di26a30d.c |  4 +--
>  drivers/gpu/drm/panel/panel-ilitek-ili9322.c  |  5 ++--
>  drivers/gpu/drm/panel/panel-ilitek-ili9881c.c |  8 +++---
>  drivers/gpu/drm/panel/panel-innolux-p079zca.c | 13 +++++----
>  .../gpu/drm/panel/panel-jdi-lt070me05000.c    |  9 ++++---
>  .../drm/panel/panel-kingdisplay-kd097d04.c    | 11 ++++----
>  drivers/gpu/drm/panel/panel-lg-lb035q02.c     |  4 +--
>  drivers/gpu/drm/panel/panel-lg-lg4573.c       |  8 +++---
>  drivers/gpu/drm/panel/panel-lvds.c            |  4 +--
>  drivers/gpu/drm/panel/panel-nec-nl8048hl11.c  |  4 +--
>  drivers/gpu/drm/panel/panel-novatek-nt39016.c |  4 +--
>  .../drm/panel/panel-olimex-lcd-olinuxino.c    |  4 +--
>  .../gpu/drm/panel/panel-orisetech-otm8009a.c  |  9 ++++---
>  .../drm/panel/panel-osd-osd101t2587-53ts.c    |  9 ++++---
>  .../drm/panel/panel-panasonic-vvx10f034n00.c  |  9 ++++---
>  .../drm/panel/panel-raspberrypi-touchscreen.c |  4 +--
>  drivers/gpu/drm/panel/panel-raydium-rm67191.c |  6 ++---
>  drivers/gpu/drm/panel/panel-raydium-rm68200.c |  9 ++++---
>  .../drm/panel/panel-rocktech-jh057n00900.c    |  9 ++++---
>  drivers/gpu/drm/panel/panel-ronbo-rb070d30.c  | 10 +++----
>  drivers/gpu/drm/panel/panel-samsung-ld9040.c  |  4 +--
>  drivers/gpu/drm/panel/panel-samsung-s6d16d0.c |  4 +--
>  drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c |  4 +--
>  .../gpu/drm/panel/panel-samsung-s6e63j0x03.c  |  4 +--
>  drivers/gpu/drm/panel/panel-samsung-s6e63m0.c |  4 +--
>  drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c |  4 +--
>  drivers/gpu/drm/panel/panel-seiko-43wvf1g.c   |  9 ++++---
>  .../gpu/drm/panel/panel-sharp-lq101r1sx01.c   |  9 ++++---
>  .../gpu/drm/panel/panel-sharp-ls037v7dw01.c   |  4 +--
>  .../gpu/drm/panel/panel-sharp-ls043t1le01.c   |  9 ++++---
>  drivers/gpu/drm/panel/panel-simple.c          | 27 ++++++++++---------
>  drivers/gpu/drm/panel/panel-sitronix-st7701.c |  9 ++++---
>  .../gpu/drm/panel/panel-sitronix-st7789v.c    |  8 +++---
>  drivers/gpu/drm/panel/panel-sony-acx565akm.c  |  4 +--
>  drivers/gpu/drm/panel/panel-tpo-td028ttec1.c  |  4 +--
>  drivers/gpu/drm/panel/panel-tpo-td043mtea1.c  |  4 +--
>  drivers/gpu/drm/panel/panel-tpo-tpg110.c      |  4 +--
>  drivers/gpu/drm/panel/panel-truly-nt35597.c   |  4 +--
>  include/drm/drm_panel.h                       |  3 ++-
>  41 files changed, 141 insertions(+), 130 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index 35609c90e467..9927e28d93e6 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -252,7 +252,7 @@ int drm_panel_get_modes(struct drm_panel *panel)
>  		return -EINVAL;
>  
>  	if (panel->funcs && panel->funcs->get_modes)
> -		return panel->funcs->get_modes(panel);
> +		return panel->funcs->get_modes(panel, panel->connector);
>  
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-arm-versatile.c b/drivers/gpu/drm/panel/panel-arm-versatile.c
> index a0574dc03e16..41aa91f60979 100644
> --- a/drivers/gpu/drm/panel/panel-arm-versatile.c
> +++ b/drivers/gpu/drm/panel/panel-arm-versatile.c
> @@ -260,9 +260,9 @@ static int versatile_panel_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int versatile_panel_get_modes(struct drm_panel *panel)
> +static int versatile_panel_get_modes(struct drm_panel *panel,
> +				     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct versatile_panel *vpanel = to_versatile_panel(panel);
>  	struct drm_display_mode *mode;
>  
> diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> index 98f184b81187..37d6b7390954 100644
> --- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> +++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> @@ -162,9 +162,9 @@ static const struct drm_display_mode feiyang_default_mode = {
>  	.type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
>  };
>  
> -static int feiyang_get_modes(struct drm_panel *panel)
> +static int feiyang_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct feiyang *ctx = panel_to_feiyang(panel);
>  	struct drm_display_mode *mode;
>  
> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> index 24955bec1958..8fd4c0521841 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> @@ -641,9 +641,9 @@ static const struct drm_display_mode itu_r_bt_656_720_mode = {
>  	.flags = 0,
>  };
>  
> -static int ili9322_get_modes(struct drm_panel *panel)
> +static int ili9322_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct ili9322 *ili = panel_to_ili9322(panel);
>  	struct drm_display_mode *mode;
>  	struct drm_display_info *info;
> @@ -655,7 +655,6 @@ static int ili9322_get_modes(struct drm_panel *panel)
>  		info->bus_flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE;
>  	else
>  		info->bus_flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE;
> -
>  	if (ili->conf->de_active_high)
>  		info->bus_flags |= DRM_BUS_FLAG_DE_HIGH;
>  	else
> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> index e8789e460a16..1c67a668d6bf 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> @@ -387,9 +387,9 @@ static const struct drm_display_mode bananapi_default_mode = {
>  	.vtotal		= 1280 + 10 + 10 + 20,
>  };
>  
> -static int ili9881c_get_modes(struct drm_panel *panel)
> +static int ili9881c_get_modes(struct drm_panel *panel,
> +			      struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct ili9881c *ctx = panel_to_ili9881c(panel);
>  	struct drm_display_mode *mode;
>  
> @@ -407,8 +407,8 @@ static int ili9881c_get_modes(struct drm_panel *panel)
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>  	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 62;
> -	panel->connector->display_info.height_mm = 110;
> +	connector->display_info.width_mm = 62;
> +	connector->display_info.height_mm = 110;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> index 83df1ac4211f..facf1bab2532 100644
> --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> @@ -403,7 +403,8 @@ static const struct panel_desc innolux_p097pfg_panel_desc = {
>  	.sleep_mode_delay = 100, /* T15 */
>  };
>  
> -static int innolux_panel_get_modes(struct drm_panel *panel)
> +static int innolux_panel_get_modes(struct drm_panel *panel,
> +				   struct drm_connector *connector)
>  {
>  	struct innolux_panel *innolux = to_innolux_panel(panel);
>  	const struct drm_display_mode *m = innolux->desc->mode;
> @@ -418,13 +419,11 @@ static int innolux_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm =
> -			innolux->desc->size.width;
> -	panel->connector->display_info.height_mm =
> -			innolux->desc->size.height;
> -	panel->connector->display_info.bpc = innolux->desc->bpc;
> +	connector->display_info.width_mm = innolux->desc->size.width;
> +	connector->display_info.height_mm = innolux->desc->size.height;
> +	connector->display_info.bpc = innolux->desc->bpc;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> index 56364a93f0b8..e6b650a64fdb 100644
> --- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> +++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> @@ -300,7 +300,8 @@ static const struct drm_display_mode default_mode = {
>  		.flags = 0,
>  };
>  
> -static int jdi_panel_get_modes(struct drm_panel *panel)
> +static int jdi_panel_get_modes(struct drm_panel *panel,
> +			       struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  	struct jdi_panel *jdi = to_jdi_panel(panel);
> @@ -316,10 +317,10 @@ static int jdi_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 95;
> -	panel->connector->display_info.height_mm = 151;
> +	connector->display_info.width_mm = 95;
> +	connector->display_info.height_mm = 151;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> index 45f96556ec8c..e6f53d56daf9 100644
> --- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> +++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> @@ -333,7 +333,8 @@ static const struct drm_display_mode default_mode = {
>  	.vrefresh = 60,
>  };
>  
> -static int kingdisplay_panel_get_modes(struct drm_panel *panel)
> +static int kingdisplay_panel_get_modes(struct drm_panel *panel,
> +				       struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  
> @@ -347,11 +348,11 @@ static int kingdisplay_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 147;
> -	panel->connector->display_info.height_mm = 196;
> -	panel->connector->display_info.bpc = 8;
> +	connector->display_info.width_mm = 147;
> +	connector->display_info.height_mm = 196;
> +	connector->display_info.bpc = 8;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-lg-lb035q02.c b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> index 7a1385e834f0..7a3bd4d80c79 100644
> --- a/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> +++ b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> @@ -141,9 +141,9 @@ static const struct drm_display_mode lb035q02_mode = {
>  	.height_mm = 53,
>  };
>  
> -static int lb035q02_get_modes(struct drm_panel *panel)
> +static int lb035q02_get_modes(struct drm_panel *panel,
> +			      struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &lb035q02_mode);
> diff --git a/drivers/gpu/drm/panel/panel-lg-lg4573.c b/drivers/gpu/drm/panel/panel-lg-lg4573.c
> index db4865a4c2b9..fc6572b4e2f9 100644
> --- a/drivers/gpu/drm/panel/panel-lg-lg4573.c
> +++ b/drivers/gpu/drm/panel/panel-lg-lg4573.c
> @@ -209,9 +209,9 @@ static const struct drm_display_mode default_mode = {
>  	.vrefresh = 60,
>  };
>  
> -static int lg4573_get_modes(struct drm_panel *panel)
> +static int lg4573_get_modes(struct drm_panel *panel,
> +			    struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> @@ -227,8 +227,8 @@ static int lg4573_get_modes(struct drm_panel *panel)
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>  	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 61;
> -	panel->connector->display_info.height_mm = 103;
> +	connector->display_info.width_mm = 61;
> +	connector->display_info.height_mm = 103;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
> index 2405f26e5d31..f6d58a60e514 100644
> --- a/drivers/gpu/drm/panel/panel-lvds.c
> +++ b/drivers/gpu/drm/panel/panel-lvds.c
> @@ -106,10 +106,10 @@ static int panel_lvds_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int panel_lvds_get_modes(struct drm_panel *panel)
> +static int panel_lvds_get_modes(struct drm_panel *panel,
> +				struct drm_connector *connector)
>  {
>  	struct panel_lvds *lvds = to_panel_lvds(panel);
> -	struct drm_connector *connector = lvds->panel.connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_create(lvds->panel.drm);
> diff --git a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> index fd593532ab23..a6ccdb09aace 100644
> --- a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> +++ b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> @@ -123,9 +123,9 @@ static const struct drm_display_mode nl8048_mode = {
>  	.height_mm = 53,
>  };
>  
> -static int nl8048_get_modes(struct drm_panel *panel)
> +static int nl8048_get_modes(struct drm_panel *panel,
> +			    struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &nl8048_mode);
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt39016.c b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> index 60ccedce530c..91ea49c05611 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> @@ -206,11 +206,11 @@ static int nt39016_disable(struct drm_panel *drm_panel)
>  	return 0;
>  }
>  
> -static int nt39016_get_modes(struct drm_panel *drm_panel)
> +static int nt39016_get_modes(struct drm_panel *drm_panel,
> +			     struct drm_connector *connector)
>  {
>  	struct nt39016 *panel = to_nt39016(drm_panel);
>  	const struct nt39016_panel_info *panel_info = panel->panel_info;
> -	struct drm_connector *connector = drm_panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(drm_panel->drm, &panel_info->display_mode);
> diff --git a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> index 8738ef1b66dc..2b7e0dfebc5e 100644
> --- a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> +++ b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> @@ -141,10 +141,10 @@ static int lcd_olinuxino_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int lcd_olinuxino_get_modes(struct drm_panel *panel)
> +static int lcd_olinuxino_get_modes(struct drm_panel *panel,
> +				   struct drm_connector *connector)
>  {
>  	struct lcd_olinuxino *lcd = to_lcd_olinuxino(panel);
> -	struct drm_connector *connector = lcd->panel.connector;
>  	struct lcd_olinuxino_info *lcd_info = &lcd->eeprom.info;
>  	struct drm_device *drm = lcd->panel.drm;
>  	struct lcd_olinuxino_mode *lcd_mode;
> diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> index bf1f928b215f..4e1606c79072 100644
> --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> @@ -349,7 +349,8 @@ static int otm8009a_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int otm8009a_get_modes(struct drm_panel *panel)
> +static int otm8009a_get_modes(struct drm_panel *panel,
> +			      struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  
> @@ -364,10 +365,10 @@ static int otm8009a_get_modes(struct drm_panel *panel)
>  	drm_mode_set_name(mode);
>  
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = mode->width_mm;
> -	panel->connector->display_info.height_mm = mode->height_mm;
> +	connector->display_info.width_mm = mode->width_mm;
> +	connector->display_info.height_mm = mode->height_mm;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> index 2b40913899d8..b3e010288c10 100644
> --- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> +++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> @@ -112,7 +112,8 @@ static const struct drm_display_mode default_mode_osd101t2587 = {
>  	.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
>  };
>  
> -static int osd101t2587_panel_get_modes(struct drm_panel *panel)
> +static int osd101t2587_panel_get_modes(struct drm_panel *panel,
> +				       struct drm_connector *connector)
>  {
>  	struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel);
>  	struct drm_display_mode *mode;
> @@ -128,10 +129,10 @@ static int osd101t2587_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 217;
> -	panel->connector->display_info.height_mm = 136;
> +	connector->display_info.width_mm = 217;
> +	connector->display_info.height_mm = 136;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> index 664605071d34..19a6eb4637c8 100644
> --- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> +++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> @@ -166,7 +166,8 @@ static const struct drm_display_mode default_mode = {
>  	.vrefresh = 60,
>  };
>  
> -static int wuxga_nt_panel_get_modes(struct drm_panel *panel)
> +static int wuxga_nt_panel_get_modes(struct drm_panel *panel,
> +				    struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  
> @@ -180,10 +181,10 @@ static int wuxga_nt_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 217;
> -	panel->connector->display_info.height_mm = 136;
> +	connector->display_info.width_mm = 217;
> +	connector->display_info.height_mm = 136;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> index 09824e92fc78..732b7111395e 100644
> --- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> @@ -311,9 +311,9 @@ static int rpi_touchscreen_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int rpi_touchscreen_get_modes(struct drm_panel *panel)
> +static int rpi_touchscreen_get_modes(struct drm_panel *panel,
> +				     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_device *drm = panel->drm;
>  	unsigned int i, num = 0;
>  	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
> diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> index fd67fc6185c4..123bb68cfcb7 100644
> --- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> +++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> @@ -436,9 +436,9 @@ static int rad_panel_disable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int rad_panel_get_modes(struct drm_panel *panel)
> +static int rad_panel_get_modes(struct drm_panel *panel,
> +			       struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> @@ -451,7 +451,7 @@ static int rad_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
>  	connector->display_info.width_mm = mode->width_mm;
>  	connector->display_info.height_mm = mode->height_mm;
> diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
> index 994e855721f4..66fa975308ec 100644
> --- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c
> +++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
> @@ -335,7 +335,8 @@ static int rm68200_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int rm68200_get_modes(struct drm_panel *panel)
> +static int rm68200_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  
> @@ -350,10 +351,10 @@ static int rm68200_get_modes(struct drm_panel *panel)
>  	drm_mode_set_name(mode);
>  
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = mode->width_mm;
> -	panel->connector->display_info.height_mm = mode->height_mm;
> +	connector->display_info.width_mm = mode->width_mm;
> +	connector->display_info.height_mm = mode->height_mm;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> index 31234b79d3b1..b2d61cab3cad 100644
> --- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> +++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> @@ -230,7 +230,8 @@ static const struct drm_display_mode default_mode = {
>  	.height_mm   = 130,
>  };
>  
> -static int jh057n_get_modes(struct drm_panel *panel)
> +static int jh057n_get_modes(struct drm_panel *panel,
> +			    struct drm_connector *connector)
>  {
>  	struct jh057n *ctx = panel_to_jh057n(panel);
>  	struct drm_display_mode *mode;
> @@ -246,9 +247,9 @@ static int jh057n_get_modes(struct drm_panel *panel)
>  	drm_mode_set_name(mode);
>  
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> -	panel->connector->display_info.width_mm = mode->width_mm;
> -	panel->connector->display_info.height_mm = mode->height_mm;
> -	drm_mode_probed_add(panel->connector, mode);
> +	connector->display_info.width_mm = mode->width_mm;
> +	connector->display_info.height_mm = mode->height_mm;
> +	drm_mode_probed_add(connector, mode);
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> index 170a5cda21b9..57a462ce221e 100644
> --- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> +++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> @@ -120,9 +120,9 @@ static const struct drm_display_mode default_mode = {
>  	.height_mm	= 85,
>  };
>  
> -static int rb070d30_panel_get_modes(struct drm_panel *panel)
> +static int rb070d30_panel_get_modes(struct drm_panel *panel,
> +				    struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);
>  	struct drm_display_mode *mode;
>  	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
> @@ -140,9 +140,9 @@ static int rb070d30_panel_get_modes(struct drm_panel *panel)
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>  	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.bpc = 8;
> -	panel->connector->display_info.width_mm = mode->width_mm;
> -	panel->connector->display_info.height_mm = mode->height_mm;
> +	connector->display_info.bpc = 8;
> +	connector->display_info.width_mm = mode->width_mm;
> +	connector->display_info.height_mm = mode->height_mm;
>  	drm_display_info_set_bus_formats(&connector->display_info,
>  					 &bus_format, 1);
>  
> diff --git a/drivers/gpu/drm/panel/panel-samsung-ld9040.c b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
> index 250809ba37c7..3c52f15f7a1c 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-ld9040.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
> @@ -261,9 +261,9 @@ static int ld9040_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int ld9040_get_modes(struct drm_panel *panel)
> +static int ld9040_get_modes(struct drm_panel *panel,
> +			    struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct ld9040 *ctx = panel_to_ld9040(panel);
>  	struct drm_display_mode *mode;
>  
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> index e3a0397e953e..71939ab757b1 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> @@ -143,9 +143,9 @@ static int s6d16d0_disable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int s6d16d0_get_modes(struct drm_panel *panel)
> +static int s6d16d0_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &samsung_s6d16d0_mode);
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> index 938ab72c5540..8e0236ba6145 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> @@ -645,9 +645,9 @@ static const struct s6e3ha2_panel_desc samsung_s6e3hf2 = {
>  	.type = HF2_TYPE,
>  };
>  
> -static int s6e3ha2_get_modes(struct drm_panel *panel)
> +static int s6e3ha2_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
>  	struct drm_display_mode *mode;
>  
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> index a60635e9226d..c939d5bde4f0 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> @@ -400,9 +400,9 @@ static int s6e63j0x03_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int s6e63j0x03_get_modes(struct drm_panel *panel)
> +static int s6e63j0x03_get_modes(struct drm_panel *panel,
> +				struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> index ba01af0b14fd..1d099092e754 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> @@ -362,9 +362,9 @@ static int s6e63m0_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int s6e63m0_get_modes(struct drm_panel *panel)
> +static int s6e63m0_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> index dbced6501204..8a028d2bd0d6 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> @@ -920,9 +920,9 @@ static int s6e8aa0_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int s6e8aa0_get_modes(struct drm_panel *panel)
> +static int s6e8aa0_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct s6e8aa0 *ctx = panel_to_s6e8aa0(panel);
>  	struct drm_display_mode *mode;
>  
> diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> index b3619ba443bd..b878930b17e4 100644
> --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> @@ -56,9 +56,9 @@ static inline struct seiko_panel *to_seiko_panel(struct drm_panel *panel)
>  	return container_of(panel, struct seiko_panel, base);
>  }
>  
> -static int seiko_panel_get_fixed_modes(struct seiko_panel *panel)
> +static int seiko_panel_get_fixed_modes(struct seiko_panel *panel,
> +				       struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->base.connector;
>  	struct drm_device *drm = panel->base.drm;
>  	struct drm_display_mode *mode;
>  	unsigned int i, num = 0;
> @@ -208,12 +208,13 @@ static int seiko_panel_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int seiko_panel_get_modes(struct drm_panel *panel)
> +static int seiko_panel_get_modes(struct drm_panel *panel,
> +				 struct drm_connector *connector)
>  {
>  	struct seiko_panel *p = to_seiko_panel(panel);
>  
>  	/* add hard-coded panel modes */
> -	return seiko_panel_get_fixed_modes(p);
> +	return seiko_panel_get_fixed_modes(p, connector);
>  }
>  
>  static int seiko_panel_get_timings(struct drm_panel *panel,
> diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> index 5e136c3ba185..e797b700661a 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> @@ -278,7 +278,8 @@ static const struct drm_display_mode default_mode = {
>  	.vrefresh = 60,
>  };
>  
> -static int sharp_panel_get_modes(struct drm_panel *panel)
> +static int sharp_panel_get_modes(struct drm_panel *panel,
> +				 struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  
> @@ -292,10 +293,10 @@ static int sharp_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 217;
> -	panel->connector->display_info.height_mm = 136;
> +	connector->display_info.width_mm = 217;
> +	connector->display_info.height_mm = 136;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> index eeab7998c7de..7103a945f0e8 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> @@ -100,9 +100,9 @@ static const struct drm_display_mode ls037v7dw01_mode = {
>  	.height_mm = 75,
>  };
>  
> -static int ls037v7dw01_get_modes(struct drm_panel *panel)
> +static int ls037v7dw01_get_modes(struct drm_panel *panel,
> +				 struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &ls037v7dw01_mode);
> diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> index b963ba4ab589..85ae6cffdbfb 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> @@ -210,7 +210,8 @@ static const struct drm_display_mode default_mode = {
>  	.vrefresh = 60,
>  };
>  
> -static int sharp_nt_panel_get_modes(struct drm_panel *panel)
> +static int sharp_nt_panel_get_modes(struct drm_panel *panel,
> +				    struct drm_connector *connector)
>  {
>  	struct drm_display_mode *mode;
>  
> @@ -224,10 +225,10 @@ static int sharp_nt_panel_get_modes(struct drm_panel *panel)
>  
>  	drm_mode_set_name(mode);
>  
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 54;
> -	panel->connector->display_info.height_mm = 95;
> +	connector->display_info.width_mm = 54;
> +	connector->display_info.height_mm = 95;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index a5df6d6dd455..d6299fe6d276 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -117,9 +117,9 @@ static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
>  	return container_of(panel, struct panel_simple, base);
>  }
>  
> -static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel)
> +static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel,
> +						   struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->base.connector;
>  	struct drm_device *drm = panel->base.drm;
>  	struct drm_display_mode *mode;
>  	unsigned int i, num = 0;
> @@ -150,9 +150,9 @@ static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel)
>  	return num;
>  }
>  
> -static unsigned int panel_simple_get_display_modes(struct panel_simple *panel)
> +static unsigned int panel_simple_get_display_modes(struct panel_simple *panel,
> +						   struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->base.connector;
>  	struct drm_device *drm = panel->base.drm;
>  	struct drm_display_mode *mode;
>  	unsigned int i, num = 0;
> @@ -181,9 +181,9 @@ static unsigned int panel_simple_get_display_modes(struct panel_simple *panel)
>  	return num;
>  }
>  
> -static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
> +static int panel_simple_get_non_edid_modes(struct panel_simple *panel,
> +					   struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->base.connector;
>  	struct drm_device *drm = panel->base.drm;
>  	struct drm_display_mode *mode;
>  	bool has_override = panel->override_mode.type;
> @@ -204,7 +204,7 @@ static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
>  
>  	/* Only add timings if override was not there or failed to validate */
>  	if (num == 0 && panel->desc->num_timings)
> -		num = panel_simple_get_timings_modes(panel);
> +		num = panel_simple_get_timings_modes(panel, connector);
>  
>  	/*
>  	 * Only add fixed modes if timings/override added no mode.
> @@ -214,7 +214,7 @@ static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
>  	 */
>  	WARN_ON(panel->desc->num_timings && panel->desc->num_modes);
>  	if (num == 0)
> -		num = panel_simple_get_display_modes(panel);
> +		num = panel_simple_get_display_modes(panel, connector);
>  
>  	connector->display_info.bpc = panel->desc->bpc;
>  	connector->display_info.width_mm = panel->desc->size.width;
> @@ -304,23 +304,24 @@ static int panel_simple_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int panel_simple_get_modes(struct drm_panel *panel)
> +static int panel_simple_get_modes(struct drm_panel *panel,
> +				  struct drm_connector *connector)
>  {
>  	struct panel_simple *p = to_panel_simple(panel);
>  	int num = 0;
>  
>  	/* probe EDID if a DDC bus is available */
>  	if (p->ddc) {
> -		struct edid *edid = drm_get_edid(panel->connector, p->ddc);
> -		drm_connector_update_edid_property(panel->connector, edid);
> +		struct edid *edid = drm_get_edid(connector, p->ddc);
> +		drm_connector_update_edid_property(connector, edid);
>  		if (edid) {
> -			num += drm_add_edid_modes(panel->connector, edid);
> +			num += drm_add_edid_modes(connector, edid);
>  			kfree(edid);
>  		}
>  	}
>  
>  	/* add hard-coded panel modes */
> -	num += panel_simple_get_non_edid_modes(p);
> +	num += panel_simple_get_non_edid_modes(p, connector);
>  
>  	return num;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> index ee3f23f45755..3ed3b1d6d82d 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> @@ -264,7 +264,8 @@ static int st7701_unprepare(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int st7701_get_modes(struct drm_panel *panel)
> +static int st7701_get_modes(struct drm_panel *panel,
> +			    struct drm_connector *connector)
>  {
>  	struct st7701 *st7701 = panel_to_st7701(panel);
>  	const struct drm_display_mode *desc_mode = st7701->desc->mode;
> @@ -280,10 +281,10 @@ static int st7701_get_modes(struct drm_panel *panel)
>  	}
>  
>  	drm_mode_set_name(mode);
> -	drm_mode_probed_add(panel->connector, mode);
> +	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = desc_mode->width_mm;
> -	panel->connector->display_info.height_mm = desc_mode->height_mm;
> +	connector->display_info.width_mm = desc_mode->width_mm;
> +	connector->display_info.height_mm = desc_mode->height_mm;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> index 108a85bb6667..836b01331505 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> @@ -170,9 +170,9 @@ static const struct drm_display_mode default_mode = {
>  	.vrefresh = 60,
>  };
>  
> -static int st7789v_get_modes(struct drm_panel *panel)
> +static int st7789v_get_modes(struct drm_panel *panel,
> +			     struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> @@ -188,8 +188,8 @@ static int st7789v_get_modes(struct drm_panel *panel)
>  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>  	drm_mode_probed_add(connector, mode);
>  
> -	panel->connector->display_info.width_mm = 61;
> -	panel->connector->display_info.height_mm = 103;
> +	connector->display_info.width_mm = 61;
> +	connector->display_info.height_mm = 103;
>  
>  	return 1;
>  }
> diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> index d6387d8f88a3..841dc73c443d 100644
> --- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> +++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> @@ -521,9 +521,9 @@ static const struct drm_display_mode acx565akm_mode = {
>  	.height_mm = 46,
>  };
>  
> -static int acx565akm_get_modes(struct drm_panel *panel)
> +static int acx565akm_get_modes(struct drm_panel *panel,
> +			       struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &acx565akm_mode);
> diff --git a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> index c44d6a65c0aa..5230176bd8e6 100644
> --- a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> +++ b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> @@ -287,9 +287,9 @@ static const struct drm_display_mode td028ttec1_mode = {
>  	.height_mm = 58,
>  };
>  
> -static int td028ttec1_get_modes(struct drm_panel *panel)
> +static int td028ttec1_get_modes(struct drm_panel *panel,
> +				struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &td028ttec1_mode);
> diff --git a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> index 621b65feec07..716f8ed1cc45 100644
> --- a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> +++ b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> @@ -346,9 +346,9 @@ static const struct drm_display_mode td043mtea1_mode = {
>  	.height_mm = 56,
>  };
>  
> -static int td043mtea1_get_modes(struct drm_panel *panel)
> +static int td043mtea1_get_modes(struct drm_panel *panel,
> +				struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct drm_display_mode *mode;
>  
>  	mode = drm_mode_duplicate(panel->drm, &td043mtea1_mode);
> diff --git a/drivers/gpu/drm/panel/panel-tpo-tpg110.c b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> index 1a5418ae2ccf..e74cd9d418cf 100644
> --- a/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> +++ b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> @@ -384,9 +384,9 @@ static int tpg110_enable(struct drm_panel *panel)
>   * presents the mode that is configured for the system under use,
>   * and which is detected by reading the registers of the display.
>   */
> -static int tpg110_get_modes(struct drm_panel *panel)
> +static int tpg110_get_modes(struct drm_panel *panel,
> +			    struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct tpg110 *tpg = to_tpg110(panel);
>  	struct drm_display_mode *mode;
>  
> diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c b/drivers/gpu/drm/panel/panel-truly-nt35597.c
> index 0feea2456e14..012ca62bf30e 100644
> --- a/drivers/gpu/drm/panel/panel-truly-nt35597.c
> +++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c
> @@ -454,9 +454,9 @@ static int truly_nt35597_enable(struct drm_panel *panel)
>  	return 0;
>  }
>  
> -static int truly_nt35597_get_modes(struct drm_panel *panel)
> +static int truly_nt35597_get_modes(struct drm_panel *panel,
> +				   struct drm_connector *connector)
>  {
> -	struct drm_connector *connector = panel->connector;
>  	struct truly_nt35597 *ctx = panel_to_ctx(panel);
>  	struct drm_display_mode *mode;
>  	const struct nt35597_config *config;
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index d30c98567384..a5f7199807f2 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -100,7 +100,8 @@ struct drm_panel_funcs {
>  	 * Add modes to the connector that the panel is attached to and
>  	 * return the number of modes added.
>  	 */
> -	int (*get_modes)(struct drm_panel *panel);
> +	int (*get_modes)(struct drm_panel *panel,
> +			 struct drm_connector *connector);
>  
>  	/**
>  	 * @get_timings:
> -- 
> 2.20.1
> 
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH v1 05/26] drm/panel: add drm_connector argument to get_modes()
  2019-12-04 12:08   ` Guido Günther
@ 2019-12-04 13:11     ` Laurent Pinchart
  0 siblings, 0 replies; 54+ messages in thread
From: Laurent Pinchart @ 2019-12-04 13:11 UTC (permalink / raw)
  To: Guido Günther
  Cc: Neil Armstrong, David Airlie, Linus Walleij, dri-devel,
	Andrzej Hajda, Thierry Reding, Benjamin Gaignard, Sam Ravnborg,
	Stefan Agner, linux-samsung-soc, Stefan Mavrodiev,
	linux-rockchip, Tomi Valkeinen, NXP Linux Team, Robert Chiras,
	Jagan Teki, Jitao Shi, Pengutronix Kernel Team,
	Maarten Lankhorst, Maxime Ripard, linux-mediatek, Abhinav Kumar,
	linux-tegra, Sean Paul, linux-arm-kernel, Purism Kernel Team,
	linux-renesas-soc, Boris Brezillon, Daniel Vetter

Hi Guido,

On Wed, Dec 04, 2019 at 01:08:04PM +0100, Guido Günther wrote:
> On Mon, Dec 02, 2019 at 08:32:09PM +0100, Sam Ravnborg wrote:
> > Today the bridge creates the drm_connector, but that is planned
> > to be moved to the display drivers.
> 
> Do you have a reference for that move at hand?

https://patchwork.kernel.org/cover/10805353/

Not something that will be enforced right away, but I think it will
simplify display controller drivers, so I'll advocate switching to that
model.

> > To facilitate this, update drm_panel_funcs.get_modes() to
> > take drm_connector as an argument.
> > All panel drivers implementing get_modes() are updated.
> > 
> > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <mripard@kernel.org>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Jagan Teki <jagan@amarulasolutions.com>
> > Cc: Stefan Mavrodiev <stefan@olimex.com>
> > Cc: Robert Chiras <robert.chiras@nxp.com>
> > Cc: "Guido Günther" <agx@sigxcpu.org>
> > Cc: Purism Kernel Team <kernel@puri.sm>
> > ---
> >  drivers/gpu/drm/drm_panel.c                   |  2 +-
> >  drivers/gpu/drm/panel/panel-arm-versatile.c   |  4 +--
> >  .../drm/panel/panel-feiyang-fy07024di26a30d.c |  4 +--
> >  drivers/gpu/drm/panel/panel-ilitek-ili9322.c  |  5 ++--
> >  drivers/gpu/drm/panel/panel-ilitek-ili9881c.c |  8 +++---
> >  drivers/gpu/drm/panel/panel-innolux-p079zca.c | 13 +++++----
> >  .../gpu/drm/panel/panel-jdi-lt070me05000.c    |  9 ++++---
> >  .../drm/panel/panel-kingdisplay-kd097d04.c    | 11 ++++----
> >  drivers/gpu/drm/panel/panel-lg-lb035q02.c     |  4 +--
> >  drivers/gpu/drm/panel/panel-lg-lg4573.c       |  8 +++---
> >  drivers/gpu/drm/panel/panel-lvds.c            |  4 +--
> >  drivers/gpu/drm/panel/panel-nec-nl8048hl11.c  |  4 +--
> >  drivers/gpu/drm/panel/panel-novatek-nt39016.c |  4 +--
> >  .../drm/panel/panel-olimex-lcd-olinuxino.c    |  4 +--
> >  .../gpu/drm/panel/panel-orisetech-otm8009a.c  |  9 ++++---
> >  .../drm/panel/panel-osd-osd101t2587-53ts.c    |  9 ++++---
> >  .../drm/panel/panel-panasonic-vvx10f034n00.c  |  9 ++++---
> >  .../drm/panel/panel-raspberrypi-touchscreen.c |  4 +--
> >  drivers/gpu/drm/panel/panel-raydium-rm67191.c |  6 ++---
> >  drivers/gpu/drm/panel/panel-raydium-rm68200.c |  9 ++++---
> >  .../drm/panel/panel-rocktech-jh057n00900.c    |  9 ++++---
> >  drivers/gpu/drm/panel/panel-ronbo-rb070d30.c  | 10 +++----
> >  drivers/gpu/drm/panel/panel-samsung-ld9040.c  |  4 +--
> >  drivers/gpu/drm/panel/panel-samsung-s6d16d0.c |  4 +--
> >  drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c |  4 +--
> >  .../gpu/drm/panel/panel-samsung-s6e63j0x03.c  |  4 +--
> >  drivers/gpu/drm/panel/panel-samsung-s6e63m0.c |  4 +--
> >  drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c |  4 +--
> >  drivers/gpu/drm/panel/panel-seiko-43wvf1g.c   |  9 ++++---
> >  .../gpu/drm/panel/panel-sharp-lq101r1sx01.c   |  9 ++++---
> >  .../gpu/drm/panel/panel-sharp-ls037v7dw01.c   |  4 +--
> >  .../gpu/drm/panel/panel-sharp-ls043t1le01.c   |  9 ++++---
> >  drivers/gpu/drm/panel/panel-simple.c          | 27 ++++++++++---------
> >  drivers/gpu/drm/panel/panel-sitronix-st7701.c |  9 ++++---
> >  .../gpu/drm/panel/panel-sitronix-st7789v.c    |  8 +++---
> >  drivers/gpu/drm/panel/panel-sony-acx565akm.c  |  4 +--
> >  drivers/gpu/drm/panel/panel-tpo-td028ttec1.c  |  4 +--
> >  drivers/gpu/drm/panel/panel-tpo-td043mtea1.c  |  4 +--
> >  drivers/gpu/drm/panel/panel-tpo-tpg110.c      |  4 +--
> >  drivers/gpu/drm/panel/panel-truly-nt35597.c   |  4 +--
> >  include/drm/drm_panel.h                       |  3 ++-
> >  41 files changed, 141 insertions(+), 130 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> > index 35609c90e467..9927e28d93e6 100644
> > --- a/drivers/gpu/drm/drm_panel.c
> > +++ b/drivers/gpu/drm/drm_panel.c
> > @@ -252,7 +252,7 @@ int drm_panel_get_modes(struct drm_panel *panel)
> >  		return -EINVAL;
> >  
> >  	if (panel->funcs && panel->funcs->get_modes)
> > -		return panel->funcs->get_modes(panel);
> > +		return panel->funcs->get_modes(panel, panel->connector);
> >  
> >  	return 0;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-arm-versatile.c b/drivers/gpu/drm/panel/panel-arm-versatile.c
> > index a0574dc03e16..41aa91f60979 100644
> > --- a/drivers/gpu/drm/panel/panel-arm-versatile.c
> > +++ b/drivers/gpu/drm/panel/panel-arm-versatile.c
> > @@ -260,9 +260,9 @@ static int versatile_panel_enable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int versatile_panel_get_modes(struct drm_panel *panel)
> > +static int versatile_panel_get_modes(struct drm_panel *panel,
> > +				     struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct versatile_panel *vpanel = to_versatile_panel(panel);
> >  	struct drm_display_mode *mode;
> >  
> > diff --git a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> > index 98f184b81187..37d6b7390954 100644
> > --- a/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> > +++ b/drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
> > @@ -162,9 +162,9 @@ static const struct drm_display_mode feiyang_default_mode = {
> >  	.type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
> >  };
> >  
> > -static int feiyang_get_modes(struct drm_panel *panel)
> > +static int feiyang_get_modes(struct drm_panel *panel,
> > +			     struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct feiyang *ctx = panel_to_feiyang(panel);
> >  	struct drm_display_mode *mode;
> >  
> > diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> > index 24955bec1958..8fd4c0521841 100644
> > --- a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> > +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
> > @@ -641,9 +641,9 @@ static const struct drm_display_mode itu_r_bt_656_720_mode = {
> >  	.flags = 0,
> >  };
> >  
> > -static int ili9322_get_modes(struct drm_panel *panel)
> > +static int ili9322_get_modes(struct drm_panel *panel,
> > +			     struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct ili9322 *ili = panel_to_ili9322(panel);
> >  	struct drm_display_mode *mode;
> >  	struct drm_display_info *info;
> > @@ -655,7 +655,6 @@ static int ili9322_get_modes(struct drm_panel *panel)
> >  		info->bus_flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE;
> >  	else
> >  		info->bus_flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE;
> > -
> >  	if (ili->conf->de_active_high)
> >  		info->bus_flags |= DRM_BUS_FLAG_DE_HIGH;
> >  	else
> > diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> > index e8789e460a16..1c67a668d6bf 100644
> > --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> > +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> > @@ -387,9 +387,9 @@ static const struct drm_display_mode bananapi_default_mode = {
> >  	.vtotal		= 1280 + 10 + 10 + 20,
> >  };
> >  
> > -static int ili9881c_get_modes(struct drm_panel *panel)
> > +static int ili9881c_get_modes(struct drm_panel *panel,
> > +			      struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct ili9881c *ctx = panel_to_ili9881c(panel);
> >  	struct drm_display_mode *mode;
> >  
> > @@ -407,8 +407,8 @@ static int ili9881c_get_modes(struct drm_panel *panel)
> >  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> >  	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.width_mm = 62;
> > -	panel->connector->display_info.height_mm = 110;
> > +	connector->display_info.width_mm = 62;
> > +	connector->display_info.height_mm = 110;
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> > index 83df1ac4211f..facf1bab2532 100644
> > --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> > +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> > @@ -403,7 +403,8 @@ static const struct panel_desc innolux_p097pfg_panel_desc = {
> >  	.sleep_mode_delay = 100, /* T15 */
> >  };
> >  
> > -static int innolux_panel_get_modes(struct drm_panel *panel)
> > +static int innolux_panel_get_modes(struct drm_panel *panel,
> > +				   struct drm_connector *connector)
> >  {
> >  	struct innolux_panel *innolux = to_innolux_panel(panel);
> >  	const struct drm_display_mode *m = innolux->desc->mode;
> > @@ -418,13 +419,11 @@ static int innolux_panel_get_modes(struct drm_panel *panel)
> >  
> >  	drm_mode_set_name(mode);
> >  
> > -	drm_mode_probed_add(panel->connector, mode);
> > +	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.width_mm =
> > -			innolux->desc->size.width;
> > -	panel->connector->display_info.height_mm =
> > -			innolux->desc->size.height;
> > -	panel->connector->display_info.bpc = innolux->desc->bpc;
> > +	connector->display_info.width_mm = innolux->desc->size.width;
> > +	connector->display_info.height_mm = innolux->desc->size.height;
> > +	connector->display_info.bpc = innolux->desc->bpc;
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> > index 56364a93f0b8..e6b650a64fdb 100644
> > --- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> > +++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> > @@ -300,7 +300,8 @@ static const struct drm_display_mode default_mode = {
> >  		.flags = 0,
> >  };
> >  
> > -static int jdi_panel_get_modes(struct drm_panel *panel)
> > +static int jdi_panel_get_modes(struct drm_panel *panel,
> > +			       struct drm_connector *connector)
> >  {
> >  	struct drm_display_mode *mode;
> >  	struct jdi_panel *jdi = to_jdi_panel(panel);
> > @@ -316,10 +317,10 @@ static int jdi_panel_get_modes(struct drm_panel *panel)
> >  
> >  	drm_mode_set_name(mode);
> >  
> > -	drm_mode_probed_add(panel->connector, mode);
> > +	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.width_mm = 95;
> > -	panel->connector->display_info.height_mm = 151;
> > +	connector->display_info.width_mm = 95;
> > +	connector->display_info.height_mm = 151;
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> > index 45f96556ec8c..e6f53d56daf9 100644
> > --- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> > +++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> > @@ -333,7 +333,8 @@ static const struct drm_display_mode default_mode = {
> >  	.vrefresh = 60,
> >  };
> >  
> > -static int kingdisplay_panel_get_modes(struct drm_panel *panel)
> > +static int kingdisplay_panel_get_modes(struct drm_panel *panel,
> > +				       struct drm_connector *connector)
> >  {
> >  	struct drm_display_mode *mode;
> >  
> > @@ -347,11 +348,11 @@ static int kingdisplay_panel_get_modes(struct drm_panel *panel)
> >  
> >  	drm_mode_set_name(mode);
> >  
> > -	drm_mode_probed_add(panel->connector, mode);
> > +	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.width_mm = 147;
> > -	panel->connector->display_info.height_mm = 196;
> > -	panel->connector->display_info.bpc = 8;
> > +	connector->display_info.width_mm = 147;
> > +	connector->display_info.height_mm = 196;
> > +	connector->display_info.bpc = 8;
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-lg-lb035q02.c b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> > index 7a1385e834f0..7a3bd4d80c79 100644
> > --- a/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> > +++ b/drivers/gpu/drm/panel/panel-lg-lb035q02.c
> > @@ -141,9 +141,9 @@ static const struct drm_display_mode lb035q02_mode = {
> >  	.height_mm = 53,
> >  };
> >  
> > -static int lb035q02_get_modes(struct drm_panel *panel)
> > +static int lb035q02_get_modes(struct drm_panel *panel,
> > +			      struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_duplicate(panel->drm, &lb035q02_mode);
> > diff --git a/drivers/gpu/drm/panel/panel-lg-lg4573.c b/drivers/gpu/drm/panel/panel-lg-lg4573.c
> > index db4865a4c2b9..fc6572b4e2f9 100644
> > --- a/drivers/gpu/drm/panel/panel-lg-lg4573.c
> > +++ b/drivers/gpu/drm/panel/panel-lg-lg4573.c
> > @@ -209,9 +209,9 @@ static const struct drm_display_mode default_mode = {
> >  	.vrefresh = 60,
> >  };
> >  
> > -static int lg4573_get_modes(struct drm_panel *panel)
> > +static int lg4573_get_modes(struct drm_panel *panel,
> > +			    struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> > @@ -227,8 +227,8 @@ static int lg4573_get_modes(struct drm_panel *panel)
> >  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> >  	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.width_mm = 61;
> > -	panel->connector->display_info.height_mm = 103;
> > +	connector->display_info.width_mm = 61;
> > +	connector->display_info.height_mm = 103;
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
> > index 2405f26e5d31..f6d58a60e514 100644
> > --- a/drivers/gpu/drm/panel/panel-lvds.c
> > +++ b/drivers/gpu/drm/panel/panel-lvds.c
> > @@ -106,10 +106,10 @@ static int panel_lvds_enable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int panel_lvds_get_modes(struct drm_panel *panel)
> > +static int panel_lvds_get_modes(struct drm_panel *panel,
> > +				struct drm_connector *connector)
> >  {
> >  	struct panel_lvds *lvds = to_panel_lvds(panel);
> > -	struct drm_connector *connector = lvds->panel.connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_create(lvds->panel.drm);
> > diff --git a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> > index fd593532ab23..a6ccdb09aace 100644
> > --- a/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> > +++ b/drivers/gpu/drm/panel/panel-nec-nl8048hl11.c
> > @@ -123,9 +123,9 @@ static const struct drm_display_mode nl8048_mode = {
> >  	.height_mm = 53,
> >  };
> >  
> > -static int nl8048_get_modes(struct drm_panel *panel)
> > +static int nl8048_get_modes(struct drm_panel *panel,
> > +			    struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_duplicate(panel->drm, &nl8048_mode);
> > diff --git a/drivers/gpu/drm/panel/panel-novatek-nt39016.c b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> > index 60ccedce530c..91ea49c05611 100644
> > --- a/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> > +++ b/drivers/gpu/drm/panel/panel-novatek-nt39016.c
> > @@ -206,11 +206,11 @@ static int nt39016_disable(struct drm_panel *drm_panel)
> >  	return 0;
> >  }
> >  
> > -static int nt39016_get_modes(struct drm_panel *drm_panel)
> > +static int nt39016_get_modes(struct drm_panel *drm_panel,
> > +			     struct drm_connector *connector)
> >  {
> >  	struct nt39016 *panel = to_nt39016(drm_panel);
> >  	const struct nt39016_panel_info *panel_info = panel->panel_info;
> > -	struct drm_connector *connector = drm_panel->connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_duplicate(drm_panel->drm, &panel_info->display_mode);
> > diff --git a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> > index 8738ef1b66dc..2b7e0dfebc5e 100644
> > --- a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> > +++ b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
> > @@ -141,10 +141,10 @@ static int lcd_olinuxino_enable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int lcd_olinuxino_get_modes(struct drm_panel *panel)
> > +static int lcd_olinuxino_get_modes(struct drm_panel *panel,
> > +				   struct drm_connector *connector)
> >  {
> >  	struct lcd_olinuxino *lcd = to_lcd_olinuxino(panel);
> > -	struct drm_connector *connector = lcd->panel.connector;
> >  	struct lcd_olinuxino_info *lcd_info = &lcd->eeprom.info;
> >  	struct drm_device *drm = lcd->panel.drm;
> >  	struct lcd_olinuxino_mode *lcd_mode;
> > diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> > index bf1f928b215f..4e1606c79072 100644
> > --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> > +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> > @@ -349,7 +349,8 @@ static int otm8009a_enable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int otm8009a_get_modes(struct drm_panel *panel)
> > +static int otm8009a_get_modes(struct drm_panel *panel,
> > +			      struct drm_connector *connector)
> >  {
> >  	struct drm_display_mode *mode;
> >  
> > @@ -364,10 +365,10 @@ static int otm8009a_get_modes(struct drm_panel *panel)
> >  	drm_mode_set_name(mode);
> >  
> >  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> > -	drm_mode_probed_add(panel->connector, mode);
> > +	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.width_mm = mode->width_mm;
> > -	panel->connector->display_info.height_mm = mode->height_mm;
> > +	connector->display_info.width_mm = mode->width_mm;
> > +	connector->display_info.height_mm = mode->height_mm;
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> > index 2b40913899d8..b3e010288c10 100644
> > --- a/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> > +++ b/drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
> > @@ -112,7 +112,8 @@ static const struct drm_display_mode default_mode_osd101t2587 = {
> >  	.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
> >  };
> >  
> > -static int osd101t2587_panel_get_modes(struct drm_panel *panel)
> > +static int osd101t2587_panel_get_modes(struct drm_panel *panel,
> > +				       struct drm_connector *connector)
> >  {
> >  	struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel);
> >  	struct drm_display_mode *mode;
> > @@ -128,10 +129,10 @@ static int osd101t2587_panel_get_modes(struct drm_panel *panel)
> >  
> >  	drm_mode_set_name(mode);
> >  
> > -	drm_mode_probed_add(panel->connector, mode);
> > +	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.width_mm = 217;
> > -	panel->connector->display_info.height_mm = 136;
> > +	connector->display_info.width_mm = 217;
> > +	connector->display_info.height_mm = 136;
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> > index 664605071d34..19a6eb4637c8 100644
> > --- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> > +++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
> > @@ -166,7 +166,8 @@ static const struct drm_display_mode default_mode = {
> >  	.vrefresh = 60,
> >  };
> >  
> > -static int wuxga_nt_panel_get_modes(struct drm_panel *panel)
> > +static int wuxga_nt_panel_get_modes(struct drm_panel *panel,
> > +				    struct drm_connector *connector)
> >  {
> >  	struct drm_display_mode *mode;
> >  
> > @@ -180,10 +181,10 @@ static int wuxga_nt_panel_get_modes(struct drm_panel *panel)
> >  
> >  	drm_mode_set_name(mode);
> >  
> > -	drm_mode_probed_add(panel->connector, mode);
> > +	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.width_mm = 217;
> > -	panel->connector->display_info.height_mm = 136;
> > +	connector->display_info.width_mm = 217;
> > +	connector->display_info.height_mm = 136;
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> > index 09824e92fc78..732b7111395e 100644
> > --- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> > +++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
> > @@ -311,9 +311,9 @@ static int rpi_touchscreen_enable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int rpi_touchscreen_get_modes(struct drm_panel *panel)
> > +static int rpi_touchscreen_get_modes(struct drm_panel *panel,
> > +				     struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct drm_device *drm = panel->drm;
> >  	unsigned int i, num = 0;
> >  	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
> > diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> > index fd67fc6185c4..123bb68cfcb7 100644
> > --- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> > +++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> > @@ -436,9 +436,9 @@ static int rad_panel_disable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int rad_panel_get_modes(struct drm_panel *panel)
> > +static int rad_panel_get_modes(struct drm_panel *panel,
> > +			       struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> > @@ -451,7 +451,7 @@ static int rad_panel_get_modes(struct drm_panel *panel)
> >  
> >  	drm_mode_set_name(mode);
> >  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> > -	drm_mode_probed_add(panel->connector, mode);
> > +	drm_mode_probed_add(connector, mode);
> >  
> >  	connector->display_info.width_mm = mode->width_mm;
> >  	connector->display_info.height_mm = mode->height_mm;
> > diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
> > index 994e855721f4..66fa975308ec 100644
> > --- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c
> > +++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c
> > @@ -335,7 +335,8 @@ static int rm68200_enable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int rm68200_get_modes(struct drm_panel *panel)
> > +static int rm68200_get_modes(struct drm_panel *panel,
> > +			     struct drm_connector *connector)
> >  {
> >  	struct drm_display_mode *mode;
> >  
> > @@ -350,10 +351,10 @@ static int rm68200_get_modes(struct drm_panel *panel)
> >  	drm_mode_set_name(mode);
> >  
> >  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> > -	drm_mode_probed_add(panel->connector, mode);
> > +	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.width_mm = mode->width_mm;
> > -	panel->connector->display_info.height_mm = mode->height_mm;
> > +	connector->display_info.width_mm = mode->width_mm;
> > +	connector->display_info.height_mm = mode->height_mm;
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> > index 31234b79d3b1..b2d61cab3cad 100644
> > --- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> > +++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> > @@ -230,7 +230,8 @@ static const struct drm_display_mode default_mode = {
> >  	.height_mm   = 130,
> >  };
> >  
> > -static int jh057n_get_modes(struct drm_panel *panel)
> > +static int jh057n_get_modes(struct drm_panel *panel,
> > +			    struct drm_connector *connector)
> >  {
> >  	struct jh057n *ctx = panel_to_jh057n(panel);
> >  	struct drm_display_mode *mode;
> > @@ -246,9 +247,9 @@ static int jh057n_get_modes(struct drm_panel *panel)
> >  	drm_mode_set_name(mode);
> >  
> >  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> > -	panel->connector->display_info.width_mm = mode->width_mm;
> > -	panel->connector->display_info.height_mm = mode->height_mm;
> > -	drm_mode_probed_add(panel->connector, mode);
> > +	connector->display_info.width_mm = mode->width_mm;
> > +	connector->display_info.height_mm = mode->height_mm;
> > +	drm_mode_probed_add(connector, mode);
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> > index 170a5cda21b9..57a462ce221e 100644
> > --- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> > +++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> > @@ -120,9 +120,9 @@ static const struct drm_display_mode default_mode = {
> >  	.height_mm	= 85,
> >  };
> >  
> > -static int rb070d30_panel_get_modes(struct drm_panel *panel)
> > +static int rb070d30_panel_get_modes(struct drm_panel *panel,
> > +				    struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);
> >  	struct drm_display_mode *mode;
> >  	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
> > @@ -140,9 +140,9 @@ static int rb070d30_panel_get_modes(struct drm_panel *panel)
> >  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> >  	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.bpc = 8;
> > -	panel->connector->display_info.width_mm = mode->width_mm;
> > -	panel->connector->display_info.height_mm = mode->height_mm;
> > +	connector->display_info.bpc = 8;
> > +	connector->display_info.width_mm = mode->width_mm;
> > +	connector->display_info.height_mm = mode->height_mm;
> >  	drm_display_info_set_bus_formats(&connector->display_info,
> >  					 &bus_format, 1);
> >  
> > diff --git a/drivers/gpu/drm/panel/panel-samsung-ld9040.c b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
> > index 250809ba37c7..3c52f15f7a1c 100644
> > --- a/drivers/gpu/drm/panel/panel-samsung-ld9040.c
> > +++ b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
> > @@ -261,9 +261,9 @@ static int ld9040_enable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int ld9040_get_modes(struct drm_panel *panel)
> > +static int ld9040_get_modes(struct drm_panel *panel,
> > +			    struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct ld9040 *ctx = panel_to_ld9040(panel);
> >  	struct drm_display_mode *mode;
> >  
> > diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> > index e3a0397e953e..71939ab757b1 100644
> > --- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> > +++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
> > @@ -143,9 +143,9 @@ static int s6d16d0_disable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int s6d16d0_get_modes(struct drm_panel *panel)
> > +static int s6d16d0_get_modes(struct drm_panel *panel,
> > +			     struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_duplicate(panel->drm, &samsung_s6d16d0_mode);
> > diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> > index 938ab72c5540..8e0236ba6145 100644
> > --- a/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> > +++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> > @@ -645,9 +645,9 @@ static const struct s6e3ha2_panel_desc samsung_s6e3hf2 = {
> >  	.type = HF2_TYPE,
> >  };
> >  
> > -static int s6e3ha2_get_modes(struct drm_panel *panel)
> > +static int s6e3ha2_get_modes(struct drm_panel *panel,
> > +			     struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
> >  	struct drm_display_mode *mode;
> >  
> > diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> > index a60635e9226d..c939d5bde4f0 100644
> > --- a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> > +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
> > @@ -400,9 +400,9 @@ static int s6e63j0x03_enable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int s6e63j0x03_get_modes(struct drm_panel *panel)
> > +static int s6e63j0x03_get_modes(struct drm_panel *panel,
> > +				struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> > diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> > index ba01af0b14fd..1d099092e754 100644
> > --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> > +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> > @@ -362,9 +362,9 @@ static int s6e63m0_enable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int s6e63m0_get_modes(struct drm_panel *panel)
> > +static int s6e63m0_get_modes(struct drm_panel *panel,
> > +			     struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> > diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> > index dbced6501204..8a028d2bd0d6 100644
> > --- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> > +++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
> > @@ -920,9 +920,9 @@ static int s6e8aa0_enable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int s6e8aa0_get_modes(struct drm_panel *panel)
> > +static int s6e8aa0_get_modes(struct drm_panel *panel,
> > +			     struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct s6e8aa0 *ctx = panel_to_s6e8aa0(panel);
> >  	struct drm_display_mode *mode;
> >  
> > diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> > index b3619ba443bd..b878930b17e4 100644
> > --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> > +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
> > @@ -56,9 +56,9 @@ static inline struct seiko_panel *to_seiko_panel(struct drm_panel *panel)
> >  	return container_of(panel, struct seiko_panel, base);
> >  }
> >  
> > -static int seiko_panel_get_fixed_modes(struct seiko_panel *panel)
> > +static int seiko_panel_get_fixed_modes(struct seiko_panel *panel,
> > +				       struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->base.connector;
> >  	struct drm_device *drm = panel->base.drm;
> >  	struct drm_display_mode *mode;
> >  	unsigned int i, num = 0;
> > @@ -208,12 +208,13 @@ static int seiko_panel_enable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int seiko_panel_get_modes(struct drm_panel *panel)
> > +static int seiko_panel_get_modes(struct drm_panel *panel,
> > +				 struct drm_connector *connector)
> >  {
> >  	struct seiko_panel *p = to_seiko_panel(panel);
> >  
> >  	/* add hard-coded panel modes */
> > -	return seiko_panel_get_fixed_modes(p);
> > +	return seiko_panel_get_fixed_modes(p, connector);
> >  }
> >  
> >  static int seiko_panel_get_timings(struct drm_panel *panel,
> > diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> > index 5e136c3ba185..e797b700661a 100644
> > --- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> > +++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> > @@ -278,7 +278,8 @@ static const struct drm_display_mode default_mode = {
> >  	.vrefresh = 60,
> >  };
> >  
> > -static int sharp_panel_get_modes(struct drm_panel *panel)
> > +static int sharp_panel_get_modes(struct drm_panel *panel,
> > +				 struct drm_connector *connector)
> >  {
> >  	struct drm_display_mode *mode;
> >  
> > @@ -292,10 +293,10 @@ static int sharp_panel_get_modes(struct drm_panel *panel)
> >  
> >  	drm_mode_set_name(mode);
> >  
> > -	drm_mode_probed_add(panel->connector, mode);
> > +	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.width_mm = 217;
> > -	panel->connector->display_info.height_mm = 136;
> > +	connector->display_info.width_mm = 217;
> > +	connector->display_info.height_mm = 136;
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> > index eeab7998c7de..7103a945f0e8 100644
> > --- a/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> > +++ b/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
> > @@ -100,9 +100,9 @@ static const struct drm_display_mode ls037v7dw01_mode = {
> >  	.height_mm = 75,
> >  };
> >  
> > -static int ls037v7dw01_get_modes(struct drm_panel *panel)
> > +static int ls037v7dw01_get_modes(struct drm_panel *panel,
> > +				 struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_duplicate(panel->drm, &ls037v7dw01_mode);
> > diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> > index b963ba4ab589..85ae6cffdbfb 100644
> > --- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> > +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> > @@ -210,7 +210,8 @@ static const struct drm_display_mode default_mode = {
> >  	.vrefresh = 60,
> >  };
> >  
> > -static int sharp_nt_panel_get_modes(struct drm_panel *panel)
> > +static int sharp_nt_panel_get_modes(struct drm_panel *panel,
> > +				    struct drm_connector *connector)
> >  {
> >  	struct drm_display_mode *mode;
> >  
> > @@ -224,10 +225,10 @@ static int sharp_nt_panel_get_modes(struct drm_panel *panel)
> >  
> >  	drm_mode_set_name(mode);
> >  
> > -	drm_mode_probed_add(panel->connector, mode);
> > +	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.width_mm = 54;
> > -	panel->connector->display_info.height_mm = 95;
> > +	connector->display_info.width_mm = 54;
> > +	connector->display_info.height_mm = 95;
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> > index a5df6d6dd455..d6299fe6d276 100644
> > --- a/drivers/gpu/drm/panel/panel-simple.c
> > +++ b/drivers/gpu/drm/panel/panel-simple.c
> > @@ -117,9 +117,9 @@ static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
> >  	return container_of(panel, struct panel_simple, base);
> >  }
> >  
> > -static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel)
> > +static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel,
> > +						   struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->base.connector;
> >  	struct drm_device *drm = panel->base.drm;
> >  	struct drm_display_mode *mode;
> >  	unsigned int i, num = 0;
> > @@ -150,9 +150,9 @@ static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel)
> >  	return num;
> >  }
> >  
> > -static unsigned int panel_simple_get_display_modes(struct panel_simple *panel)
> > +static unsigned int panel_simple_get_display_modes(struct panel_simple *panel,
> > +						   struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->base.connector;
> >  	struct drm_device *drm = panel->base.drm;
> >  	struct drm_display_mode *mode;
> >  	unsigned int i, num = 0;
> > @@ -181,9 +181,9 @@ static unsigned int panel_simple_get_display_modes(struct panel_simple *panel)
> >  	return num;
> >  }
> >  
> > -static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
> > +static int panel_simple_get_non_edid_modes(struct panel_simple *panel,
> > +					   struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->base.connector;
> >  	struct drm_device *drm = panel->base.drm;
> >  	struct drm_display_mode *mode;
> >  	bool has_override = panel->override_mode.type;
> > @@ -204,7 +204,7 @@ static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
> >  
> >  	/* Only add timings if override was not there or failed to validate */
> >  	if (num == 0 && panel->desc->num_timings)
> > -		num = panel_simple_get_timings_modes(panel);
> > +		num = panel_simple_get_timings_modes(panel, connector);
> >  
> >  	/*
> >  	 * Only add fixed modes if timings/override added no mode.
> > @@ -214,7 +214,7 @@ static int panel_simple_get_non_edid_modes(struct panel_simple *panel)
> >  	 */
> >  	WARN_ON(panel->desc->num_timings && panel->desc->num_modes);
> >  	if (num == 0)
> > -		num = panel_simple_get_display_modes(panel);
> > +		num = panel_simple_get_display_modes(panel, connector);
> >  
> >  	connector->display_info.bpc = panel->desc->bpc;
> >  	connector->display_info.width_mm = panel->desc->size.width;
> > @@ -304,23 +304,24 @@ static int panel_simple_enable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int panel_simple_get_modes(struct drm_panel *panel)
> > +static int panel_simple_get_modes(struct drm_panel *panel,
> > +				  struct drm_connector *connector)
> >  {
> >  	struct panel_simple *p = to_panel_simple(panel);
> >  	int num = 0;
> >  
> >  	/* probe EDID if a DDC bus is available */
> >  	if (p->ddc) {
> > -		struct edid *edid = drm_get_edid(panel->connector, p->ddc);
> > -		drm_connector_update_edid_property(panel->connector, edid);
> > +		struct edid *edid = drm_get_edid(connector, p->ddc);
> > +		drm_connector_update_edid_property(connector, edid);
> >  		if (edid) {
> > -			num += drm_add_edid_modes(panel->connector, edid);
> > +			num += drm_add_edid_modes(connector, edid);
> >  			kfree(edid);
> >  		}
> >  	}
> >  
> >  	/* add hard-coded panel modes */
> > -	num += panel_simple_get_non_edid_modes(p);
> > +	num += panel_simple_get_non_edid_modes(p, connector);
> >  
> >  	return num;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> > index ee3f23f45755..3ed3b1d6d82d 100644
> > --- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> > +++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
> > @@ -264,7 +264,8 @@ static int st7701_unprepare(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int st7701_get_modes(struct drm_panel *panel)
> > +static int st7701_get_modes(struct drm_panel *panel,
> > +			    struct drm_connector *connector)
> >  {
> >  	struct st7701 *st7701 = panel_to_st7701(panel);
> >  	const struct drm_display_mode *desc_mode = st7701->desc->mode;
> > @@ -280,10 +281,10 @@ static int st7701_get_modes(struct drm_panel *panel)
> >  	}
> >  
> >  	drm_mode_set_name(mode);
> > -	drm_mode_probed_add(panel->connector, mode);
> > +	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.width_mm = desc_mode->width_mm;
> > -	panel->connector->display_info.height_mm = desc_mode->height_mm;
> > +	connector->display_info.width_mm = desc_mode->width_mm;
> > +	connector->display_info.height_mm = desc_mode->height_mm;
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> > index 108a85bb6667..836b01331505 100644
> > --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> > +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> > @@ -170,9 +170,9 @@ static const struct drm_display_mode default_mode = {
> >  	.vrefresh = 60,
> >  };
> >  
> > -static int st7789v_get_modes(struct drm_panel *panel)
> > +static int st7789v_get_modes(struct drm_panel *panel,
> > +			     struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_duplicate(panel->drm, &default_mode);
> > @@ -188,8 +188,8 @@ static int st7789v_get_modes(struct drm_panel *panel)
> >  	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> >  	drm_mode_probed_add(connector, mode);
> >  
> > -	panel->connector->display_info.width_mm = 61;
> > -	panel->connector->display_info.height_mm = 103;
> > +	connector->display_info.width_mm = 61;
> > +	connector->display_info.height_mm = 103;
> >  
> >  	return 1;
> >  }
> > diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> > index d6387d8f88a3..841dc73c443d 100644
> > --- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> > +++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> > @@ -521,9 +521,9 @@ static const struct drm_display_mode acx565akm_mode = {
> >  	.height_mm = 46,
> >  };
> >  
> > -static int acx565akm_get_modes(struct drm_panel *panel)
> > +static int acx565akm_get_modes(struct drm_panel *panel,
> > +			       struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_duplicate(panel->drm, &acx565akm_mode);
> > diff --git a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> > index c44d6a65c0aa..5230176bd8e6 100644
> > --- a/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> > +++ b/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c
> > @@ -287,9 +287,9 @@ static const struct drm_display_mode td028ttec1_mode = {
> >  	.height_mm = 58,
> >  };
> >  
> > -static int td028ttec1_get_modes(struct drm_panel *panel)
> > +static int td028ttec1_get_modes(struct drm_panel *panel,
> > +				struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_duplicate(panel->drm, &td028ttec1_mode);
> > diff --git a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> > index 621b65feec07..716f8ed1cc45 100644
> > --- a/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> > +++ b/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
> > @@ -346,9 +346,9 @@ static const struct drm_display_mode td043mtea1_mode = {
> >  	.height_mm = 56,
> >  };
> >  
> > -static int td043mtea1_get_modes(struct drm_panel *panel)
> > +static int td043mtea1_get_modes(struct drm_panel *panel,
> > +				struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct drm_display_mode *mode;
> >  
> >  	mode = drm_mode_duplicate(panel->drm, &td043mtea1_mode);
> > diff --git a/drivers/gpu/drm/panel/panel-tpo-tpg110.c b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> > index 1a5418ae2ccf..e74cd9d418cf 100644
> > --- a/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> > +++ b/drivers/gpu/drm/panel/panel-tpo-tpg110.c
> > @@ -384,9 +384,9 @@ static int tpg110_enable(struct drm_panel *panel)
> >   * presents the mode that is configured for the system under use,
> >   * and which is detected by reading the registers of the display.
> >   */
> > -static int tpg110_get_modes(struct drm_panel *panel)
> > +static int tpg110_get_modes(struct drm_panel *panel,
> > +			    struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct tpg110 *tpg = to_tpg110(panel);
> >  	struct drm_display_mode *mode;
> >  
> > diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c b/drivers/gpu/drm/panel/panel-truly-nt35597.c
> > index 0feea2456e14..012ca62bf30e 100644
> > --- a/drivers/gpu/drm/panel/panel-truly-nt35597.c
> > +++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c
> > @@ -454,9 +454,9 @@ static int truly_nt35597_enable(struct drm_panel *panel)
> >  	return 0;
> >  }
> >  
> > -static int truly_nt35597_get_modes(struct drm_panel *panel)
> > +static int truly_nt35597_get_modes(struct drm_panel *panel,
> > +				   struct drm_connector *connector)
> >  {
> > -	struct drm_connector *connector = panel->connector;
> >  	struct truly_nt35597 *ctx = panel_to_ctx(panel);
> >  	struct drm_display_mode *mode;
> >  	const struct nt35597_config *config;
> > diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> > index d30c98567384..a5f7199807f2 100644
> > --- a/include/drm/drm_panel.h
> > +++ b/include/drm/drm_panel.h
> > @@ -100,7 +100,8 @@ struct drm_panel_funcs {
> >  	 * Add modes to the connector that the panel is attached to and
> >  	 * return the number of modes added.
> >  	 */
> > -	int (*get_modes)(struct drm_panel *panel);
> > +	int (*get_modes)(struct drm_panel *panel,
> > +			 struct drm_connector *connector);
> >  
> >  	/**
> >  	 * @get_timings:

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 54+ messages in thread

end of thread, back to index

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02 19:32 [PATCH v1 0/26] drm/panel infrastructure + backlight update Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 01/26] drm/drm_panel: no error when no callback Sam Ravnborg
2019-12-03  6:24   ` Laurent Pinchart
2019-12-02 19:32 ` [PATCH v1 02/26] drm/panel: add backlight support Sam Ravnborg
2019-12-03  6:32   ` Laurent Pinchart
2019-12-02 19:32 ` [PATCH v1 03/26] drm/panel: simple: use drm_panel " Sam Ravnborg
2019-12-03  6:39   ` Laurent Pinchart
2019-12-02 19:32 ` [PATCH v1 04/26] drm: get drm_bridge_panel connector via helper Sam Ravnborg
2019-12-03  6:44   ` Laurent Pinchart
2019-12-03 13:22   ` Linus Walleij
2019-12-02 19:32 ` [PATCH v1 05/26] drm/panel: add drm_connector argument to get_modes() Sam Ravnborg
2019-12-03  6:50   ` Laurent Pinchart
2019-12-03 13:25   ` Linus Walleij
2019-12-04 12:08   ` Guido Günther
2019-12-04 13:11     ` Laurent Pinchart
2019-12-02 19:32 ` [PATCH v1 07/26] drm/panel: remove get_timings Sam Ravnborg
2019-12-03  7:02   ` Laurent Pinchart
2019-12-03  7:46   ` Maxime Ripard
2019-12-03  8:18     ` Laurent Pinchart
2019-12-03  8:39     ` Sam Ravnborg
2019-12-04  8:05       ` Maxime Ripard
2019-12-03 15:20     ` Linus Walleij
2019-12-04  8:16       ` Maxime Ripard
2019-12-04  8:23         ` Laurent Pinchart
2019-12-02 19:32 ` [PATCH v1 08/26] drm/panel: drop drm_device from drm_panel Sam Ravnborg
2019-12-03  7:15   ` Laurent Pinchart
2019-12-03 13:27   ` Linus Walleij
2019-12-02 19:32 ` [PATCH v1 09/26] drm/panel: feiyang-fy07024di26a30d: use drm_panel backlight support Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 10/26] drm/panel: ilitek-ili9881c: " Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 11/26] drm/panel: innolux-p079zca: " Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 12/26] drm/panel: kingdisplay-kd097d04: " Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 13/26] drm/panel: lvds: " Sam Ravnborg
2019-12-03  7:16   ` Laurent Pinchart
2019-12-02 19:32 ` [PATCH v1 14/26] drm/panel: olimex-lcd-olinuxino: " Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 15/26] drm/panel: osd-osd101t2587-53ts: " Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 16/26] drm/panel: panasonic-vvx10f034n00: " Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 17/26] drm/panel: raydium-rm68200: " Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 18/26] drm/panel: rocktech-jh057n00900: " Sam Ravnborg
2019-12-04 12:04   ` Guido Günther
2019-12-02 19:32 ` [PATCH v1 19/26] drm/panel: ronbo-rb070d30: " Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 20/26] drm/panel: seiko-43wvf1g: " Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 21/26] drm/panel: sharp-lq101r1sx01: " Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 22/26] drm/panel: sharp-ls043t1le01: " Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 23/26] drm/panel: sitronix-st7701: " Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 24/26] drm/panel: sitronix-st7789v: " Sam Ravnborg
2019-12-02 19:32 ` [PATCH v1 25/26] drm/panel: tpo-td028ttec1: " Sam Ravnborg
2019-12-03  7:16   ` Laurent Pinchart
2019-12-02 19:32 ` [PATCH v1 26/26] drm/panel: tpo-tpg110: " Sam Ravnborg
2019-12-03 13:20   ` Linus Walleij
2019-12-02 19:59 ` [PATCH v1 0/26] drm/panel infrastructure + backlight update Jeffrey Hugo
2019-12-02 20:48   ` Sam Ravnborg
2019-12-02 20:51     ` Jeffrey Hugo
2019-12-03  7:24 ` Laurent Pinchart
2019-12-03  8:33   ` Sam Ravnborg

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git