All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-05 12:02 ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen

Hi,

This is third version of the series sent by Sebastian in February:

https://www.spinics.net/lists/linux-omap/msg153465.html

I took the patches from his git tree, and rebased on 5.10-rc2. There
were some conflicts and compilation errors, and one bug that made dsi to
not work (videomode variable was not initialized to 0).

I then fixed the few checkpatch and sparse issues. Overall, Sebastian's
patches are pretty much as they were previously. I did drop Laurent's
reviewed-bys, as it's been a long time since the previous series, and
the patches are not identical anyway.

The topmost 5 patches are new ones, cleanups enabled by the DSI
conversion. They could be handled separately, but it's such a nice
cleanup, and I've been waiting for years to get this done, so here they
are. That said, there are still a _lot_ of cleanups to do.

Almost all of the patches are omapdrm changes. The two non-omapdrm
changes are:
- After converting panel-dsi-cm to common DRM panel model, it is moved
  to drm's panel directory.
- Add MIPI_DSI_MODE_ULPS_IDLE flag

I have tested these with OMAP4 SDP, AM5 EVM and OMAP4 Panda. SDP has
command mode panel, and I don't have any videomode panels.

Sebastian, I hope you're ok with all this? I did send you an email, but
didn't get a reply yet, so I thought to just proceed. If you want to
handle this in some other way, or don't want your
authorship/signed-off-by in some of the commits, just tell.

 Tomi

Sebastian Reichel (51):
  drm/dsi: add MIPI_DSI_MODE_ULPS_IDLE
  Revert "drm/omap: dss: Remove unused omap_dss_device operations"
  drm/omap: drop unused dsi.configure_pins
  drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_*
  drm/omap: constify write buffers
  drm/omap: dsi: add generic transfer function
  drm/omap: panel-dsi-cm: convert to transfer API
  drm/omap: dsi: unexport specific data transfer functions
  drm/omap: dsi: drop virtual channel logic
  drm/omap: dsi: simplify write function
  drm/omap: dsi: simplify read functions
  drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg
  drm/omap: dsi: introduce mipi_dsi_host
  drm/omap: panel-dsi-cm: use DSI helpers
  drm/omap: dsi: request VC via mipi_dsi_attach
  drm/omap: panel-dsi-cm: drop hardcoded VC
  drm/omap: panel-dsi-cm: use common MIPI DCS 1.3 defines
  drm/omap: dsi: drop unused memory_read()
  drm/omap: dsi: drop unused get_te()
  drm/omap: dsi: drop unused enable_te()
  drm/omap: dsi: drop useless sync()
  drm/omap: dsi: use pixel-format and mode from attach
  drm/omap: panel-dsi-cm: use bulk regulator API
  drm/omap: dsi: lp/hs switching support for transfer()
  drm/omap: dsi: move TE GPIO handling into core
  drm/omap: dsi: drop custom enable_te() API
  drm/omap: dsi: do bus locking in host driver
  drm/omap: dsi: untangle ulps ops from enable/disable
  drm/omap: dsi: do ULPS in host driver
  drm/omap: dsi: move panel refresh function to host
  drm/omap: dsi: Reverse direction of the DSS device enable/disable
    operations
  drm/omap: dsi: drop custom panel capability support
  drm/omap: dsi: convert to drm_panel
  drm/omap: drop omapdss-boot-init
  drm/omap: dsi: implement check timings
  drm/omap: panel-dsi-cm: use DEVICE_ATTR_RO
  drm/omap: panel-dsi-cm: support unbinding
  drm/omap: panel-dsi-cm: fix remove()
  drm/omap: remove global dss_device variable
  drm/panel: Move OMAP's DSI command mode panel driver
  drm/omap: dsi: Register a drm_bridge
  drm/omap: remove legacy DSS device operations
  drm/omap: remove unused omap_connector
  drm/omap: simplify omap_display_id
  drm/omap: drop unused DSS next pointer
  drm/omap: drop empty omap_encoder helper functions
  drm/omap: drop DSS ops_flags
  drm/omap: drop dssdev display field
  drm/omap: simplify DSI manual update code
  drm/omap: dsi: simplify pin config
  ARM: omap2plus_defconfig: Update for moved DSI command mode panel

Tomi Valkeinen (5):
  drm/omap: squash omapdrm sub-modules into one
  drm/omap: remove unused display.c
  drm/omap: drop unused owner field
  drm/omap: remove dispc_ops
  drm/omap: remove dss_mgr_ops

 arch/arm/configs/omap2plus_defconfig          |    2 +-
 drivers/gpu/drm/omapdrm/Kconfig               |  120 +-
 drivers/gpu/drm/omapdrm/Makefile              |   19 +-
 drivers/gpu/drm/omapdrm/displays/Kconfig      |   10 -
 drivers/gpu/drm/omapdrm/displays/Makefile     |    2 -
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 1385 -----------------
 drivers/gpu/drm/omapdrm/dss/Kconfig           |  135 --
 drivers/gpu/drm/omapdrm/dss/Makefile          |   20 -
 drivers/gpu/drm/omapdrm/dss/base.c            |   87 +-
 drivers/gpu/drm/omapdrm/dss/dispc.c           |  101 +-
 drivers/gpu/drm/omapdrm/dss/display.c         |   60 -
 drivers/gpu/drm/omapdrm/dss/dpi.c             |    1 -
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 1069 ++++++++-----
 drivers/gpu/drm/omapdrm/dss/dss.c             |   28 +-
 drivers/gpu/drm/omapdrm/dss/dss.h             |   72 +-
 drivers/gpu/drm/omapdrm/dss/hdmi4.c           |    1 -
 drivers/gpu/drm/omapdrm/dss/hdmi5.c           |    1 -
 .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |  229 ---
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  278 +---
 drivers/gpu/drm/omapdrm/dss/output.c          |   57 +-
 drivers/gpu/drm/omapdrm/dss/sdi.c             |    1 -
 drivers/gpu/drm/omapdrm/dss/venc.c            |    2 -
 drivers/gpu/drm/omapdrm/omap_connector.c      |  157 --
 drivers/gpu/drm/omapdrm/omap_connector.h      |   28 -
 drivers/gpu/drm/omapdrm/omap_crtc.c           |  103 +-
 drivers/gpu/drm/omapdrm/omap_crtc.h           |    2 -
 drivers/gpu/drm/omapdrm/omap_drv.c            |   65 +-
 drivers/gpu/drm/omapdrm/omap_drv.h            |    3 +-
 drivers/gpu/drm/omapdrm/omap_encoder.c        |   59 +-
 drivers/gpu/drm/omapdrm/omap_irq.c            |   34 +-
 drivers/gpu/drm/omapdrm/omap_plane.c          |   12 +-
 drivers/gpu/drm/panel/Kconfig                 |    9 +
 drivers/gpu/drm/panel/Makefile                |    1 +
 drivers/gpu/drm/panel/panel-dsi-cm.c          |  647 ++++++++
 include/drm/drm_mipi_dsi.h                    |    2 +
 35 files changed, 1718 insertions(+), 3084 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/Kconfig
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/Makefile
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/display.c
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
 delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.c
 delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.h
 create mode 100644 drivers/gpu/drm/panel/panel-dsi-cm.c

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-05 12:02 ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen, Sekhar Nori

Hi,

This is third version of the series sent by Sebastian in February:

https://www.spinics.net/lists/linux-omap/msg153465.html

I took the patches from his git tree, and rebased on 5.10-rc2. There
were some conflicts and compilation errors, and one bug that made dsi to
not work (videomode variable was not initialized to 0).

I then fixed the few checkpatch and sparse issues. Overall, Sebastian's
patches are pretty much as they were previously. I did drop Laurent's
reviewed-bys, as it's been a long time since the previous series, and
the patches are not identical anyway.

The topmost 5 patches are new ones, cleanups enabled by the DSI
conversion. They could be handled separately, but it's such a nice
cleanup, and I've been waiting for years to get this done, so here they
are. That said, there are still a _lot_ of cleanups to do.

Almost all of the patches are omapdrm changes. The two non-omapdrm
changes are:
- After converting panel-dsi-cm to common DRM panel model, it is moved
  to drm's panel directory.
- Add MIPI_DSI_MODE_ULPS_IDLE flag

I have tested these with OMAP4 SDP, AM5 EVM and OMAP4 Panda. SDP has
command mode panel, and I don't have any videomode panels.

Sebastian, I hope you're ok with all this? I did send you an email, but
didn't get a reply yet, so I thought to just proceed. If you want to
handle this in some other way, or don't want your
authorship/signed-off-by in some of the commits, just tell.

 Tomi

Sebastian Reichel (51):
  drm/dsi: add MIPI_DSI_MODE_ULPS_IDLE
  Revert "drm/omap: dss: Remove unused omap_dss_device operations"
  drm/omap: drop unused dsi.configure_pins
  drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_*
  drm/omap: constify write buffers
  drm/omap: dsi: add generic transfer function
  drm/omap: panel-dsi-cm: convert to transfer API
  drm/omap: dsi: unexport specific data transfer functions
  drm/omap: dsi: drop virtual channel logic
  drm/omap: dsi: simplify write function
  drm/omap: dsi: simplify read functions
  drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg
  drm/omap: dsi: introduce mipi_dsi_host
  drm/omap: panel-dsi-cm: use DSI helpers
  drm/omap: dsi: request VC via mipi_dsi_attach
  drm/omap: panel-dsi-cm: drop hardcoded VC
  drm/omap: panel-dsi-cm: use common MIPI DCS 1.3 defines
  drm/omap: dsi: drop unused memory_read()
  drm/omap: dsi: drop unused get_te()
  drm/omap: dsi: drop unused enable_te()
  drm/omap: dsi: drop useless sync()
  drm/omap: dsi: use pixel-format and mode from attach
  drm/omap: panel-dsi-cm: use bulk regulator API
  drm/omap: dsi: lp/hs switching support for transfer()
  drm/omap: dsi: move TE GPIO handling into core
  drm/omap: dsi: drop custom enable_te() API
  drm/omap: dsi: do bus locking in host driver
  drm/omap: dsi: untangle ulps ops from enable/disable
  drm/omap: dsi: do ULPS in host driver
  drm/omap: dsi: move panel refresh function to host
  drm/omap: dsi: Reverse direction of the DSS device enable/disable
    operations
  drm/omap: dsi: drop custom panel capability support
  drm/omap: dsi: convert to drm_panel
  drm/omap: drop omapdss-boot-init
  drm/omap: dsi: implement check timings
  drm/omap: panel-dsi-cm: use DEVICE_ATTR_RO
  drm/omap: panel-dsi-cm: support unbinding
  drm/omap: panel-dsi-cm: fix remove()
  drm/omap: remove global dss_device variable
  drm/panel: Move OMAP's DSI command mode panel driver
  drm/omap: dsi: Register a drm_bridge
  drm/omap: remove legacy DSS device operations
  drm/omap: remove unused omap_connector
  drm/omap: simplify omap_display_id
  drm/omap: drop unused DSS next pointer
  drm/omap: drop empty omap_encoder helper functions
  drm/omap: drop DSS ops_flags
  drm/omap: drop dssdev display field
  drm/omap: simplify DSI manual update code
  drm/omap: dsi: simplify pin config
  ARM: omap2plus_defconfig: Update for moved DSI command mode panel

Tomi Valkeinen (5):
  drm/omap: squash omapdrm sub-modules into one
  drm/omap: remove unused display.c
  drm/omap: drop unused owner field
  drm/omap: remove dispc_ops
  drm/omap: remove dss_mgr_ops

 arch/arm/configs/omap2plus_defconfig          |    2 +-
 drivers/gpu/drm/omapdrm/Kconfig               |  120 +-
 drivers/gpu/drm/omapdrm/Makefile              |   19 +-
 drivers/gpu/drm/omapdrm/displays/Kconfig      |   10 -
 drivers/gpu/drm/omapdrm/displays/Makefile     |    2 -
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 1385 -----------------
 drivers/gpu/drm/omapdrm/dss/Kconfig           |  135 --
 drivers/gpu/drm/omapdrm/dss/Makefile          |   20 -
 drivers/gpu/drm/omapdrm/dss/base.c            |   87 +-
 drivers/gpu/drm/omapdrm/dss/dispc.c           |  101 +-
 drivers/gpu/drm/omapdrm/dss/display.c         |   60 -
 drivers/gpu/drm/omapdrm/dss/dpi.c             |    1 -
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 1069 ++++++++-----
 drivers/gpu/drm/omapdrm/dss/dss.c             |   28 +-
 drivers/gpu/drm/omapdrm/dss/dss.h             |   72 +-
 drivers/gpu/drm/omapdrm/dss/hdmi4.c           |    1 -
 drivers/gpu/drm/omapdrm/dss/hdmi5.c           |    1 -
 .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |  229 ---
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  278 +---
 drivers/gpu/drm/omapdrm/dss/output.c          |   57 +-
 drivers/gpu/drm/omapdrm/dss/sdi.c             |    1 -
 drivers/gpu/drm/omapdrm/dss/venc.c            |    2 -
 drivers/gpu/drm/omapdrm/omap_connector.c      |  157 --
 drivers/gpu/drm/omapdrm/omap_connector.h      |   28 -
 drivers/gpu/drm/omapdrm/omap_crtc.c           |  103 +-
 drivers/gpu/drm/omapdrm/omap_crtc.h           |    2 -
 drivers/gpu/drm/omapdrm/omap_drv.c            |   65 +-
 drivers/gpu/drm/omapdrm/omap_drv.h            |    3 +-
 drivers/gpu/drm/omapdrm/omap_encoder.c        |   59 +-
 drivers/gpu/drm/omapdrm/omap_irq.c            |   34 +-
 drivers/gpu/drm/omapdrm/omap_plane.c          |   12 +-
 drivers/gpu/drm/panel/Kconfig                 |    9 +
 drivers/gpu/drm/panel/Makefile                |    1 +
 drivers/gpu/drm/panel/panel-dsi-cm.c          |  647 ++++++++
 include/drm/drm_mipi_dsi.h                    |    2 +
 35 files changed, 1718 insertions(+), 3084 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/Kconfig
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/Makefile
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/display.c
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
 delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.c
 delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.h
 create mode 100644 drivers/gpu/drm/panel/panel-dsi-cm.c

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 01/56] drm/dsi: add MIPI_DSI_MODE_ULPS_IDLE
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

DSI command mode panels are self-refreshing displays, that
can be updated very rarely for static images. For this kind
of scenario some panels support, that the DSI bus switches
into ULPS mode until the panel needs to be refreshed.

This is problematic on some panels, so introduce a flag to
signal the DSI host implementation that the panel allows
going into ULPS mode.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 include/drm/drm_mipi_dsi.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 360e6377e84b..f36f89c14b4a 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -132,6 +132,8 @@ struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
 #define MIPI_DSI_CLOCK_NON_CONTINUOUS	BIT(10)
 /* transmit data in low power */
 #define MIPI_DSI_MODE_LPM		BIT(11)
+/* allow going into ULPS mode while command mode panel is not updated */
+#define MIPI_DSI_MODE_ULPS_IDLE		BIT(12)
 
 enum mipi_dsi_pixel_format {
 	MIPI_DSI_FMT_RGB888,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 01/56] drm/dsi: add MIPI_DSI_MODE_ULPS_IDLE
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

DSI command mode panels are self-refreshing displays, that
can be updated very rarely for static images. For this kind
of scenario some panels support, that the DSI bus switches
into ULPS mode until the panel needs to be refreshed.

This is problematic on some panels, so introduce a flag to
signal the DSI host implementation that the panel allows
going into ULPS mode.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 include/drm/drm_mipi_dsi.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 360e6377e84b..f36f89c14b4a 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -132,6 +132,8 @@ struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
 #define MIPI_DSI_CLOCK_NON_CONTINUOUS	BIT(10)
 /* transmit data in low power */
 #define MIPI_DSI_MODE_LPM		BIT(11)
+/* allow going into ULPS mode while command mode panel is not updated */
+#define MIPI_DSI_MODE_ULPS_IDLE		BIT(12)
 
 enum mipi_dsi_pixel_format {
 	MIPI_DSI_FMT_RGB888,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 02/56] Revert "drm/omap: dss: Remove unused omap_dss_device operations"
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This reverts commit 4ff8e98879e6eeae9d125dfcf3b642075d00089d.

This is still needed by DSI. E.g. unloading modules without this will
cause a crash.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c     | 26 +++++++++++++++
 drivers/gpu/drm/omapdrm/dss/omapdss.h  |  6 ++++
 drivers/gpu/drm/omapdrm/omap_encoder.c | 44 +++++++++++++++++++++++---
 3 files changed, 71 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index c7650a7c155d..455b410f7401 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -234,6 +234,18 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
 }
 EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
 
+void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
+{
+	if (!dssdev)
+		return;
+
+	omapdss_device_pre_enable(dssdev->next);
+
+	if (dssdev->ops && dssdev->ops->pre_enable)
+		dssdev->ops->pre_enable(dssdev);
+}
+EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
+
 void omapdss_device_enable(struct omap_dss_device *dssdev)
 {
 	if (!dssdev)
@@ -260,6 +272,20 @@ void omapdss_device_disable(struct omap_dss_device *dssdev)
 }
 EXPORT_SYMBOL_GPL(omapdss_device_disable);
 
+void omapdss_device_post_disable(struct omap_dss_device *dssdev)
+{
+	if (!dssdev)
+		return;
+
+	if (dssdev->ops && dssdev->ops->post_disable)
+		dssdev->ops->post_disable(dssdev);
+
+	omapdss_device_post_disable(dssdev->next);
+
+	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+}
+EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
+
 /* -----------------------------------------------------------------------------
  * Components Handling
  */
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index ab19d4af8de7..cbbe10b2b60d 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -342,11 +342,15 @@ struct omap_dss_device_ops {
 	void (*disconnect)(struct omap_dss_device *dssdev,
 			struct omap_dss_device *dst);
 
+	void (*pre_enable)(struct omap_dss_device *dssdev);
 	void (*enable)(struct omap_dss_device *dssdev);
 	void (*disable)(struct omap_dss_device *dssdev);
+	void (*post_disable)(struct omap_dss_device *dssdev);
 
 	int (*check_timings)(struct omap_dss_device *dssdev,
 			     struct drm_display_mode *mode);
+	void (*set_timings)(struct omap_dss_device *dssdev,
+			    const struct drm_display_mode *mode);
 
 	int (*get_modes)(struct omap_dss_device *dssdev,
 			 struct drm_connector *connector);
@@ -445,8 +449,10 @@ int omapdss_device_connect(struct dss_device *dss,
 			   struct omap_dss_device *dst);
 void omapdss_device_disconnect(struct omap_dss_device *src,
 			       struct omap_dss_device *dst);
+void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
 void omapdss_device_enable(struct omap_dss_device *dssdev);
 void omapdss_device_disable(struct omap_dss_device *dssdev);
+void omapdss_device_post_disable(struct omap_dss_device *dssdev);
 
 int omap_dss_get_num_overlay_managers(void);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index ae4b867a67a3..18a79dde6815 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -113,8 +113,13 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 	bus_flags = connector->display_info.bus_flags;
 	omap_encoder_update_videomode_flags(&vm, bus_flags);
 
-	/* Set timings for the dss manager. */
+	/* Set timings for all devices in the display pipeline. */
 	dss_mgr_set_timings(output, &vm);
+
+	for (dssdev = output; dssdev; dssdev = dssdev->next) {
+		if (dssdev->ops && dssdev->ops->set_timings)
+			dssdev->ops->set_timings(dssdev, adjusted_mode);
+	}
 }
 
 static void omap_encoder_disable(struct drm_encoder *encoder)
@@ -127,10 +132,26 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
 
 	/*
 	 * Disable the chain of external devices, starting at the one at the
-	 * internal encoder's output. This is used for DSI outputs only, as
-	 * dssdev->next is NULL for all other outputs.
+	 * internal encoder's output.
 	 */
 	omapdss_device_disable(dssdev->next);
+
+	/*
+	 * Disable the internal encoder. This will disable the DSS output. The
+	 * DSI is treated as an exception as DSI pipelines still use the legacy
+	 * flow where the pipeline output controls the encoder.
+	 */
+	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
+		if (dssdev->ops && dssdev->ops->disable)
+			dssdev->ops->disable(dssdev);
+		dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+	}
+
+	/*
+	 * Perform the post-disable operations on the chain of external devices
+	 * to complete the display pipeline disable.
+	 */
+	omapdss_device_post_disable(dssdev->next);
 }
 
 static void omap_encoder_enable(struct drm_encoder *encoder)
@@ -141,10 +162,23 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
 
 	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
 
+	/* Prepare the chain of external devices for pipeline enable. */
+	omapdss_device_pre_enable(dssdev->next);
+
+	/*
+	 * Enable the internal encoder. This will enable the DSS output. The
+	 * DSI is treated as an exception as DSI pipelines still use the legacy
+	 * flow where the pipeline output controls the encoder.
+	 */
+	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
+		if (dssdev->ops && dssdev->ops->enable)
+			dssdev->ops->enable(dssdev);
+		dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+	}
+
 	/*
 	 * Enable the chain of external devices, starting at the one at the
-	 * internal encoder's output. This is used for DSI outputs only, as
-	 * dssdev->next is NULL for all other outputs.
+	 * internal encoder's output.
 	 */
 	omapdss_device_enable(dssdev->next);
 }
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 02/56] Revert "drm/omap: dss: Remove unused omap_dss_device operations"
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This reverts commit 4ff8e98879e6eeae9d125dfcf3b642075d00089d.

This is still needed by DSI. E.g. unloading modules without this will
cause a crash.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c     | 26 +++++++++++++++
 drivers/gpu/drm/omapdrm/dss/omapdss.h  |  6 ++++
 drivers/gpu/drm/omapdrm/omap_encoder.c | 44 +++++++++++++++++++++++---
 3 files changed, 71 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index c7650a7c155d..455b410f7401 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -234,6 +234,18 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
 }
 EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
 
+void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
+{
+	if (!dssdev)
+		return;
+
+	omapdss_device_pre_enable(dssdev->next);
+
+	if (dssdev->ops && dssdev->ops->pre_enable)
+		dssdev->ops->pre_enable(dssdev);
+}
+EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
+
 void omapdss_device_enable(struct omap_dss_device *dssdev)
 {
 	if (!dssdev)
@@ -260,6 +272,20 @@ void omapdss_device_disable(struct omap_dss_device *dssdev)
 }
 EXPORT_SYMBOL_GPL(omapdss_device_disable);
 
+void omapdss_device_post_disable(struct omap_dss_device *dssdev)
+{
+	if (!dssdev)
+		return;
+
+	if (dssdev->ops && dssdev->ops->post_disable)
+		dssdev->ops->post_disable(dssdev);
+
+	omapdss_device_post_disable(dssdev->next);
+
+	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+}
+EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
+
 /* -----------------------------------------------------------------------------
  * Components Handling
  */
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index ab19d4af8de7..cbbe10b2b60d 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -342,11 +342,15 @@ struct omap_dss_device_ops {
 	void (*disconnect)(struct omap_dss_device *dssdev,
 			struct omap_dss_device *dst);
 
+	void (*pre_enable)(struct omap_dss_device *dssdev);
 	void (*enable)(struct omap_dss_device *dssdev);
 	void (*disable)(struct omap_dss_device *dssdev);
+	void (*post_disable)(struct omap_dss_device *dssdev);
 
 	int (*check_timings)(struct omap_dss_device *dssdev,
 			     struct drm_display_mode *mode);
+	void (*set_timings)(struct omap_dss_device *dssdev,
+			    const struct drm_display_mode *mode);
 
 	int (*get_modes)(struct omap_dss_device *dssdev,
 			 struct drm_connector *connector);
@@ -445,8 +449,10 @@ int omapdss_device_connect(struct dss_device *dss,
 			   struct omap_dss_device *dst);
 void omapdss_device_disconnect(struct omap_dss_device *src,
 			       struct omap_dss_device *dst);
+void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
 void omapdss_device_enable(struct omap_dss_device *dssdev);
 void omapdss_device_disable(struct omap_dss_device *dssdev);
+void omapdss_device_post_disable(struct omap_dss_device *dssdev);
 
 int omap_dss_get_num_overlay_managers(void);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index ae4b867a67a3..18a79dde6815 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -113,8 +113,13 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 	bus_flags = connector->display_info.bus_flags;
 	omap_encoder_update_videomode_flags(&vm, bus_flags);
 
-	/* Set timings for the dss manager. */
+	/* Set timings for all devices in the display pipeline. */
 	dss_mgr_set_timings(output, &vm);
+
+	for (dssdev = output; dssdev; dssdev = dssdev->next) {
+		if (dssdev->ops && dssdev->ops->set_timings)
+			dssdev->ops->set_timings(dssdev, adjusted_mode);
+	}
 }
 
 static void omap_encoder_disable(struct drm_encoder *encoder)
@@ -127,10 +132,26 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
 
 	/*
 	 * Disable the chain of external devices, starting at the one at the
-	 * internal encoder's output. This is used for DSI outputs only, as
-	 * dssdev->next is NULL for all other outputs.
+	 * internal encoder's output.
 	 */
 	omapdss_device_disable(dssdev->next);
+
+	/*
+	 * Disable the internal encoder. This will disable the DSS output. The
+	 * DSI is treated as an exception as DSI pipelines still use the legacy
+	 * flow where the pipeline output controls the encoder.
+	 */
+	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
+		if (dssdev->ops && dssdev->ops->disable)
+			dssdev->ops->disable(dssdev);
+		dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+	}
+
+	/*
+	 * Perform the post-disable operations on the chain of external devices
+	 * to complete the display pipeline disable.
+	 */
+	omapdss_device_post_disable(dssdev->next);
 }
 
 static void omap_encoder_enable(struct drm_encoder *encoder)
@@ -141,10 +162,23 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
 
 	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
 
+	/* Prepare the chain of external devices for pipeline enable. */
+	omapdss_device_pre_enable(dssdev->next);
+
+	/*
+	 * Enable the internal encoder. This will enable the DSS output. The
+	 * DSI is treated as an exception as DSI pipelines still use the legacy
+	 * flow where the pipeline output controls the encoder.
+	 */
+	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
+		if (dssdev->ops && dssdev->ops->enable)
+			dssdev->ops->enable(dssdev);
+		dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+	}
+
 	/*
 	 * Enable the chain of external devices, starting at the one at the
-	 * internal encoder's output. This is used for DSI outputs only, as
-	 * dssdev->next is NULL for all other outputs.
+	 * internal encoder's output.
 	 */
 	omapdss_device_enable(dssdev->next);
 }
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 03/56] drm/omap: drop unused dsi.configure_pins
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The panel-dsi-cm's ddata->pin_config is always NULL, so this
callback is never called. Instead the DSI encoder gets the pin
configuration directly from DT.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 11 -----------
 drivers/gpu/drm/omapdrm/dss/dsi.c               |  1 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h           |  2 --
 3 files changed, 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index faca5c873bde..ff610d2a13fd 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -68,8 +68,6 @@ struct panel_drv_data {
 	int width_mm;
 	int height_mm;
 
-	struct omap_dsi_pin_config pin_config;
-
 	/* runtime variables */
 	bool enabled;
 
@@ -623,15 +621,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 		}
 	}
 
-	if (ddata->pin_config.num_pins > 0) {
-		r = src->ops->dsi.configure_pins(src, &ddata->pin_config);
-		if (r) {
-			dev_err(&ddata->pdev->dev,
-				"failed to configure DSI pins\n");
-			goto err_vddi;
-		}
-	}
-
 	r = src->ops->dsi.set_config(src, &dsi_config);
 	if (r) {
 		dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index eeccf40bae41..5598fc8f91db 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4892,7 +4892,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 
 		.enable_hs = dsi_vc_enable_hs,
 
-		.configure_pins = dsi_configure_pins,
 		.set_config = dsi_set_config,
 
 		.enable_video_output = dsi_enable_video_output,
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index cbbe10b2b60d..b0424daaceed 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -292,8 +292,6 @@ struct omapdss_dsi_ops {
 	/* bus configuration */
 	int (*set_config)(struct omap_dss_device *dssdev,
 			const struct omap_dss_dsi_config *cfg);
-	int (*configure_pins)(struct omap_dss_device *dssdev,
-			const struct omap_dsi_pin_config *pin_cfg);
 
 	void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
 			bool enable);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 03/56] drm/omap: drop unused dsi.configure_pins
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The panel-dsi-cm's ddata->pin_config is always NULL, so this
callback is never called. Instead the DSI encoder gets the pin
configuration directly from DT.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 11 -----------
 drivers/gpu/drm/omapdrm/dss/dsi.c               |  1 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h           |  2 --
 3 files changed, 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index faca5c873bde..ff610d2a13fd 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -68,8 +68,6 @@ struct panel_drv_data {
 	int width_mm;
 	int height_mm;
 
-	struct omap_dsi_pin_config pin_config;
-
 	/* runtime variables */
 	bool enabled;
 
@@ -623,15 +621,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 		}
 	}
 
-	if (ddata->pin_config.num_pins > 0) {
-		r = src->ops->dsi.configure_pins(src, &ddata->pin_config);
-		if (r) {
-			dev_err(&ddata->pdev->dev,
-				"failed to configure DSI pins\n");
-			goto err_vddi;
-		}
-	}
-
 	r = src->ops->dsi.set_config(src, &dsi_config);
 	if (r) {
 		dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index eeccf40bae41..5598fc8f91db 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4892,7 +4892,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 
 		.enable_hs = dsi_vc_enable_hs,
 
-		.configure_pins = dsi_configure_pins,
 		.set_config = dsi_set_config,
 
 		.enable_video_output = dsi_enable_video_output,
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index cbbe10b2b60d..b0424daaceed 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -292,8 +292,6 @@ struct omapdss_dsi_ops {
 	/* bus configuration */
 	int (*set_config)(struct omap_dss_device *dssdev,
 			const struct omap_dss_dsi_config *cfg);
-	int (*configure_pins)(struct omap_dss_device *dssdev,
-			const struct omap_dsi_pin_config *pin_cfg);
 
 	void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
 			bool enable);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 04/56] drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_*
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This replaces OMAP specific enum for pixel format with
common implementation.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 +-
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 55 ++++++++-----------
 drivers/gpu/drm/omapdrm/dss/omapdss.h         | 13 ++---
 3 files changed, 28 insertions(+), 42 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index ff610d2a13fd..b8f3a7aacbf4 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -595,7 +595,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	int r;
 	struct omap_dss_dsi_config dsi_config = {
 		.mode = OMAP_DSS_DSI_CMD_MODE,
-		.pixel_format = OMAP_DSS_DSI_FMT_RGB888,
+		.pixel_format = MIPI_DSI_FMT_RGB888,
 		.vm = &ddata->vm,
 		.hs_clk_min = 150000000,
 		.hs_clk_max = 300000000,
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 5598fc8f91db..86b9d435fb94 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -33,6 +33,7 @@
 #include <linux/component.h>
 #include <linux/sys_soc.h>
 
+#include <drm/drm_mipi_dsi.h>
 #include <video/mipi_display.h>
 
 #include "omapdss.h"
@@ -410,7 +411,7 @@ struct dsi_data {
 
 	struct dss_lcd_mgr_config mgr_config;
 	struct videomode vm;
-	enum omap_dss_dsi_pixel_format pix_fmt;
+	enum mipi_dsi_pixel_format pix_fmt;
 	enum omap_dss_dsi_mode mode;
 	struct omap_dss_dsi_videomode_timings vm_timings;
 
@@ -514,22 +515,6 @@ static inline bool wait_for_bit_change(struct dsi_data *dsi,
 	return false;
 }
 
-static u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt)
-{
-	switch (fmt) {
-	case OMAP_DSS_DSI_FMT_RGB888:
-	case OMAP_DSS_DSI_FMT_RGB666:
-		return 24;
-	case OMAP_DSS_DSI_FMT_RGB666_PACKED:
-		return 18;
-	case OMAP_DSS_DSI_FMT_RGB565:
-		return 16;
-	default:
-		BUG();
-		return 0;
-	}
-}
-
 #ifdef DSI_PERF_MEASURE
 static void dsi_perf_mark_setup(struct dsi_data *dsi)
 {
@@ -3239,7 +3224,7 @@ static void dsi_config_vp_num_line_buffers(struct dsi_data *dsi)
 	int num_line_buffers;
 
 	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
-		int bpp = dsi_get_pixel_size(dsi->pix_fmt);
+		int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
 		const struct videomode *vm = &dsi->vm;
 		/*
 		 * Don't use line buffers if width is greater than the video
@@ -3370,7 +3355,7 @@ static void dsi_config_cmd_mode_interleaving(struct dsi_data *dsi)
 	int tclk_trail, ths_exit, exiths_clk;
 	bool ddr_alwon;
 	const struct videomode *vm = &dsi->vm;
-	int bpp = dsi_get_pixel_size(dsi->pix_fmt);
+	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
 	int ndl = dsi->num_lanes_used - 1;
 	int dsi_fclk_hsdiv = dsi->user_dsi_cinfo.mX[HSDIV_DSI] + 1;
 	int hsa_interleave_hs = 0, hsa_interleave_lp = 0;
@@ -3498,7 +3483,7 @@ static int dsi_proto_config(struct dsi_data *dsi)
 	dsi_set_lp_rx_timeout(dsi, 0x1fff, true, true);
 	dsi_set_hs_tx_timeout(dsi, 0x1fff, true, true);
 
-	switch (dsi_get_pixel_size(dsi->pix_fmt)) {
+	switch (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt)) {
 	case 16:
 		buswidth = 0;
 		break;
@@ -3619,7 +3604,7 @@ static void dsi_proto_timings(struct dsi_data *dsi)
 		int window_sync = dsi->vm_timings.window_sync;
 		bool hsync_end;
 		const struct videomode *vm = &dsi->vm;
-		int bpp = dsi_get_pixel_size(dsi->pix_fmt);
+		int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
 		int tl, t_he, width_bytes;
 
 		hsync_end = dsi->vm_timings.trans_mode == OMAP_DSS_DSI_PULSE_MODE;
@@ -3726,7 +3711,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
 static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
-	int bpp = dsi_get_pixel_size(dsi->pix_fmt);
+	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
 	u8 data_type;
 	u16 word_count;
 	int r;
@@ -3737,16 +3722,16 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 
 	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
 		switch (dsi->pix_fmt) {
-		case OMAP_DSS_DSI_FMT_RGB888:
+		case MIPI_DSI_FMT_RGB888:
 			data_type = MIPI_DSI_PACKED_PIXEL_STREAM_24;
 			break;
-		case OMAP_DSS_DSI_FMT_RGB666:
+		case MIPI_DSI_FMT_RGB666:
 			data_type = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
 			break;
-		case OMAP_DSS_DSI_FMT_RGB666_PACKED:
+		case MIPI_DSI_FMT_RGB666_PACKED:
 			data_type = MIPI_DSI_PACKED_PIXEL_STREAM_18;
 			break;
-		case OMAP_DSS_DSI_FMT_RGB565:
+		case MIPI_DSI_FMT_RGB565:
 			data_type = MIPI_DSI_PACKED_PIXEL_STREAM_16;
 			break;
 		default:
@@ -3824,7 +3809,7 @@ static void dsi_update_screen_dispc(struct dsi_data *dsi)
 
 	dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_VP);
 
-	bytespp	= dsi_get_pixel_size(dsi->pix_fmt) / 8;
+	bytespp	= mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) / 8;
 	bytespl = w * bytespp;
 	bytespf = bytespl * h;
 
@@ -3954,7 +3939,7 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
 
 #ifdef DSI_PERF_MEASURE
 	dsi->update_bytes = dw * dh *
-		dsi_get_pixel_size(dsi->pix_fmt) / 8;
+		mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) / 8;
 #endif
 	dsi_update_screen_dispc(dsi);
 
@@ -4015,7 +4000,7 @@ static int dsi_display_init_dispc(struct dsi_data *dsi)
 
 	dsi->mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS;
 	dsi->mgr_config.video_port_width =
-			dsi_get_pixel_size(dsi->pix_fmt);
+			mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
 	dsi->mgr_config.lcden_sig_polarity = 0;
 
 	dss_mgr_set_lcd_config(&dsi->output, &dsi->mgr_config);
@@ -4353,7 +4338,7 @@ static bool dsi_cm_calc(struct dsi_data *dsi,
 	unsigned long pck, txbyteclk;
 
 	clkin = clk_get_rate(dsi->pll.clkin);
-	bitspp = dsi_get_pixel_size(cfg->pixel_format);
+	bitspp = mipi_dsi_pixel_format_to_bpp(cfg->pixel_format);
 	ndl = dsi->num_lanes_used - 1;
 
 	/*
@@ -4386,7 +4371,7 @@ static bool dsi_vm_calc_blanking(struct dsi_clk_calc_ctx *ctx)
 {
 	struct dsi_data *dsi = ctx->dsi;
 	const struct omap_dss_dsi_config *cfg = ctx->config;
-	int bitspp = dsi_get_pixel_size(cfg->pixel_format);
+	int bitspp = mipi_dsi_pixel_format_to_bpp(cfg->pixel_format);
 	int ndl = dsi->num_lanes_used - 1;
 	unsigned long hsclk = ctx->dsi_cinfo.clkdco / 4;
 	unsigned long byteclk = hsclk / 4;
@@ -4653,7 +4638,7 @@ static bool dsi_vm_calc(struct dsi_data *dsi,
 	unsigned long pll_min;
 	unsigned long pll_max;
 	int ndl = dsi->num_lanes_used - 1;
-	int bitspp = dsi_get_pixel_size(cfg->pixel_format);
+	int bitspp = mipi_dsi_pixel_format_to_bpp(cfg->pixel_format);
 	unsigned long byteclk_min;
 
 	clkin = clk_get_rate(dsi->pll.clkin);
@@ -4699,6 +4684,12 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
 	dsi->pix_fmt = config->pixel_format;
 	dsi->mode = config->mode;
 
+	if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) {
+		DSSERR("invalid pixel format\n");
+		r = -EINVAL;
+		goto err;
+	}
+
 	if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
 		ok = dsi_vm_calc(dsi, config, &ctx);
 	else
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index b0424daaceed..c4bc1f919ab4 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -12,8 +12,10 @@
 #include <linux/interrupt.h>
 #include <video/videomode.h>
 #include <linux/platform_data/omapdss.h>
-#include <uapi/drm/drm_mode.h>
+
 #include <drm/drm_crtc.h>
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_mode.h>
 
 #define DISPC_IRQ_FRAMEDONE		(1 << 0)
 #define DISPC_IRQ_VSYNC			(1 << 1)
@@ -116,13 +118,6 @@ enum omap_dss_venc_type {
 	OMAP_DSS_VENC_TYPE_SVIDEO,
 };
 
-enum omap_dss_dsi_pixel_format {
-	OMAP_DSS_DSI_FMT_RGB888,
-	OMAP_DSS_DSI_FMT_RGB666,
-	OMAP_DSS_DSI_FMT_RGB666_PACKED,
-	OMAP_DSS_DSI_FMT_RGB565,
-};
-
 enum omap_dss_dsi_mode {
 	OMAP_DSS_DSI_CMD_MODE = 0,
 	OMAP_DSS_DSI_VIDEO_MODE,
@@ -210,7 +205,7 @@ struct omap_dss_dsi_videomode_timings {
 
 struct omap_dss_dsi_config {
 	enum omap_dss_dsi_mode mode;
-	enum omap_dss_dsi_pixel_format pixel_format;
+	enum mipi_dsi_pixel_format pixel_format;
 	const struct videomode *vm;
 
 	unsigned long hs_clk_min, hs_clk_max;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 04/56] drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_*
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This replaces OMAP specific enum for pixel format with
common implementation.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 +-
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 55 ++++++++-----------
 drivers/gpu/drm/omapdrm/dss/omapdss.h         | 13 ++---
 3 files changed, 28 insertions(+), 42 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index ff610d2a13fd..b8f3a7aacbf4 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -595,7 +595,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	int r;
 	struct omap_dss_dsi_config dsi_config = {
 		.mode = OMAP_DSS_DSI_CMD_MODE,
-		.pixel_format = OMAP_DSS_DSI_FMT_RGB888,
+		.pixel_format = MIPI_DSI_FMT_RGB888,
 		.vm = &ddata->vm,
 		.hs_clk_min = 150000000,
 		.hs_clk_max = 300000000,
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 5598fc8f91db..86b9d435fb94 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -33,6 +33,7 @@
 #include <linux/component.h>
 #include <linux/sys_soc.h>
 
+#include <drm/drm_mipi_dsi.h>
 #include <video/mipi_display.h>
 
 #include "omapdss.h"
@@ -410,7 +411,7 @@ struct dsi_data {
 
 	struct dss_lcd_mgr_config mgr_config;
 	struct videomode vm;
-	enum omap_dss_dsi_pixel_format pix_fmt;
+	enum mipi_dsi_pixel_format pix_fmt;
 	enum omap_dss_dsi_mode mode;
 	struct omap_dss_dsi_videomode_timings vm_timings;
 
@@ -514,22 +515,6 @@ static inline bool wait_for_bit_change(struct dsi_data *dsi,
 	return false;
 }
 
-static u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt)
-{
-	switch (fmt) {
-	case OMAP_DSS_DSI_FMT_RGB888:
-	case OMAP_DSS_DSI_FMT_RGB666:
-		return 24;
-	case OMAP_DSS_DSI_FMT_RGB666_PACKED:
-		return 18;
-	case OMAP_DSS_DSI_FMT_RGB565:
-		return 16;
-	default:
-		BUG();
-		return 0;
-	}
-}
-
 #ifdef DSI_PERF_MEASURE
 static void dsi_perf_mark_setup(struct dsi_data *dsi)
 {
@@ -3239,7 +3224,7 @@ static void dsi_config_vp_num_line_buffers(struct dsi_data *dsi)
 	int num_line_buffers;
 
 	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
-		int bpp = dsi_get_pixel_size(dsi->pix_fmt);
+		int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
 		const struct videomode *vm = &dsi->vm;
 		/*
 		 * Don't use line buffers if width is greater than the video
@@ -3370,7 +3355,7 @@ static void dsi_config_cmd_mode_interleaving(struct dsi_data *dsi)
 	int tclk_trail, ths_exit, exiths_clk;
 	bool ddr_alwon;
 	const struct videomode *vm = &dsi->vm;
-	int bpp = dsi_get_pixel_size(dsi->pix_fmt);
+	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
 	int ndl = dsi->num_lanes_used - 1;
 	int dsi_fclk_hsdiv = dsi->user_dsi_cinfo.mX[HSDIV_DSI] + 1;
 	int hsa_interleave_hs = 0, hsa_interleave_lp = 0;
@@ -3498,7 +3483,7 @@ static int dsi_proto_config(struct dsi_data *dsi)
 	dsi_set_lp_rx_timeout(dsi, 0x1fff, true, true);
 	dsi_set_hs_tx_timeout(dsi, 0x1fff, true, true);
 
-	switch (dsi_get_pixel_size(dsi->pix_fmt)) {
+	switch (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt)) {
 	case 16:
 		buswidth = 0;
 		break;
@@ -3619,7 +3604,7 @@ static void dsi_proto_timings(struct dsi_data *dsi)
 		int window_sync = dsi->vm_timings.window_sync;
 		bool hsync_end;
 		const struct videomode *vm = &dsi->vm;
-		int bpp = dsi_get_pixel_size(dsi->pix_fmt);
+		int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
 		int tl, t_he, width_bytes;
 
 		hsync_end = dsi->vm_timings.trans_mode == OMAP_DSS_DSI_PULSE_MODE;
@@ -3726,7 +3711,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
 static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
-	int bpp = dsi_get_pixel_size(dsi->pix_fmt);
+	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
 	u8 data_type;
 	u16 word_count;
 	int r;
@@ -3737,16 +3722,16 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 
 	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
 		switch (dsi->pix_fmt) {
-		case OMAP_DSS_DSI_FMT_RGB888:
+		case MIPI_DSI_FMT_RGB888:
 			data_type = MIPI_DSI_PACKED_PIXEL_STREAM_24;
 			break;
-		case OMAP_DSS_DSI_FMT_RGB666:
+		case MIPI_DSI_FMT_RGB666:
 			data_type = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
 			break;
-		case OMAP_DSS_DSI_FMT_RGB666_PACKED:
+		case MIPI_DSI_FMT_RGB666_PACKED:
 			data_type = MIPI_DSI_PACKED_PIXEL_STREAM_18;
 			break;
-		case OMAP_DSS_DSI_FMT_RGB565:
+		case MIPI_DSI_FMT_RGB565:
 			data_type = MIPI_DSI_PACKED_PIXEL_STREAM_16;
 			break;
 		default:
@@ -3824,7 +3809,7 @@ static void dsi_update_screen_dispc(struct dsi_data *dsi)
 
 	dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_VP);
 
-	bytespp	= dsi_get_pixel_size(dsi->pix_fmt) / 8;
+	bytespp	= mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) / 8;
 	bytespl = w * bytespp;
 	bytespf = bytespl * h;
 
@@ -3954,7 +3939,7 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
 
 #ifdef DSI_PERF_MEASURE
 	dsi->update_bytes = dw * dh *
-		dsi_get_pixel_size(dsi->pix_fmt) / 8;
+		mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) / 8;
 #endif
 	dsi_update_screen_dispc(dsi);
 
@@ -4015,7 +4000,7 @@ static int dsi_display_init_dispc(struct dsi_data *dsi)
 
 	dsi->mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS;
 	dsi->mgr_config.video_port_width =
-			dsi_get_pixel_size(dsi->pix_fmt);
+			mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
 	dsi->mgr_config.lcden_sig_polarity = 0;
 
 	dss_mgr_set_lcd_config(&dsi->output, &dsi->mgr_config);
@@ -4353,7 +4338,7 @@ static bool dsi_cm_calc(struct dsi_data *dsi,
 	unsigned long pck, txbyteclk;
 
 	clkin = clk_get_rate(dsi->pll.clkin);
-	bitspp = dsi_get_pixel_size(cfg->pixel_format);
+	bitspp = mipi_dsi_pixel_format_to_bpp(cfg->pixel_format);
 	ndl = dsi->num_lanes_used - 1;
 
 	/*
@@ -4386,7 +4371,7 @@ static bool dsi_vm_calc_blanking(struct dsi_clk_calc_ctx *ctx)
 {
 	struct dsi_data *dsi = ctx->dsi;
 	const struct omap_dss_dsi_config *cfg = ctx->config;
-	int bitspp = dsi_get_pixel_size(cfg->pixel_format);
+	int bitspp = mipi_dsi_pixel_format_to_bpp(cfg->pixel_format);
 	int ndl = dsi->num_lanes_used - 1;
 	unsigned long hsclk = ctx->dsi_cinfo.clkdco / 4;
 	unsigned long byteclk = hsclk / 4;
@@ -4653,7 +4638,7 @@ static bool dsi_vm_calc(struct dsi_data *dsi,
 	unsigned long pll_min;
 	unsigned long pll_max;
 	int ndl = dsi->num_lanes_used - 1;
-	int bitspp = dsi_get_pixel_size(cfg->pixel_format);
+	int bitspp = mipi_dsi_pixel_format_to_bpp(cfg->pixel_format);
 	unsigned long byteclk_min;
 
 	clkin = clk_get_rate(dsi->pll.clkin);
@@ -4699,6 +4684,12 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
 	dsi->pix_fmt = config->pixel_format;
 	dsi->mode = config->mode;
 
+	if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) {
+		DSSERR("invalid pixel format\n");
+		r = -EINVAL;
+		goto err;
+	}
+
 	if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
 		ok = dsi_vm_calc(dsi, config, &ctx);
 	else
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index b0424daaceed..c4bc1f919ab4 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -12,8 +12,10 @@
 #include <linux/interrupt.h>
 #include <video/videomode.h>
 #include <linux/platform_data/omapdss.h>
-#include <uapi/drm/drm_mode.h>
+
 #include <drm/drm_crtc.h>
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_mode.h>
 
 #define DISPC_IRQ_FRAMEDONE		(1 << 0)
 #define DISPC_IRQ_VSYNC			(1 << 1)
@@ -116,13 +118,6 @@ enum omap_dss_venc_type {
 	OMAP_DSS_VENC_TYPE_SVIDEO,
 };
 
-enum omap_dss_dsi_pixel_format {
-	OMAP_DSS_DSI_FMT_RGB888,
-	OMAP_DSS_DSI_FMT_RGB666,
-	OMAP_DSS_DSI_FMT_RGB666_PACKED,
-	OMAP_DSS_DSI_FMT_RGB565,
-};
-
 enum omap_dss_dsi_mode {
 	OMAP_DSS_DSI_CMD_MODE = 0,
 	OMAP_DSS_DSI_VIDEO_MODE,
@@ -210,7 +205,7 @@ struct omap_dss_dsi_videomode_timings {
 
 struct omap_dss_dsi_config {
 	enum omap_dss_dsi_mode mode;
-	enum omap_dss_dsi_pixel_format pixel_format;
+	enum mipi_dsi_pixel_format pixel_format;
 	const struct videomode *vm;
 
 	unsigned long hs_clk_min, hs_clk_max;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 05/56] drm/omap: constify write buffers
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The write buffers are not modified, so they can be constant.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c     | 24 ++++++++++++------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 10 +++++-----
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 86b9d435fb94..22d74d762a10 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2601,11 +2601,11 @@ static inline void dsi_vc_write_long_payload(struct dsi_data *dsi, int channel,
 }
 
 static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
-			    u8 *data, u16 len, u8 ecc)
+			    const u8 *data, u16 len, u8 ecc)
 {
 	/*u32 val; */
 	int i;
-	u8 *p;
+	const u8 *p;
 	int r = 0;
 	u8 b1, b2, b3, b4;
 
@@ -2698,7 +2698,7 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
 }
 
 static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
-				      u8 *data, int len,
+				      const u8 *data, int len,
 				      enum dss_dsi_content_type type)
 {
 	int r;
@@ -2729,7 +2729,7 @@ static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
 }
 
 static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
-		u8 *data, int len)
+		const u8 *data, int len)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 
@@ -2738,7 +2738,7 @@ static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
 }
 
 static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
-		u8 *data, int len)
+		const u8 *data, int len)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 
@@ -2747,7 +2747,7 @@ static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int chann
 }
 
 static int dsi_vc_write_common(struct omap_dss_device *dssdev,
-			       int channel, u8 *data, int len,
+			       int channel, const u8 *data, int len,
 			       enum dss_dsi_content_type type)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
@@ -2776,15 +2776,15 @@ static int dsi_vc_write_common(struct omap_dss_device *dssdev,
 	return r;
 }
 
-static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data,
-		int len)
+static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel,
+		const u8 *data, int len)
 {
 	return dsi_vc_write_common(dssdev, channel, data, len,
 			DSS_DSI_CONTENT_DCS);
 }
 
-static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 *data,
-		int len)
+static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel,
+		const u8 *data, int len)
 {
 	return dsi_vc_write_common(dssdev, channel, data, len,
 			DSS_DSI_CONTENT_GENERIC);
@@ -2810,7 +2810,7 @@ static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
 }
 
 static int dsi_vc_generic_send_read_request(struct dsi_data *dsi, int channel,
-					    u8 *reqdata, int reqlen)
+					    const u8 *reqdata, int reqlen)
 {
 	u16 data;
 	u8 data_type;
@@ -2983,7 +2983,7 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_c
 }
 
 static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
-		u8 *reqdata, int reqlen, u8 *buf, int buflen)
+		const u8 *reqdata, int reqlen, u8 *buf, int buflen)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 	int r;
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index c4bc1f919ab4..8e96ab2f20b6 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -309,18 +309,18 @@ struct omapdss_dsi_ops {
 
 	/* data transfer */
 	int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
-			u8 *data, int len);
+			const u8 *data, int len);
 	int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
-			u8 *data, int len);
+			const u8 *data, int len);
 	int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
 			u8 *data, int len);
 
 	int (*gen_write)(struct omap_dss_device *dssdev, int channel,
-			u8 *data, int len);
+			const u8 *data, int len);
 	int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
-			u8 *data, int len);
+			const u8 *data, int len);
 	int (*gen_read)(struct omap_dss_device *dssdev, int channel,
-			u8 *reqdata, int reqlen,
+			const u8 *reqdata, int reqlen,
 			u8 *data, int len);
 
 	int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 05/56] drm/omap: constify write buffers
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The write buffers are not modified, so they can be constant.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c     | 24 ++++++++++++------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 10 +++++-----
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 86b9d435fb94..22d74d762a10 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2601,11 +2601,11 @@ static inline void dsi_vc_write_long_payload(struct dsi_data *dsi, int channel,
 }
 
 static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
-			    u8 *data, u16 len, u8 ecc)
+			    const u8 *data, u16 len, u8 ecc)
 {
 	/*u32 val; */
 	int i;
-	u8 *p;
+	const u8 *p;
 	int r = 0;
 	u8 b1, b2, b3, b4;
 
@@ -2698,7 +2698,7 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
 }
 
 static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
-				      u8 *data, int len,
+				      const u8 *data, int len,
 				      enum dss_dsi_content_type type)
 {
 	int r;
@@ -2729,7 +2729,7 @@ static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
 }
 
 static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
-		u8 *data, int len)
+		const u8 *data, int len)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 
@@ -2738,7 +2738,7 @@ static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
 }
 
 static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
-		u8 *data, int len)
+		const u8 *data, int len)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 
@@ -2747,7 +2747,7 @@ static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int chann
 }
 
 static int dsi_vc_write_common(struct omap_dss_device *dssdev,
-			       int channel, u8 *data, int len,
+			       int channel, const u8 *data, int len,
 			       enum dss_dsi_content_type type)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
@@ -2776,15 +2776,15 @@ static int dsi_vc_write_common(struct omap_dss_device *dssdev,
 	return r;
 }
 
-static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data,
-		int len)
+static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel,
+		const u8 *data, int len)
 {
 	return dsi_vc_write_common(dssdev, channel, data, len,
 			DSS_DSI_CONTENT_DCS);
 }
 
-static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 *data,
-		int len)
+static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel,
+		const u8 *data, int len)
 {
 	return dsi_vc_write_common(dssdev, channel, data, len,
 			DSS_DSI_CONTENT_GENERIC);
@@ -2810,7 +2810,7 @@ static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
 }
 
 static int dsi_vc_generic_send_read_request(struct dsi_data *dsi, int channel,
-					    u8 *reqdata, int reqlen)
+					    const u8 *reqdata, int reqlen)
 {
 	u16 data;
 	u8 data_type;
@@ -2983,7 +2983,7 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_c
 }
 
 static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
-		u8 *reqdata, int reqlen, u8 *buf, int buflen)
+		const u8 *reqdata, int reqlen, u8 *buf, int buflen)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 	int r;
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index c4bc1f919ab4..8e96ab2f20b6 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -309,18 +309,18 @@ struct omapdss_dsi_ops {
 
 	/* data transfer */
 	int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
-			u8 *data, int len);
+			const u8 *data, int len);
 	int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
-			u8 *data, int len);
+			const u8 *data, int len);
 	int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
 			u8 *data, int len);
 
 	int (*gen_write)(struct omap_dss_device *dssdev, int channel,
-			u8 *data, int len);
+			const u8 *data, int len);
 	int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
-			u8 *data, int len);
+			const u8 *data, int len);
 	int (*gen_read)(struct omap_dss_device *dssdev, int channel,
-			u8 *reqdata, int reqlen,
+			const u8 *reqdata, int reqlen,
 			u8 *data, int len);
 
 	int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 06/56] drm/omap: dsi: add generic transfer function
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This prepares the driver for becoming a mipi_dsi_host implementation,
which provides a generic transfer function instead of all kind of
different read/write functions. The implementation will become more
elegant after unexporting the specific functions in the following
patches.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c     | 54 +++++++++++++++++++++++++++
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 ++
 2 files changed, 57 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 22d74d762a10..59a62d1d41cb 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4842,6 +4842,58 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
 	}
 }
 
+static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
+				 const struct mipi_dsi_msg *msg)
+{
+	/*
+	 * no_sync can be used to optimize performance by sending e.g. column
+	 * and page information without syncing in between. It's not absolutley
+	 * required, so postpone this feature for now.
+	 */
+	bool no_sync = false;
+	u16 val;
+
+	switch (msg->type) {
+	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
+	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
+	case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
+	case MIPI_DSI_GENERIC_LONG_WRITE:
+		if (no_sync)
+			return dsi_vc_generic_write_nosync(dssdev, msg->channel,
+							   msg->tx_buf,
+							   msg->tx_len);
+		else
+			return dsi_vc_generic_write(dssdev, msg->channel,
+						    msg->tx_buf, msg->tx_len);
+	case MIPI_DSI_DCS_SHORT_WRITE:
+	case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
+	case MIPI_DSI_DCS_LONG_WRITE:
+		if (no_sync)
+			return dsi_vc_dcs_write_nosync(dssdev, msg->channel,
+						       msg->tx_buf,
+						       msg->tx_len);
+		else
+			return dsi_vc_dcs_write(dssdev, msg->channel,
+						msg->tx_buf, msg->tx_len);
+	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
+	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
+	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
+		return dsi_vc_generic_read(dssdev, msg->channel,
+					   msg->tx_buf, msg->tx_len,
+					   msg->rx_buf, msg->rx_len);
+	case MIPI_DSI_DCS_READ:
+		return dsi_vc_dcs_read(dssdev, msg->channel,
+				       ((u8 *)msg->tx_buf)[0],
+				       msg->rx_buf, msg->rx_len);
+	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
+		val = le16_to_cpu(*((__le16 *)msg->tx_buf));
+		return dsi_vc_set_max_rx_packet_size(dssdev, msg->channel, val);
+	case MIPI_DSI_NULL_PACKET:
+		return dsi_vc_send_null(to_dsi_data(dssdev), msg->channel);
+	}
+
+	return -EINVAL;
+}
 
 static int dsi_get_clocks(struct dsi_data *dsi)
 {
@@ -4896,6 +4948,8 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.set_vc_id = dsi_set_vc_id,
 		.release_vc = dsi_release_vc,
 
+		.transfer = omap_dsi_transfer,
+
 		.dcs_write = dsi_vc_dcs_write,
 		.dcs_write_nosync = dsi_vc_dcs_write_nosync,
 		.dcs_read = dsi_vc_dcs_read,
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 8e96ab2f20b6..654618e5a4e5 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -308,6 +308,9 @@ struct omapdss_dsi_ops {
 	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
 
 	/* data transfer */
+	ssize_t (*transfer)(struct omap_dss_device *dssdev,
+			    const struct mipi_dsi_msg *msg);
+
 	int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
 			const u8 *data, int len);
 	int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 06/56] drm/omap: dsi: add generic transfer function
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This prepares the driver for becoming a mipi_dsi_host implementation,
which provides a generic transfer function instead of all kind of
different read/write functions. The implementation will become more
elegant after unexporting the specific functions in the following
patches.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c     | 54 +++++++++++++++++++++++++++
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 ++
 2 files changed, 57 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 22d74d762a10..59a62d1d41cb 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4842,6 +4842,58 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
 	}
 }
 
+static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
+				 const struct mipi_dsi_msg *msg)
+{
+	/*
+	 * no_sync can be used to optimize performance by sending e.g. column
+	 * and page information without syncing in between. It's not absolutley
+	 * required, so postpone this feature for now.
+	 */
+	bool no_sync = false;
+	u16 val;
+
+	switch (msg->type) {
+	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
+	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
+	case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
+	case MIPI_DSI_GENERIC_LONG_WRITE:
+		if (no_sync)
+			return dsi_vc_generic_write_nosync(dssdev, msg->channel,
+							   msg->tx_buf,
+							   msg->tx_len);
+		else
+			return dsi_vc_generic_write(dssdev, msg->channel,
+						    msg->tx_buf, msg->tx_len);
+	case MIPI_DSI_DCS_SHORT_WRITE:
+	case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
+	case MIPI_DSI_DCS_LONG_WRITE:
+		if (no_sync)
+			return dsi_vc_dcs_write_nosync(dssdev, msg->channel,
+						       msg->tx_buf,
+						       msg->tx_len);
+		else
+			return dsi_vc_dcs_write(dssdev, msg->channel,
+						msg->tx_buf, msg->tx_len);
+	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
+	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
+	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
+		return dsi_vc_generic_read(dssdev, msg->channel,
+					   msg->tx_buf, msg->tx_len,
+					   msg->rx_buf, msg->rx_len);
+	case MIPI_DSI_DCS_READ:
+		return dsi_vc_dcs_read(dssdev, msg->channel,
+				       ((u8 *)msg->tx_buf)[0],
+				       msg->rx_buf, msg->rx_len);
+	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
+		val = le16_to_cpu(*((__le16 *)msg->tx_buf));
+		return dsi_vc_set_max_rx_packet_size(dssdev, msg->channel, val);
+	case MIPI_DSI_NULL_PACKET:
+		return dsi_vc_send_null(to_dsi_data(dssdev), msg->channel);
+	}
+
+	return -EINVAL;
+}
 
 static int dsi_get_clocks(struct dsi_data *dsi)
 {
@@ -4896,6 +4948,8 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.set_vc_id = dsi_set_vc_id,
 		.release_vc = dsi_release_vc,
 
+		.transfer = omap_dsi_transfer,
+
 		.dcs_write = dsi_vc_dcs_write,
 		.dcs_write_nosync = dsi_vc_dcs_write_nosync,
 		.dcs_read = dsi_vc_dcs_read,
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 8e96ab2f20b6..654618e5a4e5 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -308,6 +308,9 @@ struct omapdss_dsi_ops {
 	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
 
 	/* data transfer */
+	ssize_t (*transfer)(struct omap_dss_device *dssdev,
+			    const struct mipi_dsi_msg *msg);
+
 	int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
 			const u8 *data, int len);
 	int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 07/56] drm/omap: panel-dsi-cm: convert to transfer API
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This converts the panel-dsi-cm driver to use the transfer
API instead of specific functions, so that the specific
functions can be unexported and squashed into the generic
transfer function.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 132 +++++++++++++-----
 1 file changed, 95 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index b8f3a7aacbf4..8b2e80129bd8 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -140,45 +140,61 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
 static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
 {
 	struct omap_dss_device *src = ddata->src;
-	int r;
-	u8 buf[1];
-
-	r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd, buf, 1);
-
-	if (r < 0)
-		return r;
-
-	*data = buf[0];
+	const struct mipi_dsi_msg msg = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_DCS_READ,
+		.tx_len = 1,
+		.tx_buf = &dcs_cmd,
+		.rx_len = 1,
+		.rx_buf = data
+	};
 
-	return 0;
+	return src->ops->dsi.transfer(src, &msg);
 }
 
 static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
 {
 	struct omap_dss_device *src = ddata->src;
+	const struct mipi_dsi_msg msg = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_DCS_SHORT_WRITE,
+		.tx_buf = &dcs_cmd,
+		.tx_len = 1,
+	};
 
-	return src->ops->dsi.dcs_write(src, ddata->channel, &dcs_cmd, 1);
+	return src->ops->dsi.transfer(src, &msg);
 }
 
 static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
 {
 	struct omap_dss_device *src = ddata->src;
-	u8 buf[2] = { dcs_cmd, param };
+	const u8 buf[] = { dcs_cmd, param };
+	const struct mipi_dsi_msg msg = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_DCS_SHORT_WRITE_PARAM,
+		.tx_buf = &buf,
+		.tx_len = 2,
+	};
 
-	return src->ops->dsi.dcs_write(src, ddata->channel, buf, 2);
+	return src->ops->dsi.transfer(src, &msg);
 }
 
 static int dsicm_sleep_in(struct panel_drv_data *ddata)
 
 {
 	struct omap_dss_device *src = ddata->src;
-	u8 cmd;
 	int r;
+	const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
+	const struct mipi_dsi_msg msg = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_DCS_SHORT_WRITE,
+		.tx_buf = &cmd,
+		.tx_len = 1,
+	};
 
 	hw_guard_wait(ddata);
 
-	cmd = MIPI_DCS_ENTER_SLEEP_MODE;
-	r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, &cmd, 1);
+	r = src->ops->dsi.transfer(src, &msg);
 	if (r)
 		return r;
 
@@ -233,28 +249,43 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
 	u16 y1 = y;
 	u16 y2 = y + h - 1;
 
-	u8 buf[5];
-	buf[0] = MIPI_DCS_SET_COLUMN_ADDRESS;
-	buf[1] = (x1 >> 8) & 0xff;
-	buf[2] = (x1 >> 0) & 0xff;
-	buf[3] = (x2 >> 8) & 0xff;
-	buf[4] = (x2 >> 0) & 0xff;
+	const u8 paramX[] = {
+		MIPI_DCS_SET_COLUMN_ADDRESS,
+		(x1 >> 8) & 0xff,
+		(x1 >> 0) & 0xff,
+		(x2 >> 8) & 0xff,
+		(x2 >> 0) & 0xff,
+	};
 
-	r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, sizeof(buf));
-	if (r)
-		return r;
+	const struct mipi_dsi_msg msgX = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_GENERIC_LONG_WRITE,
+		.tx_buf = paramX,
+		.tx_len = 5,
+	};
+
+	const u8 paramY[] = {
+		MIPI_DCS_SET_PAGE_ADDRESS,
+		(y1 >> 8) & 0xff,
+		(y1 >> 0) & 0xff,
+		(y2 >> 8) & 0xff,
+		(y2 >> 0) & 0xff,
+	};
 
-	buf[0] = MIPI_DCS_SET_PAGE_ADDRESS;
-	buf[1] = (y1 >> 8) & 0xff;
-	buf[2] = (y1 >> 0) & 0xff;
-	buf[3] = (y2 >> 8) & 0xff;
-	buf[4] = (y2 >> 0) & 0xff;
+	const struct mipi_dsi_msg msgY = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_GENERIC_LONG_WRITE,
+		.tx_buf = paramY,
+		.tx_len = 5,
+	};
 
-	r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, sizeof(buf));
+	r = src->ops->dsi.transfer(src, &msgX);
 	if (r)
 		return r;
 
-	src->ops->dsi.bta_sync(src, ddata->channel);
+	r = src->ops->dsi.transfer(src, &msgY);
+	if (r)
+		return r;
 
 	return r;
 }
@@ -991,6 +1022,27 @@ static int dsicm_get_te(struct omap_dss_device *dssdev)
 	return r;
 }
 
+static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
+					u16 size)
+{
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	struct omap_dss_device *src = ddata->src;
+
+	const u8 buf[] = {
+		size & 0xff,
+		size >> 8 & 0xff,
+	};
+
+	const struct mipi_dsi_msg msg = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
+		.tx_buf = buf,
+		.tx_len = 2,
+	};
+
+	return src->ops->dsi.transfer(src, &msg);
+}
+
 static int dsicm_memory_read(struct omap_dss_device *dssdev,
 		void *buf, size_t size,
 		u16 x, u16 y, u16 w, u16 h)
@@ -1031,17 +1083,23 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
 
 	dsicm_set_update_window(ddata, x, y, w, h);
 
-	r = src->ops->dsi.set_max_rx_packet_size(src, ddata->channel, plen);
+	r = dsicm_set_max_rx_packet_size(dssdev, plen);
 	if (r)
 		goto err2;
 
 	while (buf_used < size) {
 		u8 dcs_cmd = first ? 0x2e : 0x3e;
+		const struct mipi_dsi_msg msg = {
+			.channel = ddata->channel,
+			.type = MIPI_DSI_DCS_READ,
+			.tx_buf = &dcs_cmd,
+			.tx_len = 1,
+			.rx_buf = buf + buf_used,
+			.rx_len = size - buf_used,
+		};
 		first = 0;
 
-		r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd,
-				buf + buf_used, size - buf_used);
-
+		r = src->ops->dsi.transfer(src, &msg);
 		if (r < 0) {
 			dev_err(dssdev->dev, "read error\n");
 			goto err3;
@@ -1065,7 +1123,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
 	r = buf_used;
 
 err3:
-	src->ops->dsi.set_max_rx_packet_size(src, ddata->channel, 1);
+	dsicm_set_max_rx_packet_size(dssdev, 1);
 err2:
 	src->ops->dsi.bus_unlock(src);
 err1:
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 07/56] drm/omap: panel-dsi-cm: convert to transfer API
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This converts the panel-dsi-cm driver to use the transfer
API instead of specific functions, so that the specific
functions can be unexported and squashed into the generic
transfer function.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 132 +++++++++++++-----
 1 file changed, 95 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index b8f3a7aacbf4..8b2e80129bd8 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -140,45 +140,61 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
 static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
 {
 	struct omap_dss_device *src = ddata->src;
-	int r;
-	u8 buf[1];
-
-	r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd, buf, 1);
-
-	if (r < 0)
-		return r;
-
-	*data = buf[0];
+	const struct mipi_dsi_msg msg = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_DCS_READ,
+		.tx_len = 1,
+		.tx_buf = &dcs_cmd,
+		.rx_len = 1,
+		.rx_buf = data
+	};
 
-	return 0;
+	return src->ops->dsi.transfer(src, &msg);
 }
 
 static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
 {
 	struct omap_dss_device *src = ddata->src;
+	const struct mipi_dsi_msg msg = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_DCS_SHORT_WRITE,
+		.tx_buf = &dcs_cmd,
+		.tx_len = 1,
+	};
 
-	return src->ops->dsi.dcs_write(src, ddata->channel, &dcs_cmd, 1);
+	return src->ops->dsi.transfer(src, &msg);
 }
 
 static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
 {
 	struct omap_dss_device *src = ddata->src;
-	u8 buf[2] = { dcs_cmd, param };
+	const u8 buf[] = { dcs_cmd, param };
+	const struct mipi_dsi_msg msg = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_DCS_SHORT_WRITE_PARAM,
+		.tx_buf = &buf,
+		.tx_len = 2,
+	};
 
-	return src->ops->dsi.dcs_write(src, ddata->channel, buf, 2);
+	return src->ops->dsi.transfer(src, &msg);
 }
 
 static int dsicm_sleep_in(struct panel_drv_data *ddata)
 
 {
 	struct omap_dss_device *src = ddata->src;
-	u8 cmd;
 	int r;
+	const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
+	const struct mipi_dsi_msg msg = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_DCS_SHORT_WRITE,
+		.tx_buf = &cmd,
+		.tx_len = 1,
+	};
 
 	hw_guard_wait(ddata);
 
-	cmd = MIPI_DCS_ENTER_SLEEP_MODE;
-	r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, &cmd, 1);
+	r = src->ops->dsi.transfer(src, &msg);
 	if (r)
 		return r;
 
@@ -233,28 +249,43 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
 	u16 y1 = y;
 	u16 y2 = y + h - 1;
 
-	u8 buf[5];
-	buf[0] = MIPI_DCS_SET_COLUMN_ADDRESS;
-	buf[1] = (x1 >> 8) & 0xff;
-	buf[2] = (x1 >> 0) & 0xff;
-	buf[3] = (x2 >> 8) & 0xff;
-	buf[4] = (x2 >> 0) & 0xff;
+	const u8 paramX[] = {
+		MIPI_DCS_SET_COLUMN_ADDRESS,
+		(x1 >> 8) & 0xff,
+		(x1 >> 0) & 0xff,
+		(x2 >> 8) & 0xff,
+		(x2 >> 0) & 0xff,
+	};
 
-	r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, sizeof(buf));
-	if (r)
-		return r;
+	const struct mipi_dsi_msg msgX = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_GENERIC_LONG_WRITE,
+		.tx_buf = paramX,
+		.tx_len = 5,
+	};
+
+	const u8 paramY[] = {
+		MIPI_DCS_SET_PAGE_ADDRESS,
+		(y1 >> 8) & 0xff,
+		(y1 >> 0) & 0xff,
+		(y2 >> 8) & 0xff,
+		(y2 >> 0) & 0xff,
+	};
 
-	buf[0] = MIPI_DCS_SET_PAGE_ADDRESS;
-	buf[1] = (y1 >> 8) & 0xff;
-	buf[2] = (y1 >> 0) & 0xff;
-	buf[3] = (y2 >> 8) & 0xff;
-	buf[4] = (y2 >> 0) & 0xff;
+	const struct mipi_dsi_msg msgY = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_GENERIC_LONG_WRITE,
+		.tx_buf = paramY,
+		.tx_len = 5,
+	};
 
-	r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, sizeof(buf));
+	r = src->ops->dsi.transfer(src, &msgX);
 	if (r)
 		return r;
 
-	src->ops->dsi.bta_sync(src, ddata->channel);
+	r = src->ops->dsi.transfer(src, &msgY);
+	if (r)
+		return r;
 
 	return r;
 }
@@ -991,6 +1022,27 @@ static int dsicm_get_te(struct omap_dss_device *dssdev)
 	return r;
 }
 
+static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
+					u16 size)
+{
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	struct omap_dss_device *src = ddata->src;
+
+	const u8 buf[] = {
+		size & 0xff,
+		size >> 8 & 0xff,
+	};
+
+	const struct mipi_dsi_msg msg = {
+		.channel = ddata->channel,
+		.type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
+		.tx_buf = buf,
+		.tx_len = 2,
+	};
+
+	return src->ops->dsi.transfer(src, &msg);
+}
+
 static int dsicm_memory_read(struct omap_dss_device *dssdev,
 		void *buf, size_t size,
 		u16 x, u16 y, u16 w, u16 h)
@@ -1031,17 +1083,23 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
 
 	dsicm_set_update_window(ddata, x, y, w, h);
 
-	r = src->ops->dsi.set_max_rx_packet_size(src, ddata->channel, plen);
+	r = dsicm_set_max_rx_packet_size(dssdev, plen);
 	if (r)
 		goto err2;
 
 	while (buf_used < size) {
 		u8 dcs_cmd = first ? 0x2e : 0x3e;
+		const struct mipi_dsi_msg msg = {
+			.channel = ddata->channel,
+			.type = MIPI_DSI_DCS_READ,
+			.tx_buf = &dcs_cmd,
+			.tx_len = 1,
+			.rx_buf = buf + buf_used,
+			.rx_len = size - buf_used,
+		};
 		first = 0;
 
-		r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd,
-				buf + buf_used, size - buf_used);
-
+		r = src->ops->dsi.transfer(src, &msg);
 		if (r < 0) {
 			dev_err(dssdev->dev, "read error\n");
 			goto err3;
@@ -1065,7 +1123,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
 	r = buf_used;
 
 err3:
-	src->ops->dsi.set_max_rx_packet_size(src, ddata->channel, 1);
+	dsicm_set_max_rx_packet_size(dssdev, 1);
 err2:
 	src->ops->dsi.bus_unlock(src);
 err1:
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 08/56] drm/omap: dsi: unexport specific data transfer functions
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

After converting all DSI drivers, unexport the specific transfer
functions.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c     | 12 ------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 20 --------------------
 2 files changed, 32 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 59a62d1d41cb..2270730b16db 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4949,18 +4949,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.release_vc = dsi_release_vc,
 
 		.transfer = omap_dsi_transfer,
-
-		.dcs_write = dsi_vc_dcs_write,
-		.dcs_write_nosync = dsi_vc_dcs_write_nosync,
-		.dcs_read = dsi_vc_dcs_read,
-
-		.gen_write = dsi_vc_generic_write,
-		.gen_write_nosync = dsi_vc_generic_write_nosync,
-		.gen_read = dsi_vc_generic_read,
-
-		.bta_sync = dsi_vc_send_bta_sync,
-
-		.set_max_rx_packet_size = dsi_vc_set_max_rx_packet_size,
 	},
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 654618e5a4e5..9ead877cb24c 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -310,26 +310,6 @@ struct omapdss_dsi_ops {
 	/* data transfer */
 	ssize_t (*transfer)(struct omap_dss_device *dssdev,
 			    const struct mipi_dsi_msg *msg);
-
-	int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
-			const u8 *data, int len);
-	int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
-			const u8 *data, int len);
-	int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
-			u8 *data, int len);
-
-	int (*gen_write)(struct omap_dss_device *dssdev, int channel,
-			const u8 *data, int len);
-	int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
-			const u8 *data, int len);
-	int (*gen_read)(struct omap_dss_device *dssdev, int channel,
-			const u8 *reqdata, int reqlen,
-			u8 *data, int len);
-
-	int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
-
-	int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
-			int channel, u16 plen);
 };
 
 struct omap_dss_device_ops {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 08/56] drm/omap: dsi: unexport specific data transfer functions
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

After converting all DSI drivers, unexport the specific transfer
functions.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c     | 12 ------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 20 --------------------
 2 files changed, 32 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 59a62d1d41cb..2270730b16db 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4949,18 +4949,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.release_vc = dsi_release_vc,
 
 		.transfer = omap_dsi_transfer,
-
-		.dcs_write = dsi_vc_dcs_write,
-		.dcs_write_nosync = dsi_vc_dcs_write_nosync,
-		.dcs_read = dsi_vc_dcs_read,
-
-		.gen_write = dsi_vc_generic_write,
-		.gen_write_nosync = dsi_vc_generic_write_nosync,
-		.gen_read = dsi_vc_generic_read,
-
-		.bta_sync = dsi_vc_send_bta_sync,
-
-		.set_max_rx_packet_size = dsi_vc_set_max_rx_packet_size,
 	},
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 654618e5a4e5..9ead877cb24c 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -310,26 +310,6 @@ struct omapdss_dsi_ops {
 	/* data transfer */
 	ssize_t (*transfer)(struct omap_dss_device *dssdev,
 			    const struct mipi_dsi_msg *msg);
-
-	int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
-			const u8 *data, int len);
-	int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
-			const u8 *data, int len);
-	int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
-			u8 *data, int len);
-
-	int (*gen_write)(struct omap_dss_device *dssdev, int channel,
-			const u8 *data, int len);
-	int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
-			const u8 *data, int len);
-	int (*gen_read)(struct omap_dss_device *dssdev, int channel,
-			const u8 *reqdata, int reqlen,
-			u8 *data, int len);
-
-	int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
-
-	int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
-			int channel, u16 plen);
 };
 
 struct omap_dss_device_ops {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 09/56] drm/omap: dsi: drop virtual channel logic
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This drops the virtual channel logic. Afterwards DSI clients
request their channel number and get the virtual channel with
the same number or -EBUSY if already in use.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 11 ++---
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 46 ++++---------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  4 +-
 3 files changed, 12 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 8b2e80129bd8..ea76a89d1833 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -768,19 +768,12 @@ static int dsicm_connect(struct omap_dss_device *src,
 	struct device *dev = &ddata->pdev->dev;
 	int r;
 
-	r = src->ops->dsi.request_vc(src, &ddata->channel);
+	r = src->ops->dsi.request_vc(src, ddata->channel);
 	if (r) {
 		dev_err(dev, "failed to get virtual channel\n");
 		return r;
 	}
 
-	r = src->ops->dsi.set_vc_id(src, ddata->channel, TCH);
-	if (r) {
-		dev_err(dev, "failed to set VC_ID\n");
-		src->ops->dsi.release_vc(src, ddata->channel);
-		return r;
-	}
-
 	ddata->src = src;
 	return 0;
 }
@@ -1215,6 +1208,8 @@ static int dsicm_probe_of(struct platform_device *pdev)
 	struct display_timing timing;
 	int err;
 
+	ddata->channel = TCH;
+
 	ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ddata->reset_gpio)) {
 		err = PTR_ERR(ddata->reset_gpio);
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 2270730b16db..348be32505a2 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -350,7 +350,6 @@ struct dsi_data {
 		struct omap_dss_device *dssdev;
 		enum fifo_size tx_fifo_size;
 		enum fifo_size rx_fifo_size;
-		int vc_id;
 	} vc[4];
 
 	struct mutex lock;
@@ -2579,7 +2578,7 @@ static inline void dsi_vc_write_long_header(struct dsi_data *dsi, int channel,
 
 	WARN_ON(!dsi_bus_is_locked(dsi));
 
-	data_id = data_type | dsi->vc[channel].vc_id << 6;
+	data_id = data_type | channel << 6;
 
 	val = FLD_VAL(data_id, 7, 0) | FLD_VAL(len, 23, 8) |
 		FLD_VAL(ecc, 31, 24);
@@ -2683,7 +2682,7 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int channel, u8 data_type,
 		return -EINVAL;
 	}
 
-	data_id = data_type | dsi->vc[channel].vc_id << 6;
+	data_id = data_type | channel << 6;
 
 	r = (data_id << 0) | (data << 8) | (ecc << 24);
 
@@ -4789,45 +4788,19 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)
 	}
 }
 
-static int dsi_request_vc(struct omap_dss_device *dssdev, int *channel)
+static int dsi_request_vc(struct omap_dss_device *dssdev, int channel)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
-		if (!dsi->vc[i].dssdev) {
-			dsi->vc[i].dssdev = dssdev;
-			*channel = i;
-			return 0;
-		}
-	}
 
-	DSSERR("cannot get VC for display %s", dssdev->name);
-	return -ENOSPC;
-}
-
-static int dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
-	if (vc_id < 0 || vc_id > 3) {
-		DSSERR("VC ID out of range\n");
-		return -EINVAL;
-	}
-
-	if (channel < 0 || channel > 3) {
-		DSSERR("Virtual Channel out of range\n");
+	if (channel < 0 || channel > 3)
 		return -EINVAL;
-	}
 
-	if (dsi->vc[channel].dssdev != dssdev) {
-		DSSERR("Virtual Channel not allocated to display %s\n",
-			dssdev->name);
-		return -EINVAL;
+	if (dsi->vc[channel].dssdev) {
+		DSSERR("cannot get VC for display %s", dssdev->name);
+		return -EBUSY;
 	}
 
-	dsi->vc[channel].vc_id = vc_id;
-
+	dsi->vc[channel].dssdev = dssdev;
 	return 0;
 }
 
@@ -4838,7 +4811,6 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
 	if ((channel >= 0 && channel <= 3) &&
 		dsi->vc[channel].dssdev == dssdev) {
 		dsi->vc[channel].dssdev = NULL;
-		dsi->vc[channel].vc_id = 0;
 	}
 }
 
@@ -4945,7 +4917,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.enable_te = dsi_enable_te,
 
 		.request_vc = dsi_request_vc,
-		.set_vc_id = dsi_set_vc_id,
 		.release_vc = dsi_release_vc,
 
 		.transfer = omap_dsi_transfer,
@@ -5401,7 +5372,6 @@ static int dsi_probe(struct platform_device *pdev)
 	for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
 		dsi->vc[i].source = DSI_VC_SOURCE_L4;
 		dsi->vc[i].dssdev = NULL;
-		dsi->vc[i].vc_id = 0;
 	}
 
 	r = dsi_get_clocks(dsi);
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 9ead877cb24c..40e1ce9e256e 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -302,9 +302,7 @@ struct omapdss_dsi_ops {
 	void (*disable_video_output)(struct omap_dss_device *dssdev,
 			int channel);
 
-	int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
-	int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
-			int vc_id);
+	int (*request_vc)(struct omap_dss_device *dssdev, int channel);
 	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
 
 	/* data transfer */
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 09/56] drm/omap: dsi: drop virtual channel logic
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This drops the virtual channel logic. Afterwards DSI clients
request their channel number and get the virtual channel with
the same number or -EBUSY if already in use.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 11 ++---
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 46 ++++---------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  4 +-
 3 files changed, 12 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 8b2e80129bd8..ea76a89d1833 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -768,19 +768,12 @@ static int dsicm_connect(struct omap_dss_device *src,
 	struct device *dev = &ddata->pdev->dev;
 	int r;
 
-	r = src->ops->dsi.request_vc(src, &ddata->channel);
+	r = src->ops->dsi.request_vc(src, ddata->channel);
 	if (r) {
 		dev_err(dev, "failed to get virtual channel\n");
 		return r;
 	}
 
-	r = src->ops->dsi.set_vc_id(src, ddata->channel, TCH);
-	if (r) {
-		dev_err(dev, "failed to set VC_ID\n");
-		src->ops->dsi.release_vc(src, ddata->channel);
-		return r;
-	}
-
 	ddata->src = src;
 	return 0;
 }
@@ -1215,6 +1208,8 @@ static int dsicm_probe_of(struct platform_device *pdev)
 	struct display_timing timing;
 	int err;
 
+	ddata->channel = TCH;
+
 	ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ddata->reset_gpio)) {
 		err = PTR_ERR(ddata->reset_gpio);
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 2270730b16db..348be32505a2 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -350,7 +350,6 @@ struct dsi_data {
 		struct omap_dss_device *dssdev;
 		enum fifo_size tx_fifo_size;
 		enum fifo_size rx_fifo_size;
-		int vc_id;
 	} vc[4];
 
 	struct mutex lock;
@@ -2579,7 +2578,7 @@ static inline void dsi_vc_write_long_header(struct dsi_data *dsi, int channel,
 
 	WARN_ON(!dsi_bus_is_locked(dsi));
 
-	data_id = data_type | dsi->vc[channel].vc_id << 6;
+	data_id = data_type | channel << 6;
 
 	val = FLD_VAL(data_id, 7, 0) | FLD_VAL(len, 23, 8) |
 		FLD_VAL(ecc, 31, 24);
@@ -2683,7 +2682,7 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int channel, u8 data_type,
 		return -EINVAL;
 	}
 
-	data_id = data_type | dsi->vc[channel].vc_id << 6;
+	data_id = data_type | channel << 6;
 
 	r = (data_id << 0) | (data << 8) | (ecc << 24);
 
@@ -4789,45 +4788,19 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)
 	}
 }
 
-static int dsi_request_vc(struct omap_dss_device *dssdev, int *channel)
+static int dsi_request_vc(struct omap_dss_device *dssdev, int channel)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
-		if (!dsi->vc[i].dssdev) {
-			dsi->vc[i].dssdev = dssdev;
-			*channel = i;
-			return 0;
-		}
-	}
 
-	DSSERR("cannot get VC for display %s", dssdev->name);
-	return -ENOSPC;
-}
-
-static int dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
-	if (vc_id < 0 || vc_id > 3) {
-		DSSERR("VC ID out of range\n");
-		return -EINVAL;
-	}
-
-	if (channel < 0 || channel > 3) {
-		DSSERR("Virtual Channel out of range\n");
+	if (channel < 0 || channel > 3)
 		return -EINVAL;
-	}
 
-	if (dsi->vc[channel].dssdev != dssdev) {
-		DSSERR("Virtual Channel not allocated to display %s\n",
-			dssdev->name);
-		return -EINVAL;
+	if (dsi->vc[channel].dssdev) {
+		DSSERR("cannot get VC for display %s", dssdev->name);
+		return -EBUSY;
 	}
 
-	dsi->vc[channel].vc_id = vc_id;
-
+	dsi->vc[channel].dssdev = dssdev;
 	return 0;
 }
 
@@ -4838,7 +4811,6 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
 	if ((channel >= 0 && channel <= 3) &&
 		dsi->vc[channel].dssdev == dssdev) {
 		dsi->vc[channel].dssdev = NULL;
-		dsi->vc[channel].vc_id = 0;
 	}
 }
 
@@ -4945,7 +4917,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.enable_te = dsi_enable_te,
 
 		.request_vc = dsi_request_vc,
-		.set_vc_id = dsi_set_vc_id,
 		.release_vc = dsi_release_vc,
 
 		.transfer = omap_dsi_transfer,
@@ -5401,7 +5372,6 @@ static int dsi_probe(struct platform_device *pdev)
 	for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
 		dsi->vc[i].source = DSI_VC_SOURCE_L4;
 		dsi->vc[i].dssdev = NULL;
-		dsi->vc[i].vc_id = 0;
 	}
 
 	r = dsi_get_clocks(dsi);
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 9ead877cb24c..40e1ce9e256e 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -302,9 +302,7 @@ struct omapdss_dsi_ops {
 	void (*disable_video_output)(struct omap_dss_device *dssdev,
 			int channel);
 
-	int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
-	int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
-			int vc_id);
+	int (*request_vc)(struct omap_dss_device *dssdev, int channel);
 	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
 
 	/* data transfer */
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 10/56] drm/omap: dsi: simplify write function
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Simplify the write related messages handling by using the functionality
provided by CONFIG_DRM_MIPI_DSI.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/Kconfig |   1 +
 drivers/gpu/drm/omapdrm/dss/dsi.c   | 146 +++++++---------------------
 2 files changed, 34 insertions(+), 113 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig b/drivers/gpu/drm/omapdrm/dss/Kconfig
index 2658c521b702..fd7dfa28ce97 100644
--- a/drivers/gpu/drm/omapdrm/dss/Kconfig
+++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
@@ -95,6 +95,7 @@ config OMAP2_DSS_SDI
 config OMAP2_DSS_DSI
 	bool "DSI support"
 	default n
+	select DRM_MIPI_DSI
 	help
 	  MIPI DSI (Display Serial Interface) support.
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 348be32505a2..e1595c0608f2 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2696,97 +2696,50 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
 	return dsi_vc_send_long(dsi, channel, MIPI_DSI_NULL_PACKET, NULL, 0, 0);
 }
 
-static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
-				      const u8 *data, int len,
-				      enum dss_dsi_content_type type)
-{
-	int r;
-
-	if (len == 0) {
-		BUG_ON(type == DSS_DSI_CONTENT_DCS);
-		r = dsi_vc_send_short(dsi, channel,
-				MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM, 0, 0);
-	} else if (len == 1) {
-		r = dsi_vc_send_short(dsi, channel,
-				type == DSS_DSI_CONTENT_GENERIC ?
-				MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM :
-				MIPI_DSI_DCS_SHORT_WRITE, data[0], 0);
-	} else if (len == 2) {
-		r = dsi_vc_send_short(dsi, channel,
-				type == DSS_DSI_CONTENT_GENERIC ?
-				MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM :
-				MIPI_DSI_DCS_SHORT_WRITE_PARAM,
-				data[0] | (data[1] << 8), 0);
-	} else {
-		r = dsi_vc_send_long(dsi, channel,
-				type == DSS_DSI_CONTENT_GENERIC ?
-				MIPI_DSI_GENERIC_LONG_WRITE :
-				MIPI_DSI_DCS_LONG_WRITE, data, len, 0);
-	}
-
-	return r;
-}
-
-static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
-		const u8 *data, int len)
+static int dsi_vc_write_common(struct omap_dss_device *dssdev,
+			       const struct mipi_dsi_msg *msg)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
+	struct mipi_dsi_packet packet;
+	int r;
 
-	return dsi_vc_write_nosync_common(dsi, channel, data, len,
-			DSS_DSI_CONTENT_DCS);
-}
+	r = mipi_dsi_create_packet(&packet, msg);
+	if (r < 0)
+		return r;
 
-static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
-		const u8 *data, int len)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
+	if (mipi_dsi_packet_format_is_short(msg->type)) {
+		u16 data = packet.header[1] | (packet.header[2] << 8);
 
-	return dsi_vc_write_nosync_common(dsi, channel, data, len,
-			DSS_DSI_CONTENT_GENERIC);
-}
+		r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
+	} else {
+		r = dsi_vc_send_long(dsi, msg->channel, msg->type,
+				     msg->tx_buf, msg->tx_len, 0);
+	}
 
-static int dsi_vc_write_common(struct omap_dss_device *dssdev,
-			       int channel, const u8 *data, int len,
-			       enum dss_dsi_content_type type)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-	int r;
+	if (r < 0)
+		return r;
 
-	r = dsi_vc_write_nosync_common(dsi, channel, data, len, type);
-	if (r)
-		goto err;
+	/*
+	 * TODO: we do not always have to do the BTA sync, for example
+	 * we can improve performance by setting the update window
+	 * information without sending BTA sync between the commands.
+	 * In that case we can return early.
+	 */
 
-	r = dsi_vc_send_bta_sync(dssdev, channel);
-	if (r)
-		goto err;
+	r = dsi_vc_send_bta_sync(dssdev, msg->channel);
+	if (r) {
+		DSSERR("bta sync failed\n");
+		return r;
+	}
 
 	/* RX_FIFO_NOT_EMPTY */
-	if (REG_GET(dsi, DSI_VC_CTRL(channel), 20, 20)) {
+	if (REG_GET(dsi, DSI_VC_CTRL(msg->channel), 20, 20)) {
 		DSSERR("rx fifo not empty after write, dumping data:\n");
-		dsi_vc_flush_receive_data(dsi, channel);
-		r = -EIO;
-		goto err;
+		dsi_vc_flush_receive_data(dsi, msg->channel);
+		return -EIO;
 	}
 
 	return 0;
-err:
-	DSSERR("dsi_vc_write_common(ch %d, cmd 0x%02x, len %d) failed\n",
-			channel, data[0], len);
-	return r;
-}
-
-static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel,
-		const u8 *data, int len)
-{
-	return dsi_vc_write_common(dssdev, channel, data, len,
-			DSS_DSI_CONTENT_DCS);
-}
-
-static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel,
-		const u8 *data, int len)
-{
-	return dsi_vc_write_common(dssdev, channel, data, len,
-			DSS_DSI_CONTENT_GENERIC);
 }
 
 static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
@@ -3008,15 +2961,6 @@ static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
 	return 0;
 }
 
-static int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
-		u16 len)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
-	return dsi_vc_send_short(dsi, channel,
-			MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE, len, 0);
-}
-
 static int dsi_enter_ulps(struct dsi_data *dsi)
 {
 	DECLARE_COMPLETION_ONSTACK(completion);
@@ -4817,36 +4761,17 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
 static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
 				 const struct mipi_dsi_msg *msg)
 {
-	/*
-	 * no_sync can be used to optimize performance by sending e.g. column
-	 * and page information without syncing in between. It's not absolutley
-	 * required, so postpone this feature for now.
-	 */
-	bool no_sync = false;
-	u16 val;
-
 	switch (msg->type) {
 	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
 	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
 	case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
 	case MIPI_DSI_GENERIC_LONG_WRITE:
-		if (no_sync)
-			return dsi_vc_generic_write_nosync(dssdev, msg->channel,
-							   msg->tx_buf,
-							   msg->tx_len);
-		else
-			return dsi_vc_generic_write(dssdev, msg->channel,
-						    msg->tx_buf, msg->tx_len);
 	case MIPI_DSI_DCS_SHORT_WRITE:
 	case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
 	case MIPI_DSI_DCS_LONG_WRITE:
-		if (no_sync)
-			return dsi_vc_dcs_write_nosync(dssdev, msg->channel,
-						       msg->tx_buf,
-						       msg->tx_len);
-		else
-			return dsi_vc_dcs_write(dssdev, msg->channel,
-						msg->tx_buf, msg->tx_len);
+	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
+	case MIPI_DSI_NULL_PACKET:
+		return dsi_vc_write_common(dssdev, msg);
 	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
 	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
 	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
@@ -4857,11 +4782,6 @@ static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
 		return dsi_vc_dcs_read(dssdev, msg->channel,
 				       ((u8 *)msg->tx_buf)[0],
 				       msg->rx_buf, msg->rx_len);
-	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
-		val = le16_to_cpu(*((__le16 *)msg->tx_buf));
-		return dsi_vc_set_max_rx_packet_size(dssdev, msg->channel, val);
-	case MIPI_DSI_NULL_PACKET:
-		return dsi_vc_send_null(to_dsi_data(dssdev), msg->channel);
 	}
 
 	return -EINVAL;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 10/56] drm/omap: dsi: simplify write function
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Simplify the write related messages handling by using the functionality
provided by CONFIG_DRM_MIPI_DSI.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/Kconfig |   1 +
 drivers/gpu/drm/omapdrm/dss/dsi.c   | 146 +++++++---------------------
 2 files changed, 34 insertions(+), 113 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig b/drivers/gpu/drm/omapdrm/dss/Kconfig
index 2658c521b702..fd7dfa28ce97 100644
--- a/drivers/gpu/drm/omapdrm/dss/Kconfig
+++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
@@ -95,6 +95,7 @@ config OMAP2_DSS_SDI
 config OMAP2_DSS_DSI
 	bool "DSI support"
 	default n
+	select DRM_MIPI_DSI
 	help
 	  MIPI DSI (Display Serial Interface) support.
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 348be32505a2..e1595c0608f2 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2696,97 +2696,50 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
 	return dsi_vc_send_long(dsi, channel, MIPI_DSI_NULL_PACKET, NULL, 0, 0);
 }
 
-static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
-				      const u8 *data, int len,
-				      enum dss_dsi_content_type type)
-{
-	int r;
-
-	if (len == 0) {
-		BUG_ON(type == DSS_DSI_CONTENT_DCS);
-		r = dsi_vc_send_short(dsi, channel,
-				MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM, 0, 0);
-	} else if (len == 1) {
-		r = dsi_vc_send_short(dsi, channel,
-				type == DSS_DSI_CONTENT_GENERIC ?
-				MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM :
-				MIPI_DSI_DCS_SHORT_WRITE, data[0], 0);
-	} else if (len == 2) {
-		r = dsi_vc_send_short(dsi, channel,
-				type == DSS_DSI_CONTENT_GENERIC ?
-				MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM :
-				MIPI_DSI_DCS_SHORT_WRITE_PARAM,
-				data[0] | (data[1] << 8), 0);
-	} else {
-		r = dsi_vc_send_long(dsi, channel,
-				type == DSS_DSI_CONTENT_GENERIC ?
-				MIPI_DSI_GENERIC_LONG_WRITE :
-				MIPI_DSI_DCS_LONG_WRITE, data, len, 0);
-	}
-
-	return r;
-}
-
-static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
-		const u8 *data, int len)
+static int dsi_vc_write_common(struct omap_dss_device *dssdev,
+			       const struct mipi_dsi_msg *msg)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
+	struct mipi_dsi_packet packet;
+	int r;
 
-	return dsi_vc_write_nosync_common(dsi, channel, data, len,
-			DSS_DSI_CONTENT_DCS);
-}
+	r = mipi_dsi_create_packet(&packet, msg);
+	if (r < 0)
+		return r;
 
-static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
-		const u8 *data, int len)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
+	if (mipi_dsi_packet_format_is_short(msg->type)) {
+		u16 data = packet.header[1] | (packet.header[2] << 8);
 
-	return dsi_vc_write_nosync_common(dsi, channel, data, len,
-			DSS_DSI_CONTENT_GENERIC);
-}
+		r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
+	} else {
+		r = dsi_vc_send_long(dsi, msg->channel, msg->type,
+				     msg->tx_buf, msg->tx_len, 0);
+	}
 
-static int dsi_vc_write_common(struct omap_dss_device *dssdev,
-			       int channel, const u8 *data, int len,
-			       enum dss_dsi_content_type type)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-	int r;
+	if (r < 0)
+		return r;
 
-	r = dsi_vc_write_nosync_common(dsi, channel, data, len, type);
-	if (r)
-		goto err;
+	/*
+	 * TODO: we do not always have to do the BTA sync, for example
+	 * we can improve performance by setting the update window
+	 * information without sending BTA sync between the commands.
+	 * In that case we can return early.
+	 */
 
-	r = dsi_vc_send_bta_sync(dssdev, channel);
-	if (r)
-		goto err;
+	r = dsi_vc_send_bta_sync(dssdev, msg->channel);
+	if (r) {
+		DSSERR("bta sync failed\n");
+		return r;
+	}
 
 	/* RX_FIFO_NOT_EMPTY */
-	if (REG_GET(dsi, DSI_VC_CTRL(channel), 20, 20)) {
+	if (REG_GET(dsi, DSI_VC_CTRL(msg->channel), 20, 20)) {
 		DSSERR("rx fifo not empty after write, dumping data:\n");
-		dsi_vc_flush_receive_data(dsi, channel);
-		r = -EIO;
-		goto err;
+		dsi_vc_flush_receive_data(dsi, msg->channel);
+		return -EIO;
 	}
 
 	return 0;
-err:
-	DSSERR("dsi_vc_write_common(ch %d, cmd 0x%02x, len %d) failed\n",
-			channel, data[0], len);
-	return r;
-}
-
-static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel,
-		const u8 *data, int len)
-{
-	return dsi_vc_write_common(dssdev, channel, data, len,
-			DSS_DSI_CONTENT_DCS);
-}
-
-static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel,
-		const u8 *data, int len)
-{
-	return dsi_vc_write_common(dssdev, channel, data, len,
-			DSS_DSI_CONTENT_GENERIC);
 }
 
 static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
@@ -3008,15 +2961,6 @@ static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
 	return 0;
 }
 
-static int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
-		u16 len)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
-	return dsi_vc_send_short(dsi, channel,
-			MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE, len, 0);
-}
-
 static int dsi_enter_ulps(struct dsi_data *dsi)
 {
 	DECLARE_COMPLETION_ONSTACK(completion);
@@ -4817,36 +4761,17 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
 static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
 				 const struct mipi_dsi_msg *msg)
 {
-	/*
-	 * no_sync can be used to optimize performance by sending e.g. column
-	 * and page information without syncing in between. It's not absolutley
-	 * required, so postpone this feature for now.
-	 */
-	bool no_sync = false;
-	u16 val;
-
 	switch (msg->type) {
 	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
 	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
 	case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
 	case MIPI_DSI_GENERIC_LONG_WRITE:
-		if (no_sync)
-			return dsi_vc_generic_write_nosync(dssdev, msg->channel,
-							   msg->tx_buf,
-							   msg->tx_len);
-		else
-			return dsi_vc_generic_write(dssdev, msg->channel,
-						    msg->tx_buf, msg->tx_len);
 	case MIPI_DSI_DCS_SHORT_WRITE:
 	case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
 	case MIPI_DSI_DCS_LONG_WRITE:
-		if (no_sync)
-			return dsi_vc_dcs_write_nosync(dssdev, msg->channel,
-						       msg->tx_buf,
-						       msg->tx_len);
-		else
-			return dsi_vc_dcs_write(dssdev, msg->channel,
-						msg->tx_buf, msg->tx_len);
+	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
+	case MIPI_DSI_NULL_PACKET:
+		return dsi_vc_write_common(dssdev, msg);
 	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
 	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
 	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
@@ -4857,11 +4782,6 @@ static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
 		return dsi_vc_dcs_read(dssdev, msg->channel,
 				       ((u8 *)msg->tx_buf)[0],
 				       msg->rx_buf, msg->rx_len);
-	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
-		val = le16_to_cpu(*((__le16 *)msg->tx_buf));
-		return dsi_vc_set_max_rx_packet_size(dssdev, msg->channel, val);
-	case MIPI_DSI_NULL_PACKET:
-		return dsi_vc_send_null(to_dsi_data(dssdev), msg->channel);
 	}
 
 	return -EINVAL;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 11/56] drm/omap: dsi: simplify read functions
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Simplify the read related message handling by using the functionality
provided by CONFIG_DRM_MIPI_DSI.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 110 +++++++++---------------------
 1 file changed, 34 insertions(+), 76 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index e1595c0608f2..bbdc52ee3559 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2742,60 +2742,6 @@ static int dsi_vc_write_common(struct omap_dss_device *dssdev,
 	return 0;
 }
 
-static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
-					u8 dcs_cmd)
-{
-	int r;
-
-	if (dsi->debug_read)
-		DSSDBG("dsi_vc_dcs_send_read_request(ch%d, dcs_cmd %x)\n",
-			channel, dcs_cmd);
-
-	r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
-	if (r) {
-		DSSERR("dsi_vc_dcs_send_read_request(ch %d, cmd 0x%02x)"
-			" failed\n", channel, dcs_cmd);
-		return r;
-	}
-
-	return 0;
-}
-
-static int dsi_vc_generic_send_read_request(struct dsi_data *dsi, int channel,
-					    const u8 *reqdata, int reqlen)
-{
-	u16 data;
-	u8 data_type;
-	int r;
-
-	if (dsi->debug_read)
-		DSSDBG("dsi_vc_generic_send_read_request(ch %d, reqlen %d)\n",
-			channel, reqlen);
-
-	if (reqlen == 0) {
-		data_type = MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM;
-		data = 0;
-	} else if (reqlen == 1) {
-		data_type = MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM;
-		data = reqdata[0];
-	} else if (reqlen == 2) {
-		data_type = MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM;
-		data = reqdata[0] | (reqdata[1] << 8);
-	} else {
-		BUG();
-		return -EINVAL;
-	}
-
-	r = dsi_vc_send_short(dsi, channel, data_type, data, 0);
-	if (r) {
-		DSSERR("dsi_vc_generic_send_read_request(ch %d, reqlen %d)"
-			" failed\n", channel, reqlen);
-		return r;
-	}
-
-	return 0;
-}
-
 static int dsi_vc_read_rx_fifo(struct dsi_data *dsi, int channel, u8 *buf,
 			       int buflen, enum dss_dsi_content_type type)
 {
@@ -2904,13 +2850,18 @@ static int dsi_vc_read_rx_fifo(struct dsi_data *dsi, int channel, u8 *buf,
 	return r;
 }
 
-static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
-		u8 *buf, int buflen)
+static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
+			   const struct mipi_dsi_msg *msg)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
+	u8 dcs_cmd = ((u8 *)msg->tx_buf)[0];
+	u8 channel = msg->channel;
 	int r;
 
-	r = dsi_vc_dcs_send_read_request(dsi, channel, dcs_cmd);
+	if (dsi->debug_read)
+		DSSDBG("%s(ch %d, cmd %x)\n", __func__, channel, dcs_cmd);
+
+	r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
 	if (r)
 		goto err;
 
@@ -2918,47 +2869,58 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_c
 	if (r)
 		goto err;
 
-	r = dsi_vc_read_rx_fifo(dsi, channel, buf, buflen,
+	r = dsi_vc_read_rx_fifo(dsi, channel, msg->rx_buf, msg->rx_len,
 		DSS_DSI_CONTENT_DCS);
 	if (r < 0)
 		goto err;
 
-	if (r != buflen) {
+	if (r != msg->rx_len) {
 		r = -EIO;
 		goto err;
 	}
 
 	return 0;
 err:
-	DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n", channel, dcs_cmd);
+	DSSERR("%s(ch %d, cmd 0x%02x) failed\n", __func__, msg->channel, dcs_cmd);
 	return r;
 }
 
-static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
-		const u8 *reqdata, int reqlen, u8 *buf, int buflen)
+static int dsi_vc_generic_read(struct omap_dss_device *dssdev,
+			       const struct mipi_dsi_msg *msg)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
+	struct mipi_dsi_packet packet;
+	u16 data;
 	int r;
 
-	r = dsi_vc_generic_send_read_request(dsi, channel, reqdata, reqlen);
+	r = mipi_dsi_create_packet(&packet, msg);
+	if (r < 0)
+		goto err;
+
+	data = packet.header[1] | (packet.header[2] << 8);
+
+	r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
 	if (r)
-		return r;
+		goto err;
 
-	r = dsi_vc_send_bta_sync(dssdev, channel);
+	r = dsi_vc_send_bta_sync(dssdev, msg->channel);
 	if (r)
-		return r;
+		goto err;
 
-	r = dsi_vc_read_rx_fifo(dsi, channel, buf, buflen,
+	r = dsi_vc_read_rx_fifo(dsi, msg->channel, msg->rx_buf, msg->rx_len,
 		DSS_DSI_CONTENT_GENERIC);
 	if (r < 0)
-		return r;
+		goto err;
 
-	if (r != buflen) {
+	if (r != msg->rx_len) {
 		r = -EIO;
-		return r;
+		goto err;
 	}
 
 	return 0;
+err:
+	DSSERR("%s(ch %d, reqlen %d) failed\n", __func__,  msg->channel, msg->tx_len);
+	return r;
 }
 
 static int dsi_enter_ulps(struct dsi_data *dsi)
@@ -4775,13 +4737,9 @@ static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
 	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
 	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
 	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
-		return dsi_vc_generic_read(dssdev, msg->channel,
-					   msg->tx_buf, msg->tx_len,
-					   msg->rx_buf, msg->rx_len);
+		return dsi_vc_generic_read(dssdev, msg);
 	case MIPI_DSI_DCS_READ:
-		return dsi_vc_dcs_read(dssdev, msg->channel,
-				       ((u8 *)msg->tx_buf)[0],
-				       msg->rx_buf, msg->rx_len);
+		return dsi_vc_dcs_read(dssdev, msg);
 	}
 
 	return -EINVAL;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 11/56] drm/omap: dsi: simplify read functions
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Simplify the read related message handling by using the functionality
provided by CONFIG_DRM_MIPI_DSI.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 110 +++++++++---------------------
 1 file changed, 34 insertions(+), 76 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index e1595c0608f2..bbdc52ee3559 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2742,60 +2742,6 @@ static int dsi_vc_write_common(struct omap_dss_device *dssdev,
 	return 0;
 }
 
-static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
-					u8 dcs_cmd)
-{
-	int r;
-
-	if (dsi->debug_read)
-		DSSDBG("dsi_vc_dcs_send_read_request(ch%d, dcs_cmd %x)\n",
-			channel, dcs_cmd);
-
-	r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
-	if (r) {
-		DSSERR("dsi_vc_dcs_send_read_request(ch %d, cmd 0x%02x)"
-			" failed\n", channel, dcs_cmd);
-		return r;
-	}
-
-	return 0;
-}
-
-static int dsi_vc_generic_send_read_request(struct dsi_data *dsi, int channel,
-					    const u8 *reqdata, int reqlen)
-{
-	u16 data;
-	u8 data_type;
-	int r;
-
-	if (dsi->debug_read)
-		DSSDBG("dsi_vc_generic_send_read_request(ch %d, reqlen %d)\n",
-			channel, reqlen);
-
-	if (reqlen == 0) {
-		data_type = MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM;
-		data = 0;
-	} else if (reqlen == 1) {
-		data_type = MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM;
-		data = reqdata[0];
-	} else if (reqlen == 2) {
-		data_type = MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM;
-		data = reqdata[0] | (reqdata[1] << 8);
-	} else {
-		BUG();
-		return -EINVAL;
-	}
-
-	r = dsi_vc_send_short(dsi, channel, data_type, data, 0);
-	if (r) {
-		DSSERR("dsi_vc_generic_send_read_request(ch %d, reqlen %d)"
-			" failed\n", channel, reqlen);
-		return r;
-	}
-
-	return 0;
-}
-
 static int dsi_vc_read_rx_fifo(struct dsi_data *dsi, int channel, u8 *buf,
 			       int buflen, enum dss_dsi_content_type type)
 {
@@ -2904,13 +2850,18 @@ static int dsi_vc_read_rx_fifo(struct dsi_data *dsi, int channel, u8 *buf,
 	return r;
 }
 
-static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
-		u8 *buf, int buflen)
+static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
+			   const struct mipi_dsi_msg *msg)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
+	u8 dcs_cmd = ((u8 *)msg->tx_buf)[0];
+	u8 channel = msg->channel;
 	int r;
 
-	r = dsi_vc_dcs_send_read_request(dsi, channel, dcs_cmd);
+	if (dsi->debug_read)
+		DSSDBG("%s(ch %d, cmd %x)\n", __func__, channel, dcs_cmd);
+
+	r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
 	if (r)
 		goto err;
 
@@ -2918,47 +2869,58 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_c
 	if (r)
 		goto err;
 
-	r = dsi_vc_read_rx_fifo(dsi, channel, buf, buflen,
+	r = dsi_vc_read_rx_fifo(dsi, channel, msg->rx_buf, msg->rx_len,
 		DSS_DSI_CONTENT_DCS);
 	if (r < 0)
 		goto err;
 
-	if (r != buflen) {
+	if (r != msg->rx_len) {
 		r = -EIO;
 		goto err;
 	}
 
 	return 0;
 err:
-	DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n", channel, dcs_cmd);
+	DSSERR("%s(ch %d, cmd 0x%02x) failed\n", __func__, msg->channel, dcs_cmd);
 	return r;
 }
 
-static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
-		const u8 *reqdata, int reqlen, u8 *buf, int buflen)
+static int dsi_vc_generic_read(struct omap_dss_device *dssdev,
+			       const struct mipi_dsi_msg *msg)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
+	struct mipi_dsi_packet packet;
+	u16 data;
 	int r;
 
-	r = dsi_vc_generic_send_read_request(dsi, channel, reqdata, reqlen);
+	r = mipi_dsi_create_packet(&packet, msg);
+	if (r < 0)
+		goto err;
+
+	data = packet.header[1] | (packet.header[2] << 8);
+
+	r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
 	if (r)
-		return r;
+		goto err;
 
-	r = dsi_vc_send_bta_sync(dssdev, channel);
+	r = dsi_vc_send_bta_sync(dssdev, msg->channel);
 	if (r)
-		return r;
+		goto err;
 
-	r = dsi_vc_read_rx_fifo(dsi, channel, buf, buflen,
+	r = dsi_vc_read_rx_fifo(dsi, msg->channel, msg->rx_buf, msg->rx_len,
 		DSS_DSI_CONTENT_GENERIC);
 	if (r < 0)
-		return r;
+		goto err;
 
-	if (r != buflen) {
+	if (r != msg->rx_len) {
 		r = -EIO;
-		return r;
+		goto err;
 	}
 
 	return 0;
+err:
+	DSSERR("%s(ch %d, reqlen %d) failed\n", __func__,  msg->channel, msg->tx_len);
+	return r;
 }
 
 static int dsi_enter_ulps(struct dsi_data *dsi)
@@ -4775,13 +4737,9 @@ static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
 	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
 	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
 	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
-		return dsi_vc_generic_read(dssdev, msg->channel,
-					   msg->tx_buf, msg->tx_len,
-					   msg->rx_buf, msg->rx_len);
+		return dsi_vc_generic_read(dssdev, msg);
 	case MIPI_DSI_DCS_READ:
-		return dsi_vc_dcs_read(dssdev, msg->channel,
-				       ((u8 *)msg->tx_buf)[0],
-				       msg->rx_buf, msg->rx_len);
+		return dsi_vc_dcs_read(dssdev, msg);
 	}
 
 	return -EINVAL;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 12/56] drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Simplify the DSI encoder by using mipi_dsi_msg for
dsi_vc_send_long and dsi_vc_send_short. Further improvements
require cleaning up the channel allocation code first.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 89 ++++++++++++++-----------------
 1 file changed, 40 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index bbdc52ee3559..6fa7833e32ad 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2599,8 +2599,8 @@ static inline void dsi_vc_write_long_payload(struct dsi_data *dsi, int channel,
 	dsi_write_reg(dsi, DSI_VC_LONG_PACKET_PAYLOAD(channel), val);
 }
 
-static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
-			    const u8 *data, u16 len, u8 ecc)
+static int dsi_vc_send_long(struct dsi_data *dsi,
+			    const struct mipi_dsi_msg *msg)
 {
 	/*u32 val; */
 	int i;
@@ -2609,20 +2609,20 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
 	u8 b1, b2, b3, b4;
 
 	if (dsi->debug_write)
-		DSSDBG("dsi_vc_send_long, %d bytes\n", len);
+		DSSDBG("dsi_vc_send_long, %d bytes\n", msg->tx_len);
 
 	/* len + header */
-	if (dsi->vc[channel].tx_fifo_size * 32 * 4 < len + 4) {
+	if (dsi->vc[msg->channel].tx_fifo_size * 32 * 4 < msg->tx_len + 4) {
 		DSSERR("unable to send long packet: packet too long.\n");
 		return -EINVAL;
 	}
 
-	dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_L4);
+	dsi_vc_config_source(dsi, msg->channel, DSI_VC_SOURCE_L4);
 
-	dsi_vc_write_long_header(dsi, channel, data_type, len, ecc);
+	dsi_vc_write_long_header(dsi, msg->channel, msg->type, msg->tx_len, 0);
 
-	p = data;
-	for (i = 0; i < len >> 2; i++) {
+	p = msg->tx_buf;
+	for (i = 0; i < msg->tx_len >> 2; i++) {
 		if (dsi->debug_write)
 			DSSDBG("\tsending full packet %d\n", i);
 
@@ -2631,10 +2631,10 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
 		b3 = *p++;
 		b4 = *p++;
 
-		dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, b4);
+		dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, b4);
 	}
 
-	i = len % 4;
+	i = msg->tx_len % 4;
 	if (i) {
 		b1 = 0; b2 = 0; b3 = 0;
 
@@ -2656,65 +2656,64 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
 			break;
 		}
 
-		dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, 0);
+		dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, 0);
 	}
 
 	return r;
 }
 
-static int dsi_vc_send_short(struct dsi_data *dsi, int channel, u8 data_type,
-			     u16 data, u8 ecc)
+static int dsi_vc_send_short(struct dsi_data *dsi,
+			     const struct mipi_dsi_msg *msg)
 {
+	struct mipi_dsi_packet pkt;
 	u32 r;
-	u8 data_id;
+
+	r = mipi_dsi_create_packet(&pkt, msg);
+	if (r < 0)
+		return r;
 
 	WARN_ON(!dsi_bus_is_locked(dsi));
 
 	if (dsi->debug_write)
 		DSSDBG("dsi_vc_send_short(ch%d, dt %#x, b1 %#x, b2 %#x)\n",
-				channel,
-				data_type, data & 0xff, (data >> 8) & 0xff);
+				msg->channel,
+				msg->type, pkt.header[1], pkt.header[2]);
 
-	dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_L4);
+	dsi_vc_config_source(dsi, msg->channel, DSI_VC_SOURCE_L4);
 
-	if (FLD_GET(dsi_read_reg(dsi, DSI_VC_CTRL(channel)), 16, 16)) {
+	if (FLD_GET(dsi_read_reg(dsi, DSI_VC_CTRL(msg->channel)), 16, 16)) {
 		DSSERR("ERROR FIFO FULL, aborting transfer\n");
 		return -EINVAL;
 	}
 
-	data_id = data_type | channel << 6;
-
-	r = (data_id << 0) | (data << 8) | (ecc << 24);
+	r = pkt.header[3] << 24 | pkt.header[2] << 16 | pkt.header[1] << 8 |
+	    pkt.header[0];
 
-	dsi_write_reg(dsi, DSI_VC_SHORT_PACKET_HEADER(channel), r);
+	dsi_write_reg(dsi, DSI_VC_SHORT_PACKET_HEADER(msg->channel), r);
 
 	return 0;
 }
 
 static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
 {
-	return dsi_vc_send_long(dsi, channel, MIPI_DSI_NULL_PACKET, NULL, 0, 0);
+	const struct mipi_dsi_msg msg = {
+		.channel = channel,
+		.type = MIPI_DSI_NULL_PACKET,
+	};
+
+	return dsi_vc_send_long(dsi, &msg);
 }
 
 static int dsi_vc_write_common(struct omap_dss_device *dssdev,
 			       const struct mipi_dsi_msg *msg)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
-	struct mipi_dsi_packet packet;
 	int r;
 
-	r = mipi_dsi_create_packet(&packet, msg);
-	if (r < 0)
-		return r;
-
-	if (mipi_dsi_packet_format_is_short(msg->type)) {
-		u16 data = packet.header[1] | (packet.header[2] << 8);
-
-		r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
-	} else {
-		r = dsi_vc_send_long(dsi, msg->channel, msg->type,
-				     msg->tx_buf, msg->tx_len, 0);
-	}
+	if (mipi_dsi_packet_format_is_short(msg->type))
+		r = dsi_vc_send_short(dsi, msg);
+	else
+		r = dsi_vc_send_long(dsi, msg);
 
 	if (r < 0)
 		return r;
@@ -2854,14 +2853,14 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
 			   const struct mipi_dsi_msg *msg)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
-	u8 dcs_cmd = ((u8 *)msg->tx_buf)[0];
+	u8 cmd = ((u8 *)msg->tx_buf)[0];
 	u8 channel = msg->channel;
 	int r;
 
 	if (dsi->debug_read)
-		DSSDBG("%s(ch %d, cmd %x)\n", __func__, channel, dcs_cmd);
+		DSSDBG("%s(ch %d, cmd %x)\n", __func__, channel, cmd);
 
-	r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
+	r = dsi_vc_send_short(dsi, msg);
 	if (r)
 		goto err;
 
@@ -2881,7 +2880,7 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
 
 	return 0;
 err:
-	DSSERR("%s(ch %d, cmd 0x%02x) failed\n", __func__, msg->channel, dcs_cmd);
+	DSSERR("%s(ch %d, cmd 0x%02x) failed\n", __func__,  msg->channel, cmd);
 	return r;
 }
 
@@ -2889,17 +2888,9 @@ static int dsi_vc_generic_read(struct omap_dss_device *dssdev,
 			       const struct mipi_dsi_msg *msg)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
-	struct mipi_dsi_packet packet;
-	u16 data;
 	int r;
 
-	r = mipi_dsi_create_packet(&packet, msg);
-	if (r < 0)
-		goto err;
-
-	data = packet.header[1] | (packet.header[2] << 8);
-
-	r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
+	r = dsi_vc_send_short(dsi, msg);
 	if (r)
 		goto err;
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 12/56] drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Simplify the DSI encoder by using mipi_dsi_msg for
dsi_vc_send_long and dsi_vc_send_short. Further improvements
require cleaning up the channel allocation code first.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 89 ++++++++++++++-----------------
 1 file changed, 40 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index bbdc52ee3559..6fa7833e32ad 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -2599,8 +2599,8 @@ static inline void dsi_vc_write_long_payload(struct dsi_data *dsi, int channel,
 	dsi_write_reg(dsi, DSI_VC_LONG_PACKET_PAYLOAD(channel), val);
 }
 
-static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
-			    const u8 *data, u16 len, u8 ecc)
+static int dsi_vc_send_long(struct dsi_data *dsi,
+			    const struct mipi_dsi_msg *msg)
 {
 	/*u32 val; */
 	int i;
@@ -2609,20 +2609,20 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
 	u8 b1, b2, b3, b4;
 
 	if (dsi->debug_write)
-		DSSDBG("dsi_vc_send_long, %d bytes\n", len);
+		DSSDBG("dsi_vc_send_long, %d bytes\n", msg->tx_len);
 
 	/* len + header */
-	if (dsi->vc[channel].tx_fifo_size * 32 * 4 < len + 4) {
+	if (dsi->vc[msg->channel].tx_fifo_size * 32 * 4 < msg->tx_len + 4) {
 		DSSERR("unable to send long packet: packet too long.\n");
 		return -EINVAL;
 	}
 
-	dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_L4);
+	dsi_vc_config_source(dsi, msg->channel, DSI_VC_SOURCE_L4);
 
-	dsi_vc_write_long_header(dsi, channel, data_type, len, ecc);
+	dsi_vc_write_long_header(dsi, msg->channel, msg->type, msg->tx_len, 0);
 
-	p = data;
-	for (i = 0; i < len >> 2; i++) {
+	p = msg->tx_buf;
+	for (i = 0; i < msg->tx_len >> 2; i++) {
 		if (dsi->debug_write)
 			DSSDBG("\tsending full packet %d\n", i);
 
@@ -2631,10 +2631,10 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
 		b3 = *p++;
 		b4 = *p++;
 
-		dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, b4);
+		dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, b4);
 	}
 
-	i = len % 4;
+	i = msg->tx_len % 4;
 	if (i) {
 		b1 = 0; b2 = 0; b3 = 0;
 
@@ -2656,65 +2656,64 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
 			break;
 		}
 
-		dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, 0);
+		dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, 0);
 	}
 
 	return r;
 }
 
-static int dsi_vc_send_short(struct dsi_data *dsi, int channel, u8 data_type,
-			     u16 data, u8 ecc)
+static int dsi_vc_send_short(struct dsi_data *dsi,
+			     const struct mipi_dsi_msg *msg)
 {
+	struct mipi_dsi_packet pkt;
 	u32 r;
-	u8 data_id;
+
+	r = mipi_dsi_create_packet(&pkt, msg);
+	if (r < 0)
+		return r;
 
 	WARN_ON(!dsi_bus_is_locked(dsi));
 
 	if (dsi->debug_write)
 		DSSDBG("dsi_vc_send_short(ch%d, dt %#x, b1 %#x, b2 %#x)\n",
-				channel,
-				data_type, data & 0xff, (data >> 8) & 0xff);
+				msg->channel,
+				msg->type, pkt.header[1], pkt.header[2]);
 
-	dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_L4);
+	dsi_vc_config_source(dsi, msg->channel, DSI_VC_SOURCE_L4);
 
-	if (FLD_GET(dsi_read_reg(dsi, DSI_VC_CTRL(channel)), 16, 16)) {
+	if (FLD_GET(dsi_read_reg(dsi, DSI_VC_CTRL(msg->channel)), 16, 16)) {
 		DSSERR("ERROR FIFO FULL, aborting transfer\n");
 		return -EINVAL;
 	}
 
-	data_id = data_type | channel << 6;
-
-	r = (data_id << 0) | (data << 8) | (ecc << 24);
+	r = pkt.header[3] << 24 | pkt.header[2] << 16 | pkt.header[1] << 8 |
+	    pkt.header[0];
 
-	dsi_write_reg(dsi, DSI_VC_SHORT_PACKET_HEADER(channel), r);
+	dsi_write_reg(dsi, DSI_VC_SHORT_PACKET_HEADER(msg->channel), r);
 
 	return 0;
 }
 
 static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
 {
-	return dsi_vc_send_long(dsi, channel, MIPI_DSI_NULL_PACKET, NULL, 0, 0);
+	const struct mipi_dsi_msg msg = {
+		.channel = channel,
+		.type = MIPI_DSI_NULL_PACKET,
+	};
+
+	return dsi_vc_send_long(dsi, &msg);
 }
 
 static int dsi_vc_write_common(struct omap_dss_device *dssdev,
 			       const struct mipi_dsi_msg *msg)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
-	struct mipi_dsi_packet packet;
 	int r;
 
-	r = mipi_dsi_create_packet(&packet, msg);
-	if (r < 0)
-		return r;
-
-	if (mipi_dsi_packet_format_is_short(msg->type)) {
-		u16 data = packet.header[1] | (packet.header[2] << 8);
-
-		r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
-	} else {
-		r = dsi_vc_send_long(dsi, msg->channel, msg->type,
-				     msg->tx_buf, msg->tx_len, 0);
-	}
+	if (mipi_dsi_packet_format_is_short(msg->type))
+		r = dsi_vc_send_short(dsi, msg);
+	else
+		r = dsi_vc_send_long(dsi, msg);
 
 	if (r < 0)
 		return r;
@@ -2854,14 +2853,14 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
 			   const struct mipi_dsi_msg *msg)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
-	u8 dcs_cmd = ((u8 *)msg->tx_buf)[0];
+	u8 cmd = ((u8 *)msg->tx_buf)[0];
 	u8 channel = msg->channel;
 	int r;
 
 	if (dsi->debug_read)
-		DSSDBG("%s(ch %d, cmd %x)\n", __func__, channel, dcs_cmd);
+		DSSDBG("%s(ch %d, cmd %x)\n", __func__, channel, cmd);
 
-	r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
+	r = dsi_vc_send_short(dsi, msg);
 	if (r)
 		goto err;
 
@@ -2881,7 +2880,7 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
 
 	return 0;
 err:
-	DSSERR("%s(ch %d, cmd 0x%02x) failed\n", __func__, msg->channel, dcs_cmd);
+	DSSERR("%s(ch %d, cmd 0x%02x) failed\n", __func__,  msg->channel, cmd);
 	return r;
 }
 
@@ -2889,17 +2888,9 @@ static int dsi_vc_generic_read(struct omap_dss_device *dssdev,
 			       const struct mipi_dsi_msg *msg)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
-	struct mipi_dsi_packet packet;
-	u16 data;
 	int r;
 
-	r = mipi_dsi_create_packet(&packet, msg);
-	if (r < 0)
-		goto err;
-
-	data = packet.header[1] | (packet.header[2] << 8);
-
-	r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
+	r = dsi_vc_send_short(dsi, msg);
 	if (r)
 		goto err;
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 13/56] drm/omap: dsi: introduce mipi_dsi_host
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This moves from custom platform driver infrastructure to mipi_dsi_host
and mipi_dsi_device. Note, that this is a graduate step and the driver
only uses the devices types and transfer function, but not yet the new
device binding style or drm_panel.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 121 +++++++++---------
 drivers/gpu/drm/omapdrm/dss/dsi.c             |  54 ++++++--
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |   4 -
 3 files changed, 103 insertions(+), 76 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index ea76a89d1833..c3190223d192 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -14,7 +14,6 @@
 #include <linux/interrupt.h>
 #include <linux/jiffies.h>
 #include <linux/module.h>
-#include <linux/platform_device.h>
 #include <linux/sched/signal.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
@@ -39,13 +38,13 @@
 #define DCS_GET_ID3		0xdc
 
 struct panel_drv_data {
+	struct mipi_dsi_device *dsi;
+
 	struct omap_dss_device dssdev;
 	struct omap_dss_device *src;
 
 	struct videomode vm;
 
-	struct platform_device *pdev;
-
 	struct mutex lock;
 
 	struct backlight_device *bldev;
@@ -139,7 +138,7 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
 
 static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
 {
-	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	const struct mipi_dsi_msg msg = {
 		.channel = ddata->channel,
 		.type = MIPI_DSI_DCS_READ,
@@ -149,12 +148,12 @@ static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
 		.rx_buf = data
 	};
 
-	return src->ops->dsi.transfer(src, &msg);
+	return dsi->host->ops->transfer(dsi->host, &msg);
 }
 
 static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
 {
-	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	const struct mipi_dsi_msg msg = {
 		.channel = ddata->channel,
 		.type = MIPI_DSI_DCS_SHORT_WRITE,
@@ -162,12 +161,12 @@ static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
 		.tx_len = 1,
 	};
 
-	return src->ops->dsi.transfer(src, &msg);
+	return dsi->host->ops->transfer(dsi->host, &msg);
 }
 
 static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
 {
-	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	const u8 buf[] = { dcs_cmd, param };
 	const struct mipi_dsi_msg msg = {
 		.channel = ddata->channel,
@@ -176,13 +175,13 @@ static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
 		.tx_len = 2,
 	};
 
-	return src->ops->dsi.transfer(src, &msg);
+	return dsi->host->ops->transfer(dsi->host, &msg);
 }
 
 static int dsicm_sleep_in(struct panel_drv_data *ddata)
 
 {
-	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	int r;
 	const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
 	const struct mipi_dsi_msg msg = {
@@ -194,7 +193,7 @@ static int dsicm_sleep_in(struct panel_drv_data *ddata)
 
 	hw_guard_wait(ddata);
 
-	r = src->ops->dsi.transfer(src, &msg);
+	r = dsi->host->ops->transfer(dsi->host, &msg);
 	if (r)
 		return r;
 
@@ -242,7 +241,7 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
 static int dsicm_set_update_window(struct panel_drv_data *ddata,
 		u16 x, u16 y, u16 w, u16 h)
 {
-	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	int r;
 	u16 x1 = x;
 	u16 x2 = x + w - 1;
@@ -279,11 +278,11 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
 		.tx_len = 5,
 	};
 
-	r = src->ops->dsi.transfer(src, &msgX);
+	r = dsi->host->ops->transfer(dsi->host, &msgX);
 	if (r)
 		return r;
 
-	r = src->ops->dsi.transfer(src, &msgY);
+	r = dsi->host->ops->transfer(dsi->host, &msgY);
 	if (r)
 		return r;
 
@@ -326,7 +325,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
 	return 0;
 
 err:
-	dev_err(&ddata->pdev->dev, "enter ULPS failed");
+	dev_err(&ddata->dsi->dev, "enter ULPS failed");
 	dsicm_panel_reset(ddata);
 
 	ddata->ulps_enabled = false;
@@ -349,7 +348,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 
 	r = _dsicm_enable_te(ddata, true);
 	if (r) {
-		dev_err(&ddata->pdev->dev, "failed to re-enable TE");
+		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
 		goto err2;
 	}
 
@@ -363,7 +362,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 	return 0;
 
 err2:
-	dev_err(&ddata->pdev->dev, "failed to exit ULPS");
+	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
 
 	r = dsicm_panel_reset(ddata);
 	if (!r) {
@@ -400,7 +399,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
 	else
 		level = 0;
 
-	dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level);
+	dev_dbg(&ddata->dsi->dev, "update brightness to %d\n", level);
 
 	mutex_lock(&ddata->lock);
 
@@ -637,7 +636,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	if (ddata->vpnl) {
 		r = regulator_enable(ddata->vpnl);
 		if (r) {
-			dev_err(&ddata->pdev->dev,
+			dev_err(&ddata->dsi->dev,
 				"failed to enable VPNL: %d\n", r);
 			return r;
 		}
@@ -646,7 +645,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	if (ddata->vddi) {
 		r = regulator_enable(ddata->vddi);
 		if (r) {
-			dev_err(&ddata->pdev->dev,
+			dev_err(&ddata->dsi->dev,
 				"failed to enable VDDI: %d\n", r);
 			goto err_vpnl;
 		}
@@ -654,7 +653,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
 	r = src->ops->dsi.set_config(src, &dsi_config);
 	if (r) {
-		dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
+		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
 		goto err_vddi;
 	}
 
@@ -701,7 +700,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	ddata->enabled = true;
 
 	if (!ddata->intro_printed) {
-		dev_info(&ddata->pdev->dev, "panel revision %02x.%02x.%02x\n",
+		dev_info(&ddata->dsi->dev, "panel revision %02x.%02x.%02x\n",
 			id1, id2, id3);
 		ddata->intro_printed = true;
 	}
@@ -710,7 +709,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
 	return 0;
 err:
-	dev_err(&ddata->pdev->dev, "error while enabling panel, issuing HW reset\n");
+	dev_err(&ddata->dsi->dev, "error while enabling panel, issuing HW reset\n");
 
 	dsicm_hw_reset(ddata);
 
@@ -737,7 +736,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 		r = dsicm_sleep_in(ddata);
 
 	if (r) {
-		dev_err(&ddata->pdev->dev,
+		dev_err(&ddata->dsi->dev,
 				"error disabling panel, issuing HW reset\n");
 		dsicm_hw_reset(ddata);
 	}
@@ -754,7 +753,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 
 static int dsicm_panel_reset(struct panel_drv_data *ddata)
 {
-	dev_err(&ddata->pdev->dev, "performing LCD reset\n");
+	dev_err(&ddata->dsi->dev, "performing LCD reset\n");
 
 	dsicm_power_off(ddata);
 	dsicm_hw_reset(ddata);
@@ -765,7 +764,7 @@ static int dsicm_connect(struct omap_dss_device *src,
 			 struct omap_dss_device *dst)
 {
 	struct panel_drv_data *ddata = to_panel_data(dst);
-	struct device *dev = &ddata->pdev->dev;
+	struct device *dev = &ddata->dsi->dev;
 	int r;
 
 	r = src->ops->dsi.request_vc(src, ddata->channel);
@@ -810,7 +809,7 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
 
 	return;
 err:
-	dev_dbg(&ddata->pdev->dev, "enable failed (%d)\n", r);
+	dev_dbg(&ddata->dsi->dev, "enable failed (%d)\n", r);
 	mutex_unlock(&ddata->lock);
 }
 
@@ -842,7 +841,7 @@ static void dsicm_framedone_cb(int err, void *data)
 	struct panel_drv_data *ddata = data;
 	struct omap_dss_device *src = ddata->src;
 
-	dev_dbg(&ddata->pdev->dev, "framedone, err %d\n", err);
+	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
 	src->ops->dsi.bus_unlock(src);
 }
 
@@ -866,7 +865,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data)
 
 	return IRQ_HANDLED;
 err:
-	dev_err(&ddata->pdev->dev, "start update failed\n");
+	dev_err(&ddata->dsi->dev, "start update failed\n");
 	src->ops->dsi.bus_unlock(src);
 	return IRQ_HANDLED;
 }
@@ -877,7 +876,7 @@ static void dsicm_te_timeout_work_callback(struct work_struct *work)
 					te_timeout_work.work);
 	struct omap_dss_device *src = ddata->src;
 
-	dev_err(&ddata->pdev->dev, "TE not received for 250ms!\n");
+	dev_err(&ddata->dsi->dev, "TE not received for 250ms!\n");
 
 	atomic_set(&ddata->do_update, 0);
 	src->ops->dsi.bus_unlock(src);
@@ -890,7 +889,7 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 	struct omap_dss_device *src = ddata->src;
 	int r;
 
-	dev_dbg(&ddata->pdev->dev, "update %d, %d, %d x %d\n", x, y, w, h);
+	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
 
 	mutex_lock(&ddata->lock);
 	src->ops->dsi.bus_lock(src);
@@ -935,14 +934,14 @@ static int dsicm_sync(struct omap_dss_device *dssdev)
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
 	struct omap_dss_device *src = ddata->src;
 
-	dev_dbg(&ddata->pdev->dev, "sync\n");
+	dev_dbg(&ddata->dsi->dev, "sync\n");
 
 	mutex_lock(&ddata->lock);
 	src->ops->dsi.bus_lock(src);
 	src->ops->dsi.bus_unlock(src);
 	mutex_unlock(&ddata->lock);
 
-	dev_dbg(&ddata->pdev->dev, "sync done\n");
+	dev_dbg(&ddata->dsi->dev, "sync done\n");
 
 	return 0;
 }
@@ -1019,7 +1018,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
 					u16 size)
 {
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 
 	const u8 buf[] = {
 		size & 0xff,
@@ -1033,7 +1032,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
 		.tx_len = 2,
 	};
 
-	return src->ops->dsi.transfer(src, &msg);
+	return dsi->host->ops->transfer(dsi->host, &msg);
 }
 
 static int dsicm_memory_read(struct omap_dss_device *dssdev,
@@ -1041,6 +1040,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
 		u16 x, u16 y, u16 w, u16 h)
 {
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	struct omap_dss_device *src = ddata->src;
 	int r;
 	int first = 1;
@@ -1092,7 +1092,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
 		};
 		first = 0;
 
-		r = src->ops->dsi.transfer(src, &msg);
+		r = dsi->host->ops->transfer(dsi->host, &msg);
 		if (r < 0) {
 			dev_err(dssdev->dev, "read error\n");
 			goto err3;
@@ -1101,12 +1101,12 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
 		buf_used += r;
 
 		if (r < plen) {
-			dev_err(&ddata->pdev->dev, "short read\n");
+			dev_err(&ddata->dsi->dev, "short read\n");
 			break;
 		}
 
 		if (signal_pending(current)) {
-			dev_err(&ddata->pdev->dev, "signal pending, "
+			dev_err(&ddata->dsi->dev, "signal pending, "
 					"aborting memory read\n");
 			r = -ERESTARTSYS;
 			goto err3;
@@ -1200,28 +1200,28 @@ static const struct omap_dss_driver dsicm_dss_driver = {
 	.memory_read	= dsicm_memory_read,
 };
 
-static int dsicm_probe_of(struct platform_device *pdev)
+static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 {
-	struct device_node *node = pdev->dev.of_node;
+	struct device_node *node = dsi->dev.of_node;
 	struct backlight_device *backlight;
-	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
+	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
 	struct display_timing timing;
 	int err;
 
 	ddata->channel = TCH;
 
-	ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
+	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ddata->reset_gpio)) {
 		err = PTR_ERR(ddata->reset_gpio);
-		dev_err(&pdev->dev, "reset gpio request failed: %d", err);
+		dev_err(&dsi->dev, "reset gpio request failed: %d", err);
 		return err;
 	}
 
-	ddata->ext_te_gpio = devm_gpiod_get_optional(&pdev->dev, "te",
+	ddata->ext_te_gpio = devm_gpiod_get_optional(&dsi->dev, "te",
 						     GPIOD_IN);
 	if (IS_ERR(ddata->ext_te_gpio)) {
 		err = PTR_ERR(ddata->ext_te_gpio);
-		dev_err(&pdev->dev, "TE gpio request failed: %d", err);
+		dev_err(&dsi->dev, "TE gpio request failed: %d", err);
 		return err;
 	}
 
@@ -1232,7 +1232,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
 			ddata->vm.pixelclock =
 				ddata->vm.hactive * ddata->vm.vactive * 60;
 	} else {
-		dev_warn(&pdev->dev,
+		dev_warn(&dsi->dev,
 			 "failed to get video timing, using defaults\n");
 	}
 
@@ -1242,7 +1242,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
 	ddata->height_mm = 0;
 	of_property_read_u32(node, "height-mm", &ddata->height_mm);
 
-	ddata->vpnl = devm_regulator_get_optional(&pdev->dev, "vpnl");
+	ddata->vpnl = devm_regulator_get_optional(&dsi->dev, "vpnl");
 	if (IS_ERR(ddata->vpnl)) {
 		err = PTR_ERR(ddata->vpnl);
 		if (err == -EPROBE_DEFER)
@@ -1250,7 +1250,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
 		ddata->vpnl = NULL;
 	}
 
-	ddata->vddi = devm_regulator_get_optional(&pdev->dev, "vddi");
+	ddata->vddi = devm_regulator_get_optional(&dsi->dev, "vddi");
 	if (IS_ERR(ddata->vddi)) {
 		err = PTR_ERR(ddata->vddi);
 		if (err == -EPROBE_DEFER)
@@ -1258,7 +1258,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
 		ddata->vddi = NULL;
 	}
 
-	backlight = devm_of_find_backlight(&pdev->dev);
+	backlight = devm_of_find_backlight(&dsi->dev);
 	if (IS_ERR(backlight))
 		return PTR_ERR(backlight);
 
@@ -1273,11 +1273,11 @@ static int dsicm_probe_of(struct platform_device *pdev)
 	return 0;
 }
 
-static int dsicm_probe(struct platform_device *pdev)
+static int dsicm_probe(struct mipi_dsi_device *dsi)
 {
 	struct panel_drv_data *ddata;
 	struct backlight_device *bldev = NULL;
-	struct device *dev = &pdev->dev;
+	struct device *dev = &dsi->dev;
 	struct omap_dss_device *dssdev;
 	int r;
 
@@ -1287,14 +1287,14 @@ static int dsicm_probe(struct platform_device *pdev)
 	if (!ddata)
 		return -ENOMEM;
 
-	platform_set_drvdata(pdev, ddata);
-	ddata->pdev = pdev;
+	mipi_dsi_set_drvdata(dsi, ddata);
+	ddata->dsi = dsi;
 
 	ddata->vm.hactive = 864;
 	ddata->vm.vactive = 480;
 	ddata->vm.pixelclock = 864 * 480 * 60;
 
-	r = dsicm_probe_of(pdev);
+	r = dsicm_probe_of(dsi);
 	if (r)
 		return r;
 
@@ -1376,12 +1376,12 @@ static int dsicm_probe(struct platform_device *pdev)
 	return r;
 }
 
-static int __exit dsicm_remove(struct platform_device *pdev)
+static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
 {
-	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
+	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
 	struct omap_dss_device *dssdev = &ddata->dssdev;
 
-	dev_dbg(&pdev->dev, "remove\n");
+	dev_dbg(&dsi->dev, "remove\n");
 
 	omapdss_device_unregister(dssdev);
 
@@ -1389,7 +1389,7 @@ static int __exit dsicm_remove(struct platform_device *pdev)
 		dsicm_disable(dssdev);
 	omapdss_device_disconnect(ddata->src, dssdev);
 
-	sysfs_remove_group(&pdev->dev.kobj, &dsicm_attr_group);
+	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
 
 	if (ddata->extbldev)
 		put_device(&ddata->extbldev->dev);
@@ -1410,7 +1410,7 @@ static const struct of_device_id dsicm_of_match[] = {
 
 MODULE_DEVICE_TABLE(of, dsicm_of_match);
 
-static struct platform_driver dsicm_driver = {
+static struct mipi_dsi_driver dsicm_driver = {
 	.probe = dsicm_probe,
 	.remove = __exit_p(dsicm_remove),
 	.driver = {
@@ -1419,8 +1419,7 @@ static struct platform_driver dsicm_driver = {
 		.suppress_bind_attrs = true,
 	},
 };
-
-module_platform_driver(dsicm_driver);
+module_mipi_dsi_driver(dsicm_driver);
 
 MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
 MODULE_DESCRIPTION("Generic DSI Command Mode Panel Driver");
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 6fa7833e32ad..d1187a8af37f 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -334,6 +334,8 @@ struct dsi_data {
 	struct regmap *syscon;
 	struct dss_device *dss;
 
+	struct mipi_dsi_host host;
+
 	struct dispc_clock_info user_dispc_cinfo;
 	struct dss_pll_clock_info user_dsi_cinfo;
 
@@ -432,6 +434,11 @@ static inline struct dsi_data *to_dsi_data(struct omap_dss_device *dssdev)
 	return dev_get_drvdata(dssdev->dev);
 }
 
+static inline struct dsi_data *host_to_omap(struct mipi_dsi_host *host)
+{
+	return container_of(host, struct dsi_data, host);
+}
+
 static inline void dsi_write_reg(struct dsi_data *dsi,
 				 const struct dsi_reg idx, u32 val)
 {
@@ -4711,9 +4718,12 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
 	}
 }
 
-static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
-				 const struct mipi_dsi_msg *msg)
+static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
+				      const struct mipi_dsi_msg *msg)
 {
+	struct dsi_data *dsi = host_to_omap(host);
+	struct omap_dss_device *dssdev = &dsi->output;
+
 	switch (msg->type) {
 	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
 	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
@@ -4787,11 +4797,30 @@ static const struct omap_dss_device_ops dsi_ops = {
 
 		.request_vc = dsi_request_vc,
 		.release_vc = dsi_release_vc,
-
-		.transfer = omap_dsi_transfer,
 	},
 };
 
+static int omap_dsi_host_attach(struct mipi_dsi_host *host,
+			 struct mipi_dsi_device *dsi)
+{
+	/* TODO: convert driver from custom binding method to this one */
+	return 0;
+}
+
+static int omap_dsi_host_detach(struct mipi_dsi_host *host,
+			 struct mipi_dsi_device *dsi)
+{
+	/* TODO: convert driver from custom binding method to this one */
+	return 0;
+}
+
+static const struct mipi_dsi_host_ops omap_dsi_host_ops = {
+	.attach = omap_dsi_host_attach,
+	.detach = omap_dsi_host_detach,
+	.transfer = omap_dsi_host_transfer,
+};
+
+
 /* -----------------------------------------------------------------------------
  * PLL
  */
@@ -5260,15 +5289,18 @@ static int dsi_probe(struct platform_device *pdev)
 		dsi->num_lanes_supported = 3;
 	}
 
-	r = of_platform_populate(dev->of_node, NULL, NULL, dev);
-	if (r) {
-		DSSERR("Failed to populate DSI child devices: %d\n", r);
+	dsi->host.ops = &omap_dsi_host_ops;
+	dsi->host.dev = &pdev->dev;
+
+	r = mipi_dsi_host_register(&dsi->host);
+	if (r < 0) {
+		dev_err(&pdev->dev, "failed to register DSI host: %d\n", r);
 		goto err_pm_disable;
 	}
 
 	r = dsi_init_output(dsi);
 	if (r)
-		goto err_of_depopulate;
+		goto err_dsi_host_unregister;
 
 	r = dsi_probe_of(dsi);
 	if (r) {
@@ -5284,8 +5316,8 @@ static int dsi_probe(struct platform_device *pdev)
 
 err_uninit_output:
 	dsi_uninit_output(dsi);
-err_of_depopulate:
-	of_platform_depopulate(dev);
+err_dsi_host_unregister:
+	mipi_dsi_host_unregister(&dsi->host);
 err_pm_disable:
 	pm_runtime_disable(dev);
 	return r;
@@ -5299,7 +5331,7 @@ static int dsi_remove(struct platform_device *pdev)
 
 	dsi_uninit_output(dsi);
 
-	of_platform_depopulate(&pdev->dev);
+	mipi_dsi_host_unregister(&dsi->host);
 
 	pm_runtime_disable(&pdev->dev);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 40e1ce9e256e..8cd2c800922e 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -304,10 +304,6 @@ struct omapdss_dsi_ops {
 
 	int (*request_vc)(struct omap_dss_device *dssdev, int channel);
 	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
-
-	/* data transfer */
-	ssize_t (*transfer)(struct omap_dss_device *dssdev,
-			    const struct mipi_dsi_msg *msg);
 };
 
 struct omap_dss_device_ops {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 13/56] drm/omap: dsi: introduce mipi_dsi_host
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This moves from custom platform driver infrastructure to mipi_dsi_host
and mipi_dsi_device. Note, that this is a graduate step and the driver
only uses the devices types and transfer function, but not yet the new
device binding style or drm_panel.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 121 +++++++++---------
 drivers/gpu/drm/omapdrm/dss/dsi.c             |  54 ++++++--
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |   4 -
 3 files changed, 103 insertions(+), 76 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index ea76a89d1833..c3190223d192 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -14,7 +14,6 @@
 #include <linux/interrupt.h>
 #include <linux/jiffies.h>
 #include <linux/module.h>
-#include <linux/platform_device.h>
 #include <linux/sched/signal.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
@@ -39,13 +38,13 @@
 #define DCS_GET_ID3		0xdc
 
 struct panel_drv_data {
+	struct mipi_dsi_device *dsi;
+
 	struct omap_dss_device dssdev;
 	struct omap_dss_device *src;
 
 	struct videomode vm;
 
-	struct platform_device *pdev;
-
 	struct mutex lock;
 
 	struct backlight_device *bldev;
@@ -139,7 +138,7 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
 
 static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
 {
-	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	const struct mipi_dsi_msg msg = {
 		.channel = ddata->channel,
 		.type = MIPI_DSI_DCS_READ,
@@ -149,12 +148,12 @@ static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
 		.rx_buf = data
 	};
 
-	return src->ops->dsi.transfer(src, &msg);
+	return dsi->host->ops->transfer(dsi->host, &msg);
 }
 
 static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
 {
-	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	const struct mipi_dsi_msg msg = {
 		.channel = ddata->channel,
 		.type = MIPI_DSI_DCS_SHORT_WRITE,
@@ -162,12 +161,12 @@ static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
 		.tx_len = 1,
 	};
 
-	return src->ops->dsi.transfer(src, &msg);
+	return dsi->host->ops->transfer(dsi->host, &msg);
 }
 
 static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
 {
-	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	const u8 buf[] = { dcs_cmd, param };
 	const struct mipi_dsi_msg msg = {
 		.channel = ddata->channel,
@@ -176,13 +175,13 @@ static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
 		.tx_len = 2,
 	};
 
-	return src->ops->dsi.transfer(src, &msg);
+	return dsi->host->ops->transfer(dsi->host, &msg);
 }
 
 static int dsicm_sleep_in(struct panel_drv_data *ddata)
 
 {
-	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	int r;
 	const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
 	const struct mipi_dsi_msg msg = {
@@ -194,7 +193,7 @@ static int dsicm_sleep_in(struct panel_drv_data *ddata)
 
 	hw_guard_wait(ddata);
 
-	r = src->ops->dsi.transfer(src, &msg);
+	r = dsi->host->ops->transfer(dsi->host, &msg);
 	if (r)
 		return r;
 
@@ -242,7 +241,7 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
 static int dsicm_set_update_window(struct panel_drv_data *ddata,
 		u16 x, u16 y, u16 w, u16 h)
 {
-	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	int r;
 	u16 x1 = x;
 	u16 x2 = x + w - 1;
@@ -279,11 +278,11 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
 		.tx_len = 5,
 	};
 
-	r = src->ops->dsi.transfer(src, &msgX);
+	r = dsi->host->ops->transfer(dsi->host, &msgX);
 	if (r)
 		return r;
 
-	r = src->ops->dsi.transfer(src, &msgY);
+	r = dsi->host->ops->transfer(dsi->host, &msgY);
 	if (r)
 		return r;
 
@@ -326,7 +325,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
 	return 0;
 
 err:
-	dev_err(&ddata->pdev->dev, "enter ULPS failed");
+	dev_err(&ddata->dsi->dev, "enter ULPS failed");
 	dsicm_panel_reset(ddata);
 
 	ddata->ulps_enabled = false;
@@ -349,7 +348,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 
 	r = _dsicm_enable_te(ddata, true);
 	if (r) {
-		dev_err(&ddata->pdev->dev, "failed to re-enable TE");
+		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
 		goto err2;
 	}
 
@@ -363,7 +362,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 	return 0;
 
 err2:
-	dev_err(&ddata->pdev->dev, "failed to exit ULPS");
+	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
 
 	r = dsicm_panel_reset(ddata);
 	if (!r) {
@@ -400,7 +399,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
 	else
 		level = 0;
 
-	dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level);
+	dev_dbg(&ddata->dsi->dev, "update brightness to %d\n", level);
 
 	mutex_lock(&ddata->lock);
 
@@ -637,7 +636,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	if (ddata->vpnl) {
 		r = regulator_enable(ddata->vpnl);
 		if (r) {
-			dev_err(&ddata->pdev->dev,
+			dev_err(&ddata->dsi->dev,
 				"failed to enable VPNL: %d\n", r);
 			return r;
 		}
@@ -646,7 +645,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	if (ddata->vddi) {
 		r = regulator_enable(ddata->vddi);
 		if (r) {
-			dev_err(&ddata->pdev->dev,
+			dev_err(&ddata->dsi->dev,
 				"failed to enable VDDI: %d\n", r);
 			goto err_vpnl;
 		}
@@ -654,7 +653,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
 	r = src->ops->dsi.set_config(src, &dsi_config);
 	if (r) {
-		dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
+		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
 		goto err_vddi;
 	}
 
@@ -701,7 +700,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	ddata->enabled = true;
 
 	if (!ddata->intro_printed) {
-		dev_info(&ddata->pdev->dev, "panel revision %02x.%02x.%02x\n",
+		dev_info(&ddata->dsi->dev, "panel revision %02x.%02x.%02x\n",
 			id1, id2, id3);
 		ddata->intro_printed = true;
 	}
@@ -710,7 +709,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
 	return 0;
 err:
-	dev_err(&ddata->pdev->dev, "error while enabling panel, issuing HW reset\n");
+	dev_err(&ddata->dsi->dev, "error while enabling panel, issuing HW reset\n");
 
 	dsicm_hw_reset(ddata);
 
@@ -737,7 +736,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 		r = dsicm_sleep_in(ddata);
 
 	if (r) {
-		dev_err(&ddata->pdev->dev,
+		dev_err(&ddata->dsi->dev,
 				"error disabling panel, issuing HW reset\n");
 		dsicm_hw_reset(ddata);
 	}
@@ -754,7 +753,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 
 static int dsicm_panel_reset(struct panel_drv_data *ddata)
 {
-	dev_err(&ddata->pdev->dev, "performing LCD reset\n");
+	dev_err(&ddata->dsi->dev, "performing LCD reset\n");
 
 	dsicm_power_off(ddata);
 	dsicm_hw_reset(ddata);
@@ -765,7 +764,7 @@ static int dsicm_connect(struct omap_dss_device *src,
 			 struct omap_dss_device *dst)
 {
 	struct panel_drv_data *ddata = to_panel_data(dst);
-	struct device *dev = &ddata->pdev->dev;
+	struct device *dev = &ddata->dsi->dev;
 	int r;
 
 	r = src->ops->dsi.request_vc(src, ddata->channel);
@@ -810,7 +809,7 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
 
 	return;
 err:
-	dev_dbg(&ddata->pdev->dev, "enable failed (%d)\n", r);
+	dev_dbg(&ddata->dsi->dev, "enable failed (%d)\n", r);
 	mutex_unlock(&ddata->lock);
 }
 
@@ -842,7 +841,7 @@ static void dsicm_framedone_cb(int err, void *data)
 	struct panel_drv_data *ddata = data;
 	struct omap_dss_device *src = ddata->src;
 
-	dev_dbg(&ddata->pdev->dev, "framedone, err %d\n", err);
+	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
 	src->ops->dsi.bus_unlock(src);
 }
 
@@ -866,7 +865,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data)
 
 	return IRQ_HANDLED;
 err:
-	dev_err(&ddata->pdev->dev, "start update failed\n");
+	dev_err(&ddata->dsi->dev, "start update failed\n");
 	src->ops->dsi.bus_unlock(src);
 	return IRQ_HANDLED;
 }
@@ -877,7 +876,7 @@ static void dsicm_te_timeout_work_callback(struct work_struct *work)
 					te_timeout_work.work);
 	struct omap_dss_device *src = ddata->src;
 
-	dev_err(&ddata->pdev->dev, "TE not received for 250ms!\n");
+	dev_err(&ddata->dsi->dev, "TE not received for 250ms!\n");
 
 	atomic_set(&ddata->do_update, 0);
 	src->ops->dsi.bus_unlock(src);
@@ -890,7 +889,7 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 	struct omap_dss_device *src = ddata->src;
 	int r;
 
-	dev_dbg(&ddata->pdev->dev, "update %d, %d, %d x %d\n", x, y, w, h);
+	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
 
 	mutex_lock(&ddata->lock);
 	src->ops->dsi.bus_lock(src);
@@ -935,14 +934,14 @@ static int dsicm_sync(struct omap_dss_device *dssdev)
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
 	struct omap_dss_device *src = ddata->src;
 
-	dev_dbg(&ddata->pdev->dev, "sync\n");
+	dev_dbg(&ddata->dsi->dev, "sync\n");
 
 	mutex_lock(&ddata->lock);
 	src->ops->dsi.bus_lock(src);
 	src->ops->dsi.bus_unlock(src);
 	mutex_unlock(&ddata->lock);
 
-	dev_dbg(&ddata->pdev->dev, "sync done\n");
+	dev_dbg(&ddata->dsi->dev, "sync done\n");
 
 	return 0;
 }
@@ -1019,7 +1018,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
 					u16 size)
 {
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 
 	const u8 buf[] = {
 		size & 0xff,
@@ -1033,7 +1032,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
 		.tx_len = 2,
 	};
 
-	return src->ops->dsi.transfer(src, &msg);
+	return dsi->host->ops->transfer(dsi->host, &msg);
 }
 
 static int dsicm_memory_read(struct omap_dss_device *dssdev,
@@ -1041,6 +1040,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
 		u16 x, u16 y, u16 w, u16 h)
 {
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	struct omap_dss_device *src = ddata->src;
 	int r;
 	int first = 1;
@@ -1092,7 +1092,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
 		};
 		first = 0;
 
-		r = src->ops->dsi.transfer(src, &msg);
+		r = dsi->host->ops->transfer(dsi->host, &msg);
 		if (r < 0) {
 			dev_err(dssdev->dev, "read error\n");
 			goto err3;
@@ -1101,12 +1101,12 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
 		buf_used += r;
 
 		if (r < plen) {
-			dev_err(&ddata->pdev->dev, "short read\n");
+			dev_err(&ddata->dsi->dev, "short read\n");
 			break;
 		}
 
 		if (signal_pending(current)) {
-			dev_err(&ddata->pdev->dev, "signal pending, "
+			dev_err(&ddata->dsi->dev, "signal pending, "
 					"aborting memory read\n");
 			r = -ERESTARTSYS;
 			goto err3;
@@ -1200,28 +1200,28 @@ static const struct omap_dss_driver dsicm_dss_driver = {
 	.memory_read	= dsicm_memory_read,
 };
 
-static int dsicm_probe_of(struct platform_device *pdev)
+static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 {
-	struct device_node *node = pdev->dev.of_node;
+	struct device_node *node = dsi->dev.of_node;
 	struct backlight_device *backlight;
-	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
+	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
 	struct display_timing timing;
 	int err;
 
 	ddata->channel = TCH;
 
-	ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
+	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ddata->reset_gpio)) {
 		err = PTR_ERR(ddata->reset_gpio);
-		dev_err(&pdev->dev, "reset gpio request failed: %d", err);
+		dev_err(&dsi->dev, "reset gpio request failed: %d", err);
 		return err;
 	}
 
-	ddata->ext_te_gpio = devm_gpiod_get_optional(&pdev->dev, "te",
+	ddata->ext_te_gpio = devm_gpiod_get_optional(&dsi->dev, "te",
 						     GPIOD_IN);
 	if (IS_ERR(ddata->ext_te_gpio)) {
 		err = PTR_ERR(ddata->ext_te_gpio);
-		dev_err(&pdev->dev, "TE gpio request failed: %d", err);
+		dev_err(&dsi->dev, "TE gpio request failed: %d", err);
 		return err;
 	}
 
@@ -1232,7 +1232,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
 			ddata->vm.pixelclock =
 				ddata->vm.hactive * ddata->vm.vactive * 60;
 	} else {
-		dev_warn(&pdev->dev,
+		dev_warn(&dsi->dev,
 			 "failed to get video timing, using defaults\n");
 	}
 
@@ -1242,7 +1242,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
 	ddata->height_mm = 0;
 	of_property_read_u32(node, "height-mm", &ddata->height_mm);
 
-	ddata->vpnl = devm_regulator_get_optional(&pdev->dev, "vpnl");
+	ddata->vpnl = devm_regulator_get_optional(&dsi->dev, "vpnl");
 	if (IS_ERR(ddata->vpnl)) {
 		err = PTR_ERR(ddata->vpnl);
 		if (err == -EPROBE_DEFER)
@@ -1250,7 +1250,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
 		ddata->vpnl = NULL;
 	}
 
-	ddata->vddi = devm_regulator_get_optional(&pdev->dev, "vddi");
+	ddata->vddi = devm_regulator_get_optional(&dsi->dev, "vddi");
 	if (IS_ERR(ddata->vddi)) {
 		err = PTR_ERR(ddata->vddi);
 		if (err == -EPROBE_DEFER)
@@ -1258,7 +1258,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
 		ddata->vddi = NULL;
 	}
 
-	backlight = devm_of_find_backlight(&pdev->dev);
+	backlight = devm_of_find_backlight(&dsi->dev);
 	if (IS_ERR(backlight))
 		return PTR_ERR(backlight);
 
@@ -1273,11 +1273,11 @@ static int dsicm_probe_of(struct platform_device *pdev)
 	return 0;
 }
 
-static int dsicm_probe(struct platform_device *pdev)
+static int dsicm_probe(struct mipi_dsi_device *dsi)
 {
 	struct panel_drv_data *ddata;
 	struct backlight_device *bldev = NULL;
-	struct device *dev = &pdev->dev;
+	struct device *dev = &dsi->dev;
 	struct omap_dss_device *dssdev;
 	int r;
 
@@ -1287,14 +1287,14 @@ static int dsicm_probe(struct platform_device *pdev)
 	if (!ddata)
 		return -ENOMEM;
 
-	platform_set_drvdata(pdev, ddata);
-	ddata->pdev = pdev;
+	mipi_dsi_set_drvdata(dsi, ddata);
+	ddata->dsi = dsi;
 
 	ddata->vm.hactive = 864;
 	ddata->vm.vactive = 480;
 	ddata->vm.pixelclock = 864 * 480 * 60;
 
-	r = dsicm_probe_of(pdev);
+	r = dsicm_probe_of(dsi);
 	if (r)
 		return r;
 
@@ -1376,12 +1376,12 @@ static int dsicm_probe(struct platform_device *pdev)
 	return r;
 }
 
-static int __exit dsicm_remove(struct platform_device *pdev)
+static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
 {
-	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
+	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
 	struct omap_dss_device *dssdev = &ddata->dssdev;
 
-	dev_dbg(&pdev->dev, "remove\n");
+	dev_dbg(&dsi->dev, "remove\n");
 
 	omapdss_device_unregister(dssdev);
 
@@ -1389,7 +1389,7 @@ static int __exit dsicm_remove(struct platform_device *pdev)
 		dsicm_disable(dssdev);
 	omapdss_device_disconnect(ddata->src, dssdev);
 
-	sysfs_remove_group(&pdev->dev.kobj, &dsicm_attr_group);
+	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
 
 	if (ddata->extbldev)
 		put_device(&ddata->extbldev->dev);
@@ -1410,7 +1410,7 @@ static const struct of_device_id dsicm_of_match[] = {
 
 MODULE_DEVICE_TABLE(of, dsicm_of_match);
 
-static struct platform_driver dsicm_driver = {
+static struct mipi_dsi_driver dsicm_driver = {
 	.probe = dsicm_probe,
 	.remove = __exit_p(dsicm_remove),
 	.driver = {
@@ -1419,8 +1419,7 @@ static struct platform_driver dsicm_driver = {
 		.suppress_bind_attrs = true,
 	},
 };
-
-module_platform_driver(dsicm_driver);
+module_mipi_dsi_driver(dsicm_driver);
 
 MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
 MODULE_DESCRIPTION("Generic DSI Command Mode Panel Driver");
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 6fa7833e32ad..d1187a8af37f 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -334,6 +334,8 @@ struct dsi_data {
 	struct regmap *syscon;
 	struct dss_device *dss;
 
+	struct mipi_dsi_host host;
+
 	struct dispc_clock_info user_dispc_cinfo;
 	struct dss_pll_clock_info user_dsi_cinfo;
 
@@ -432,6 +434,11 @@ static inline struct dsi_data *to_dsi_data(struct omap_dss_device *dssdev)
 	return dev_get_drvdata(dssdev->dev);
 }
 
+static inline struct dsi_data *host_to_omap(struct mipi_dsi_host *host)
+{
+	return container_of(host, struct dsi_data, host);
+}
+
 static inline void dsi_write_reg(struct dsi_data *dsi,
 				 const struct dsi_reg idx, u32 val)
 {
@@ -4711,9 +4718,12 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
 	}
 }
 
-static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
-				 const struct mipi_dsi_msg *msg)
+static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
+				      const struct mipi_dsi_msg *msg)
 {
+	struct dsi_data *dsi = host_to_omap(host);
+	struct omap_dss_device *dssdev = &dsi->output;
+
 	switch (msg->type) {
 	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
 	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
@@ -4787,11 +4797,30 @@ static const struct omap_dss_device_ops dsi_ops = {
 
 		.request_vc = dsi_request_vc,
 		.release_vc = dsi_release_vc,
-
-		.transfer = omap_dsi_transfer,
 	},
 };
 
+static int omap_dsi_host_attach(struct mipi_dsi_host *host,
+			 struct mipi_dsi_device *dsi)
+{
+	/* TODO: convert driver from custom binding method to this one */
+	return 0;
+}
+
+static int omap_dsi_host_detach(struct mipi_dsi_host *host,
+			 struct mipi_dsi_device *dsi)
+{
+	/* TODO: convert driver from custom binding method to this one */
+	return 0;
+}
+
+static const struct mipi_dsi_host_ops omap_dsi_host_ops = {
+	.attach = omap_dsi_host_attach,
+	.detach = omap_dsi_host_detach,
+	.transfer = omap_dsi_host_transfer,
+};
+
+
 /* -----------------------------------------------------------------------------
  * PLL
  */
@@ -5260,15 +5289,18 @@ static int dsi_probe(struct platform_device *pdev)
 		dsi->num_lanes_supported = 3;
 	}
 
-	r = of_platform_populate(dev->of_node, NULL, NULL, dev);
-	if (r) {
-		DSSERR("Failed to populate DSI child devices: %d\n", r);
+	dsi->host.ops = &omap_dsi_host_ops;
+	dsi->host.dev = &pdev->dev;
+
+	r = mipi_dsi_host_register(&dsi->host);
+	if (r < 0) {
+		dev_err(&pdev->dev, "failed to register DSI host: %d\n", r);
 		goto err_pm_disable;
 	}
 
 	r = dsi_init_output(dsi);
 	if (r)
-		goto err_of_depopulate;
+		goto err_dsi_host_unregister;
 
 	r = dsi_probe_of(dsi);
 	if (r) {
@@ -5284,8 +5316,8 @@ static int dsi_probe(struct platform_device *pdev)
 
 err_uninit_output:
 	dsi_uninit_output(dsi);
-err_of_depopulate:
-	of_platform_depopulate(dev);
+err_dsi_host_unregister:
+	mipi_dsi_host_unregister(&dsi->host);
 err_pm_disable:
 	pm_runtime_disable(dev);
 	return r;
@@ -5299,7 +5331,7 @@ static int dsi_remove(struct platform_device *pdev)
 
 	dsi_uninit_output(dsi);
 
-	of_platform_depopulate(&pdev->dev);
+	mipi_dsi_host_unregister(&dsi->host);
 
 	pm_runtime_disable(&pdev->dev);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 40e1ce9e256e..8cd2c800922e 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -304,10 +304,6 @@ struct omapdss_dsi_ops {
 
 	int (*request_vc)(struct omap_dss_device *dssdev, int channel);
 	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
-
-	/* data transfer */
-	ssize_t (*transfer)(struct omap_dss_device *dssdev,
-			    const struct mipi_dsi_msg *msg);
 };
 
 struct omap_dss_device_ops {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 14/56] drm/omap: panel-dsi-cm: use DSI helpers
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

After converting the driver to mipi_dsi_device we can use the generic
message helpers to simplify the driver a lot.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 125 +++---------------
 1 file changed, 18 insertions(+), 107 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index c3190223d192..ec36e62ddc3a 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -138,62 +138,22 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
 
 static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
 {
-	struct mipi_dsi_device *dsi = ddata->dsi;
-	const struct mipi_dsi_msg msg = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_DCS_READ,
-		.tx_len = 1,
-		.tx_buf = &dcs_cmd,
-		.rx_len = 1,
-		.rx_buf = data
-	};
-
-	return dsi->host->ops->transfer(dsi->host, &msg);
-}
-
-static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
-{
-	struct mipi_dsi_device *dsi = ddata->dsi;
-	const struct mipi_dsi_msg msg = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_DCS_SHORT_WRITE,
-		.tx_buf = &dcs_cmd,
-		.tx_len = 1,
-	};
-
-	return dsi->host->ops->transfer(dsi->host, &msg);
+	return mipi_dsi_dcs_read(ddata->dsi, dcs_cmd, data, 1);
 }
 
 static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
 {
-	struct mipi_dsi_device *dsi = ddata->dsi;
-	const u8 buf[] = { dcs_cmd, param };
-	const struct mipi_dsi_msg msg = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_DCS_SHORT_WRITE_PARAM,
-		.tx_buf = &buf,
-		.tx_len = 2,
-	};
-
-	return dsi->host->ops->transfer(dsi->host, &msg);
+	return mipi_dsi_dcs_write(ddata->dsi, dcs_cmd, &param, 1);
 }
 
 static int dsicm_sleep_in(struct panel_drv_data *ddata)
 
 {
-	struct mipi_dsi_device *dsi = ddata->dsi;
 	int r;
-	const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
-	const struct mipi_dsi_msg msg = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_DCS_SHORT_WRITE,
-		.tx_buf = &cmd,
-		.tx_len = 1,
-	};
 
 	hw_guard_wait(ddata);
 
-	r = dsi->host->ops->transfer(dsi->host, &msg);
+	r = mipi_dsi_dcs_enter_sleep_mode(ddata->dsi);
 	if (r)
 		return r;
 
@@ -210,7 +170,7 @@ static int dsicm_sleep_out(struct panel_drv_data *ddata)
 
 	hw_guard_wait(ddata);
 
-	r = dsicm_dcs_write_0(ddata, MIPI_DCS_EXIT_SLEEP_MODE);
+	r = mipi_dsi_dcs_exit_sleep_mode(ddata->dsi);
 	if (r)
 		return r;
 
@@ -248,45 +208,15 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
 	u16 y1 = y;
 	u16 y2 = y + h - 1;
 
-	const u8 paramX[] = {
-		MIPI_DCS_SET_COLUMN_ADDRESS,
-		(x1 >> 8) & 0xff,
-		(x1 >> 0) & 0xff,
-		(x2 >> 8) & 0xff,
-		(x2 >> 0) & 0xff,
-	};
-
-	const struct mipi_dsi_msg msgX = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_GENERIC_LONG_WRITE,
-		.tx_buf = paramX,
-		.tx_len = 5,
-	};
-
-	const u8 paramY[] = {
-		MIPI_DCS_SET_PAGE_ADDRESS,
-		(y1 >> 8) & 0xff,
-		(y1 >> 0) & 0xff,
-		(y2 >> 8) & 0xff,
-		(y2 >> 0) & 0xff,
-	};
-
-	const struct mipi_dsi_msg msgY = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_GENERIC_LONG_WRITE,
-		.tx_buf = paramY,
-		.tx_len = 5,
-	};
-
-	r = dsi->host->ops->transfer(dsi->host, &msgX);
-	if (r)
+	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
+	if (r < 0)
 		return r;
 
-	r = dsi->host->ops->transfer(dsi->host, &msgY);
-	if (r)
+	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
+	if (r < 0)
 		return r;
 
-	return r;
+	return 0;
 }
 
 static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
@@ -680,12 +610,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	if (r)
 		goto err;
 
-	r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_PIXEL_FORMAT,
-		MIPI_DCS_PIXEL_FMT_24BIT);
+	r = mipi_dsi_dcs_set_pixel_format(ddata->dsi, MIPI_DCS_PIXEL_FMT_24BIT);
 	if (r)
 		goto err;
 
-	r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_DISPLAY_ON);
+	r = mipi_dsi_dcs_set_display_on(ddata->dsi);
 	if (r)
 		goto err;
 
@@ -731,7 +660,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 
 	src->ops->dsi.disable_video_output(src, ddata->channel);
 
-	r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_DISPLAY_OFF);
+	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
 	if (!r)
 		r = dsicm_sleep_in(ddata);
 
@@ -949,12 +878,13 @@ static int dsicm_sync(struct omap_dss_device *dssdev)
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
 	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	int r;
 
 	if (enable)
-		r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_TEAR_ON, 0);
+		r = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK);
 	else
-		r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_TEAR_OFF);
+		r = mipi_dsi_dcs_set_tear_off(dsi);
 
 	if (!ddata->ext_te_gpio)
 		src->ops->dsi.enable_te(src, enable);
@@ -1020,19 +950,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
 	struct mipi_dsi_device *dsi = ddata->dsi;
 
-	const u8 buf[] = {
-		size & 0xff,
-		size >> 8 & 0xff,
-	};
-
-	const struct mipi_dsi_msg msg = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
-		.tx_buf = buf,
-		.tx_len = 2,
-	};
-
-	return dsi->host->ops->transfer(dsi->host, &msg);
+	return mipi_dsi_set_maximum_return_packet_size(dsi, size);
 }
 
 static int dsicm_memory_read(struct omap_dss_device *dssdev,
@@ -1082,17 +1000,10 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
 
 	while (buf_used < size) {
 		u8 dcs_cmd = first ? 0x2e : 0x3e;
-		const struct mipi_dsi_msg msg = {
-			.channel = ddata->channel,
-			.type = MIPI_DSI_DCS_READ,
-			.tx_buf = &dcs_cmd,
-			.tx_len = 1,
-			.rx_buf = buf + buf_used,
-			.rx_len = size - buf_used,
-		};
 		first = 0;
 
-		r = dsi->host->ops->transfer(dsi->host, &msg);
+		r = mipi_dsi_dcs_read(dsi, dcs_cmd,
+				      buf + buf_used, size - buf_used);
 		if (r < 0) {
 			dev_err(dssdev->dev, "read error\n");
 			goto err3;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 14/56] drm/omap: panel-dsi-cm: use DSI helpers
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

After converting the driver to mipi_dsi_device we can use the generic
message helpers to simplify the driver a lot.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 125 +++---------------
 1 file changed, 18 insertions(+), 107 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index c3190223d192..ec36e62ddc3a 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -138,62 +138,22 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
 
 static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
 {
-	struct mipi_dsi_device *dsi = ddata->dsi;
-	const struct mipi_dsi_msg msg = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_DCS_READ,
-		.tx_len = 1,
-		.tx_buf = &dcs_cmd,
-		.rx_len = 1,
-		.rx_buf = data
-	};
-
-	return dsi->host->ops->transfer(dsi->host, &msg);
-}
-
-static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
-{
-	struct mipi_dsi_device *dsi = ddata->dsi;
-	const struct mipi_dsi_msg msg = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_DCS_SHORT_WRITE,
-		.tx_buf = &dcs_cmd,
-		.tx_len = 1,
-	};
-
-	return dsi->host->ops->transfer(dsi->host, &msg);
+	return mipi_dsi_dcs_read(ddata->dsi, dcs_cmd, data, 1);
 }
 
 static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
 {
-	struct mipi_dsi_device *dsi = ddata->dsi;
-	const u8 buf[] = { dcs_cmd, param };
-	const struct mipi_dsi_msg msg = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_DCS_SHORT_WRITE_PARAM,
-		.tx_buf = &buf,
-		.tx_len = 2,
-	};
-
-	return dsi->host->ops->transfer(dsi->host, &msg);
+	return mipi_dsi_dcs_write(ddata->dsi, dcs_cmd, &param, 1);
 }
 
 static int dsicm_sleep_in(struct panel_drv_data *ddata)
 
 {
-	struct mipi_dsi_device *dsi = ddata->dsi;
 	int r;
-	const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
-	const struct mipi_dsi_msg msg = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_DCS_SHORT_WRITE,
-		.tx_buf = &cmd,
-		.tx_len = 1,
-	};
 
 	hw_guard_wait(ddata);
 
-	r = dsi->host->ops->transfer(dsi->host, &msg);
+	r = mipi_dsi_dcs_enter_sleep_mode(ddata->dsi);
 	if (r)
 		return r;
 
@@ -210,7 +170,7 @@ static int dsicm_sleep_out(struct panel_drv_data *ddata)
 
 	hw_guard_wait(ddata);
 
-	r = dsicm_dcs_write_0(ddata, MIPI_DCS_EXIT_SLEEP_MODE);
+	r = mipi_dsi_dcs_exit_sleep_mode(ddata->dsi);
 	if (r)
 		return r;
 
@@ -248,45 +208,15 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
 	u16 y1 = y;
 	u16 y2 = y + h - 1;
 
-	const u8 paramX[] = {
-		MIPI_DCS_SET_COLUMN_ADDRESS,
-		(x1 >> 8) & 0xff,
-		(x1 >> 0) & 0xff,
-		(x2 >> 8) & 0xff,
-		(x2 >> 0) & 0xff,
-	};
-
-	const struct mipi_dsi_msg msgX = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_GENERIC_LONG_WRITE,
-		.tx_buf = paramX,
-		.tx_len = 5,
-	};
-
-	const u8 paramY[] = {
-		MIPI_DCS_SET_PAGE_ADDRESS,
-		(y1 >> 8) & 0xff,
-		(y1 >> 0) & 0xff,
-		(y2 >> 8) & 0xff,
-		(y2 >> 0) & 0xff,
-	};
-
-	const struct mipi_dsi_msg msgY = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_GENERIC_LONG_WRITE,
-		.tx_buf = paramY,
-		.tx_len = 5,
-	};
-
-	r = dsi->host->ops->transfer(dsi->host, &msgX);
-	if (r)
+	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
+	if (r < 0)
 		return r;
 
-	r = dsi->host->ops->transfer(dsi->host, &msgY);
-	if (r)
+	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
+	if (r < 0)
 		return r;
 
-	return r;
+	return 0;
 }
 
 static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
@@ -680,12 +610,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	if (r)
 		goto err;
 
-	r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_PIXEL_FORMAT,
-		MIPI_DCS_PIXEL_FMT_24BIT);
+	r = mipi_dsi_dcs_set_pixel_format(ddata->dsi, MIPI_DCS_PIXEL_FMT_24BIT);
 	if (r)
 		goto err;
 
-	r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_DISPLAY_ON);
+	r = mipi_dsi_dcs_set_display_on(ddata->dsi);
 	if (r)
 		goto err;
 
@@ -731,7 +660,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 
 	src->ops->dsi.disable_video_output(src, ddata->channel);
 
-	r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_DISPLAY_OFF);
+	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
 	if (!r)
 		r = dsicm_sleep_in(ddata);
 
@@ -949,12 +878,13 @@ static int dsicm_sync(struct omap_dss_device *dssdev)
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
 	struct omap_dss_device *src = ddata->src;
+	struct mipi_dsi_device *dsi = ddata->dsi;
 	int r;
 
 	if (enable)
-		r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_TEAR_ON, 0);
+		r = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK);
 	else
-		r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_TEAR_OFF);
+		r = mipi_dsi_dcs_set_tear_off(dsi);
 
 	if (!ddata->ext_te_gpio)
 		src->ops->dsi.enable_te(src, enable);
@@ -1020,19 +950,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
 	struct mipi_dsi_device *dsi = ddata->dsi;
 
-	const u8 buf[] = {
-		size & 0xff,
-		size >> 8 & 0xff,
-	};
-
-	const struct mipi_dsi_msg msg = {
-		.channel = ddata->channel,
-		.type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
-		.tx_buf = buf,
-		.tx_len = 2,
-	};
-
-	return dsi->host->ops->transfer(dsi->host, &msg);
+	return mipi_dsi_set_maximum_return_packet_size(dsi, size);
 }
 
 static int dsicm_memory_read(struct omap_dss_device *dssdev,
@@ -1082,17 +1000,10 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
 
 	while (buf_used < size) {
 		u8 dcs_cmd = first ? 0x2e : 0x3e;
-		const struct mipi_dsi_msg msg = {
-			.channel = ddata->channel,
-			.type = MIPI_DSI_DCS_READ,
-			.tx_buf = &dcs_cmd,
-			.tx_len = 1,
-			.rx_buf = buf + buf_used,
-			.rx_len = size - buf_used,
-		};
 		first = 0;
 
-		r = dsi->host->ops->transfer(dsi->host, &msg);
+		r = mipi_dsi_dcs_read(dsi, dcs_cmd,
+				      buf + buf_used, size - buf_used);
 		if (r < 0) {
 			dev_err(dssdev->dev, "read error\n");
 			goto err3;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 15/56] drm/omap: dsi: request VC via mipi_dsi_attach
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Drop custom request_vc/release_vc callbacks by using the
generic mipi_dsi_attach/mipi_dsi_detach functions.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 24 +++++---
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 61 ++++++++-----------
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  3 -
 3 files changed, 41 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index ec36e62ddc3a..b1ca9b34ce17 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -693,14 +693,6 @@ static int dsicm_connect(struct omap_dss_device *src,
 			 struct omap_dss_device *dst)
 {
 	struct panel_drv_data *ddata = to_panel_data(dst);
-	struct device *dev = &ddata->dsi->dev;
-	int r;
-
-	r = src->ops->dsi.request_vc(src, ddata->channel);
-	if (r) {
-		dev_err(dev, "failed to get virtual channel\n");
-		return r;
-	}
 
 	ddata->src = src;
 	return 0;
@@ -711,7 +703,6 @@ static void dsicm_disconnect(struct omap_dss_device *src,
 {
 	struct panel_drv_data *ddata = to_panel_data(dst);
 
-	src->ops->dsi.release_vc(src, ddata->channel);
 	ddata->src = NULL;
 }
 
@@ -1276,8 +1267,21 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 		goto err_bl;
 	}
 
+	dsi->lanes = 3;
+	dsi->format = MIPI_DSI_FMT_RGB888;
+	dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
+			  MIPI_DSI_MODE_EOT_PACKET;
+	dsi->hs_rate = 300000000;
+	dsi->lp_rate = 10000000;
+
+	r = mipi_dsi_attach(dsi);
+	if (r < 0)
+		goto err_dsi_attach;
+
 	return 0;
 
+err_dsi_attach:
+	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
 err_bl:
 	destroy_workqueue(ddata->workqueue);
 err_reg:
@@ -1294,6 +1298,8 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
 
 	dev_dbg(&dsi->dev, "remove\n");
 
+	mipi_dsi_detach(dsi);
+
 	omapdss_device_unregister(dssdev);
 
 	if (omapdss_device_is_enabled(dssdev))
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index d1187a8af37f..a16427f3bc23 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -349,7 +349,7 @@ struct dsi_data {
 
 	struct {
 		enum dsi_vc_source source;
-		struct omap_dss_device *dssdev;
+		struct mipi_dsi_device *dest;
 		enum fifo_size tx_fifo_size;
 		enum fifo_size rx_fifo_size;
 	} vc[4];
@@ -4692,32 +4692,6 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)
 	}
 }
 
-static int dsi_request_vc(struct omap_dss_device *dssdev, int channel)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
-	if (channel < 0 || channel > 3)
-		return -EINVAL;
-
-	if (dsi->vc[channel].dssdev) {
-		DSSERR("cannot get VC for display %s", dssdev->name);
-		return -EBUSY;
-	}
-
-	dsi->vc[channel].dssdev = dssdev;
-	return 0;
-}
-
-static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
-	if ((channel >= 0 && channel <= 3) &&
-		dsi->vc[channel].dssdev == dssdev) {
-		dsi->vc[channel].dssdev = NULL;
-	}
-}
-
 static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 				      const struct mipi_dsi_msg *msg)
 {
@@ -4794,23 +4768,40 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.update = dsi_update,
 
 		.enable_te = dsi_enable_te,
-
-		.request_vc = dsi_request_vc,
-		.release_vc = dsi_release_vc,
 	},
 };
 
 static int omap_dsi_host_attach(struct mipi_dsi_host *host,
-			 struct mipi_dsi_device *dsi)
+				struct mipi_dsi_device *client)
 {
-	/* TODO: convert driver from custom binding method to this one */
+	struct dsi_data *dsi = host_to_omap(host);
+	unsigned int channel = client->channel;
+
+	if (channel > 3)
+		return -EINVAL;
+
+	if (dsi->vc[channel].dest) {
+		DSSERR("cannot get VC for display %s", dev_name(&client->dev));
+		return -EBUSY;
+	}
+
+	dsi->vc[channel].dest = client;
 	return 0;
 }
 
 static int omap_dsi_host_detach(struct mipi_dsi_host *host,
-			 struct mipi_dsi_device *dsi)
+				struct mipi_dsi_device *client)
 {
-	/* TODO: convert driver from custom binding method to this one */
+	struct dsi_data *dsi = host_to_omap(host);
+	unsigned int channel = client->channel;
+
+	if (channel > 3)
+		return -EINVAL;
+
+	if (dsi->vc[channel].dest != client)
+		return -EINVAL;
+
+	dsi->vc[channel].dest = NULL;
 	return 0;
 }
 
@@ -5269,7 +5260,7 @@ static int dsi_probe(struct platform_device *pdev)
 	/* DSI VCs initialization */
 	for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
 		dsi->vc[i].source = DSI_VC_SOURCE_L4;
-		dsi->vc[i].dssdev = NULL;
+		dsi->vc[i].dest = NULL;
 	}
 
 	r = dsi_get_clocks(dsi);
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 8cd2c800922e..78041ef922cc 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -301,9 +301,6 @@ struct omapdss_dsi_ops {
 	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
 	void (*disable_video_output)(struct omap_dss_device *dssdev,
 			int channel);
-
-	int (*request_vc)(struct omap_dss_device *dssdev, int channel);
-	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
 };
 
 struct omap_dss_device_ops {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 15/56] drm/omap: dsi: request VC via mipi_dsi_attach
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Drop custom request_vc/release_vc callbacks by using the
generic mipi_dsi_attach/mipi_dsi_detach functions.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 24 +++++---
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 61 ++++++++-----------
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  3 -
 3 files changed, 41 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index ec36e62ddc3a..b1ca9b34ce17 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -693,14 +693,6 @@ static int dsicm_connect(struct omap_dss_device *src,
 			 struct omap_dss_device *dst)
 {
 	struct panel_drv_data *ddata = to_panel_data(dst);
-	struct device *dev = &ddata->dsi->dev;
-	int r;
-
-	r = src->ops->dsi.request_vc(src, ddata->channel);
-	if (r) {
-		dev_err(dev, "failed to get virtual channel\n");
-		return r;
-	}
 
 	ddata->src = src;
 	return 0;
@@ -711,7 +703,6 @@ static void dsicm_disconnect(struct omap_dss_device *src,
 {
 	struct panel_drv_data *ddata = to_panel_data(dst);
 
-	src->ops->dsi.release_vc(src, ddata->channel);
 	ddata->src = NULL;
 }
 
@@ -1276,8 +1267,21 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 		goto err_bl;
 	}
 
+	dsi->lanes = 3;
+	dsi->format = MIPI_DSI_FMT_RGB888;
+	dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
+			  MIPI_DSI_MODE_EOT_PACKET;
+	dsi->hs_rate = 300000000;
+	dsi->lp_rate = 10000000;
+
+	r = mipi_dsi_attach(dsi);
+	if (r < 0)
+		goto err_dsi_attach;
+
 	return 0;
 
+err_dsi_attach:
+	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
 err_bl:
 	destroy_workqueue(ddata->workqueue);
 err_reg:
@@ -1294,6 +1298,8 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
 
 	dev_dbg(&dsi->dev, "remove\n");
 
+	mipi_dsi_detach(dsi);
+
 	omapdss_device_unregister(dssdev);
 
 	if (omapdss_device_is_enabled(dssdev))
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index d1187a8af37f..a16427f3bc23 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -349,7 +349,7 @@ struct dsi_data {
 
 	struct {
 		enum dsi_vc_source source;
-		struct omap_dss_device *dssdev;
+		struct mipi_dsi_device *dest;
 		enum fifo_size tx_fifo_size;
 		enum fifo_size rx_fifo_size;
 	} vc[4];
@@ -4692,32 +4692,6 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)
 	}
 }
 
-static int dsi_request_vc(struct omap_dss_device *dssdev, int channel)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
-	if (channel < 0 || channel > 3)
-		return -EINVAL;
-
-	if (dsi->vc[channel].dssdev) {
-		DSSERR("cannot get VC for display %s", dssdev->name);
-		return -EBUSY;
-	}
-
-	dsi->vc[channel].dssdev = dssdev;
-	return 0;
-}
-
-static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
-	if ((channel >= 0 && channel <= 3) &&
-		dsi->vc[channel].dssdev == dssdev) {
-		dsi->vc[channel].dssdev = NULL;
-	}
-}
-
 static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 				      const struct mipi_dsi_msg *msg)
 {
@@ -4794,23 +4768,40 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.update = dsi_update,
 
 		.enable_te = dsi_enable_te,
-
-		.request_vc = dsi_request_vc,
-		.release_vc = dsi_release_vc,
 	},
 };
 
 static int omap_dsi_host_attach(struct mipi_dsi_host *host,
-			 struct mipi_dsi_device *dsi)
+				struct mipi_dsi_device *client)
 {
-	/* TODO: convert driver from custom binding method to this one */
+	struct dsi_data *dsi = host_to_omap(host);
+	unsigned int channel = client->channel;
+
+	if (channel > 3)
+		return -EINVAL;
+
+	if (dsi->vc[channel].dest) {
+		DSSERR("cannot get VC for display %s", dev_name(&client->dev));
+		return -EBUSY;
+	}
+
+	dsi->vc[channel].dest = client;
 	return 0;
 }
 
 static int omap_dsi_host_detach(struct mipi_dsi_host *host,
-			 struct mipi_dsi_device *dsi)
+				struct mipi_dsi_device *client)
 {
-	/* TODO: convert driver from custom binding method to this one */
+	struct dsi_data *dsi = host_to_omap(host);
+	unsigned int channel = client->channel;
+
+	if (channel > 3)
+		return -EINVAL;
+
+	if (dsi->vc[channel].dest != client)
+		return -EINVAL;
+
+	dsi->vc[channel].dest = NULL;
 	return 0;
 }
 
@@ -5269,7 +5260,7 @@ static int dsi_probe(struct platform_device *pdev)
 	/* DSI VCs initialization */
 	for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
 		dsi->vc[i].source = DSI_VC_SOURCE_L4;
-		dsi->vc[i].dssdev = NULL;
+		dsi->vc[i].dest = NULL;
 	}
 
 	r = dsi_get_clocks(dsi);
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 8cd2c800922e..78041ef922cc 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -301,9 +301,6 @@ struct omapdss_dsi_ops {
 	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
 	void (*disable_video_output)(struct omap_dss_device *dssdev,
 			int channel);
-
-	int (*request_vc)(struct omap_dss_device *dssdev, int channel);
-	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
 };
 
 struct omap_dss_device_ops {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 16/56] drm/omap: panel-dsi-cm: drop hardcoded VC
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Use dsi->channel everywhere, which originates from DT.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 20 +++++++------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index b1ca9b34ce17..25183744a61d 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -27,9 +27,6 @@
 
 #include "../dss/omapdss.h"
 
-/* DSI Virtual channel. Hardcoded for now. */
-#define TCH 0
-
 #define DCS_READ_NUM_ERRORS	0x05
 #define DCS_BRIGHTNESS		0x51
 #define DCS_CTRL_DISPLAY	0x53
@@ -73,7 +70,6 @@ struct panel_drv_data {
 	bool te_enabled;
 
 	atomic_t do_update;
-	int channel;
 
 	struct delayed_work te_timeout_work;
 
@@ -274,7 +270,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 		return 0;
 
 	src->ops->enable(src);
-	src->ops->dsi.enable_hs(src, ddata->channel, true);
+	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
 
 	r = _dsicm_enable_te(ddata, true);
 	if (r) {
@@ -591,7 +587,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
 	dsicm_hw_reset(ddata);
 
-	src->ops->dsi.enable_hs(src, ddata->channel, false);
+	src->ops->dsi.enable_hs(src, ddata->dsi->channel, false);
 
 	r = dsicm_sleep_out(ddata);
 	if (r)
@@ -622,7 +618,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	if (r)
 		goto err;
 
-	r = src->ops->dsi.enable_video_output(src, ddata->channel);
+	r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
 	if (r)
 		goto err;
 
@@ -634,7 +630,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 		ddata->intro_printed = true;
 	}
 
-	src->ops->dsi.enable_hs(src, ddata->channel, true);
+	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
 
 	return 0;
 err:
@@ -658,7 +654,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 	struct omap_dss_device *src = ddata->src;
 	int r;
 
-	src->ops->dsi.disable_video_output(src, ddata->channel);
+	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
 
 	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
 	if (!r)
@@ -777,7 +773,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data)
 	if (old) {
 		cancel_delayed_work(&ddata->te_timeout_work);
 
-		r = src->ops->dsi.update(src, ddata->channel, dsicm_framedone_cb,
+		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
 				ddata);
 		if (r)
 			goto err;
@@ -834,7 +830,7 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 				msecs_to_jiffies(250));
 		atomic_set(&ddata->do_update, 1);
 	} else {
-		r = src->ops->dsi.update(src, ddata->channel, dsicm_framedone_cb,
+		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
 				ddata);
 		if (r)
 			goto err;
@@ -1110,8 +1106,6 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 	struct display_timing timing;
 	int err;
 
-	ddata->channel = TCH;
-
 	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ddata->reset_gpio)) {
 		err = PTR_ERR(ddata->reset_gpio);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 16/56] drm/omap: panel-dsi-cm: drop hardcoded VC
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Use dsi->channel everywhere, which originates from DT.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 20 +++++++------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index b1ca9b34ce17..25183744a61d 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -27,9 +27,6 @@
 
 #include "../dss/omapdss.h"
 
-/* DSI Virtual channel. Hardcoded for now. */
-#define TCH 0
-
 #define DCS_READ_NUM_ERRORS	0x05
 #define DCS_BRIGHTNESS		0x51
 #define DCS_CTRL_DISPLAY	0x53
@@ -73,7 +70,6 @@ struct panel_drv_data {
 	bool te_enabled;
 
 	atomic_t do_update;
-	int channel;
 
 	struct delayed_work te_timeout_work;
 
@@ -274,7 +270,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 		return 0;
 
 	src->ops->enable(src);
-	src->ops->dsi.enable_hs(src, ddata->channel, true);
+	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
 
 	r = _dsicm_enable_te(ddata, true);
 	if (r) {
@@ -591,7 +587,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
 	dsicm_hw_reset(ddata);
 
-	src->ops->dsi.enable_hs(src, ddata->channel, false);
+	src->ops->dsi.enable_hs(src, ddata->dsi->channel, false);
 
 	r = dsicm_sleep_out(ddata);
 	if (r)
@@ -622,7 +618,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	if (r)
 		goto err;
 
-	r = src->ops->dsi.enable_video_output(src, ddata->channel);
+	r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
 	if (r)
 		goto err;
 
@@ -634,7 +630,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 		ddata->intro_printed = true;
 	}
 
-	src->ops->dsi.enable_hs(src, ddata->channel, true);
+	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
 
 	return 0;
 err:
@@ -658,7 +654,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 	struct omap_dss_device *src = ddata->src;
 	int r;
 
-	src->ops->dsi.disable_video_output(src, ddata->channel);
+	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
 
 	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
 	if (!r)
@@ -777,7 +773,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data)
 	if (old) {
 		cancel_delayed_work(&ddata->te_timeout_work);
 
-		r = src->ops->dsi.update(src, ddata->channel, dsicm_framedone_cb,
+		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
 				ddata);
 		if (r)
 			goto err;
@@ -834,7 +830,7 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 				msecs_to_jiffies(250));
 		atomic_set(&ddata->do_update, 1);
 	} else {
-		r = src->ops->dsi.update(src, ddata->channel, dsicm_framedone_cb,
+		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
 				ddata);
 		if (r)
 			goto err;
@@ -1110,8 +1106,6 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 	struct display_timing timing;
 	int err;
 
-	ddata->channel = TCH;
-
 	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ddata->reset_gpio)) {
 		err = PTR_ERR(ddata->reset_gpio);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 17/56] drm/omap: panel-dsi-cm: use common MIPI DCS 1.3 defines
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Drop local definition of common MIPI DCS 1.3 defines.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 25183744a61d..a7236d9c3046 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -28,8 +28,6 @@
 #include "../dss/omapdss.h"
 
 #define DCS_READ_NUM_ERRORS	0x05
-#define DCS_BRIGHTNESS		0x51
-#define DCS_CTRL_DISPLAY	0x53
 #define DCS_GET_ID1		0xda
 #define DCS_GET_ID2		0xdb
 #define DCS_GET_ID3		0xdc
@@ -333,8 +331,10 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
 		src->ops->dsi.bus_lock(src);
 
 		r = dsicm_wake_up(ddata);
-		if (!r)
-			r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, level);
+		if (!r) {
+			r = dsicm_dcs_write_1(ddata,
+				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
+		}
 
 		src->ops->dsi.bus_unlock(src);
 	}
@@ -597,11 +597,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	if (r)
 		goto err;
 
-	r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, 0xff);
+	r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 0xff);
 	if (r)
 		goto err;
 
-	r = dsicm_dcs_write_1(ddata, DCS_CTRL_DISPLAY,
+	r = dsicm_dcs_write_1(ddata, MIPI_DCS_WRITE_CONTROL_DISPLAY,
 			(1<<2) | (1<<5));	/* BL | BCTRL */
 	if (r)
 		goto err;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 17/56] drm/omap: panel-dsi-cm: use common MIPI DCS 1.3 defines
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Drop local definition of common MIPI DCS 1.3 defines.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 25183744a61d..a7236d9c3046 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -28,8 +28,6 @@
 #include "../dss/omapdss.h"
 
 #define DCS_READ_NUM_ERRORS	0x05
-#define DCS_BRIGHTNESS		0x51
-#define DCS_CTRL_DISPLAY	0x53
 #define DCS_GET_ID1		0xda
 #define DCS_GET_ID2		0xdb
 #define DCS_GET_ID3		0xdc
@@ -333,8 +331,10 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
 		src->ops->dsi.bus_lock(src);
 
 		r = dsicm_wake_up(ddata);
-		if (!r)
-			r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, level);
+		if (!r) {
+			r = dsicm_dcs_write_1(ddata,
+				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
+		}
 
 		src->ops->dsi.bus_unlock(src);
 	}
@@ -597,11 +597,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	if (r)
 		goto err;
 
-	r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, 0xff);
+	r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 0xff);
 	if (r)
 		goto err;
 
-	r = dsicm_dcs_write_1(ddata, DCS_CTRL_DISPLAY,
+	r = dsicm_dcs_write_1(ddata, MIPI_DCS_WRITE_CONTROL_DISPLAY,
 			(1<<2) | (1<<5));	/* BL | BCTRL */
 	if (r)
 		goto err;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 18/56] drm/omap: dsi: drop unused memory_read()
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

memory_read is not used, so we can drop the code.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 93 -------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  4 -
 2 files changed, 97 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index a7236d9c3046..dd9112ca76ba 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -931,97 +931,6 @@ static int dsicm_get_te(struct omap_dss_device *dssdev)
 	return r;
 }
 
-static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
-					u16 size)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct mipi_dsi_device *dsi = ddata->dsi;
-
-	return mipi_dsi_set_maximum_return_packet_size(dsi, size);
-}
-
-static int dsicm_memory_read(struct omap_dss_device *dssdev,
-		void *buf, size_t size,
-		u16 x, u16 y, u16 w, u16 h)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct mipi_dsi_device *dsi = ddata->dsi;
-	struct omap_dss_device *src = ddata->src;
-	int r;
-	int first = 1;
-	int plen;
-	unsigned int buf_used = 0;
-
-	if (size < w * h * 3)
-		return -ENOMEM;
-
-	mutex_lock(&ddata->lock);
-
-	if (!ddata->enabled) {
-		r = -ENODEV;
-		goto err1;
-	}
-
-	size = min((u32)w * h * 3,
-		   ddata->vm.hactive * ddata->vm.vactive * 3);
-
-	src->ops->dsi.bus_lock(src);
-
-	r = dsicm_wake_up(ddata);
-	if (r)
-		goto err2;
-
-	/* plen 1 or 2 goes into short packet. until checksum error is fixed,
-	 * use short packets. plen 32 works, but bigger packets seem to cause
-	 * an error. */
-	if (size % 2)
-		plen = 1;
-	else
-		plen = 2;
-
-	dsicm_set_update_window(ddata, x, y, w, h);
-
-	r = dsicm_set_max_rx_packet_size(dssdev, plen);
-	if (r)
-		goto err2;
-
-	while (buf_used < size) {
-		u8 dcs_cmd = first ? 0x2e : 0x3e;
-		first = 0;
-
-		r = mipi_dsi_dcs_read(dsi, dcs_cmd,
-				      buf + buf_used, size - buf_used);
-		if (r < 0) {
-			dev_err(dssdev->dev, "read error\n");
-			goto err3;
-		}
-
-		buf_used += r;
-
-		if (r < plen) {
-			dev_err(&ddata->dsi->dev, "short read\n");
-			break;
-		}
-
-		if (signal_pending(current)) {
-			dev_err(&ddata->dsi->dev, "signal pending, "
-					"aborting memory read\n");
-			r = -ERESTARTSYS;
-			goto err3;
-		}
-	}
-
-	r = buf_used;
-
-err3:
-	dsicm_set_max_rx_packet_size(dssdev, 1);
-err2:
-	src->ops->dsi.bus_unlock(src);
-err1:
-	mutex_unlock(&ddata->lock);
-	return r;
-}
-
 static void dsicm_ulps_work(struct work_struct *work)
 {
 	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
@@ -1094,8 +1003,6 @@ static const struct omap_dss_driver dsicm_dss_driver = {
 
 	.enable_te	= dsicm_enable_te,
 	.get_te		= dsicm_get_te,
-
-	.memory_read	= dsicm_memory_read,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 78041ef922cc..e67928373560 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -389,10 +389,6 @@ struct omap_dss_driver {
 
 	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
 	int (*get_te)(struct omap_dss_device *dssdev);
-
-	int (*memory_read)(struct omap_dss_device *dssdev,
-			void *buf, size_t size,
-			u16 x, u16 y, u16 w, u16 h);
 };
 
 struct dss_device *omapdss_get_dss(void);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 18/56] drm/omap: dsi: drop unused memory_read()
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

memory_read is not used, so we can drop the code.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 93 -------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  4 -
 2 files changed, 97 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index a7236d9c3046..dd9112ca76ba 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -931,97 +931,6 @@ static int dsicm_get_te(struct omap_dss_device *dssdev)
 	return r;
 }
 
-static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
-					u16 size)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct mipi_dsi_device *dsi = ddata->dsi;
-
-	return mipi_dsi_set_maximum_return_packet_size(dsi, size);
-}
-
-static int dsicm_memory_read(struct omap_dss_device *dssdev,
-		void *buf, size_t size,
-		u16 x, u16 y, u16 w, u16 h)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct mipi_dsi_device *dsi = ddata->dsi;
-	struct omap_dss_device *src = ddata->src;
-	int r;
-	int first = 1;
-	int plen;
-	unsigned int buf_used = 0;
-
-	if (size < w * h * 3)
-		return -ENOMEM;
-
-	mutex_lock(&ddata->lock);
-
-	if (!ddata->enabled) {
-		r = -ENODEV;
-		goto err1;
-	}
-
-	size = min((u32)w * h * 3,
-		   ddata->vm.hactive * ddata->vm.vactive * 3);
-
-	src->ops->dsi.bus_lock(src);
-
-	r = dsicm_wake_up(ddata);
-	if (r)
-		goto err2;
-
-	/* plen 1 or 2 goes into short packet. until checksum error is fixed,
-	 * use short packets. plen 32 works, but bigger packets seem to cause
-	 * an error. */
-	if (size % 2)
-		plen = 1;
-	else
-		plen = 2;
-
-	dsicm_set_update_window(ddata, x, y, w, h);
-
-	r = dsicm_set_max_rx_packet_size(dssdev, plen);
-	if (r)
-		goto err2;
-
-	while (buf_used < size) {
-		u8 dcs_cmd = first ? 0x2e : 0x3e;
-		first = 0;
-
-		r = mipi_dsi_dcs_read(dsi, dcs_cmd,
-				      buf + buf_used, size - buf_used);
-		if (r < 0) {
-			dev_err(dssdev->dev, "read error\n");
-			goto err3;
-		}
-
-		buf_used += r;
-
-		if (r < plen) {
-			dev_err(&ddata->dsi->dev, "short read\n");
-			break;
-		}
-
-		if (signal_pending(current)) {
-			dev_err(&ddata->dsi->dev, "signal pending, "
-					"aborting memory read\n");
-			r = -ERESTARTSYS;
-			goto err3;
-		}
-	}
-
-	r = buf_used;
-
-err3:
-	dsicm_set_max_rx_packet_size(dssdev, 1);
-err2:
-	src->ops->dsi.bus_unlock(src);
-err1:
-	mutex_unlock(&ddata->lock);
-	return r;
-}
-
 static void dsicm_ulps_work(struct work_struct *work)
 {
 	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
@@ -1094,8 +1003,6 @@ static const struct omap_dss_driver dsicm_dss_driver = {
 
 	.enable_te	= dsicm_enable_te,
 	.get_te		= dsicm_get_te,
-
-	.memory_read	= dsicm_memory_read,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 78041ef922cc..e67928373560 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -389,10 +389,6 @@ struct omap_dss_driver {
 
 	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
 	int (*get_te)(struct omap_dss_device *dssdev);
-
-	int (*memory_read)(struct omap_dss_device *dssdev,
-			void *buf, size_t size,
-			u16 x, u16 y, u16 w, u16 h);
 };
 
 struct dss_device *omapdss_get_dss(void);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 19/56] drm/omap: dsi: drop unused get_te()
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The get_te() callback is not used, so we can drop the
custom API.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 13 -------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h           |  1 -
 2 files changed, 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index dd9112ca76ba..92ac90035fec 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -919,18 +919,6 @@ static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
 	return r;
 }
 
-static int dsicm_get_te(struct omap_dss_device *dssdev)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	int r;
-
-	mutex_lock(&ddata->lock);
-	r = ddata->te_enabled;
-	mutex_unlock(&ddata->lock);
-
-	return r;
-}
-
 static void dsicm_ulps_work(struct work_struct *work)
 {
 	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
@@ -1002,7 +990,6 @@ static const struct omap_dss_driver dsicm_dss_driver = {
 	.sync		= dsicm_sync,
 
 	.enable_te	= dsicm_enable_te,
-	.get_te		= dsicm_get_te,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index e67928373560..aa307f5ab9cf 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -388,7 +388,6 @@ struct omap_dss_driver {
 	int (*sync)(struct omap_dss_device *dssdev);
 
 	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
-	int (*get_te)(struct omap_dss_device *dssdev);
 };
 
 struct dss_device *omapdss_get_dss(void);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 19/56] drm/omap: dsi: drop unused get_te()
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The get_te() callback is not used, so we can drop the
custom API.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 13 -------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h           |  1 -
 2 files changed, 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index dd9112ca76ba..92ac90035fec 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -919,18 +919,6 @@ static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
 	return r;
 }
 
-static int dsicm_get_te(struct omap_dss_device *dssdev)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	int r;
-
-	mutex_lock(&ddata->lock);
-	r = ddata->te_enabled;
-	mutex_unlock(&ddata->lock);
-
-	return r;
-}
-
 static void dsicm_ulps_work(struct work_struct *work)
 {
 	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
@@ -1002,7 +990,6 @@ static const struct omap_dss_driver dsicm_dss_driver = {
 	.sync		= dsicm_sync,
 
 	.enable_te	= dsicm_enable_te,
-	.get_te		= dsicm_get_te,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index e67928373560..aa307f5ab9cf 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -388,7 +388,6 @@ struct omap_dss_driver {
 	int (*sync)(struct omap_dss_device *dssdev);
 
 	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
-	int (*get_te)(struct omap_dss_device *dssdev);
 };
 
 struct dss_device *omapdss_get_dss(void);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 20/56] drm/omap: dsi: drop unused enable_te()
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

enable_te() is not used, so the custom API can be dropped.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 39 -------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  2 -
 2 files changed, 41 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 92ac90035fec..f59775cabe2d 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -882,43 +882,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 	return r;
 }
 
-static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
-	int r;
-
-	mutex_lock(&ddata->lock);
-
-	if (ddata->te_enabled == enable)
-		goto end;
-
-	src->ops->dsi.bus_lock(src);
-
-	if (ddata->enabled) {
-		r = dsicm_wake_up(ddata);
-		if (r)
-			goto err;
-
-		r = _dsicm_enable_te(ddata, enable);
-		if (r)
-			goto err;
-	}
-
-	ddata->te_enabled = enable;
-
-	src->ops->dsi.bus_unlock(src);
-end:
-	mutex_unlock(&ddata->lock);
-
-	return 0;
-err:
-	src->ops->dsi.bus_unlock(src);
-	mutex_unlock(&ddata->lock);
-
-	return r;
-}
-
 static void dsicm_ulps_work(struct work_struct *work)
 {
 	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
@@ -988,8 +951,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
 static const struct omap_dss_driver dsicm_dss_driver = {
 	.update		= dsicm_update,
 	.sync		= dsicm_sync,
-
-	.enable_te	= dsicm_enable_te,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index aa307f5ab9cf..55d5bca59f81 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -386,8 +386,6 @@ struct omap_dss_driver {
 	int (*update)(struct omap_dss_device *dssdev,
 			       u16 x, u16 y, u16 w, u16 h);
 	int (*sync)(struct omap_dss_device *dssdev);
-
-	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
 };
 
 struct dss_device *omapdss_get_dss(void);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 20/56] drm/omap: dsi: drop unused enable_te()
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

enable_te() is not used, so the custom API can be dropped.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 39 -------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  2 -
 2 files changed, 41 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 92ac90035fec..f59775cabe2d 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -882,43 +882,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 	return r;
 }
 
-static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
-	int r;
-
-	mutex_lock(&ddata->lock);
-
-	if (ddata->te_enabled == enable)
-		goto end;
-
-	src->ops->dsi.bus_lock(src);
-
-	if (ddata->enabled) {
-		r = dsicm_wake_up(ddata);
-		if (r)
-			goto err;
-
-		r = _dsicm_enable_te(ddata, enable);
-		if (r)
-			goto err;
-	}
-
-	ddata->te_enabled = enable;
-
-	src->ops->dsi.bus_unlock(src);
-end:
-	mutex_unlock(&ddata->lock);
-
-	return 0;
-err:
-	src->ops->dsi.bus_unlock(src);
-	mutex_unlock(&ddata->lock);
-
-	return r;
-}
-
 static void dsicm_ulps_work(struct work_struct *work)
 {
 	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
@@ -988,8 +951,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
 static const struct omap_dss_driver dsicm_dss_driver = {
 	.update		= dsicm_update,
 	.sync		= dsicm_sync,
-
-	.enable_te	= dsicm_enable_te,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index aa307f5ab9cf..55d5bca59f81 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -386,8 +386,6 @@ struct omap_dss_driver {
 	int (*update)(struct omap_dss_device *dssdev,
 			       u16 x, u16 y, u16 w, u16 h);
 	int (*sync)(struct omap_dss_device *dssdev);
-
-	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
 };
 
 struct dss_device *omapdss_get_dss(void);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 21/56] drm/omap: dsi: drop useless sync()
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The DSI sync() function only locks the bus and then releases
it again. Currently the only invocation is directly before
update(), which locks the bus anyways.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c    | 18 ------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h          |  1 -
 drivers/gpu/drm/omapdrm/omap_crtc.c            |  3 ---
 3 files changed, 22 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index f59775cabe2d..a9609eed6bfa 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -845,23 +845,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 	return r;
 }
 
-static int dsicm_sync(struct omap_dss_device *dssdev)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
-
-	dev_dbg(&ddata->dsi->dev, "sync\n");
-
-	mutex_lock(&ddata->lock);
-	src->ops->dsi.bus_lock(src);
-	src->ops->dsi.bus_unlock(src);
-	mutex_unlock(&ddata->lock);
-
-	dev_dbg(&ddata->dsi->dev, "sync done\n");
-
-	return 0;
-}
-
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
 	struct omap_dss_device *src = ddata->src;
@@ -950,7 +933,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
 
 static const struct omap_dss_driver dsicm_dss_driver = {
 	.update		= dsicm_update,
-	.sync		= dsicm_sync,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 55d5bca59f81..9bbd2c0f3187 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -385,7 +385,6 @@ struct omap_dss_device {
 struct omap_dss_driver {
 	int (*update)(struct omap_dss_device *dssdev,
 			       u16 x, u16 y, u16 w, u16 h);
-	int (*sync)(struct omap_dss_device *dssdev);
 };
 
 struct dss_device *omapdss_get_dss(void);
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 328a4a74f534..dac9ccda98df 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -379,9 +379,6 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
 		return;
 	}
 
-	if (dssdrv->sync)
-		dssdrv->sync(dssdev);
-
 	ret = dssdrv->update(dssdev, 0, 0, mode->hdisplay, mode->vdisplay);
 	if (ret < 0) {
 		spin_lock_irq(&dev->event_lock);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 21/56] drm/omap: dsi: drop useless sync()
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The DSI sync() function only locks the bus and then releases
it again. Currently the only invocation is directly before
update(), which locks the bus anyways.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c    | 18 ------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h          |  1 -
 drivers/gpu/drm/omapdrm/omap_crtc.c            |  3 ---
 3 files changed, 22 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index f59775cabe2d..a9609eed6bfa 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -845,23 +845,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 	return r;
 }
 
-static int dsicm_sync(struct omap_dss_device *dssdev)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
-
-	dev_dbg(&ddata->dsi->dev, "sync\n");
-
-	mutex_lock(&ddata->lock);
-	src->ops->dsi.bus_lock(src);
-	src->ops->dsi.bus_unlock(src);
-	mutex_unlock(&ddata->lock);
-
-	dev_dbg(&ddata->dsi->dev, "sync done\n");
-
-	return 0;
-}
-
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
 	struct omap_dss_device *src = ddata->src;
@@ -950,7 +933,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
 
 static const struct omap_dss_driver dsicm_dss_driver = {
 	.update		= dsicm_update,
-	.sync		= dsicm_sync,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 55d5bca59f81..9bbd2c0f3187 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -385,7 +385,6 @@ struct omap_dss_device {
 struct omap_dss_driver {
 	int (*update)(struct omap_dss_device *dssdev,
 			       u16 x, u16 y, u16 w, u16 h);
-	int (*sync)(struct omap_dss_device *dssdev);
 };
 
 struct dss_device *omapdss_get_dss(void);
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 328a4a74f534..dac9ccda98df 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -379,9 +379,6 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
 		return;
 	}
 
-	if (dssdrv->sync)
-		dssdrv->sync(dssdev);
-
 	ret = dssdrv->update(dssdev, 0, 0, mode->hdisplay, mode->vdisplay);
 	if (ret < 0) {
 		spin_lock_irq(&dev->event_lock);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 22/56] drm/omap: dsi: use pixel-format and mode from attach
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:02   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

In order to reduce the amount of custom functionality, this moves
handling of pixel format and DSI mode from set_config() to dsi
attach.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 --
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 31 ++++++++++++-------
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index a9609eed6bfa..2e9de33fc8d4 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -550,8 +550,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	u8 id1, id2, id3;
 	int r;
 	struct omap_dss_dsi_config dsi_config = {
-		.mode = OMAP_DSS_DSI_CMD_MODE,
-		.pixel_format = MIPI_DSI_FMT_RGB888,
 		.vm = &ddata->vm,
 		.hs_clk_min = 150000000,
 		.hs_clk_max = 300000000,
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index a16427f3bc23..e341aca92462 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4579,24 +4579,19 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 	struct dsi_clk_calc_ctx ctx;
+	struct omap_dss_dsi_config cfg = *config;
 	bool ok;
 	int r;
 
 	mutex_lock(&dsi->lock);
 
-	dsi->pix_fmt = config->pixel_format;
-	dsi->mode = config->mode;
+	cfg.mode = dsi->mode;
+	cfg.pixel_format = dsi->pix_fmt;
 
-	if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) {
-		DSSERR("invalid pixel format\n");
-		r = -EINVAL;
-		goto err;
-	}
-
-	if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
-		ok = dsi_vm_calc(dsi, config, &ctx);
+	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
+		ok = dsi_vm_calc(dsi, &cfg, &ctx);
 	else
-		ok = dsi_cm_calc(dsi, config, &ctx);
+		ok = dsi_cm_calc(dsi, &cfg, &ctx);
 
 	if (!ok) {
 		DSSERR("failed to find suitable DSI clock settings\n");
@@ -4607,7 +4602,7 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
 	dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
 
 	r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
-		config->lp_clk_min, config->lp_clk_max, &dsi->user_lp_cinfo);
+		cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
 	if (r) {
 		DSSERR("failed to find suitable DSI LP clock settings\n");
 		goto err;
@@ -4785,7 +4780,19 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 		return -EBUSY;
 	}
 
+	if (mipi_dsi_pixel_format_to_bpp(client->format) < 0) {
+		DSSERR("invalid pixel format\n");
+		return -EINVAL;
+	}
+
 	dsi->vc[channel].dest = client;
+
+	dsi->pix_fmt = client->format;
+	if (client->mode_flags & MIPI_DSI_MODE_VIDEO)
+		dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
+	else
+		dsi->mode = OMAP_DSS_DSI_CMD_MODE;
+
 	return 0;
 }
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 22/56] drm/omap: dsi: use pixel-format and mode from attach
@ 2020-11-05 12:02   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:02 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

In order to reduce the amount of custom functionality, this moves
handling of pixel format and DSI mode from set_config() to dsi
attach.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 --
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 31 ++++++++++++-------
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index a9609eed6bfa..2e9de33fc8d4 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -550,8 +550,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	u8 id1, id2, id3;
 	int r;
 	struct omap_dss_dsi_config dsi_config = {
-		.mode = OMAP_DSS_DSI_CMD_MODE,
-		.pixel_format = MIPI_DSI_FMT_RGB888,
 		.vm = &ddata->vm,
 		.hs_clk_min = 150000000,
 		.hs_clk_max = 300000000,
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index a16427f3bc23..e341aca92462 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4579,24 +4579,19 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 	struct dsi_clk_calc_ctx ctx;
+	struct omap_dss_dsi_config cfg = *config;
 	bool ok;
 	int r;
 
 	mutex_lock(&dsi->lock);
 
-	dsi->pix_fmt = config->pixel_format;
-	dsi->mode = config->mode;
+	cfg.mode = dsi->mode;
+	cfg.pixel_format = dsi->pix_fmt;
 
-	if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) {
-		DSSERR("invalid pixel format\n");
-		r = -EINVAL;
-		goto err;
-	}
-
-	if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
-		ok = dsi_vm_calc(dsi, config, &ctx);
+	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
+		ok = dsi_vm_calc(dsi, &cfg, &ctx);
 	else
-		ok = dsi_cm_calc(dsi, config, &ctx);
+		ok = dsi_cm_calc(dsi, &cfg, &ctx);
 
 	if (!ok) {
 		DSSERR("failed to find suitable DSI clock settings\n");
@@ -4607,7 +4602,7 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
 	dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
 
 	r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
-		config->lp_clk_min, config->lp_clk_max, &dsi->user_lp_cinfo);
+		cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
 	if (r) {
 		DSSERR("failed to find suitable DSI LP clock settings\n");
 		goto err;
@@ -4785,7 +4780,19 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 		return -EBUSY;
 	}
 
+	if (mipi_dsi_pixel_format_to_bpp(client->format) < 0) {
+		DSSERR("invalid pixel format\n");
+		return -EINVAL;
+	}
+
 	dsi->vc[channel].dest = client;
+
+	dsi->pix_fmt = client->format;
+	if (client->mode_flags & MIPI_DSI_MODE_VIDEO)
+		dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
+	else
+		dsi->mode = OMAP_DSS_DSI_CMD_MODE;
+
 	return 0;
 }
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 23/56] drm/omap: panel-dsi-cm: use bulk regulator API
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Use bulk regulator API to simplify the code. This also switches
from _optional variant to normal variant, which will provide a
dummy regulator (i.e. if some always-enabled regulator is not
described in DT).

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 65 ++++++-------------
 1 file changed, 21 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 2e9de33fc8d4..1e742cf798b6 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -32,6 +32,8 @@
 #define DCS_GET_ID2		0xdb
 #define DCS_GET_ID3		0xdc
 
+#define DCS_REGULATOR_SUPPLY_NUM 2
+
 struct panel_drv_data {
 	struct mipi_dsi_device *dsi;
 
@@ -54,8 +56,7 @@ struct panel_drv_data {
 	struct gpio_desc *reset_gpio;
 	struct gpio_desc *ext_te_gpio;
 
-	struct regulator *vpnl;
-	struct regulator *vddi;
+	struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
 
 	bool use_dsi_backlight;
 
@@ -557,28 +558,16 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 		.lp_clk_max = 10000000,
 	};
 
-	if (ddata->vpnl) {
-		r = regulator_enable(ddata->vpnl);
-		if (r) {
-			dev_err(&ddata->dsi->dev,
-				"failed to enable VPNL: %d\n", r);
-			return r;
-		}
-	}
-
-	if (ddata->vddi) {
-		r = regulator_enable(ddata->vddi);
-		if (r) {
-			dev_err(&ddata->dsi->dev,
-				"failed to enable VDDI: %d\n", r);
-			goto err_vpnl;
-		}
+	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+	if (r) {
+		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
+		return r;
 	}
 
 	r = src->ops->dsi.set_config(src, &dsi_config);
 	if (r) {
 		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
-		goto err_vddi;
+		goto err_regulators;
 	}
 
 	src->ops->enable(src);
@@ -637,12 +626,10 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	dsicm_hw_reset(ddata);
 
 	src->ops->dsi.disable(src, true, false);
-err_vddi:
-	if (ddata->vddi)
-		regulator_disable(ddata->vddi);
-err_vpnl:
-	if (ddata->vpnl)
-		regulator_disable(ddata->vpnl);
+err_regulators:
+	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+	if (r)
+		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
 
 	return r;
 }
@@ -666,10 +653,9 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 
 	src->ops->dsi.disable(src, true, false);
 
-	if (ddata->vddi)
-		regulator_disable(ddata->vddi);
-	if (ddata->vpnl)
-		regulator_disable(ddata->vpnl);
+	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+	if (r)
+		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
 
 	ddata->enabled = false;
 }
@@ -973,21 +959,12 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 	ddata->height_mm = 0;
 	of_property_read_u32(node, "height-mm", &ddata->height_mm);
 
-	ddata->vpnl = devm_regulator_get_optional(&dsi->dev, "vpnl");
-	if (IS_ERR(ddata->vpnl)) {
-		err = PTR_ERR(ddata->vpnl);
-		if (err == -EPROBE_DEFER)
-			return err;
-		ddata->vpnl = NULL;
-	}
-
-	ddata->vddi = devm_regulator_get_optional(&dsi->dev, "vddi");
-	if (IS_ERR(ddata->vddi)) {
-		err = PTR_ERR(ddata->vddi);
-		if (err == -EPROBE_DEFER)
-			return err;
-		ddata->vddi = NULL;
-	}
+	ddata->supplies[0].supply = "vpnl";
+	ddata->supplies[1].supply = "vddi";
+	err = devm_regulator_bulk_get(&dsi->dev, DCS_REGULATOR_SUPPLY_NUM,
+				      ddata->supplies);
+	if (err)
+		return err;
 
 	backlight = devm_of_find_backlight(&dsi->dev);
 	if (IS_ERR(backlight))
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 23/56] drm/omap: panel-dsi-cm: use bulk regulator API
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Use bulk regulator API to simplify the code. This also switches
from _optional variant to normal variant, which will provide a
dummy regulator (i.e. if some always-enabled regulator is not
described in DT).

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 65 ++++++-------------
 1 file changed, 21 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 2e9de33fc8d4..1e742cf798b6 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -32,6 +32,8 @@
 #define DCS_GET_ID2		0xdb
 #define DCS_GET_ID3		0xdc
 
+#define DCS_REGULATOR_SUPPLY_NUM 2
+
 struct panel_drv_data {
 	struct mipi_dsi_device *dsi;
 
@@ -54,8 +56,7 @@ struct panel_drv_data {
 	struct gpio_desc *reset_gpio;
 	struct gpio_desc *ext_te_gpio;
 
-	struct regulator *vpnl;
-	struct regulator *vddi;
+	struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
 
 	bool use_dsi_backlight;
 
@@ -557,28 +558,16 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 		.lp_clk_max = 10000000,
 	};
 
-	if (ddata->vpnl) {
-		r = regulator_enable(ddata->vpnl);
-		if (r) {
-			dev_err(&ddata->dsi->dev,
-				"failed to enable VPNL: %d\n", r);
-			return r;
-		}
-	}
-
-	if (ddata->vddi) {
-		r = regulator_enable(ddata->vddi);
-		if (r) {
-			dev_err(&ddata->dsi->dev,
-				"failed to enable VDDI: %d\n", r);
-			goto err_vpnl;
-		}
+	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+	if (r) {
+		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
+		return r;
 	}
 
 	r = src->ops->dsi.set_config(src, &dsi_config);
 	if (r) {
 		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
-		goto err_vddi;
+		goto err_regulators;
 	}
 
 	src->ops->enable(src);
@@ -637,12 +626,10 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	dsicm_hw_reset(ddata);
 
 	src->ops->dsi.disable(src, true, false);
-err_vddi:
-	if (ddata->vddi)
-		regulator_disable(ddata->vddi);
-err_vpnl:
-	if (ddata->vpnl)
-		regulator_disable(ddata->vpnl);
+err_regulators:
+	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+	if (r)
+		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
 
 	return r;
 }
@@ -666,10 +653,9 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 
 	src->ops->dsi.disable(src, true, false);
 
-	if (ddata->vddi)
-		regulator_disable(ddata->vddi);
-	if (ddata->vpnl)
-		regulator_disable(ddata->vpnl);
+	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+	if (r)
+		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
 
 	ddata->enabled = false;
 }
@@ -973,21 +959,12 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 	ddata->height_mm = 0;
 	of_property_read_u32(node, "height-mm", &ddata->height_mm);
 
-	ddata->vpnl = devm_regulator_get_optional(&dsi->dev, "vpnl");
-	if (IS_ERR(ddata->vpnl)) {
-		err = PTR_ERR(ddata->vpnl);
-		if (err == -EPROBE_DEFER)
-			return err;
-		ddata->vpnl = NULL;
-	}
-
-	ddata->vddi = devm_regulator_get_optional(&dsi->dev, "vddi");
-	if (IS_ERR(ddata->vddi)) {
-		err = PTR_ERR(ddata->vddi);
-		if (err == -EPROBE_DEFER)
-			return err;
-		ddata->vddi = NULL;
-	}
+	ddata->supplies[0].supply = "vpnl";
+	ddata->supplies[1].supply = "vddi";
+	err = devm_regulator_bulk_get(&dsi->dev, DCS_REGULATOR_SUPPLY_NUM,
+				      ddata->supplies);
+	if (err)
+		return err;
 
 	backlight = devm_of_find_backlight(&dsi->dev);
 	if (IS_ERR(backlight))
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 24/56] drm/omap: dsi: lp/hs switching support for transfer()
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Integrate low-power / high-speed bus switching into transfer
function and drop the omapdrm specific enable_hs() callback.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  6 +++---
 drivers/gpu/drm/omapdrm/dss/dsi.c               | 10 ++++++++--
 drivers/gpu/drm/omapdrm/dss/omapdss.h           |  2 --
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 1e742cf798b6..8890ee2ba830 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -269,7 +269,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 		return 0;
 
 	src->ops->enable(src);
-	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
+	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
 	r = _dsicm_enable_te(ddata, true);
 	if (r) {
@@ -574,7 +574,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
 	dsicm_hw_reset(ddata);
 
-	src->ops->dsi.enable_hs(src, ddata->dsi->channel, false);
+	ddata->dsi->mode_flags |= MIPI_DSI_MODE_LPM;
 
 	r = dsicm_sleep_out(ddata);
 	if (r)
@@ -617,7 +617,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 		ddata->intro_printed = true;
 	}
 
-	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
+	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
 	return 0;
 err:
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index e341aca92462..003d26cead5a 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -329,6 +329,7 @@ struct dsi_data {
 	int irq;
 
 	bool is_enabled;
+	bool in_lp_mode;
 
 	struct clk *dss_clk;
 	struct regmap *syscon;
@@ -2431,6 +2432,8 @@ static void dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
 	/* start the DDR clock by sending a NULL packet */
 	if (dsi->vm_timings.ddr_clk_always_on && enable)
 		dsi_vc_send_null(dsi, channel);
+
+	dsi->in_lp_mode = !enable;
 }
 
 static void dsi_vc_flush_long_data(struct dsi_data *dsi, int channel)
@@ -4693,6 +4696,11 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 	struct dsi_data *dsi = host_to_omap(host);
 	struct omap_dss_device *dssdev = &dsi->output;
 
+	if (!!(msg->flags & MIPI_DSI_MSG_USE_LPM) != dsi->in_lp_mode) {
+		dsi_vc_enable_hs(dssdev, msg->channel,
+				 !(msg->flags & MIPI_DSI_MSG_USE_LPM));
+	}
+
 	switch (msg->type) {
 	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
 	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
@@ -4753,8 +4761,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 
 		.disable = dsi_display_disable,
 
-		.enable_hs = dsi_vc_enable_hs,
-
 		.set_config = dsi_set_config,
 
 		.enable_video_output = dsi_enable_video_output,
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 9bbd2c0f3187..2d44a8e32fcc 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -288,8 +288,6 @@ struct omapdss_dsi_ops {
 	int (*set_config)(struct omap_dss_device *dssdev,
 			const struct omap_dss_dsi_config *cfg);
 
-	void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
-			bool enable);
 	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
 
 	int (*update)(struct omap_dss_device *dssdev, int channel,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 24/56] drm/omap: dsi: lp/hs switching support for transfer()
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Integrate low-power / high-speed bus switching into transfer
function and drop the omapdrm specific enable_hs() callback.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  6 +++---
 drivers/gpu/drm/omapdrm/dss/dsi.c               | 10 ++++++++--
 drivers/gpu/drm/omapdrm/dss/omapdss.h           |  2 --
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 1e742cf798b6..8890ee2ba830 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -269,7 +269,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 		return 0;
 
 	src->ops->enable(src);
-	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
+	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
 	r = _dsicm_enable_te(ddata, true);
 	if (r) {
@@ -574,7 +574,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
 	dsicm_hw_reset(ddata);
 
-	src->ops->dsi.enable_hs(src, ddata->dsi->channel, false);
+	ddata->dsi->mode_flags |= MIPI_DSI_MODE_LPM;
 
 	r = dsicm_sleep_out(ddata);
 	if (r)
@@ -617,7 +617,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 		ddata->intro_printed = true;
 	}
 
-	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
+	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
 	return 0;
 err:
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index e341aca92462..003d26cead5a 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -329,6 +329,7 @@ struct dsi_data {
 	int irq;
 
 	bool is_enabled;
+	bool in_lp_mode;
 
 	struct clk *dss_clk;
 	struct regmap *syscon;
@@ -2431,6 +2432,8 @@ static void dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
 	/* start the DDR clock by sending a NULL packet */
 	if (dsi->vm_timings.ddr_clk_always_on && enable)
 		dsi_vc_send_null(dsi, channel);
+
+	dsi->in_lp_mode = !enable;
 }
 
 static void dsi_vc_flush_long_data(struct dsi_data *dsi, int channel)
@@ -4693,6 +4696,11 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 	struct dsi_data *dsi = host_to_omap(host);
 	struct omap_dss_device *dssdev = &dsi->output;
 
+	if (!!(msg->flags & MIPI_DSI_MSG_USE_LPM) != dsi->in_lp_mode) {
+		dsi_vc_enable_hs(dssdev, msg->channel,
+				 !(msg->flags & MIPI_DSI_MSG_USE_LPM));
+	}
+
 	switch (msg->type) {
 	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
 	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
@@ -4753,8 +4761,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 
 		.disable = dsi_display_disable,
 
-		.enable_hs = dsi_vc_enable_hs,
-
 		.set_config = dsi_set_config,
 
 		.enable_video_output = dsi_enable_video_output,
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 9bbd2c0f3187..2d44a8e32fcc 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -288,8 +288,6 @@ struct omapdss_dsi_ops {
 	int (*set_config)(struct omap_dss_device *dssdev,
 			const struct omap_dss_dsi_config *cfg);
 
-	void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
-			bool enable);
 	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
 
 	int (*update)(struct omap_dss_device *dssdev, int channel,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 25/56] drm/omap: dsi: move TE GPIO handling into core
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

In preparation for removing custom DSS calls from the DSI
panel driver, this moves support for external tearing event
GPIOs into the DSI host driver. This way tearing events are
always handled in the core resulting in simplification of
the panel drivers.

The TE GPIO acquisition follows works in the same way as the
exynos DSI implementation.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 101 +------------
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 138 ++++++++++++++++--
 2 files changed, 133 insertions(+), 106 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 8890ee2ba830..43f63b5a120b 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -54,7 +54,6 @@ struct panel_drv_data {
 
 	/* panel HW configuration from DT or platform data */
 	struct gpio_desc *reset_gpio;
-	struct gpio_desc *ext_te_gpio;
 
 	struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
 
@@ -68,10 +67,6 @@ struct panel_drv_data {
 
 	bool te_enabled;
 
-	atomic_t do_update;
-
-	struct delayed_work te_timeout_work;
-
 	bool intro_printed;
 
 	struct workqueue_struct *workqueue;
@@ -83,8 +78,6 @@ struct panel_drv_data {
 
 #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
 
-static irqreturn_t dsicm_te_isr(int irq, void *data);
-static void dsicm_te_timeout_work_callback(struct work_struct *work);
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
 
 static int dsicm_panel_reset(struct panel_drv_data *ddata);
@@ -240,9 +233,6 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
 	if (r)
 		goto err;
 
-	if (ddata->ext_te_gpio)
-		disable_irq(gpiod_to_irq(ddata->ext_te_gpio));
-
 	src->ops->dsi.disable(src, false, true);
 
 	ddata->ulps_enabled = true;
@@ -271,15 +261,12 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 	src->ops->enable(src);
 	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
-	r = _dsicm_enable_te(ddata, true);
+	r = _dsicm_enable_te(ddata, ddata->te_enabled);
 	if (r) {
 		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
 		goto err2;
 	}
 
-	if (ddata->ext_te_gpio)
-		enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
-
 	dsicm_queue_ulps_work(ddata);
 
 	ddata->ulps_enabled = false;
@@ -290,11 +277,8 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
 
 	r = dsicm_panel_reset(ddata);
-	if (!r) {
-		if (ddata->ext_te_gpio)
-			enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
+	if (!r)
 		ddata->ulps_enabled = false;
-	}
 
 	dsicm_queue_ulps_work(ddata);
 
@@ -745,43 +729,6 @@ static void dsicm_framedone_cb(int err, void *data)
 	src->ops->dsi.bus_unlock(src);
 }
 
-static irqreturn_t dsicm_te_isr(int irq, void *data)
-{
-	struct panel_drv_data *ddata = data;
-	struct omap_dss_device *src = ddata->src;
-	int old;
-	int r;
-
-	old = atomic_cmpxchg(&ddata->do_update, 1, 0);
-
-	if (old) {
-		cancel_delayed_work(&ddata->te_timeout_work);
-
-		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
-				ddata);
-		if (r)
-			goto err;
-	}
-
-	return IRQ_HANDLED;
-err:
-	dev_err(&ddata->dsi->dev, "start update failed\n");
-	src->ops->dsi.bus_unlock(src);
-	return IRQ_HANDLED;
-}
-
-static void dsicm_te_timeout_work_callback(struct work_struct *work)
-{
-	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
-					te_timeout_work.work);
-	struct omap_dss_device *src = ddata->src;
-
-	dev_err(&ddata->dsi->dev, "TE not received for 250ms!\n");
-
-	atomic_set(&ddata->do_update, 0);
-	src->ops->dsi.bus_unlock(src);
-}
-
 static int dsicm_update(struct omap_dss_device *dssdev,
 				    u16 x, u16 y, u16 w, u16 h)
 {
@@ -809,16 +756,10 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 	if (r)
 		goto err;
 
-	if (ddata->te_enabled && ddata->ext_te_gpio) {
-		schedule_delayed_work(&ddata->te_timeout_work,
-				msecs_to_jiffies(250));
-		atomic_set(&ddata->do_update, 1);
-	} else {
-		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
-				ddata);
-		if (r)
-			goto err;
-	}
+	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
+			ddata);
+	if (r)
+		goto err;
 
 	/* note: no bus_unlock here. unlock is src framedone_cb */
 	mutex_unlock(&ddata->lock);
@@ -840,8 +781,7 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 	else
 		r = mipi_dsi_dcs_set_tear_off(dsi);
 
-	if (!ddata->ext_te_gpio)
-		src->ops->dsi.enable_te(src, enable);
+	src->ops->dsi.enable_te(src, enable);
 
 	/* possible panel bug */
 	msleep(100);
@@ -934,14 +874,6 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 		return err;
 	}
 
-	ddata->ext_te_gpio = devm_gpiod_get_optional(&dsi->dev, "te",
-						     GPIOD_IN);
-	if (IS_ERR(ddata->ext_te_gpio)) {
-		err = PTR_ERR(ddata->ext_te_gpio);
-		dev_err(&dsi->dev, "TE gpio request failed: %d", err);
-		return err;
-	}
-
 	err = of_get_display_timing(node, "panel-timing", &timing);
 	if (!err) {
 		videomode_from_timing(&timing, &ddata->vm);
@@ -1024,25 +956,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 
 	mutex_init(&ddata->lock);
 
-	atomic_set(&ddata->do_update, 0);
-
-	if (ddata->ext_te_gpio) {
-		r = devm_request_irq(dev, gpiod_to_irq(ddata->ext_te_gpio),
-				dsicm_te_isr,
-				IRQF_TRIGGER_RISING,
-				"taal vsync", ddata);
-
-		if (r) {
-			dev_err(dev, "IRQ request failed\n");
-			goto err_reg;
-		}
-
-		INIT_DEFERRABLE_WORK(&ddata->te_timeout_work,
-					dsicm_te_timeout_work_callback);
-
-		dev_dbg(dev, "Using GPIO TE\n");
-	}
-
 	ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
 	if (!ddata->workqueue) {
 		r = -ENOMEM;
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 003d26cead5a..921e7a1e1014 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -14,7 +14,9 @@
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/mutex.h>
 #include <linux/module.h>
 #include <linux/semaphore.h>
@@ -368,6 +370,11 @@ struct dsi_data {
 	unsigned int update_bytes;
 #endif
 
+	/* external TE GPIO */
+	struct gpio_desc *te_gpio;
+	struct delayed_work te_timeout_work;
+	atomic_t do_ext_te_update;
+
 	bool te_enabled;
 	bool ulps_enabled;
 
@@ -3827,19 +3834,12 @@ static void dsi_framedone_irq_callback(void *data)
 	dsi_handle_framedone(dsi, 0);
 }
 
-static int dsi_update(struct omap_dss_device *dssdev, int channel,
-		void (*callback)(int, void *), void *data)
+static int _dsi_update(struct dsi_data *dsi)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
 	u16 dw, dh;
 
 	dsi_perf_mark_setup(dsi);
 
-	dsi->update_channel = channel;
-
-	dsi->framedone_callback = callback;
-	dsi->framedone_data = data;
-
 	dw = dsi->vm.hactive;
 	dh = dsi->vm.vactive;
 
@@ -3852,6 +3852,26 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
 	return 0;
 }
 
+static int dsi_update(struct omap_dss_device *dssdev, int channel,
+		void (*callback)(int, void *), void *data)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+
+	dsi->update_channel = channel;
+	dsi->framedone_callback = callback;
+	dsi->framedone_data = data;
+
+	if (dsi->te_enabled && dsi->te_gpio) {
+		schedule_delayed_work(&dsi->te_timeout_work,
+				      msecs_to_jiffies(250));
+		atomic_set(&dsi->do_ext_te_update, 1);
+	} else {
+		_dsi_update(dsi);
+	}
+
+	return 0;
+}
+
 /* Display funcs */
 
 static int dsi_configure_dispc_clocks(struct dsi_data *dsi)
@@ -4095,6 +4115,14 @@ static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 
 	dsi->te_enabled = enable;
+
+	if (dsi->te_gpio) {
+		if (enable)
+			enable_irq(gpiod_to_irq(dsi->te_gpio));
+		else
+			disable_irq(gpiod_to_irq(dsi->te_gpio));
+	}
+
 	return 0;
 }
 
@@ -4772,11 +4800,89 @@ static const struct omap_dss_device_ops dsi_ops = {
 	},
 };
 
+static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
+{
+	struct dsi_data *dsi = (struct dsi_data *)dev_id;
+	int old;
+
+	old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
+	if (old) {
+		cancel_delayed_work(&dsi->te_timeout_work);
+		_dsi_update(dsi);
+	}
+
+	return IRQ_HANDLED;
+}
+
+static void omap_dsi_te_timeout_work_callback(struct work_struct *work)
+{
+	struct dsi_data *dsi = container_of(work, struct dsi_data,
+					te_timeout_work.work);
+	int old;
+
+	old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
+	if (old) {
+		dev_err(dsi->dev, "TE not received for 250ms!\n");
+		_dsi_update(dsi);
+	}
+}
+
+static int omap_dsi_register_te_irq(struct dsi_data *dsi,
+				    struct mipi_dsi_device *client)
+{
+	int err;
+	int te_irq;
+
+	dsi->te_gpio = gpiod_get_from_of_node(client->dev.of_node,
+					      "te-gpios", 0, GPIOD_IN,
+					      "dsi-tearing-effect");
+	if (IS_ERR(dsi->te_gpio)) {
+		err = PTR_ERR(dsi->te_gpio);
+
+		if (err == -ENOENT) {
+			dsi->te_gpio = NULL;
+			return 0;
+		}
+
+		dev_err(dsi->dev, "Could not get TE gpio: %d\n", err);
+		return err;
+	}
+
+	te_irq = gpiod_to_irq(dsi->te_gpio);
+	irq_set_status_flags(te_irq, IRQ_NOAUTOEN);
+
+	err = request_threaded_irq(te_irq, omap_dsi_te_irq_handler, NULL,
+				   IRQF_TRIGGER_RISING, "TE", dsi);
+	if (err) {
+		dev_err(dsi->dev, "request irq failed with %d\n", err);
+		gpiod_put(dsi->te_gpio);
+		return err;
+	}
+
+	INIT_DEFERRABLE_WORK(&dsi->te_timeout_work,
+			     omap_dsi_te_timeout_work_callback);
+
+	dev_dbg(dsi->dev, "Using GPIO TE\n");
+
+	return 0;
+}
+
+static void omap_dsi_unregister_te_irq(struct dsi_data *dsi)
+{
+	if (dsi->te_gpio) {
+		free_irq(gpiod_to_irq(dsi->te_gpio), dsi);
+		cancel_delayed_work(&dsi->te_timeout_work);
+		gpiod_put(dsi->te_gpio);
+		dsi->te_gpio = NULL;
+	}
+}
+
 static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 				struct mipi_dsi_device *client)
 {
 	struct dsi_data *dsi = host_to_omap(host);
 	unsigned int channel = client->channel;
+	int r;
 
 	if (channel > 3)
 		return -EINVAL;
@@ -4791,13 +4897,20 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 		return -EINVAL;
 	}
 
-	dsi->vc[channel].dest = client;
+	atomic_set(&dsi->do_ext_te_update, 0);
 
-	dsi->pix_fmt = client->format;
-	if (client->mode_flags & MIPI_DSI_MODE_VIDEO)
+	if (client->mode_flags & MIPI_DSI_MODE_VIDEO) {
 		dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
-	else
+	} else {
+		r = omap_dsi_register_te_irq(dsi, client);
+		if (r)
+			return r;
+
 		dsi->mode = OMAP_DSS_DSI_CMD_MODE;
+	}
+
+	dsi->vc[channel].dest = client;
+	dsi->pix_fmt = client->format;
 
 	return 0;
 }
@@ -4814,6 +4927,7 @@ static int omap_dsi_host_detach(struct mipi_dsi_host *host,
 	if (dsi->vc[channel].dest != client)
 		return -EINVAL;
 
+	omap_dsi_unregister_te_irq(dsi);
 	dsi->vc[channel].dest = NULL;
 	return 0;
 }
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 25/56] drm/omap: dsi: move TE GPIO handling into core
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

In preparation for removing custom DSS calls from the DSI
panel driver, this moves support for external tearing event
GPIOs into the DSI host driver. This way tearing events are
always handled in the core resulting in simplification of
the panel drivers.

The TE GPIO acquisition follows works in the same way as the
exynos DSI implementation.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 101 +------------
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 138 ++++++++++++++++--
 2 files changed, 133 insertions(+), 106 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 8890ee2ba830..43f63b5a120b 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -54,7 +54,6 @@ struct panel_drv_data {
 
 	/* panel HW configuration from DT or platform data */
 	struct gpio_desc *reset_gpio;
-	struct gpio_desc *ext_te_gpio;
 
 	struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
 
@@ -68,10 +67,6 @@ struct panel_drv_data {
 
 	bool te_enabled;
 
-	atomic_t do_update;
-
-	struct delayed_work te_timeout_work;
-
 	bool intro_printed;
 
 	struct workqueue_struct *workqueue;
@@ -83,8 +78,6 @@ struct panel_drv_data {
 
 #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
 
-static irqreturn_t dsicm_te_isr(int irq, void *data);
-static void dsicm_te_timeout_work_callback(struct work_struct *work);
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
 
 static int dsicm_panel_reset(struct panel_drv_data *ddata);
@@ -240,9 +233,6 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
 	if (r)
 		goto err;
 
-	if (ddata->ext_te_gpio)
-		disable_irq(gpiod_to_irq(ddata->ext_te_gpio));
-
 	src->ops->dsi.disable(src, false, true);
 
 	ddata->ulps_enabled = true;
@@ -271,15 +261,12 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 	src->ops->enable(src);
 	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
-	r = _dsicm_enable_te(ddata, true);
+	r = _dsicm_enable_te(ddata, ddata->te_enabled);
 	if (r) {
 		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
 		goto err2;
 	}
 
-	if (ddata->ext_te_gpio)
-		enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
-
 	dsicm_queue_ulps_work(ddata);
 
 	ddata->ulps_enabled = false;
@@ -290,11 +277,8 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
 
 	r = dsicm_panel_reset(ddata);
-	if (!r) {
-		if (ddata->ext_te_gpio)
-			enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
+	if (!r)
 		ddata->ulps_enabled = false;
-	}
 
 	dsicm_queue_ulps_work(ddata);
 
@@ -745,43 +729,6 @@ static void dsicm_framedone_cb(int err, void *data)
 	src->ops->dsi.bus_unlock(src);
 }
 
-static irqreturn_t dsicm_te_isr(int irq, void *data)
-{
-	struct panel_drv_data *ddata = data;
-	struct omap_dss_device *src = ddata->src;
-	int old;
-	int r;
-
-	old = atomic_cmpxchg(&ddata->do_update, 1, 0);
-
-	if (old) {
-		cancel_delayed_work(&ddata->te_timeout_work);
-
-		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
-				ddata);
-		if (r)
-			goto err;
-	}
-
-	return IRQ_HANDLED;
-err:
-	dev_err(&ddata->dsi->dev, "start update failed\n");
-	src->ops->dsi.bus_unlock(src);
-	return IRQ_HANDLED;
-}
-
-static void dsicm_te_timeout_work_callback(struct work_struct *work)
-{
-	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
-					te_timeout_work.work);
-	struct omap_dss_device *src = ddata->src;
-
-	dev_err(&ddata->dsi->dev, "TE not received for 250ms!\n");
-
-	atomic_set(&ddata->do_update, 0);
-	src->ops->dsi.bus_unlock(src);
-}
-
 static int dsicm_update(struct omap_dss_device *dssdev,
 				    u16 x, u16 y, u16 w, u16 h)
 {
@@ -809,16 +756,10 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 	if (r)
 		goto err;
 
-	if (ddata->te_enabled && ddata->ext_te_gpio) {
-		schedule_delayed_work(&ddata->te_timeout_work,
-				msecs_to_jiffies(250));
-		atomic_set(&ddata->do_update, 1);
-	} else {
-		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
-				ddata);
-		if (r)
-			goto err;
-	}
+	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
+			ddata);
+	if (r)
+		goto err;
 
 	/* note: no bus_unlock here. unlock is src framedone_cb */
 	mutex_unlock(&ddata->lock);
@@ -840,8 +781,7 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 	else
 		r = mipi_dsi_dcs_set_tear_off(dsi);
 
-	if (!ddata->ext_te_gpio)
-		src->ops->dsi.enable_te(src, enable);
+	src->ops->dsi.enable_te(src, enable);
 
 	/* possible panel bug */
 	msleep(100);
@@ -934,14 +874,6 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 		return err;
 	}
 
-	ddata->ext_te_gpio = devm_gpiod_get_optional(&dsi->dev, "te",
-						     GPIOD_IN);
-	if (IS_ERR(ddata->ext_te_gpio)) {
-		err = PTR_ERR(ddata->ext_te_gpio);
-		dev_err(&dsi->dev, "TE gpio request failed: %d", err);
-		return err;
-	}
-
 	err = of_get_display_timing(node, "panel-timing", &timing);
 	if (!err) {
 		videomode_from_timing(&timing, &ddata->vm);
@@ -1024,25 +956,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 
 	mutex_init(&ddata->lock);
 
-	atomic_set(&ddata->do_update, 0);
-
-	if (ddata->ext_te_gpio) {
-		r = devm_request_irq(dev, gpiod_to_irq(ddata->ext_te_gpio),
-				dsicm_te_isr,
-				IRQF_TRIGGER_RISING,
-				"taal vsync", ddata);
-
-		if (r) {
-			dev_err(dev, "IRQ request failed\n");
-			goto err_reg;
-		}
-
-		INIT_DEFERRABLE_WORK(&ddata->te_timeout_work,
-					dsicm_te_timeout_work_callback);
-
-		dev_dbg(dev, "Using GPIO TE\n");
-	}
-
 	ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
 	if (!ddata->workqueue) {
 		r = -ENOMEM;
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 003d26cead5a..921e7a1e1014 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -14,7 +14,9 @@
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/mutex.h>
 #include <linux/module.h>
 #include <linux/semaphore.h>
@@ -368,6 +370,11 @@ struct dsi_data {
 	unsigned int update_bytes;
 #endif
 
+	/* external TE GPIO */
+	struct gpio_desc *te_gpio;
+	struct delayed_work te_timeout_work;
+	atomic_t do_ext_te_update;
+
 	bool te_enabled;
 	bool ulps_enabled;
 
@@ -3827,19 +3834,12 @@ static void dsi_framedone_irq_callback(void *data)
 	dsi_handle_framedone(dsi, 0);
 }
 
-static int dsi_update(struct omap_dss_device *dssdev, int channel,
-		void (*callback)(int, void *), void *data)
+static int _dsi_update(struct dsi_data *dsi)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
 	u16 dw, dh;
 
 	dsi_perf_mark_setup(dsi);
 
-	dsi->update_channel = channel;
-
-	dsi->framedone_callback = callback;
-	dsi->framedone_data = data;
-
 	dw = dsi->vm.hactive;
 	dh = dsi->vm.vactive;
 
@@ -3852,6 +3852,26 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
 	return 0;
 }
 
+static int dsi_update(struct omap_dss_device *dssdev, int channel,
+		void (*callback)(int, void *), void *data)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+
+	dsi->update_channel = channel;
+	dsi->framedone_callback = callback;
+	dsi->framedone_data = data;
+
+	if (dsi->te_enabled && dsi->te_gpio) {
+		schedule_delayed_work(&dsi->te_timeout_work,
+				      msecs_to_jiffies(250));
+		atomic_set(&dsi->do_ext_te_update, 1);
+	} else {
+		_dsi_update(dsi);
+	}
+
+	return 0;
+}
+
 /* Display funcs */
 
 static int dsi_configure_dispc_clocks(struct dsi_data *dsi)
@@ -4095,6 +4115,14 @@ static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 
 	dsi->te_enabled = enable;
+
+	if (dsi->te_gpio) {
+		if (enable)
+			enable_irq(gpiod_to_irq(dsi->te_gpio));
+		else
+			disable_irq(gpiod_to_irq(dsi->te_gpio));
+	}
+
 	return 0;
 }
 
@@ -4772,11 +4800,89 @@ static const struct omap_dss_device_ops dsi_ops = {
 	},
 };
 
+static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
+{
+	struct dsi_data *dsi = (struct dsi_data *)dev_id;
+	int old;
+
+	old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
+	if (old) {
+		cancel_delayed_work(&dsi->te_timeout_work);
+		_dsi_update(dsi);
+	}
+
+	return IRQ_HANDLED;
+}
+
+static void omap_dsi_te_timeout_work_callback(struct work_struct *work)
+{
+	struct dsi_data *dsi = container_of(work, struct dsi_data,
+					te_timeout_work.work);
+	int old;
+
+	old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
+	if (old) {
+		dev_err(dsi->dev, "TE not received for 250ms!\n");
+		_dsi_update(dsi);
+	}
+}
+
+static int omap_dsi_register_te_irq(struct dsi_data *dsi,
+				    struct mipi_dsi_device *client)
+{
+	int err;
+	int te_irq;
+
+	dsi->te_gpio = gpiod_get_from_of_node(client->dev.of_node,
+					      "te-gpios", 0, GPIOD_IN,
+					      "dsi-tearing-effect");
+	if (IS_ERR(dsi->te_gpio)) {
+		err = PTR_ERR(dsi->te_gpio);
+
+		if (err == -ENOENT) {
+			dsi->te_gpio = NULL;
+			return 0;
+		}
+
+		dev_err(dsi->dev, "Could not get TE gpio: %d\n", err);
+		return err;
+	}
+
+	te_irq = gpiod_to_irq(dsi->te_gpio);
+	irq_set_status_flags(te_irq, IRQ_NOAUTOEN);
+
+	err = request_threaded_irq(te_irq, omap_dsi_te_irq_handler, NULL,
+				   IRQF_TRIGGER_RISING, "TE", dsi);
+	if (err) {
+		dev_err(dsi->dev, "request irq failed with %d\n", err);
+		gpiod_put(dsi->te_gpio);
+		return err;
+	}
+
+	INIT_DEFERRABLE_WORK(&dsi->te_timeout_work,
+			     omap_dsi_te_timeout_work_callback);
+
+	dev_dbg(dsi->dev, "Using GPIO TE\n");
+
+	return 0;
+}
+
+static void omap_dsi_unregister_te_irq(struct dsi_data *dsi)
+{
+	if (dsi->te_gpio) {
+		free_irq(gpiod_to_irq(dsi->te_gpio), dsi);
+		cancel_delayed_work(&dsi->te_timeout_work);
+		gpiod_put(dsi->te_gpio);
+		dsi->te_gpio = NULL;
+	}
+}
+
 static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 				struct mipi_dsi_device *client)
 {
 	struct dsi_data *dsi = host_to_omap(host);
 	unsigned int channel = client->channel;
+	int r;
 
 	if (channel > 3)
 		return -EINVAL;
@@ -4791,13 +4897,20 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 		return -EINVAL;
 	}
 
-	dsi->vc[channel].dest = client;
+	atomic_set(&dsi->do_ext_te_update, 0);
 
-	dsi->pix_fmt = client->format;
-	if (client->mode_flags & MIPI_DSI_MODE_VIDEO)
+	if (client->mode_flags & MIPI_DSI_MODE_VIDEO) {
 		dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
-	else
+	} else {
+		r = omap_dsi_register_te_irq(dsi, client);
+		if (r)
+			return r;
+
 		dsi->mode = OMAP_DSS_DSI_CMD_MODE;
+	}
+
+	dsi->vc[channel].dest = client;
+	dsi->pix_fmt = client->format;
 
 	return 0;
 }
@@ -4814,6 +4927,7 @@ static int omap_dsi_host_detach(struct mipi_dsi_host *host,
 	if (dsi->vc[channel].dest != client)
 		return -EINVAL;
 
+	omap_dsi_unregister_te_irq(dsi);
 	dsi->vc[channel].dest = NULL;
 	return 0;
 }
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 26/56] drm/omap: dsi: drop custom enable_te() API
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Instead of using the custon enable_te() API, this automatically
enables/disables TE core support when a matching packet is send
to the panel.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  3 --
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 34 ++++++++++++++-----
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  2 --
 3 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 43f63b5a120b..dc2c045cc6b0 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -772,7 +772,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
-	struct omap_dss_device *src = ddata->src;
 	struct mipi_dsi_device *dsi = ddata->dsi;
 	int r;
 
@@ -781,8 +780,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 	else
 		r = mipi_dsi_dcs_set_tear_off(dsi);
 
-	src->ops->dsi.enable_te(src, enable);
-
 	/* possible panel bug */
 	msleep(100);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 921e7a1e1014..41431ca34568 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4110,10 +4110,8 @@ static void dsi_display_disable(struct omap_dss_device *dssdev,
 	mutex_unlock(&dsi->lock);
 }
 
-static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
+static int dsi_enable_te(struct dsi_data *dsi, bool enable)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
 	dsi->te_enabled = enable;
 
 	if (dsi->te_gpio) {
@@ -4723,6 +4721,7 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 {
 	struct dsi_data *dsi = host_to_omap(host);
 	struct omap_dss_device *dssdev = &dsi->output;
+	int r;
 
 	if (!!(msg->flags & MIPI_DSI_MSG_USE_LPM) != dsi->in_lp_mode) {
 		dsi_vc_enable_hs(dssdev, msg->channel,
@@ -4739,16 +4738,35 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 	case MIPI_DSI_DCS_LONG_WRITE:
 	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
 	case MIPI_DSI_NULL_PACKET:
-		return dsi_vc_write_common(dssdev, msg);
+		r = dsi_vc_write_common(dssdev, msg);
+		break;
 	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
 	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
 	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
-		return dsi_vc_generic_read(dssdev, msg);
+		r = dsi_vc_generic_read(dssdev, msg);
+		break;
 	case MIPI_DSI_DCS_READ:
-		return dsi_vc_dcs_read(dssdev, msg);
+		r = dsi_vc_dcs_read(dssdev, msg);
+		break;
+	default:
+		r = -EINVAL;
+		break;
 	}
 
-	return -EINVAL;
+	if (r < 0)
+		return r;
+
+	if (msg->type == MIPI_DSI_DCS_SHORT_WRITE ||
+	    msg->type == MIPI_DSI_DCS_SHORT_WRITE_PARAM) {
+		u8 cmd = ((u8 *)msg->tx_buf)[0];
+
+		if (cmd == MIPI_DCS_SET_TEAR_OFF)
+			dsi_enable_te(dsi, false);
+		else if (cmd == MIPI_DCS_SET_TEAR_ON)
+			dsi_enable_te(dsi, true);
+	}
+
+	return 0;
 }
 
 static int dsi_get_clocks(struct dsi_data *dsi)
@@ -4795,8 +4813,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.disable_video_output = dsi_disable_video_output,
 
 		.update = dsi_update,
-
-		.enable_te = dsi_enable_te,
 	},
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 2d44a8e32fcc..1520a5f752b7 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -288,8 +288,6 @@ struct omapdss_dsi_ops {
 	int (*set_config)(struct omap_dss_device *dssdev,
 			const struct omap_dss_dsi_config *cfg);
 
-	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
-
 	int (*update)(struct omap_dss_device *dssdev, int channel,
 			void (*callback)(int, void *), void *data);
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 26/56] drm/omap: dsi: drop custom enable_te() API
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Instead of using the custon enable_te() API, this automatically
enables/disables TE core support when a matching packet is send
to the panel.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  3 --
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 34 ++++++++++++++-----
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  2 --
 3 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 43f63b5a120b..dc2c045cc6b0 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -772,7 +772,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
-	struct omap_dss_device *src = ddata->src;
 	struct mipi_dsi_device *dsi = ddata->dsi;
 	int r;
 
@@ -781,8 +780,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 	else
 		r = mipi_dsi_dcs_set_tear_off(dsi);
 
-	src->ops->dsi.enable_te(src, enable);
-
 	/* possible panel bug */
 	msleep(100);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 921e7a1e1014..41431ca34568 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4110,10 +4110,8 @@ static void dsi_display_disable(struct omap_dss_device *dssdev,
 	mutex_unlock(&dsi->lock);
 }
 
-static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
+static int dsi_enable_te(struct dsi_data *dsi, bool enable)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
 	dsi->te_enabled = enable;
 
 	if (dsi->te_gpio) {
@@ -4723,6 +4721,7 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 {
 	struct dsi_data *dsi = host_to_omap(host);
 	struct omap_dss_device *dssdev = &dsi->output;
+	int r;
 
 	if (!!(msg->flags & MIPI_DSI_MSG_USE_LPM) != dsi->in_lp_mode) {
 		dsi_vc_enable_hs(dssdev, msg->channel,
@@ -4739,16 +4738,35 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 	case MIPI_DSI_DCS_LONG_WRITE:
 	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
 	case MIPI_DSI_NULL_PACKET:
-		return dsi_vc_write_common(dssdev, msg);
+		r = dsi_vc_write_common(dssdev, msg);
+		break;
 	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
 	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
 	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
-		return dsi_vc_generic_read(dssdev, msg);
+		r = dsi_vc_generic_read(dssdev, msg);
+		break;
 	case MIPI_DSI_DCS_READ:
-		return dsi_vc_dcs_read(dssdev, msg);
+		r = dsi_vc_dcs_read(dssdev, msg);
+		break;
+	default:
+		r = -EINVAL;
+		break;
 	}
 
-	return -EINVAL;
+	if (r < 0)
+		return r;
+
+	if (msg->type == MIPI_DSI_DCS_SHORT_WRITE ||
+	    msg->type == MIPI_DSI_DCS_SHORT_WRITE_PARAM) {
+		u8 cmd = ((u8 *)msg->tx_buf)[0];
+
+		if (cmd == MIPI_DCS_SET_TEAR_OFF)
+			dsi_enable_te(dsi, false);
+		else if (cmd == MIPI_DCS_SET_TEAR_ON)
+			dsi_enable_te(dsi, true);
+	}
+
+	return 0;
 }
 
 static int dsi_get_clocks(struct dsi_data *dsi)
@@ -4795,8 +4813,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.disable_video_output = dsi_disable_video_output,
 
 		.update = dsi_update,
-
-		.enable_te = dsi_enable_te,
 	},
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 2d44a8e32fcc..1520a5f752b7 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -288,8 +288,6 @@ struct omapdss_dsi_ops {
 	int (*set_config)(struct omap_dss_device *dssdev,
 			const struct omap_dss_dsi_config *cfg);
 
-	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
-
 	int (*update)(struct omap_dss_device *dssdev, int channel,
 			void (*callback)(int, void *), void *data);
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This moves the bus locking into the host driver and unexports
the custom API in preparation for drm_panel support.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 46 +------------------
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 33 ++++++++-----
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  3 --
 3 files changed, 23 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index dc2c045cc6b0..4be0c9dbcc43 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -298,7 +298,6 @@ static int dsicm_wake_up(struct panel_drv_data *ddata)
 static int dsicm_bl_update_status(struct backlight_device *dev)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
-	struct omap_dss_device *src = ddata->src;
 	int r = 0;
 	int level;
 
@@ -313,15 +312,11 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
 	mutex_lock(&ddata->lock);
 
 	if (ddata->enabled) {
-		src->ops->dsi.bus_lock(src);
-
 		r = dsicm_wake_up(ddata);
 		if (!r) {
 			r = dsicm_dcs_write_1(ddata,
 				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
 		}
-
-		src->ops->dsi.bus_unlock(src);
 	}
 
 	mutex_unlock(&ddata->lock);
@@ -347,21 +342,16 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	struct omap_dss_device *src = ddata->src;
 	u8 errors = 0;
 	int r;
 
 	mutex_lock(&ddata->lock);
 
 	if (ddata->enabled) {
-		src->ops->dsi.bus_lock(src);
-
 		r = dsicm_wake_up(ddata);
 		if (!r)
 			r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
 					&errors);
-
-		src->ops->dsi.bus_unlock(src);
 	} else {
 		r = -ENODEV;
 	}
@@ -378,20 +368,15 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	struct omap_dss_device *src = ddata->src;
 	u8 id1, id2, id3;
 	int r;
 
 	mutex_lock(&ddata->lock);
 
 	if (ddata->enabled) {
-		src->ops->dsi.bus_lock(src);
-
 		r = dsicm_wake_up(ddata);
 		if (!r)
 			r = dsicm_get_id(ddata, &id1, &id2, &id3);
-
-		src->ops->dsi.bus_unlock(src);
 	} else {
 		r = -ENODEV;
 	}
@@ -409,7 +394,6 @@ static ssize_t dsicm_store_ulps(struct device *dev,
 		const char *buf, size_t count)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	struct omap_dss_device *src = ddata->src;
 	unsigned long t;
 	int r;
 
@@ -420,14 +404,10 @@ static ssize_t dsicm_store_ulps(struct device *dev,
 	mutex_lock(&ddata->lock);
 
 	if (ddata->enabled) {
-		src->ops->dsi.bus_lock(src);
-
 		if (t)
 			r = dsicm_enter_ulps(ddata);
 		else
 			r = dsicm_wake_up(ddata);
-
-		src->ops->dsi.bus_unlock(src);
 	}
 
 	mutex_unlock(&ddata->lock);
@@ -457,7 +437,6 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
 		const char *buf, size_t count)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	struct omap_dss_device *src = ddata->src;
 	unsigned long t;
 	int r;
 
@@ -470,9 +449,7 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
 
 	if (ddata->enabled) {
 		/* dsicm_wake_up will restart the timer */
-		src->ops->dsi.bus_lock(src);
 		r = dsicm_wake_up(ddata);
-		src->ops->dsi.bus_unlock(src);
 	}
 
 	mutex_unlock(&ddata->lock);
@@ -673,17 +650,11 @@ static void dsicm_disconnect(struct omap_dss_device *src,
 static void dsicm_enable(struct omap_dss_device *dssdev)
 {
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
 	int r;
 
 	mutex_lock(&ddata->lock);
 
-	src->ops->dsi.bus_lock(src);
-
 	r = dsicm_power_on(ddata);
-
-	src->ops->dsi.bus_unlock(src);
-
 	if (r)
 		goto err;
 
@@ -700,7 +671,6 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
 static void dsicm_disable(struct omap_dss_device *dssdev)
 {
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
 	int r;
 
 	dsicm_bl_power(ddata, false);
@@ -709,24 +679,19 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
 
 	dsicm_cancel_ulps_work(ddata);
 
-	src->ops->dsi.bus_lock(src);
-
 	r = dsicm_wake_up(ddata);
 	if (!r)
 		dsicm_power_off(ddata);
 
-	src->ops->dsi.bus_unlock(src);
-
 	mutex_unlock(&ddata->lock);
 }
 
 static void dsicm_framedone_cb(int err, void *data)
 {
 	struct panel_drv_data *ddata = data;
-	struct omap_dss_device *src = ddata->src;
 
 	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
-	src->ops->dsi.bus_unlock(src);
+	mutex_unlock(&ddata->lock);
 }
 
 static int dsicm_update(struct omap_dss_device *dssdev,
@@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
 
 	mutex_lock(&ddata->lock);
-	src->ops->dsi.bus_lock(src);
 
 	r = dsicm_wake_up(ddata);
 	if (r)
@@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 	if (r)
 		goto err;
 
-	/* note: no bus_unlock here. unlock is src framedone_cb */
-	mutex_unlock(&ddata->lock);
+	/* note: no unlock here. unlock is src framedone_cb */
 	return 0;
 err:
-	src->ops->dsi.bus_unlock(src);
 	mutex_unlock(&ddata->lock);
 	return r;
 }
@@ -791,7 +753,6 @@ static void dsicm_ulps_work(struct work_struct *work)
 	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
 			ulps_work.work);
 	struct omap_dss_device *dssdev = &ddata->dssdev;
-	struct omap_dss_device *src = ddata->src;
 
 	mutex_lock(&ddata->lock);
 
@@ -800,11 +761,8 @@ static void dsicm_ulps_work(struct work_struct *work)
 		return;
 	}
 
-	src->ops->dsi.bus_lock(src);
-
 	dsicm_enter_ulps(ddata);
 
-	src->ops->dsi.bus_unlock(src);
 	mutex_unlock(&ddata->lock);
 }
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 41431ca34568..d54b743c2b48 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -476,17 +476,13 @@ static inline u32 dsi_read_reg(struct dsi_data *dsi, const struct dsi_reg idx)
 	return __raw_readl(base + idx.idx);
 }
 
-static void dsi_bus_lock(struct omap_dss_device *dssdev)
+static void dsi_bus_lock(struct dsi_data *dsi)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
 	down(&dsi->bus_lock);
 }
 
-static void dsi_bus_unlock(struct omap_dss_device *dssdev)
+static void dsi_bus_unlock(struct dsi_data *dsi)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
 	up(&dsi->bus_lock);
 }
 
@@ -3798,6 +3794,8 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
 		REG_FLD_MOD(dsi, DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */
 	}
 
+	dsi_bus_unlock(dsi);
+
 	dsi->framedone_callback(error, dsi->framedone_data);
 
 	if (!error)
@@ -3857,6 +3855,8 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 
+	dsi_bus_lock(dsi);
+
 	dsi->update_channel = channel;
 	dsi->framedone_callback = callback;
 	dsi->framedone_data = data;
@@ -4716,10 +4716,9 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)
 	}
 }
 
-static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
-				      const struct mipi_dsi_msg *msg)
+static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
+				       const struct mipi_dsi_msg *msg)
 {
-	struct dsi_data *dsi = host_to_omap(host);
 	struct omap_dss_device *dssdev = &dsi->output;
 	int r;
 
@@ -4769,6 +4768,19 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 	return 0;
 }
 
+static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
+				      const struct mipi_dsi_msg *msg)
+{
+	struct dsi_data *dsi = host_to_omap(host);
+	int r;
+
+	dsi_bus_lock(dsi);
+	r = _omap_dsi_host_transfer(dsi, msg);
+	dsi_bus_unlock(dsi);
+
+	return r;
+}
+
 static int dsi_get_clocks(struct dsi_data *dsi)
 {
 	struct clk *clk;
@@ -4802,9 +4814,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 	.enable = dsi_display_enable,
 
 	.dsi = {
-		.bus_lock = dsi_bus_lock,
-		.bus_unlock = dsi_bus_unlock,
-
 		.disable = dsi_display_disable,
 
 		.set_config = dsi_set_config,
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 1520a5f752b7..43eba2ea1f96 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -291,9 +291,6 @@ struct omapdss_dsi_ops {
 	int (*update)(struct omap_dss_device *dssdev, int channel,
 			void (*callback)(int, void *), void *data);
 
-	void (*bus_lock)(struct omap_dss_device *dssdev);
-	void (*bus_unlock)(struct omap_dss_device *dssdev);
-
 	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
 	void (*disable_video_output)(struct omap_dss_device *dssdev,
 			int channel);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This moves the bus locking into the host driver and unexports
the custom API in preparation for drm_panel support.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 46 +------------------
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 33 ++++++++-----
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  3 --
 3 files changed, 23 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index dc2c045cc6b0..4be0c9dbcc43 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -298,7 +298,6 @@ static int dsicm_wake_up(struct panel_drv_data *ddata)
 static int dsicm_bl_update_status(struct backlight_device *dev)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
-	struct omap_dss_device *src = ddata->src;
 	int r = 0;
 	int level;
 
@@ -313,15 +312,11 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
 	mutex_lock(&ddata->lock);
 
 	if (ddata->enabled) {
-		src->ops->dsi.bus_lock(src);
-
 		r = dsicm_wake_up(ddata);
 		if (!r) {
 			r = dsicm_dcs_write_1(ddata,
 				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
 		}
-
-		src->ops->dsi.bus_unlock(src);
 	}
 
 	mutex_unlock(&ddata->lock);
@@ -347,21 +342,16 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	struct omap_dss_device *src = ddata->src;
 	u8 errors = 0;
 	int r;
 
 	mutex_lock(&ddata->lock);
 
 	if (ddata->enabled) {
-		src->ops->dsi.bus_lock(src);
-
 		r = dsicm_wake_up(ddata);
 		if (!r)
 			r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
 					&errors);
-
-		src->ops->dsi.bus_unlock(src);
 	} else {
 		r = -ENODEV;
 	}
@@ -378,20 +368,15 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	struct omap_dss_device *src = ddata->src;
 	u8 id1, id2, id3;
 	int r;
 
 	mutex_lock(&ddata->lock);
 
 	if (ddata->enabled) {
-		src->ops->dsi.bus_lock(src);
-
 		r = dsicm_wake_up(ddata);
 		if (!r)
 			r = dsicm_get_id(ddata, &id1, &id2, &id3);
-
-		src->ops->dsi.bus_unlock(src);
 	} else {
 		r = -ENODEV;
 	}
@@ -409,7 +394,6 @@ static ssize_t dsicm_store_ulps(struct device *dev,
 		const char *buf, size_t count)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	struct omap_dss_device *src = ddata->src;
 	unsigned long t;
 	int r;
 
@@ -420,14 +404,10 @@ static ssize_t dsicm_store_ulps(struct device *dev,
 	mutex_lock(&ddata->lock);
 
 	if (ddata->enabled) {
-		src->ops->dsi.bus_lock(src);
-
 		if (t)
 			r = dsicm_enter_ulps(ddata);
 		else
 			r = dsicm_wake_up(ddata);
-
-		src->ops->dsi.bus_unlock(src);
 	}
 
 	mutex_unlock(&ddata->lock);
@@ -457,7 +437,6 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
 		const char *buf, size_t count)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	struct omap_dss_device *src = ddata->src;
 	unsigned long t;
 	int r;
 
@@ -470,9 +449,7 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
 
 	if (ddata->enabled) {
 		/* dsicm_wake_up will restart the timer */
-		src->ops->dsi.bus_lock(src);
 		r = dsicm_wake_up(ddata);
-		src->ops->dsi.bus_unlock(src);
 	}
 
 	mutex_unlock(&ddata->lock);
@@ -673,17 +650,11 @@ static void dsicm_disconnect(struct omap_dss_device *src,
 static void dsicm_enable(struct omap_dss_device *dssdev)
 {
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
 	int r;
 
 	mutex_lock(&ddata->lock);
 
-	src->ops->dsi.bus_lock(src);
-
 	r = dsicm_power_on(ddata);
-
-	src->ops->dsi.bus_unlock(src);
-
 	if (r)
 		goto err;
 
@@ -700,7 +671,6 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
 static void dsicm_disable(struct omap_dss_device *dssdev)
 {
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
 	int r;
 
 	dsicm_bl_power(ddata, false);
@@ -709,24 +679,19 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
 
 	dsicm_cancel_ulps_work(ddata);
 
-	src->ops->dsi.bus_lock(src);
-
 	r = dsicm_wake_up(ddata);
 	if (!r)
 		dsicm_power_off(ddata);
 
-	src->ops->dsi.bus_unlock(src);
-
 	mutex_unlock(&ddata->lock);
 }
 
 static void dsicm_framedone_cb(int err, void *data)
 {
 	struct panel_drv_data *ddata = data;
-	struct omap_dss_device *src = ddata->src;
 
 	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
-	src->ops->dsi.bus_unlock(src);
+	mutex_unlock(&ddata->lock);
 }
 
 static int dsicm_update(struct omap_dss_device *dssdev,
@@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
 
 	mutex_lock(&ddata->lock);
-	src->ops->dsi.bus_lock(src);
 
 	r = dsicm_wake_up(ddata);
 	if (r)
@@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 	if (r)
 		goto err;
 
-	/* note: no bus_unlock here. unlock is src framedone_cb */
-	mutex_unlock(&ddata->lock);
+	/* note: no unlock here. unlock is src framedone_cb */
 	return 0;
 err:
-	src->ops->dsi.bus_unlock(src);
 	mutex_unlock(&ddata->lock);
 	return r;
 }
@@ -791,7 +753,6 @@ static void dsicm_ulps_work(struct work_struct *work)
 	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
 			ulps_work.work);
 	struct omap_dss_device *dssdev = &ddata->dssdev;
-	struct omap_dss_device *src = ddata->src;
 
 	mutex_lock(&ddata->lock);
 
@@ -800,11 +761,8 @@ static void dsicm_ulps_work(struct work_struct *work)
 		return;
 	}
 
-	src->ops->dsi.bus_lock(src);
-
 	dsicm_enter_ulps(ddata);
 
-	src->ops->dsi.bus_unlock(src);
 	mutex_unlock(&ddata->lock);
 }
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 41431ca34568..d54b743c2b48 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -476,17 +476,13 @@ static inline u32 dsi_read_reg(struct dsi_data *dsi, const struct dsi_reg idx)
 	return __raw_readl(base + idx.idx);
 }
 
-static void dsi_bus_lock(struct omap_dss_device *dssdev)
+static void dsi_bus_lock(struct dsi_data *dsi)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
 	down(&dsi->bus_lock);
 }
 
-static void dsi_bus_unlock(struct omap_dss_device *dssdev)
+static void dsi_bus_unlock(struct dsi_data *dsi)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
 	up(&dsi->bus_lock);
 }
 
@@ -3798,6 +3794,8 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
 		REG_FLD_MOD(dsi, DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */
 	}
 
+	dsi_bus_unlock(dsi);
+
 	dsi->framedone_callback(error, dsi->framedone_data);
 
 	if (!error)
@@ -3857,6 +3855,8 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 
+	dsi_bus_lock(dsi);
+
 	dsi->update_channel = channel;
 	dsi->framedone_callback = callback;
 	dsi->framedone_data = data;
@@ -4716,10 +4716,9 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)
 	}
 }
 
-static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
-				      const struct mipi_dsi_msg *msg)
+static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
+				       const struct mipi_dsi_msg *msg)
 {
-	struct dsi_data *dsi = host_to_omap(host);
 	struct omap_dss_device *dssdev = &dsi->output;
 	int r;
 
@@ -4769,6 +4768,19 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 	return 0;
 }
 
+static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
+				      const struct mipi_dsi_msg *msg)
+{
+	struct dsi_data *dsi = host_to_omap(host);
+	int r;
+
+	dsi_bus_lock(dsi);
+	r = _omap_dsi_host_transfer(dsi, msg);
+	dsi_bus_unlock(dsi);
+
+	return r;
+}
+
 static int dsi_get_clocks(struct dsi_data *dsi)
 {
 	struct clk *clk;
@@ -4802,9 +4814,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 	.enable = dsi_display_enable,
 
 	.dsi = {
-		.bus_lock = dsi_bus_lock,
-		.bus_unlock = dsi_bus_unlock,
-
 		.disable = dsi_display_disable,
 
 		.set_config = dsi_set_config,
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 1520a5f752b7..43eba2ea1f96 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -291,9 +291,6 @@ struct omapdss_dsi_ops {
 	int (*update)(struct omap_dss_device *dssdev, int channel,
 			void (*callback)(int, void *), void *data);
 
-	void (*bus_lock)(struct omap_dss_device *dssdev);
-	void (*bus_unlock)(struct omap_dss_device *dssdev);
-
 	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
 	void (*disable_video_output)(struct omap_dss_device *dssdev,
 			int channel);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 28/56] drm/omap: dsi: untangle ulps ops from enable/disable
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Create a custom function pointer for ULPS and use it instead of
reusing disable/enable functions for ULPS mode switch. This allows
us to use the common disable/enable functions pointers for DSI.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  8 ++--
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 42 ++++++++++++++-----
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  5 +--
 3 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 4be0c9dbcc43..78247dcb1848 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -233,7 +233,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
 	if (r)
 		goto err;
 
-	src->ops->dsi.disable(src, false, true);
+	src->ops->dsi.ulps(src, true);
 
 	ddata->ulps_enabled = true;
 
@@ -258,7 +258,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 	if (!ddata->ulps_enabled)
 		return 0;
 
-	src->ops->enable(src);
+	src->ops->dsi.ulps(src, false);
 	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
 	r = _dsicm_enable_te(ddata, ddata->te_enabled);
@@ -586,7 +586,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
 	dsicm_hw_reset(ddata);
 
-	src->ops->dsi.disable(src, true, false);
+	src->ops->disable(src);
 err_regulators:
 	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
 	if (r)
@@ -612,7 +612,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 		dsicm_hw_reset(ddata);
 	}
 
-	src->ops->dsi.disable(src, true, false);
+	src->ops->disable(src);
 
 	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
 	if (r)
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index d54b743c2b48..937362ade4b4 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4055,13 +4055,10 @@ static void dsi_display_uninit_dsi(struct dsi_data *dsi, bool disconnect_lanes,
 	}
 }
 
-static void dsi_display_enable(struct omap_dss_device *dssdev)
+static void dsi_display_ulps_enable(struct dsi_data *dsi)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
 	int r;
 
-	DSSDBG("dsi_display_enable\n");
-
 	WARN_ON(!dsi_bus_is_locked(dsi));
 
 	mutex_lock(&dsi->lock);
@@ -4084,16 +4081,19 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
 	dsi_runtime_put(dsi);
 err_get_dsi:
 	mutex_unlock(&dsi->lock);
-	DSSDBG("dsi_display_enable FAILED\n");
+	DSSDBG("dsi_display_ulps_enable FAILED\n");
 }
 
-static void dsi_display_disable(struct omap_dss_device *dssdev,
-		bool disconnect_lanes, bool enter_ulps)
+static void dsi_display_enable(struct omap_dss_device *dssdev)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
+	DSSDBG("dsi_display_enable\n");
+	dsi_display_ulps_enable(dsi);
+}
 
-	DSSDBG("dsi_display_disable\n");
-
+static void dsi_display_ulps_disable(struct dsi_data *dsi,
+		bool disconnect_lanes, bool enter_ulps)
+{
 	WARN_ON(!dsi_bus_is_locked(dsi));
 
 	mutex_lock(&dsi->lock);
@@ -4110,6 +4110,27 @@ static void dsi_display_disable(struct omap_dss_device *dssdev,
 	mutex_unlock(&dsi->lock);
 }
 
+static void dsi_display_disable(struct omap_dss_device *dssdev)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+
+	DSSDBG("dsi_display_disable\n");
+
+	dsi_display_ulps_disable(dsi, true, false);
+}
+
+static void dsi_ulps(struct omap_dss_device *dssdev, bool enable)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+
+	DSSDBG("dsi_ulps\n");
+
+	if (enable)
+		dsi_display_ulps_disable(dsi, false, true);
+	else
+		dsi_display_ulps_enable(dsi);
+}
+
 static int dsi_enable_te(struct dsi_data *dsi, bool enable)
 {
 	dsi->te_enabled = enable;
@@ -4812,9 +4833,10 @@ static const struct omap_dss_device_ops dsi_ops = {
 	.connect = dsi_connect,
 	.disconnect = dsi_disconnect,
 	.enable = dsi_display_enable,
+	.disable = dsi_display_disable,
 
 	.dsi = {
-		.disable = dsi_display_disable,
+		.ulps = dsi_ulps,
 
 		.set_config = dsi_set_config,
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 43eba2ea1f96..0d82ba34ca89 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -281,10 +281,9 @@ struct omap_dss_writeback_info {
 };
 
 struct omapdss_dsi_ops {
-	void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
-			bool enter_ulps);
-
 	/* bus configuration */
+	void (*ulps)(struct omap_dss_device *dssdev, bool enable);
+
 	int (*set_config)(struct omap_dss_device *dssdev,
 			const struct omap_dss_dsi_config *cfg);
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 28/56] drm/omap: dsi: untangle ulps ops from enable/disable
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Create a custom function pointer for ULPS and use it instead of
reusing disable/enable functions for ULPS mode switch. This allows
us to use the common disable/enable functions pointers for DSI.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  8 ++--
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 42 ++++++++++++++-----
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  5 +--
 3 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 4be0c9dbcc43..78247dcb1848 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -233,7 +233,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
 	if (r)
 		goto err;
 
-	src->ops->dsi.disable(src, false, true);
+	src->ops->dsi.ulps(src, true);
 
 	ddata->ulps_enabled = true;
 
@@ -258,7 +258,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 	if (!ddata->ulps_enabled)
 		return 0;
 
-	src->ops->enable(src);
+	src->ops->dsi.ulps(src, false);
 	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 
 	r = _dsicm_enable_te(ddata, ddata->te_enabled);
@@ -586,7 +586,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
 	dsicm_hw_reset(ddata);
 
-	src->ops->dsi.disable(src, true, false);
+	src->ops->disable(src);
 err_regulators:
 	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
 	if (r)
@@ -612,7 +612,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 		dsicm_hw_reset(ddata);
 	}
 
-	src->ops->dsi.disable(src, true, false);
+	src->ops->disable(src);
 
 	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
 	if (r)
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index d54b743c2b48..937362ade4b4 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4055,13 +4055,10 @@ static void dsi_display_uninit_dsi(struct dsi_data *dsi, bool disconnect_lanes,
 	}
 }
 
-static void dsi_display_enable(struct omap_dss_device *dssdev)
+static void dsi_display_ulps_enable(struct dsi_data *dsi)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
 	int r;
 
-	DSSDBG("dsi_display_enable\n");
-
 	WARN_ON(!dsi_bus_is_locked(dsi));
 
 	mutex_lock(&dsi->lock);
@@ -4084,16 +4081,19 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
 	dsi_runtime_put(dsi);
 err_get_dsi:
 	mutex_unlock(&dsi->lock);
-	DSSDBG("dsi_display_enable FAILED\n");
+	DSSDBG("dsi_display_ulps_enable FAILED\n");
 }
 
-static void dsi_display_disable(struct omap_dss_device *dssdev,
-		bool disconnect_lanes, bool enter_ulps)
+static void dsi_display_enable(struct omap_dss_device *dssdev)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
+	DSSDBG("dsi_display_enable\n");
+	dsi_display_ulps_enable(dsi);
+}
 
-	DSSDBG("dsi_display_disable\n");
-
+static void dsi_display_ulps_disable(struct dsi_data *dsi,
+		bool disconnect_lanes, bool enter_ulps)
+{
 	WARN_ON(!dsi_bus_is_locked(dsi));
 
 	mutex_lock(&dsi->lock);
@@ -4110,6 +4110,27 @@ static void dsi_display_disable(struct omap_dss_device *dssdev,
 	mutex_unlock(&dsi->lock);
 }
 
+static void dsi_display_disable(struct omap_dss_device *dssdev)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+
+	DSSDBG("dsi_display_disable\n");
+
+	dsi_display_ulps_disable(dsi, true, false);
+}
+
+static void dsi_ulps(struct omap_dss_device *dssdev, bool enable)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+
+	DSSDBG("dsi_ulps\n");
+
+	if (enable)
+		dsi_display_ulps_disable(dsi, false, true);
+	else
+		dsi_display_ulps_enable(dsi);
+}
+
 static int dsi_enable_te(struct dsi_data *dsi, bool enable)
 {
 	dsi->te_enabled = enable;
@@ -4812,9 +4833,10 @@ static const struct omap_dss_device_ops dsi_ops = {
 	.connect = dsi_connect,
 	.disconnect = dsi_disconnect,
 	.enable = dsi_display_enable,
+	.disable = dsi_display_disable,
 
 	.dsi = {
-		.disable = dsi_display_disable,
+		.ulps = dsi_ulps,
 
 		.set_config = dsi_set_config,
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 43eba2ea1f96..0d82ba34ca89 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -281,10 +281,9 @@ struct omap_dss_writeback_info {
 };
 
 struct omapdss_dsi_ops {
-	void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
-			bool enter_ulps);
-
 	/* bus configuration */
+	void (*ulps)(struct omap_dss_device *dssdev, bool enable);
+
 	int (*set_config)(struct omap_dss_device *dssdev,
 			const struct omap_dss_dsi_config *cfg);
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 29/56] drm/omap: dsi: do ULPS in host driver
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Move ULPS handling into the DSI host controller, so that we
no longer need a custom API for the DSI client.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 273 +-----------------
 drivers/gpu/drm/omapdrm/dss/dsi.c             |  63 +++-
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |   2 -
 3 files changed, 62 insertions(+), 276 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 78247dcb1848..030a8fa140db 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -16,7 +16,6 @@
 #include <linux/module.h>
 #include <linux/sched/signal.h>
 #include <linux/slab.h>
-#include <linux/workqueue.h>
 #include <linux/of_device.h>
 #include <linux/regulator/consumer.h>
 
@@ -69,21 +68,13 @@ struct panel_drv_data {
 
 	bool intro_printed;
 
-	struct workqueue_struct *workqueue;
-
 	bool ulps_enabled;
-	unsigned int ulps_timeout;
-	struct delayed_work ulps_work;
 };
 
 #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
 
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
 
-static int dsicm_panel_reset(struct panel_drv_data *ddata);
-
-static void dsicm_ulps_work(struct work_struct *work);
-
 static void dsicm_bl_power(struct panel_drv_data *ddata, bool enable)
 {
 	struct backlight_device *backlight;
@@ -207,94 +198,6 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
 	return 0;
 }
 
-static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
-{
-	if (ddata->ulps_timeout > 0)
-		queue_delayed_work(ddata->workqueue, &ddata->ulps_work,
-				msecs_to_jiffies(ddata->ulps_timeout));
-}
-
-static void dsicm_cancel_ulps_work(struct panel_drv_data *ddata)
-{
-	cancel_delayed_work(&ddata->ulps_work);
-}
-
-static int dsicm_enter_ulps(struct panel_drv_data *ddata)
-{
-	struct omap_dss_device *src = ddata->src;
-	int r;
-
-	if (ddata->ulps_enabled)
-		return 0;
-
-	dsicm_cancel_ulps_work(ddata);
-
-	r = _dsicm_enable_te(ddata, false);
-	if (r)
-		goto err;
-
-	src->ops->dsi.ulps(src, true);
-
-	ddata->ulps_enabled = true;
-
-	return 0;
-
-err:
-	dev_err(&ddata->dsi->dev, "enter ULPS failed");
-	dsicm_panel_reset(ddata);
-
-	ddata->ulps_enabled = false;
-
-	dsicm_queue_ulps_work(ddata);
-
-	return r;
-}
-
-static int dsicm_exit_ulps(struct panel_drv_data *ddata)
-{
-	struct omap_dss_device *src = ddata->src;
-	int r;
-
-	if (!ddata->ulps_enabled)
-		return 0;
-
-	src->ops->dsi.ulps(src, false);
-	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
-
-	r = _dsicm_enable_te(ddata, ddata->te_enabled);
-	if (r) {
-		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
-		goto err2;
-	}
-
-	dsicm_queue_ulps_work(ddata);
-
-	ddata->ulps_enabled = false;
-
-	return 0;
-
-err2:
-	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
-
-	r = dsicm_panel_reset(ddata);
-	if (!r)
-		ddata->ulps_enabled = false;
-
-	dsicm_queue_ulps_work(ddata);
-
-	return r;
-}
-
-static int dsicm_wake_up(struct panel_drv_data *ddata)
-{
-	if (ddata->ulps_enabled)
-		return dsicm_exit_ulps(ddata);
-
-	dsicm_cancel_ulps_work(ddata);
-	dsicm_queue_ulps_work(ddata);
-	return 0;
-}
-
 static int dsicm_bl_update_status(struct backlight_device *dev)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
@@ -312,11 +215,8 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
 	mutex_lock(&ddata->lock);
 
 	if (ddata->enabled) {
-		r = dsicm_wake_up(ddata);
-		if (!r) {
-			r = dsicm_dcs_write_1(ddata,
-				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
-		}
+		r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
+				      level);
 	}
 
 	mutex_unlock(&ddata->lock);
@@ -343,18 +243,12 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
 	u8 errors = 0;
-	int r;
+	int r = -ENODEV;
 
 	mutex_lock(&ddata->lock);
 
-	if (ddata->enabled) {
-		r = dsicm_wake_up(ddata);
-		if (!r)
-			r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
-					&errors);
-	} else {
-		r = -ENODEV;
-	}
+	if (ddata->enabled)
+		r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS, &errors);
 
 	mutex_unlock(&ddata->lock);
 
@@ -369,17 +263,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
 	u8 id1, id2, id3;
-	int r;
+	int r = -ENODEV;
 
 	mutex_lock(&ddata->lock);
 
-	if (ddata->enabled) {
-		r = dsicm_wake_up(ddata);
-		if (!r)
-			r = dsicm_get_id(ddata, &id1, &id2, &id3);
-	} else {
-		r = -ENODEV;
-	}
+	if (ddata->enabled)
+		r = dsicm_get_id(ddata, &id1, &id2, &id3);
 
 	mutex_unlock(&ddata->lock);
 
@@ -389,103 +278,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
 	return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
 }
 
-static ssize_t dsicm_store_ulps(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf, size_t count)
-{
-	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	unsigned long t;
-	int r;
-
-	r = kstrtoul(buf, 0, &t);
-	if (r)
-		return r;
-
-	mutex_lock(&ddata->lock);
-
-	if (ddata->enabled) {
-		if (t)
-			r = dsicm_enter_ulps(ddata);
-		else
-			r = dsicm_wake_up(ddata);
-	}
-
-	mutex_unlock(&ddata->lock);
-
-	if (r)
-		return r;
-
-	return count;
-}
-
-static ssize_t dsicm_show_ulps(struct device *dev,
-		struct device_attribute *attr,
-		char *buf)
-{
-	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	unsigned int t;
-
-	mutex_lock(&ddata->lock);
-	t = ddata->ulps_enabled;
-	mutex_unlock(&ddata->lock);
-
-	return snprintf(buf, PAGE_SIZE, "%u\n", t);
-}
-
-static ssize_t dsicm_store_ulps_timeout(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf, size_t count)
-{
-	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	unsigned long t;
-	int r;
-
-	r = kstrtoul(buf, 0, &t);
-	if (r)
-		return r;
-
-	mutex_lock(&ddata->lock);
-	ddata->ulps_timeout = t;
-
-	if (ddata->enabled) {
-		/* dsicm_wake_up will restart the timer */
-		r = dsicm_wake_up(ddata);
-	}
-
-	mutex_unlock(&ddata->lock);
-
-	if (r)
-		return r;
-
-	return count;
-}
-
-static ssize_t dsicm_show_ulps_timeout(struct device *dev,
-		struct device_attribute *attr,
-		char *buf)
-{
-	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	unsigned int t;
-
-	mutex_lock(&ddata->lock);
-	t = ddata->ulps_timeout;
-	mutex_unlock(&ddata->lock);
-
-	return snprintf(buf, PAGE_SIZE, "%u\n", t);
-}
-
 static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
 static DEVICE_ATTR(hw_revision, S_IRUGO, dsicm_hw_revision_show, NULL);
-static DEVICE_ATTR(ulps, S_IRUGO | S_IWUSR,
-		dsicm_show_ulps, dsicm_store_ulps);
-static DEVICE_ATTR(ulps_timeout, S_IRUGO | S_IWUSR,
-		dsicm_show_ulps_timeout, dsicm_store_ulps_timeout);
 
 static struct attribute *dsicm_attrs[] = {
 	&dev_attr_num_dsi_errors.attr,
 	&dev_attr_hw_revision.attr,
-	&dev_attr_ulps.attr,
-	&dev_attr_ulps_timeout.attr,
 	NULL,
 };
 
@@ -621,15 +419,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 	ddata->enabled = false;
 }
 
-static int dsicm_panel_reset(struct panel_drv_data *ddata)
-{
-	dev_err(&ddata->dsi->dev, "performing LCD reset\n");
-
-	dsicm_power_off(ddata);
-	dsicm_hw_reset(ddata);
-	return dsicm_power_on(ddata);
-}
-
 static int dsicm_connect(struct omap_dss_device *src,
 			 struct omap_dss_device *dst)
 {
@@ -671,17 +460,12 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
 static void dsicm_disable(struct omap_dss_device *dssdev)
 {
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	int r;
 
 	dsicm_bl_power(ddata, false);
 
 	mutex_lock(&ddata->lock);
 
-	dsicm_cancel_ulps_work(ddata);
-
-	r = dsicm_wake_up(ddata);
-	if (!r)
-		dsicm_power_off(ddata);
+	dsicm_power_off(ddata);
 
 	mutex_unlock(&ddata->lock);
 }
@@ -705,10 +489,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 
 	mutex_lock(&ddata->lock);
 
-	r = dsicm_wake_up(ddata);
-	if (r)
-		goto err;
-
 	if (!ddata->enabled) {
 		r = 0;
 		goto err;
@@ -748,24 +528,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 	return r;
 }
 
-static void dsicm_ulps_work(struct work_struct *work)
-{
-	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
-			ulps_work.work);
-	struct omap_dss_device *dssdev = &ddata->dssdev;
-
-	mutex_lock(&ddata->lock);
-
-	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || !ddata->enabled) {
-		mutex_unlock(&ddata->lock);
-		return;
-	}
-
-	dsicm_enter_ulps(ddata);
-
-	mutex_unlock(&ddata->lock);
-}
-
 static int dsicm_get_modes(struct omap_dss_device *dssdev,
 			   struct drm_connector *connector)
 {
@@ -863,7 +625,7 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 	else
 		ddata->use_dsi_backlight = true;
 
-	/* TODO: ulps */
+	/* TODO: ulps_enabled */
 
 	return 0;
 }
@@ -911,13 +673,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 
 	mutex_init(&ddata->lock);
 
-	ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
-	if (!ddata->workqueue) {
-		r = -ENOMEM;
-		goto err_reg;
-	}
-	INIT_DELAYED_WORK(&ddata->ulps_work, dsicm_ulps_work);
-
 	dsicm_hw_reset(ddata);
 
 	if (ddata->use_dsi_backlight) {
@@ -948,6 +703,9 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	dsi->hs_rate = 300000000;
 	dsi->lp_rate = 10000000;
 
+	if (ddata->ulps_enabled)
+		dsi->mode_flags |= MIPI_DSI_MODE_ULPS_IDLE;
+
 	r = mipi_dsi_attach(dsi);
 	if (r < 0)
 		goto err_dsi_attach;
@@ -957,8 +715,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 err_dsi_attach:
 	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
 err_bl:
-	destroy_workqueue(ddata->workqueue);
-err_reg:
 	if (ddata->extbldev)
 		put_device(&ddata->extbldev->dev);
 
@@ -985,9 +741,6 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
 	if (ddata->extbldev)
 		put_device(&ddata->extbldev->dev);
 
-	dsicm_cancel_ulps_work(ddata);
-	destroy_workqueue(ddata->workqueue);
-
 	/* reset, to be sure that the panel is in a valid state */
 	dsicm_hw_reset(ddata);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 937362ade4b4..0f264654792d 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -207,6 +207,8 @@ struct dsi_reg { u16 module; u16 idx; };
 typedef void (*omap_dsi_isr_t) (void *arg, u32 mask);
 struct dsi_data;
 
+static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable);
+
 static int dsi_display_init_dispc(struct dsi_data *dsi);
 static void dsi_display_uninit_dispc(struct dsi_data *dsi);
 
@@ -377,6 +379,9 @@ struct dsi_data {
 
 	bool te_enabled;
 	bool ulps_enabled;
+	bool ulps_auto_idle;
+
+	struct delayed_work ulps_work;
 
 	void (*framedone_callback)(int, void *);
 	void *framedone_data;
@@ -3794,6 +3799,7 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
 		REG_FLD_MOD(dsi, DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */
 	}
 
+	dsi_set_ulps_auto(dsi, true);
 	dsi_bus_unlock(dsi);
 
 	dsi->framedone_callback(error, dsi->framedone_data);
@@ -3856,6 +3862,7 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 
 	dsi_bus_lock(dsi);
+	dsi_set_ulps_auto(dsi, false);
 
 	dsi->update_channel = channel;
 	dsi->framedone_callback = callback;
@@ -4119,18 +4126,6 @@ static void dsi_display_disable(struct omap_dss_device *dssdev)
 	dsi_display_ulps_disable(dsi, true, false);
 }
 
-static void dsi_ulps(struct omap_dss_device *dssdev, bool enable)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
-	DSSDBG("dsi_ulps\n");
-
-	if (enable)
-		dsi_display_ulps_disable(dsi, false, true);
-	else
-		dsi_display_ulps_enable(dsi);
-}
-
 static int dsi_enable_te(struct dsi_data *dsi, bool enable)
 {
 	dsi->te_enabled = enable;
@@ -4145,6 +4140,40 @@ static int dsi_enable_te(struct dsi_data *dsi, bool enable)
 	return 0;
 }
 
+static void omap_dsi_ulps_work_callback(struct work_struct *work)
+{
+	struct dsi_data *dsi = container_of(work, struct dsi_data,
+					    ulps_work.work);
+
+	dsi_bus_lock(dsi);
+
+	dsi_enable_te(dsi, false);
+
+	dsi_display_ulps_disable(dsi, false, true);
+
+	dsi_bus_unlock(dsi);
+}
+
+static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable)
+{
+	WARN_ON(!dsi_bus_is_locked(dsi));
+
+	if (!dsi->ulps_auto_idle)
+		return;
+
+	if (enable) {
+		schedule_delayed_work(&dsi->ulps_work, msecs_to_jiffies(250));
+	} else {
+		cancel_delayed_work_sync(&dsi->ulps_work);
+
+		if (!dsi->ulps_enabled)
+			return;
+
+		dsi_display_ulps_enable(dsi);
+		dsi_enable_te(dsi, true);
+	}
+}
+
 #ifdef PRINT_VERBOSE_VM_TIMINGS
 static void print_dsi_vm(const char *str,
 		const struct omap_dss_dsi_videomode_timings *t)
@@ -4796,7 +4825,9 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 	int r;
 
 	dsi_bus_lock(dsi);
+	dsi_set_ulps_auto(dsi, false);
 	r = _omap_dsi_host_transfer(dsi, msg);
+	dsi_set_ulps_auto(dsi, true);
 	dsi_bus_unlock(dsi);
 
 	return r;
@@ -4836,8 +4867,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 	.disable = dsi_display_disable,
 
 	.dsi = {
-		.ulps = dsi_ulps,
-
 		.set_config = dsi_set_config,
 
 		.enable_video_output = dsi_enable_video_output,
@@ -4959,6 +4988,12 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 	dsi->vc[channel].dest = client;
 	dsi->pix_fmt = client->format;
 
+	INIT_DEFERRABLE_WORK(&dsi->ulps_work,
+			     omap_dsi_ulps_work_callback);
+
+	dsi->ulps_auto_idle = !!(client->mode_flags & MIPI_DSI_MODE_ULPS_IDLE);
+	dsi_set_ulps_auto(dsi, true);
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 0d82ba34ca89..524cb87cd9ea 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -282,8 +282,6 @@ struct omap_dss_writeback_info {
 
 struct omapdss_dsi_ops {
 	/* bus configuration */
-	void (*ulps)(struct omap_dss_device *dssdev, bool enable);
-
 	int (*set_config)(struct omap_dss_device *dssdev,
 			const struct omap_dss_dsi_config *cfg);
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 29/56] drm/omap: dsi: do ULPS in host driver
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Move ULPS handling into the DSI host controller, so that we
no longer need a custom API for the DSI client.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 273 +-----------------
 drivers/gpu/drm/omapdrm/dss/dsi.c             |  63 +++-
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |   2 -
 3 files changed, 62 insertions(+), 276 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 78247dcb1848..030a8fa140db 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -16,7 +16,6 @@
 #include <linux/module.h>
 #include <linux/sched/signal.h>
 #include <linux/slab.h>
-#include <linux/workqueue.h>
 #include <linux/of_device.h>
 #include <linux/regulator/consumer.h>
 
@@ -69,21 +68,13 @@ struct panel_drv_data {
 
 	bool intro_printed;
 
-	struct workqueue_struct *workqueue;
-
 	bool ulps_enabled;
-	unsigned int ulps_timeout;
-	struct delayed_work ulps_work;
 };
 
 #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
 
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
 
-static int dsicm_panel_reset(struct panel_drv_data *ddata);
-
-static void dsicm_ulps_work(struct work_struct *work);
-
 static void dsicm_bl_power(struct panel_drv_data *ddata, bool enable)
 {
 	struct backlight_device *backlight;
@@ -207,94 +198,6 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
 	return 0;
 }
 
-static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
-{
-	if (ddata->ulps_timeout > 0)
-		queue_delayed_work(ddata->workqueue, &ddata->ulps_work,
-				msecs_to_jiffies(ddata->ulps_timeout));
-}
-
-static void dsicm_cancel_ulps_work(struct panel_drv_data *ddata)
-{
-	cancel_delayed_work(&ddata->ulps_work);
-}
-
-static int dsicm_enter_ulps(struct panel_drv_data *ddata)
-{
-	struct omap_dss_device *src = ddata->src;
-	int r;
-
-	if (ddata->ulps_enabled)
-		return 0;
-
-	dsicm_cancel_ulps_work(ddata);
-
-	r = _dsicm_enable_te(ddata, false);
-	if (r)
-		goto err;
-
-	src->ops->dsi.ulps(src, true);
-
-	ddata->ulps_enabled = true;
-
-	return 0;
-
-err:
-	dev_err(&ddata->dsi->dev, "enter ULPS failed");
-	dsicm_panel_reset(ddata);
-
-	ddata->ulps_enabled = false;
-
-	dsicm_queue_ulps_work(ddata);
-
-	return r;
-}
-
-static int dsicm_exit_ulps(struct panel_drv_data *ddata)
-{
-	struct omap_dss_device *src = ddata->src;
-	int r;
-
-	if (!ddata->ulps_enabled)
-		return 0;
-
-	src->ops->dsi.ulps(src, false);
-	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
-
-	r = _dsicm_enable_te(ddata, ddata->te_enabled);
-	if (r) {
-		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
-		goto err2;
-	}
-
-	dsicm_queue_ulps_work(ddata);
-
-	ddata->ulps_enabled = false;
-
-	return 0;
-
-err2:
-	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
-
-	r = dsicm_panel_reset(ddata);
-	if (!r)
-		ddata->ulps_enabled = false;
-
-	dsicm_queue_ulps_work(ddata);
-
-	return r;
-}
-
-static int dsicm_wake_up(struct panel_drv_data *ddata)
-{
-	if (ddata->ulps_enabled)
-		return dsicm_exit_ulps(ddata);
-
-	dsicm_cancel_ulps_work(ddata);
-	dsicm_queue_ulps_work(ddata);
-	return 0;
-}
-
 static int dsicm_bl_update_status(struct backlight_device *dev)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
@@ -312,11 +215,8 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
 	mutex_lock(&ddata->lock);
 
 	if (ddata->enabled) {
-		r = dsicm_wake_up(ddata);
-		if (!r) {
-			r = dsicm_dcs_write_1(ddata,
-				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
-		}
+		r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
+				      level);
 	}
 
 	mutex_unlock(&ddata->lock);
@@ -343,18 +243,12 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
 	u8 errors = 0;
-	int r;
+	int r = -ENODEV;
 
 	mutex_lock(&ddata->lock);
 
-	if (ddata->enabled) {
-		r = dsicm_wake_up(ddata);
-		if (!r)
-			r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
-					&errors);
-	} else {
-		r = -ENODEV;
-	}
+	if (ddata->enabled)
+		r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS, &errors);
 
 	mutex_unlock(&ddata->lock);
 
@@ -369,17 +263,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
 	u8 id1, id2, id3;
-	int r;
+	int r = -ENODEV;
 
 	mutex_lock(&ddata->lock);
 
-	if (ddata->enabled) {
-		r = dsicm_wake_up(ddata);
-		if (!r)
-			r = dsicm_get_id(ddata, &id1, &id2, &id3);
-	} else {
-		r = -ENODEV;
-	}
+	if (ddata->enabled)
+		r = dsicm_get_id(ddata, &id1, &id2, &id3);
 
 	mutex_unlock(&ddata->lock);
 
@@ -389,103 +278,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
 	return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
 }
 
-static ssize_t dsicm_store_ulps(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf, size_t count)
-{
-	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	unsigned long t;
-	int r;
-
-	r = kstrtoul(buf, 0, &t);
-	if (r)
-		return r;
-
-	mutex_lock(&ddata->lock);
-
-	if (ddata->enabled) {
-		if (t)
-			r = dsicm_enter_ulps(ddata);
-		else
-			r = dsicm_wake_up(ddata);
-	}
-
-	mutex_unlock(&ddata->lock);
-
-	if (r)
-		return r;
-
-	return count;
-}
-
-static ssize_t dsicm_show_ulps(struct device *dev,
-		struct device_attribute *attr,
-		char *buf)
-{
-	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	unsigned int t;
-
-	mutex_lock(&ddata->lock);
-	t = ddata->ulps_enabled;
-	mutex_unlock(&ddata->lock);
-
-	return snprintf(buf, PAGE_SIZE, "%u\n", t);
-}
-
-static ssize_t dsicm_store_ulps_timeout(struct device *dev,
-		struct device_attribute *attr,
-		const char *buf, size_t count)
-{
-	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	unsigned long t;
-	int r;
-
-	r = kstrtoul(buf, 0, &t);
-	if (r)
-		return r;
-
-	mutex_lock(&ddata->lock);
-	ddata->ulps_timeout = t;
-
-	if (ddata->enabled) {
-		/* dsicm_wake_up will restart the timer */
-		r = dsicm_wake_up(ddata);
-	}
-
-	mutex_unlock(&ddata->lock);
-
-	if (r)
-		return r;
-
-	return count;
-}
-
-static ssize_t dsicm_show_ulps_timeout(struct device *dev,
-		struct device_attribute *attr,
-		char *buf)
-{
-	struct panel_drv_data *ddata = dev_get_drvdata(dev);
-	unsigned int t;
-
-	mutex_lock(&ddata->lock);
-	t = ddata->ulps_timeout;
-	mutex_unlock(&ddata->lock);
-
-	return snprintf(buf, PAGE_SIZE, "%u\n", t);
-}
-
 static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
 static DEVICE_ATTR(hw_revision, S_IRUGO, dsicm_hw_revision_show, NULL);
-static DEVICE_ATTR(ulps, S_IRUGO | S_IWUSR,
-		dsicm_show_ulps, dsicm_store_ulps);
-static DEVICE_ATTR(ulps_timeout, S_IRUGO | S_IWUSR,
-		dsicm_show_ulps_timeout, dsicm_store_ulps_timeout);
 
 static struct attribute *dsicm_attrs[] = {
 	&dev_attr_num_dsi_errors.attr,
 	&dev_attr_hw_revision.attr,
-	&dev_attr_ulps.attr,
-	&dev_attr_ulps_timeout.attr,
 	NULL,
 };
 
@@ -621,15 +419,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 	ddata->enabled = false;
 }
 
-static int dsicm_panel_reset(struct panel_drv_data *ddata)
-{
-	dev_err(&ddata->dsi->dev, "performing LCD reset\n");
-
-	dsicm_power_off(ddata);
-	dsicm_hw_reset(ddata);
-	return dsicm_power_on(ddata);
-}
-
 static int dsicm_connect(struct omap_dss_device *src,
 			 struct omap_dss_device *dst)
 {
@@ -671,17 +460,12 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
 static void dsicm_disable(struct omap_dss_device *dssdev)
 {
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	int r;
 
 	dsicm_bl_power(ddata, false);
 
 	mutex_lock(&ddata->lock);
 
-	dsicm_cancel_ulps_work(ddata);
-
-	r = dsicm_wake_up(ddata);
-	if (!r)
-		dsicm_power_off(ddata);
+	dsicm_power_off(ddata);
 
 	mutex_unlock(&ddata->lock);
 }
@@ -705,10 +489,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
 
 	mutex_lock(&ddata->lock);
 
-	r = dsicm_wake_up(ddata);
-	if (r)
-		goto err;
-
 	if (!ddata->enabled) {
 		r = 0;
 		goto err;
@@ -748,24 +528,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 	return r;
 }
 
-static void dsicm_ulps_work(struct work_struct *work)
-{
-	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
-			ulps_work.work);
-	struct omap_dss_device *dssdev = &ddata->dssdev;
-
-	mutex_lock(&ddata->lock);
-
-	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || !ddata->enabled) {
-		mutex_unlock(&ddata->lock);
-		return;
-	}
-
-	dsicm_enter_ulps(ddata);
-
-	mutex_unlock(&ddata->lock);
-}
-
 static int dsicm_get_modes(struct omap_dss_device *dssdev,
 			   struct drm_connector *connector)
 {
@@ -863,7 +625,7 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 	else
 		ddata->use_dsi_backlight = true;
 
-	/* TODO: ulps */
+	/* TODO: ulps_enabled */
 
 	return 0;
 }
@@ -911,13 +673,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 
 	mutex_init(&ddata->lock);
 
-	ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
-	if (!ddata->workqueue) {
-		r = -ENOMEM;
-		goto err_reg;
-	}
-	INIT_DELAYED_WORK(&ddata->ulps_work, dsicm_ulps_work);
-
 	dsicm_hw_reset(ddata);
 
 	if (ddata->use_dsi_backlight) {
@@ -948,6 +703,9 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	dsi->hs_rate = 300000000;
 	dsi->lp_rate = 10000000;
 
+	if (ddata->ulps_enabled)
+		dsi->mode_flags |= MIPI_DSI_MODE_ULPS_IDLE;
+
 	r = mipi_dsi_attach(dsi);
 	if (r < 0)
 		goto err_dsi_attach;
@@ -957,8 +715,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 err_dsi_attach:
 	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
 err_bl:
-	destroy_workqueue(ddata->workqueue);
-err_reg:
 	if (ddata->extbldev)
 		put_device(&ddata->extbldev->dev);
 
@@ -985,9 +741,6 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
 	if (ddata->extbldev)
 		put_device(&ddata->extbldev->dev);
 
-	dsicm_cancel_ulps_work(ddata);
-	destroy_workqueue(ddata->workqueue);
-
 	/* reset, to be sure that the panel is in a valid state */
 	dsicm_hw_reset(ddata);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 937362ade4b4..0f264654792d 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -207,6 +207,8 @@ struct dsi_reg { u16 module; u16 idx; };
 typedef void (*omap_dsi_isr_t) (void *arg, u32 mask);
 struct dsi_data;
 
+static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable);
+
 static int dsi_display_init_dispc(struct dsi_data *dsi);
 static void dsi_display_uninit_dispc(struct dsi_data *dsi);
 
@@ -377,6 +379,9 @@ struct dsi_data {
 
 	bool te_enabled;
 	bool ulps_enabled;
+	bool ulps_auto_idle;
+
+	struct delayed_work ulps_work;
 
 	void (*framedone_callback)(int, void *);
 	void *framedone_data;
@@ -3794,6 +3799,7 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
 		REG_FLD_MOD(dsi, DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */
 	}
 
+	dsi_set_ulps_auto(dsi, true);
 	dsi_bus_unlock(dsi);
 
 	dsi->framedone_callback(error, dsi->framedone_data);
@@ -3856,6 +3862,7 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 
 	dsi_bus_lock(dsi);
+	dsi_set_ulps_auto(dsi, false);
 
 	dsi->update_channel = channel;
 	dsi->framedone_callback = callback;
@@ -4119,18 +4126,6 @@ static void dsi_display_disable(struct omap_dss_device *dssdev)
 	dsi_display_ulps_disable(dsi, true, false);
 }
 
-static void dsi_ulps(struct omap_dss_device *dssdev, bool enable)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-
-	DSSDBG("dsi_ulps\n");
-
-	if (enable)
-		dsi_display_ulps_disable(dsi, false, true);
-	else
-		dsi_display_ulps_enable(dsi);
-}
-
 static int dsi_enable_te(struct dsi_data *dsi, bool enable)
 {
 	dsi->te_enabled = enable;
@@ -4145,6 +4140,40 @@ static int dsi_enable_te(struct dsi_data *dsi, bool enable)
 	return 0;
 }
 
+static void omap_dsi_ulps_work_callback(struct work_struct *work)
+{
+	struct dsi_data *dsi = container_of(work, struct dsi_data,
+					    ulps_work.work);
+
+	dsi_bus_lock(dsi);
+
+	dsi_enable_te(dsi, false);
+
+	dsi_display_ulps_disable(dsi, false, true);
+
+	dsi_bus_unlock(dsi);
+}
+
+static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable)
+{
+	WARN_ON(!dsi_bus_is_locked(dsi));
+
+	if (!dsi->ulps_auto_idle)
+		return;
+
+	if (enable) {
+		schedule_delayed_work(&dsi->ulps_work, msecs_to_jiffies(250));
+	} else {
+		cancel_delayed_work_sync(&dsi->ulps_work);
+
+		if (!dsi->ulps_enabled)
+			return;
+
+		dsi_display_ulps_enable(dsi);
+		dsi_enable_te(dsi, true);
+	}
+}
+
 #ifdef PRINT_VERBOSE_VM_TIMINGS
 static void print_dsi_vm(const char *str,
 		const struct omap_dss_dsi_videomode_timings *t)
@@ -4796,7 +4825,9 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 	int r;
 
 	dsi_bus_lock(dsi);
+	dsi_set_ulps_auto(dsi, false);
 	r = _omap_dsi_host_transfer(dsi, msg);
+	dsi_set_ulps_auto(dsi, true);
 	dsi_bus_unlock(dsi);
 
 	return r;
@@ -4836,8 +4867,6 @@ static const struct omap_dss_device_ops dsi_ops = {
 	.disable = dsi_display_disable,
 
 	.dsi = {
-		.ulps = dsi_ulps,
-
 		.set_config = dsi_set_config,
 
 		.enable_video_output = dsi_enable_video_output,
@@ -4959,6 +4988,12 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 	dsi->vc[channel].dest = client;
 	dsi->pix_fmt = client->format;
 
+	INIT_DEFERRABLE_WORK(&dsi->ulps_work,
+			     omap_dsi_ulps_work_callback);
+
+	dsi->ulps_auto_idle = !!(client->mode_flags & MIPI_DSI_MODE_ULPS_IDLE);
+	dsi_set_ulps_auto(dsi, true);
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 0d82ba34ca89..524cb87cd9ea 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -282,8 +282,6 @@ struct omap_dss_writeback_info {
 
 struct omapdss_dsi_ops {
 	/* bus configuration */
-	void (*ulps)(struct omap_dss_device *dssdev, bool enable);
-
 	int (*set_config)(struct omap_dss_device *dssdev,
 			const struct omap_dss_dsi_config *cfg);
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This moves the panel refresh/update function from the panel
driver into the DSI host driver to prepare for common drm_panel
support.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  68 ------------
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 101 ++++++++++++++++--
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  13 +--
 drivers/gpu/drm/omapdrm/omap_crtc.c           |  11 +-
 4 files changed, 97 insertions(+), 96 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 030a8fa140db..1582960f9e90 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
 	return 0;
 }
 
-static int dsicm_set_update_window(struct panel_drv_data *ddata,
-		u16 x, u16 y, u16 w, u16 h)
-{
-	struct mipi_dsi_device *dsi = ddata->dsi;
-	int r;
-	u16 x1 = x;
-	u16 x2 = x + w - 1;
-	u16 y1 = y;
-	u16 y2 = y + h - 1;
-
-	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
-	if (r < 0)
-		return r;
-
-	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
-	if (r < 0)
-		return r;
-
-	return 0;
-}
-
 static int dsicm_bl_update_status(struct backlight_device *dev)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
@@ -470,48 +449,6 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
 	mutex_unlock(&ddata->lock);
 }
 
-static void dsicm_framedone_cb(int err, void *data)
-{
-	struct panel_drv_data *ddata = data;
-
-	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
-	mutex_unlock(&ddata->lock);
-}
-
-static int dsicm_update(struct omap_dss_device *dssdev,
-				    u16 x, u16 y, u16 w, u16 h)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
-	int r;
-
-	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
-
-	mutex_lock(&ddata->lock);
-
-	if (!ddata->enabled) {
-		r = 0;
-		goto err;
-	}
-
-	/* XXX no need to send this every frame, but dsi break if not done */
-	r = dsicm_set_update_window(ddata, 0, 0, ddata->vm.hactive,
-				    ddata->vm.vactive);
-	if (r)
-		goto err;
-
-	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
-			ddata);
-	if (r)
-		goto err;
-
-	/* note: no unlock here. unlock is src framedone_cb */
-	return 0;
-err:
-	mutex_unlock(&ddata->lock);
-	return r;
-}
-
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
 	struct mipi_dsi_device *dsi = ddata->dsi;
@@ -572,10 +509,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
 	.check_timings	= dsicm_check_timings,
 };
 
-static const struct omap_dss_driver dsicm_dss_driver = {
-	.update		= dsicm_update,
-};
-
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 {
 	struct device_node *node = dsi->dev.of_node;
@@ -658,7 +591,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	dssdev = &ddata->dssdev;
 	dssdev->dev = dev;
 	dssdev->ops = &dsicm_ops;
-	dssdev->driver = &dsicm_dss_driver;
 	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
 	dssdev->display = true;
 	dssdev->owner = THIS_MODULE;
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 0f264654792d..0aa0d21cf896 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -214,6 +214,9 @@ static void dsi_display_uninit_dispc(struct dsi_data *dsi);
 
 static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
 
+static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
+				       const struct mipi_dsi_msg *msg);
+
 /* DSI PLL HSDIV indices */
 #define HSDIV_DISPC	0
 #define HSDIV_DSI	1
@@ -383,9 +386,6 @@ struct dsi_data {
 
 	struct delayed_work ulps_work;
 
-	void (*framedone_callback)(int, void *);
-	void *framedone_data;
-
 	struct delayed_work framedone_timeout_work;
 
 #ifdef DSI_CATCH_MISSING_TE
@@ -3802,8 +3802,6 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
 	dsi_set_ulps_auto(dsi, true);
 	dsi_bus_unlock(dsi);
 
-	dsi->framedone_callback(error, dsi->framedone_data);
-
 	if (!error)
 		dsi_perf_show(dsi, "DISPC");
 }
@@ -3835,6 +3833,8 @@ static void dsi_framedone_irq_callback(void *data)
 
 	cancel_delayed_work(&dsi->framedone_timeout_work);
 
+	DSSDBG("Framedone received!\n");
+
 	dsi_handle_framedone(dsi, 0);
 }
 
@@ -3856,17 +3856,69 @@ static int _dsi_update(struct dsi_data *dsi)
 	return 0;
 }
 
-static int dsi_update(struct omap_dss_device *dssdev, int channel,
-		void (*callback)(int, void *), void *data)
+static int _dsi_update_window(struct dsi_data *dsi, int channel,
+			      int x, int y, int w, int h)
+{
+	int x1 = x, x2 = (x + w - 1);
+	int y1 = y, y2 = (y + h - 1);
+	u8 payloadX[5] = { MIPI_DCS_SET_COLUMN_ADDRESS,
+			   x1 >> 8, x1 & 0xff, x2 >> 8, x2 & 0xff };
+	u8 payloadY[5] = { MIPI_DCS_SET_PAGE_ADDRESS,
+			   y1 >> 8, y1 & 0xff, y2 >> 8, y2 & 0xff };
+	struct mipi_dsi_msg msgX = { 0 }, msgY = { 0 };
+	int ret;
+
+	WARN_ON(!dsi_bus_is_locked(dsi));
+
+	msgX.type = MIPI_DSI_DCS_LONG_WRITE;
+	msgX.channel = channel;
+	msgX.tx_buf = payloadX;
+	msgX.tx_len = sizeof(payloadX);
+
+	msgY.type = MIPI_DSI_DCS_LONG_WRITE;
+	msgY.channel = channel;
+	msgY.tx_buf = payloadY;
+	msgY.tx_len = sizeof(payloadY);
+
+	ret = _omap_dsi_host_transfer(dsi, &msgX);
+	if (ret != 0)
+		return ret;
+
+	return _omap_dsi_host_transfer(dsi, &msgY);
+}
+
+static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
+	int r;
+
+	if (channel > 3)
+		return -EINVAL;
 
 	dsi_bus_lock(dsi);
+
+	if (!dsi->vc[channel].dest) {
+		r = -ENODEV;
+		goto err;
+	}
+
+	if (dsi->vm.hactive == 0 || dsi->vm.vactive == 0) {
+		r = -EINVAL;
+		goto err;
+	}
+
+	DSSDBG("dsi_update_channel: %d", channel);
+
 	dsi_set_ulps_auto(dsi, false);
 
+	r = _dsi_update_window(dsi, channel, 0, 0, dsi->vm.hactive,
+			       dsi->vm.vactive);
+	if (r < 0) {
+		DSSWARN("window update error: %d\n", r);
+		goto err;
+	}
+
 	dsi->update_channel = channel;
-	dsi->framedone_callback = callback;
-	dsi->framedone_data = data;
 
 	if (dsi->te_enabled && dsi->te_gpio) {
 		schedule_delayed_work(&dsi->te_timeout_work,
@@ -3877,6 +3929,24 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
 	}
 
 	return 0;
+
+err:
+	dsi_set_ulps_auto(dsi, true);
+	dsi_bus_unlock(dsi);
+	return r;
+}
+
+static int dsi_update_all(struct omap_dss_device *dssdev)
+{
+	int i, r;
+
+	for (i = 0; i < 4; i++) {
+		r = dsi_update_channel(dssdev, i);
+		if (r != -ENODEV)
+			return r;
+	}
+
+	return r;
 }
 
 /* Display funcs */
@@ -4095,7 +4165,9 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 	DSSDBG("dsi_display_enable\n");
+	dsi_bus_lock(dsi);
 	dsi_display_ulps_enable(dsi);
+	dsi_bus_unlock(dsi);
 }
 
 static void dsi_display_ulps_disable(struct dsi_data *dsi,
@@ -4123,7 +4195,9 @@ static void dsi_display_disable(struct omap_dss_device *dssdev)
 
 	DSSDBG("dsi_display_disable\n");
 
+	dsi_bus_lock(dsi);
 	dsi_display_ulps_disable(dsi, true, false);
+	dsi_bus_unlock(dsi);
 }
 
 static int dsi_enable_te(struct dsi_data *dsi, bool enable)
@@ -4872,7 +4946,7 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.enable_video_output = dsi_enable_video_output,
 		.disable_video_output = dsi_disable_video_output,
 
-		.update = dsi_update,
+		.update = dsi_update_all,
 	},
 };
 
@@ -4973,14 +5047,18 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 		return -EINVAL;
 	}
 
+	dsi_bus_lock(dsi);
+
 	atomic_set(&dsi->do_ext_te_update, 0);
 
 	if (client->mode_flags & MIPI_DSI_MODE_VIDEO) {
 		dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
 	} else {
 		r = omap_dsi_register_te_irq(dsi, client);
-		if (r)
+		if (r) {
+			dsi_bus_unlock(dsi);
 			return r;
+		}
 
 		dsi->mode = OMAP_DSS_DSI_CMD_MODE;
 	}
@@ -4994,6 +5072,7 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 	dsi->ulps_auto_idle = !!(client->mode_flags & MIPI_DSI_MODE_ULPS_IDLE);
 	dsi_set_ulps_auto(dsi, true);
 
+	dsi_bus_unlock(dsi);
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 524cb87cd9ea..de4c779c358a 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -281,13 +281,12 @@ struct omap_dss_writeback_info {
 };
 
 struct omapdss_dsi_ops {
-	/* bus configuration */
+	int (*update)(struct omap_dss_device *dssdev);
+
+	/* legacy API used by omapdss panels */
 	int (*set_config)(struct omap_dss_device *dssdev,
 			const struct omap_dss_dsi_config *cfg);
 
-	int (*update)(struct omap_dss_device *dssdev, int channel,
-			void (*callback)(int, void *), void *data);
-
 	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
 	void (*disable_video_output)(struct omap_dss_device *dssdev,
 			int channel);
@@ -351,7 +350,6 @@ struct omap_dss_device {
 
 	const char *name;
 
-	const struct omap_dss_driver *driver;
 	const struct omap_dss_device_ops *ops;
 	unsigned long ops_flags;
 	u32 bus_flags;
@@ -372,11 +370,6 @@ struct omap_dss_device {
 	unsigned int of_port;
 };
 
-struct omap_dss_driver {
-	int (*update)(struct omap_dss_device *dssdev,
-			       u16 x, u16 y, u16 w, u16 h);
-};
-
 struct dss_device *omapdss_get_dss(void);
 void omapdss_set_dss(struct dss_device *dss);
 static inline bool omapdss_is_initialized(void)
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index dac9ccda98df..3068e4fffa16 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -362,10 +362,8 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
 {
 	struct omap_crtc *omap_crtc =
 			container_of(data, struct omap_crtc, update_work.work);
-	struct drm_display_mode *mode = &omap_crtc->pipe->crtc->mode;
-	struct omap_dss_device *dssdev = omap_crtc->pipe->output->next;
+	struct omap_dss_device *dssdev = omap_crtc->pipe->output;
 	struct drm_device *dev = omap_crtc->base.dev;
-	const struct omap_dss_driver *dssdrv;
 	int ret;
 
 	if (!dssdev) {
@@ -373,13 +371,12 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
 		return;
 	}
 
-	dssdrv = dssdev->driver;
-	if (!dssdrv || !dssdrv->update) {
-		dev_err_once(dev->dev, "missing or incorrect dssdrv!");
+	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI || !dssdev->ops->dsi.update) {
+		dev_err_once(dev->dev, "no DSI update callback found!");
 		return;
 	}
 
-	ret = dssdrv->update(dssdev, 0, 0, mode->hdisplay, mode->vdisplay);
+	ret = dssdev->ops->dsi.update(dssdev);
 	if (ret < 0) {
 		spin_lock_irq(&dev->event_lock);
 		omap_crtc->pending = false;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This moves the panel refresh/update function from the panel
driver into the DSI host driver to prepare for common drm_panel
support.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  68 ------------
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 101 ++++++++++++++++--
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |  13 +--
 drivers/gpu/drm/omapdrm/omap_crtc.c           |  11 +-
 4 files changed, 97 insertions(+), 96 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 030a8fa140db..1582960f9e90 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
 	return 0;
 }
 
-static int dsicm_set_update_window(struct panel_drv_data *ddata,
-		u16 x, u16 y, u16 w, u16 h)
-{
-	struct mipi_dsi_device *dsi = ddata->dsi;
-	int r;
-	u16 x1 = x;
-	u16 x2 = x + w - 1;
-	u16 y1 = y;
-	u16 y2 = y + h - 1;
-
-	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
-	if (r < 0)
-		return r;
-
-	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
-	if (r < 0)
-		return r;
-
-	return 0;
-}
-
 static int dsicm_bl_update_status(struct backlight_device *dev)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
@@ -470,48 +449,6 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
 	mutex_unlock(&ddata->lock);
 }
 
-static void dsicm_framedone_cb(int err, void *data)
-{
-	struct panel_drv_data *ddata = data;
-
-	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
-	mutex_unlock(&ddata->lock);
-}
-
-static int dsicm_update(struct omap_dss_device *dssdev,
-				    u16 x, u16 y, u16 w, u16 h)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
-	int r;
-
-	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
-
-	mutex_lock(&ddata->lock);
-
-	if (!ddata->enabled) {
-		r = 0;
-		goto err;
-	}
-
-	/* XXX no need to send this every frame, but dsi break if not done */
-	r = dsicm_set_update_window(ddata, 0, 0, ddata->vm.hactive,
-				    ddata->vm.vactive);
-	if (r)
-		goto err;
-
-	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
-			ddata);
-	if (r)
-		goto err;
-
-	/* note: no unlock here. unlock is src framedone_cb */
-	return 0;
-err:
-	mutex_unlock(&ddata->lock);
-	return r;
-}
-
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
 	struct mipi_dsi_device *dsi = ddata->dsi;
@@ -572,10 +509,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
 	.check_timings	= dsicm_check_timings,
 };
 
-static const struct omap_dss_driver dsicm_dss_driver = {
-	.update		= dsicm_update,
-};
-
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 {
 	struct device_node *node = dsi->dev.of_node;
@@ -658,7 +591,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	dssdev = &ddata->dssdev;
 	dssdev->dev = dev;
 	dssdev->ops = &dsicm_ops;
-	dssdev->driver = &dsicm_dss_driver;
 	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
 	dssdev->display = true;
 	dssdev->owner = THIS_MODULE;
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 0f264654792d..0aa0d21cf896 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -214,6 +214,9 @@ static void dsi_display_uninit_dispc(struct dsi_data *dsi);
 
 static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
 
+static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
+				       const struct mipi_dsi_msg *msg);
+
 /* DSI PLL HSDIV indices */
 #define HSDIV_DISPC	0
 #define HSDIV_DSI	1
@@ -383,9 +386,6 @@ struct dsi_data {
 
 	struct delayed_work ulps_work;
 
-	void (*framedone_callback)(int, void *);
-	void *framedone_data;
-
 	struct delayed_work framedone_timeout_work;
 
 #ifdef DSI_CATCH_MISSING_TE
@@ -3802,8 +3802,6 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
 	dsi_set_ulps_auto(dsi, true);
 	dsi_bus_unlock(dsi);
 
-	dsi->framedone_callback(error, dsi->framedone_data);
-
 	if (!error)
 		dsi_perf_show(dsi, "DISPC");
 }
@@ -3835,6 +3833,8 @@ static void dsi_framedone_irq_callback(void *data)
 
 	cancel_delayed_work(&dsi->framedone_timeout_work);
 
+	DSSDBG("Framedone received!\n");
+
 	dsi_handle_framedone(dsi, 0);
 }
 
@@ -3856,17 +3856,69 @@ static int _dsi_update(struct dsi_data *dsi)
 	return 0;
 }
 
-static int dsi_update(struct omap_dss_device *dssdev, int channel,
-		void (*callback)(int, void *), void *data)
+static int _dsi_update_window(struct dsi_data *dsi, int channel,
+			      int x, int y, int w, int h)
+{
+	int x1 = x, x2 = (x + w - 1);
+	int y1 = y, y2 = (y + h - 1);
+	u8 payloadX[5] = { MIPI_DCS_SET_COLUMN_ADDRESS,
+			   x1 >> 8, x1 & 0xff, x2 >> 8, x2 & 0xff };
+	u8 payloadY[5] = { MIPI_DCS_SET_PAGE_ADDRESS,
+			   y1 >> 8, y1 & 0xff, y2 >> 8, y2 & 0xff };
+	struct mipi_dsi_msg msgX = { 0 }, msgY = { 0 };
+	int ret;
+
+	WARN_ON(!dsi_bus_is_locked(dsi));
+
+	msgX.type = MIPI_DSI_DCS_LONG_WRITE;
+	msgX.channel = channel;
+	msgX.tx_buf = payloadX;
+	msgX.tx_len = sizeof(payloadX);
+
+	msgY.type = MIPI_DSI_DCS_LONG_WRITE;
+	msgY.channel = channel;
+	msgY.tx_buf = payloadY;
+	msgY.tx_len = sizeof(payloadY);
+
+	ret = _omap_dsi_host_transfer(dsi, &msgX);
+	if (ret != 0)
+		return ret;
+
+	return _omap_dsi_host_transfer(dsi, &msgY);
+}
+
+static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
+	int r;
+
+	if (channel > 3)
+		return -EINVAL;
 
 	dsi_bus_lock(dsi);
+
+	if (!dsi->vc[channel].dest) {
+		r = -ENODEV;
+		goto err;
+	}
+
+	if (dsi->vm.hactive == 0 || dsi->vm.vactive == 0) {
+		r = -EINVAL;
+		goto err;
+	}
+
+	DSSDBG("dsi_update_channel: %d", channel);
+
 	dsi_set_ulps_auto(dsi, false);
 
+	r = _dsi_update_window(dsi, channel, 0, 0, dsi->vm.hactive,
+			       dsi->vm.vactive);
+	if (r < 0) {
+		DSSWARN("window update error: %d\n", r);
+		goto err;
+	}
+
 	dsi->update_channel = channel;
-	dsi->framedone_callback = callback;
-	dsi->framedone_data = data;
 
 	if (dsi->te_enabled && dsi->te_gpio) {
 		schedule_delayed_work(&dsi->te_timeout_work,
@@ -3877,6 +3929,24 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
 	}
 
 	return 0;
+
+err:
+	dsi_set_ulps_auto(dsi, true);
+	dsi_bus_unlock(dsi);
+	return r;
+}
+
+static int dsi_update_all(struct omap_dss_device *dssdev)
+{
+	int i, r;
+
+	for (i = 0; i < 4; i++) {
+		r = dsi_update_channel(dssdev, i);
+		if (r != -ENODEV)
+			return r;
+	}
+
+	return r;
 }
 
 /* Display funcs */
@@ -4095,7 +4165,9 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 	DSSDBG("dsi_display_enable\n");
+	dsi_bus_lock(dsi);
 	dsi_display_ulps_enable(dsi);
+	dsi_bus_unlock(dsi);
 }
 
 static void dsi_display_ulps_disable(struct dsi_data *dsi,
@@ -4123,7 +4195,9 @@ static void dsi_display_disable(struct omap_dss_device *dssdev)
 
 	DSSDBG("dsi_display_disable\n");
 
+	dsi_bus_lock(dsi);
 	dsi_display_ulps_disable(dsi, true, false);
+	dsi_bus_unlock(dsi);
 }
 
 static int dsi_enable_te(struct dsi_data *dsi, bool enable)
@@ -4872,7 +4946,7 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.enable_video_output = dsi_enable_video_output,
 		.disable_video_output = dsi_disable_video_output,
 
-		.update = dsi_update,
+		.update = dsi_update_all,
 	},
 };
 
@@ -4973,14 +5047,18 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 		return -EINVAL;
 	}
 
+	dsi_bus_lock(dsi);
+
 	atomic_set(&dsi->do_ext_te_update, 0);
 
 	if (client->mode_flags & MIPI_DSI_MODE_VIDEO) {
 		dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
 	} else {
 		r = omap_dsi_register_te_irq(dsi, client);
-		if (r)
+		if (r) {
+			dsi_bus_unlock(dsi);
 			return r;
+		}
 
 		dsi->mode = OMAP_DSS_DSI_CMD_MODE;
 	}
@@ -4994,6 +5072,7 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 	dsi->ulps_auto_idle = !!(client->mode_flags & MIPI_DSI_MODE_ULPS_IDLE);
 	dsi_set_ulps_auto(dsi, true);
 
+	dsi_bus_unlock(dsi);
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 524cb87cd9ea..de4c779c358a 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -281,13 +281,12 @@ struct omap_dss_writeback_info {
 };
 
 struct omapdss_dsi_ops {
-	/* bus configuration */
+	int (*update)(struct omap_dss_device *dssdev);
+
+	/* legacy API used by omapdss panels */
 	int (*set_config)(struct omap_dss_device *dssdev,
 			const struct omap_dss_dsi_config *cfg);
 
-	int (*update)(struct omap_dss_device *dssdev, int channel,
-			void (*callback)(int, void *), void *data);
-
 	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
 	void (*disable_video_output)(struct omap_dss_device *dssdev,
 			int channel);
@@ -351,7 +350,6 @@ struct omap_dss_device {
 
 	const char *name;
 
-	const struct omap_dss_driver *driver;
 	const struct omap_dss_device_ops *ops;
 	unsigned long ops_flags;
 	u32 bus_flags;
@@ -372,11 +370,6 @@ struct omap_dss_device {
 	unsigned int of_port;
 };
 
-struct omap_dss_driver {
-	int (*update)(struct omap_dss_device *dssdev,
-			       u16 x, u16 y, u16 w, u16 h);
-};
-
 struct dss_device *omapdss_get_dss(void);
 void omapdss_set_dss(struct dss_device *dss);
 static inline bool omapdss_is_initialized(void)
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index dac9ccda98df..3068e4fffa16 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -362,10 +362,8 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
 {
 	struct omap_crtc *omap_crtc =
 			container_of(data, struct omap_crtc, update_work.work);
-	struct drm_display_mode *mode = &omap_crtc->pipe->crtc->mode;
-	struct omap_dss_device *dssdev = omap_crtc->pipe->output->next;
+	struct omap_dss_device *dssdev = omap_crtc->pipe->output;
 	struct drm_device *dev = omap_crtc->base.dev;
-	const struct omap_dss_driver *dssdrv;
 	int ret;
 
 	if (!dssdev) {
@@ -373,13 +371,12 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
 		return;
 	}
 
-	dssdrv = dssdev->driver;
-	if (!dssdrv || !dssdrv->update) {
-		dev_err_once(dev->dev, "missing or incorrect dssdrv!");
+	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI || !dssdev->ops->dsi.update) {
+		dev_err_once(dev->dev, "no DSI update callback found!");
 		return;
 	}
 
-	ret = dssdrv->update(dssdev, 0, 0, mode->hdisplay, mode->vdisplay);
+	ret = dssdev->ops->dsi.update(dssdev);
 	if (ret < 0) {
 		spin_lock_irq(&dev->event_lock);
 		omap_crtc->pending = false;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 31/56] drm/omap: dsi: Reverse direction of the DSS device enable/disable operations
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Complete the direction reversal of the DSS device enable/disable
operations started by 19b4200d8f4b ("drm/omap: Reverse direction
of the DSS device enable/disable operations").

This effectively drops the requirement of calling DSS specific
code from the DSI panel driver moving it a bit further to a
standard drm_panel driver.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 74 +++++++++----------
 drivers/gpu/drm/omapdrm/omap_encoder.c        | 24 ++----
 2 files changed, 45 insertions(+), 53 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 1582960f9e90..45d417870498 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -288,27 +288,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	struct omap_dss_device *src = ddata->src;
 	u8 id1, id2, id3;
 	int r;
-	struct omap_dss_dsi_config dsi_config = {
-		.vm = &ddata->vm,
-		.hs_clk_min = 150000000,
-		.hs_clk_max = 300000000,
-		.lp_clk_min = 7000000,
-		.lp_clk_max = 10000000,
-	};
-
-	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
-	if (r) {
-		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
-		return r;
-	}
-
-	r = src->ops->dsi.set_config(src, &dsi_config);
-	if (r) {
-		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
-		goto err_regulators;
-	}
-
-	src->ops->enable(src);
 
 	dsicm_hw_reset(ddata);
 
@@ -363,12 +342,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
 	dsicm_hw_reset(ddata);
 
-	src->ops->disable(src);
-err_regulators:
-	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
-	if (r)
-		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
-
 	return r;
 }
 
@@ -377,6 +350,8 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 	struct omap_dss_device *src = ddata->src;
 	int r;
 
+	ddata->enabled = false;
+
 	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
 
 	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
@@ -388,14 +363,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 				"error disabling panel, issuing HW reset\n");
 		dsicm_hw_reset(ddata);
 	}
-
-	src->ops->disable(src);
-
-	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
-	if (r)
-		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
-
-	ddata->enabled = false;
 }
 
 static int dsicm_connect(struct omap_dss_device *src,
@@ -415,6 +382,29 @@ static void dsicm_disconnect(struct omap_dss_device *src,
 	ddata->src = NULL;
 }
 
+static void dsicm_pre_enable(struct omap_dss_device *dssdev)
+{
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	struct omap_dss_device *src = ddata->src;
+	int r;
+	struct omap_dss_dsi_config dsi_config = {
+		.vm = &ddata->vm,
+		.hs_clk_min = 150000000,
+		.hs_clk_max = 300000000,
+		.lp_clk_min = 7000000,
+		.lp_clk_max = 10000000,
+	};
+
+	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+	if (r)
+		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
+
+	r = src->ops->dsi.set_config(src, &dsi_config);
+	if (r) {
+		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
+	}
+}
+
 static void dsicm_enable(struct omap_dss_device *dssdev)
 {
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
@@ -449,6 +439,16 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
 	mutex_unlock(&ddata->lock);
 }
 
+static void dsicm_post_disable(struct omap_dss_device *dssdev)
+{
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	int r;
+
+	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+	if (r)
+		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
+}
+
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
 	struct mipi_dsi_device *dsi = ddata->dsi;
@@ -502,8 +502,10 @@ static const struct omap_dss_device_ops dsicm_ops = {
 	.connect	= dsicm_connect,
 	.disconnect	= dsicm_disconnect,
 
+	.pre_enable	= dsicm_pre_enable,
 	.enable		= dsicm_enable,
 	.disable	= dsicm_disable,
+	.post_disable	= dsicm_post_disable,
 
 	.get_modes	= dsicm_get_modes,
 	.check_timings	= dsicm_check_timings,
@@ -664,8 +666,6 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
 
 	omapdss_device_unregister(dssdev);
 
-	if (omapdss_device_is_enabled(dssdev))
-		dsicm_disable(dssdev);
 	omapdss_device_disconnect(ddata->src, dssdev);
 
 	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 18a79dde6815..10abe4d01b0b 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -137,15 +137,11 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
 	omapdss_device_disable(dssdev->next);
 
 	/*
-	 * Disable the internal encoder. This will disable the DSS output. The
-	 * DSI is treated as an exception as DSI pipelines still use the legacy
-	 * flow where the pipeline output controls the encoder.
+	 * Disable the internal encoder. This will disable the DSS output.
 	 */
-	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
-		if (dssdev->ops && dssdev->ops->disable)
-			dssdev->ops->disable(dssdev);
-		dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
-	}
+	if (dssdev->ops && dssdev->ops->disable)
+		dssdev->ops->disable(dssdev);
+	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
 
 	/*
 	 * Perform the post-disable operations on the chain of external devices
@@ -166,15 +162,11 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
 	omapdss_device_pre_enable(dssdev->next);
 
 	/*
-	 * Enable the internal encoder. This will enable the DSS output. The
-	 * DSI is treated as an exception as DSI pipelines still use the legacy
-	 * flow where the pipeline output controls the encoder.
+	 * Enable the internal encoder. This will enable the DSS output.
 	 */
-	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
-		if (dssdev->ops && dssdev->ops->enable)
-			dssdev->ops->enable(dssdev);
-		dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
-	}
+	if (dssdev->ops && dssdev->ops->enable)
+		dssdev->ops->enable(dssdev);
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
 	/*
 	 * Enable the chain of external devices, starting at the one at the
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 31/56] drm/omap: dsi: Reverse direction of the DSS device enable/disable operations
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Complete the direction reversal of the DSS device enable/disable
operations started by 19b4200d8f4b ("drm/omap: Reverse direction
of the DSS device enable/disable operations").

This effectively drops the requirement of calling DSS specific
code from the DSI panel driver moving it a bit further to a
standard drm_panel driver.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 74 +++++++++----------
 drivers/gpu/drm/omapdrm/omap_encoder.c        | 24 ++----
 2 files changed, 45 insertions(+), 53 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 1582960f9e90..45d417870498 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -288,27 +288,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	struct omap_dss_device *src = ddata->src;
 	u8 id1, id2, id3;
 	int r;
-	struct omap_dss_dsi_config dsi_config = {
-		.vm = &ddata->vm,
-		.hs_clk_min = 150000000,
-		.hs_clk_max = 300000000,
-		.lp_clk_min = 7000000,
-		.lp_clk_max = 10000000,
-	};
-
-	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
-	if (r) {
-		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
-		return r;
-	}
-
-	r = src->ops->dsi.set_config(src, &dsi_config);
-	if (r) {
-		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
-		goto err_regulators;
-	}
-
-	src->ops->enable(src);
 
 	dsicm_hw_reset(ddata);
 
@@ -363,12 +342,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 
 	dsicm_hw_reset(ddata);
 
-	src->ops->disable(src);
-err_regulators:
-	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
-	if (r)
-		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
-
 	return r;
 }
 
@@ -377,6 +350,8 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 	struct omap_dss_device *src = ddata->src;
 	int r;
 
+	ddata->enabled = false;
+
 	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
 
 	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
@@ -388,14 +363,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 				"error disabling panel, issuing HW reset\n");
 		dsicm_hw_reset(ddata);
 	}
-
-	src->ops->disable(src);
-
-	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
-	if (r)
-		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
-
-	ddata->enabled = false;
 }
 
 static int dsicm_connect(struct omap_dss_device *src,
@@ -415,6 +382,29 @@ static void dsicm_disconnect(struct omap_dss_device *src,
 	ddata->src = NULL;
 }
 
+static void dsicm_pre_enable(struct omap_dss_device *dssdev)
+{
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	struct omap_dss_device *src = ddata->src;
+	int r;
+	struct omap_dss_dsi_config dsi_config = {
+		.vm = &ddata->vm,
+		.hs_clk_min = 150000000,
+		.hs_clk_max = 300000000,
+		.lp_clk_min = 7000000,
+		.lp_clk_max = 10000000,
+	};
+
+	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+	if (r)
+		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
+
+	r = src->ops->dsi.set_config(src, &dsi_config);
+	if (r) {
+		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
+	}
+}
+
 static void dsicm_enable(struct omap_dss_device *dssdev)
 {
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
@@ -449,6 +439,16 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
 	mutex_unlock(&ddata->lock);
 }
 
+static void dsicm_post_disable(struct omap_dss_device *dssdev)
+{
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	int r;
+
+	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+	if (r)
+		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
+}
+
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 {
 	struct mipi_dsi_device *dsi = ddata->dsi;
@@ -502,8 +502,10 @@ static const struct omap_dss_device_ops dsicm_ops = {
 	.connect	= dsicm_connect,
 	.disconnect	= dsicm_disconnect,
 
+	.pre_enable	= dsicm_pre_enable,
 	.enable		= dsicm_enable,
 	.disable	= dsicm_disable,
+	.post_disable	= dsicm_post_disable,
 
 	.get_modes	= dsicm_get_modes,
 	.check_timings	= dsicm_check_timings,
@@ -664,8 +666,6 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
 
 	omapdss_device_unregister(dssdev);
 
-	if (omapdss_device_is_enabled(dssdev))
-		dsicm_disable(dssdev);
 	omapdss_device_disconnect(ddata->src, dssdev);
 
 	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 18a79dde6815..10abe4d01b0b 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -137,15 +137,11 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
 	omapdss_device_disable(dssdev->next);
 
 	/*
-	 * Disable the internal encoder. This will disable the DSS output. The
-	 * DSI is treated as an exception as DSI pipelines still use the legacy
-	 * flow where the pipeline output controls the encoder.
+	 * Disable the internal encoder. This will disable the DSS output.
 	 */
-	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
-		if (dssdev->ops && dssdev->ops->disable)
-			dssdev->ops->disable(dssdev);
-		dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
-	}
+	if (dssdev->ops && dssdev->ops->disable)
+		dssdev->ops->disable(dssdev);
+	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
 
 	/*
 	 * Perform the post-disable operations on the chain of external devices
@@ -166,15 +162,11 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
 	omapdss_device_pre_enable(dssdev->next);
 
 	/*
-	 * Enable the internal encoder. This will enable the DSS output. The
-	 * DSI is treated as an exception as DSI pipelines still use the legacy
-	 * flow where the pipeline output controls the encoder.
+	 * Enable the internal encoder. This will enable the DSS output.
 	 */
-	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
-		if (dssdev->ops && dssdev->ops->enable)
-			dssdev->ops->enable(dssdev);
-		dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
-	}
+	if (dssdev->ops && dssdev->ops->enable)
+		dssdev->ops->enable(dssdev);
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
 	/*
 	 * Enable the chain of external devices, starting at the one at the
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 32/56] drm/omap: dsi: drop custom panel capability support
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Due to previous changes the DSI encoder gets the capabilities
via DSI client's mode_flags and no longer needs the omapdss
specific caps. The core code now checks if the DSI encoder
is actually configured into command mode instead of just checking
the panel capabilities.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  3 ---
 drivers/gpu/drm/omapdrm/dss/dsi.c               |  8 ++++++++
 drivers/gpu/drm/omapdrm/dss/omapdss.h           |  8 +-------
 drivers/gpu/drm/omapdrm/omap_crtc.c             | 17 ++++++++---------
 4 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 45d417870498..d9b3444b4faf 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -599,9 +599,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	dssdev->of_port = 0;
 	dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
 
-	dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
-		OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;
-
 	omapdss_display_init(dssdev);
 	omapdss_device_register(dssdev);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 0aa0d21cf896..620cef8bb1f2 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4727,6 +4727,13 @@ static bool dsi_vm_calc(struct dsi_data *dsi,
 			dsi_vm_calc_pll_cb, ctx);
 }
 
+static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+
+	return (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE);
+}
+
 static int dsi_set_config(struct omap_dss_device *dssdev,
 		const struct omap_dss_dsi_config *config)
 {
@@ -4947,6 +4954,7 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.disable_video_output = dsi_disable_video_output,
 
 		.update = dsi_update_all,
+		.is_video_mode = dsi_is_video_mode,
 	},
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index de4c779c358a..4200611525d5 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -123,11 +123,6 @@ enum omap_dss_dsi_mode {
 	OMAP_DSS_DSI_VIDEO_MODE,
 };
 
-enum omap_display_caps {
-	OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE	= 1 << 0,
-	OMAP_DSS_DISPLAY_CAP_TEAR_ELIM		= 1 << 1,
-};
-
 enum omap_dss_display_state {
 	OMAP_DSS_DISPLAY_DISABLED = 0,
 	OMAP_DSS_DISPLAY_ACTIVE,
@@ -282,6 +277,7 @@ struct omap_dss_writeback_info {
 
 struct omapdss_dsi_ops {
 	int (*update)(struct omap_dss_device *dssdev);
+	bool (*is_video_mode)(struct omap_dss_device *dssdev);
 
 	/* legacy API used by omapdss panels */
 	int (*set_config)(struct omap_dss_device *dssdev,
@@ -354,8 +350,6 @@ struct omap_dss_device {
 	unsigned long ops_flags;
 	u32 bus_flags;
 
-	enum omap_display_caps caps;
-
 	enum omap_dss_display_state state;
 
 	/* OMAP DSS output specific fields */
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 3068e4fffa16..f6b968060cf0 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -496,8 +496,7 @@ static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
 	 * valid DISPC mode. DSI will calculate and configure the
 	 * proper DISPC mode later.
 	 */
-	if (omap_crtc->pipe->output->next == NULL ||
-	    omap_crtc->pipe->output->next->type != OMAP_DISPLAY_TYPE_DSI) {
+	if (omap_crtc->pipe->output->type != OMAP_DISPLAY_TYPE_DSI) {
 		r = priv->dispc_ops->mgr_check_timings(priv->dispc,
 						       omap_crtc->channel,
 						       &vm);
@@ -549,17 +548,17 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc)
 static bool omap_crtc_is_manually_updated(struct drm_crtc *crtc)
 {
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
-	struct omap_dss_device *display = omap_crtc->pipe->output->next;
+	struct omap_dss_device *dssdev = omap_crtc->pipe->output;
 
-	if (!display)
+	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
+	    !dssdev->ops->dsi.is_video_mode)
 		return false;
 
-	if (display->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) {
-		DBG("detected manually updated display!");
-		return true;
-	}
+	if (dssdev->ops->dsi.is_video_mode(dssdev))
+		return false;
 
-	return false;
+	DBG("detected manually updated display!");
+	return true;
 }
 
 static int omap_crtc_atomic_check(struct drm_crtc *crtc,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 32/56] drm/omap: dsi: drop custom panel capability support
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Due to previous changes the DSI encoder gets the capabilities
via DSI client's mode_flags and no longer needs the omapdss
specific caps. The core code now checks if the DSI encoder
is actually configured into command mode instead of just checking
the panel capabilities.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  3 ---
 drivers/gpu/drm/omapdrm/dss/dsi.c               |  8 ++++++++
 drivers/gpu/drm/omapdrm/dss/omapdss.h           |  8 +-------
 drivers/gpu/drm/omapdrm/omap_crtc.c             | 17 ++++++++---------
 4 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 45d417870498..d9b3444b4faf 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -599,9 +599,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	dssdev->of_port = 0;
 	dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
 
-	dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
-		OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;
-
 	omapdss_display_init(dssdev);
 	omapdss_device_register(dssdev);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 0aa0d21cf896..620cef8bb1f2 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4727,6 +4727,13 @@ static bool dsi_vm_calc(struct dsi_data *dsi,
 			dsi_vm_calc_pll_cb, ctx);
 }
 
+static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+
+	return (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE);
+}
+
 static int dsi_set_config(struct omap_dss_device *dssdev,
 		const struct omap_dss_dsi_config *config)
 {
@@ -4947,6 +4954,7 @@ static const struct omap_dss_device_ops dsi_ops = {
 		.disable_video_output = dsi_disable_video_output,
 
 		.update = dsi_update_all,
+		.is_video_mode = dsi_is_video_mode,
 	},
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index de4c779c358a..4200611525d5 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -123,11 +123,6 @@ enum omap_dss_dsi_mode {
 	OMAP_DSS_DSI_VIDEO_MODE,
 };
 
-enum omap_display_caps {
-	OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE	= 1 << 0,
-	OMAP_DSS_DISPLAY_CAP_TEAR_ELIM		= 1 << 1,
-};
-
 enum omap_dss_display_state {
 	OMAP_DSS_DISPLAY_DISABLED = 0,
 	OMAP_DSS_DISPLAY_ACTIVE,
@@ -282,6 +277,7 @@ struct omap_dss_writeback_info {
 
 struct omapdss_dsi_ops {
 	int (*update)(struct omap_dss_device *dssdev);
+	bool (*is_video_mode)(struct omap_dss_device *dssdev);
 
 	/* legacy API used by omapdss panels */
 	int (*set_config)(struct omap_dss_device *dssdev,
@@ -354,8 +350,6 @@ struct omap_dss_device {
 	unsigned long ops_flags;
 	u32 bus_flags;
 
-	enum omap_display_caps caps;
-
 	enum omap_dss_display_state state;
 
 	/* OMAP DSS output specific fields */
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 3068e4fffa16..f6b968060cf0 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -496,8 +496,7 @@ static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
 	 * valid DISPC mode. DSI will calculate and configure the
 	 * proper DISPC mode later.
 	 */
-	if (omap_crtc->pipe->output->next == NULL ||
-	    omap_crtc->pipe->output->next->type != OMAP_DISPLAY_TYPE_DSI) {
+	if (omap_crtc->pipe->output->type != OMAP_DISPLAY_TYPE_DSI) {
 		r = priv->dispc_ops->mgr_check_timings(priv->dispc,
 						       omap_crtc->channel,
 						       &vm);
@@ -549,17 +548,17 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc)
 static bool omap_crtc_is_manually_updated(struct drm_crtc *crtc)
 {
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
-	struct omap_dss_device *display = omap_crtc->pipe->output->next;
+	struct omap_dss_device *dssdev = omap_crtc->pipe->output;
 
-	if (!display)
+	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
+	    !dssdev->ops->dsi.is_video_mode)
 		return false;
 
-	if (display->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) {
-		DBG("detected manually updated display!");
-		return true;
-	}
+	if (dssdev->ops->dsi.is_video_mode(dssdev))
+		return false;
 
-	return false;
+	DBG("detected manually updated display!");
+	return true;
 }
 
 static int omap_crtc_atomic_check(struct drm_crtc *crtc,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 33/56] drm/omap: dsi: convert to drm_panel
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This converts the DSI module to expect common drm_panel display
drivers instead of dssdev based ones.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 204 +++++++-----------
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 133 ++++++++++--
 .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |   1 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |   8 -
 4 files changed, 189 insertions(+), 157 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index d9b3444b4faf..3668b3f0aff2 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -6,8 +6,6 @@
  * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
  */
 
-/* #define DEBUG */
-
 #include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
@@ -20,11 +18,14 @@
 #include <linux/regulator/consumer.h>
 
 #include <drm/drm_connector.h>
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_panel.h>
+#include <drm/drm_modes.h>
 
+#include <video/display_timing.h>
 #include <video/mipi_display.h>
 #include <video/of_display_timing.h>
-
-#include "../dss/omapdss.h"
+#include <video/videomode.h>
 
 #define DCS_READ_NUM_ERRORS	0x05
 #define DCS_GET_ID1		0xda
@@ -35,11 +36,8 @@
 
 struct panel_drv_data {
 	struct mipi_dsi_device *dsi;
-
-	struct omap_dss_device dssdev;
-	struct omap_dss_device *src;
-
-	struct videomode vm;
+	struct drm_panel panel;
+	struct drm_display_mode mode;
 
 	struct mutex lock;
 
@@ -71,7 +69,11 @@ struct panel_drv_data {
 	bool ulps_enabled;
 };
 
-#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
+
+static inline struct panel_drv_data *panel_to_ddata(struct drm_panel *panel)
+{
+	return container_of(panel, struct panel_drv_data, panel);
+}
 
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
 
@@ -285,7 +287,6 @@ static void dsicm_hw_reset(struct panel_drv_data *ddata)
 
 static int dsicm_power_on(struct panel_drv_data *ddata)
 {
-	struct omap_dss_device *src = ddata->src;
 	u8 id1, id2, id3;
 	int r;
 
@@ -322,10 +323,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	if (r)
 		goto err;
 
-	r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
-	if (r)
-		goto err;
-
 	ddata->enabled = true;
 
 	if (!ddata->intro_printed) {
@@ -345,15 +342,12 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	return r;
 }
 
-static void dsicm_power_off(struct panel_drv_data *ddata)
+static int dsicm_power_off(struct panel_drv_data *ddata)
 {
-	struct omap_dss_device *src = ddata->src;
 	int r;
 
 	ddata->enabled = false;
 
-	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
-
 	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
 	if (!r)
 		r = dsicm_sleep_in(ddata);
@@ -363,51 +357,25 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 				"error disabling panel, issuing HW reset\n");
 		dsicm_hw_reset(ddata);
 	}
-}
-
-static int dsicm_connect(struct omap_dss_device *src,
-			 struct omap_dss_device *dst)
-{
-	struct panel_drv_data *ddata = to_panel_data(dst);
-
-	ddata->src = src;
-	return 0;
-}
-
-static void dsicm_disconnect(struct omap_dss_device *src,
-			     struct omap_dss_device *dst)
-{
-	struct panel_drv_data *ddata = to_panel_data(dst);
 
-	ddata->src = NULL;
+	return r;
 }
 
-static void dsicm_pre_enable(struct omap_dss_device *dssdev)
+static int dsicm_prepare(struct drm_panel *panel)
 {
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
+	struct panel_drv_data *ddata = panel_to_ddata(panel);
 	int r;
-	struct omap_dss_dsi_config dsi_config = {
-		.vm = &ddata->vm,
-		.hs_clk_min = 150000000,
-		.hs_clk_max = 300000000,
-		.lp_clk_min = 7000000,
-		.lp_clk_max = 10000000,
-	};
 
 	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
 	if (r)
 		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
 
-	r = src->ops->dsi.set_config(src, &dsi_config);
-	if (r) {
-		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
-	}
+	return r;
 }
 
-static void dsicm_enable(struct omap_dss_device *dssdev)
+static int dsicm_enable(struct drm_panel *panel)
 {
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	struct panel_drv_data *ddata = panel_to_ddata(panel);
 	int r;
 
 	mutex_lock(&ddata->lock);
@@ -420,33 +388,39 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
 
 	dsicm_bl_power(ddata, true);
 
-	return;
+	return 0;
 err:
-	dev_dbg(&ddata->dsi->dev, "enable failed (%d)\n", r);
+	dev_err(&ddata->dsi->dev, "enable failed (%d)\n", r);
 	mutex_unlock(&ddata->lock);
+	return r;
+}
+
+static int dsicm_unprepare(struct drm_panel *panel)
+{
+	struct panel_drv_data *ddata = panel_to_ddata(panel);
+	int r;
+
+	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+	if (r)
+		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
+
+	return r;
 }
 
-static void dsicm_disable(struct omap_dss_device *dssdev)
+static int dsicm_disable(struct drm_panel *panel)
 {
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	struct panel_drv_data *ddata = panel_to_ddata(panel);
+	int r;
 
 	dsicm_bl_power(ddata, false);
 
 	mutex_lock(&ddata->lock);
 
-	dsicm_power_off(ddata);
+	r = dsicm_power_off(ddata);
 
 	mutex_unlock(&ddata->lock);
-}
-
-static void dsicm_post_disable(struct omap_dss_device *dssdev)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	int r;
 
-	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
-	if (r)
-		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
+	return r;
 }
 
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
@@ -465,50 +439,37 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 	return r;
 }
 
-static int dsicm_get_modes(struct omap_dss_device *dssdev,
+static int dsicm_get_modes(struct drm_panel *panel,
 			   struct drm_connector *connector)
 {
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	struct panel_drv_data *ddata = panel_to_ddata(panel);
+	struct drm_display_mode *mode;
+
+	mode = drm_mode_duplicate(connector->dev, &ddata->mode);
+	if (!mode) {
+		dev_err(&ddata->dsi->dev, "failed to add mode %ux%ux@%u kHz\n",
+			ddata->mode.hdisplay, ddata->mode.vdisplay,
+			ddata->mode.clock);
+		return -ENOMEM;
+	}
+
+	drm_mode_set_name(mode);
+	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
 
 	connector->display_info.width_mm = ddata->width_mm;
 	connector->display_info.height_mm = ddata->height_mm;
 
-	return omapdss_display_get_modes(connector, &ddata->vm);
-}
-
-static int dsicm_check_timings(struct omap_dss_device *dssdev,
-			       struct drm_display_mode *mode)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	int ret = 0;
-
-	if (mode->hdisplay != ddata->vm.hactive)
-		ret = -EINVAL;
-
-	if (mode->vdisplay != ddata->vm.vactive)
-		ret = -EINVAL;
+	drm_mode_probed_add(connector, mode);
 
-	if (ret) {
-		dev_warn(dssdev->dev, "wrong resolution: %d x %d",
-			 mode->hdisplay, mode->vdisplay);
-		dev_warn(dssdev->dev, "panel resolution: %d x %d",
-			 ddata->vm.hactive, ddata->vm.vactive);
-	}
-
-	return ret;
+	return 1;
 }
 
-static const struct omap_dss_device_ops dsicm_ops = {
-	.connect	= dsicm_connect,
-	.disconnect	= dsicm_disconnect,
-
-	.pre_enable	= dsicm_pre_enable,
-	.enable		= dsicm_enable,
-	.disable	= dsicm_disable,
-	.post_disable	= dsicm_post_disable,
-
-	.get_modes	= dsicm_get_modes,
-	.check_timings	= dsicm_check_timings,
+static const struct drm_panel_funcs dsicm_panel_funcs = {
+	.unprepare = dsicm_unprepare,
+	.disable = dsicm_disable,
+	.prepare = dsicm_prepare,
+	.enable = dsicm_enable,
+	.get_modes = dsicm_get_modes,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
@@ -517,8 +478,12 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 	struct backlight_device *backlight;
 	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
 	struct display_timing timing;
+	struct videomode vm = { 0 };
 	int err;
 
+	vm.hactive = 864;
+	vm.vactive = 480;
+
 	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ddata->reset_gpio)) {
 		err = PTR_ERR(ddata->reset_gpio);
@@ -528,15 +493,16 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 
 	err = of_get_display_timing(node, "panel-timing", &timing);
 	if (!err) {
-		videomode_from_timing(&timing, &ddata->vm);
-		if (!ddata->vm.pixelclock)
-			ddata->vm.pixelclock =
-				ddata->vm.hactive * ddata->vm.vactive * 60;
+		videomode_from_timing(&timing, &vm);
 	} else {
 		dev_warn(&dsi->dev,
 			 "failed to get video timing, using defaults\n");
 	}
 
+	if (!vm.pixelclock)
+		vm.pixelclock = vm.hactive * vm.vactive * 60;
+	drm_display_mode_from_videomode(&vm, &ddata->mode);
+
 	ddata->width_mm = 0;
 	of_property_read_u32(node, "width-mm", &ddata->width_mm);
 
@@ -570,7 +536,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	struct panel_drv_data *ddata;
 	struct backlight_device *bldev = NULL;
 	struct device *dev = &dsi->dev;
-	struct omap_dss_device *dssdev;
 	int r;
 
 	dev_dbg(dev, "probe\n");
@@ -582,30 +547,17 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	mipi_dsi_set_drvdata(dsi, ddata);
 	ddata->dsi = dsi;
 
-	ddata->vm.hactive = 864;
-	ddata->vm.vactive = 480;
-	ddata->vm.pixelclock = 864 * 480 * 60;
-
 	r = dsicm_probe_of(dsi);
 	if (r)
 		return r;
 
-	dssdev = &ddata->dssdev;
-	dssdev->dev = dev;
-	dssdev->ops = &dsicm_ops;
-	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
-	dssdev->display = true;
-	dssdev->owner = THIS_MODULE;
-	dssdev->of_port = 0;
-	dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
-
-	omapdss_display_init(dssdev);
-	omapdss_device_register(dssdev);
-
 	mutex_init(&ddata->lock);
 
 	dsicm_hw_reset(ddata);
 
+	drm_panel_init(&ddata->panel, dev, &dsicm_panel_funcs,
+		       DRM_MODE_CONNECTOR_DSI);
+
 	if (ddata->use_dsi_backlight) {
 		struct backlight_properties props = { 0 };
 		props.max_brightness = 255;
@@ -637,6 +589,8 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	if (ddata->ulps_enabled)
 		dsi->mode_flags |= MIPI_DSI_MODE_ULPS_IDLE;
 
+	drm_panel_add(&ddata->panel);
+
 	r = mipi_dsi_attach(dsi);
 	if (r < 0)
 		goto err_dsi_attach;
@@ -644,6 +598,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	return 0;
 
 err_dsi_attach:
+	drm_panel_remove(&ddata->panel);
 	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
 err_bl:
 	if (ddata->extbldev)
@@ -655,15 +610,12 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
 {
 	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
-	struct omap_dss_device *dssdev = &ddata->dssdev;
 
 	dev_dbg(&dsi->dev, "remove\n");
 
 	mipi_dsi_detach(dsi);
 
-	omapdss_device_unregister(dssdev);
-
-	omapdss_device_disconnect(ddata->src, dssdev);
+	drm_panel_remove(&ddata->panel);
 
 	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
 
@@ -677,7 +629,7 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
 }
 
 static const struct of_device_id dsicm_of_match[] = {
-	{ .compatible = "omapdss,panel-dsi-cm", },
+	{ .compatible = "panel-dsi-cm", },
 	{},
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 620cef8bb1f2..a1a867a7d91d 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -36,6 +36,7 @@
 #include <linux/sys_soc.h>
 
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_panel.h>
 #include <video/mipi_display.h>
 
 #include "omapdss.h"
@@ -217,6 +218,8 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
 static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
 				       const struct mipi_dsi_msg *msg);
 
+static void dsi_display_disable(struct omap_dss_device *dssdev);
+
 /* DSI PLL HSDIV indices */
 #define HSDIV_DISPC	0
 #define HSDIV_DSI	1
@@ -383,6 +386,7 @@ struct dsi_data {
 	bool te_enabled;
 	bool ulps_enabled;
 	bool ulps_auto_idle;
+	bool video_enabled;
 
 	struct delayed_work ulps_work;
 
@@ -423,6 +427,8 @@ struct dsi_data {
 
 	unsigned int scp_clk_refcount;
 
+	struct omap_dss_dsi_config config;
+
 	struct dss_lcd_mgr_config mgr_config;
 	struct videomode vm;
 	enum mipi_dsi_pixel_format pix_fmt;
@@ -3622,7 +3628,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
 	return 0;
 }
 
-static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
+static void dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
@@ -3631,8 +3637,10 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 	int r;
 
 	r = dsi_display_init_dispc(dsi);
-	if (r)
-		return r;
+	if (r) {
+		dev_err(dsi->dev, "failed to init dispc!\n");
+		return;
+	}
 
 	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
 		switch (dsi->pix_fmt) {
@@ -3672,7 +3680,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 	if (r)
 		goto err_mgr_enable;
 
-	return 0;
+	return;
 
 err_mgr_enable:
 	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
@@ -3681,7 +3689,8 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 	}
 err_pix_fmt:
 	dsi_display_uninit_dispc(dsi);
-	return r;
+	dev_err(dsi->dev, "failed to enable DSI encoder!\n");
+	return;
 }
 
 static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel)
@@ -3704,6 +3713,25 @@ static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel
 	dsi_display_uninit_dispc(dsi);
 }
 
+static void dsi_disable_video_outputs(struct omap_dss_device *dssdev)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+	int i;
+
+	dsi_bus_lock(dsi);
+	dsi->video_enabled = false;
+
+	for (i = 0; i < 3; i++) {
+		if (!dsi->vc[i].dest)
+			continue;
+		dsi_disable_video_output(dssdev, i);
+	}
+
+	dsi_display_disable(dssdev);
+
+	dsi_bus_unlock(dsi);
+}
+
 static void dsi_update_screen_dispc(struct dsi_data *dsi)
 {
 	unsigned int bytespp;
@@ -3897,6 +3925,11 @@ static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
 
 	dsi_bus_lock(dsi);
 
+	if (!dsi->video_enabled) {
+		r = -EIO;
+		goto err;
+	}
+
 	if (!dsi->vc[channel].dest) {
 		r = -ENODEV;
 		goto err;
@@ -3942,7 +3975,7 @@ static int dsi_update_all(struct omap_dss_device *dssdev)
 
 	for (i = 0; i < 4; i++) {
 		r = dsi_update_channel(dssdev, i);
-		if (r != -ENODEV)
+		if (r && r != -ENODEV)
 			return r;
 	}
 
@@ -4165,8 +4198,30 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 	DSSDBG("dsi_display_enable\n");
-	dsi_bus_lock(dsi);
+	WARN_ON(!dsi_bus_is_locked(dsi));
+
 	dsi_display_ulps_enable(dsi);
+}
+
+static void dsi_enable_video_outputs(struct omap_dss_device *dssdev)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+	int i;
+
+	dsi_bus_lock(dsi);
+
+	dsi_display_enable(dssdev);
+
+	for (i = 0; i < 3; i++) {
+		if (!dsi->vc[i].dest)
+			continue;
+		dsi_enable_video_output(dssdev, i);
+	}
+
+	dsi->video_enabled = true;
+
+	dsi_set_ulps_auto(dsi, true);
+
 	dsi_bus_unlock(dsi);
 }
 
@@ -4193,11 +4248,11 @@ static void dsi_display_disable(struct omap_dss_device *dssdev)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 
+	WARN_ON(!dsi_bus_is_locked(dsi));
+
 	DSSDBG("dsi_display_disable\n");
 
-	dsi_bus_lock(dsi);
 	dsi_display_ulps_disable(dsi, true, false);
-	dsi_bus_unlock(dsi);
 }
 
 static int dsi_enable_te(struct dsi_data *dsi, bool enable)
@@ -4735,14 +4790,18 @@ static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
 }
 
 static int dsi_set_config(struct omap_dss_device *dssdev,
-		const struct omap_dss_dsi_config *config)
+		const struct drm_display_mode *mode)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 	struct dsi_clk_calc_ctx ctx;
-	struct omap_dss_dsi_config cfg = *config;
+	struct videomode vm;
+	struct omap_dss_dsi_config cfg = dsi->config;
 	bool ok;
 	int r;
 
+	drm_display_mode_to_videomode(mode, &vm);
+	cfg.vm = &vm;
+
 	mutex_lock(&dsi->lock);
 
 	cfg.mode = dsi->mode;
@@ -4906,9 +4965,15 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 	int r;
 
 	dsi_bus_lock(dsi);
-	dsi_set_ulps_auto(dsi, false);
-	r = _omap_dsi_host_transfer(dsi, msg);
-	dsi_set_ulps_auto(dsi, true);
+
+	if (dsi->video_enabled) {
+		dsi_set_ulps_auto(dsi, false);
+		r = _omap_dsi_host_transfer(dsi, msg);
+		dsi_set_ulps_auto(dsi, true);
+	} else {
+		r = -EIO;
+	}
+
 	dsi_bus_unlock(dsi);
 
 	return r;
@@ -4929,6 +4994,23 @@ static int dsi_get_clocks(struct dsi_data *dsi)
 	return 0;
 }
 
+static void dsi_set_timings(struct omap_dss_device *dssdev,
+			    const struct drm_display_mode *mode)
+{
+	DSSDBG("dsi_set_timings\n");
+	dsi_set_config(dssdev, mode);
+}
+
+static int dsi_check_timings(struct omap_dss_device *dssdev,
+			     struct drm_display_mode *mode)
+{
+	DSSDBG("dsi_check_timings\n");
+
+	/* TODO */
+
+	return 0;
+}
+
 static int dsi_connect(struct omap_dss_device *src,
 		       struct omap_dss_device *dst)
 {
@@ -4944,15 +5026,13 @@ static void dsi_disconnect(struct omap_dss_device *src,
 static const struct omap_dss_device_ops dsi_ops = {
 	.connect = dsi_connect,
 	.disconnect = dsi_disconnect,
-	.enable = dsi_display_enable,
-	.disable = dsi_display_disable,
-
-	.dsi = {
-		.set_config = dsi_set_config,
+	.enable = dsi_enable_video_outputs,
+	.disable = dsi_disable_video_outputs,
 
-		.enable_video_output = dsi_enable_video_output,
-		.disable_video_output = dsi_disable_video_output,
+	.check_timings = dsi_check_timings,
+	.set_timings = dsi_set_timings,
 
+	.dsi = {
 		.update = dsi_update_all,
 		.is_video_mode = dsi_is_video_mode,
 	},
@@ -5040,6 +5120,7 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 {
 	struct dsi_data *dsi = host_to_omap(host);
 	unsigned int channel = client->channel;
+	struct drm_panel *panel;
 	int r;
 
 	if (channel > 3)
@@ -5057,6 +5138,10 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 
 	dsi_bus_lock(dsi);
 
+	panel = of_drm_find_panel(client->dev.of_node);
+	if (IS_ERR(panel))
+		return PTR_ERR(panel);
+
 	atomic_set(&dsi->do_ext_te_update, 0);
 
 	if (client->mode_flags & MIPI_DSI_MODE_VIDEO) {
@@ -5077,8 +5162,12 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 	INIT_DEFERRABLE_WORK(&dsi->ulps_work,
 			     omap_dsi_ulps_work_callback);
 
+	dsi->config.hs_clk_min = 150000000; // TODO: get from client?
+	dsi->config.hs_clk_max = client->hs_rate;
+	dsi->config.lp_clk_min = 7000000; // TODO: get from client?
+	dsi->config.lp_clk_max = client->lp_rate;
+
 	dsi->ulps_auto_idle = !!(client->mode_flags & MIPI_DSI_MODE_ULPS_IDLE);
-	dsi_set_ulps_auto(dsi, true);
 
 	dsi_bus_unlock(dsi);
 	return 0;
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
index 72a7da7bfff1..18560ca4bbb0 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
@@ -174,7 +174,6 @@ static const struct of_device_id omapdss_of_match[] __initconst = {
 };
 
 static const struct of_device_id omapdss_of_fixups_whitelist[] __initconst = {
-	{ .compatible = "panel-dsi-cm" },
 	{},
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 4200611525d5..3ee3063b6a2d 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -278,14 +278,6 @@ struct omap_dss_writeback_info {
 struct omapdss_dsi_ops {
 	int (*update)(struct omap_dss_device *dssdev);
 	bool (*is_video_mode)(struct omap_dss_device *dssdev);
-
-	/* legacy API used by omapdss panels */
-	int (*set_config)(struct omap_dss_device *dssdev,
-			const struct omap_dss_dsi_config *cfg);
-
-	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
-	void (*disable_video_output)(struct omap_dss_device *dssdev,
-			int channel);
 };
 
 struct omap_dss_device_ops {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 33/56] drm/omap: dsi: convert to drm_panel
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

This converts the DSI module to expect common drm_panel display
drivers instead of dssdev based ones.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 204 +++++++-----------
 drivers/gpu/drm/omapdrm/dss/dsi.c             | 133 ++++++++++--
 .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |   1 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h         |   8 -
 4 files changed, 189 insertions(+), 157 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index d9b3444b4faf..3668b3f0aff2 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -6,8 +6,6 @@
  * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
  */
 
-/* #define DEBUG */
-
 #include <linux/backlight.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
@@ -20,11 +18,14 @@
 #include <linux/regulator/consumer.h>
 
 #include <drm/drm_connector.h>
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_panel.h>
+#include <drm/drm_modes.h>
 
+#include <video/display_timing.h>
 #include <video/mipi_display.h>
 #include <video/of_display_timing.h>
-
-#include "../dss/omapdss.h"
+#include <video/videomode.h>
 
 #define DCS_READ_NUM_ERRORS	0x05
 #define DCS_GET_ID1		0xda
@@ -35,11 +36,8 @@
 
 struct panel_drv_data {
 	struct mipi_dsi_device *dsi;
-
-	struct omap_dss_device dssdev;
-	struct omap_dss_device *src;
-
-	struct videomode vm;
+	struct drm_panel panel;
+	struct drm_display_mode mode;
 
 	struct mutex lock;
 
@@ -71,7 +69,11 @@ struct panel_drv_data {
 	bool ulps_enabled;
 };
 
-#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
+
+static inline struct panel_drv_data *panel_to_ddata(struct drm_panel *panel)
+{
+	return container_of(panel, struct panel_drv_data, panel);
+}
 
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
 
@@ -285,7 +287,6 @@ static void dsicm_hw_reset(struct panel_drv_data *ddata)
 
 static int dsicm_power_on(struct panel_drv_data *ddata)
 {
-	struct omap_dss_device *src = ddata->src;
 	u8 id1, id2, id3;
 	int r;
 
@@ -322,10 +323,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	if (r)
 		goto err;
 
-	r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
-	if (r)
-		goto err;
-
 	ddata->enabled = true;
 
 	if (!ddata->intro_printed) {
@@ -345,15 +342,12 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	return r;
 }
 
-static void dsicm_power_off(struct panel_drv_data *ddata)
+static int dsicm_power_off(struct panel_drv_data *ddata)
 {
-	struct omap_dss_device *src = ddata->src;
 	int r;
 
 	ddata->enabled = false;
 
-	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
-
 	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
 	if (!r)
 		r = dsicm_sleep_in(ddata);
@@ -363,51 +357,25 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 				"error disabling panel, issuing HW reset\n");
 		dsicm_hw_reset(ddata);
 	}
-}
-
-static int dsicm_connect(struct omap_dss_device *src,
-			 struct omap_dss_device *dst)
-{
-	struct panel_drv_data *ddata = to_panel_data(dst);
-
-	ddata->src = src;
-	return 0;
-}
-
-static void dsicm_disconnect(struct omap_dss_device *src,
-			     struct omap_dss_device *dst)
-{
-	struct panel_drv_data *ddata = to_panel_data(dst);
 
-	ddata->src = NULL;
+	return r;
 }
 
-static void dsicm_pre_enable(struct omap_dss_device *dssdev)
+static int dsicm_prepare(struct drm_panel *panel)
 {
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	struct omap_dss_device *src = ddata->src;
+	struct panel_drv_data *ddata = panel_to_ddata(panel);
 	int r;
-	struct omap_dss_dsi_config dsi_config = {
-		.vm = &ddata->vm,
-		.hs_clk_min = 150000000,
-		.hs_clk_max = 300000000,
-		.lp_clk_min = 7000000,
-		.lp_clk_max = 10000000,
-	};
 
 	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
 	if (r)
 		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
 
-	r = src->ops->dsi.set_config(src, &dsi_config);
-	if (r) {
-		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
-	}
+	return r;
 }
 
-static void dsicm_enable(struct omap_dss_device *dssdev)
+static int dsicm_enable(struct drm_panel *panel)
 {
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	struct panel_drv_data *ddata = panel_to_ddata(panel);
 	int r;
 
 	mutex_lock(&ddata->lock);
@@ -420,33 +388,39 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
 
 	dsicm_bl_power(ddata, true);
 
-	return;
+	return 0;
 err:
-	dev_dbg(&ddata->dsi->dev, "enable failed (%d)\n", r);
+	dev_err(&ddata->dsi->dev, "enable failed (%d)\n", r);
 	mutex_unlock(&ddata->lock);
+	return r;
+}
+
+static int dsicm_unprepare(struct drm_panel *panel)
+{
+	struct panel_drv_data *ddata = panel_to_ddata(panel);
+	int r;
+
+	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
+	if (r)
+		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
+
+	return r;
 }
 
-static void dsicm_disable(struct omap_dss_device *dssdev)
+static int dsicm_disable(struct drm_panel *panel)
 {
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	struct panel_drv_data *ddata = panel_to_ddata(panel);
+	int r;
 
 	dsicm_bl_power(ddata, false);
 
 	mutex_lock(&ddata->lock);
 
-	dsicm_power_off(ddata);
+	r = dsicm_power_off(ddata);
 
 	mutex_unlock(&ddata->lock);
-}
-
-static void dsicm_post_disable(struct omap_dss_device *dssdev)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	int r;
 
-	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
-	if (r)
-		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
+	return r;
 }
 
 static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
@@ -465,50 +439,37 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
 	return r;
 }
 
-static int dsicm_get_modes(struct omap_dss_device *dssdev,
+static int dsicm_get_modes(struct drm_panel *panel,
 			   struct drm_connector *connector)
 {
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	struct panel_drv_data *ddata = panel_to_ddata(panel);
+	struct drm_display_mode *mode;
+
+	mode = drm_mode_duplicate(connector->dev, &ddata->mode);
+	if (!mode) {
+		dev_err(&ddata->dsi->dev, "failed to add mode %ux%ux@%u kHz\n",
+			ddata->mode.hdisplay, ddata->mode.vdisplay,
+			ddata->mode.clock);
+		return -ENOMEM;
+	}
+
+	drm_mode_set_name(mode);
+	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
 
 	connector->display_info.width_mm = ddata->width_mm;
 	connector->display_info.height_mm = ddata->height_mm;
 
-	return omapdss_display_get_modes(connector, &ddata->vm);
-}
-
-static int dsicm_check_timings(struct omap_dss_device *dssdev,
-			       struct drm_display_mode *mode)
-{
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
-	int ret = 0;
-
-	if (mode->hdisplay != ddata->vm.hactive)
-		ret = -EINVAL;
-
-	if (mode->vdisplay != ddata->vm.vactive)
-		ret = -EINVAL;
+	drm_mode_probed_add(connector, mode);
 
-	if (ret) {
-		dev_warn(dssdev->dev, "wrong resolution: %d x %d",
-			 mode->hdisplay, mode->vdisplay);
-		dev_warn(dssdev->dev, "panel resolution: %d x %d",
-			 ddata->vm.hactive, ddata->vm.vactive);
-	}
-
-	return ret;
+	return 1;
 }
 
-static const struct omap_dss_device_ops dsicm_ops = {
-	.connect	= dsicm_connect,
-	.disconnect	= dsicm_disconnect,
-
-	.pre_enable	= dsicm_pre_enable,
-	.enable		= dsicm_enable,
-	.disable	= dsicm_disable,
-	.post_disable	= dsicm_post_disable,
-
-	.get_modes	= dsicm_get_modes,
-	.check_timings	= dsicm_check_timings,
+static const struct drm_panel_funcs dsicm_panel_funcs = {
+	.unprepare = dsicm_unprepare,
+	.disable = dsicm_disable,
+	.prepare = dsicm_prepare,
+	.enable = dsicm_enable,
+	.get_modes = dsicm_get_modes,
 };
 
 static int dsicm_probe_of(struct mipi_dsi_device *dsi)
@@ -517,8 +478,12 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 	struct backlight_device *backlight;
 	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
 	struct display_timing timing;
+	struct videomode vm = { 0 };
 	int err;
 
+	vm.hactive = 864;
+	vm.vactive = 480;
+
 	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ddata->reset_gpio)) {
 		err = PTR_ERR(ddata->reset_gpio);
@@ -528,15 +493,16 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
 
 	err = of_get_display_timing(node, "panel-timing", &timing);
 	if (!err) {
-		videomode_from_timing(&timing, &ddata->vm);
-		if (!ddata->vm.pixelclock)
-			ddata->vm.pixelclock =
-				ddata->vm.hactive * ddata->vm.vactive * 60;
+		videomode_from_timing(&timing, &vm);
 	} else {
 		dev_warn(&dsi->dev,
 			 "failed to get video timing, using defaults\n");
 	}
 
+	if (!vm.pixelclock)
+		vm.pixelclock = vm.hactive * vm.vactive * 60;
+	drm_display_mode_from_videomode(&vm, &ddata->mode);
+
 	ddata->width_mm = 0;
 	of_property_read_u32(node, "width-mm", &ddata->width_mm);
 
@@ -570,7 +536,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	struct panel_drv_data *ddata;
 	struct backlight_device *bldev = NULL;
 	struct device *dev = &dsi->dev;
-	struct omap_dss_device *dssdev;
 	int r;
 
 	dev_dbg(dev, "probe\n");
@@ -582,30 +547,17 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	mipi_dsi_set_drvdata(dsi, ddata);
 	ddata->dsi = dsi;
 
-	ddata->vm.hactive = 864;
-	ddata->vm.vactive = 480;
-	ddata->vm.pixelclock = 864 * 480 * 60;
-
 	r = dsicm_probe_of(dsi);
 	if (r)
 		return r;
 
-	dssdev = &ddata->dssdev;
-	dssdev->dev = dev;
-	dssdev->ops = &dsicm_ops;
-	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
-	dssdev->display = true;
-	dssdev->owner = THIS_MODULE;
-	dssdev->of_port = 0;
-	dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
-
-	omapdss_display_init(dssdev);
-	omapdss_device_register(dssdev);
-
 	mutex_init(&ddata->lock);
 
 	dsicm_hw_reset(ddata);
 
+	drm_panel_init(&ddata->panel, dev, &dsicm_panel_funcs,
+		       DRM_MODE_CONNECTOR_DSI);
+
 	if (ddata->use_dsi_backlight) {
 		struct backlight_properties props = { 0 };
 		props.max_brightness = 255;
@@ -637,6 +589,8 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	if (ddata->ulps_enabled)
 		dsi->mode_flags |= MIPI_DSI_MODE_ULPS_IDLE;
 
+	drm_panel_add(&ddata->panel);
+
 	r = mipi_dsi_attach(dsi);
 	if (r < 0)
 		goto err_dsi_attach;
@@ -644,6 +598,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	return 0;
 
 err_dsi_attach:
+	drm_panel_remove(&ddata->panel);
 	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
 err_bl:
 	if (ddata->extbldev)
@@ -655,15 +610,12 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
 {
 	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
-	struct omap_dss_device *dssdev = &ddata->dssdev;
 
 	dev_dbg(&dsi->dev, "remove\n");
 
 	mipi_dsi_detach(dsi);
 
-	omapdss_device_unregister(dssdev);
-
-	omapdss_device_disconnect(ddata->src, dssdev);
+	drm_panel_remove(&ddata->panel);
 
 	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
 
@@ -677,7 +629,7 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
 }
 
 static const struct of_device_id dsicm_of_match[] = {
-	{ .compatible = "omapdss,panel-dsi-cm", },
+	{ .compatible = "panel-dsi-cm", },
 	{},
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 620cef8bb1f2..a1a867a7d91d 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -36,6 +36,7 @@
 #include <linux/sys_soc.h>
 
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_panel.h>
 #include <video/mipi_display.h>
 
 #include "omapdss.h"
@@ -217,6 +218,8 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
 static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
 				       const struct mipi_dsi_msg *msg);
 
+static void dsi_display_disable(struct omap_dss_device *dssdev);
+
 /* DSI PLL HSDIV indices */
 #define HSDIV_DISPC	0
 #define HSDIV_DSI	1
@@ -383,6 +386,7 @@ struct dsi_data {
 	bool te_enabled;
 	bool ulps_enabled;
 	bool ulps_auto_idle;
+	bool video_enabled;
 
 	struct delayed_work ulps_work;
 
@@ -423,6 +427,8 @@ struct dsi_data {
 
 	unsigned int scp_clk_refcount;
 
+	struct omap_dss_dsi_config config;
+
 	struct dss_lcd_mgr_config mgr_config;
 	struct videomode vm;
 	enum mipi_dsi_pixel_format pix_fmt;
@@ -3622,7 +3628,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
 	return 0;
 }
 
-static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
+static void dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
@@ -3631,8 +3637,10 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 	int r;
 
 	r = dsi_display_init_dispc(dsi);
-	if (r)
-		return r;
+	if (r) {
+		dev_err(dsi->dev, "failed to init dispc!\n");
+		return;
+	}
 
 	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
 		switch (dsi->pix_fmt) {
@@ -3672,7 +3680,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 	if (r)
 		goto err_mgr_enable;
 
-	return 0;
+	return;
 
 err_mgr_enable:
 	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
@@ -3681,7 +3689,8 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 	}
 err_pix_fmt:
 	dsi_display_uninit_dispc(dsi);
-	return r;
+	dev_err(dsi->dev, "failed to enable DSI encoder!\n");
+	return;
 }
 
 static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel)
@@ -3704,6 +3713,25 @@ static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel
 	dsi_display_uninit_dispc(dsi);
 }
 
+static void dsi_disable_video_outputs(struct omap_dss_device *dssdev)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+	int i;
+
+	dsi_bus_lock(dsi);
+	dsi->video_enabled = false;
+
+	for (i = 0; i < 3; i++) {
+		if (!dsi->vc[i].dest)
+			continue;
+		dsi_disable_video_output(dssdev, i);
+	}
+
+	dsi_display_disable(dssdev);
+
+	dsi_bus_unlock(dsi);
+}
+
 static void dsi_update_screen_dispc(struct dsi_data *dsi)
 {
 	unsigned int bytespp;
@@ -3897,6 +3925,11 @@ static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
 
 	dsi_bus_lock(dsi);
 
+	if (!dsi->video_enabled) {
+		r = -EIO;
+		goto err;
+	}
+
 	if (!dsi->vc[channel].dest) {
 		r = -ENODEV;
 		goto err;
@@ -3942,7 +3975,7 @@ static int dsi_update_all(struct omap_dss_device *dssdev)
 
 	for (i = 0; i < 4; i++) {
 		r = dsi_update_channel(dssdev, i);
-		if (r != -ENODEV)
+		if (r && r != -ENODEV)
 			return r;
 	}
 
@@ -4165,8 +4198,30 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 	DSSDBG("dsi_display_enable\n");
-	dsi_bus_lock(dsi);
+	WARN_ON(!dsi_bus_is_locked(dsi));
+
 	dsi_display_ulps_enable(dsi);
+}
+
+static void dsi_enable_video_outputs(struct omap_dss_device *dssdev)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+	int i;
+
+	dsi_bus_lock(dsi);
+
+	dsi_display_enable(dssdev);
+
+	for (i = 0; i < 3; i++) {
+		if (!dsi->vc[i].dest)
+			continue;
+		dsi_enable_video_output(dssdev, i);
+	}
+
+	dsi->video_enabled = true;
+
+	dsi_set_ulps_auto(dsi, true);
+
 	dsi_bus_unlock(dsi);
 }
 
@@ -4193,11 +4248,11 @@ static void dsi_display_disable(struct omap_dss_device *dssdev)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 
+	WARN_ON(!dsi_bus_is_locked(dsi));
+
 	DSSDBG("dsi_display_disable\n");
 
-	dsi_bus_lock(dsi);
 	dsi_display_ulps_disable(dsi, true, false);
-	dsi_bus_unlock(dsi);
 }
 
 static int dsi_enable_te(struct dsi_data *dsi, bool enable)
@@ -4735,14 +4790,18 @@ static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
 }
 
 static int dsi_set_config(struct omap_dss_device *dssdev,
-		const struct omap_dss_dsi_config *config)
+		const struct drm_display_mode *mode)
 {
 	struct dsi_data *dsi = to_dsi_data(dssdev);
 	struct dsi_clk_calc_ctx ctx;
-	struct omap_dss_dsi_config cfg = *config;
+	struct videomode vm;
+	struct omap_dss_dsi_config cfg = dsi->config;
 	bool ok;
 	int r;
 
+	drm_display_mode_to_videomode(mode, &vm);
+	cfg.vm = &vm;
+
 	mutex_lock(&dsi->lock);
 
 	cfg.mode = dsi->mode;
@@ -4906,9 +4965,15 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
 	int r;
 
 	dsi_bus_lock(dsi);
-	dsi_set_ulps_auto(dsi, false);
-	r = _omap_dsi_host_transfer(dsi, msg);
-	dsi_set_ulps_auto(dsi, true);
+
+	if (dsi->video_enabled) {
+		dsi_set_ulps_auto(dsi, false);
+		r = _omap_dsi_host_transfer(dsi, msg);
+		dsi_set_ulps_auto(dsi, true);
+	} else {
+		r = -EIO;
+	}
+
 	dsi_bus_unlock(dsi);
 
 	return r;
@@ -4929,6 +4994,23 @@ static int dsi_get_clocks(struct dsi_data *dsi)
 	return 0;
 }
 
+static void dsi_set_timings(struct omap_dss_device *dssdev,
+			    const struct drm_display_mode *mode)
+{
+	DSSDBG("dsi_set_timings\n");
+	dsi_set_config(dssdev, mode);
+}
+
+static int dsi_check_timings(struct omap_dss_device *dssdev,
+			     struct drm_display_mode *mode)
+{
+	DSSDBG("dsi_check_timings\n");
+
+	/* TODO */
+
+	return 0;
+}
+
 static int dsi_connect(struct omap_dss_device *src,
 		       struct omap_dss_device *dst)
 {
@@ -4944,15 +5026,13 @@ static void dsi_disconnect(struct omap_dss_device *src,
 static const struct omap_dss_device_ops dsi_ops = {
 	.connect = dsi_connect,
 	.disconnect = dsi_disconnect,
-	.enable = dsi_display_enable,
-	.disable = dsi_display_disable,
-
-	.dsi = {
-		.set_config = dsi_set_config,
+	.enable = dsi_enable_video_outputs,
+	.disable = dsi_disable_video_outputs,
 
-		.enable_video_output = dsi_enable_video_output,
-		.disable_video_output = dsi_disable_video_output,
+	.check_timings = dsi_check_timings,
+	.set_timings = dsi_set_timings,
 
+	.dsi = {
 		.update = dsi_update_all,
 		.is_video_mode = dsi_is_video_mode,
 	},
@@ -5040,6 +5120,7 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 {
 	struct dsi_data *dsi = host_to_omap(host);
 	unsigned int channel = client->channel;
+	struct drm_panel *panel;
 	int r;
 
 	if (channel > 3)
@@ -5057,6 +5138,10 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 
 	dsi_bus_lock(dsi);
 
+	panel = of_drm_find_panel(client->dev.of_node);
+	if (IS_ERR(panel))
+		return PTR_ERR(panel);
+
 	atomic_set(&dsi->do_ext_te_update, 0);
 
 	if (client->mode_flags & MIPI_DSI_MODE_VIDEO) {
@@ -5077,8 +5162,12 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
 	INIT_DEFERRABLE_WORK(&dsi->ulps_work,
 			     omap_dsi_ulps_work_callback);
 
+	dsi->config.hs_clk_min = 150000000; // TODO: get from client?
+	dsi->config.hs_clk_max = client->hs_rate;
+	dsi->config.lp_clk_min = 7000000; // TODO: get from client?
+	dsi->config.lp_clk_max = client->lp_rate;
+
 	dsi->ulps_auto_idle = !!(client->mode_flags & MIPI_DSI_MODE_ULPS_IDLE);
-	dsi_set_ulps_auto(dsi, true);
 
 	dsi_bus_unlock(dsi);
 	return 0;
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
index 72a7da7bfff1..18560ca4bbb0 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
@@ -174,7 +174,6 @@ static const struct of_device_id omapdss_of_match[] __initconst = {
 };
 
 static const struct of_device_id omapdss_of_fixups_whitelist[] __initconst = {
-	{ .compatible = "panel-dsi-cm" },
 	{},
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 4200611525d5..3ee3063b6a2d 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -278,14 +278,6 @@ struct omap_dss_writeback_info {
 struct omapdss_dsi_ops {
 	int (*update)(struct omap_dss_device *dssdev);
 	bool (*is_video_mode)(struct omap_dss_device *dssdev);
-
-	/* legacy API used by omapdss panels */
-	int (*set_config)(struct omap_dss_device *dssdev,
-			const struct omap_dss_dsi_config *cfg);
-
-	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
-	void (*disable_video_output)(struct omap_dss_device *dssdev,
-			int channel);
 };
 
 struct omap_dss_device_ops {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 34/56] drm/omap: drop omapdss-boot-init
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The table of compatible values needed to be prefixed with "omapdss,"
is empty, so all of this code is doing nothing now. Let's drop it.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/Kconfig           |   4 -
 drivers/gpu/drm/omapdrm/dss/Makefile          |   2 -
 .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   | 228 ------------------
 3 files changed, 234 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c

diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig b/drivers/gpu/drm/omapdrm/dss/Kconfig
index fd7dfa28ce97..6ec80771af3d 100644
--- a/drivers/gpu/drm/omapdrm/dss/Kconfig
+++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
@@ -1,7 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
-config OMAP2_DSS_INIT
-	bool
-
 config OMAP_DSS_BASE
 	tristate
 
@@ -9,7 +6,6 @@ menuconfig OMAP2_DSS
 	tristate "OMAP2+ Display Subsystem support"
 	select OMAP_DSS_BASE
 	select VIDEOMODE_HELPERS
-	select OMAP2_DSS_INIT
 	select HDMI
 	help
 	  OMAP2+ Display Subsystem support.
diff --git a/drivers/gpu/drm/omapdrm/dss/Makefile b/drivers/gpu/drm/omapdrm/dss/Makefile
index f967e6948f2e..811966cd7468 100644
--- a/drivers/gpu/drm/omapdrm/dss/Makefile
+++ b/drivers/gpu/drm/omapdrm/dss/Makefile
@@ -1,6 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_OMAP2_DSS_INIT) += omapdss-boot-init.o
-
 obj-$(CONFIG_OMAP_DSS_BASE) += omapdss-base.o
 omapdss-base-y := base.o display.o output.o
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
deleted file mode 100644
index 18560ca4bbb0..000000000000
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ /dev/null
@@ -1,228 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
- * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
- */
-
-/*
- * As omapdss panel drivers are omapdss specific, but we want to define the
- * DT-data in generic manner, we convert the compatible strings of the panel and
- * encoder nodes from "panel-foo" to "omapdss,panel-foo". This way we can have
- * both correct DT data and omapdss specific drivers.
- *
- * When we get generic panel drivers to the kernel, this file will be removed.
- */
-
-#include <linux/kernel.h>
-#include <linux/of.h>
-#include <linux/of_graph.h>
-#include <linux/slab.h>
-#include <linux/list.h>
-
-static struct list_head dss_conv_list __initdata;
-
-static const char prefix[] __initconst = "omapdss,";
-
-struct dss_conv_node {
-	struct list_head list;
-	struct device_node *node;
-	bool root;
-};
-
-static int __init omapdss_count_strings(const struct property *prop)
-{
-	const char *p = prop->value;
-	int l = 0, total = 0;
-	int i;
-
-	for (i = 0; total < prop->length; total += l, p += l, i++)
-		l = strlen(p) + 1;
-
-	return i;
-}
-
-static void __init omapdss_update_prop(struct device_node *node, char *compat,
-	int len)
-{
-	struct property *prop;
-
-	prop = kzalloc(sizeof(*prop), GFP_KERNEL);
-	if (!prop)
-		return;
-
-	prop->name = "compatible";
-	prop->value = compat;
-	prop->length = len;
-
-	of_update_property(node, prop);
-}
-
-static void __init omapdss_prefix_strcpy(char *dst, int dst_len,
-	const char *src, int src_len)
-{
-	size_t total = 0;
-
-	while (total < src_len) {
-		size_t l = strlen(src) + 1;
-
-		strcpy(dst, prefix);
-		dst += strlen(prefix);
-
-		strcpy(dst, src);
-		dst += l;
-
-		src += l;
-		total += l;
-	}
-}
-
-/* prepend compatible property strings with "omapdss," */
-static void __init omapdss_omapify_node(struct device_node *node)
-{
-	struct property *prop;
-	char *new_compat;
-	int num_strs;
-	int new_len;
-
-	prop = of_find_property(node, "compatible", NULL);
-
-	if (!prop || !prop->value)
-		return;
-
-	if (strnlen(prop->value, prop->length) >= prop->length)
-		return;
-
-	/* is it already prefixed? */
-	if (strncmp(prefix, prop->value, strlen(prefix)) == 0)
-		return;
-
-	num_strs = omapdss_count_strings(prop);
-
-	new_len = prop->length + strlen(prefix) * num_strs;
-	new_compat = kmalloc(new_len, GFP_KERNEL);
-
-	omapdss_prefix_strcpy(new_compat, new_len, prop->value, prop->length);
-
-	omapdss_update_prop(node, new_compat, new_len);
-}
-
-static void __init omapdss_add_to_list(struct device_node *node, bool root)
-{
-	struct dss_conv_node *n = kmalloc(sizeof(*n), GFP_KERNEL);
-	if (n) {
-		n->node = node;
-		n->root = root;
-		list_add(&n->list, &dss_conv_list);
-	}
-}
-
-static bool __init omapdss_list_contains(const struct device_node *node)
-{
-	struct dss_conv_node *n;
-
-	list_for_each_entry(n, &dss_conv_list, list) {
-		if (n->node == node)
-			return true;
-	}
-
-	return false;
-}
-
-static void __init omapdss_walk_device(struct device_node *node, bool root)
-{
-	struct device_node *n;
-
-	omapdss_add_to_list(node, root);
-
-	/*
-	 * of_graph_get_remote_port_parent() prints an error if there is no
-	 * port/ports node. To avoid that, check first that there's the node.
-	 */
-	n = of_get_child_by_name(node, "ports");
-	if (!n)
-		n = of_get_child_by_name(node, "port");
-	if (!n)
-		return;
-
-	of_node_put(n);
-
-	n = NULL;
-	while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
-		struct device_node *pn;
-
-		pn = of_graph_get_remote_port_parent(n);
-
-		if (!pn)
-			continue;
-
-		if (!of_device_is_available(pn) || omapdss_list_contains(pn)) {
-			of_node_put(pn);
-			continue;
-		}
-
-		omapdss_walk_device(pn, false);
-	}
-}
-
-static const struct of_device_id omapdss_of_match[] __initconst = {
-	{ .compatible = "ti,omap2-dss", },
-	{ .compatible = "ti,omap3-dss", },
-	{ .compatible = "ti,omap4-dss", },
-	{ .compatible = "ti,omap5-dss", },
-	{ .compatible = "ti,dra7-dss", },
-	{},
-};
-
-static const struct of_device_id omapdss_of_fixups_whitelist[] __initconst = {
-	{},
-};
-
-static void __init omapdss_find_children(struct device_node *np)
-{
-	struct device_node *child;
-
-	for_each_available_child_of_node(np, child) {
-		if (!of_find_property(child, "compatible", NULL))
-			continue;
-
-		omapdss_walk_device(child, true);
-
-		if (of_device_is_compatible(child, "ti,sysc"))
-			omapdss_find_children(child);
-	}
-}
-
-static int __init omapdss_boot_init(void)
-{
-	struct device_node *dss;
-
-	INIT_LIST_HEAD(&dss_conv_list);
-
-	dss = of_find_matching_node(NULL, omapdss_of_match);
-
-	if (dss == NULL || !of_device_is_available(dss))
-		goto put_node;
-
-	omapdss_walk_device(dss, true);
-	omapdss_find_children(dss);
-
-	while (!list_empty(&dss_conv_list)) {
-		struct dss_conv_node *n;
-
-		n = list_first_entry(&dss_conv_list, struct dss_conv_node,
-			list);
-
-		if (of_match_node(omapdss_of_fixups_whitelist, n->node))
-			omapdss_omapify_node(n->node);
-
-		list_del(&n->list);
-		of_node_put(n->node);
-		kfree(n);
-	}
-
-put_node:
-	of_node_put(dss);
-	return 0;
-}
-
-subsys_initcall(omapdss_boot_init);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 34/56] drm/omap: drop omapdss-boot-init
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The table of compatible values needed to be prefixed with "omapdss,"
is empty, so all of this code is doing nothing now. Let's drop it.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/Kconfig           |   4 -
 drivers/gpu/drm/omapdrm/dss/Makefile          |   2 -
 .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   | 228 ------------------
 3 files changed, 234 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c

diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig b/drivers/gpu/drm/omapdrm/dss/Kconfig
index fd7dfa28ce97..6ec80771af3d 100644
--- a/drivers/gpu/drm/omapdrm/dss/Kconfig
+++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
@@ -1,7 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
-config OMAP2_DSS_INIT
-	bool
-
 config OMAP_DSS_BASE
 	tristate
 
@@ -9,7 +6,6 @@ menuconfig OMAP2_DSS
 	tristate "OMAP2+ Display Subsystem support"
 	select OMAP_DSS_BASE
 	select VIDEOMODE_HELPERS
-	select OMAP2_DSS_INIT
 	select HDMI
 	help
 	  OMAP2+ Display Subsystem support.
diff --git a/drivers/gpu/drm/omapdrm/dss/Makefile b/drivers/gpu/drm/omapdrm/dss/Makefile
index f967e6948f2e..811966cd7468 100644
--- a/drivers/gpu/drm/omapdrm/dss/Makefile
+++ b/drivers/gpu/drm/omapdrm/dss/Makefile
@@ -1,6 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_OMAP2_DSS_INIT) += omapdss-boot-init.o
-
 obj-$(CONFIG_OMAP_DSS_BASE) += omapdss-base.o
 omapdss-base-y := base.o display.o output.o
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
deleted file mode 100644
index 18560ca4bbb0..000000000000
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ /dev/null
@@ -1,228 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
- * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
- */
-
-/*
- * As omapdss panel drivers are omapdss specific, but we want to define the
- * DT-data in generic manner, we convert the compatible strings of the panel and
- * encoder nodes from "panel-foo" to "omapdss,panel-foo". This way we can have
- * both correct DT data and omapdss specific drivers.
- *
- * When we get generic panel drivers to the kernel, this file will be removed.
- */
-
-#include <linux/kernel.h>
-#include <linux/of.h>
-#include <linux/of_graph.h>
-#include <linux/slab.h>
-#include <linux/list.h>
-
-static struct list_head dss_conv_list __initdata;
-
-static const char prefix[] __initconst = "omapdss,";
-
-struct dss_conv_node {
-	struct list_head list;
-	struct device_node *node;
-	bool root;
-};
-
-static int __init omapdss_count_strings(const struct property *prop)
-{
-	const char *p = prop->value;
-	int l = 0, total = 0;
-	int i;
-
-	for (i = 0; total < prop->length; total += l, p += l, i++)
-		l = strlen(p) + 1;
-
-	return i;
-}
-
-static void __init omapdss_update_prop(struct device_node *node, char *compat,
-	int len)
-{
-	struct property *prop;
-
-	prop = kzalloc(sizeof(*prop), GFP_KERNEL);
-	if (!prop)
-		return;
-
-	prop->name = "compatible";
-	prop->value = compat;
-	prop->length = len;
-
-	of_update_property(node, prop);
-}
-
-static void __init omapdss_prefix_strcpy(char *dst, int dst_len,
-	const char *src, int src_len)
-{
-	size_t total = 0;
-
-	while (total < src_len) {
-		size_t l = strlen(src) + 1;
-
-		strcpy(dst, prefix);
-		dst += strlen(prefix);
-
-		strcpy(dst, src);
-		dst += l;
-
-		src += l;
-		total += l;
-	}
-}
-
-/* prepend compatible property strings with "omapdss," */
-static void __init omapdss_omapify_node(struct device_node *node)
-{
-	struct property *prop;
-	char *new_compat;
-	int num_strs;
-	int new_len;
-
-	prop = of_find_property(node, "compatible", NULL);
-
-	if (!prop || !prop->value)
-		return;
-
-	if (strnlen(prop->value, prop->length) >= prop->length)
-		return;
-
-	/* is it already prefixed? */
-	if (strncmp(prefix, prop->value, strlen(prefix)) == 0)
-		return;
-
-	num_strs = omapdss_count_strings(prop);
-
-	new_len = prop->length + strlen(prefix) * num_strs;
-	new_compat = kmalloc(new_len, GFP_KERNEL);
-
-	omapdss_prefix_strcpy(new_compat, new_len, prop->value, prop->length);
-
-	omapdss_update_prop(node, new_compat, new_len);
-}
-
-static void __init omapdss_add_to_list(struct device_node *node, bool root)
-{
-	struct dss_conv_node *n = kmalloc(sizeof(*n), GFP_KERNEL);
-	if (n) {
-		n->node = node;
-		n->root = root;
-		list_add(&n->list, &dss_conv_list);
-	}
-}
-
-static bool __init omapdss_list_contains(const struct device_node *node)
-{
-	struct dss_conv_node *n;
-
-	list_for_each_entry(n, &dss_conv_list, list) {
-		if (n->node == node)
-			return true;
-	}
-
-	return false;
-}
-
-static void __init omapdss_walk_device(struct device_node *node, bool root)
-{
-	struct device_node *n;
-
-	omapdss_add_to_list(node, root);
-
-	/*
-	 * of_graph_get_remote_port_parent() prints an error if there is no
-	 * port/ports node. To avoid that, check first that there's the node.
-	 */
-	n = of_get_child_by_name(node, "ports");
-	if (!n)
-		n = of_get_child_by_name(node, "port");
-	if (!n)
-		return;
-
-	of_node_put(n);
-
-	n = NULL;
-	while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
-		struct device_node *pn;
-
-		pn = of_graph_get_remote_port_parent(n);
-
-		if (!pn)
-			continue;
-
-		if (!of_device_is_available(pn) || omapdss_list_contains(pn)) {
-			of_node_put(pn);
-			continue;
-		}
-
-		omapdss_walk_device(pn, false);
-	}
-}
-
-static const struct of_device_id omapdss_of_match[] __initconst = {
-	{ .compatible = "ti,omap2-dss", },
-	{ .compatible = "ti,omap3-dss", },
-	{ .compatible = "ti,omap4-dss", },
-	{ .compatible = "ti,omap5-dss", },
-	{ .compatible = "ti,dra7-dss", },
-	{},
-};
-
-static const struct of_device_id omapdss_of_fixups_whitelist[] __initconst = {
-	{},
-};
-
-static void __init omapdss_find_children(struct device_node *np)
-{
-	struct device_node *child;
-
-	for_each_available_child_of_node(np, child) {
-		if (!of_find_property(child, "compatible", NULL))
-			continue;
-
-		omapdss_walk_device(child, true);
-
-		if (of_device_is_compatible(child, "ti,sysc"))
-			omapdss_find_children(child);
-	}
-}
-
-static int __init omapdss_boot_init(void)
-{
-	struct device_node *dss;
-
-	INIT_LIST_HEAD(&dss_conv_list);
-
-	dss = of_find_matching_node(NULL, omapdss_of_match);
-
-	if (dss == NULL || !of_device_is_available(dss))
-		goto put_node;
-
-	omapdss_walk_device(dss, true);
-	omapdss_find_children(dss);
-
-	while (!list_empty(&dss_conv_list)) {
-		struct dss_conv_node *n;
-
-		n = list_first_entry(&dss_conv_list, struct dss_conv_node,
-			list);
-
-		if (of_match_node(omapdss_of_fixups_whitelist, n->node))
-			omapdss_omapify_node(n->node);
-
-		list_del(&n->list);
-		of_node_put(n->node);
-		kfree(n);
-	}
-
-put_node:
-	of_node_put(dss);
-	return 0;
-}
-
-subsys_initcall(omapdss_boot_init);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 35/56] drm/omap: dsi: implement check timings
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Implement check timings, which will check if its possible to
configure the clocks for the provided mode using the same code
as the set_config() hook.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 70 +++++++++++++++++++------------
 1 file changed, 44 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index a1a867a7d91d..f643321434e9 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -280,6 +280,11 @@ struct dsi_isr_tables {
 	struct dsi_isr_data isr_table_cio[DSI_MAX_NR_ISRS];
 };
 
+struct dsi_lp_clock_info {
+	unsigned long lp_clk;
+	u16 lp_clk_div;
+};
+
 struct dsi_clk_calc_ctx {
 	struct dsi_data *dsi;
 	struct dss_pll *pll;
@@ -294,16 +299,12 @@ struct dsi_clk_calc_ctx {
 
 	struct dss_pll_clock_info dsi_cinfo;
 	struct dispc_clock_info dispc_cinfo;
+	struct dsi_lp_clock_info user_lp_cinfo;
 
 	struct videomode vm;
 	struct omap_dss_dsi_videomode_timings dsi_vm;
 };
 
-struct dsi_lp_clock_info {
-	unsigned long lp_clk;
-	u16 lp_clk_div;
-};
-
 struct dsi_module_id_data {
 	u32 address;
 	int id;
@@ -4789,44 +4790,55 @@ static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
 	return (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE);
 }
 
-static int dsi_set_config(struct omap_dss_device *dssdev,
-		const struct drm_display_mode *mode)
+static int __dsi_calc_config(struct dsi_data *dsi,
+		const struct drm_display_mode *mode,
+		struct dsi_clk_calc_ctx *ctx)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-	struct dsi_clk_calc_ctx ctx;
-	struct videomode vm;
 	struct omap_dss_dsi_config cfg = dsi->config;
+	struct videomode vm;
 	bool ok;
 	int r;
 
 	drm_display_mode_to_videomode(mode, &vm);
-	cfg.vm = &vm;
-
-	mutex_lock(&dsi->lock);
 
+	cfg.vm = &vm;
 	cfg.mode = dsi->mode;
 	cfg.pixel_format = dsi->pix_fmt;
 
 	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
-		ok = dsi_vm_calc(dsi, &cfg, &ctx);
+		ok = dsi_vm_calc(dsi, &cfg, ctx);
 	else
-		ok = dsi_cm_calc(dsi, &cfg, &ctx);
+		ok = dsi_cm_calc(dsi, &cfg, ctx);
 
-	if (!ok) {
-		DSSERR("failed to find suitable DSI clock settings\n");
-		r = -EINVAL;
-		goto err;
-	}
+	if (!ok)
+		return -EINVAL;
+
+	dsi_pll_calc_dsi_fck(dsi, &ctx->dsi_cinfo);
 
-	dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
+	r = dsi_lp_clock_calc(ctx->dsi_cinfo.clkout[HSDIV_DSI],
+		cfg.lp_clk_min, cfg.lp_clk_max, &ctx->user_lp_cinfo);
+	if (r)
+		return r;
+
+	return 0;
+}
 
-	r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
-		cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
+static int dsi_set_config(struct omap_dss_device *dssdev,
+		const struct drm_display_mode *mode)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+	struct dsi_clk_calc_ctx ctx;
+	int r;
+
+	mutex_lock(&dsi->lock);
+
+	r = __dsi_calc_config(dsi, mode, &ctx);
 	if (r) {
-		DSSERR("failed to find suitable DSI LP clock settings\n");
+		DSSERR("failed to find suitable DSI clock settings\n");
 		goto err;
 	}
 
+	dsi->user_lp_cinfo = ctx.user_lp_cinfo;
 	dsi->user_dsi_cinfo = ctx.dsi_cinfo;
 	dsi->user_dispc_cinfo = ctx.dispc_cinfo;
 
@@ -5004,11 +5016,17 @@ static void dsi_set_timings(struct omap_dss_device *dssdev,
 static int dsi_check_timings(struct omap_dss_device *dssdev,
 			     struct drm_display_mode *mode)
 {
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+	struct dsi_clk_calc_ctx ctx;
+	int r;
+
 	DSSDBG("dsi_check_timings\n");
 
-	/* TODO */
+	mutex_lock(&dsi->lock);
+	r = __dsi_calc_config(dsi, mode, &ctx);
+	mutex_unlock(&dsi->lock);
 
-	return 0;
+	return r;
 }
 
 static int dsi_connect(struct omap_dss_device *src,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 35/56] drm/omap: dsi: implement check timings
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Implement check timings, which will check if its possible to
configure the clocks for the provided mode using the same code
as the set_config() hook.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 70 +++++++++++++++++++------------
 1 file changed, 44 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index a1a867a7d91d..f643321434e9 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -280,6 +280,11 @@ struct dsi_isr_tables {
 	struct dsi_isr_data isr_table_cio[DSI_MAX_NR_ISRS];
 };
 
+struct dsi_lp_clock_info {
+	unsigned long lp_clk;
+	u16 lp_clk_div;
+};
+
 struct dsi_clk_calc_ctx {
 	struct dsi_data *dsi;
 	struct dss_pll *pll;
@@ -294,16 +299,12 @@ struct dsi_clk_calc_ctx {
 
 	struct dss_pll_clock_info dsi_cinfo;
 	struct dispc_clock_info dispc_cinfo;
+	struct dsi_lp_clock_info user_lp_cinfo;
 
 	struct videomode vm;
 	struct omap_dss_dsi_videomode_timings dsi_vm;
 };
 
-struct dsi_lp_clock_info {
-	unsigned long lp_clk;
-	u16 lp_clk_div;
-};
-
 struct dsi_module_id_data {
 	u32 address;
 	int id;
@@ -4789,44 +4790,55 @@ static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
 	return (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE);
 }
 
-static int dsi_set_config(struct omap_dss_device *dssdev,
-		const struct drm_display_mode *mode)
+static int __dsi_calc_config(struct dsi_data *dsi,
+		const struct drm_display_mode *mode,
+		struct dsi_clk_calc_ctx *ctx)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-	struct dsi_clk_calc_ctx ctx;
-	struct videomode vm;
 	struct omap_dss_dsi_config cfg = dsi->config;
+	struct videomode vm;
 	bool ok;
 	int r;
 
 	drm_display_mode_to_videomode(mode, &vm);
-	cfg.vm = &vm;
-
-	mutex_lock(&dsi->lock);
 
+	cfg.vm = &vm;
 	cfg.mode = dsi->mode;
 	cfg.pixel_format = dsi->pix_fmt;
 
 	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
-		ok = dsi_vm_calc(dsi, &cfg, &ctx);
+		ok = dsi_vm_calc(dsi, &cfg, ctx);
 	else
-		ok = dsi_cm_calc(dsi, &cfg, &ctx);
+		ok = dsi_cm_calc(dsi, &cfg, ctx);
 
-	if (!ok) {
-		DSSERR("failed to find suitable DSI clock settings\n");
-		r = -EINVAL;
-		goto err;
-	}
+	if (!ok)
+		return -EINVAL;
+
+	dsi_pll_calc_dsi_fck(dsi, &ctx->dsi_cinfo);
 
-	dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
+	r = dsi_lp_clock_calc(ctx->dsi_cinfo.clkout[HSDIV_DSI],
+		cfg.lp_clk_min, cfg.lp_clk_max, &ctx->user_lp_cinfo);
+	if (r)
+		return r;
+
+	return 0;
+}
 
-	r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
-		cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
+static int dsi_set_config(struct omap_dss_device *dssdev,
+		const struct drm_display_mode *mode)
+{
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+	struct dsi_clk_calc_ctx ctx;
+	int r;
+
+	mutex_lock(&dsi->lock);
+
+	r = __dsi_calc_config(dsi, mode, &ctx);
 	if (r) {
-		DSSERR("failed to find suitable DSI LP clock settings\n");
+		DSSERR("failed to find suitable DSI clock settings\n");
 		goto err;
 	}
 
+	dsi->user_lp_cinfo = ctx.user_lp_cinfo;
 	dsi->user_dsi_cinfo = ctx.dsi_cinfo;
 	dsi->user_dispc_cinfo = ctx.dispc_cinfo;
 
@@ -5004,11 +5016,17 @@ static void dsi_set_timings(struct omap_dss_device *dssdev,
 static int dsi_check_timings(struct omap_dss_device *dssdev,
 			     struct drm_display_mode *mode)
 {
+	struct dsi_data *dsi = to_dsi_data(dssdev);
+	struct dsi_clk_calc_ctx ctx;
+	int r;
+
 	DSSDBG("dsi_check_timings\n");
 
-	/* TODO */
+	mutex_lock(&dsi->lock);
+	r = __dsi_calc_config(dsi, mode, &ctx);
+	mutex_unlock(&dsi->lock);
 
-	return 0;
+	return r;
 }
 
 static int dsi_connect(struct omap_dss_device *src,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 36/56] drm/omap: panel-dsi-cm: use DEVICE_ATTR_RO
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Use DEVICE_ATTR_RO helper instead of plain DEVICE_ATTR,
which makes the code a bit shorter and easier to read.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 3668b3f0aff2..5159dd51a353 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -219,7 +219,7 @@ static const struct backlight_ops dsicm_bl_ops = {
 	.update_status  = dsicm_bl_update_status,
 };
 
-static ssize_t dsicm_num_errors_show(struct device *dev,
+static ssize_t num_dsi_errors_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
@@ -239,7 +239,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
 	return snprintf(buf, PAGE_SIZE, "%d\n", errors);
 }
 
-static ssize_t dsicm_hw_revision_show(struct device *dev,
+static ssize_t hw_revision_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
@@ -259,8 +259,8 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
 	return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
 }
 
-static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
-static DEVICE_ATTR(hw_revision, S_IRUGO, dsicm_hw_revision_show, NULL);
+static DEVICE_ATTR_RO(num_dsi_errors);
+static DEVICE_ATTR_RO(hw_revision);
 
 static struct attribute *dsicm_attrs[] = {
 	&dev_attr_num_dsi_errors.attr,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 36/56] drm/omap: panel-dsi-cm: use DEVICE_ATTR_RO
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Use DEVICE_ATTR_RO helper instead of plain DEVICE_ATTR,
which makes the code a bit shorter and easier to read.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 3668b3f0aff2..5159dd51a353 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -219,7 +219,7 @@ static const struct backlight_ops dsicm_bl_ops = {
 	.update_status  = dsicm_bl_update_status,
 };
 
-static ssize_t dsicm_num_errors_show(struct device *dev,
+static ssize_t num_dsi_errors_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
@@ -239,7 +239,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
 	return snprintf(buf, PAGE_SIZE, "%d\n", errors);
 }
 
-static ssize_t dsicm_hw_revision_show(struct device *dev,
+static ssize_t hw_revision_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct panel_drv_data *ddata = dev_get_drvdata(dev);
@@ -259,8 +259,8 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
 	return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
 }
 
-static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
-static DEVICE_ATTR(hw_revision, S_IRUGO, dsicm_hw_revision_show, NULL);
+static DEVICE_ATTR_RO(num_dsi_errors);
+static DEVICE_ATTR_RO(hw_revision);
 
 static struct attribute *dsicm_attrs[] = {
 	&dev_attr_num_dsi_errors.attr,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 37/56] drm/omap: panel-dsi-cm: support unbinding
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Now, that the driver implements the common DRM panel API
the unbind no longer needs to be suppressed.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 5159dd51a353..086c7d71fe17 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -607,7 +607,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	return r;
 }
 
-static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
+static int dsicm_remove(struct mipi_dsi_device *dsi)
 {
 	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
 
@@ -637,11 +637,10 @@ MODULE_DEVICE_TABLE(of, dsicm_of_match);
 
 static struct mipi_dsi_driver dsicm_driver = {
 	.probe = dsicm_probe,
-	.remove = __exit_p(dsicm_remove),
+	.remove = dsicm_remove,
 	.driver = {
 		.name = "panel-dsi-cm",
 		.of_match_table = dsicm_of_match,
-		.suppress_bind_attrs = true,
 	},
 };
 module_mipi_dsi_driver(dsicm_driver);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 37/56] drm/omap: panel-dsi-cm: support unbinding
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Now, that the driver implements the common DRM panel API
the unbind no longer needs to be suppressed.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 5159dd51a353..086c7d71fe17 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -607,7 +607,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
 	return r;
 }
 
-static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
+static int dsicm_remove(struct mipi_dsi_device *dsi)
 {
 	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
 
@@ -637,11 +637,10 @@ MODULE_DEVICE_TABLE(of, dsicm_of_match);
 
 static struct mipi_dsi_driver dsicm_driver = {
 	.probe = dsicm_probe,
-	.remove = __exit_p(dsicm_remove),
+	.remove = dsicm_remove,
 	.driver = {
 		.name = "panel-dsi-cm",
 		.of_match_table = dsicm_of_match,
-		.suppress_bind_attrs = true,
 	},
 };
 module_mipi_dsi_driver(dsicm_driver);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 38/56] drm/omap: panel-dsi-cm: fix remove()
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Do not try to reset the panel after DSI has been
detached, since the DSI clocks may have been disabled
at this point. The panel will be disabled and unprepared
before being removed and a reset will be done when being
probed again.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 086c7d71fe17..795db22d148d 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -622,9 +622,6 @@ static int dsicm_remove(struct mipi_dsi_device *dsi)
 	if (ddata->extbldev)
 		put_device(&ddata->extbldev->dev);
 
-	/* reset, to be sure that the panel is in a valid state */
-	dsicm_hw_reset(ddata);
-
 	return 0;
 }
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 38/56] drm/omap: panel-dsi-cm: fix remove()
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Do not try to reset the panel after DSI has been
detached, since the DSI clocks may have been disabled
at this point. The panel will be disabled and unprepared
before being removed and a reset will be done when being
probed again.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 086c7d71fe17..795db22d148d 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -622,9 +622,6 @@ static int dsicm_remove(struct mipi_dsi_device *dsi)
 	if (ddata->extbldev)
 		put_device(&ddata->extbldev->dev);
 
-	/* reset, to be sure that the panel is in a valid state */
-	dsicm_hw_reset(ddata);
-
 	return 0;
 }
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 39/56] drm/omap: remove global dss_device variable
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

We can simply provide the device to the omapdrm driver
via pdata. omapdss_is_initialized() is no longer required
(even before this patch), since omapdrm device is only
registered after the pointer is initialized.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c    | 14 --------------
 drivers/gpu/drm/omapdrm/dss/dss.c     |  9 ++++-----
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  9 +++------
 drivers/gpu/drm/omapdrm/omap_drv.c    |  6 ++----
 4 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index 455b410f7401..8e08c49b4f97 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -16,20 +16,6 @@
 #include "dss.h"
 #include "omapdss.h"
 
-static struct dss_device *dss_device;
-
-struct dss_device *omapdss_get_dss(void)
-{
-	return dss_device;
-}
-EXPORT_SYMBOL(omapdss_get_dss);
-
-void omapdss_set_dss(struct dss_device *dss)
-{
-	dss_device = dss;
-}
-EXPORT_SYMBOL(omapdss_set_dss);
-
 struct dispc_device *dispc_get_dispc(struct dss_device *dss)
 {
 	return dss->dispc;
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index 6ccbc29c4ce4..6e86f4e67a2c 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1305,6 +1305,7 @@ static int dss_bind(struct device *dev)
 {
 	struct dss_device *dss = dev_get_drvdata(dev);
 	struct platform_device *drm_pdev;
+	struct dss_pdata pdata;
 	int r;
 
 	r = component_bind_all(dev, NULL);
@@ -1313,9 +1314,9 @@ static int dss_bind(struct device *dev)
 
 	pm_set_vt_switch(0);
 
-	omapdss_set_dss(dss);
-
-	drm_pdev = platform_device_register_simple("omapdrm", 0, NULL, 0);
+	pdata.dss = dss;
+	drm_pdev = platform_device_register_data(NULL, "omapdrm", 0,
+						 &pdata, sizeof(pdata));
 	if (IS_ERR(drm_pdev)) {
 		component_unbind_all(dev, NULL);
 		return PTR_ERR(drm_pdev);
@@ -1332,8 +1333,6 @@ static void dss_unbind(struct device *dev)
 
 	platform_device_unregister(dss->drm_pdev);
 
-	omapdss_set_dss(NULL);
-
 	component_unbind_all(dev, NULL);
 }
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 3ee3063b6a2d..42d1ec3aaf0c 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -356,12 +356,9 @@ struct omap_dss_device {
 	unsigned int of_port;
 };
 
-struct dss_device *omapdss_get_dss(void);
-void omapdss_set_dss(struct dss_device *dss);
-static inline bool omapdss_is_initialized(void)
-{
-	return !!omapdss_get_dss();
-}
+struct dss_pdata {
+	struct dss_device *dss;
+};
 
 void omapdss_display_init(struct omap_dss_device *dssdev);
 int omapdss_display_get_modes(struct drm_connector *connector,
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 53d5e184ee77..b342f5b6ced0 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -577,6 +577,7 @@ static const struct soc_device_attribute omapdrm_soc_devices[] = {
 static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 {
 	const struct soc_device_attribute *soc;
+	struct dss_pdata *pdata = dev->platform_data;
 	struct drm_device *ddev;
 	int ret;
 
@@ -591,7 +592,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 	ddev->dev_private = priv;
 
 	priv->dev = dev;
-	priv->dss = omapdss_get_dss();
+	priv->dss = pdata->dss;
 	priv->dispc = dispc_get_dispc(priv->dss);
 	priv->dispc_ops = dispc_get_ops(priv->dss);
 
@@ -686,9 +687,6 @@ static int pdev_probe(struct platform_device *pdev)
 	struct omap_drm_private *priv;
 	int ret;
 
-	if (omapdss_is_initialized() == false)
-		return -EPROBE_DEFER;
-
 	ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to set the DMA mask\n");
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 39/56] drm/omap: remove global dss_device variable
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

We can simply provide the device to the omapdrm driver
via pdata. omapdss_is_initialized() is no longer required
(even before this patch), since omapdrm device is only
registered after the pointer is initialized.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c    | 14 --------------
 drivers/gpu/drm/omapdrm/dss/dss.c     |  9 ++++-----
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  9 +++------
 drivers/gpu/drm/omapdrm/omap_drv.c    |  6 ++----
 4 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index 455b410f7401..8e08c49b4f97 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -16,20 +16,6 @@
 #include "dss.h"
 #include "omapdss.h"
 
-static struct dss_device *dss_device;
-
-struct dss_device *omapdss_get_dss(void)
-{
-	return dss_device;
-}
-EXPORT_SYMBOL(omapdss_get_dss);
-
-void omapdss_set_dss(struct dss_device *dss)
-{
-	dss_device = dss;
-}
-EXPORT_SYMBOL(omapdss_set_dss);
-
 struct dispc_device *dispc_get_dispc(struct dss_device *dss)
 {
 	return dss->dispc;
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index 6ccbc29c4ce4..6e86f4e67a2c 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1305,6 +1305,7 @@ static int dss_bind(struct device *dev)
 {
 	struct dss_device *dss = dev_get_drvdata(dev);
 	struct platform_device *drm_pdev;
+	struct dss_pdata pdata;
 	int r;
 
 	r = component_bind_all(dev, NULL);
@@ -1313,9 +1314,9 @@ static int dss_bind(struct device *dev)
 
 	pm_set_vt_switch(0);
 
-	omapdss_set_dss(dss);
-
-	drm_pdev = platform_device_register_simple("omapdrm", 0, NULL, 0);
+	pdata.dss = dss;
+	drm_pdev = platform_device_register_data(NULL, "omapdrm", 0,
+						 &pdata, sizeof(pdata));
 	if (IS_ERR(drm_pdev)) {
 		component_unbind_all(dev, NULL);
 		return PTR_ERR(drm_pdev);
@@ -1332,8 +1333,6 @@ static void dss_unbind(struct device *dev)
 
 	platform_device_unregister(dss->drm_pdev);
 
-	omapdss_set_dss(NULL);
-
 	component_unbind_all(dev, NULL);
 }
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 3ee3063b6a2d..42d1ec3aaf0c 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -356,12 +356,9 @@ struct omap_dss_device {
 	unsigned int of_port;
 };
 
-struct dss_device *omapdss_get_dss(void);
-void omapdss_set_dss(struct dss_device *dss);
-static inline bool omapdss_is_initialized(void)
-{
-	return !!omapdss_get_dss();
-}
+struct dss_pdata {
+	struct dss_device *dss;
+};
 
 void omapdss_display_init(struct omap_dss_device *dssdev);
 int omapdss_display_get_modes(struct drm_connector *connector,
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 53d5e184ee77..b342f5b6ced0 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -577,6 +577,7 @@ static const struct soc_device_attribute omapdrm_soc_devices[] = {
 static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 {
 	const struct soc_device_attribute *soc;
+	struct dss_pdata *pdata = dev->platform_data;
 	struct drm_device *ddev;
 	int ret;
 
@@ -591,7 +592,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 	ddev->dev_private = priv;
 
 	priv->dev = dev;
-	priv->dss = omapdss_get_dss();
+	priv->dss = pdata->dss;
 	priv->dispc = dispc_get_dispc(priv->dss);
 	priv->dispc_ops = dispc_get_ops(priv->dss);
 
@@ -686,9 +687,6 @@ static int pdev_probe(struct platform_device *pdev)
 	struct omap_drm_private *priv;
 	int ret;
 
-	if (omapdss_is_initialized() == false)
-		return -EPROBE_DEFER;
-
 	ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to set the DMA mask\n");
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 40/56] drm/panel: Move OMAP's DSI command mode panel driver
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen, Thierry Reding, Sam Ravnborg

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The panel driver is no longer using any OMAP specific APIs, so
let's move it into the generic panel directory.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/omapdrm/Kconfig                        |  1 -
 drivers/gpu/drm/omapdrm/Makefile                       |  1 -
 drivers/gpu/drm/omapdrm/displays/Kconfig               | 10 ----------
 drivers/gpu/drm/omapdrm/displays/Makefile              |  2 --
 drivers/gpu/drm/panel/Kconfig                          |  9 +++++++++
 drivers/gpu/drm/panel/Makefile                         |  1 +
 .../gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c |  0
 7 files changed, 10 insertions(+), 14 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
 rename drivers/gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c (100%)

diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
index 5417e7a47072..cea3f44ea6d4 100644
--- a/drivers/gpu/drm/omapdrm/Kconfig
+++ b/drivers/gpu/drm/omapdrm/Kconfig
@@ -12,6 +12,5 @@ config DRM_OMAP
 if DRM_OMAP
 
 source "drivers/gpu/drm/omapdrm/dss/Kconfig"
-source "drivers/gpu/drm/omapdrm/displays/Kconfig"
 
 endif
diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index f115253115c5..66a73eae6f7c 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -5,7 +5,6 @@
 #
 
 obj-y += dss/
-obj-y += displays/
 
 omapdrm-y := omap_drv.o \
 	omap_irq.o \
diff --git a/drivers/gpu/drm/omapdrm/displays/Kconfig b/drivers/gpu/drm/omapdrm/displays/Kconfig
deleted file mode 100644
index f2be594c7eff..000000000000
--- a/drivers/gpu/drm/omapdrm/displays/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-menu "OMAPDRM External Display Device Drivers"
-
-config DRM_OMAP_PANEL_DSI_CM
-	tristate "Generic DSI Command Mode Panel"
-	depends on BACKLIGHT_CLASS_DEVICE
-	help
-	  Driver for generic DSI command mode panels.
-
-endmenu
diff --git a/drivers/gpu/drm/omapdrm/displays/Makefile b/drivers/gpu/drm/omapdrm/displays/Makefile
deleted file mode 100644
index 488ddf153613..000000000000
--- a/drivers/gpu/drm/omapdrm/displays/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_DRM_OMAP_PANEL_DSI_CM) += panel-dsi-cm.o
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index b9dbedf8f15e..a71f95afc52e 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -48,6 +48,15 @@ config DRM_PANEL_BOE_TV101WUM_NL6
 	  Say Y here if you want to support for BOE TV101WUM and AUO KD101N80
 	  45NA WUXGA PANEL DSI Video Mode panel
 
+config DRM_PANEL_DSI_CM
+	tristate "Generic DSI command mode panels"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	help
+	  DRM panel driver for DSI command mode panels with support for
+	  embedded and external backlights.
+
 config DRM_PANEL_LVDS
 	tristate "Generic LVDS panel driver"
 	depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 2ba560bca61d..c553e968e9a9 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_PANEL_ARM_VERSATILE) += panel-arm-versatile.o
 obj-$(CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596) += panel-asus-z00t-tm5p5-n35596.o
 obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o
 obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o
+obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o
 obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
 obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/panel/panel-dsi-cm.c
similarity index 100%
rename from drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
rename to drivers/gpu/drm/panel/panel-dsi-cm.c
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 40/56] drm/panel: Move OMAP's DSI command mode panel driver
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel, Thierry Reding, Sam Ravnborg

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The panel driver is no longer using any OMAP specific APIs, so
let's move it into the generic panel directory.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/omapdrm/Kconfig                        |  1 -
 drivers/gpu/drm/omapdrm/Makefile                       |  1 -
 drivers/gpu/drm/omapdrm/displays/Kconfig               | 10 ----------
 drivers/gpu/drm/omapdrm/displays/Makefile              |  2 --
 drivers/gpu/drm/panel/Kconfig                          |  9 +++++++++
 drivers/gpu/drm/panel/Makefile                         |  1 +
 .../gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c |  0
 7 files changed, 10 insertions(+), 14 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
 rename drivers/gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c (100%)

diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
index 5417e7a47072..cea3f44ea6d4 100644
--- a/drivers/gpu/drm/omapdrm/Kconfig
+++ b/drivers/gpu/drm/omapdrm/Kconfig
@@ -12,6 +12,5 @@ config DRM_OMAP
 if DRM_OMAP
 
 source "drivers/gpu/drm/omapdrm/dss/Kconfig"
-source "drivers/gpu/drm/omapdrm/displays/Kconfig"
 
 endif
diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index f115253115c5..66a73eae6f7c 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -5,7 +5,6 @@
 #
 
 obj-y += dss/
-obj-y += displays/
 
 omapdrm-y := omap_drv.o \
 	omap_irq.o \
diff --git a/drivers/gpu/drm/omapdrm/displays/Kconfig b/drivers/gpu/drm/omapdrm/displays/Kconfig
deleted file mode 100644
index f2be594c7eff..000000000000
--- a/drivers/gpu/drm/omapdrm/displays/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-menu "OMAPDRM External Display Device Drivers"
-
-config DRM_OMAP_PANEL_DSI_CM
-	tristate "Generic DSI Command Mode Panel"
-	depends on BACKLIGHT_CLASS_DEVICE
-	help
-	  Driver for generic DSI command mode panels.
-
-endmenu
diff --git a/drivers/gpu/drm/omapdrm/displays/Makefile b/drivers/gpu/drm/omapdrm/displays/Makefile
deleted file mode 100644
index 488ddf153613..000000000000
--- a/drivers/gpu/drm/omapdrm/displays/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_DRM_OMAP_PANEL_DSI_CM) += panel-dsi-cm.o
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index b9dbedf8f15e..a71f95afc52e 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -48,6 +48,15 @@ config DRM_PANEL_BOE_TV101WUM_NL6
 	  Say Y here if you want to support for BOE TV101WUM and AUO KD101N80
 	  45NA WUXGA PANEL DSI Video Mode panel
 
+config DRM_PANEL_DSI_CM
+	tristate "Generic DSI command mode panels"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	help
+	  DRM panel driver for DSI command mode panels with support for
+	  embedded and external backlights.
+
 config DRM_PANEL_LVDS
 	tristate "Generic LVDS panel driver"
 	depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 2ba560bca61d..c553e968e9a9 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_PANEL_ARM_VERSATILE) += panel-arm-versatile.o
 obj-$(CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596) += panel-asus-z00t-tm5p5-n35596.o
 obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o
 obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o
+obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o
 obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
 obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/panel/panel-dsi-cm.c
similarity index 100%
rename from drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
rename to drivers/gpu/drm/panel/panel-dsi-cm.c
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 41/56] drm/omap: dsi: Register a drm_bridge
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

In order to integrate with a chain of drm_bridge, the internal DSI
output has to expose its operations through the drm_bridge API.
Register a bridge at initialisation time to do so and remove the
omap_dss_device operations that are now unused.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 134 ++++++++++++++++++++----------
 1 file changed, 89 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index f643321434e9..bbcdb62e1571 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -35,6 +35,7 @@
 #include <linux/component.h>
 #include <linux/sys_soc.h>
 
+#include <drm/drm_bridge.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
 #include <video/mipi_display.h>
@@ -437,6 +438,7 @@ struct dsi_data {
 	struct omap_dss_dsi_videomode_timings vm_timings;
 
 	struct omap_dss_device output;
+	struct drm_bridge bridge;
 };
 
 struct dsi_packet_sent_handler_data {
@@ -449,6 +451,9 @@ static bool dsi_perf;
 module_param(dsi_perf, bool, 0644);
 #endif
 
+#define drm_bridge_to_dsi(bridge) \
+	container_of(bridge, struct dsi_data, bridge)
+
 static inline struct dsi_data *to_dsi_data(struct omap_dss_device *dssdev)
 {
 	return dev_get_drvdata(dssdev->dev);
@@ -5006,50 +5011,7 @@ static int dsi_get_clocks(struct dsi_data *dsi)
 	return 0;
 }
 
-static void dsi_set_timings(struct omap_dss_device *dssdev,
-			    const struct drm_display_mode *mode)
-{
-	DSSDBG("dsi_set_timings\n");
-	dsi_set_config(dssdev, mode);
-}
-
-static int dsi_check_timings(struct omap_dss_device *dssdev,
-			     struct drm_display_mode *mode)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-	struct dsi_clk_calc_ctx ctx;
-	int r;
-
-	DSSDBG("dsi_check_timings\n");
-
-	mutex_lock(&dsi->lock);
-	r = __dsi_calc_config(dsi, mode, &ctx);
-	mutex_unlock(&dsi->lock);
-
-	return r;
-}
-
-static int dsi_connect(struct omap_dss_device *src,
-		       struct omap_dss_device *dst)
-{
-	return omapdss_device_connect(dst->dss, dst, dst->next);
-}
-
-static void dsi_disconnect(struct omap_dss_device *src,
-			   struct omap_dss_device *dst)
-{
-	omapdss_device_disconnect(dst, dst->next);
-}
-
 static const struct omap_dss_device_ops dsi_ops = {
-	.connect = dsi_connect,
-	.disconnect = dsi_disconnect,
-	.enable = dsi_enable_video_outputs,
-	.disable = dsi_disable_video_outputs,
-
-	.check_timings = dsi_check_timings,
-	.set_timings = dsi_set_timings,
-
 	.dsi = {
 		.update = dsi_update_all,
 		.is_video_mode = dsi_is_video_mode,
@@ -5393,6 +5355,83 @@ static const struct component_ops dsi_component_ops = {
 	.unbind	= dsi_unbind,
 };
 
+/* -----------------------------------------------------------------------------
+ * DRM Bridge Operations
+ */
+
+static int dsi_bridge_attach(struct drm_bridge *bridge,
+			     enum drm_bridge_attach_flags flags)
+{
+	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+
+	if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
+		return -EINVAL;
+
+	return drm_bridge_attach(bridge->encoder, dsi->output.next_bridge,
+				 bridge, flags);
+}
+
+static enum drm_mode_status
+dsi_bridge_mode_valid(struct drm_bridge *bridge,
+		      const struct drm_display_info *info,
+		      const struct drm_display_mode *mode)
+{
+	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+	struct dsi_clk_calc_ctx ctx;
+	int r;
+
+	mutex_lock(&dsi->lock);
+	r = __dsi_calc_config(dsi, mode, &ctx);
+	mutex_unlock(&dsi->lock);
+
+	return r ? MODE_CLOCK_RANGE : MODE_OK;
+}
+
+static void dsi_bridge_mode_set(struct drm_bridge *bridge,
+				const struct drm_display_mode *mode,
+				const struct drm_display_mode *adjusted_mode)
+{
+	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+
+	dsi_set_config(&dsi->output, adjusted_mode);
+}
+
+static void dsi_bridge_enable(struct drm_bridge *bridge)
+{
+	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+
+	dsi_enable_video_outputs(&dsi->output);
+}
+
+static void dsi_bridge_disable(struct drm_bridge *bridge)
+{
+	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+
+	dsi_disable_video_outputs(&dsi->output);
+}
+
+static const struct drm_bridge_funcs dsi_bridge_funcs = {
+	.attach = dsi_bridge_attach,
+	.mode_valid = dsi_bridge_mode_valid,
+	.mode_set = dsi_bridge_mode_set,
+	.enable = dsi_bridge_enable,
+	.disable = dsi_bridge_disable,
+};
+
+static void dsi_bridge_init(struct dsi_data *dsi)
+{
+	dsi->bridge.funcs = &dsi_bridge_funcs;
+	dsi->bridge.of_node = dsi->host.dev->of_node;
+	dsi->bridge.type = DRM_MODE_CONNECTOR_DSI;
+
+	drm_bridge_add(&dsi->bridge);
+}
+
+static void dsi_bridge_cleanup(struct dsi_data *dsi)
+{
+	drm_bridge_remove(&dsi->bridge);
+}
+
 /* -----------------------------------------------------------------------------
  * Probe & Remove, Suspend & Resume
  */
@@ -5402,6 +5441,8 @@ static int dsi_init_output(struct dsi_data *dsi)
 	struct omap_dss_device *out = &dsi->output;
 	int r;
 
+	dsi_bridge_init(dsi);
+
 	out->dev = dsi->dev;
 	out->id = dsi->module_id == 0 ?
 			OMAP_DSS_OUTPUT_DSI1 : OMAP_DSS_OUTPUT_DSI2;
@@ -5416,9 +5457,11 @@ static int dsi_init_output(struct dsi_data *dsi)
 		       | DRM_BUS_FLAG_DE_HIGH
 		       | DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE;
 
-	r = omapdss_device_init_output(out, NULL);
-	if (r < 0)
+	r = omapdss_device_init_output(out, &dsi->bridge);
+	if (r < 0) {
+		dsi_bridge_cleanup(dsi);
 		return r;
+	}
 
 	omapdss_device_register(out);
 
@@ -5431,6 +5474,7 @@ static void dsi_uninit_output(struct dsi_data *dsi)
 
 	omapdss_device_unregister(out);
 	omapdss_device_cleanup_output(out);
+	dsi_bridge_cleanup(dsi);
 }
 
 static int dsi_probe_of(struct dsi_data *dsi)
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 41/56] drm/omap: dsi: Register a drm_bridge
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

In order to integrate with a chain of drm_bridge, the internal DSI
output has to expose its operations through the drm_bridge API.
Register a bridge at initialisation time to do so and remove the
omap_dss_device operations that are now unused.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 134 ++++++++++++++++++++----------
 1 file changed, 89 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index f643321434e9..bbcdb62e1571 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -35,6 +35,7 @@
 #include <linux/component.h>
 #include <linux/sys_soc.h>
 
+#include <drm/drm_bridge.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
 #include <video/mipi_display.h>
@@ -437,6 +438,7 @@ struct dsi_data {
 	struct omap_dss_dsi_videomode_timings vm_timings;
 
 	struct omap_dss_device output;
+	struct drm_bridge bridge;
 };
 
 struct dsi_packet_sent_handler_data {
@@ -449,6 +451,9 @@ static bool dsi_perf;
 module_param(dsi_perf, bool, 0644);
 #endif
 
+#define drm_bridge_to_dsi(bridge) \
+	container_of(bridge, struct dsi_data, bridge)
+
 static inline struct dsi_data *to_dsi_data(struct omap_dss_device *dssdev)
 {
 	return dev_get_drvdata(dssdev->dev);
@@ -5006,50 +5011,7 @@ static int dsi_get_clocks(struct dsi_data *dsi)
 	return 0;
 }
 
-static void dsi_set_timings(struct omap_dss_device *dssdev,
-			    const struct drm_display_mode *mode)
-{
-	DSSDBG("dsi_set_timings\n");
-	dsi_set_config(dssdev, mode);
-}
-
-static int dsi_check_timings(struct omap_dss_device *dssdev,
-			     struct drm_display_mode *mode)
-{
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-	struct dsi_clk_calc_ctx ctx;
-	int r;
-
-	DSSDBG("dsi_check_timings\n");
-
-	mutex_lock(&dsi->lock);
-	r = __dsi_calc_config(dsi, mode, &ctx);
-	mutex_unlock(&dsi->lock);
-
-	return r;
-}
-
-static int dsi_connect(struct omap_dss_device *src,
-		       struct omap_dss_device *dst)
-{
-	return omapdss_device_connect(dst->dss, dst, dst->next);
-}
-
-static void dsi_disconnect(struct omap_dss_device *src,
-			   struct omap_dss_device *dst)
-{
-	omapdss_device_disconnect(dst, dst->next);
-}
-
 static const struct omap_dss_device_ops dsi_ops = {
-	.connect = dsi_connect,
-	.disconnect = dsi_disconnect,
-	.enable = dsi_enable_video_outputs,
-	.disable = dsi_disable_video_outputs,
-
-	.check_timings = dsi_check_timings,
-	.set_timings = dsi_set_timings,
-
 	.dsi = {
 		.update = dsi_update_all,
 		.is_video_mode = dsi_is_video_mode,
@@ -5393,6 +5355,83 @@ static const struct component_ops dsi_component_ops = {
 	.unbind	= dsi_unbind,
 };
 
+/* -----------------------------------------------------------------------------
+ * DRM Bridge Operations
+ */
+
+static int dsi_bridge_attach(struct drm_bridge *bridge,
+			     enum drm_bridge_attach_flags flags)
+{
+	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+
+	if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
+		return -EINVAL;
+
+	return drm_bridge_attach(bridge->encoder, dsi->output.next_bridge,
+				 bridge, flags);
+}
+
+static enum drm_mode_status
+dsi_bridge_mode_valid(struct drm_bridge *bridge,
+		      const struct drm_display_info *info,
+		      const struct drm_display_mode *mode)
+{
+	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+	struct dsi_clk_calc_ctx ctx;
+	int r;
+
+	mutex_lock(&dsi->lock);
+	r = __dsi_calc_config(dsi, mode, &ctx);
+	mutex_unlock(&dsi->lock);
+
+	return r ? MODE_CLOCK_RANGE : MODE_OK;
+}
+
+static void dsi_bridge_mode_set(struct drm_bridge *bridge,
+				const struct drm_display_mode *mode,
+				const struct drm_display_mode *adjusted_mode)
+{
+	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+
+	dsi_set_config(&dsi->output, adjusted_mode);
+}
+
+static void dsi_bridge_enable(struct drm_bridge *bridge)
+{
+	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+
+	dsi_enable_video_outputs(&dsi->output);
+}
+
+static void dsi_bridge_disable(struct drm_bridge *bridge)
+{
+	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
+
+	dsi_disable_video_outputs(&dsi->output);
+}
+
+static const struct drm_bridge_funcs dsi_bridge_funcs = {
+	.attach = dsi_bridge_attach,
+	.mode_valid = dsi_bridge_mode_valid,
+	.mode_set = dsi_bridge_mode_set,
+	.enable = dsi_bridge_enable,
+	.disable = dsi_bridge_disable,
+};
+
+static void dsi_bridge_init(struct dsi_data *dsi)
+{
+	dsi->bridge.funcs = &dsi_bridge_funcs;
+	dsi->bridge.of_node = dsi->host.dev->of_node;
+	dsi->bridge.type = DRM_MODE_CONNECTOR_DSI;
+
+	drm_bridge_add(&dsi->bridge);
+}
+
+static void dsi_bridge_cleanup(struct dsi_data *dsi)
+{
+	drm_bridge_remove(&dsi->bridge);
+}
+
 /* -----------------------------------------------------------------------------
  * Probe & Remove, Suspend & Resume
  */
@@ -5402,6 +5441,8 @@ static int dsi_init_output(struct dsi_data *dsi)
 	struct omap_dss_device *out = &dsi->output;
 	int r;
 
+	dsi_bridge_init(dsi);
+
 	out->dev = dsi->dev;
 	out->id = dsi->module_id == 0 ?
 			OMAP_DSS_OUTPUT_DSI1 : OMAP_DSS_OUTPUT_DSI2;
@@ -5416,9 +5457,11 @@ static int dsi_init_output(struct dsi_data *dsi)
 		       | DRM_BUS_FLAG_DE_HIGH
 		       | DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE;
 
-	r = omapdss_device_init_output(out, NULL);
-	if (r < 0)
+	r = omapdss_device_init_output(out, &dsi->bridge);
+	if (r < 0) {
+		dsi_bridge_cleanup(dsi);
 		return r;
+	}
 
 	omapdss_device_register(out);
 
@@ -5431,6 +5474,7 @@ static void dsi_uninit_output(struct dsi_data *dsi)
 
 	omapdss_device_unregister(out);
 	omapdss_device_cleanup_output(out);
+	dsi_bridge_cleanup(dsi);
 }
 
 static int dsi_probe_of(struct dsi_data *dsi)
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 42/56] drm/omap: remove legacy DSS device operations
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

All DSS devices have been converted to bridge API, so
the device operations are always NULL. This removes
the device ops function pointers and all code using it.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c       | 66 ------------------------
 drivers/gpu/drm/omapdrm/dss/dss.c        |  8 ---
 drivers/gpu/drm/omapdrm/dss/omapdss.h    | 34 ------------
 drivers/gpu/drm/omapdrm/omap_connector.c | 29 -----------
 drivers/gpu/drm/omapdrm/omap_encoder.c   | 40 --------------
 5 files changed, 177 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index 8e08c49b4f97..c2791305c332 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -161,8 +161,6 @@ int omapdss_device_connect(struct dss_device *dss,
 			   struct omap_dss_device *src,
 			   struct omap_dss_device *dst)
 {
-	int ret;
-
 	dev_dbg(&dss->pdev->dev, "connect(%s, %s)\n",
 		src ? dev_name(src->dev) : "NULL",
 		dst ? dev_name(dst->dev) : "NULL");
@@ -181,14 +179,6 @@ int omapdss_device_connect(struct dss_device *dss,
 
 	dst->dss = dss;
 
-	if (dst->ops && dst->ops->connect) {
-		ret = dst->ops->connect(src, dst);
-		if (ret < 0) {
-			dst->dss = NULL;
-			return ret;
-		}
-	}
-
 	return 0;
 }
 EXPORT_SYMBOL_GPL(omapdss_device_connect);
@@ -212,66 +202,10 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
 		return;
 	}
 
-	WARN_ON(dst->state != OMAP_DSS_DISPLAY_DISABLED);
-
-	if (dst->ops && dst->ops->disconnect)
-		dst->ops->disconnect(src, dst);
 	dst->dss = NULL;
 }
 EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
 
-void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
-{
-	if (!dssdev)
-		return;
-
-	omapdss_device_pre_enable(dssdev->next);
-
-	if (dssdev->ops && dssdev->ops->pre_enable)
-		dssdev->ops->pre_enable(dssdev);
-}
-EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
-
-void omapdss_device_enable(struct omap_dss_device *dssdev)
-{
-	if (!dssdev)
-		return;
-
-	if (dssdev->ops && dssdev->ops->enable)
-		dssdev->ops->enable(dssdev);
-
-	omapdss_device_enable(dssdev->next);
-
-	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
-}
-EXPORT_SYMBOL_GPL(omapdss_device_enable);
-
-void omapdss_device_disable(struct omap_dss_device *dssdev)
-{
-	if (!dssdev)
-		return;
-
-	omapdss_device_disable(dssdev->next);
-
-	if (dssdev->ops && dssdev->ops->disable)
-		dssdev->ops->disable(dssdev);
-}
-EXPORT_SYMBOL_GPL(omapdss_device_disable);
-
-void omapdss_device_post_disable(struct omap_dss_device *dssdev)
-{
-	if (!dssdev)
-		return;
-
-	if (dssdev->ops && dssdev->ops->post_disable)
-		dssdev->ops->post_disable(dssdev);
-
-	omapdss_device_post_disable(dssdev->next);
-
-	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
-}
-EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
-
 /* -----------------------------------------------------------------------------
  * Components Handling
  */
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index 6e86f4e67a2c..6a160138bf88 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1565,15 +1565,7 @@ static int dss_remove(struct platform_device *pdev)
 
 static void dss_shutdown(struct platform_device *pdev)
 {
-	struct omap_dss_device *dssdev = NULL;
-
 	DSSDBG("shutdown\n");
-
-	for_each_dss_output(dssdev) {
-		if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE &&
-		    dssdev->ops && dssdev->ops->disable)
-			dssdev->ops->disable(dssdev);
-	}
 }
 
 static int dss_runtime_suspend(struct device *dev)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 42d1ec3aaf0c..5d6edec5a427 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -123,11 +123,6 @@ enum omap_dss_dsi_mode {
 	OMAP_DSS_DSI_VIDEO_MODE,
 };
 
-enum omap_dss_display_state {
-	OMAP_DSS_DISPLAY_DISABLED = 0,
-	OMAP_DSS_DISPLAY_ACTIVE,
-};
-
 enum omap_dss_rotation_type {
 	OMAP_DSS_ROT_NONE	= 0,
 	OMAP_DSS_ROT_TILER	= 1 << 0,
@@ -281,24 +276,6 @@ struct omapdss_dsi_ops {
 };
 
 struct omap_dss_device_ops {
-	int (*connect)(struct omap_dss_device *dssdev,
-			struct omap_dss_device *dst);
-	void (*disconnect)(struct omap_dss_device *dssdev,
-			struct omap_dss_device *dst);
-
-	void (*pre_enable)(struct omap_dss_device *dssdev);
-	void (*enable)(struct omap_dss_device *dssdev);
-	void (*disable)(struct omap_dss_device *dssdev);
-	void (*post_disable)(struct omap_dss_device *dssdev);
-
-	int (*check_timings)(struct omap_dss_device *dssdev,
-			     struct drm_display_mode *mode);
-	void (*set_timings)(struct omap_dss_device *dssdev,
-			    const struct drm_display_mode *mode);
-
-	int (*get_modes)(struct omap_dss_device *dssdev,
-			 struct drm_connector *connector);
-
 	const struct omapdss_dsi_ops dsi;
 };
 
@@ -342,8 +319,6 @@ struct omap_dss_device {
 	unsigned long ops_flags;
 	u32 bus_flags;
 
-	enum omap_dss_display_state state;
-
 	/* OMAP DSS output specific fields */
 
 	/* DISPC channel for this output */
@@ -374,10 +349,6 @@ int omapdss_device_connect(struct dss_device *dss,
 			   struct omap_dss_device *dst);
 void omapdss_device_disconnect(struct omap_dss_device *src,
 			       struct omap_dss_device *dst);
-void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
-void omapdss_device_enable(struct omap_dss_device *dssdev);
-void omapdss_device_disable(struct omap_dss_device *dssdev);
-void omapdss_device_post_disable(struct omap_dss_device *dssdev);
 
 int omap_dss_get_num_overlay_managers(void);
 
@@ -397,11 +368,6 @@ int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
 int omapdss_compat_init(void);
 void omapdss_compat_uninit(void);
 
-static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
-{
-	return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
-}
-
 enum dss_writeback_channel {
 	DSS_WB_LCD1_MGR =	0,
 	DSS_WB_LCD2_MGR =	1,
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index de95dc1b861c..c6d9b4268841 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -43,24 +43,8 @@ static void omap_connector_destroy(struct drm_connector *connector)
 
 static int omap_connector_get_modes(struct drm_connector *connector)
 {
-	struct omap_connector *omap_connector = to_omap_connector(connector);
-	struct omap_dss_device *dssdev = NULL;
-	struct omap_dss_device *d;
-
 	DBG("%s", connector->name);
 
-	/*
-	 * If the display pipeline reports modes (e.g. with a fixed resolution
-	 * panel or an analog TV output), query it.
-	 */
-	for (d = omap_connector->output; d; d = d->next) {
-		if (d->ops_flags & OMAP_DSS_DEVICE_OP_MODES)
-			dssdev = d;
-	}
-
-	if (dssdev)
-		return dssdev->ops->get_modes(dssdev, connector);
-
 	/* We can't retrieve modes. The KMS core will add the default modes. */
 	return 0;
 }
@@ -69,19 +53,6 @@ enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
 					const struct drm_display_mode *mode,
 					struct drm_display_mode *adjusted_mode)
 {
-	int ret;
-
-	drm_mode_copy(adjusted_mode, mode);
-
-	for (; dssdev; dssdev = dssdev->next) {
-		if (!dssdev->ops || !dssdev->ops->check_timings)
-			continue;
-
-		ret = dssdev->ops->check_timings(dssdev, adjusted_mode);
-		if (ret)
-			return MODE_BAD;
-	}
-
 	return MODE_OK;
 }
 
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 10abe4d01b0b..abb3821de8b8 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -115,11 +115,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 
 	/* Set timings for all devices in the display pipeline. */
 	dss_mgr_set_timings(output, &vm);
-
-	for (dssdev = output; dssdev; dssdev = dssdev->next) {
-		if (dssdev->ops && dssdev->ops->set_timings)
-			dssdev->ops->set_timings(dssdev, adjusted_mode);
-	}
 }
 
 static void omap_encoder_disable(struct drm_encoder *encoder)
@@ -129,25 +124,6 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
 	struct drm_device *dev = encoder->dev;
 
 	dev_dbg(dev->dev, "disable(%s)\n", dssdev->name);
-
-	/*
-	 * Disable the chain of external devices, starting at the one at the
-	 * internal encoder's output.
-	 */
-	omapdss_device_disable(dssdev->next);
-
-	/*
-	 * Disable the internal encoder. This will disable the DSS output.
-	 */
-	if (dssdev->ops && dssdev->ops->disable)
-		dssdev->ops->disable(dssdev);
-	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
-
-	/*
-	 * Perform the post-disable operations on the chain of external devices
-	 * to complete the display pipeline disable.
-	 */
-	omapdss_device_post_disable(dssdev->next);
 }
 
 static void omap_encoder_enable(struct drm_encoder *encoder)
@@ -157,22 +133,6 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
 	struct drm_device *dev = encoder->dev;
 
 	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
-
-	/* Prepare the chain of external devices for pipeline enable. */
-	omapdss_device_pre_enable(dssdev->next);
-
-	/*
-	 * Enable the internal encoder. This will enable the DSS output.
-	 */
-	if (dssdev->ops && dssdev->ops->enable)
-		dssdev->ops->enable(dssdev);
-	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
-
-	/*
-	 * Enable the chain of external devices, starting at the one at the
-	 * internal encoder's output.
-	 */
-	omapdss_device_enable(dssdev->next);
 }
 
 static int omap_encoder_atomic_check(struct drm_encoder *encoder,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 42/56] drm/omap: remove legacy DSS device operations
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

All DSS devices have been converted to bridge API, so
the device operations are always NULL. This removes
the device ops function pointers and all code using it.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c       | 66 ------------------------
 drivers/gpu/drm/omapdrm/dss/dss.c        |  8 ---
 drivers/gpu/drm/omapdrm/dss/omapdss.h    | 34 ------------
 drivers/gpu/drm/omapdrm/omap_connector.c | 29 -----------
 drivers/gpu/drm/omapdrm/omap_encoder.c   | 40 --------------
 5 files changed, 177 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index 8e08c49b4f97..c2791305c332 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -161,8 +161,6 @@ int omapdss_device_connect(struct dss_device *dss,
 			   struct omap_dss_device *src,
 			   struct omap_dss_device *dst)
 {
-	int ret;
-
 	dev_dbg(&dss->pdev->dev, "connect(%s, %s)\n",
 		src ? dev_name(src->dev) : "NULL",
 		dst ? dev_name(dst->dev) : "NULL");
@@ -181,14 +179,6 @@ int omapdss_device_connect(struct dss_device *dss,
 
 	dst->dss = dss;
 
-	if (dst->ops && dst->ops->connect) {
-		ret = dst->ops->connect(src, dst);
-		if (ret < 0) {
-			dst->dss = NULL;
-			return ret;
-		}
-	}
-
 	return 0;
 }
 EXPORT_SYMBOL_GPL(omapdss_device_connect);
@@ -212,66 +202,10 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
 		return;
 	}
 
-	WARN_ON(dst->state != OMAP_DSS_DISPLAY_DISABLED);
-
-	if (dst->ops && dst->ops->disconnect)
-		dst->ops->disconnect(src, dst);
 	dst->dss = NULL;
 }
 EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
 
-void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
-{
-	if (!dssdev)
-		return;
-
-	omapdss_device_pre_enable(dssdev->next);
-
-	if (dssdev->ops && dssdev->ops->pre_enable)
-		dssdev->ops->pre_enable(dssdev);
-}
-EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
-
-void omapdss_device_enable(struct omap_dss_device *dssdev)
-{
-	if (!dssdev)
-		return;
-
-	if (dssdev->ops && dssdev->ops->enable)
-		dssdev->ops->enable(dssdev);
-
-	omapdss_device_enable(dssdev->next);
-
-	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
-}
-EXPORT_SYMBOL_GPL(omapdss_device_enable);
-
-void omapdss_device_disable(struct omap_dss_device *dssdev)
-{
-	if (!dssdev)
-		return;
-
-	omapdss_device_disable(dssdev->next);
-
-	if (dssdev->ops && dssdev->ops->disable)
-		dssdev->ops->disable(dssdev);
-}
-EXPORT_SYMBOL_GPL(omapdss_device_disable);
-
-void omapdss_device_post_disable(struct omap_dss_device *dssdev)
-{
-	if (!dssdev)
-		return;
-
-	if (dssdev->ops && dssdev->ops->post_disable)
-		dssdev->ops->post_disable(dssdev);
-
-	omapdss_device_post_disable(dssdev->next);
-
-	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
-}
-EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
-
 /* -----------------------------------------------------------------------------
  * Components Handling
  */
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index 6e86f4e67a2c..6a160138bf88 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1565,15 +1565,7 @@ static int dss_remove(struct platform_device *pdev)
 
 static void dss_shutdown(struct platform_device *pdev)
 {
-	struct omap_dss_device *dssdev = NULL;
-
 	DSSDBG("shutdown\n");
-
-	for_each_dss_output(dssdev) {
-		if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE &&
-		    dssdev->ops && dssdev->ops->disable)
-			dssdev->ops->disable(dssdev);
-	}
 }
 
 static int dss_runtime_suspend(struct device *dev)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 42d1ec3aaf0c..5d6edec5a427 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -123,11 +123,6 @@ enum omap_dss_dsi_mode {
 	OMAP_DSS_DSI_VIDEO_MODE,
 };
 
-enum omap_dss_display_state {
-	OMAP_DSS_DISPLAY_DISABLED = 0,
-	OMAP_DSS_DISPLAY_ACTIVE,
-};
-
 enum omap_dss_rotation_type {
 	OMAP_DSS_ROT_NONE	= 0,
 	OMAP_DSS_ROT_TILER	= 1 << 0,
@@ -281,24 +276,6 @@ struct omapdss_dsi_ops {
 };
 
 struct omap_dss_device_ops {
-	int (*connect)(struct omap_dss_device *dssdev,
-			struct omap_dss_device *dst);
-	void (*disconnect)(struct omap_dss_device *dssdev,
-			struct omap_dss_device *dst);
-
-	void (*pre_enable)(struct omap_dss_device *dssdev);
-	void (*enable)(struct omap_dss_device *dssdev);
-	void (*disable)(struct omap_dss_device *dssdev);
-	void (*post_disable)(struct omap_dss_device *dssdev);
-
-	int (*check_timings)(struct omap_dss_device *dssdev,
-			     struct drm_display_mode *mode);
-	void (*set_timings)(struct omap_dss_device *dssdev,
-			    const struct drm_display_mode *mode);
-
-	int (*get_modes)(struct omap_dss_device *dssdev,
-			 struct drm_connector *connector);
-
 	const struct omapdss_dsi_ops dsi;
 };
 
@@ -342,8 +319,6 @@ struct omap_dss_device {
 	unsigned long ops_flags;
 	u32 bus_flags;
 
-	enum omap_dss_display_state state;
-
 	/* OMAP DSS output specific fields */
 
 	/* DISPC channel for this output */
@@ -374,10 +349,6 @@ int omapdss_device_connect(struct dss_device *dss,
 			   struct omap_dss_device *dst);
 void omapdss_device_disconnect(struct omap_dss_device *src,
 			       struct omap_dss_device *dst);
-void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
-void omapdss_device_enable(struct omap_dss_device *dssdev);
-void omapdss_device_disable(struct omap_dss_device *dssdev);
-void omapdss_device_post_disable(struct omap_dss_device *dssdev);
 
 int omap_dss_get_num_overlay_managers(void);
 
@@ -397,11 +368,6 @@ int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
 int omapdss_compat_init(void);
 void omapdss_compat_uninit(void);
 
-static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
-{
-	return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
-}
-
 enum dss_writeback_channel {
 	DSS_WB_LCD1_MGR =	0,
 	DSS_WB_LCD2_MGR =	1,
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index de95dc1b861c..c6d9b4268841 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -43,24 +43,8 @@ static void omap_connector_destroy(struct drm_connector *connector)
 
 static int omap_connector_get_modes(struct drm_connector *connector)
 {
-	struct omap_connector *omap_connector = to_omap_connector(connector);
-	struct omap_dss_device *dssdev = NULL;
-	struct omap_dss_device *d;
-
 	DBG("%s", connector->name);
 
-	/*
-	 * If the display pipeline reports modes (e.g. with a fixed resolution
-	 * panel or an analog TV output), query it.
-	 */
-	for (d = omap_connector->output; d; d = d->next) {
-		if (d->ops_flags & OMAP_DSS_DEVICE_OP_MODES)
-			dssdev = d;
-	}
-
-	if (dssdev)
-		return dssdev->ops->get_modes(dssdev, connector);
-
 	/* We can't retrieve modes. The KMS core will add the default modes. */
 	return 0;
 }
@@ -69,19 +53,6 @@ enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
 					const struct drm_display_mode *mode,
 					struct drm_display_mode *adjusted_mode)
 {
-	int ret;
-
-	drm_mode_copy(adjusted_mode, mode);
-
-	for (; dssdev; dssdev = dssdev->next) {
-		if (!dssdev->ops || !dssdev->ops->check_timings)
-			continue;
-
-		ret = dssdev->ops->check_timings(dssdev, adjusted_mode);
-		if (ret)
-			return MODE_BAD;
-	}
-
 	return MODE_OK;
 }
 
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 10abe4d01b0b..abb3821de8b8 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -115,11 +115,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 
 	/* Set timings for all devices in the display pipeline. */
 	dss_mgr_set_timings(output, &vm);
-
-	for (dssdev = output; dssdev; dssdev = dssdev->next) {
-		if (dssdev->ops && dssdev->ops->set_timings)
-			dssdev->ops->set_timings(dssdev, adjusted_mode);
-	}
 }
 
 static void omap_encoder_disable(struct drm_encoder *encoder)
@@ -129,25 +124,6 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
 	struct drm_device *dev = encoder->dev;
 
 	dev_dbg(dev->dev, "disable(%s)\n", dssdev->name);
-
-	/*
-	 * Disable the chain of external devices, starting at the one at the
-	 * internal encoder's output.
-	 */
-	omapdss_device_disable(dssdev->next);
-
-	/*
-	 * Disable the internal encoder. This will disable the DSS output.
-	 */
-	if (dssdev->ops && dssdev->ops->disable)
-		dssdev->ops->disable(dssdev);
-	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
-
-	/*
-	 * Perform the post-disable operations on the chain of external devices
-	 * to complete the display pipeline disable.
-	 */
-	omapdss_device_post_disable(dssdev->next);
 }
 
 static void omap_encoder_enable(struct drm_encoder *encoder)
@@ -157,22 +133,6 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
 	struct drm_device *dev = encoder->dev;
 
 	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
-
-	/* Prepare the chain of external devices for pipeline enable. */
-	omapdss_device_pre_enable(dssdev->next);
-
-	/*
-	 * Enable the internal encoder. This will enable the DSS output.
-	 */
-	if (dssdev->ops && dssdev->ops->enable)
-		dssdev->ops->enable(dssdev);
-	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
-
-	/*
-	 * Enable the chain of external devices, starting at the one at the
-	 * internal encoder's output.
-	 */
-	omapdss_device_enable(dssdev->next);
 }
 
 static int omap_encoder_atomic_check(struct drm_encoder *encoder,
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 43/56] drm/omap: remove unused omap_connector
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Remove unused code. Connectors are now created via drm_bridge_connector_init()
and no longer OMAP specific.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/Makefile         |   1 -
 drivers/gpu/drm/omapdrm/omap_connector.c | 128 -----------------------
 drivers/gpu/drm/omapdrm/omap_connector.h |  28 -----
 drivers/gpu/drm/omapdrm/omap_drv.c       |  19 ++--
 drivers/gpu/drm/omapdrm/omap_drv.h       |   1 -
 drivers/gpu/drm/omapdrm/omap_encoder.c   |  11 --
 6 files changed, 6 insertions(+), 182 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.c
 delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.h

diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index 66a73eae6f7c..2a404e045b78 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -12,7 +12,6 @@ omapdrm-y := omap_drv.o \
 	omap_crtc.o \
 	omap_plane.o \
 	omap_encoder.o \
-	omap_connector.o \
 	omap_fb.o \
 	omap_gem.o \
 	omap_gem_dmabuf.o \
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
deleted file mode 100644
index c6d9b4268841..000000000000
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ /dev/null
@@ -1,128 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- * Author: Rob Clark <rob@ti.com>
- */
-
-#include <drm/drm_atomic_helper.h>
-#include <drm/drm_crtc.h>
-#include <drm/drm_probe_helper.h>
-
-#include "omap_drv.h"
-
-/*
- * connector funcs
- */
-
-#define to_omap_connector(x) container_of(x, struct omap_connector, base)
-
-struct omap_connector {
-	struct drm_connector base;
-	struct omap_dss_device *output;
-};
-
-static enum drm_connector_status omap_connector_detect(
-		struct drm_connector *connector, bool force)
-{
-	return connector_status_connected;
-}
-
-static void omap_connector_destroy(struct drm_connector *connector)
-{
-	struct omap_connector *omap_connector = to_omap_connector(connector);
-
-	DBG("%s", connector->name);
-
-	drm_connector_unregister(connector);
-	drm_connector_cleanup(connector);
-
-	omapdss_device_put(omap_connector->output);
-
-	kfree(omap_connector);
-}
-
-static int omap_connector_get_modes(struct drm_connector *connector)
-{
-	DBG("%s", connector->name);
-
-	/* We can't retrieve modes. The KMS core will add the default modes. */
-	return 0;
-}
-
-enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
-					const struct drm_display_mode *mode,
-					struct drm_display_mode *adjusted_mode)
-{
-	return MODE_OK;
-}
-
-static enum drm_mode_status omap_connector_mode_valid(struct drm_connector *connector,
-				 struct drm_display_mode *mode)
-{
-	struct omap_connector *omap_connector = to_omap_connector(connector);
-	struct drm_display_mode new_mode = {};
-	enum drm_mode_status status;
-
-	status = omap_connector_mode_fixup(omap_connector->output, mode,
-					   &new_mode);
-	if (status != MODE_OK)
-		goto done;
-
-	/* Check if vrefresh is still valid. */
-	if (drm_mode_vrefresh(mode) != drm_mode_vrefresh(&new_mode))
-		status = MODE_NOCLOCK;
-
-done:
-	DBG("connector: mode %s: " DRM_MODE_FMT,
-			(status == MODE_OK) ? "valid" : "invalid",
-			DRM_MODE_ARG(mode));
-
-	return status;
-}
-
-static const struct drm_connector_funcs omap_connector_funcs = {
-	.reset = drm_atomic_helper_connector_reset,
-	.detect = omap_connector_detect,
-	.fill_modes = drm_helper_probe_single_connector_modes,
-	.destroy = omap_connector_destroy,
-	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
-};
-
-static const struct drm_connector_helper_funcs omap_connector_helper_funcs = {
-	.get_modes = omap_connector_get_modes,
-	.mode_valid = omap_connector_mode_valid,
-};
-
-/* initialize connector */
-struct drm_connector *omap_connector_init(struct drm_device *dev,
-					  struct omap_dss_device *output,
-					  struct drm_encoder *encoder)
-{
-	struct drm_connector *connector = NULL;
-	struct omap_connector *omap_connector;
-
-	DBG("%s", output->name);
-
-	omap_connector = kzalloc(sizeof(*omap_connector), GFP_KERNEL);
-	if (!omap_connector)
-		goto fail;
-
-	omap_connector->output = omapdss_device_get(output);
-
-	connector = &omap_connector->base;
-	connector->interlace_allowed = 1;
-	connector->doublescan_allowed = 0;
-
-	drm_connector_init(dev, connector, &omap_connector_funcs,
-			   DRM_MODE_CONNECTOR_DSI);
-	drm_connector_helper_add(connector, &omap_connector_helper_funcs);
-
-	return connector;
-
-fail:
-	if (connector)
-		omap_connector_destroy(connector);
-
-	return NULL;
-}
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.h b/drivers/gpu/drm/omapdrm/omap_connector.h
deleted file mode 100644
index 0ecd4f1655b7..000000000000
--- a/drivers/gpu/drm/omapdrm/omap_connector.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * omap_connector.h -- OMAP DRM Connector
- *
- * Copyright (C) 2011 Texas Instruments
- * Author: Rob Clark <rob@ti.com>
- */
-
-#ifndef __OMAPDRM_CONNECTOR_H__
-#define __OMAPDRM_CONNECTOR_H__
-
-#include <linux/types.h>
-
-enum drm_mode_status;
-
-struct drm_connector;
-struct drm_device;
-struct drm_encoder;
-struct omap_dss_device;
-
-struct drm_connector *omap_connector_init(struct drm_device *dev,
-					  struct omap_dss_device *output,
-					  struct drm_encoder *encoder);
-enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
-					const struct drm_display_mode *mode,
-					struct drm_display_mode *adjusted_mode);
-
-#endif /* __OMAPDRM_CONNECTOR_H__ */
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index b342f5b6ced0..20b5b4e9071c 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -332,19 +332,12 @@ static int omap_modeset_init(struct drm_device *dev)
 		struct drm_encoder *encoder = pipe->encoder;
 		struct drm_crtc *crtc;
 
-		if (pipe->output->next) {
-			pipe->connector = omap_connector_init(dev, pipe->output,
-							      encoder);
-			if (!pipe->connector)
-				return -ENOMEM;
-		} else {
-			pipe->connector = drm_bridge_connector_init(dev, encoder);
-			if (IS_ERR(pipe->connector)) {
-				dev_err(priv->dev,
-					"unable to create bridge connector for %s\n",
-					pipe->output->name);
-				return PTR_ERR(pipe->connector);
-			}
+		pipe->connector = drm_bridge_connector_init(dev, encoder);
+		if (IS_ERR(pipe->connector)) {
+			dev_err(priv->dev,
+				"unable to create bridge connector for %s\n",
+				pipe->output->name);
+			return PTR_ERR(pipe->connector);
 		}
 
 		drm_connector_attach_encoder(pipe->connector, encoder);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index 8a1fac680138..93d171ffd26d 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -16,7 +16,6 @@
 #include <drm/drm_gem.h>
 #include <drm/omap_drm.h>
 
-#include "omap_connector.h"
 #include "omap_crtc.h"
 #include "omap_encoder.h"
 #include "omap_fb.h"
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index abb3821de8b8..610c5a2f2771 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -139,17 +139,6 @@ static int omap_encoder_atomic_check(struct drm_encoder *encoder,
 				     struct drm_crtc_state *crtc_state,
 				     struct drm_connector_state *conn_state)
 {
-	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
-	enum drm_mode_status status;
-
-	status = omap_connector_mode_fixup(omap_encoder->output,
-					   &crtc_state->mode,
-					   &crtc_state->adjusted_mode);
-	if (status != MODE_OK) {
-		dev_err(encoder->dev->dev, "invalid timings: %d\n", status);
-		return -EINVAL;
-	}
-
 	return 0;
 }
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 43/56] drm/omap: remove unused omap_connector
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Remove unused code. Connectors are now created via drm_bridge_connector_init()
and no longer OMAP specific.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/Makefile         |   1 -
 drivers/gpu/drm/omapdrm/omap_connector.c | 128 -----------------------
 drivers/gpu/drm/omapdrm/omap_connector.h |  28 -----
 drivers/gpu/drm/omapdrm/omap_drv.c       |  19 ++--
 drivers/gpu/drm/omapdrm/omap_drv.h       |   1 -
 drivers/gpu/drm/omapdrm/omap_encoder.c   |  11 --
 6 files changed, 6 insertions(+), 182 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.c
 delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.h

diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index 66a73eae6f7c..2a404e045b78 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -12,7 +12,6 @@ omapdrm-y := omap_drv.o \
 	omap_crtc.o \
 	omap_plane.o \
 	omap_encoder.o \
-	omap_connector.o \
 	omap_fb.o \
 	omap_gem.o \
 	omap_gem_dmabuf.o \
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
deleted file mode 100644
index c6d9b4268841..000000000000
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ /dev/null
@@ -1,128 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- * Author: Rob Clark <rob@ti.com>
- */
-
-#include <drm/drm_atomic_helper.h>
-#include <drm/drm_crtc.h>
-#include <drm/drm_probe_helper.h>
-
-#include "omap_drv.h"
-
-/*
- * connector funcs
- */
-
-#define to_omap_connector(x) container_of(x, struct omap_connector, base)
-
-struct omap_connector {
-	struct drm_connector base;
-	struct omap_dss_device *output;
-};
-
-static enum drm_connector_status omap_connector_detect(
-		struct drm_connector *connector, bool force)
-{
-	return connector_status_connected;
-}
-
-static void omap_connector_destroy(struct drm_connector *connector)
-{
-	struct omap_connector *omap_connector = to_omap_connector(connector);
-
-	DBG("%s", connector->name);
-
-	drm_connector_unregister(connector);
-	drm_connector_cleanup(connector);
-
-	omapdss_device_put(omap_connector->output);
-
-	kfree(omap_connector);
-}
-
-static int omap_connector_get_modes(struct drm_connector *connector)
-{
-	DBG("%s", connector->name);
-
-	/* We can't retrieve modes. The KMS core will add the default modes. */
-	return 0;
-}
-
-enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
-					const struct drm_display_mode *mode,
-					struct drm_display_mode *adjusted_mode)
-{
-	return MODE_OK;
-}
-
-static enum drm_mode_status omap_connector_mode_valid(struct drm_connector *connector,
-				 struct drm_display_mode *mode)
-{
-	struct omap_connector *omap_connector = to_omap_connector(connector);
-	struct drm_display_mode new_mode = {};
-	enum drm_mode_status status;
-
-	status = omap_connector_mode_fixup(omap_connector->output, mode,
-					   &new_mode);
-	if (status != MODE_OK)
-		goto done;
-
-	/* Check if vrefresh is still valid. */
-	if (drm_mode_vrefresh(mode) != drm_mode_vrefresh(&new_mode))
-		status = MODE_NOCLOCK;
-
-done:
-	DBG("connector: mode %s: " DRM_MODE_FMT,
-			(status == MODE_OK) ? "valid" : "invalid",
-			DRM_MODE_ARG(mode));
-
-	return status;
-}
-
-static const struct drm_connector_funcs omap_connector_funcs = {
-	.reset = drm_atomic_helper_connector_reset,
-	.detect = omap_connector_detect,
-	.fill_modes = drm_helper_probe_single_connector_modes,
-	.destroy = omap_connector_destroy,
-	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
-};
-
-static const struct drm_connector_helper_funcs omap_connector_helper_funcs = {
-	.get_modes = omap_connector_get_modes,
-	.mode_valid = omap_connector_mode_valid,
-};
-
-/* initialize connector */
-struct drm_connector *omap_connector_init(struct drm_device *dev,
-					  struct omap_dss_device *output,
-					  struct drm_encoder *encoder)
-{
-	struct drm_connector *connector = NULL;
-	struct omap_connector *omap_connector;
-
-	DBG("%s", output->name);
-
-	omap_connector = kzalloc(sizeof(*omap_connector), GFP_KERNEL);
-	if (!omap_connector)
-		goto fail;
-
-	omap_connector->output = omapdss_device_get(output);
-
-	connector = &omap_connector->base;
-	connector->interlace_allowed = 1;
-	connector->doublescan_allowed = 0;
-
-	drm_connector_init(dev, connector, &omap_connector_funcs,
-			   DRM_MODE_CONNECTOR_DSI);
-	drm_connector_helper_add(connector, &omap_connector_helper_funcs);
-
-	return connector;
-
-fail:
-	if (connector)
-		omap_connector_destroy(connector);
-
-	return NULL;
-}
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.h b/drivers/gpu/drm/omapdrm/omap_connector.h
deleted file mode 100644
index 0ecd4f1655b7..000000000000
--- a/drivers/gpu/drm/omapdrm/omap_connector.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * omap_connector.h -- OMAP DRM Connector
- *
- * Copyright (C) 2011 Texas Instruments
- * Author: Rob Clark <rob@ti.com>
- */
-
-#ifndef __OMAPDRM_CONNECTOR_H__
-#define __OMAPDRM_CONNECTOR_H__
-
-#include <linux/types.h>
-
-enum drm_mode_status;
-
-struct drm_connector;
-struct drm_device;
-struct drm_encoder;
-struct omap_dss_device;
-
-struct drm_connector *omap_connector_init(struct drm_device *dev,
-					  struct omap_dss_device *output,
-					  struct drm_encoder *encoder);
-enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
-					const struct drm_display_mode *mode,
-					struct drm_display_mode *adjusted_mode);
-
-#endif /* __OMAPDRM_CONNECTOR_H__ */
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index b342f5b6ced0..20b5b4e9071c 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -332,19 +332,12 @@ static int omap_modeset_init(struct drm_device *dev)
 		struct drm_encoder *encoder = pipe->encoder;
 		struct drm_crtc *crtc;
 
-		if (pipe->output->next) {
-			pipe->connector = omap_connector_init(dev, pipe->output,
-							      encoder);
-			if (!pipe->connector)
-				return -ENOMEM;
-		} else {
-			pipe->connector = drm_bridge_connector_init(dev, encoder);
-			if (IS_ERR(pipe->connector)) {
-				dev_err(priv->dev,
-					"unable to create bridge connector for %s\n",
-					pipe->output->name);
-				return PTR_ERR(pipe->connector);
-			}
+		pipe->connector = drm_bridge_connector_init(dev, encoder);
+		if (IS_ERR(pipe->connector)) {
+			dev_err(priv->dev,
+				"unable to create bridge connector for %s\n",
+				pipe->output->name);
+			return PTR_ERR(pipe->connector);
 		}
 
 		drm_connector_attach_encoder(pipe->connector, encoder);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index 8a1fac680138..93d171ffd26d 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -16,7 +16,6 @@
 #include <drm/drm_gem.h>
 #include <drm/omap_drm.h>
 
-#include "omap_connector.h"
 #include "omap_crtc.h"
 #include "omap_encoder.h"
 #include "omap_fb.h"
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index abb3821de8b8..610c5a2f2771 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -139,17 +139,6 @@ static int omap_encoder_atomic_check(struct drm_encoder *encoder,
 				     struct drm_crtc_state *crtc_state,
 				     struct drm_connector_state *conn_state)
 {
-	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
-	enum drm_mode_status status;
-
-	status = omap_connector_mode_fixup(omap_encoder->output,
-					   &crtc_state->mode,
-					   &crtc_state->adjusted_mode);
-	if (status != MODE_OK) {
-		dev_err(encoder->dev->dev, "invalid timings: %d\n", status);
-		return -EINVAL;
-	}
-
 	return 0;
 }
 
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 44/56] drm/omap: simplify omap_display_id
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

We no longer need to check for the DSS API, since all encoders,
panels and connectors have been converted to the bridge API.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 20b5b4e9071c..dbb8e95234b3 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -206,14 +206,7 @@ static int omap_display_id(struct omap_dss_device *output)
 {
 	struct device_node *node = NULL;
 
-	if (output->next) {
-		struct omap_dss_device *display = output;
-
-		while (display->next)
-			display = display->next;
-
-		node = display->dev->of_node;
-	} else if (output->bridge) {
+	if (output->bridge) {
 		struct drm_bridge *bridge = output->bridge;
 
 		while (drm_bridge_get_next_bridge(bridge))
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 44/56] drm/omap: simplify omap_display_id
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

We no longer need to check for the DSS API, since all encoders,
panels and connectors have been converted to the bridge API.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 20b5b4e9071c..dbb8e95234b3 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -206,14 +206,7 @@ static int omap_display_id(struct omap_dss_device *output)
 {
 	struct device_node *node = NULL;
 
-	if (output->next) {
-		struct omap_dss_device *display = output;
-
-		while (display->next)
-			display = display->next;
-
-		node = display->dev->of_node;
-	} else if (output->bridge) {
+	if (output->bridge) {
 		struct drm_bridge *bridge = output->bridge;
 
 		while (drm_bridge_get_next_bridge(bridge))
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 45/56] drm/omap: drop unused DSS next pointer
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Since all encoders and panels are using the bridge API now,
we next pointer is no longer useful and can be dropped.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c     |  2 +-
 drivers/gpu/drm/omapdrm/dss/omapdss.h  |  1 -
 drivers/gpu/drm/omapdrm/dss/output.c   | 13 +------------
 drivers/gpu/drm/omapdrm/omap_encoder.c |  4 ----
 4 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index c2791305c332..d62713b241d2 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -135,7 +135,7 @@ struct omap_dss_device *omapdss_device_next_output(struct omap_dss_device *from)
 			goto done;
 		}
 
-		if (dssdev->id && (dssdev->next || dssdev->bridge))
+		if (dssdev->id && (dssdev->bridge))
 			goto done;
 	}
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 5d6edec5a427..1f02d3e406dc 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -293,7 +293,6 @@ struct omap_dss_device {
 	struct module *owner;
 
 	struct dss_device *dss;
-	struct omap_dss_device *next;
 	struct drm_bridge *bridge;
 	struct drm_bridge *next_bridge;
 	struct drm_panel *panel;
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
index ce21c798cca6..40cb353572f6 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -30,7 +30,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
 		return 0;
 	}
 
-	out->next = omapdss_find_device_by_node(remote_node);
 	out->bridge = of_drm_find_bridge(remote_node);
 	out->panel = of_drm_find_panel(remote_node);
 	if (IS_ERR(out->panel))
@@ -38,12 +37,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
 
 	of_node_put(remote_node);
 
-	if (out->next && out->type != out->next->type) {
-		dev_err(out->dev, "output type and display type don't match\n");
-		ret = -EINVAL;
-		goto error;
-	}
-
 	if (out->panel) {
 		struct drm_bridge *bridge;
 
@@ -69,7 +62,7 @@ int omapdss_device_init_output(struct omap_dss_device *out,
 		out->bridge = local_bridge;
 	}
 
-	if (!out->next && !out->bridge) {
+	if (!out->bridge) {
 		ret = -EPROBE_DEFER;
 		goto error;
 	}
@@ -78,7 +71,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
 
 error:
 	omapdss_device_cleanup_output(out);
-	out->next = NULL;
 	return ret;
 }
 EXPORT_SYMBOL(omapdss_device_init_output);
@@ -88,9 +80,6 @@ void omapdss_device_cleanup_output(struct omap_dss_device *out)
 	if (out->bridge && out->panel)
 		drm_panel_bridge_remove(out->next_bridge ?
 					out->next_bridge : out->bridge);
-
-	if (out->next)
-		omapdss_device_put(out->next);
 }
 EXPORT_SYMBOL(omapdss_device_cleanup_output);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 610c5a2f2771..5f5fa01240a7 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -75,7 +75,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 {
 	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
 	struct omap_dss_device *output = omap_encoder->output;
-	struct omap_dss_device *dssdev;
 	struct drm_device *dev = encoder->dev;
 	struct drm_connector *connector;
 	struct drm_bridge *bridge;
@@ -98,9 +97,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 	 *
 	 * A better solution is to use DRM's bus-flags through the whole driver.
 	 */
-	for (dssdev = output; dssdev; dssdev = dssdev->next)
-		omap_encoder_update_videomode_flags(&vm, dssdev->bus_flags);
-
 	for (bridge = output->bridge; bridge;
 	     bridge = drm_bridge_get_next_bridge(bridge)) {
 		if (!bridge->timings)
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 45/56] drm/omap: drop unused DSS next pointer
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Since all encoders and panels are using the bridge API now,
we next pointer is no longer useful and can be dropped.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c     |  2 +-
 drivers/gpu/drm/omapdrm/dss/omapdss.h  |  1 -
 drivers/gpu/drm/omapdrm/dss/output.c   | 13 +------------
 drivers/gpu/drm/omapdrm/omap_encoder.c |  4 ----
 4 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index c2791305c332..d62713b241d2 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -135,7 +135,7 @@ struct omap_dss_device *omapdss_device_next_output(struct omap_dss_device *from)
 			goto done;
 		}
 
-		if (dssdev->id && (dssdev->next || dssdev->bridge))
+		if (dssdev->id && (dssdev->bridge))
 			goto done;
 	}
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 5d6edec5a427..1f02d3e406dc 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -293,7 +293,6 @@ struct omap_dss_device {
 	struct module *owner;
 
 	struct dss_device *dss;
-	struct omap_dss_device *next;
 	struct drm_bridge *bridge;
 	struct drm_bridge *next_bridge;
 	struct drm_panel *panel;
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
index ce21c798cca6..40cb353572f6 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -30,7 +30,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
 		return 0;
 	}
 
-	out->next = omapdss_find_device_by_node(remote_node);
 	out->bridge = of_drm_find_bridge(remote_node);
 	out->panel = of_drm_find_panel(remote_node);
 	if (IS_ERR(out->panel))
@@ -38,12 +37,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
 
 	of_node_put(remote_node);
 
-	if (out->next && out->type != out->next->type) {
-		dev_err(out->dev, "output type and display type don't match\n");
-		ret = -EINVAL;
-		goto error;
-	}
-
 	if (out->panel) {
 		struct drm_bridge *bridge;
 
@@ -69,7 +62,7 @@ int omapdss_device_init_output(struct omap_dss_device *out,
 		out->bridge = local_bridge;
 	}
 
-	if (!out->next && !out->bridge) {
+	if (!out->bridge) {
 		ret = -EPROBE_DEFER;
 		goto error;
 	}
@@ -78,7 +71,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
 
 error:
 	omapdss_device_cleanup_output(out);
-	out->next = NULL;
 	return ret;
 }
 EXPORT_SYMBOL(omapdss_device_init_output);
@@ -88,9 +80,6 @@ void omapdss_device_cleanup_output(struct omap_dss_device *out)
 	if (out->bridge && out->panel)
 		drm_panel_bridge_remove(out->next_bridge ?
 					out->next_bridge : out->bridge);
-
-	if (out->next)
-		omapdss_device_put(out->next);
 }
 EXPORT_SYMBOL(omapdss_device_cleanup_output);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 610c5a2f2771..5f5fa01240a7 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -75,7 +75,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 {
 	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
 	struct omap_dss_device *output = omap_encoder->output;
-	struct omap_dss_device *dssdev;
 	struct drm_device *dev = encoder->dev;
 	struct drm_connector *connector;
 	struct drm_bridge *bridge;
@@ -98,9 +97,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 	 *
 	 * A better solution is to use DRM's bus-flags through the whole driver.
 	 */
-	for (dssdev = output; dssdev; dssdev = dssdev->next)
-		omap_encoder_update_videomode_flags(&vm, dssdev->bus_flags);
-
 	for (bridge = output->bridge; bridge;
 	     bridge = drm_bridge_get_next_bridge(bridge)) {
 		if (!bridge->timings)
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 46/56] drm/omap: drop empty omap_encoder helper functions
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Cleanup empty functions for encoder enable, disable and atomic check.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_encoder.c | 28 --------------------------
 1 file changed, 28 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 5f5fa01240a7..e24411fb9dac 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -113,36 +113,8 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 	dss_mgr_set_timings(output, &vm);
 }
 
-static void omap_encoder_disable(struct drm_encoder *encoder)
-{
-	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
-	struct omap_dss_device *dssdev = omap_encoder->output;
-	struct drm_device *dev = encoder->dev;
-
-	dev_dbg(dev->dev, "disable(%s)\n", dssdev->name);
-}
-
-static void omap_encoder_enable(struct drm_encoder *encoder)
-{
-	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
-	struct omap_dss_device *dssdev = omap_encoder->output;
-	struct drm_device *dev = encoder->dev;
-
-	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
-}
-
-static int omap_encoder_atomic_check(struct drm_encoder *encoder,
-				     struct drm_crtc_state *crtc_state,
-				     struct drm_connector_state *conn_state)
-{
-	return 0;
-}
-
 static const struct drm_encoder_helper_funcs omap_encoder_helper_funcs = {
 	.mode_set = omap_encoder_mode_set,
-	.disable = omap_encoder_disable,
-	.enable = omap_encoder_enable,
-	.atomic_check = omap_encoder_atomic_check,
 };
 
 /* initialize encoder */
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 46/56] drm/omap: drop empty omap_encoder helper functions
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Cleanup empty functions for encoder enable, disable and atomic check.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_encoder.c | 28 --------------------------
 1 file changed, 28 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 5f5fa01240a7..e24411fb9dac 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -113,36 +113,8 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
 	dss_mgr_set_timings(output, &vm);
 }
 
-static void omap_encoder_disable(struct drm_encoder *encoder)
-{
-	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
-	struct omap_dss_device *dssdev = omap_encoder->output;
-	struct drm_device *dev = encoder->dev;
-
-	dev_dbg(dev->dev, "disable(%s)\n", dssdev->name);
-}
-
-static void omap_encoder_enable(struct drm_encoder *encoder)
-{
-	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
-	struct omap_dss_device *dssdev = omap_encoder->output;
-	struct drm_device *dev = encoder->dev;
-
-	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
-}
-
-static int omap_encoder_atomic_check(struct drm_encoder *encoder,
-				     struct drm_crtc_state *crtc_state,
-				     struct drm_connector_state *conn_state)
-{
-	return 0;
-}
-
 static const struct drm_encoder_helper_funcs omap_encoder_helper_funcs = {
 	.mode_set = omap_encoder_mode_set,
-	.disable = omap_encoder_disable,
-	.enable = omap_encoder_enable,
-	.atomic_check = omap_encoder_atomic_check,
 };
 
 /* initialize encoder */
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 47/56] drm/omap: drop DSS ops_flags
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The omapdss device's ops_flags field is no longer
used and can be dropped.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 9 ---------
 drivers/gpu/drm/omapdrm/dss/venc.c    | 1 -
 2 files changed, 10 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 1f02d3e406dc..916c55101629 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -279,14 +279,6 @@ struct omap_dss_device_ops {
 	const struct omapdss_dsi_ops dsi;
 };
 
-/**
- * enum omap_dss_device_ops_flag - Indicates which device ops are supported
- * @OMAP_DSS_DEVICE_OP_MODES: The device supports reading modes
- */
-enum omap_dss_device_ops_flag {
-	OMAP_DSS_DEVICE_OP_MODES = BIT(3),
-};
-
 struct omap_dss_device {
 	struct device *dev;
 
@@ -315,7 +307,6 @@ struct omap_dss_device {
 	const char *name;
 
 	const struct omap_dss_device_ops *ops;
-	unsigned long ops_flags;
 	u32 bus_flags;
 
 	/* OMAP DSS output specific fields */
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
index 5c027c81760f..6e418a0f7572 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -732,7 +732,6 @@ static int venc_init_output(struct venc_device *venc)
 	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
 	out->owner = THIS_MODULE;
 	out->of_port = 0;
-	out->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
 
 	r = omapdss_device_init_output(out, &venc->bridge);
 	if (r < 0) {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 47/56] drm/omap: drop DSS ops_flags
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The omapdss device's ops_flags field is no longer
used and can be dropped.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 9 ---------
 drivers/gpu/drm/omapdrm/dss/venc.c    | 1 -
 2 files changed, 10 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 1f02d3e406dc..916c55101629 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -279,14 +279,6 @@ struct omap_dss_device_ops {
 	const struct omapdss_dsi_ops dsi;
 };
 
-/**
- * enum omap_dss_device_ops_flag - Indicates which device ops are supported
- * @OMAP_DSS_DEVICE_OP_MODES: The device supports reading modes
- */
-enum omap_dss_device_ops_flag {
-	OMAP_DSS_DEVICE_OP_MODES = BIT(3),
-};
-
 struct omap_dss_device {
 	struct device *dev;
 
@@ -315,7 +307,6 @@ struct omap_dss_device {
 	const char *name;
 
 	const struct omap_dss_device_ops *ops;
-	unsigned long ops_flags;
 	u32 bus_flags;
 
 	/* OMAP DSS output specific fields */
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
index 5c027c81760f..6e418a0f7572 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -732,7 +732,6 @@ static int venc_init_output(struct venc_device *venc)
 	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
 	out->owner = THIS_MODULE;
 	out->of_port = 0;
-	out->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
 
 	r = omapdss_device_init_output(out, &venc->bridge);
 	if (r < 0) {
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 48/56] drm/omap: drop dssdev display field
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

All displays are using drm_panel instead off dssdev
now, so this field is always 0 and can be dropped.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c    | 2 +-
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index d62713b241d2..d9a5e7b9d401 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -198,7 +198,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
 	}
 
 	if (!dst->id && !omapdss_device_is_connected(dst)) {
-		WARN_ON(!dst->display);
+		WARN_ON(1);
 		return;
 	}
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 916c55101629..c2199c4946ec 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -298,12 +298,6 @@ struct omap_dss_device {
 	 */
 	enum omap_display_type type;
 
-	/*
-	 * True if the device is a display (panel or connector) at the end of
-	 * the pipeline, false otherwise.
-	 */
-	bool display;
-
 	const char *name;
 
 	const struct omap_dss_device_ops *ops;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 48/56] drm/omap: drop dssdev display field
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

All displays are using drm_panel instead off dssdev
now, so this field is always 0 and can be dropped.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c    | 2 +-
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index d62713b241d2..d9a5e7b9d401 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -198,7 +198,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
 	}
 
 	if (!dst->id && !omapdss_device_is_connected(dst)) {
-		WARN_ON(!dst->display);
+		WARN_ON(1);
 		return;
 	}
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 916c55101629..c2199c4946ec 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -298,12 +298,6 @@ struct omap_dss_device {
 	 */
 	enum omap_display_type type;
 
-	/*
-	 * True if the device is a display (panel or connector) at the end of
-	 * the pipeline, false otherwise.
-	 */
-	bool display;
-
 	const char *name;
 
 	const struct omap_dss_device_ops *ops;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 49/56] drm/omap: simplify DSI manual update code
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Move dsi_ops into the main structure, since all other ops
are gone. Instead of checking the device type we can simply
check if dsi_ops are set.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c     | 10 ++++------
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  6 +-----
 drivers/gpu/drm/omapdrm/omap_crtc.c   | 16 ++++------------
 3 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index bbcdb62e1571..f47d7e3bb631 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5011,11 +5011,9 @@ static int dsi_get_clocks(struct dsi_data *dsi)
 	return 0;
 }
 
-static const struct omap_dss_device_ops dsi_ops = {
-	.dsi = {
-		.update = dsi_update_all,
-		.is_video_mode = dsi_is_video_mode,
-	},
+static const struct omapdss_dsi_ops dsi_ops = {
+	.update = dsi_update_all,
+	.is_video_mode = dsi_is_video_mode,
 };
 
 static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
@@ -5450,7 +5448,7 @@ static int dsi_init_output(struct dsi_data *dsi)
 	out->type = OMAP_DISPLAY_TYPE_DSI;
 	out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
 	out->dispc_channel = dsi_get_channel(dsi);
-	out->ops = &dsi_ops;
+	out->dsi_ops = &dsi_ops;
 	out->owner = THIS_MODULE;
 	out->of_port = 0;
 	out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index c2199c4946ec..a1236b8ef7ea 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -275,10 +275,6 @@ struct omapdss_dsi_ops {
 	bool (*is_video_mode)(struct omap_dss_device *dssdev);
 };
 
-struct omap_dss_device_ops {
-	const struct omapdss_dsi_ops dsi;
-};
-
 struct omap_dss_device {
 	struct device *dev;
 
@@ -300,7 +296,7 @@ struct omap_dss_device {
 
 	const char *name;
 
-	const struct omap_dss_device_ops *ops;
+	const struct omapdss_dsi_ops *dsi_ops;
 	u32 bus_flags;
 
 	/* OMAP DSS output specific fields */
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index f6b968060cf0..5ab557c477ef 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -366,17 +366,10 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
 	struct drm_device *dev = omap_crtc->base.dev;
 	int ret;
 
-	if (!dssdev) {
-		dev_err_once(dev->dev, "missing display dssdev!");
+	if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->update)
 		return;
-	}
-
-	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI || !dssdev->ops->dsi.update) {
-		dev_err_once(dev->dev, "no DSI update callback found!");
-		return;
-	}
 
-	ret = dssdev->ops->dsi.update(dssdev);
+	ret = dssdev->dsi_ops->update(dssdev);
 	if (ret < 0) {
 		spin_lock_irq(&dev->event_lock);
 		omap_crtc->pending = false;
@@ -550,11 +543,10 @@ static bool omap_crtc_is_manually_updated(struct drm_crtc *crtc)
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
 	struct omap_dss_device *dssdev = omap_crtc->pipe->output;
 
-	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
-	    !dssdev->ops->dsi.is_video_mode)
+	if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->is_video_mode)
 		return false;
 
-	if (dssdev->ops->dsi.is_video_mode(dssdev))
+	if (dssdev->dsi_ops->is_video_mode(dssdev))
 		return false;
 
 	DBG("detected manually updated display!");
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 49/56] drm/omap: simplify DSI manual update code
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Move dsi_ops into the main structure, since all other ops
are gone. Instead of checking the device type we can simply
check if dsi_ops are set.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c     | 10 ++++------
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  6 +-----
 drivers/gpu/drm/omapdrm/omap_crtc.c   | 16 ++++------------
 3 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index bbcdb62e1571..f47d7e3bb631 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5011,11 +5011,9 @@ static int dsi_get_clocks(struct dsi_data *dsi)
 	return 0;
 }
 
-static const struct omap_dss_device_ops dsi_ops = {
-	.dsi = {
-		.update = dsi_update_all,
-		.is_video_mode = dsi_is_video_mode,
-	},
+static const struct omapdss_dsi_ops dsi_ops = {
+	.update = dsi_update_all,
+	.is_video_mode = dsi_is_video_mode,
 };
 
 static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
@@ -5450,7 +5448,7 @@ static int dsi_init_output(struct dsi_data *dsi)
 	out->type = OMAP_DISPLAY_TYPE_DSI;
 	out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
 	out->dispc_channel = dsi_get_channel(dsi);
-	out->ops = &dsi_ops;
+	out->dsi_ops = &dsi_ops;
 	out->owner = THIS_MODULE;
 	out->of_port = 0;
 	out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index c2199c4946ec..a1236b8ef7ea 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -275,10 +275,6 @@ struct omapdss_dsi_ops {
 	bool (*is_video_mode)(struct omap_dss_device *dssdev);
 };
 
-struct omap_dss_device_ops {
-	const struct omapdss_dsi_ops dsi;
-};
-
 struct omap_dss_device {
 	struct device *dev;
 
@@ -300,7 +296,7 @@ struct omap_dss_device {
 
 	const char *name;
 
-	const struct omap_dss_device_ops *ops;
+	const struct omapdss_dsi_ops *dsi_ops;
 	u32 bus_flags;
 
 	/* OMAP DSS output specific fields */
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index f6b968060cf0..5ab557c477ef 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -366,17 +366,10 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
 	struct drm_device *dev = omap_crtc->base.dev;
 	int ret;
 
-	if (!dssdev) {
-		dev_err_once(dev->dev, "missing display dssdev!");
+	if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->update)
 		return;
-	}
-
-	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI || !dssdev->ops->dsi.update) {
-		dev_err_once(dev->dev, "no DSI update callback found!");
-		return;
-	}
 
-	ret = dssdev->ops->dsi.update(dssdev);
+	ret = dssdev->dsi_ops->update(dssdev);
 	if (ret < 0) {
 		spin_lock_irq(&dev->event_lock);
 		omap_crtc->pending = false;
@@ -550,11 +543,10 @@ static bool omap_crtc_is_manually_updated(struct drm_crtc *crtc)
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
 	struct omap_dss_device *dssdev = omap_crtc->pipe->output;
 
-	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
-	    !dssdev->ops->dsi.is_video_mode)
+	if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->is_video_mode)
 		return false;
 
-	if (dssdev->ops->dsi.is_video_mode(dssdev))
+	if (dssdev->dsi_ops->is_video_mode(dssdev))
 		return false;
 
 	DBG("detected manually updated display!");
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 50/56] drm/omap: dsi: simplify pin config
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Simplify DSI pin config, which always originates from DT
nowadays. With the code being fully contained in the DSI
encoder, we can drop the public structure.

Since the function is no longer exposed, it now directly
takes the private DSI data pointer. This drop a pointless
conversion and means the pins can be configured earlier.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c     | 33 +++++++++------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 15 ------------
 2 files changed, 11 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index f47d7e3bb631..76e4f607d8cf 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -3568,12 +3568,9 @@ static void dsi_proto_timings(struct dsi_data *dsi)
 	}
 }
 
-static int dsi_configure_pins(struct omap_dss_device *dssdev,
-		const struct omap_dsi_pin_config *pin_cfg)
+static int dsi_configure_pins(struct dsi_data *dsi,
+		int num_pins, const u32 *pins)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-	int num_pins;
-	const int *pins;
 	struct dsi_lane_config lanes[DSI_MAX_NR_LANES];
 	int num_lanes;
 	int i;
@@ -3586,9 +3583,6 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
 		DSI_LANE_DATA4,
 	};
 
-	num_pins = pin_cfg->num_pins;
-	pins = pin_cfg->pins;
-
 	if (num_pins < 4 || num_pins > dsi->num_lanes_supported * 2
 			|| num_pins % 2 != 0)
 		return -EINVAL;
@@ -3600,7 +3594,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
 
 	for (i = 0; i < num_pins; i += 2) {
 		u8 lane, pol;
-		int dx, dy;
+		u32 dx, dy;
 
 		dx = pins[i];
 		dy = pins[i + 1];
@@ -5481,9 +5475,8 @@ static int dsi_probe_of(struct dsi_data *dsi)
 	struct property *prop;
 	u32 lane_arr[10];
 	int len, num_pins;
-	int r, i;
+	int r;
 	struct device_node *ep;
-	struct omap_dsi_pin_config pin_cfg;
 
 	ep = of_graph_get_endpoint_by_regs(node, 0, 0);
 	if (!ep)
@@ -5511,11 +5504,7 @@ static int dsi_probe_of(struct dsi_data *dsi)
 		goto err;
 	}
 
-	pin_cfg.num_pins = num_pins;
-	for (i = 0; i < num_pins; ++i)
-		pin_cfg.pins[i] = (int)lane_arr[i];
-
-	r = dsi_configure_pins(&dsi->output, &pin_cfg);
+	r = dsi_configure_pins(dsi, num_pins, lane_arr);
 	if (r) {
 		dev_err(dsi->dev, "failed to configure pins");
 		goto err;
@@ -5728,6 +5717,12 @@ static int dsi_probe(struct platform_device *pdev)
 	dsi->host.ops = &omap_dsi_host_ops;
 	dsi->host.dev = &pdev->dev;
 
+	r = dsi_probe_of(dsi);
+	if (r) {
+		DSSERR("Invalid DSI DT data\n");
+		goto err_pm_disable;
+	}
+
 	r = mipi_dsi_host_register(&dsi->host);
 	if (r < 0) {
 		dev_err(&pdev->dev, "failed to register DSI host: %d\n", r);
@@ -5738,12 +5733,6 @@ static int dsi_probe(struct platform_device *pdev)
 	if (r)
 		goto err_dsi_host_unregister;
 
-	r = dsi_probe_of(dsi);
-	if (r) {
-		DSSERR("Invalid DSI DT data\n");
-		goto err_uninit_output;
-	}
-
 	r = component_add(&pdev->dev, &dsi_component_ops);
 	if (r)
 		goto err_uninit_output;
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index a1236b8ef7ea..4a0826c8fed5 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -243,21 +243,6 @@ struct omap_overlay_manager_info {
 	struct omap_dss_cpr_coefs cpr_coefs;
 };
 
-/* 22 pins means 1 clk lane and 10 data lanes */
-#define OMAP_DSS_MAX_DSI_PINS 22
-
-struct omap_dsi_pin_config {
-	int num_pins;
-	/*
-	 * pin numbers in the following order:
-	 * clk+, clk-
-	 * data1+, data1-
-	 * data2+, data2-
-	 * ...
-	 */
-	int pins[OMAP_DSS_MAX_DSI_PINS];
-};
-
 struct omap_dss_writeback_info {
 	u32 paddr;
 	u32 p_uv_addr;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 50/56] drm/omap: dsi: simplify pin config
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

Simplify DSI pin config, which always originates from DT
nowadays. With the code being fully contained in the DSI
encoder, we can drop the public structure.

Since the function is no longer exposed, it now directly
takes the private DSI data pointer. This drop a pointless
conversion and means the pins can be configured earlier.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c     | 33 +++++++++------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 15 ------------
 2 files changed, 11 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index f47d7e3bb631..76e4f607d8cf 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -3568,12 +3568,9 @@ static void dsi_proto_timings(struct dsi_data *dsi)
 	}
 }
 
-static int dsi_configure_pins(struct omap_dss_device *dssdev,
-		const struct omap_dsi_pin_config *pin_cfg)
+static int dsi_configure_pins(struct dsi_data *dsi,
+		int num_pins, const u32 *pins)
 {
-	struct dsi_data *dsi = to_dsi_data(dssdev);
-	int num_pins;
-	const int *pins;
 	struct dsi_lane_config lanes[DSI_MAX_NR_LANES];
 	int num_lanes;
 	int i;
@@ -3586,9 +3583,6 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
 		DSI_LANE_DATA4,
 	};
 
-	num_pins = pin_cfg->num_pins;
-	pins = pin_cfg->pins;
-
 	if (num_pins < 4 || num_pins > dsi->num_lanes_supported * 2
 			|| num_pins % 2 != 0)
 		return -EINVAL;
@@ -3600,7 +3594,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
 
 	for (i = 0; i < num_pins; i += 2) {
 		u8 lane, pol;
-		int dx, dy;
+		u32 dx, dy;
 
 		dx = pins[i];
 		dy = pins[i + 1];
@@ -5481,9 +5475,8 @@ static int dsi_probe_of(struct dsi_data *dsi)
 	struct property *prop;
 	u32 lane_arr[10];
 	int len, num_pins;
-	int r, i;
+	int r;
 	struct device_node *ep;
-	struct omap_dsi_pin_config pin_cfg;
 
 	ep = of_graph_get_endpoint_by_regs(node, 0, 0);
 	if (!ep)
@@ -5511,11 +5504,7 @@ static int dsi_probe_of(struct dsi_data *dsi)
 		goto err;
 	}
 
-	pin_cfg.num_pins = num_pins;
-	for (i = 0; i < num_pins; ++i)
-		pin_cfg.pins[i] = (int)lane_arr[i];
-
-	r = dsi_configure_pins(&dsi->output, &pin_cfg);
+	r = dsi_configure_pins(dsi, num_pins, lane_arr);
 	if (r) {
 		dev_err(dsi->dev, "failed to configure pins");
 		goto err;
@@ -5728,6 +5717,12 @@ static int dsi_probe(struct platform_device *pdev)
 	dsi->host.ops = &omap_dsi_host_ops;
 	dsi->host.dev = &pdev->dev;
 
+	r = dsi_probe_of(dsi);
+	if (r) {
+		DSSERR("Invalid DSI DT data\n");
+		goto err_pm_disable;
+	}
+
 	r = mipi_dsi_host_register(&dsi->host);
 	if (r < 0) {
 		dev_err(&pdev->dev, "failed to register DSI host: %d\n", r);
@@ -5738,12 +5733,6 @@ static int dsi_probe(struct platform_device *pdev)
 	if (r)
 		goto err_dsi_host_unregister;
 
-	r = dsi_probe_of(dsi);
-	if (r) {
-		DSSERR("Invalid DSI DT data\n");
-		goto err_uninit_output;
-	}
-
 	r = component_add(&pdev->dev, &dsi_component_ops);
 	if (r)
 		goto err_uninit_output;
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index a1236b8ef7ea..4a0826c8fed5 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -243,21 +243,6 @@ struct omap_overlay_manager_info {
 	struct omap_dss_cpr_coefs cpr_coefs;
 };
 
-/* 22 pins means 1 clk lane and 10 data lanes */
-#define OMAP_DSS_MAX_DSI_PINS 22
-
-struct omap_dsi_pin_config {
-	int num_pins;
-	/*
-	 * pin numbers in the following order:
-	 * clk+, clk-
-	 * data1+, data1-
-	 * data2+, data2-
-	 * ...
-	 */
-	int pins[OMAP_DSS_MAX_DSI_PINS];
-};
-
 struct omap_dss_writeback_info {
 	u32 paddr;
 	u32 p_uv_addr;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 51/56] ARM: omap2plus_defconfig: Update for moved DSI command mode panel
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Tomi Valkeinen

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The DSI command mode panel is no longer specific
to OMAP and thus the config option has been renamed
slightly.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/configs/omap2plus_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 34793aabdb65..d329d0829fce 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -369,7 +369,7 @@ CONFIG_DRM_OMAP=m
 CONFIG_OMAP5_DSS_HDMI=y
 CONFIG_OMAP2_DSS_SDI=y
 CONFIG_OMAP2_DSS_DSI=y
-CONFIG_DRM_OMAP_PANEL_DSI_CM=m
+CONFIG_DRM_PANEL_DSI_CM=m
 CONFIG_DRM_TILCDC=m
 CONFIG_DRM_PANEL_SIMPLE=m
 CONFIG_DRM_PANEL_LG_LB035Q02=m
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 51/56] ARM: omap2plus_defconfig: Update for moved DSI command mode panel
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen,
	Sekhar Nori, Sebastian Reichel

From: Sebastian Reichel <sebastian.reichel@collabora.com>

The DSI command mode panel is no longer specific
to OMAP and thus the config option has been renamed
slightly.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/configs/omap2plus_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 34793aabdb65..d329d0829fce 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -369,7 +369,7 @@ CONFIG_DRM_OMAP=m
 CONFIG_OMAP5_DSS_HDMI=y
 CONFIG_OMAP2_DSS_SDI=y
 CONFIG_OMAP2_DSS_DSI=y
-CONFIG_DRM_OMAP_PANEL_DSI_CM=m
+CONFIG_DRM_PANEL_DSI_CM=m
 CONFIG_DRM_TILCDC=m
 CONFIG_DRM_PANEL_SIMPLE=m
 CONFIG_DRM_PANEL_LG_LB035Q02=m
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 52/56] drm/omap: squash omapdrm sub-modules into one
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen

At the moment we have three different modules: omapdss-base, omapdss,
omapdrm. This setup is finally obsolete, as the last omapdrm specific
panel has been converted to DRM panel.

We can thus remove omapdss-base and omapdss, and just compile everything
into omapdrm.ko.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/Kconfig       | 119 ++++++++++++++++++++++-
 drivers/gpu/drm/omapdrm/Makefile      |  17 +++-
 drivers/gpu/drm/omapdrm/dss/Kconfig   | 132 --------------------------
 drivers/gpu/drm/omapdrm/dss/Makefile  |  18 ----
 drivers/gpu/drm/omapdrm/dss/base.c    |  23 +----
 drivers/gpu/drm/omapdrm/dss/display.c |   2 -
 drivers/gpu/drm/omapdrm/dss/dss.c     |  11 +--
 drivers/gpu/drm/omapdrm/dss/omapdss.h |   3 +
 drivers/gpu/drm/omapdrm/dss/output.c  |  11 ---
 drivers/gpu/drm/omapdrm/omap_drv.c    |  12 ++-
 10 files changed, 148 insertions(+), 200 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/Kconfig
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/Makefile

diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
index cea3f44ea6d4..e7281da5bc6a 100644
--- a/drivers/gpu/drm/omapdrm/Kconfig
+++ b/drivers/gpu/drm/omapdrm/Kconfig
@@ -5,12 +5,129 @@ config DRM_OMAP
 	depends on ARCH_OMAP2PLUS || ARCH_MULTIPLATFORM
 	select OMAP2_DSS
 	select DRM_KMS_HELPER
+	select VIDEOMODE_HELPERS
+	select HDMI
 	default n
 	help
 	  DRM display driver for OMAP2/3/4 based boards.
 
 if DRM_OMAP
 
-source "drivers/gpu/drm/omapdrm/dss/Kconfig"
+config OMAP2_DSS_DEBUG
+	bool "Debug support"
+	default n
+	help
+	  This enables printing of debug messages. Alternatively, debug messages
+	  can also be enabled by setting CONFIG_DYNAMIC_DEBUG and then setting
+	  appropriate flags in <debugfs>/dynamic_debug/control.
+
+config OMAP2_DSS_DEBUGFS
+	bool "Debugfs filesystem support"
+	depends on DEBUG_FS
+	default n
+	help
+	  This enables debugfs for OMAPDSS at <debugfs>/omapdss. This enables
+	  querying about clock configuration and register configuration of dss,
+	  dispc, dsi, hdmi and rfbi.
+
+config OMAP2_DSS_COLLECT_IRQ_STATS
+	bool "Collect DSS IRQ statistics"
+	depends on OMAP2_DSS_DEBUGFS
+	default n
+	help
+	  Collect DSS IRQ statistics, printable via debugfs.
+
+	  The statistics can be found from
+	  <debugfs>/omapdss/dispc_irq for DISPC interrupts, and
+	  <debugfs>/omapdss/dsi_irq for DSI interrupts.
+
+config OMAP2_DSS_DPI
+	bool "DPI support"
+	default y
+	help
+	  DPI Interface. This is the Parallel Display Interface.
+
+config OMAP2_DSS_VENC
+	bool "VENC support"
+	default y
+	help
+	  OMAP Video Encoder support for S-Video and composite TV-out.
+
+config OMAP2_DSS_HDMI_COMMON
+	bool
+
+config OMAP4_DSS_HDMI
+	bool "HDMI support for OMAP4"
+	default y
+	select OMAP2_DSS_HDMI_COMMON
+	help
+	  HDMI support for OMAP4 based SoCs.
+
+config OMAP4_DSS_HDMI_CEC
+	bool "Enable HDMI CEC support for OMAP4"
+	depends on OMAP4_DSS_HDMI
+	select CEC_CORE
+	default y
+	help
+	  When selected the HDMI transmitter will support the CEC feature.
+
+config OMAP5_DSS_HDMI
+	bool "HDMI support for OMAP5"
+	default n
+	select OMAP2_DSS_HDMI_COMMON
+	help
+	  HDMI Interface for OMAP5 and similar cores. This adds the High
+	  Definition Multimedia Interface. See http://www.hdmi.org/ for HDMI
+	  specification.
+
+config OMAP2_DSS_SDI
+	bool "SDI support"
+	default n
+	help
+	  SDI (Serial Display Interface) support.
+
+	  SDI is a high speed one-way display serial bus between the host
+	  processor and a display.
+
+config OMAP2_DSS_DSI
+	bool "DSI support"
+	default n
+	select DRM_MIPI_DSI
+	help
+	  MIPI DSI (Display Serial Interface) support.
+
+	  DSI is a high speed half-duplex serial interface between the host
+	  processor and a peripheral, such as a display or a framebuffer chip.
+
+	  See http://www.mipi.org/ for DSI specifications.
+
+config OMAP2_DSS_MIN_FCK_PER_PCK
+	int "Minimum FCK/PCK ratio (for scaling)"
+	range 0 32
+	default 0
+	help
+	  This can be used to adjust the minimum FCK/PCK ratio.
+
+	  With this you can make sure that DISPC FCK is at least
+	  n x PCK. Video plane scaling requires higher FCK than
+	  normally.
+
+	  If this is set to 0, there's no extra constraint on the
+	  DISPC FCK. However, the FCK will at minimum be
+	  2xPCK (if active matrix) or 3xPCK (if passive matrix).
+
+	  Max FCK is 173MHz, so this doesn't work if your PCK
+	  is very high.
+
+config OMAP2_DSS_SLEEP_AFTER_VENC_RESET
+	bool "Sleep 20ms after VENC reset"
+	default y
+	help
+	  There is a 20ms sleep after VENC reset which seemed to fix the
+	  reset. The reason for the bug is unclear, and it's also unclear
+	  on what platforms this happens.
+
+	  This option enables the sleep, and is enabled by default. You can
+	  disable the sleep if it doesn't cause problems on your platform.
 
 endif
diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index 2a404e045b78..33fe7e937680 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -4,8 +4,6 @@
 # Direct Rendering Infrastructure (DRI)
 #
 
-obj-y += dss/
-
 omapdrm-y := omap_drv.o \
 	omap_irq.o \
 	omap_debugfs.o \
@@ -20,4 +18,17 @@ omapdrm-y := omap_drv.o \
 
 omapdrm-$(CONFIG_DRM_FBDEV_EMULATION) += omap_fbdev.o
 
-obj-$(CONFIG_DRM_OMAP)	+= omapdrm.o
+omapdrm-y += dss/base.o dss/display.o dss/output.o dss/dss.o dss/dispc.o \
+		dss/dispc_coefs.o dss/pll.o dss/video-pll.o
+omapdrm-$(CONFIG_OMAP2_DSS_DPI) += dss/dpi.o
+omapdrm-$(CONFIG_OMAP2_DSS_VENC) += dss/venc.o
+omapdrm-$(CONFIG_OMAP2_DSS_SDI) += dss/sdi.o
+omapdrm-$(CONFIG_OMAP2_DSS_DSI) += dss/dsi.o
+omapdrm-$(CONFIG_OMAP2_DSS_HDMI_COMMON) += dss/hdmi_common.o dss/hdmi_wp.o \
+		dss/hdmi_pll.o dss/hdmi_phy.o
+omapdrm-$(CONFIG_OMAP4_DSS_HDMI) += dss/hdmi4.o dss/hdmi4_core.o
+omapdrm-$(CONFIG_OMAP4_DSS_HDMI_CEC) += dss/hdmi4_cec.o
+omapdrm-$(CONFIG_OMAP5_DSS_HDMI) += dss/hdmi5.o dss/hdmi5_core.o
+ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG
+
+obj-$(CONFIG_DRM_OMAP) += omapdrm.o
diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig b/drivers/gpu/drm/omapdrm/dss/Kconfig
deleted file mode 100644
index 6ec80771af3d..000000000000
--- a/drivers/gpu/drm/omapdrm/dss/Kconfig
+++ /dev/null
@@ -1,132 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-config OMAP_DSS_BASE
-	tristate
-
-menuconfig OMAP2_DSS
-	tristate "OMAP2+ Display Subsystem support"
-	select OMAP_DSS_BASE
-	select VIDEOMODE_HELPERS
-	select HDMI
-	help
-	  OMAP2+ Display Subsystem support.
-
-if OMAP2_DSS
-
-config OMAP2_DSS_DEBUG
-	bool "Debug support"
-	default n
-	help
-	  This enables printing of debug messages. Alternatively, debug messages
-	  can also be enabled by setting CONFIG_DYNAMIC_DEBUG and then setting
-	  appropriate flags in <debugfs>/dynamic_debug/control.
-
-config OMAP2_DSS_DEBUGFS
-	bool "Debugfs filesystem support"
-	depends on DEBUG_FS
-	default n
-	help
-	  This enables debugfs for OMAPDSS at <debugfs>/omapdss. This enables
-	  querying about clock configuration and register configuration of dss,
-	  dispc, dsi, hdmi and rfbi.
-
-config OMAP2_DSS_COLLECT_IRQ_STATS
-	bool "Collect DSS IRQ statistics"
-	depends on OMAP2_DSS_DEBUGFS
-	default n
-	help
-	  Collect DSS IRQ statistics, printable via debugfs.
-
-	  The statistics can be found from
-	  <debugfs>/omapdss/dispc_irq for DISPC interrupts, and
-	  <debugfs>/omapdss/dsi_irq for DSI interrupts.
-
-config OMAP2_DSS_DPI
-	bool "DPI support"
-	default y
-	help
-	  DPI Interface. This is the Parallel Display Interface.
-
-config OMAP2_DSS_VENC
-	bool "VENC support"
-	default y
-	help
-	  OMAP Video Encoder support for S-Video and composite TV-out.
-
-config OMAP2_DSS_HDMI_COMMON
-	bool
-
-config OMAP4_DSS_HDMI
-	bool "HDMI support for OMAP4"
-	default y
-	select OMAP2_DSS_HDMI_COMMON
-	help
-	  HDMI support for OMAP4 based SoCs.
-
-config OMAP4_DSS_HDMI_CEC
-	bool "Enable HDMI CEC support for OMAP4"
-	depends on OMAP4_DSS_HDMI
-	select CEC_CORE
-	default y
-	help
-	  When selected the HDMI transmitter will support the CEC feature.
-
-config OMAP5_DSS_HDMI
-	bool "HDMI support for OMAP5"
-	default n
-	select OMAP2_DSS_HDMI_COMMON
-	help
-	  HDMI Interface for OMAP5 and similar cores. This adds the High
-	  Definition Multimedia Interface. See http://www.hdmi.org/ for HDMI
-	  specification.
-
-config OMAP2_DSS_SDI
-	bool "SDI support"
-	default n
-	help
-	  SDI (Serial Display Interface) support.
-
-	  SDI is a high speed one-way display serial bus between the host
-	  processor and a display.
-
-config OMAP2_DSS_DSI
-	bool "DSI support"
-	default n
-	select DRM_MIPI_DSI
-	help
-	  MIPI DSI (Display Serial Interface) support.
-
-	  DSI is a high speed half-duplex serial interface between the host
-	  processor and a peripheral, such as a display or a framebuffer chip.
-
-	  See http://www.mipi.org/ for DSI specifications.
-
-config OMAP2_DSS_MIN_FCK_PER_PCK
-	int "Minimum FCK/PCK ratio (for scaling)"
-	range 0 32
-	default 0
-	help
-	  This can be used to adjust the minimum FCK/PCK ratio.
-
-	  With this you can make sure that DISPC FCK is at least
-	  n x PCK. Video plane scaling requires higher FCK than
-	  normally.
-
-	  If this is set to 0, there's no extra constraint on the
-	  DISPC FCK. However, the FCK will at minimum be
-	  2xPCK (if active matrix) or 3xPCK (if passive matrix).
-
-	  Max FCK is 173MHz, so this doesn't work if your PCK
-	  is very high.
-
-config OMAP2_DSS_SLEEP_AFTER_VENC_RESET
-	bool "Sleep 20ms after VENC reset"
-	default y
-	help
-	  There is a 20ms sleep after VENC reset which seemed to fix the
-	  reset. The reason for the bug is unclear, and it's also unclear
-	  on what platforms this happens.
-
-	  This option enables the sleep, and is enabled by default. You can
-	  disable the sleep if it doesn't cause problems on your platform.
-
-endif
diff --git a/drivers/gpu/drm/omapdrm/dss/Makefile b/drivers/gpu/drm/omapdrm/dss/Makefile
deleted file mode 100644
index 811966cd7468..000000000000
--- a/drivers/gpu/drm/omapdrm/dss/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_OMAP_DSS_BASE) += omapdss-base.o
-omapdss-base-y := base.o display.o output.o
-
-obj-$(CONFIG_OMAP2_DSS) += omapdss.o
-# Core DSS files
-omapdss-y := dss.o dispc.o dispc_coefs.o \
-	pll.o video-pll.o
-omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o
-omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
-omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o
-omapdss-$(CONFIG_OMAP2_DSS_DSI) += dsi.o
-omapdss-$(CONFIG_OMAP2_DSS_HDMI_COMMON) += hdmi_common.o hdmi_wp.o hdmi_pll.o \
-	hdmi_phy.o
-omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi4.o hdmi4_core.o
-omapdss-$(CONFIG_OMAP4_DSS_HDMI_CEC) += hdmi4_cec.o
-omapdss-$(CONFIG_OMAP5_DSS_HDMI) += hdmi5.o hdmi5_core.o
-ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG
diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index d9a5e7b9d401..08c7c5024896 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -20,13 +20,11 @@ struct dispc_device *dispc_get_dispc(struct dss_device *dss)
 {
 	return dss->dispc;
 }
-EXPORT_SYMBOL(dispc_get_dispc);
 
 const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
 {
 	return dss->dispc_ops;
 }
-EXPORT_SYMBOL(dispc_get_ops);
 
 
 /* -----------------------------------------------------------------------------
@@ -42,7 +40,6 @@ void omapdss_device_register(struct omap_dss_device *dssdev)
 	list_add_tail(&dssdev->list, &omapdss_devices_list);
 	mutex_unlock(&omapdss_devices_lock);
 }
-EXPORT_SYMBOL_GPL(omapdss_device_register);
 
 void omapdss_device_unregister(struct omap_dss_device *dssdev)
 {
@@ -50,7 +47,6 @@ void omapdss_device_unregister(struct omap_dss_device *dssdev)
 	list_del(&dssdev->list);
 	mutex_unlock(&omapdss_devices_lock);
 }
-EXPORT_SYMBOL_GPL(omapdss_device_unregister);
 
 static bool omapdss_device_is_registered(struct device_node *node)
 {
@@ -72,24 +68,16 @@ static bool omapdss_device_is_registered(struct device_node *node)
 
 struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev)
 {
-	if (!try_module_get(dssdev->owner))
+	if (get_device(dssdev->dev) == NULL)
 		return NULL;
 
-	if (get_device(dssdev->dev) == NULL) {
-		module_put(dssdev->owner);
-		return NULL;
-	}
-
 	return dssdev;
 }
-EXPORT_SYMBOL(omapdss_device_get);
 
 void omapdss_device_put(struct omap_dss_device *dssdev)
 {
 	put_device(dssdev->dev);
-	module_put(dssdev->owner);
 }
-EXPORT_SYMBOL(omapdss_device_put);
 
 struct omap_dss_device *omapdss_find_device_by_node(struct device_node *node)
 {
@@ -150,7 +138,6 @@ struct omap_dss_device *omapdss_device_next_output(struct omap_dss_device *from)
 	mutex_unlock(&omapdss_devices_lock);
 	return dssdev;
 }
-EXPORT_SYMBOL(omapdss_device_next_output);
 
 static bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
 {
@@ -181,7 +168,6 @@ int omapdss_device_connect(struct dss_device *dss,
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omapdss_device_connect);
 
 void omapdss_device_disconnect(struct omap_dss_device *src,
 			       struct omap_dss_device *dst)
@@ -204,7 +190,6 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
 
 	dst->dss = NULL;
 }
-EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
 
 /* -----------------------------------------------------------------------------
  * Components Handling
@@ -290,7 +275,6 @@ void omapdss_gather_components(struct device *dev)
 	for_each_available_child_of_node(dev->of_node, child)
 		omapdss_walk_device(dev, child, true);
 }
-EXPORT_SYMBOL(omapdss_gather_components);
 
 static bool omapdss_component_is_loaded(struct omapdss_comp_node *comp)
 {
@@ -315,8 +299,3 @@ bool omapdss_stack_is_ready(void)
 
 	return true;
 }
-EXPORT_SYMBOL(omapdss_stack_is_ready);
-
-MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
-MODULE_DESCRIPTION("OMAP Display Subsystem Base");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c
index 3b82158b1bfd..7b7ee2019eae 100644
--- a/drivers/gpu/drm/omapdrm/dss/display.c
+++ b/drivers/gpu/drm/omapdrm/dss/display.c
@@ -38,7 +38,6 @@ void omapdss_display_init(struct omap_dss_device *dssdev)
 		dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
 					      "display%u", id);
 }
-EXPORT_SYMBOL_GPL(omapdss_display_init);
 
 int omapdss_display_get_modes(struct drm_connector *connector,
 			      const struct videomode *vm)
@@ -57,4 +56,3 @@ int omapdss_display_get_modes(struct drm_connector *connector,
 
 	return 1;
 }
-EXPORT_SYMBOL_GPL(omapdss_display_get_modes);
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index 6a160138bf88..6547a9f4b388 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1638,21 +1638,14 @@ static struct platform_driver * const omap_dss_drivers[] = {
 #endif
 };
 
-static int __init omap_dss_init(void)
+int __init omap_dss_init(void)
 {
 	return platform_register_drivers(omap_dss_drivers,
 					 ARRAY_SIZE(omap_dss_drivers));
 }
 
-static void __exit omap_dss_exit(void)
+void __exit omap_dss_exit(void)
 {
 	platform_unregister_drivers(omap_dss_drivers,
 				    ARRAY_SIZE(omap_dss_drivers));
 }
-
-module_init(omap_dss_init);
-module_exit(omap_dss_exit);
-
-MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
-MODULE_DESCRIPTION("OMAP2/3/4/5 Display Subsystem");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 4a0826c8fed5..4e7ae164de4f 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -458,4 +458,7 @@ const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
 bool omapdss_stack_is_ready(void);
 void omapdss_gather_components(struct device *dev);
 
+int omap_dss_init(void);
+void omap_dss_exit(void);
+
 #endif /* __OMAP_DRM_DSS_H */
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
index 40cb353572f6..7a14d2b5b2f7 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -73,7 +73,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
 	omapdss_device_cleanup_output(out);
 	return ret;
 }
-EXPORT_SYMBOL(omapdss_device_init_output);
 
 void omapdss_device_cleanup_output(struct omap_dss_device *out)
 {
@@ -81,7 +80,6 @@ void omapdss_device_cleanup_output(struct omap_dss_device *out)
 		drm_panel_bridge_remove(out->next_bridge ?
 					out->next_bridge : out->bridge);
 }
-EXPORT_SYMBOL(omapdss_device_cleanup_output);
 
 int dss_install_mgr_ops(struct dss_device *dss,
 			const struct dss_mgr_ops *mgr_ops,
@@ -95,14 +93,12 @@ int dss_install_mgr_ops(struct dss_device *dss,
 
 	return 0;
 }
-EXPORT_SYMBOL(dss_install_mgr_ops);
 
 void dss_uninstall_mgr_ops(struct dss_device *dss)
 {
 	dss->mgr_ops = NULL;
 	dss->mgr_ops_priv = NULL;
 }
-EXPORT_SYMBOL(dss_uninstall_mgr_ops);
 
 void dss_mgr_set_timings(struct omap_dss_device *dssdev,
 			 const struct videomode *vm)
@@ -110,7 +106,6 @@ void dss_mgr_set_timings(struct omap_dss_device *dssdev,
 	dssdev->dss->mgr_ops->set_timings(dssdev->dss->mgr_ops_priv,
 					  dssdev->dispc_channel, vm);
 }
-EXPORT_SYMBOL(dss_mgr_set_timings);
 
 void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
 		const struct dss_lcd_mgr_config *config)
@@ -118,28 +113,24 @@ void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
 	dssdev->dss->mgr_ops->set_lcd_config(dssdev->dss->mgr_ops_priv,
 					     dssdev->dispc_channel, config);
 }
-EXPORT_SYMBOL(dss_mgr_set_lcd_config);
 
 int dss_mgr_enable(struct omap_dss_device *dssdev)
 {
 	return dssdev->dss->mgr_ops->enable(dssdev->dss->mgr_ops_priv,
 					    dssdev->dispc_channel);
 }
-EXPORT_SYMBOL(dss_mgr_enable);
 
 void dss_mgr_disable(struct omap_dss_device *dssdev)
 {
 	dssdev->dss->mgr_ops->disable(dssdev->dss->mgr_ops_priv,
 				      dssdev->dispc_channel);
 }
-EXPORT_SYMBOL(dss_mgr_disable);
 
 void dss_mgr_start_update(struct omap_dss_device *dssdev)
 {
 	dssdev->dss->mgr_ops->start_update(dssdev->dss->mgr_ops_priv,
 					   dssdev->dispc_channel);
 }
-EXPORT_SYMBOL(dss_mgr_start_update);
 
 int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
 		void (*handler)(void *), void *data)
@@ -150,7 +141,6 @@ int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
 							dssdev->dispc_channel,
 							handler, data);
 }
-EXPORT_SYMBOL(dss_mgr_register_framedone_handler);
 
 void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
 		void (*handler)(void *), void *data)
@@ -161,4 +151,3 @@ void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
 						   dssdev->dispc_channel,
 						   handler, data);
 }
-EXPORT_SYMBOL(dss_mgr_unregister_framedone_handler);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index dbb8e95234b3..9d5f53e774ef 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -741,8 +741,14 @@ static struct platform_driver * const drivers[] = {
 
 static int __init omap_drm_init(void)
 {
+	int r;
+
 	DBG("init");
 
+	r = omap_dss_init();
+	if (r)
+		return r;
+
 	return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
 }
 
@@ -751,13 +757,15 @@ static void __exit omap_drm_fini(void)
 	DBG("fini");
 
 	platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
+
+	omap_dss_exit();
 }
 
-/* need late_initcall() so we load after dss_driver's are loaded */
-late_initcall(omap_drm_init);
+module_init(omap_drm_init);
 module_exit(omap_drm_fini);
 
 MODULE_AUTHOR("Rob Clark <rob@ti.com>");
+MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
 MODULE_DESCRIPTION("OMAP DRM Display Driver");
 MODULE_ALIAS("platform:" DRIVER_NAME);
 MODULE_LICENSE("GPL v2");
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 52/56] drm/omap: squash omapdrm sub-modules into one
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen, Sekhar Nori

At the moment we have three different modules: omapdss-base, omapdss,
omapdrm. This setup is finally obsolete, as the last omapdrm specific
panel has been converted to DRM panel.

We can thus remove omapdss-base and omapdss, and just compile everything
into omapdrm.ko.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/Kconfig       | 119 ++++++++++++++++++++++-
 drivers/gpu/drm/omapdrm/Makefile      |  17 +++-
 drivers/gpu/drm/omapdrm/dss/Kconfig   | 132 --------------------------
 drivers/gpu/drm/omapdrm/dss/Makefile  |  18 ----
 drivers/gpu/drm/omapdrm/dss/base.c    |  23 +----
 drivers/gpu/drm/omapdrm/dss/display.c |   2 -
 drivers/gpu/drm/omapdrm/dss/dss.c     |  11 +--
 drivers/gpu/drm/omapdrm/dss/omapdss.h |   3 +
 drivers/gpu/drm/omapdrm/dss/output.c  |  11 ---
 drivers/gpu/drm/omapdrm/omap_drv.c    |  12 ++-
 10 files changed, 148 insertions(+), 200 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/Kconfig
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/Makefile

diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
index cea3f44ea6d4..e7281da5bc6a 100644
--- a/drivers/gpu/drm/omapdrm/Kconfig
+++ b/drivers/gpu/drm/omapdrm/Kconfig
@@ -5,12 +5,129 @@ config DRM_OMAP
 	depends on ARCH_OMAP2PLUS || ARCH_MULTIPLATFORM
 	select OMAP2_DSS
 	select DRM_KMS_HELPER
+	select VIDEOMODE_HELPERS
+	select HDMI
 	default n
 	help
 	  DRM display driver for OMAP2/3/4 based boards.
 
 if DRM_OMAP
 
-source "drivers/gpu/drm/omapdrm/dss/Kconfig"
+config OMAP2_DSS_DEBUG
+	bool "Debug support"
+	default n
+	help
+	  This enables printing of debug messages. Alternatively, debug messages
+	  can also be enabled by setting CONFIG_DYNAMIC_DEBUG and then setting
+	  appropriate flags in <debugfs>/dynamic_debug/control.
+
+config OMAP2_DSS_DEBUGFS
+	bool "Debugfs filesystem support"
+	depends on DEBUG_FS
+	default n
+	help
+	  This enables debugfs for OMAPDSS at <debugfs>/omapdss. This enables
+	  querying about clock configuration and register configuration of dss,
+	  dispc, dsi, hdmi and rfbi.
+
+config OMAP2_DSS_COLLECT_IRQ_STATS
+	bool "Collect DSS IRQ statistics"
+	depends on OMAP2_DSS_DEBUGFS
+	default n
+	help
+	  Collect DSS IRQ statistics, printable via debugfs.
+
+	  The statistics can be found from
+	  <debugfs>/omapdss/dispc_irq for DISPC interrupts, and
+	  <debugfs>/omapdss/dsi_irq for DSI interrupts.
+
+config OMAP2_DSS_DPI
+	bool "DPI support"
+	default y
+	help
+	  DPI Interface. This is the Parallel Display Interface.
+
+config OMAP2_DSS_VENC
+	bool "VENC support"
+	default y
+	help
+	  OMAP Video Encoder support for S-Video and composite TV-out.
+
+config OMAP2_DSS_HDMI_COMMON
+	bool
+
+config OMAP4_DSS_HDMI
+	bool "HDMI support for OMAP4"
+	default y
+	select OMAP2_DSS_HDMI_COMMON
+	help
+	  HDMI support for OMAP4 based SoCs.
+
+config OMAP4_DSS_HDMI_CEC
+	bool "Enable HDMI CEC support for OMAP4"
+	depends on OMAP4_DSS_HDMI
+	select CEC_CORE
+	default y
+	help
+	  When selected the HDMI transmitter will support the CEC feature.
+
+config OMAP5_DSS_HDMI
+	bool "HDMI support for OMAP5"
+	default n
+	select OMAP2_DSS_HDMI_COMMON
+	help
+	  HDMI Interface for OMAP5 and similar cores. This adds the High
+	  Definition Multimedia Interface. See http://www.hdmi.org/ for HDMI
+	  specification.
+
+config OMAP2_DSS_SDI
+	bool "SDI support"
+	default n
+	help
+	  SDI (Serial Display Interface) support.
+
+	  SDI is a high speed one-way display serial bus between the host
+	  processor and a display.
+
+config OMAP2_DSS_DSI
+	bool "DSI support"
+	default n
+	select DRM_MIPI_DSI
+	help
+	  MIPI DSI (Display Serial Interface) support.
+
+	  DSI is a high speed half-duplex serial interface between the host
+	  processor and a peripheral, such as a display or a framebuffer chip.
+
+	  See http://www.mipi.org/ for DSI specifications.
+
+config OMAP2_DSS_MIN_FCK_PER_PCK
+	int "Minimum FCK/PCK ratio (for scaling)"
+	range 0 32
+	default 0
+	help
+	  This can be used to adjust the minimum FCK/PCK ratio.
+
+	  With this you can make sure that DISPC FCK is at least
+	  n x PCK. Video plane scaling requires higher FCK than
+	  normally.
+
+	  If this is set to 0, there's no extra constraint on the
+	  DISPC FCK. However, the FCK will at minimum be
+	  2xPCK (if active matrix) or 3xPCK (if passive matrix).
+
+	  Max FCK is 173MHz, so this doesn't work if your PCK
+	  is very high.
+
+config OMAP2_DSS_SLEEP_AFTER_VENC_RESET
+	bool "Sleep 20ms after VENC reset"
+	default y
+	help
+	  There is a 20ms sleep after VENC reset which seemed to fix the
+	  reset. The reason for the bug is unclear, and it's also unclear
+	  on what platforms this happens.
+
+	  This option enables the sleep, and is enabled by default. You can
+	  disable the sleep if it doesn't cause problems on your platform.
 
 endif
diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index 2a404e045b78..33fe7e937680 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -4,8 +4,6 @@
 # Direct Rendering Infrastructure (DRI)
 #
 
-obj-y += dss/
-
 omapdrm-y := omap_drv.o \
 	omap_irq.o \
 	omap_debugfs.o \
@@ -20,4 +18,17 @@ omapdrm-y := omap_drv.o \
 
 omapdrm-$(CONFIG_DRM_FBDEV_EMULATION) += omap_fbdev.o
 
-obj-$(CONFIG_DRM_OMAP)	+= omapdrm.o
+omapdrm-y += dss/base.o dss/display.o dss/output.o dss/dss.o dss/dispc.o \
+		dss/dispc_coefs.o dss/pll.o dss/video-pll.o
+omapdrm-$(CONFIG_OMAP2_DSS_DPI) += dss/dpi.o
+omapdrm-$(CONFIG_OMAP2_DSS_VENC) += dss/venc.o
+omapdrm-$(CONFIG_OMAP2_DSS_SDI) += dss/sdi.o
+omapdrm-$(CONFIG_OMAP2_DSS_DSI) += dss/dsi.o
+omapdrm-$(CONFIG_OMAP2_DSS_HDMI_COMMON) += dss/hdmi_common.o dss/hdmi_wp.o \
+		dss/hdmi_pll.o dss/hdmi_phy.o
+omapdrm-$(CONFIG_OMAP4_DSS_HDMI) += dss/hdmi4.o dss/hdmi4_core.o
+omapdrm-$(CONFIG_OMAP4_DSS_HDMI_CEC) += dss/hdmi4_cec.o
+omapdrm-$(CONFIG_OMAP5_DSS_HDMI) += dss/hdmi5.o dss/hdmi5_core.o
+ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG
+
+obj-$(CONFIG_DRM_OMAP) += omapdrm.o
diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig b/drivers/gpu/drm/omapdrm/dss/Kconfig
deleted file mode 100644
index 6ec80771af3d..000000000000
--- a/drivers/gpu/drm/omapdrm/dss/Kconfig
+++ /dev/null
@@ -1,132 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-config OMAP_DSS_BASE
-	tristate
-
-menuconfig OMAP2_DSS
-	tristate "OMAP2+ Display Subsystem support"
-	select OMAP_DSS_BASE
-	select VIDEOMODE_HELPERS
-	select HDMI
-	help
-	  OMAP2+ Display Subsystem support.
-
-if OMAP2_DSS
-
-config OMAP2_DSS_DEBUG
-	bool "Debug support"
-	default n
-	help
-	  This enables printing of debug messages. Alternatively, debug messages
-	  can also be enabled by setting CONFIG_DYNAMIC_DEBUG and then setting
-	  appropriate flags in <debugfs>/dynamic_debug/control.
-
-config OMAP2_DSS_DEBUGFS
-	bool "Debugfs filesystem support"
-	depends on DEBUG_FS
-	default n
-	help
-	  This enables debugfs for OMAPDSS at <debugfs>/omapdss. This enables
-	  querying about clock configuration and register configuration of dss,
-	  dispc, dsi, hdmi and rfbi.
-
-config OMAP2_DSS_COLLECT_IRQ_STATS
-	bool "Collect DSS IRQ statistics"
-	depends on OMAP2_DSS_DEBUGFS
-	default n
-	help
-	  Collect DSS IRQ statistics, printable via debugfs.
-
-	  The statistics can be found from
-	  <debugfs>/omapdss/dispc_irq for DISPC interrupts, and
-	  <debugfs>/omapdss/dsi_irq for DSI interrupts.
-
-config OMAP2_DSS_DPI
-	bool "DPI support"
-	default y
-	help
-	  DPI Interface. This is the Parallel Display Interface.
-
-config OMAP2_DSS_VENC
-	bool "VENC support"
-	default y
-	help
-	  OMAP Video Encoder support for S-Video and composite TV-out.
-
-config OMAP2_DSS_HDMI_COMMON
-	bool
-
-config OMAP4_DSS_HDMI
-	bool "HDMI support for OMAP4"
-	default y
-	select OMAP2_DSS_HDMI_COMMON
-	help
-	  HDMI support for OMAP4 based SoCs.
-
-config OMAP4_DSS_HDMI_CEC
-	bool "Enable HDMI CEC support for OMAP4"
-	depends on OMAP4_DSS_HDMI
-	select CEC_CORE
-	default y
-	help
-	  When selected the HDMI transmitter will support the CEC feature.
-
-config OMAP5_DSS_HDMI
-	bool "HDMI support for OMAP5"
-	default n
-	select OMAP2_DSS_HDMI_COMMON
-	help
-	  HDMI Interface for OMAP5 and similar cores. This adds the High
-	  Definition Multimedia Interface. See http://www.hdmi.org/ for HDMI
-	  specification.
-
-config OMAP2_DSS_SDI
-	bool "SDI support"
-	default n
-	help
-	  SDI (Serial Display Interface) support.
-
-	  SDI is a high speed one-way display serial bus between the host
-	  processor and a display.
-
-config OMAP2_DSS_DSI
-	bool "DSI support"
-	default n
-	select DRM_MIPI_DSI
-	help
-	  MIPI DSI (Display Serial Interface) support.
-
-	  DSI is a high speed half-duplex serial interface between the host
-	  processor and a peripheral, such as a display or a framebuffer chip.
-
-	  See http://www.mipi.org/ for DSI specifications.
-
-config OMAP2_DSS_MIN_FCK_PER_PCK
-	int "Minimum FCK/PCK ratio (for scaling)"
-	range 0 32
-	default 0
-	help
-	  This can be used to adjust the minimum FCK/PCK ratio.
-
-	  With this you can make sure that DISPC FCK is at least
-	  n x PCK. Video plane scaling requires higher FCK than
-	  normally.
-
-	  If this is set to 0, there's no extra constraint on the
-	  DISPC FCK. However, the FCK will at minimum be
-	  2xPCK (if active matrix) or 3xPCK (if passive matrix).
-
-	  Max FCK is 173MHz, so this doesn't work if your PCK
-	  is very high.
-
-config OMAP2_DSS_SLEEP_AFTER_VENC_RESET
-	bool "Sleep 20ms after VENC reset"
-	default y
-	help
-	  There is a 20ms sleep after VENC reset which seemed to fix the
-	  reset. The reason for the bug is unclear, and it's also unclear
-	  on what platforms this happens.
-
-	  This option enables the sleep, and is enabled by default. You can
-	  disable the sleep if it doesn't cause problems on your platform.
-
-endif
diff --git a/drivers/gpu/drm/omapdrm/dss/Makefile b/drivers/gpu/drm/omapdrm/dss/Makefile
deleted file mode 100644
index 811966cd7468..000000000000
--- a/drivers/gpu/drm/omapdrm/dss/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_OMAP_DSS_BASE) += omapdss-base.o
-omapdss-base-y := base.o display.o output.o
-
-obj-$(CONFIG_OMAP2_DSS) += omapdss.o
-# Core DSS files
-omapdss-y := dss.o dispc.o dispc_coefs.o \
-	pll.o video-pll.o
-omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o
-omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
-omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o
-omapdss-$(CONFIG_OMAP2_DSS_DSI) += dsi.o
-omapdss-$(CONFIG_OMAP2_DSS_HDMI_COMMON) += hdmi_common.o hdmi_wp.o hdmi_pll.o \
-	hdmi_phy.o
-omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi4.o hdmi4_core.o
-omapdss-$(CONFIG_OMAP4_DSS_HDMI_CEC) += hdmi4_cec.o
-omapdss-$(CONFIG_OMAP5_DSS_HDMI) += hdmi5.o hdmi5_core.o
-ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG
diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index d9a5e7b9d401..08c7c5024896 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -20,13 +20,11 @@ struct dispc_device *dispc_get_dispc(struct dss_device *dss)
 {
 	return dss->dispc;
 }
-EXPORT_SYMBOL(dispc_get_dispc);
 
 const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
 {
 	return dss->dispc_ops;
 }
-EXPORT_SYMBOL(dispc_get_ops);
 
 
 /* -----------------------------------------------------------------------------
@@ -42,7 +40,6 @@ void omapdss_device_register(struct omap_dss_device *dssdev)
 	list_add_tail(&dssdev->list, &omapdss_devices_list);
 	mutex_unlock(&omapdss_devices_lock);
 }
-EXPORT_SYMBOL_GPL(omapdss_device_register);
 
 void omapdss_device_unregister(struct omap_dss_device *dssdev)
 {
@@ -50,7 +47,6 @@ void omapdss_device_unregister(struct omap_dss_device *dssdev)
 	list_del(&dssdev->list);
 	mutex_unlock(&omapdss_devices_lock);
 }
-EXPORT_SYMBOL_GPL(omapdss_device_unregister);
 
 static bool omapdss_device_is_registered(struct device_node *node)
 {
@@ -72,24 +68,16 @@ static bool omapdss_device_is_registered(struct device_node *node)
 
 struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev)
 {
-	if (!try_module_get(dssdev->owner))
+	if (get_device(dssdev->dev) == NULL)
 		return NULL;
 
-	if (get_device(dssdev->dev) == NULL) {
-		module_put(dssdev->owner);
-		return NULL;
-	}
-
 	return dssdev;
 }
-EXPORT_SYMBOL(omapdss_device_get);
 
 void omapdss_device_put(struct omap_dss_device *dssdev)
 {
 	put_device(dssdev->dev);
-	module_put(dssdev->owner);
 }
-EXPORT_SYMBOL(omapdss_device_put);
 
 struct omap_dss_device *omapdss_find_device_by_node(struct device_node *node)
 {
@@ -150,7 +138,6 @@ struct omap_dss_device *omapdss_device_next_output(struct omap_dss_device *from)
 	mutex_unlock(&omapdss_devices_lock);
 	return dssdev;
 }
-EXPORT_SYMBOL(omapdss_device_next_output);
 
 static bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
 {
@@ -181,7 +168,6 @@ int omapdss_device_connect(struct dss_device *dss,
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omapdss_device_connect);
 
 void omapdss_device_disconnect(struct omap_dss_device *src,
 			       struct omap_dss_device *dst)
@@ -204,7 +190,6 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
 
 	dst->dss = NULL;
 }
-EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
 
 /* -----------------------------------------------------------------------------
  * Components Handling
@@ -290,7 +275,6 @@ void omapdss_gather_components(struct device *dev)
 	for_each_available_child_of_node(dev->of_node, child)
 		omapdss_walk_device(dev, child, true);
 }
-EXPORT_SYMBOL(omapdss_gather_components);
 
 static bool omapdss_component_is_loaded(struct omapdss_comp_node *comp)
 {
@@ -315,8 +299,3 @@ bool omapdss_stack_is_ready(void)
 
 	return true;
 }
-EXPORT_SYMBOL(omapdss_stack_is_ready);
-
-MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
-MODULE_DESCRIPTION("OMAP Display Subsystem Base");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c
index 3b82158b1bfd..7b7ee2019eae 100644
--- a/drivers/gpu/drm/omapdrm/dss/display.c
+++ b/drivers/gpu/drm/omapdrm/dss/display.c
@@ -38,7 +38,6 @@ void omapdss_display_init(struct omap_dss_device *dssdev)
 		dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
 					      "display%u", id);
 }
-EXPORT_SYMBOL_GPL(omapdss_display_init);
 
 int omapdss_display_get_modes(struct drm_connector *connector,
 			      const struct videomode *vm)
@@ -57,4 +56,3 @@ int omapdss_display_get_modes(struct drm_connector *connector,
 
 	return 1;
 }
-EXPORT_SYMBOL_GPL(omapdss_display_get_modes);
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index 6a160138bf88..6547a9f4b388 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1638,21 +1638,14 @@ static struct platform_driver * const omap_dss_drivers[] = {
 #endif
 };
 
-static int __init omap_dss_init(void)
+int __init omap_dss_init(void)
 {
 	return platform_register_drivers(omap_dss_drivers,
 					 ARRAY_SIZE(omap_dss_drivers));
 }
 
-static void __exit omap_dss_exit(void)
+void __exit omap_dss_exit(void)
 {
 	platform_unregister_drivers(omap_dss_drivers,
 				    ARRAY_SIZE(omap_dss_drivers));
 }
-
-module_init(omap_dss_init);
-module_exit(omap_dss_exit);
-
-MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
-MODULE_DESCRIPTION("OMAP2/3/4/5 Display Subsystem");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 4a0826c8fed5..4e7ae164de4f 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -458,4 +458,7 @@ const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
 bool omapdss_stack_is_ready(void);
 void omapdss_gather_components(struct device *dev);
 
+int omap_dss_init(void);
+void omap_dss_exit(void);
+
 #endif /* __OMAP_DRM_DSS_H */
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
index 40cb353572f6..7a14d2b5b2f7 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -73,7 +73,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
 	omapdss_device_cleanup_output(out);
 	return ret;
 }
-EXPORT_SYMBOL(omapdss_device_init_output);
 
 void omapdss_device_cleanup_output(struct omap_dss_device *out)
 {
@@ -81,7 +80,6 @@ void omapdss_device_cleanup_output(struct omap_dss_device *out)
 		drm_panel_bridge_remove(out->next_bridge ?
 					out->next_bridge : out->bridge);
 }
-EXPORT_SYMBOL(omapdss_device_cleanup_output);
 
 int dss_install_mgr_ops(struct dss_device *dss,
 			const struct dss_mgr_ops *mgr_ops,
@@ -95,14 +93,12 @@ int dss_install_mgr_ops(struct dss_device *dss,
 
 	return 0;
 }
-EXPORT_SYMBOL(dss_install_mgr_ops);
 
 void dss_uninstall_mgr_ops(struct dss_device *dss)
 {
 	dss->mgr_ops = NULL;
 	dss->mgr_ops_priv = NULL;
 }
-EXPORT_SYMBOL(dss_uninstall_mgr_ops);
 
 void dss_mgr_set_timings(struct omap_dss_device *dssdev,
 			 const struct videomode *vm)
@@ -110,7 +106,6 @@ void dss_mgr_set_timings(struct omap_dss_device *dssdev,
 	dssdev->dss->mgr_ops->set_timings(dssdev->dss->mgr_ops_priv,
 					  dssdev->dispc_channel, vm);
 }
-EXPORT_SYMBOL(dss_mgr_set_timings);
 
 void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
 		const struct dss_lcd_mgr_config *config)
@@ -118,28 +113,24 @@ void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
 	dssdev->dss->mgr_ops->set_lcd_config(dssdev->dss->mgr_ops_priv,
 					     dssdev->dispc_channel, config);
 }
-EXPORT_SYMBOL(dss_mgr_set_lcd_config);
 
 int dss_mgr_enable(struct omap_dss_device *dssdev)
 {
 	return dssdev->dss->mgr_ops->enable(dssdev->dss->mgr_ops_priv,
 					    dssdev->dispc_channel);
 }
-EXPORT_SYMBOL(dss_mgr_enable);
 
 void dss_mgr_disable(struct omap_dss_device *dssdev)
 {
 	dssdev->dss->mgr_ops->disable(dssdev->dss->mgr_ops_priv,
 				      dssdev->dispc_channel);
 }
-EXPORT_SYMBOL(dss_mgr_disable);
 
 void dss_mgr_start_update(struct omap_dss_device *dssdev)
 {
 	dssdev->dss->mgr_ops->start_update(dssdev->dss->mgr_ops_priv,
 					   dssdev->dispc_channel);
 }
-EXPORT_SYMBOL(dss_mgr_start_update);
 
 int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
 		void (*handler)(void *), void *data)
@@ -150,7 +141,6 @@ int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
 							dssdev->dispc_channel,
 							handler, data);
 }
-EXPORT_SYMBOL(dss_mgr_register_framedone_handler);
 
 void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
 		void (*handler)(void *), void *data)
@@ -161,4 +151,3 @@ void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
 						   dssdev->dispc_channel,
 						   handler, data);
 }
-EXPORT_SYMBOL(dss_mgr_unregister_framedone_handler);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index dbb8e95234b3..9d5f53e774ef 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -741,8 +741,14 @@ static struct platform_driver * const drivers[] = {
 
 static int __init omap_drm_init(void)
 {
+	int r;
+
 	DBG("init");
 
+	r = omap_dss_init();
+	if (r)
+		return r;
+
 	return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
 }
 
@@ -751,13 +757,15 @@ static void __exit omap_drm_fini(void)
 	DBG("fini");
 
 	platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
+
+	omap_dss_exit();
 }
 
-/* need late_initcall() so we load after dss_driver's are loaded */
-late_initcall(omap_drm_init);
+module_init(omap_drm_init);
 module_exit(omap_drm_fini);
 
 MODULE_AUTHOR("Rob Clark <rob@ti.com>");
+MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
 MODULE_DESCRIPTION("OMAP DRM Display Driver");
 MODULE_ALIAS("platform:" DRIVER_NAME);
 MODULE_LICENSE("GPL v2");
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 53/56] drm/omap: remove unused display.c
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen

The functions in display.c are not used, so drop the file.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/Makefile      |  2 +-
 drivers/gpu/drm/omapdrm/dss/display.c | 58 ---------------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 --
 3 files changed, 1 insertion(+), 63 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/display.c

diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index 33fe7e937680..21e8277ff88f 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -18,7 +18,7 @@ omapdrm-y := omap_drv.o \
 
 omapdrm-$(CONFIG_DRM_FBDEV_EMULATION) += omap_fbdev.o
 
-omapdrm-y += dss/base.o dss/display.o dss/output.o dss/dss.o dss/dispc.o \
+omapdrm-y += dss/base.o dss/output.o dss/dss.o dss/dispc.o \
 		dss/dispc_coefs.o dss/pll.o dss/video-pll.o
 omapdrm-$(CONFIG_OMAP2_DSS_DPI) += dss/dpi.o
 omapdrm-$(CONFIG_OMAP2_DSS_VENC) += dss/venc.o
diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c
deleted file mode 100644
index 7b7ee2019eae..000000000000
--- a/drivers/gpu/drm/omapdrm/dss/display.c
+++ /dev/null
@@ -1,58 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2009 Nokia Corporation
- * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
- *
- * Some code and ideas taken from drivers/video/omap/ driver
- * by Imre Deak.
- */
-
-#define DSS_SUBSYS_NAME "DISPLAY"
-
-#include <linux/kernel.h>
-#include <linux/of.h>
-
-#include <drm/drm_connector.h>
-#include <drm/drm_modes.h>
-
-#include "omapdss.h"
-
-static int disp_num_counter;
-
-void omapdss_display_init(struct omap_dss_device *dssdev)
-{
-	int id;
-
-	/*
-	 * Note: this presumes that all displays either have an DT alias, or
-	 * none has.
-	 */
-	id = of_alias_get_id(dssdev->dev->of_node, "display");
-	if (id < 0)
-		id = disp_num_counter++;
-
-	/* Use 'label' property for name, if it exists */
-	of_property_read_string(dssdev->dev->of_node, "label", &dssdev->name);
-
-	if (dssdev->name == NULL)
-		dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
-					      "display%u", id);
-}
-
-int omapdss_display_get_modes(struct drm_connector *connector,
-			      const struct videomode *vm)
-{
-	struct drm_display_mode *mode;
-
-	mode = drm_mode_create(connector->dev);
-	if (!mode)
-		return 0;
-
-	drm_display_mode_from_videomode(vm, mode);
-
-	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
-	drm_mode_set_name(mode);
-	drm_mode_probed_add(connector, mode);
-
-	return 1;
-}
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 4e7ae164de4f..90e41c635e45 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -300,10 +300,6 @@ struct dss_pdata {
 	struct dss_device *dss;
 };
 
-void omapdss_display_init(struct omap_dss_device *dssdev);
-int omapdss_display_get_modes(struct drm_connector *connector,
-			      const struct videomode *vm);
-
 void omapdss_device_register(struct omap_dss_device *dssdev);
 void omapdss_device_unregister(struct omap_dss_device *dssdev);
 struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 53/56] drm/omap: remove unused display.c
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen, Sekhar Nori

The functions in display.c are not used, so drop the file.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/Makefile      |  2 +-
 drivers/gpu/drm/omapdrm/dss/display.c | 58 ---------------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 --
 3 files changed, 1 insertion(+), 63 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/display.c

diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index 33fe7e937680..21e8277ff88f 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -18,7 +18,7 @@ omapdrm-y := omap_drv.o \
 
 omapdrm-$(CONFIG_DRM_FBDEV_EMULATION) += omap_fbdev.o
 
-omapdrm-y += dss/base.o dss/display.o dss/output.o dss/dss.o dss/dispc.o \
+omapdrm-y += dss/base.o dss/output.o dss/dss.o dss/dispc.o \
 		dss/dispc_coefs.o dss/pll.o dss/video-pll.o
 omapdrm-$(CONFIG_OMAP2_DSS_DPI) += dss/dpi.o
 omapdrm-$(CONFIG_OMAP2_DSS_VENC) += dss/venc.o
diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c
deleted file mode 100644
index 7b7ee2019eae..000000000000
--- a/drivers/gpu/drm/omapdrm/dss/display.c
+++ /dev/null
@@ -1,58 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2009 Nokia Corporation
- * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
- *
- * Some code and ideas taken from drivers/video/omap/ driver
- * by Imre Deak.
- */
-
-#define DSS_SUBSYS_NAME "DISPLAY"
-
-#include <linux/kernel.h>
-#include <linux/of.h>
-
-#include <drm/drm_connector.h>
-#include <drm/drm_modes.h>
-
-#include "omapdss.h"
-
-static int disp_num_counter;
-
-void omapdss_display_init(struct omap_dss_device *dssdev)
-{
-	int id;
-
-	/*
-	 * Note: this presumes that all displays either have an DT alias, or
-	 * none has.
-	 */
-	id = of_alias_get_id(dssdev->dev->of_node, "display");
-	if (id < 0)
-		id = disp_num_counter++;
-
-	/* Use 'label' property for name, if it exists */
-	of_property_read_string(dssdev->dev->of_node, "label", &dssdev->name);
-
-	if (dssdev->name == NULL)
-		dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
-					      "display%u", id);
-}
-
-int omapdss_display_get_modes(struct drm_connector *connector,
-			      const struct videomode *vm)
-{
-	struct drm_display_mode *mode;
-
-	mode = drm_mode_create(connector->dev);
-	if (!mode)
-		return 0;
-
-	drm_display_mode_from_videomode(vm, mode);
-
-	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
-	drm_mode_set_name(mode);
-	drm_mode_probed_add(connector, mode);
-
-	return 1;
-}
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 4e7ae164de4f..90e41c635e45 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -300,10 +300,6 @@ struct dss_pdata {
 	struct dss_device *dss;
 };
 
-void omapdss_display_init(struct omap_dss_device *dssdev);
-int omapdss_display_get_modes(struct drm_connector *connector,
-			      const struct videomode *vm);
-
 void omapdss_device_register(struct omap_dss_device *dssdev);
 void omapdss_device_unregister(struct omap_dss_device *dssdev);
 struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 54/56] drm/omap: drop unused owner field
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen

dssdev->owner is set, but never used. We can drop the field.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dpi.c     | 1 -
 drivers/gpu/drm/omapdrm/dss/dsi.c     | 1 -
 drivers/gpu/drm/omapdrm/dss/hdmi4.c   | 1 -
 drivers/gpu/drm/omapdrm/dss/hdmi5.c   | 1 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 --
 drivers/gpu/drm/omapdrm/dss/sdi.c     | 1 -
 drivers/gpu/drm/omapdrm/dss/venc.c    | 1 -
 7 files changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c
index 1d2992daef40..030f997eccd0 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -641,7 +641,6 @@ static int dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
 	out->type = OMAP_DISPLAY_TYPE_DPI;
 	out->dispc_channel = dpi_get_channel(dpi);
 	out->of_port = port_num;
-	out->owner = THIS_MODULE;
 
 	r = omapdss_device_init_output(out, &dpi->bridge);
 	if (r < 0) {
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 76e4f607d8cf..22718a771d6d 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5443,7 +5443,6 @@ static int dsi_init_output(struct dsi_data *dsi)
 	out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
 	out->dispc_channel = dsi_get_channel(dsi);
 	out->dsi_ops = &dsi_ops;
-	out->owner = THIS_MODULE;
 	out->of_port = 0;
 	out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
 		       | DRM_BUS_FLAG_DE_HIGH
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index a14fbf06cb30..13701571d59b 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -707,7 +707,6 @@ static int hdmi4_init_output(struct omap_hdmi *hdmi)
 	out->type = OMAP_DISPLAY_TYPE_HDMI;
 	out->name = "hdmi.0";
 	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
-	out->owner = THIS_MODULE;
 	out->of_port = 0;
 
 	r = omapdss_device_init_output(out, &hdmi->bridge);
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index b738d9750686..5d627caf90f2 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -681,7 +681,6 @@ static int hdmi5_init_output(struct omap_hdmi *hdmi)
 	out->type = OMAP_DISPLAY_TYPE_HDMI;
 	out->name = "hdmi.0";
 	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
-	out->owner = THIS_MODULE;
 	out->of_port = 0;
 
 	r = omapdss_device_init_output(out, &hdmi->bridge);
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 90e41c635e45..4442e49ffc5c 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -263,8 +263,6 @@ struct omapdss_dsi_ops {
 struct omap_dss_device {
 	struct device *dev;
 
-	struct module *owner;
-
 	struct dss_device *dss;
 	struct drm_bridge *bridge;
 	struct drm_bridge *next_bridge;
diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c b/drivers/gpu/drm/omapdrm/dss/sdi.c
index 033fd30074b0..35827b4487bd 100644
--- a/drivers/gpu/drm/omapdrm/dss/sdi.c
+++ b/drivers/gpu/drm/omapdrm/dss/sdi.c
@@ -314,7 +314,6 @@ static int sdi_init_output(struct sdi_device *sdi)
 	out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
 	/* We have SDI only on OMAP3, where it's on port 1 */
 	out->of_port = 1;
-	out->owner = THIS_MODULE;
 	out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE	/* 15.5.9.1.2 */
 		       | DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
index 6e418a0f7572..8ecffe5bbd29 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -730,7 +730,6 @@ static int venc_init_output(struct venc_device *venc)
 	out->type = OMAP_DISPLAY_TYPE_VENC;
 	out->name = "venc.0";
 	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
-	out->owner = THIS_MODULE;
 	out->of_port = 0;
 
 	r = omapdss_device_init_output(out, &venc->bridge);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 54/56] drm/omap: drop unused owner field
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen, Sekhar Nori

dssdev->owner is set, but never used. We can drop the field.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dpi.c     | 1 -
 drivers/gpu/drm/omapdrm/dss/dsi.c     | 1 -
 drivers/gpu/drm/omapdrm/dss/hdmi4.c   | 1 -
 drivers/gpu/drm/omapdrm/dss/hdmi5.c   | 1 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 --
 drivers/gpu/drm/omapdrm/dss/sdi.c     | 1 -
 drivers/gpu/drm/omapdrm/dss/venc.c    | 1 -
 7 files changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c
index 1d2992daef40..030f997eccd0 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -641,7 +641,6 @@ static int dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
 	out->type = OMAP_DISPLAY_TYPE_DPI;
 	out->dispc_channel = dpi_get_channel(dpi);
 	out->of_port = port_num;
-	out->owner = THIS_MODULE;
 
 	r = omapdss_device_init_output(out, &dpi->bridge);
 	if (r < 0) {
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 76e4f607d8cf..22718a771d6d 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5443,7 +5443,6 @@ static int dsi_init_output(struct dsi_data *dsi)
 	out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
 	out->dispc_channel = dsi_get_channel(dsi);
 	out->dsi_ops = &dsi_ops;
-	out->owner = THIS_MODULE;
 	out->of_port = 0;
 	out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
 		       | DRM_BUS_FLAG_DE_HIGH
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index a14fbf06cb30..13701571d59b 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -707,7 +707,6 @@ static int hdmi4_init_output(struct omap_hdmi *hdmi)
 	out->type = OMAP_DISPLAY_TYPE_HDMI;
 	out->name = "hdmi.0";
 	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
-	out->owner = THIS_MODULE;
 	out->of_port = 0;
 
 	r = omapdss_device_init_output(out, &hdmi->bridge);
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index b738d9750686..5d627caf90f2 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -681,7 +681,6 @@ static int hdmi5_init_output(struct omap_hdmi *hdmi)
 	out->type = OMAP_DISPLAY_TYPE_HDMI;
 	out->name = "hdmi.0";
 	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
-	out->owner = THIS_MODULE;
 	out->of_port = 0;
 
 	r = omapdss_device_init_output(out, &hdmi->bridge);
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 90e41c635e45..4442e49ffc5c 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -263,8 +263,6 @@ struct omapdss_dsi_ops {
 struct omap_dss_device {
 	struct device *dev;
 
-	struct module *owner;
-
 	struct dss_device *dss;
 	struct drm_bridge *bridge;
 	struct drm_bridge *next_bridge;
diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c b/drivers/gpu/drm/omapdrm/dss/sdi.c
index 033fd30074b0..35827b4487bd 100644
--- a/drivers/gpu/drm/omapdrm/dss/sdi.c
+++ b/drivers/gpu/drm/omapdrm/dss/sdi.c
@@ -314,7 +314,6 @@ static int sdi_init_output(struct sdi_device *sdi)
 	out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
 	/* We have SDI only on OMAP3, where it's on port 1 */
 	out->of_port = 1;
-	out->owner = THIS_MODULE;
 	out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE	/* 15.5.9.1.2 */
 		       | DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
index 6e418a0f7572..8ecffe5bbd29 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -730,7 +730,6 @@ static int venc_init_output(struct venc_device *venc)
 	out->type = OMAP_DISPLAY_TYPE_VENC;
 	out->name = "venc.0";
 	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
-	out->owner = THIS_MODULE;
 	out->of_port = 0;
 
 	r = omapdss_device_init_output(out, &venc->bridge);
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 55/56] drm/omap: remove dispc_ops
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen

dispc_ops was created to help with the multi-module architecture and
giving us the possibility of multiple dispc implementations. Neither of
these is valid anymore, and we can remove dispc_ops and use direct
calls to dispc.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c    |   6 --
 drivers/gpu/drm/omapdrm/dss/dispc.c   | 101 +++++++-------------------
 drivers/gpu/drm/omapdrm/dss/dss.h     |  71 +++++++++++++++++-
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  71 ------------------
 drivers/gpu/drm/omapdrm/omap_crtc.c   |  30 ++++----
 drivers/gpu/drm/omapdrm/omap_drv.c    |  15 ++--
 drivers/gpu/drm/omapdrm/omap_drv.h    |   2 +-
 drivers/gpu/drm/omapdrm/omap_irq.c    |  34 ++++-----
 drivers/gpu/drm/omapdrm/omap_plane.c  |  12 +--
 9 files changed, 143 insertions(+), 199 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index 08c7c5024896..0aff16bf6edb 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -21,12 +21,6 @@ struct dispc_device *dispc_get_dispc(struct dss_device *dss)
 	return dss->dispc;
 }
 
-const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
-{
-	return dss->dispc_ops;
-}
-
-
 /* -----------------------------------------------------------------------------
  * OMAP DSS Devices Handling
  */
diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 48593932bddf..509bac99cb57 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -351,8 +351,6 @@ static unsigned long dispc_plane_pclk_rate(struct dispc_device *dispc,
 static unsigned long dispc_plane_lclk_rate(struct dispc_device *dispc,
 					   enum omap_plane_id plane);
 
-static void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask);
-
 static inline void dispc_write_reg(struct dispc_device *dispc, u16 idx, u32 val)
 {
 	__raw_writel(val, dispc->base + idx);
@@ -379,12 +377,12 @@ static void mgr_fld_write(struct dispc_device *dispc, enum omap_channel channel,
 	REG_FLD_MOD(dispc, rfld->reg, val, rfld->high, rfld->low);
 }
 
-static int dispc_get_num_ovls(struct dispc_device *dispc)
+int dispc_get_num_ovls(struct dispc_device *dispc)
 {
 	return dispc->feat->num_ovls;
 }
 
-static int dispc_get_num_mgrs(struct dispc_device *dispc)
+int dispc_get_num_mgrs(struct dispc_device *dispc)
 {
 	return dispc->feat->num_mgrs;
 }
@@ -667,13 +665,13 @@ void dispc_runtime_put(struct dispc_device *dispc)
 	WARN_ON(r < 0 && r != -ENOSYS);
 }
 
-static u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
+u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
 				   enum omap_channel channel)
 {
 	return mgr_desc[channel].vsync_irq;
 }
 
-static u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
+u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
 				       enum omap_channel channel)
 {
 	if (channel == OMAP_DSS_CHANNEL_DIGIT && dispc->feat->no_framedone_tv)
@@ -682,18 +680,18 @@ static u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
 	return mgr_desc[channel].framedone_irq;
 }
 
-static u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
+u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
 				       enum omap_channel channel)
 {
 	return mgr_desc[channel].sync_lost_irq;
 }
 
-static u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
+u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
 {
 	return DISPC_IRQ_FRAMEDONEWB;
 }
 
-static void dispc_mgr_enable(struct dispc_device *dispc,
+void dispc_mgr_enable(struct dispc_device *dispc,
 			     enum omap_channel channel, bool enable)
 {
 	mgr_fld_write(dispc, channel, DISPC_MGR_FLD_ENABLE, enable);
@@ -707,13 +705,13 @@ static bool dispc_mgr_is_enabled(struct dispc_device *dispc,
 	return !!mgr_fld_read(dispc, channel, DISPC_MGR_FLD_ENABLE);
 }
 
-static bool dispc_mgr_go_busy(struct dispc_device *dispc,
+bool dispc_mgr_go_busy(struct dispc_device *dispc,
 			      enum omap_channel channel)
 {
 	return mgr_fld_read(dispc, channel, DISPC_MGR_FLD_GO) == 1;
 }
 
-static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
+void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
 {
 	WARN_ON(!dispc_mgr_is_enabled(dispc, channel));
 	WARN_ON(dispc_mgr_go_busy(dispc, channel));
@@ -723,12 +721,12 @@ static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
 	mgr_fld_write(dispc, channel, DISPC_MGR_FLD_GO, 1);
 }
 
-static bool dispc_wb_go_busy(struct dispc_device *dispc)
+bool dispc_wb_go_busy(struct dispc_device *dispc)
 {
 	return REG_GET(dispc, DISPC_CONTROL2, 6, 6) == 1;
 }
 
-static void dispc_wb_go(struct dispc_device *dispc)
+void dispc_wb_go(struct dispc_device *dispc)
 {
 	enum omap_plane_id plane = OMAP_DSS_WB;
 	bool enable, go;
@@ -1282,7 +1280,7 @@ static bool dispc_ovl_color_mode_supported(struct dispc_device *dispc,
 	return false;
 }
 
-static const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc,
+const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc,
 					    enum omap_plane_id plane)
 {
 	return dispc->feat->supported_color_modes[plane];
@@ -2761,7 +2759,7 @@ static int dispc_ovl_setup_common(struct dispc_device *dispc,
 	return 0;
 }
 
-static int dispc_ovl_setup(struct dispc_device *dispc,
+int dispc_ovl_setup(struct dispc_device *dispc,
 			   enum omap_plane_id plane,
 			   const struct omap_overlay_info *oi,
 			   const struct videomode *vm, bool mem_to_mem,
@@ -2788,7 +2786,7 @@ static int dispc_ovl_setup(struct dispc_device *dispc,
 	return r;
 }
 
-static int dispc_wb_setup(struct dispc_device *dispc,
+int dispc_wb_setup(struct dispc_device *dispc,
 		   const struct omap_dss_writeback_info *wi,
 		   bool mem_to_mem, const struct videomode *vm,
 		   enum dss_writeback_channel channel_in)
@@ -2871,12 +2869,12 @@ static int dispc_wb_setup(struct dispc_device *dispc,
 	return 0;
 }
 
-static bool dispc_has_writeback(struct dispc_device *dispc)
+bool dispc_has_writeback(struct dispc_device *dispc)
 {
 	return dispc->feat->has_writeback;
 }
 
-static int dispc_ovl_enable(struct dispc_device *dispc,
+int dispc_ovl_enable(struct dispc_device *dispc,
 			    enum omap_plane_id plane, bool enable)
 {
 	DSSDBG("dispc_enable_plane %d, %d\n", plane, enable);
@@ -2967,7 +2965,7 @@ static void dispc_mgr_enable_alpha_fixed_zorder(struct dispc_device *dispc,
 		REG_FLD_MOD(dispc, DISPC_CONFIG, enable, 19, 19);
 }
 
-static void dispc_mgr_setup(struct dispc_device *dispc,
+void dispc_mgr_setup(struct dispc_device *dispc,
 			    enum omap_channel channel,
 			    const struct omap_overlay_manager_info *info)
 {
@@ -3046,7 +3044,7 @@ static void dispc_mgr_enable_stallmode(struct dispc_device *dispc,
 	mgr_fld_write(dispc, channel, DISPC_MGR_FLD_STALLMODE, enable);
 }
 
-static void dispc_mgr_set_lcd_config(struct dispc_device *dispc,
+void dispc_mgr_set_lcd_config(struct dispc_device *dispc,
 				     enum omap_channel channel,
 				     const struct dss_lcd_mgr_config *config)
 {
@@ -3095,7 +3093,7 @@ static bool _dispc_mgr_pclk_ok(struct dispc_device *dispc,
 		return pclk <= dispc->feat->max_tv_pclk;
 }
 
-static int dispc_mgr_check_timings(struct dispc_device *dispc,
+int dispc_mgr_check_timings(struct dispc_device *dispc,
 				   enum omap_channel channel,
 				   const struct videomode *vm)
 {
@@ -3188,7 +3186,7 @@ static int vm_flag_to_int(enum display_flags flags, enum display_flags high,
 }
 
 /* change name to mode? */
-static void dispc_mgr_set_timings(struct dispc_device *dispc,
+void dispc_mgr_set_timings(struct dispc_device *dispc,
 				  enum omap_channel channel,
 				  const struct videomode *vm)
 {
@@ -3732,17 +3730,17 @@ int dispc_mgr_get_clock_div(struct dispc_device *dispc,
 	return 0;
 }
 
-static u32 dispc_read_irqstatus(struct dispc_device *dispc)
+u32 dispc_read_irqstatus(struct dispc_device *dispc)
 {
 	return dispc_read_reg(dispc, DISPC_IRQSTATUS);
 }
 
-static void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask)
+void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask)
 {
 	dispc_write_reg(dispc, DISPC_IRQSTATUS, mask);
 }
 
-static void dispc_write_irqenable(struct dispc_device *dispc, u32 mask)
+void dispc_write_irqenable(struct dispc_device *dispc, u32 mask)
 {
 	u32 old_mask = dispc_read_reg(dispc, DISPC_IRQENABLE);
 
@@ -3766,7 +3764,7 @@ void dispc_disable_sidle(struct dispc_device *dispc)
 	REG_FLD_MOD(dispc, DISPC_SYSCONFIG, 1, 4, 3);	/* SIDLEMODE: no idle */
 }
 
-static u32 dispc_mgr_gamma_size(struct dispc_device *dispc,
+u32 dispc_mgr_gamma_size(struct dispc_device *dispc,
 				enum omap_channel channel)
 {
 	const struct dispc_gamma_desc *gdesc = &mgr_desc[channel].gamma;
@@ -3821,7 +3819,7 @@ static const struct drm_color_lut dispc_mgr_gamma_default_lut[] = {
 	{ .red = U16_MAX, .green = U16_MAX, .blue = U16_MAX, },
 };
 
-static void dispc_mgr_set_gamma(struct dispc_device *dispc,
+void dispc_mgr_set_gamma(struct dispc_device *dispc,
 				enum omap_channel channel,
 				const struct drm_color_lut *lut,
 				unsigned int length)
@@ -4479,7 +4477,7 @@ static irqreturn_t dispc_irq_handler(int irq, void *arg)
 	return dispc->user_handler(irq, dispc->user_data);
 }
 
-static int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
+int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
 			     void *dev_id)
 {
 	int r;
@@ -4503,7 +4501,7 @@ static int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
 	return r;
 }
 
-static void dispc_free_irq(struct dispc_device *dispc, void *dev_id)
+void dispc_free_irq(struct dispc_device *dispc, void *dev_id)
 {
 	devm_free_irq(&dispc->pdev->dev, dispc->irq, dispc);
 
@@ -4511,7 +4509,7 @@ static void dispc_free_irq(struct dispc_device *dispc, void *dev_id)
 	dispc->user_data = NULL;
 }
 
-static u32 dispc_get_memory_bandwidth_limit(struct dispc_device *dispc)
+u32 dispc_get_memory_bandwidth_limit(struct dispc_device *dispc)
 {
 	u32 limit = 0;
 
@@ -4681,47 +4679,6 @@ static void dispc_errata_i734_wa(struct dispc_device *dispc)
 	REG_FLD_MOD(dispc, DISPC_CONFIG, gatestate, 8, 4);
 }
 
-static const struct dispc_ops dispc_ops = {
-	.read_irqstatus = dispc_read_irqstatus,
-	.clear_irqstatus = dispc_clear_irqstatus,
-	.write_irqenable = dispc_write_irqenable,
-
-	.request_irq = dispc_request_irq,
-	.free_irq = dispc_free_irq,
-
-	.runtime_get = dispc_runtime_get,
-	.runtime_put = dispc_runtime_put,
-
-	.get_num_ovls = dispc_get_num_ovls,
-	.get_num_mgrs = dispc_get_num_mgrs,
-
-	.get_memory_bandwidth_limit = dispc_get_memory_bandwidth_limit,
-
-	.mgr_enable = dispc_mgr_enable,
-	.mgr_is_enabled = dispc_mgr_is_enabled,
-	.mgr_get_vsync_irq = dispc_mgr_get_vsync_irq,
-	.mgr_get_framedone_irq = dispc_mgr_get_framedone_irq,
-	.mgr_get_sync_lost_irq = dispc_mgr_get_sync_lost_irq,
-	.mgr_go_busy = dispc_mgr_go_busy,
-	.mgr_go = dispc_mgr_go,
-	.mgr_set_lcd_config = dispc_mgr_set_lcd_config,
-	.mgr_check_timings = dispc_mgr_check_timings,
-	.mgr_set_timings = dispc_mgr_set_timings,
-	.mgr_setup = dispc_mgr_setup,
-	.mgr_gamma_size = dispc_mgr_gamma_size,
-	.mgr_set_gamma = dispc_mgr_set_gamma,
-
-	.ovl_enable = dispc_ovl_enable,
-	.ovl_setup = dispc_ovl_setup,
-	.ovl_get_color_modes = dispc_ovl_get_color_modes,
-
-	.wb_get_framedone_irq = dispc_wb_get_framedone_irq,
-	.wb_setup = dispc_wb_setup,
-	.has_writeback = dispc_has_writeback,
-	.wb_go_busy = dispc_wb_go_busy,
-	.wb_go = dispc_wb_go,
-};
-
 /* DISPC HW IP initialisation */
 static const struct of_device_id dispc_of_match[] = {
 	{ .compatible = "ti,omap2-dispc", .data = &omap24xx_dispc_feats },
@@ -4823,7 +4780,6 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
 	dispc_runtime_put(dispc);
 
 	dss->dispc = dispc;
-	dss->dispc_ops = &dispc_ops;
 
 	dispc->debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs,
 						 dispc);
@@ -4845,7 +4801,6 @@ static void dispc_unbind(struct device *dev, struct device *master, void *data)
 	dss_debugfs_remove_file(dispc->debugfs);
 
 	dss->dispc = NULL;
-	dss->dispc_ops = NULL;
 
 	pm_runtime_disable(dev);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
index 2b404bcb41dd..96f702314c8c 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss.h
@@ -257,7 +257,6 @@ struct dss_device {
 	struct dss_pll	*video2_pll;
 
 	struct dispc_device *dispc;
-	const struct dispc_ops *dispc_ops;
 	const struct dss_mgr_ops *mgr_ops;
 	struct omap_drm_private *mgr_ops_priv;
 };
@@ -393,6 +392,76 @@ void dispc_dump_clocks(struct dispc_device *dispc, struct seq_file *s);
 int dispc_runtime_get(struct dispc_device *dispc);
 void dispc_runtime_put(struct dispc_device *dispc);
 
+int dispc_get_num_ovls(struct dispc_device *dispc);
+int dispc_get_num_mgrs(struct dispc_device *dispc);
+
+const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc,
+					    enum omap_plane_id plane);
+
+u32 dispc_read_irqstatus(struct dispc_device *dispc);
+void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask);
+void dispc_write_irqenable(struct dispc_device *dispc, u32 mask);
+
+int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
+			     void *dev_id);
+void dispc_free_irq(struct dispc_device *dispc, void *dev_id);
+
+u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
+				   enum omap_channel channel);
+u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
+				       enum omap_channel channel);
+u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
+				       enum omap_channel channel);
+u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc);
+
+u32 dispc_get_memory_bandwidth_limit(struct dispc_device *dispc);
+
+void dispc_mgr_enable(struct dispc_device *dispc,
+			     enum omap_channel channel, bool enable);
+
+bool dispc_mgr_go_busy(struct dispc_device *dispc,
+			      enum omap_channel channel);
+
+void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel);
+
+void dispc_mgr_set_lcd_config(struct dispc_device *dispc,
+				     enum omap_channel channel,
+				     const struct dss_lcd_mgr_config *config);
+void dispc_mgr_set_timings(struct dispc_device *dispc,
+				  enum omap_channel channel,
+				  const struct videomode *vm);
+void dispc_mgr_setup(struct dispc_device *dispc,
+			    enum omap_channel channel,
+			    const struct omap_overlay_manager_info *info);
+
+int dispc_mgr_check_timings(struct dispc_device *dispc,
+				   enum omap_channel channel,
+				   const struct videomode *vm);
+
+u32 dispc_mgr_gamma_size(struct dispc_device *dispc,
+				enum omap_channel channel);
+void dispc_mgr_set_gamma(struct dispc_device *dispc,
+				enum omap_channel channel,
+				const struct drm_color_lut *lut,
+				unsigned int length);
+
+int dispc_ovl_setup(struct dispc_device *dispc,
+			   enum omap_plane_id plane,
+			   const struct omap_overlay_info *oi,
+			   const struct videomode *vm, bool mem_to_mem,
+			   enum omap_channel channel);
+
+int dispc_ovl_enable(struct dispc_device *dispc,
+			    enum omap_plane_id plane, bool enable);
+
+bool dispc_has_writeback(struct dispc_device *dispc);
+int dispc_wb_setup(struct dispc_device *dispc,
+		   const struct omap_dss_writeback_info *wi,
+		   bool mem_to_mem, const struct videomode *vm,
+		   enum dss_writeback_channel channel_in);
+bool dispc_wb_go_busy(struct dispc_device *dispc);
+void dispc_wb_go(struct dispc_device *dispc);
+
 void dispc_enable_sidle(struct dispc_device *dispc);
 void dispc_disable_sidle(struct dispc_device *dispc);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 4442e49ffc5c..fba5f05e5e48 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -376,78 +376,7 @@ int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
 void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
 		void (*handler)(void *), void *data);
 
-/* dispc ops */
-
-struct dispc_ops {
-	u32 (*read_irqstatus)(struct dispc_device *dispc);
-	void (*clear_irqstatus)(struct dispc_device *dispc, u32 mask);
-	void (*write_irqenable)(struct dispc_device *dispc, u32 mask);
-
-	int (*request_irq)(struct dispc_device *dispc, irq_handler_t handler,
-			   void *dev_id);
-	void (*free_irq)(struct dispc_device *dispc, void *dev_id);
-
-	int (*runtime_get)(struct dispc_device *dispc);
-	void (*runtime_put)(struct dispc_device *dispc);
-
-	int (*get_num_ovls)(struct dispc_device *dispc);
-	int (*get_num_mgrs)(struct dispc_device *dispc);
-
-	u32 (*get_memory_bandwidth_limit)(struct dispc_device *dispc);
-
-	void (*mgr_enable)(struct dispc_device *dispc,
-			   enum omap_channel channel, bool enable);
-	bool (*mgr_is_enabled)(struct dispc_device *dispc,
-			       enum omap_channel channel);
-	u32 (*mgr_get_vsync_irq)(struct dispc_device *dispc,
-				 enum omap_channel channel);
-	u32 (*mgr_get_framedone_irq)(struct dispc_device *dispc,
-				     enum omap_channel channel);
-	u32 (*mgr_get_sync_lost_irq)(struct dispc_device *dispc,
-				     enum omap_channel channel);
-	bool (*mgr_go_busy)(struct dispc_device *dispc,
-			    enum omap_channel channel);
-	void (*mgr_go)(struct dispc_device *dispc, enum omap_channel channel);
-	void (*mgr_set_lcd_config)(struct dispc_device *dispc,
-				   enum omap_channel channel,
-				   const struct dss_lcd_mgr_config *config);
-	int (*mgr_check_timings)(struct dispc_device *dispc,
-				 enum omap_channel channel,
-				 const struct videomode *vm);
-	void (*mgr_set_timings)(struct dispc_device *dispc,
-				enum omap_channel channel,
-				const struct videomode *vm);
-	void (*mgr_setup)(struct dispc_device *dispc, enum omap_channel channel,
-			  const struct omap_overlay_manager_info *info);
-	u32 (*mgr_gamma_size)(struct dispc_device *dispc,
-			      enum omap_channel channel);
-	void (*mgr_set_gamma)(struct dispc_device *dispc,
-			      enum omap_channel channel,
-			      const struct drm_color_lut *lut,
-			      unsigned int length);
-
-	int (*ovl_enable)(struct dispc_device *dispc, enum omap_plane_id plane,
-			  bool enable);
-	int (*ovl_setup)(struct dispc_device *dispc, enum omap_plane_id plane,
-			 const struct omap_overlay_info *oi,
-			 const struct videomode *vm, bool mem_to_mem,
-			 enum omap_channel channel);
-
-	const u32 *(*ovl_get_color_modes)(struct dispc_device *dispc,
-					  enum omap_plane_id plane);
-
-	u32 (*wb_get_framedone_irq)(struct dispc_device *dispc);
-	int (*wb_setup)(struct dispc_device *dispc,
-		const struct omap_dss_writeback_info *wi,
-		bool mem_to_mem, const struct videomode *vm,
-		enum dss_writeback_channel channel_in);
-	bool (*has_writeback)(struct dispc_device *dispc);
-	bool (*wb_go_busy)(struct dispc_device *dispc);
-	void (*wb_go)(struct dispc_device *dispc);
-};
-
 struct dispc_device *dispc_get_dispc(struct dss_device *dss);
-const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
 
 bool omapdss_stack_is_ready(void);
 void omapdss_gather_components(struct device *dev);
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 5ab557c477ef..0bf5cef579b5 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -103,7 +103,7 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc)
 static void omap_crtc_dss_start_update(struct omap_drm_private *priv,
 				       enum omap_channel channel)
 {
-	priv->dispc_ops->mgr_enable(priv->dispc, channel, true);
+	dispc_mgr_enable(priv->dispc, channel, true);
 }
 
 /* Called only from the encoder enable/disable and suspend/resume handlers. */
@@ -128,7 +128,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 	}
 
 	if (omap_crtc->pipe->output->type == OMAP_DISPLAY_TYPE_HDMI) {
-		priv->dispc_ops->mgr_enable(priv->dispc, channel, enable);
+		dispc_mgr_enable(priv->dispc, channel, enable);
 		omap_crtc->enabled = enable;
 		return;
 	}
@@ -141,9 +141,9 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 		omap_crtc->ignore_digit_sync_lost = true;
 	}
 
-	framedone_irq = priv->dispc_ops->mgr_get_framedone_irq(priv->dispc,
+	framedone_irq = dispc_mgr_get_framedone_irq(priv->dispc,
 							       channel);
-	vsync_irq = priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel);
+	vsync_irq = dispc_mgr_get_vsync_irq(priv->dispc, channel);
 
 	if (enable) {
 		wait = omap_irq_wait_init(dev, vsync_irq, 1);
@@ -163,7 +163,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 			wait = omap_irq_wait_init(dev, vsync_irq, 2);
 	}
 
-	priv->dispc_ops->mgr_enable(priv->dispc, channel, enable);
+	dispc_mgr_enable(priv->dispc, channel, enable);
 	omap_crtc->enabled = enable;
 
 	ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100));
@@ -186,7 +186,7 @@ static int omap_crtc_dss_enable(struct omap_drm_private *priv,
 	struct drm_crtc *crtc = priv->channels[channel]->crtc;
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
 
-	priv->dispc_ops->mgr_set_timings(priv->dispc, omap_crtc->channel,
+	dispc_mgr_set_timings(priv->dispc, omap_crtc->channel,
 					 &omap_crtc->vm);
 	omap_crtc_set_enabled(&omap_crtc->base, true);
 
@@ -221,7 +221,7 @@ static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
 
 	DBG("%s", omap_crtc->name);
-	priv->dispc_ops->mgr_set_lcd_config(priv->dispc, omap_crtc->channel,
+	dispc_mgr_set_lcd_config(priv->dispc, omap_crtc->channel,
 					    config);
 }
 
@@ -300,7 +300,7 @@ void omap_crtc_vblank_irq(struct drm_crtc *crtc)
 	 * If the dispc is busy we're racing the flush operation. Try again on
 	 * the next vblank interrupt.
 	 */
-	if (priv->dispc_ops->mgr_go_busy(priv->dispc, omap_crtc->channel)) {
+	if (dispc_mgr_go_busy(priv->dispc, omap_crtc->channel)) {
 		spin_unlock(&crtc->dev->event_lock);
 		return;
 	}
@@ -391,7 +391,7 @@ static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc)
 	info.partial_alpha_enabled = false;
 	info.cpr_enable = false;
 
-	priv->dispc_ops->mgr_setup(priv->dispc, omap_crtc->channel, &info);
+	dispc_mgr_setup(priv->dispc, omap_crtc->channel, &info);
 }
 
 /* -----------------------------------------------------------------------------
@@ -432,7 +432,7 @@ static void omap_crtc_atomic_enable(struct drm_crtc *crtc,
 
 	DBG("%s", omap_crtc->name);
 
-	priv->dispc_ops->runtime_get(priv->dispc);
+	dispc_runtime_get(priv->dispc);
 
 	/* manual updated display will not trigger vsync irq */
 	if (omap_state->manually_updated)
@@ -471,7 +471,7 @@ static void omap_crtc_atomic_disable(struct drm_crtc *crtc,
 
 	drm_crtc_vblank_off(crtc);
 
-	priv->dispc_ops->runtime_put(priv->dispc);
+	dispc_runtime_put(priv->dispc);
 }
 
 static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
@@ -490,7 +490,7 @@ static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
 	 * proper DISPC mode later.
 	 */
 	if (omap_crtc->pipe->output->type != OMAP_DISPLAY_TYPE_DSI) {
-		r = priv->dispc_ops->mgr_check_timings(priv->dispc,
+		r = dispc_mgr_check_timings(priv->dispc,
 						       omap_crtc->channel,
 						       &vm);
 		if (r)
@@ -605,7 +605,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
 			length = crtc->state->gamma_lut->length /
 				sizeof(*lut);
 		}
-		priv->dispc_ops->mgr_set_gamma(priv->dispc, omap_crtc->channel,
+		dispc_mgr_set_gamma(priv->dispc, omap_crtc->channel,
 					       lut, length);
 	}
 
@@ -630,7 +630,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
 	WARN_ON(ret != 0);
 
 	spin_lock_irq(&crtc->dev->event_lock);
-	priv->dispc_ops->mgr_go(priv->dispc, omap_crtc->channel);
+	dispc_mgr_go(priv->dispc, omap_crtc->channel);
 	omap_crtc_arm_event(crtc);
 	spin_unlock_irq(&crtc->dev->event_lock);
 }
@@ -821,7 +821,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
 	 * extracted with dispc_mgr_gamma_size(). If it returns 0
 	 * gamma table is not supported.
 	 */
-	if (priv->dispc_ops->mgr_gamma_size(priv->dispc, channel)) {
+	if (dispc_mgr_gamma_size(priv->dispc, channel)) {
 		unsigned int gamma_lut_size = 256;
 
 		drm_crtc_enable_color_mgmt(crtc, 0, false, gamma_lut_size);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 9d5f53e774ef..eb419387ed05 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -69,7 +69,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)
 	struct drm_device *dev = old_state->dev;
 	struct omap_drm_private *priv = dev->dev_private;
 
-	priv->dispc_ops->runtime_get(priv->dispc);
+	dispc_runtime_get(priv->dispc);
 
 	/* Apply the atomic update. */
 	drm_atomic_helper_commit_modeset_disables(dev, old_state);
@@ -113,7 +113,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)
 
 	drm_atomic_helper_cleanup_planes(dev, old_state);
 
-	priv->dispc_ops->runtime_put(priv->dispc);
+	dispc_runtime_put(priv->dispc);
 }
 
 static const struct drm_mode_config_helper_funcs omap_mode_config_helper_funcs = {
@@ -192,7 +192,7 @@ static int omap_compare_pipelines(const void *a, const void *b)
 static int omap_modeset_init_properties(struct drm_device *dev)
 {
 	struct omap_drm_private *priv = dev->dev_private;
-	unsigned int num_planes = priv->dispc_ops->get_num_ovls(priv->dispc);
+	unsigned int num_planes = dispc_get_num_ovls(priv->dispc);
 
 	priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0,
 						      num_planes - 1);
@@ -221,8 +221,8 @@ static int omap_display_id(struct omap_dss_device *output)
 static int omap_modeset_init(struct drm_device *dev)
 {
 	struct omap_drm_private *priv = dev->dev_private;
-	int num_ovls = priv->dispc_ops->get_num_ovls(priv->dispc);
-	int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc);
+	int num_ovls = dispc_get_num_ovls(priv->dispc);
+	int num_mgrs = dispc_get_num_mgrs(priv->dispc);
 	unsigned int i;
 	int ret;
 	u32 plane_crtc_mask;
@@ -580,7 +580,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 	priv->dev = dev;
 	priv->dss = pdata->dss;
 	priv->dispc = dispc_get_dispc(priv->dss);
-	priv->dispc_ops = dispc_get_ops(priv->dss);
 
 	omap_crtc_pre_init(priv);
 
@@ -592,9 +591,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 	INIT_LIST_HEAD(&priv->obj_list);
 
 	/* Get memory bandwidth limits */
-	if (priv->dispc_ops->get_memory_bandwidth_limit)
-		priv->max_bandwidth =
-			priv->dispc_ops->get_memory_bandwidth_limit(priv->dispc);
+	priv->max_bandwidth = dispc_get_memory_bandwidth_limit(priv->dispc);
 
 	omap_gem_init(ddev);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index 93d171ffd26d..6e69358f624c 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -12,6 +12,7 @@
 #include <linux/workqueue.h>
 
 #include "dss/omapdss.h"
+#include "dss/dss.h"
 
 #include <drm/drm_gem.h>
 #include <drm/omap_drm.h>
@@ -46,7 +47,6 @@ struct omap_drm_private {
 
 	struct dss_device *dss;
 	struct dispc_device *dispc;
-	const struct dispc_ops *dispc_ops;
 
 	unsigned int num_pipes;
 	struct omap_drm_pipeline pipes[8];
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c
index 382bcdc72ac0..981387220765 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -29,7 +29,7 @@ static void omap_irq_update(struct drm_device *dev)
 
 	DBG("irqmask=%08x", irqmask);
 
-	priv->dispc_ops->write_irqenable(priv->dispc, irqmask);
+	dispc_write_irqenable(priv->dispc, irqmask);
 }
 
 static void omap_irq_wait_handler(struct omap_irq_wait *wait)
@@ -83,7 +83,7 @@ int omap_irq_enable_framedone(struct drm_crtc *crtc, bool enable)
 	unsigned long flags;
 	enum omap_channel channel = omap_crtc_channel(crtc);
 	int framedone_irq =
-		priv->dispc_ops->mgr_get_framedone_irq(priv->dispc, channel);
+		dispc_mgr_get_framedone_irq(priv->dispc, channel);
 
 	DBG("dev=%p, crtc=%u, enable=%d", dev, channel, enable);
 
@@ -121,7 +121,7 @@ int omap_irq_enable_vblank(struct drm_crtc *crtc)
 	DBG("dev=%p, crtc=%u", dev, channel);
 
 	spin_lock_irqsave(&priv->wait_lock, flags);
-	priv->irq_mask |= priv->dispc_ops->mgr_get_vsync_irq(priv->dispc,
+	priv->irq_mask |= dispc_mgr_get_vsync_irq(priv->dispc,
 							     channel);
 	omap_irq_update(dev);
 	spin_unlock_irqrestore(&priv->wait_lock, flags);
@@ -148,7 +148,7 @@ void omap_irq_disable_vblank(struct drm_crtc *crtc)
 	DBG("dev=%p, crtc=%u", dev, channel);
 
 	spin_lock_irqsave(&priv->wait_lock, flags);
-	priv->irq_mask &= ~priv->dispc_ops->mgr_get_vsync_irq(priv->dispc,
+	priv->irq_mask &= ~dispc_mgr_get_vsync_irq(priv->dispc,
 							      channel);
 	omap_irq_update(dev);
 	spin_unlock_irqrestore(&priv->wait_lock, flags);
@@ -213,9 +213,9 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
 	unsigned int id;
 	u32 irqstatus;
 
-	irqstatus = priv->dispc_ops->read_irqstatus(priv->dispc);
-	priv->dispc_ops->clear_irqstatus(priv->dispc, irqstatus);
-	priv->dispc_ops->read_irqstatus(priv->dispc);	/* flush posted write */
+	irqstatus = dispc_read_irqstatus(priv->dispc);
+	dispc_clear_irqstatus(priv->dispc, irqstatus);
+	dispc_read_irqstatus(priv->dispc);	/* flush posted write */
 
 	VERB("irqs: %08x", irqstatus);
 
@@ -223,15 +223,15 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
 		struct drm_crtc *crtc = priv->pipes[id].crtc;
 		enum omap_channel channel = omap_crtc_channel(crtc);
 
-		if (irqstatus & priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel)) {
+		if (irqstatus & dispc_mgr_get_vsync_irq(priv->dispc, channel)) {
 			drm_handle_vblank(dev, id);
 			omap_crtc_vblank_irq(crtc);
 		}
 
-		if (irqstatus & priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, channel))
+		if (irqstatus & dispc_mgr_get_sync_lost_irq(priv->dispc, channel))
 			omap_crtc_error_irq(crtc, irqstatus);
 
-		if (irqstatus & priv->dispc_ops->mgr_get_framedone_irq(priv->dispc, channel))
+		if (irqstatus & dispc_mgr_get_framedone_irq(priv->dispc, channel))
 			omap_crtc_framedone_irq(crtc, irqstatus);
 	}
 
@@ -265,7 +265,7 @@ static const u32 omap_underflow_irqs[] = {
 int omap_drm_irq_install(struct drm_device *dev)
 {
 	struct omap_drm_private *priv = dev->dev_private;
-	unsigned int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc);
+	unsigned int num_mgrs = dispc_get_num_mgrs(priv->dispc);
 	unsigned int max_planes;
 	unsigned int i;
 	int ret;
@@ -283,13 +283,13 @@ int omap_drm_irq_install(struct drm_device *dev)
 	}
 
 	for (i = 0; i < num_mgrs; ++i)
-		priv->irq_mask |= priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, i);
+		priv->irq_mask |= dispc_mgr_get_sync_lost_irq(priv->dispc, i);
 
-	priv->dispc_ops->runtime_get(priv->dispc);
-	priv->dispc_ops->clear_irqstatus(priv->dispc, 0xffffffff);
-	priv->dispc_ops->runtime_put(priv->dispc);
+	dispc_runtime_get(priv->dispc);
+	dispc_clear_irqstatus(priv->dispc, 0xffffffff);
+	dispc_runtime_put(priv->dispc);
 
-	ret = priv->dispc_ops->request_irq(priv->dispc, omap_irq_handler, dev);
+	ret = dispc_request_irq(priv->dispc, omap_irq_handler, dev);
 	if (ret < 0)
 		return ret;
 
@@ -307,5 +307,5 @@ void omap_drm_irq_uninstall(struct drm_device *dev)
 
 	dev->irq_enabled = false;
 
-	priv->dispc_ops->free_irq(priv->dispc, dev);
+	dispc_free_irq(priv->dispc, dev);
 }
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 73ec99819a3d..88d2a986d880 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -70,17 +70,17 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
 			&info.paddr, &info.p_uv_addr);
 
 	/* and finally, update omapdss: */
-	ret = priv->dispc_ops->ovl_setup(priv->dispc, omap_plane->id, &info,
+	ret = dispc_ovl_setup(priv->dispc, omap_plane->id, &info,
 			      omap_crtc_timings(state->crtc), false,
 			      omap_crtc_channel(state->crtc));
 	if (ret) {
 		dev_err(plane->dev->dev, "Failed to setup plane %s\n",
 			omap_plane->name);
-		priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, false);
+		dispc_ovl_enable(priv->dispc, omap_plane->id, false);
 		return;
 	}
 
-	priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, true);
+	dispc_ovl_enable(priv->dispc, omap_plane->id, true);
 }
 
 static void omap_plane_atomic_disable(struct drm_plane *plane,
@@ -93,7 +93,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
 	plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY
 			   ? 0 : omap_plane->id;
 
-	priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, false);
+	dispc_ovl_enable(priv->dispc, omap_plane->id, false);
 }
 
 static int omap_plane_atomic_check(struct drm_plane *plane,
@@ -252,7 +252,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
 		u32 possible_crtcs)
 {
 	struct omap_drm_private *priv = dev->dev_private;
-	unsigned int num_planes = priv->dispc_ops->get_num_ovls(priv->dispc);
+	unsigned int num_planes = dispc_get_num_ovls(priv->dispc);
 	struct drm_plane *plane;
 	struct omap_plane *omap_plane;
 	enum omap_plane_id id;
@@ -271,7 +271,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
 	if (!omap_plane)
 		return ERR_PTR(-ENOMEM);
 
-	formats = priv->dispc_ops->ovl_get_color_modes(priv->dispc, id);
+	formats = dispc_ovl_get_color_modes(priv->dispc, id);
 	for (nformats = 0; formats[nformats]; ++nformats)
 		;
 	omap_plane->id = id;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 55/56] drm/omap: remove dispc_ops
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen, Sekhar Nori

dispc_ops was created to help with the multi-module architecture and
giving us the possibility of multiple dispc implementations. Neither of
these is valid anymore, and we can remove dispc_ops and use direct
calls to dispc.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/base.c    |   6 --
 drivers/gpu/drm/omapdrm/dss/dispc.c   | 101 +++++++-------------------
 drivers/gpu/drm/omapdrm/dss/dss.h     |  71 +++++++++++++++++-
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  71 ------------------
 drivers/gpu/drm/omapdrm/omap_crtc.c   |  30 ++++----
 drivers/gpu/drm/omapdrm/omap_drv.c    |  15 ++--
 drivers/gpu/drm/omapdrm/omap_drv.h    |   2 +-
 drivers/gpu/drm/omapdrm/omap_irq.c    |  34 ++++-----
 drivers/gpu/drm/omapdrm/omap_plane.c  |  12 +--
 9 files changed, 143 insertions(+), 199 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index 08c7c5024896..0aff16bf6edb 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -21,12 +21,6 @@ struct dispc_device *dispc_get_dispc(struct dss_device *dss)
 	return dss->dispc;
 }
 
-const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
-{
-	return dss->dispc_ops;
-}
-
-
 /* -----------------------------------------------------------------------------
  * OMAP DSS Devices Handling
  */
diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 48593932bddf..509bac99cb57 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -351,8 +351,6 @@ static unsigned long dispc_plane_pclk_rate(struct dispc_device *dispc,
 static unsigned long dispc_plane_lclk_rate(struct dispc_device *dispc,
 					   enum omap_plane_id plane);
 
-static void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask);
-
 static inline void dispc_write_reg(struct dispc_device *dispc, u16 idx, u32 val)
 {
 	__raw_writel(val, dispc->base + idx);
@@ -379,12 +377,12 @@ static void mgr_fld_write(struct dispc_device *dispc, enum omap_channel channel,
 	REG_FLD_MOD(dispc, rfld->reg, val, rfld->high, rfld->low);
 }
 
-static int dispc_get_num_ovls(struct dispc_device *dispc)
+int dispc_get_num_ovls(struct dispc_device *dispc)
 {
 	return dispc->feat->num_ovls;
 }
 
-static int dispc_get_num_mgrs(struct dispc_device *dispc)
+int dispc_get_num_mgrs(struct dispc_device *dispc)
 {
 	return dispc->feat->num_mgrs;
 }
@@ -667,13 +665,13 @@ void dispc_runtime_put(struct dispc_device *dispc)
 	WARN_ON(r < 0 && r != -ENOSYS);
 }
 
-static u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
+u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
 				   enum omap_channel channel)
 {
 	return mgr_desc[channel].vsync_irq;
 }
 
-static u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
+u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
 				       enum omap_channel channel)
 {
 	if (channel == OMAP_DSS_CHANNEL_DIGIT && dispc->feat->no_framedone_tv)
@@ -682,18 +680,18 @@ static u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
 	return mgr_desc[channel].framedone_irq;
 }
 
-static u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
+u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
 				       enum omap_channel channel)
 {
 	return mgr_desc[channel].sync_lost_irq;
 }
 
-static u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
+u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
 {
 	return DISPC_IRQ_FRAMEDONEWB;
 }
 
-static void dispc_mgr_enable(struct dispc_device *dispc,
+void dispc_mgr_enable(struct dispc_device *dispc,
 			     enum omap_channel channel, bool enable)
 {
 	mgr_fld_write(dispc, channel, DISPC_MGR_FLD_ENABLE, enable);
@@ -707,13 +705,13 @@ static bool dispc_mgr_is_enabled(struct dispc_device *dispc,
 	return !!mgr_fld_read(dispc, channel, DISPC_MGR_FLD_ENABLE);
 }
 
-static bool dispc_mgr_go_busy(struct dispc_device *dispc,
+bool dispc_mgr_go_busy(struct dispc_device *dispc,
 			      enum omap_channel channel)
 {
 	return mgr_fld_read(dispc, channel, DISPC_MGR_FLD_GO) == 1;
 }
 
-static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
+void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
 {
 	WARN_ON(!dispc_mgr_is_enabled(dispc, channel));
 	WARN_ON(dispc_mgr_go_busy(dispc, channel));
@@ -723,12 +721,12 @@ static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
 	mgr_fld_write(dispc, channel, DISPC_MGR_FLD_GO, 1);
 }
 
-static bool dispc_wb_go_busy(struct dispc_device *dispc)
+bool dispc_wb_go_busy(struct dispc_device *dispc)
 {
 	return REG_GET(dispc, DISPC_CONTROL2, 6, 6) == 1;
 }
 
-static void dispc_wb_go(struct dispc_device *dispc)
+void dispc_wb_go(struct dispc_device *dispc)
 {
 	enum omap_plane_id plane = OMAP_DSS_WB;
 	bool enable, go;
@@ -1282,7 +1280,7 @@ static bool dispc_ovl_color_mode_supported(struct dispc_device *dispc,
 	return false;
 }
 
-static const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc,
+const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc,
 					    enum omap_plane_id plane)
 {
 	return dispc->feat->supported_color_modes[plane];
@@ -2761,7 +2759,7 @@ static int dispc_ovl_setup_common(struct dispc_device *dispc,
 	return 0;
 }
 
-static int dispc_ovl_setup(struct dispc_device *dispc,
+int dispc_ovl_setup(struct dispc_device *dispc,
 			   enum omap_plane_id plane,
 			   const struct omap_overlay_info *oi,
 			   const struct videomode *vm, bool mem_to_mem,
@@ -2788,7 +2786,7 @@ static int dispc_ovl_setup(struct dispc_device *dispc,
 	return r;
 }
 
-static int dispc_wb_setup(struct dispc_device *dispc,
+int dispc_wb_setup(struct dispc_device *dispc,
 		   const struct omap_dss_writeback_info *wi,
 		   bool mem_to_mem, const struct videomode *vm,
 		   enum dss_writeback_channel channel_in)
@@ -2871,12 +2869,12 @@ static int dispc_wb_setup(struct dispc_device *dispc,
 	return 0;
 }
 
-static bool dispc_has_writeback(struct dispc_device *dispc)
+bool dispc_has_writeback(struct dispc_device *dispc)
 {
 	return dispc->feat->has_writeback;
 }
 
-static int dispc_ovl_enable(struct dispc_device *dispc,
+int dispc_ovl_enable(struct dispc_device *dispc,
 			    enum omap_plane_id plane, bool enable)
 {
 	DSSDBG("dispc_enable_plane %d, %d\n", plane, enable);
@@ -2967,7 +2965,7 @@ static void dispc_mgr_enable_alpha_fixed_zorder(struct dispc_device *dispc,
 		REG_FLD_MOD(dispc, DISPC_CONFIG, enable, 19, 19);
 }
 
-static void dispc_mgr_setup(struct dispc_device *dispc,
+void dispc_mgr_setup(struct dispc_device *dispc,
 			    enum omap_channel channel,
 			    const struct omap_overlay_manager_info *info)
 {
@@ -3046,7 +3044,7 @@ static void dispc_mgr_enable_stallmode(struct dispc_device *dispc,
 	mgr_fld_write(dispc, channel, DISPC_MGR_FLD_STALLMODE, enable);
 }
 
-static void dispc_mgr_set_lcd_config(struct dispc_device *dispc,
+void dispc_mgr_set_lcd_config(struct dispc_device *dispc,
 				     enum omap_channel channel,
 				     const struct dss_lcd_mgr_config *config)
 {
@@ -3095,7 +3093,7 @@ static bool _dispc_mgr_pclk_ok(struct dispc_device *dispc,
 		return pclk <= dispc->feat->max_tv_pclk;
 }
 
-static int dispc_mgr_check_timings(struct dispc_device *dispc,
+int dispc_mgr_check_timings(struct dispc_device *dispc,
 				   enum omap_channel channel,
 				   const struct videomode *vm)
 {
@@ -3188,7 +3186,7 @@ static int vm_flag_to_int(enum display_flags flags, enum display_flags high,
 }
 
 /* change name to mode? */
-static void dispc_mgr_set_timings(struct dispc_device *dispc,
+void dispc_mgr_set_timings(struct dispc_device *dispc,
 				  enum omap_channel channel,
 				  const struct videomode *vm)
 {
@@ -3732,17 +3730,17 @@ int dispc_mgr_get_clock_div(struct dispc_device *dispc,
 	return 0;
 }
 
-static u32 dispc_read_irqstatus(struct dispc_device *dispc)
+u32 dispc_read_irqstatus(struct dispc_device *dispc)
 {
 	return dispc_read_reg(dispc, DISPC_IRQSTATUS);
 }
 
-static void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask)
+void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask)
 {
 	dispc_write_reg(dispc, DISPC_IRQSTATUS, mask);
 }
 
-static void dispc_write_irqenable(struct dispc_device *dispc, u32 mask)
+void dispc_write_irqenable(struct dispc_device *dispc, u32 mask)
 {
 	u32 old_mask = dispc_read_reg(dispc, DISPC_IRQENABLE);
 
@@ -3766,7 +3764,7 @@ void dispc_disable_sidle(struct dispc_device *dispc)
 	REG_FLD_MOD(dispc, DISPC_SYSCONFIG, 1, 4, 3);	/* SIDLEMODE: no idle */
 }
 
-static u32 dispc_mgr_gamma_size(struct dispc_device *dispc,
+u32 dispc_mgr_gamma_size(struct dispc_device *dispc,
 				enum omap_channel channel)
 {
 	const struct dispc_gamma_desc *gdesc = &mgr_desc[channel].gamma;
@@ -3821,7 +3819,7 @@ static const struct drm_color_lut dispc_mgr_gamma_default_lut[] = {
 	{ .red = U16_MAX, .green = U16_MAX, .blue = U16_MAX, },
 };
 
-static void dispc_mgr_set_gamma(struct dispc_device *dispc,
+void dispc_mgr_set_gamma(struct dispc_device *dispc,
 				enum omap_channel channel,
 				const struct drm_color_lut *lut,
 				unsigned int length)
@@ -4479,7 +4477,7 @@ static irqreturn_t dispc_irq_handler(int irq, void *arg)
 	return dispc->user_handler(irq, dispc->user_data);
 }
 
-static int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
+int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
 			     void *dev_id)
 {
 	int r;
@@ -4503,7 +4501,7 @@ static int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
 	return r;
 }
 
-static void dispc_free_irq(struct dispc_device *dispc, void *dev_id)
+void dispc_free_irq(struct dispc_device *dispc, void *dev_id)
 {
 	devm_free_irq(&dispc->pdev->dev, dispc->irq, dispc);
 
@@ -4511,7 +4509,7 @@ static void dispc_free_irq(struct dispc_device *dispc, void *dev_id)
 	dispc->user_data = NULL;
 }
 
-static u32 dispc_get_memory_bandwidth_limit(struct dispc_device *dispc)
+u32 dispc_get_memory_bandwidth_limit(struct dispc_device *dispc)
 {
 	u32 limit = 0;
 
@@ -4681,47 +4679,6 @@ static void dispc_errata_i734_wa(struct dispc_device *dispc)
 	REG_FLD_MOD(dispc, DISPC_CONFIG, gatestate, 8, 4);
 }
 
-static const struct dispc_ops dispc_ops = {
-	.read_irqstatus = dispc_read_irqstatus,
-	.clear_irqstatus = dispc_clear_irqstatus,
-	.write_irqenable = dispc_write_irqenable,
-
-	.request_irq = dispc_request_irq,
-	.free_irq = dispc_free_irq,
-
-	.runtime_get = dispc_runtime_get,
-	.runtime_put = dispc_runtime_put,
-
-	.get_num_ovls = dispc_get_num_ovls,
-	.get_num_mgrs = dispc_get_num_mgrs,
-
-	.get_memory_bandwidth_limit = dispc_get_memory_bandwidth_limit,
-
-	.mgr_enable = dispc_mgr_enable,
-	.mgr_is_enabled = dispc_mgr_is_enabled,
-	.mgr_get_vsync_irq = dispc_mgr_get_vsync_irq,
-	.mgr_get_framedone_irq = dispc_mgr_get_framedone_irq,
-	.mgr_get_sync_lost_irq = dispc_mgr_get_sync_lost_irq,
-	.mgr_go_busy = dispc_mgr_go_busy,
-	.mgr_go = dispc_mgr_go,
-	.mgr_set_lcd_config = dispc_mgr_set_lcd_config,
-	.mgr_check_timings = dispc_mgr_check_timings,
-	.mgr_set_timings = dispc_mgr_set_timings,
-	.mgr_setup = dispc_mgr_setup,
-	.mgr_gamma_size = dispc_mgr_gamma_size,
-	.mgr_set_gamma = dispc_mgr_set_gamma,
-
-	.ovl_enable = dispc_ovl_enable,
-	.ovl_setup = dispc_ovl_setup,
-	.ovl_get_color_modes = dispc_ovl_get_color_modes,
-
-	.wb_get_framedone_irq = dispc_wb_get_framedone_irq,
-	.wb_setup = dispc_wb_setup,
-	.has_writeback = dispc_has_writeback,
-	.wb_go_busy = dispc_wb_go_busy,
-	.wb_go = dispc_wb_go,
-};
-
 /* DISPC HW IP initialisation */
 static const struct of_device_id dispc_of_match[] = {
 	{ .compatible = "ti,omap2-dispc", .data = &omap24xx_dispc_feats },
@@ -4823,7 +4780,6 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
 	dispc_runtime_put(dispc);
 
 	dss->dispc = dispc;
-	dss->dispc_ops = &dispc_ops;
 
 	dispc->debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs,
 						 dispc);
@@ -4845,7 +4801,6 @@ static void dispc_unbind(struct device *dev, struct device *master, void *data)
 	dss_debugfs_remove_file(dispc->debugfs);
 
 	dss->dispc = NULL;
-	dss->dispc_ops = NULL;
 
 	pm_runtime_disable(dev);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
index 2b404bcb41dd..96f702314c8c 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss.h
@@ -257,7 +257,6 @@ struct dss_device {
 	struct dss_pll	*video2_pll;
 
 	struct dispc_device *dispc;
-	const struct dispc_ops *dispc_ops;
 	const struct dss_mgr_ops *mgr_ops;
 	struct omap_drm_private *mgr_ops_priv;
 };
@@ -393,6 +392,76 @@ void dispc_dump_clocks(struct dispc_device *dispc, struct seq_file *s);
 int dispc_runtime_get(struct dispc_device *dispc);
 void dispc_runtime_put(struct dispc_device *dispc);
 
+int dispc_get_num_ovls(struct dispc_device *dispc);
+int dispc_get_num_mgrs(struct dispc_device *dispc);
+
+const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc,
+					    enum omap_plane_id plane);
+
+u32 dispc_read_irqstatus(struct dispc_device *dispc);
+void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask);
+void dispc_write_irqenable(struct dispc_device *dispc, u32 mask);
+
+int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
+			     void *dev_id);
+void dispc_free_irq(struct dispc_device *dispc, void *dev_id);
+
+u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
+				   enum omap_channel channel);
+u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
+				       enum omap_channel channel);
+u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
+				       enum omap_channel channel);
+u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc);
+
+u32 dispc_get_memory_bandwidth_limit(struct dispc_device *dispc);
+
+void dispc_mgr_enable(struct dispc_device *dispc,
+			     enum omap_channel channel, bool enable);
+
+bool dispc_mgr_go_busy(struct dispc_device *dispc,
+			      enum omap_channel channel);
+
+void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel);
+
+void dispc_mgr_set_lcd_config(struct dispc_device *dispc,
+				     enum omap_channel channel,
+				     const struct dss_lcd_mgr_config *config);
+void dispc_mgr_set_timings(struct dispc_device *dispc,
+				  enum omap_channel channel,
+				  const struct videomode *vm);
+void dispc_mgr_setup(struct dispc_device *dispc,
+			    enum omap_channel channel,
+			    const struct omap_overlay_manager_info *info);
+
+int dispc_mgr_check_timings(struct dispc_device *dispc,
+				   enum omap_channel channel,
+				   const struct videomode *vm);
+
+u32 dispc_mgr_gamma_size(struct dispc_device *dispc,
+				enum omap_channel channel);
+void dispc_mgr_set_gamma(struct dispc_device *dispc,
+				enum omap_channel channel,
+				const struct drm_color_lut *lut,
+				unsigned int length);
+
+int dispc_ovl_setup(struct dispc_device *dispc,
+			   enum omap_plane_id plane,
+			   const struct omap_overlay_info *oi,
+			   const struct videomode *vm, bool mem_to_mem,
+			   enum omap_channel channel);
+
+int dispc_ovl_enable(struct dispc_device *dispc,
+			    enum omap_plane_id plane, bool enable);
+
+bool dispc_has_writeback(struct dispc_device *dispc);
+int dispc_wb_setup(struct dispc_device *dispc,
+		   const struct omap_dss_writeback_info *wi,
+		   bool mem_to_mem, const struct videomode *vm,
+		   enum dss_writeback_channel channel_in);
+bool dispc_wb_go_busy(struct dispc_device *dispc);
+void dispc_wb_go(struct dispc_device *dispc);
+
 void dispc_enable_sidle(struct dispc_device *dispc);
 void dispc_disable_sidle(struct dispc_device *dispc);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 4442e49ffc5c..fba5f05e5e48 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -376,78 +376,7 @@ int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
 void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
 		void (*handler)(void *), void *data);
 
-/* dispc ops */
-
-struct dispc_ops {
-	u32 (*read_irqstatus)(struct dispc_device *dispc);
-	void (*clear_irqstatus)(struct dispc_device *dispc, u32 mask);
-	void (*write_irqenable)(struct dispc_device *dispc, u32 mask);
-
-	int (*request_irq)(struct dispc_device *dispc, irq_handler_t handler,
-			   void *dev_id);
-	void (*free_irq)(struct dispc_device *dispc, void *dev_id);
-
-	int (*runtime_get)(struct dispc_device *dispc);
-	void (*runtime_put)(struct dispc_device *dispc);
-
-	int (*get_num_ovls)(struct dispc_device *dispc);
-	int (*get_num_mgrs)(struct dispc_device *dispc);
-
-	u32 (*get_memory_bandwidth_limit)(struct dispc_device *dispc);
-
-	void (*mgr_enable)(struct dispc_device *dispc,
-			   enum omap_channel channel, bool enable);
-	bool (*mgr_is_enabled)(struct dispc_device *dispc,
-			       enum omap_channel channel);
-	u32 (*mgr_get_vsync_irq)(struct dispc_device *dispc,
-				 enum omap_channel channel);
-	u32 (*mgr_get_framedone_irq)(struct dispc_device *dispc,
-				     enum omap_channel channel);
-	u32 (*mgr_get_sync_lost_irq)(struct dispc_device *dispc,
-				     enum omap_channel channel);
-	bool (*mgr_go_busy)(struct dispc_device *dispc,
-			    enum omap_channel channel);
-	void (*mgr_go)(struct dispc_device *dispc, enum omap_channel channel);
-	void (*mgr_set_lcd_config)(struct dispc_device *dispc,
-				   enum omap_channel channel,
-				   const struct dss_lcd_mgr_config *config);
-	int (*mgr_check_timings)(struct dispc_device *dispc,
-				 enum omap_channel channel,
-				 const struct videomode *vm);
-	void (*mgr_set_timings)(struct dispc_device *dispc,
-				enum omap_channel channel,
-				const struct videomode *vm);
-	void (*mgr_setup)(struct dispc_device *dispc, enum omap_channel channel,
-			  const struct omap_overlay_manager_info *info);
-	u32 (*mgr_gamma_size)(struct dispc_device *dispc,
-			      enum omap_channel channel);
-	void (*mgr_set_gamma)(struct dispc_device *dispc,
-			      enum omap_channel channel,
-			      const struct drm_color_lut *lut,
-			      unsigned int length);
-
-	int (*ovl_enable)(struct dispc_device *dispc, enum omap_plane_id plane,
-			  bool enable);
-	int (*ovl_setup)(struct dispc_device *dispc, enum omap_plane_id plane,
-			 const struct omap_overlay_info *oi,
-			 const struct videomode *vm, bool mem_to_mem,
-			 enum omap_channel channel);
-
-	const u32 *(*ovl_get_color_modes)(struct dispc_device *dispc,
-					  enum omap_plane_id plane);
-
-	u32 (*wb_get_framedone_irq)(struct dispc_device *dispc);
-	int (*wb_setup)(struct dispc_device *dispc,
-		const struct omap_dss_writeback_info *wi,
-		bool mem_to_mem, const struct videomode *vm,
-		enum dss_writeback_channel channel_in);
-	bool (*has_writeback)(struct dispc_device *dispc);
-	bool (*wb_go_busy)(struct dispc_device *dispc);
-	void (*wb_go)(struct dispc_device *dispc);
-};
-
 struct dispc_device *dispc_get_dispc(struct dss_device *dss);
-const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
 
 bool omapdss_stack_is_ready(void);
 void omapdss_gather_components(struct device *dev);
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 5ab557c477ef..0bf5cef579b5 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -103,7 +103,7 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc)
 static void omap_crtc_dss_start_update(struct omap_drm_private *priv,
 				       enum omap_channel channel)
 {
-	priv->dispc_ops->mgr_enable(priv->dispc, channel, true);
+	dispc_mgr_enable(priv->dispc, channel, true);
 }
 
 /* Called only from the encoder enable/disable and suspend/resume handlers. */
@@ -128,7 +128,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 	}
 
 	if (omap_crtc->pipe->output->type == OMAP_DISPLAY_TYPE_HDMI) {
-		priv->dispc_ops->mgr_enable(priv->dispc, channel, enable);
+		dispc_mgr_enable(priv->dispc, channel, enable);
 		omap_crtc->enabled = enable;
 		return;
 	}
@@ -141,9 +141,9 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 		omap_crtc->ignore_digit_sync_lost = true;
 	}
 
-	framedone_irq = priv->dispc_ops->mgr_get_framedone_irq(priv->dispc,
+	framedone_irq = dispc_mgr_get_framedone_irq(priv->dispc,
 							       channel);
-	vsync_irq = priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel);
+	vsync_irq = dispc_mgr_get_vsync_irq(priv->dispc, channel);
 
 	if (enable) {
 		wait = omap_irq_wait_init(dev, vsync_irq, 1);
@@ -163,7 +163,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 			wait = omap_irq_wait_init(dev, vsync_irq, 2);
 	}
 
-	priv->dispc_ops->mgr_enable(priv->dispc, channel, enable);
+	dispc_mgr_enable(priv->dispc, channel, enable);
 	omap_crtc->enabled = enable;
 
 	ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100));
@@ -186,7 +186,7 @@ static int omap_crtc_dss_enable(struct omap_drm_private *priv,
 	struct drm_crtc *crtc = priv->channels[channel]->crtc;
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
 
-	priv->dispc_ops->mgr_set_timings(priv->dispc, omap_crtc->channel,
+	dispc_mgr_set_timings(priv->dispc, omap_crtc->channel,
 					 &omap_crtc->vm);
 	omap_crtc_set_enabled(&omap_crtc->base, true);
 
@@ -221,7 +221,7 @@ static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
 
 	DBG("%s", omap_crtc->name);
-	priv->dispc_ops->mgr_set_lcd_config(priv->dispc, omap_crtc->channel,
+	dispc_mgr_set_lcd_config(priv->dispc, omap_crtc->channel,
 					    config);
 }
 
@@ -300,7 +300,7 @@ void omap_crtc_vblank_irq(struct drm_crtc *crtc)
 	 * If the dispc is busy we're racing the flush operation. Try again on
 	 * the next vblank interrupt.
 	 */
-	if (priv->dispc_ops->mgr_go_busy(priv->dispc, omap_crtc->channel)) {
+	if (dispc_mgr_go_busy(priv->dispc, omap_crtc->channel)) {
 		spin_unlock(&crtc->dev->event_lock);
 		return;
 	}
@@ -391,7 +391,7 @@ static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc)
 	info.partial_alpha_enabled = false;
 	info.cpr_enable = false;
 
-	priv->dispc_ops->mgr_setup(priv->dispc, omap_crtc->channel, &info);
+	dispc_mgr_setup(priv->dispc, omap_crtc->channel, &info);
 }
 
 /* -----------------------------------------------------------------------------
@@ -432,7 +432,7 @@ static void omap_crtc_atomic_enable(struct drm_crtc *crtc,
 
 	DBG("%s", omap_crtc->name);
 
-	priv->dispc_ops->runtime_get(priv->dispc);
+	dispc_runtime_get(priv->dispc);
 
 	/* manual updated display will not trigger vsync irq */
 	if (omap_state->manually_updated)
@@ -471,7 +471,7 @@ static void omap_crtc_atomic_disable(struct drm_crtc *crtc,
 
 	drm_crtc_vblank_off(crtc);
 
-	priv->dispc_ops->runtime_put(priv->dispc);
+	dispc_runtime_put(priv->dispc);
 }
 
 static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
@@ -490,7 +490,7 @@ static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
 	 * proper DISPC mode later.
 	 */
 	if (omap_crtc->pipe->output->type != OMAP_DISPLAY_TYPE_DSI) {
-		r = priv->dispc_ops->mgr_check_timings(priv->dispc,
+		r = dispc_mgr_check_timings(priv->dispc,
 						       omap_crtc->channel,
 						       &vm);
 		if (r)
@@ -605,7 +605,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
 			length = crtc->state->gamma_lut->length /
 				sizeof(*lut);
 		}
-		priv->dispc_ops->mgr_set_gamma(priv->dispc, omap_crtc->channel,
+		dispc_mgr_set_gamma(priv->dispc, omap_crtc->channel,
 					       lut, length);
 	}
 
@@ -630,7 +630,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
 	WARN_ON(ret != 0);
 
 	spin_lock_irq(&crtc->dev->event_lock);
-	priv->dispc_ops->mgr_go(priv->dispc, omap_crtc->channel);
+	dispc_mgr_go(priv->dispc, omap_crtc->channel);
 	omap_crtc_arm_event(crtc);
 	spin_unlock_irq(&crtc->dev->event_lock);
 }
@@ -821,7 +821,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
 	 * extracted with dispc_mgr_gamma_size(). If it returns 0
 	 * gamma table is not supported.
 	 */
-	if (priv->dispc_ops->mgr_gamma_size(priv->dispc, channel)) {
+	if (dispc_mgr_gamma_size(priv->dispc, channel)) {
 		unsigned int gamma_lut_size = 256;
 
 		drm_crtc_enable_color_mgmt(crtc, 0, false, gamma_lut_size);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 9d5f53e774ef..eb419387ed05 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -69,7 +69,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)
 	struct drm_device *dev = old_state->dev;
 	struct omap_drm_private *priv = dev->dev_private;
 
-	priv->dispc_ops->runtime_get(priv->dispc);
+	dispc_runtime_get(priv->dispc);
 
 	/* Apply the atomic update. */
 	drm_atomic_helper_commit_modeset_disables(dev, old_state);
@@ -113,7 +113,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)
 
 	drm_atomic_helper_cleanup_planes(dev, old_state);
 
-	priv->dispc_ops->runtime_put(priv->dispc);
+	dispc_runtime_put(priv->dispc);
 }
 
 static const struct drm_mode_config_helper_funcs omap_mode_config_helper_funcs = {
@@ -192,7 +192,7 @@ static int omap_compare_pipelines(const void *a, const void *b)
 static int omap_modeset_init_properties(struct drm_device *dev)
 {
 	struct omap_drm_private *priv = dev->dev_private;
-	unsigned int num_planes = priv->dispc_ops->get_num_ovls(priv->dispc);
+	unsigned int num_planes = dispc_get_num_ovls(priv->dispc);
 
 	priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0,
 						      num_planes - 1);
@@ -221,8 +221,8 @@ static int omap_display_id(struct omap_dss_device *output)
 static int omap_modeset_init(struct drm_device *dev)
 {
 	struct omap_drm_private *priv = dev->dev_private;
-	int num_ovls = priv->dispc_ops->get_num_ovls(priv->dispc);
-	int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc);
+	int num_ovls = dispc_get_num_ovls(priv->dispc);
+	int num_mgrs = dispc_get_num_mgrs(priv->dispc);
 	unsigned int i;
 	int ret;
 	u32 plane_crtc_mask;
@@ -580,7 +580,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 	priv->dev = dev;
 	priv->dss = pdata->dss;
 	priv->dispc = dispc_get_dispc(priv->dss);
-	priv->dispc_ops = dispc_get_ops(priv->dss);
 
 	omap_crtc_pre_init(priv);
 
@@ -592,9 +591,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 	INIT_LIST_HEAD(&priv->obj_list);
 
 	/* Get memory bandwidth limits */
-	if (priv->dispc_ops->get_memory_bandwidth_limit)
-		priv->max_bandwidth =
-			priv->dispc_ops->get_memory_bandwidth_limit(priv->dispc);
+	priv->max_bandwidth = dispc_get_memory_bandwidth_limit(priv->dispc);
 
 	omap_gem_init(ddev);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index 93d171ffd26d..6e69358f624c 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -12,6 +12,7 @@
 #include <linux/workqueue.h>
 
 #include "dss/omapdss.h"
+#include "dss/dss.h"
 
 #include <drm/drm_gem.h>
 #include <drm/omap_drm.h>
@@ -46,7 +47,6 @@ struct omap_drm_private {
 
 	struct dss_device *dss;
 	struct dispc_device *dispc;
-	const struct dispc_ops *dispc_ops;
 
 	unsigned int num_pipes;
 	struct omap_drm_pipeline pipes[8];
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c
index 382bcdc72ac0..981387220765 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -29,7 +29,7 @@ static void omap_irq_update(struct drm_device *dev)
 
 	DBG("irqmask=%08x", irqmask);
 
-	priv->dispc_ops->write_irqenable(priv->dispc, irqmask);
+	dispc_write_irqenable(priv->dispc, irqmask);
 }
 
 static void omap_irq_wait_handler(struct omap_irq_wait *wait)
@@ -83,7 +83,7 @@ int omap_irq_enable_framedone(struct drm_crtc *crtc, bool enable)
 	unsigned long flags;
 	enum omap_channel channel = omap_crtc_channel(crtc);
 	int framedone_irq =
-		priv->dispc_ops->mgr_get_framedone_irq(priv->dispc, channel);
+		dispc_mgr_get_framedone_irq(priv->dispc, channel);
 
 	DBG("dev=%p, crtc=%u, enable=%d", dev, channel, enable);
 
@@ -121,7 +121,7 @@ int omap_irq_enable_vblank(struct drm_crtc *crtc)
 	DBG("dev=%p, crtc=%u", dev, channel);
 
 	spin_lock_irqsave(&priv->wait_lock, flags);
-	priv->irq_mask |= priv->dispc_ops->mgr_get_vsync_irq(priv->dispc,
+	priv->irq_mask |= dispc_mgr_get_vsync_irq(priv->dispc,
 							     channel);
 	omap_irq_update(dev);
 	spin_unlock_irqrestore(&priv->wait_lock, flags);
@@ -148,7 +148,7 @@ void omap_irq_disable_vblank(struct drm_crtc *crtc)
 	DBG("dev=%p, crtc=%u", dev, channel);
 
 	spin_lock_irqsave(&priv->wait_lock, flags);
-	priv->irq_mask &= ~priv->dispc_ops->mgr_get_vsync_irq(priv->dispc,
+	priv->irq_mask &= ~dispc_mgr_get_vsync_irq(priv->dispc,
 							      channel);
 	omap_irq_update(dev);
 	spin_unlock_irqrestore(&priv->wait_lock, flags);
@@ -213,9 +213,9 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
 	unsigned int id;
 	u32 irqstatus;
 
-	irqstatus = priv->dispc_ops->read_irqstatus(priv->dispc);
-	priv->dispc_ops->clear_irqstatus(priv->dispc, irqstatus);
-	priv->dispc_ops->read_irqstatus(priv->dispc);	/* flush posted write */
+	irqstatus = dispc_read_irqstatus(priv->dispc);
+	dispc_clear_irqstatus(priv->dispc, irqstatus);
+	dispc_read_irqstatus(priv->dispc);	/* flush posted write */
 
 	VERB("irqs: %08x", irqstatus);
 
@@ -223,15 +223,15 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
 		struct drm_crtc *crtc = priv->pipes[id].crtc;
 		enum omap_channel channel = omap_crtc_channel(crtc);
 
-		if (irqstatus & priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel)) {
+		if (irqstatus & dispc_mgr_get_vsync_irq(priv->dispc, channel)) {
 			drm_handle_vblank(dev, id);
 			omap_crtc_vblank_irq(crtc);
 		}
 
-		if (irqstatus & priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, channel))
+		if (irqstatus & dispc_mgr_get_sync_lost_irq(priv->dispc, channel))
 			omap_crtc_error_irq(crtc, irqstatus);
 
-		if (irqstatus & priv->dispc_ops->mgr_get_framedone_irq(priv->dispc, channel))
+		if (irqstatus & dispc_mgr_get_framedone_irq(priv->dispc, channel))
 			omap_crtc_framedone_irq(crtc, irqstatus);
 	}
 
@@ -265,7 +265,7 @@ static const u32 omap_underflow_irqs[] = {
 int omap_drm_irq_install(struct drm_device *dev)
 {
 	struct omap_drm_private *priv = dev->dev_private;
-	unsigned int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc);
+	unsigned int num_mgrs = dispc_get_num_mgrs(priv->dispc);
 	unsigned int max_planes;
 	unsigned int i;
 	int ret;
@@ -283,13 +283,13 @@ int omap_drm_irq_install(struct drm_device *dev)
 	}
 
 	for (i = 0; i < num_mgrs; ++i)
-		priv->irq_mask |= priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, i);
+		priv->irq_mask |= dispc_mgr_get_sync_lost_irq(priv->dispc, i);
 
-	priv->dispc_ops->runtime_get(priv->dispc);
-	priv->dispc_ops->clear_irqstatus(priv->dispc, 0xffffffff);
-	priv->dispc_ops->runtime_put(priv->dispc);
+	dispc_runtime_get(priv->dispc);
+	dispc_clear_irqstatus(priv->dispc, 0xffffffff);
+	dispc_runtime_put(priv->dispc);
 
-	ret = priv->dispc_ops->request_irq(priv->dispc, omap_irq_handler, dev);
+	ret = dispc_request_irq(priv->dispc, omap_irq_handler, dev);
 	if (ret < 0)
 		return ret;
 
@@ -307,5 +307,5 @@ void omap_drm_irq_uninstall(struct drm_device *dev)
 
 	dev->irq_enabled = false;
 
-	priv->dispc_ops->free_irq(priv->dispc, dev);
+	dispc_free_irq(priv->dispc, dev);
 }
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 73ec99819a3d..88d2a986d880 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -70,17 +70,17 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
 			&info.paddr, &info.p_uv_addr);
 
 	/* and finally, update omapdss: */
-	ret = priv->dispc_ops->ovl_setup(priv->dispc, omap_plane->id, &info,
+	ret = dispc_ovl_setup(priv->dispc, omap_plane->id, &info,
 			      omap_crtc_timings(state->crtc), false,
 			      omap_crtc_channel(state->crtc));
 	if (ret) {
 		dev_err(plane->dev->dev, "Failed to setup plane %s\n",
 			omap_plane->name);
-		priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, false);
+		dispc_ovl_enable(priv->dispc, omap_plane->id, false);
 		return;
 	}
 
-	priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, true);
+	dispc_ovl_enable(priv->dispc, omap_plane->id, true);
 }
 
 static void omap_plane_atomic_disable(struct drm_plane *plane,
@@ -93,7 +93,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
 	plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY
 			   ? 0 : omap_plane->id;
 
-	priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, false);
+	dispc_ovl_enable(priv->dispc, omap_plane->id, false);
 }
 
 static int omap_plane_atomic_check(struct drm_plane *plane,
@@ -252,7 +252,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
 		u32 possible_crtcs)
 {
 	struct omap_drm_private *priv = dev->dev_private;
-	unsigned int num_planes = priv->dispc_ops->get_num_ovls(priv->dispc);
+	unsigned int num_planes = dispc_get_num_ovls(priv->dispc);
 	struct drm_plane *plane;
 	struct omap_plane *omap_plane;
 	enum omap_plane_id id;
@@ -271,7 +271,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
 	if (!omap_plane)
 		return ERR_PTR(-ENOMEM);
 
-	formats = priv->dispc_ops->ovl_get_color_modes(priv->dispc, id);
+	formats = dispc_ovl_get_color_modes(priv->dispc, id);
 	for (nformats = 0; formats[nformats]; ++nformats)
 		;
 	omap_plane->id = id;
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 56/56] drm/omap: remove dss_mgr_ops
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 12:03   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen

dss_mgr_ops was needed with the multi-module architecture, but is no
longer needed. We can thus remove it and use direct calls.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dss.h     |  1 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 42 +++++++++++----------------
 drivers/gpu/drm/omapdrm/dss/output.c  | 33 +++++----------------
 drivers/gpu/drm/omapdrm/omap_crtc.c   | 38 +++++-------------------
 drivers/gpu/drm/omapdrm/omap_crtc.h   |  2 --
 drivers/gpu/drm/omapdrm/omap_drv.c    |  4 +--
 6 files changed, 33 insertions(+), 87 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
index 96f702314c8c..a547527bb2f3 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss.h
@@ -257,7 +257,6 @@ struct dss_device {
 	struct dss_pll	*video2_pll;
 
 	struct dispc_device *dispc;
-	const struct dss_mgr_ops *mgr_ops;
 	struct omap_drm_private *mgr_ops_priv;
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index fba5f05e5e48..9df322ca467d 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -338,31 +338,23 @@ enum dss_writeback_channel {
 	DSS_WB_LCD3_MGR =	7,
 };
 
-struct dss_mgr_ops {
-	void (*start_update)(struct omap_drm_private *priv,
-			     enum omap_channel channel);
-	int (*enable)(struct omap_drm_private *priv,
-		      enum omap_channel channel);
-	void (*disable)(struct omap_drm_private *priv,
-			enum omap_channel channel);
-	void (*set_timings)(struct omap_drm_private *priv,
-			    enum omap_channel channel,
-			    const struct videomode *vm);
-	void (*set_lcd_config)(struct omap_drm_private *priv,
-			       enum omap_channel channel,
-			       const struct dss_lcd_mgr_config *config);
-	int (*register_framedone_handler)(struct omap_drm_private *priv,
-			enum omap_channel channel,
-			void (*handler)(void *), void *data);
-	void (*unregister_framedone_handler)(struct omap_drm_private *priv,
-			enum omap_channel channel,
-			void (*handler)(void *), void *data);
-};
-
-int dss_install_mgr_ops(struct dss_device *dss,
-			const struct dss_mgr_ops *mgr_ops,
-			struct omap_drm_private *priv);
-void dss_uninstall_mgr_ops(struct dss_device *dss);
+void omap_crtc_dss_start_update(struct omap_drm_private *priv,
+				       enum omap_channel channel);
+void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable);
+int omap_crtc_dss_enable(struct omap_drm_private *priv, enum omap_channel channel);
+void omap_crtc_dss_disable(struct omap_drm_private *priv, enum omap_channel channel);
+void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
+		enum omap_channel channel,
+		const struct videomode *vm);
+void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
+		enum omap_channel channel,
+		const struct dss_lcd_mgr_config *config);
+int omap_crtc_dss_register_framedone(
+		struct omap_drm_private *priv, enum omap_channel channel,
+		void (*handler)(void *), void *data);
+void omap_crtc_dss_unregister_framedone(
+		struct omap_drm_private *priv, enum omap_channel channel,
+		void (*handler)(void *), void *data);
 
 void dss_mgr_set_timings(struct omap_dss_device *dssdev,
 		const struct videomode *vm);
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
index 7a14d2b5b2f7..2121c947947b 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -81,54 +81,35 @@ void omapdss_device_cleanup_output(struct omap_dss_device *out)
 					out->next_bridge : out->bridge);
 }
 
-int dss_install_mgr_ops(struct dss_device *dss,
-			const struct dss_mgr_ops *mgr_ops,
-			struct omap_drm_private *priv)
-{
-	if (dss->mgr_ops)
-		return -EBUSY;
-
-	dss->mgr_ops = mgr_ops;
-	dss->mgr_ops_priv = priv;
-
-	return 0;
-}
-
-void dss_uninstall_mgr_ops(struct dss_device *dss)
-{
-	dss->mgr_ops = NULL;
-	dss->mgr_ops_priv = NULL;
-}
-
 void dss_mgr_set_timings(struct omap_dss_device *dssdev,
 			 const struct videomode *vm)
 {
-	dssdev->dss->mgr_ops->set_timings(dssdev->dss->mgr_ops_priv,
+	omap_crtc_dss_set_timings(dssdev->dss->mgr_ops_priv,
 					  dssdev->dispc_channel, vm);
 }
 
 void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
 		const struct dss_lcd_mgr_config *config)
 {
-	dssdev->dss->mgr_ops->set_lcd_config(dssdev->dss->mgr_ops_priv,
+	omap_crtc_dss_set_lcd_config(dssdev->dss->mgr_ops_priv,
 					     dssdev->dispc_channel, config);
 }
 
 int dss_mgr_enable(struct omap_dss_device *dssdev)
 {
-	return dssdev->dss->mgr_ops->enable(dssdev->dss->mgr_ops_priv,
+	return omap_crtc_dss_enable(dssdev->dss->mgr_ops_priv,
 					    dssdev->dispc_channel);
 }
 
 void dss_mgr_disable(struct omap_dss_device *dssdev)
 {
-	dssdev->dss->mgr_ops->disable(dssdev->dss->mgr_ops_priv,
+	omap_crtc_dss_disable(dssdev->dss->mgr_ops_priv,
 				      dssdev->dispc_channel);
 }
 
 void dss_mgr_start_update(struct omap_dss_device *dssdev)
 {
-	dssdev->dss->mgr_ops->start_update(dssdev->dss->mgr_ops_priv,
+	omap_crtc_dss_start_update(dssdev->dss->mgr_ops_priv,
 					   dssdev->dispc_channel);
 }
 
@@ -137,7 +118,7 @@ int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
 {
 	struct dss_device *dss = dssdev->dss;
 
-	return dss->mgr_ops->register_framedone_handler(dss->mgr_ops_priv,
+	return omap_crtc_dss_register_framedone(dss->mgr_ops_priv,
 							dssdev->dispc_channel,
 							handler, data);
 }
@@ -147,7 +128,7 @@ void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
 {
 	struct dss_device *dss = dssdev->dss;
 
-	dss->mgr_ops->unregister_framedone_handler(dss->mgr_ops_priv,
+	omap_crtc_dss_unregister_framedone(dss->mgr_ops_priv,
 						   dssdev->dispc_channel,
 						   handler, data);
 }
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 0bf5cef579b5..e3259338afb9 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -100,14 +100,14 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc)
  * the upstream part of the video pipe.
  */
 
-static void omap_crtc_dss_start_update(struct omap_drm_private *priv,
+void omap_crtc_dss_start_update(struct omap_drm_private *priv,
 				       enum omap_channel channel)
 {
 	dispc_mgr_enable(priv->dispc, channel, true);
 }
 
 /* Called only from the encoder enable/disable and suspend/resume handlers. */
-static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
+void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 {
 	struct omap_crtc_state *omap_state = to_omap_crtc_state(crtc->state);
 	struct drm_device *dev = crtc->dev;
@@ -180,8 +180,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 }
 
 
-static int omap_crtc_dss_enable(struct omap_drm_private *priv,
-				enum omap_channel channel)
+int omap_crtc_dss_enable(struct omap_drm_private *priv, enum omap_channel channel)
 {
 	struct drm_crtc *crtc = priv->channels[channel]->crtc;
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
@@ -193,8 +192,7 @@ static int omap_crtc_dss_enable(struct omap_drm_private *priv,
 	return 0;
 }
 
-static void omap_crtc_dss_disable(struct omap_drm_private *priv,
-				  enum omap_channel channel)
+void omap_crtc_dss_disable(struct omap_drm_private *priv, enum omap_channel channel)
 {
 	struct drm_crtc *crtc = priv->channels[channel]->crtc;
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
@@ -202,7 +200,7 @@ static void omap_crtc_dss_disable(struct omap_drm_private *priv,
 	omap_crtc_set_enabled(&omap_crtc->base, false);
 }
 
-static void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
+void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
 		enum omap_channel channel,
 		const struct videomode *vm)
 {
@@ -213,7 +211,7 @@ static void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
 	omap_crtc->vm = *vm;
 }
 
-static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
+void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
 		enum omap_channel channel,
 		const struct dss_lcd_mgr_config *config)
 {
@@ -225,7 +223,7 @@ static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
 					    config);
 }
 
-static int omap_crtc_dss_register_framedone(
+int omap_crtc_dss_register_framedone(
 		struct omap_drm_private *priv, enum omap_channel channel,
 		void (*handler)(void *), void *data)
 {
@@ -244,7 +242,7 @@ static int omap_crtc_dss_register_framedone(
 	return 0;
 }
 
-static void omap_crtc_dss_unregister_framedone(
+void omap_crtc_dss_unregister_framedone(
 		struct omap_drm_private *priv, enum omap_channel channel,
 		void (*handler)(void *), void *data)
 {
@@ -261,16 +259,6 @@ static void omap_crtc_dss_unregister_framedone(
 	omap_crtc->framedone_handler_data = NULL;
 }
 
-static const struct dss_mgr_ops mgr_ops = {
-	.start_update = omap_crtc_dss_start_update,
-	.enable = omap_crtc_dss_enable,
-	.disable = omap_crtc_dss_disable,
-	.set_timings = omap_crtc_dss_set_timings,
-	.set_lcd_config = omap_crtc_dss_set_lcd_config,
-	.register_framedone_handler = omap_crtc_dss_register_framedone,
-	.unregister_framedone_handler = omap_crtc_dss_unregister_framedone,
-};
-
 /* -----------------------------------------------------------------------------
  * Setup, Flush and Page Flip
  */
@@ -753,16 +741,6 @@ static const char *channel_names[] = {
 	[OMAP_DSS_CHANNEL_LCD3] = "lcd3",
 };
 
-void omap_crtc_pre_init(struct omap_drm_private *priv)
-{
-	dss_install_mgr_ops(priv->dss, &mgr_ops, priv);
-}
-
-void omap_crtc_pre_uninit(struct omap_drm_private *priv)
-{
-	dss_uninstall_mgr_ops(priv->dss);
-}
-
 /* initialize crtc */
 struct drm_crtc *omap_crtc_init(struct drm_device *dev,
 				struct omap_drm_pipeline *pipe,
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.h b/drivers/gpu/drm/omapdrm/omap_crtc.h
index 2fd57751ae2b..a8b9cbee86e0 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.h
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.h
@@ -22,8 +22,6 @@ struct videomode;
 
 struct videomode *omap_crtc_timings(struct drm_crtc *crtc);
 enum omap_channel omap_crtc_channel(struct drm_crtc *crtc);
-void omap_crtc_pre_init(struct omap_drm_private *priv);
-void omap_crtc_pre_uninit(struct omap_drm_private *priv);
 struct drm_crtc *omap_crtc_init(struct drm_device *dev,
 				struct omap_drm_pipeline *pipe,
 				struct drm_plane *plane);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index eb419387ed05..c5b2f50439d6 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -581,7 +581,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 	priv->dss = pdata->dss;
 	priv->dispc = dispc_get_dispc(priv->dss);
 
-	omap_crtc_pre_init(priv);
+	priv->dss->mgr_ops_priv = priv;
 
 	soc = soc_device_match(omapdrm_soc_devices);
 	priv->omaprev = soc ? (unsigned int)soc->data : 0;
@@ -634,7 +634,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 	omap_gem_deinit(ddev);
 	destroy_workqueue(priv->wq);
 	omap_disconnect_pipelines(ddev);
-	omap_crtc_pre_uninit(priv);
 	drm_dev_put(ddev);
 	return ret;
 }
@@ -660,7 +659,6 @@ static void omapdrm_cleanup(struct omap_drm_private *priv)
 	destroy_workqueue(priv->wq);
 
 	omap_disconnect_pipelines(ddev);
-	omap_crtc_pre_uninit(priv);
 
 	drm_dev_put(ddev);
 }
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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

* [PATCH v3 56/56] drm/omap: remove dss_mgr_ops
@ 2020-11-05 12:03   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 12:03 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Tomi Valkeinen, Sekhar Nori

dss_mgr_ops was needed with the multi-module architecture, but is no
longer needed. We can thus remove it and use direct calls.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dss.h     |  1 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 42 +++++++++++----------------
 drivers/gpu/drm/omapdrm/dss/output.c  | 33 +++++----------------
 drivers/gpu/drm/omapdrm/omap_crtc.c   | 38 +++++-------------------
 drivers/gpu/drm/omapdrm/omap_crtc.h   |  2 --
 drivers/gpu/drm/omapdrm/omap_drv.c    |  4 +--
 6 files changed, 33 insertions(+), 87 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
index 96f702314c8c..a547527bb2f3 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss.h
@@ -257,7 +257,6 @@ struct dss_device {
 	struct dss_pll	*video2_pll;
 
 	struct dispc_device *dispc;
-	const struct dss_mgr_ops *mgr_ops;
 	struct omap_drm_private *mgr_ops_priv;
 };
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index fba5f05e5e48..9df322ca467d 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -338,31 +338,23 @@ enum dss_writeback_channel {
 	DSS_WB_LCD3_MGR =	7,
 };
 
-struct dss_mgr_ops {
-	void (*start_update)(struct omap_drm_private *priv,
-			     enum omap_channel channel);
-	int (*enable)(struct omap_drm_private *priv,
-		      enum omap_channel channel);
-	void (*disable)(struct omap_drm_private *priv,
-			enum omap_channel channel);
-	void (*set_timings)(struct omap_drm_private *priv,
-			    enum omap_channel channel,
-			    const struct videomode *vm);
-	void (*set_lcd_config)(struct omap_drm_private *priv,
-			       enum omap_channel channel,
-			       const struct dss_lcd_mgr_config *config);
-	int (*register_framedone_handler)(struct omap_drm_private *priv,
-			enum omap_channel channel,
-			void (*handler)(void *), void *data);
-	void (*unregister_framedone_handler)(struct omap_drm_private *priv,
-			enum omap_channel channel,
-			void (*handler)(void *), void *data);
-};
-
-int dss_install_mgr_ops(struct dss_device *dss,
-			const struct dss_mgr_ops *mgr_ops,
-			struct omap_drm_private *priv);
-void dss_uninstall_mgr_ops(struct dss_device *dss);
+void omap_crtc_dss_start_update(struct omap_drm_private *priv,
+				       enum omap_channel channel);
+void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable);
+int omap_crtc_dss_enable(struct omap_drm_private *priv, enum omap_channel channel);
+void omap_crtc_dss_disable(struct omap_drm_private *priv, enum omap_channel channel);
+void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
+		enum omap_channel channel,
+		const struct videomode *vm);
+void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
+		enum omap_channel channel,
+		const struct dss_lcd_mgr_config *config);
+int omap_crtc_dss_register_framedone(
+		struct omap_drm_private *priv, enum omap_channel channel,
+		void (*handler)(void *), void *data);
+void omap_crtc_dss_unregister_framedone(
+		struct omap_drm_private *priv, enum omap_channel channel,
+		void (*handler)(void *), void *data);
 
 void dss_mgr_set_timings(struct omap_dss_device *dssdev,
 		const struct videomode *vm);
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
index 7a14d2b5b2f7..2121c947947b 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -81,54 +81,35 @@ void omapdss_device_cleanup_output(struct omap_dss_device *out)
 					out->next_bridge : out->bridge);
 }
 
-int dss_install_mgr_ops(struct dss_device *dss,
-			const struct dss_mgr_ops *mgr_ops,
-			struct omap_drm_private *priv)
-{
-	if (dss->mgr_ops)
-		return -EBUSY;
-
-	dss->mgr_ops = mgr_ops;
-	dss->mgr_ops_priv = priv;
-
-	return 0;
-}
-
-void dss_uninstall_mgr_ops(struct dss_device *dss)
-{
-	dss->mgr_ops = NULL;
-	dss->mgr_ops_priv = NULL;
-}
-
 void dss_mgr_set_timings(struct omap_dss_device *dssdev,
 			 const struct videomode *vm)
 {
-	dssdev->dss->mgr_ops->set_timings(dssdev->dss->mgr_ops_priv,
+	omap_crtc_dss_set_timings(dssdev->dss->mgr_ops_priv,
 					  dssdev->dispc_channel, vm);
 }
 
 void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
 		const struct dss_lcd_mgr_config *config)
 {
-	dssdev->dss->mgr_ops->set_lcd_config(dssdev->dss->mgr_ops_priv,
+	omap_crtc_dss_set_lcd_config(dssdev->dss->mgr_ops_priv,
 					     dssdev->dispc_channel, config);
 }
 
 int dss_mgr_enable(struct omap_dss_device *dssdev)
 {
-	return dssdev->dss->mgr_ops->enable(dssdev->dss->mgr_ops_priv,
+	return omap_crtc_dss_enable(dssdev->dss->mgr_ops_priv,
 					    dssdev->dispc_channel);
 }
 
 void dss_mgr_disable(struct omap_dss_device *dssdev)
 {
-	dssdev->dss->mgr_ops->disable(dssdev->dss->mgr_ops_priv,
+	omap_crtc_dss_disable(dssdev->dss->mgr_ops_priv,
 				      dssdev->dispc_channel);
 }
 
 void dss_mgr_start_update(struct omap_dss_device *dssdev)
 {
-	dssdev->dss->mgr_ops->start_update(dssdev->dss->mgr_ops_priv,
+	omap_crtc_dss_start_update(dssdev->dss->mgr_ops_priv,
 					   dssdev->dispc_channel);
 }
 
@@ -137,7 +118,7 @@ int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
 {
 	struct dss_device *dss = dssdev->dss;
 
-	return dss->mgr_ops->register_framedone_handler(dss->mgr_ops_priv,
+	return omap_crtc_dss_register_framedone(dss->mgr_ops_priv,
 							dssdev->dispc_channel,
 							handler, data);
 }
@@ -147,7 +128,7 @@ void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
 {
 	struct dss_device *dss = dssdev->dss;
 
-	dss->mgr_ops->unregister_framedone_handler(dss->mgr_ops_priv,
+	omap_crtc_dss_unregister_framedone(dss->mgr_ops_priv,
 						   dssdev->dispc_channel,
 						   handler, data);
 }
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 0bf5cef579b5..e3259338afb9 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -100,14 +100,14 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc)
  * the upstream part of the video pipe.
  */
 
-static void omap_crtc_dss_start_update(struct omap_drm_private *priv,
+void omap_crtc_dss_start_update(struct omap_drm_private *priv,
 				       enum omap_channel channel)
 {
 	dispc_mgr_enable(priv->dispc, channel, true);
 }
 
 /* Called only from the encoder enable/disable and suspend/resume handlers. */
-static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
+void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 {
 	struct omap_crtc_state *omap_state = to_omap_crtc_state(crtc->state);
 	struct drm_device *dev = crtc->dev;
@@ -180,8 +180,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 }
 
 
-static int omap_crtc_dss_enable(struct omap_drm_private *priv,
-				enum omap_channel channel)
+int omap_crtc_dss_enable(struct omap_drm_private *priv, enum omap_channel channel)
 {
 	struct drm_crtc *crtc = priv->channels[channel]->crtc;
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
@@ -193,8 +192,7 @@ static int omap_crtc_dss_enable(struct omap_drm_private *priv,
 	return 0;
 }
 
-static void omap_crtc_dss_disable(struct omap_drm_private *priv,
-				  enum omap_channel channel)
+void omap_crtc_dss_disable(struct omap_drm_private *priv, enum omap_channel channel)
 {
 	struct drm_crtc *crtc = priv->channels[channel]->crtc;
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
@@ -202,7 +200,7 @@ static void omap_crtc_dss_disable(struct omap_drm_private *priv,
 	omap_crtc_set_enabled(&omap_crtc->base, false);
 }
 
-static void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
+void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
 		enum omap_channel channel,
 		const struct videomode *vm)
 {
@@ -213,7 +211,7 @@ static void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
 	omap_crtc->vm = *vm;
 }
 
-static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
+void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
 		enum omap_channel channel,
 		const struct dss_lcd_mgr_config *config)
 {
@@ -225,7 +223,7 @@ static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
 					    config);
 }
 
-static int omap_crtc_dss_register_framedone(
+int omap_crtc_dss_register_framedone(
 		struct omap_drm_private *priv, enum omap_channel channel,
 		void (*handler)(void *), void *data)
 {
@@ -244,7 +242,7 @@ static int omap_crtc_dss_register_framedone(
 	return 0;
 }
 
-static void omap_crtc_dss_unregister_framedone(
+void omap_crtc_dss_unregister_framedone(
 		struct omap_drm_private *priv, enum omap_channel channel,
 		void (*handler)(void *), void *data)
 {
@@ -261,16 +259,6 @@ static void omap_crtc_dss_unregister_framedone(
 	omap_crtc->framedone_handler_data = NULL;
 }
 
-static const struct dss_mgr_ops mgr_ops = {
-	.start_update = omap_crtc_dss_start_update,
-	.enable = omap_crtc_dss_enable,
-	.disable = omap_crtc_dss_disable,
-	.set_timings = omap_crtc_dss_set_timings,
-	.set_lcd_config = omap_crtc_dss_set_lcd_config,
-	.register_framedone_handler = omap_crtc_dss_register_framedone,
-	.unregister_framedone_handler = omap_crtc_dss_unregister_framedone,
-};
-
 /* -----------------------------------------------------------------------------
  * Setup, Flush and Page Flip
  */
@@ -753,16 +741,6 @@ static const char *channel_names[] = {
 	[OMAP_DSS_CHANNEL_LCD3] = "lcd3",
 };
 
-void omap_crtc_pre_init(struct omap_drm_private *priv)
-{
-	dss_install_mgr_ops(priv->dss, &mgr_ops, priv);
-}
-
-void omap_crtc_pre_uninit(struct omap_drm_private *priv)
-{
-	dss_uninstall_mgr_ops(priv->dss);
-}
-
 /* initialize crtc */
 struct drm_crtc *omap_crtc_init(struct drm_device *dev,
 				struct omap_drm_pipeline *pipe,
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.h b/drivers/gpu/drm/omapdrm/omap_crtc.h
index 2fd57751ae2b..a8b9cbee86e0 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.h
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.h
@@ -22,8 +22,6 @@ struct videomode;
 
 struct videomode *omap_crtc_timings(struct drm_crtc *crtc);
 enum omap_channel omap_crtc_channel(struct drm_crtc *crtc);
-void omap_crtc_pre_init(struct omap_drm_private *priv);
-void omap_crtc_pre_uninit(struct omap_drm_private *priv);
 struct drm_crtc *omap_crtc_init(struct drm_device *dev,
 				struct omap_drm_pipeline *pipe,
 				struct drm_plane *plane);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index eb419387ed05..c5b2f50439d6 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -581,7 +581,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 	priv->dss = pdata->dss;
 	priv->dispc = dispc_get_dispc(priv->dss);
 
-	omap_crtc_pre_init(priv);
+	priv->dss->mgr_ops_priv = priv;
 
 	soc = soc_device_match(omapdrm_soc_devices);
 	priv->omaprev = soc ? (unsigned int)soc->data : 0;
@@ -634,7 +634,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 	omap_gem_deinit(ddev);
 	destroy_workqueue(priv->wq);
 	omap_disconnect_pipelines(ddev);
-	omap_crtc_pre_uninit(priv);
 	drm_dev_put(ddev);
 	return ret;
 }
@@ -660,7 +659,6 @@ static void omapdrm_cleanup(struct omap_drm_private *priv)
 	destroy_workqueue(priv->wq);
 
 	omap_disconnect_pipelines(ddev);
-	omap_crtc_pre_uninit(priv);
 
 	drm_dev_put(ddev);
 }
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 40/56] drm/panel: Move OMAP's DSI command mode panel driver
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-05 15:16     ` Sam Ravnborg
  -1 siblings, 0 replies; 328+ messages in thread
From: Sam Ravnborg @ 2020-11-05 15:16 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren,
	H . Nikolaus Schaller, Sebastian Reichel, Thierry Reding

On Thu, Nov 05, 2020 at 02:03:17PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The panel driver is no longer using any OMAP specific APIs, so
> let's move it into the generic panel directory.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>

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

* Re: [PATCH v3 40/56] drm/panel: Move OMAP's DSI command mode panel driver
@ 2020-11-05 15:16     ` Sam Ravnborg
  0 siblings, 0 replies; 328+ messages in thread
From: Sam Ravnborg @ 2020-11-05 15:16 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, Thierry Reding,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

On Thu, Nov 05, 2020 at 02:03:17PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The panel driver is no longer using any OMAP specific APIs, so
> let's move it into the generic panel directory.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 40/56] drm/panel: Move OMAP's DSI command mode panel driver
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-05 15:27     ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 15:27 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Thierry Reding, Sam Ravnborg

On 05/11/2020 14:03, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The panel driver is no longer using any OMAP specific APIs, so
> let's move it into the generic panel directory.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> ---
>  drivers/gpu/drm/omapdrm/Kconfig                        |  1 -
>  drivers/gpu/drm/omapdrm/Makefile                       |  1 -
>  drivers/gpu/drm/omapdrm/displays/Kconfig               | 10 ----------
>  drivers/gpu/drm/omapdrm/displays/Makefile              |  2 --
>  drivers/gpu/drm/panel/Kconfig                          |  9 +++++++++
>  drivers/gpu/drm/panel/Makefile                         |  1 +
>  .../gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c |  0
>  7 files changed, 10 insertions(+), 14 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
>  rename drivers/gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c (100%)

Just a note, I already have a few more cleanups for this driver. And I think we need to discuss how
to make this a properly generic DSI command mode driver, or should we just make this a driver for a
subset of drivers, used on OMAP platforms.

But I think that work is easier if the panel driver is in its proper place, as done in this patch.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 40/56] drm/panel: Move OMAP's DSI command mode panel driver
@ 2020-11-05 15:27     ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 15:27 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, Thierry Reding, Sam Ravnborg

On 05/11/2020 14:03, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The panel driver is no longer using any OMAP specific APIs, so
> let's move it into the generic panel directory.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> ---
>  drivers/gpu/drm/omapdrm/Kconfig                        |  1 -
>  drivers/gpu/drm/omapdrm/Makefile                       |  1 -
>  drivers/gpu/drm/omapdrm/displays/Kconfig               | 10 ----------
>  drivers/gpu/drm/omapdrm/displays/Makefile              |  2 --
>  drivers/gpu/drm/panel/Kconfig                          |  9 +++++++++
>  drivers/gpu/drm/panel/Makefile                         |  1 +
>  .../gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c |  0
>  7 files changed, 10 insertions(+), 14 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
>  rename drivers/gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c (100%)

Just a note, I already have a few more cleanups for this driver. And I think we need to discuss how
to make this a properly generic DSI command mode driver, or should we just make this a driver for a
subset of drivers, used on OMAP platforms.

But I think that work is easier if the panel driver is in its proper place, as done in this patch.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 17:15   ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-05 17:15 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren

Hi Tomi,

> Am 05.11.2020 um 13:02 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> Hi,
> 
> This is third version of the series sent by Sebastian in February:
> 
> https://www.spinics.net/lists/linux-omap/msg153465.html
> 
> I took the patches from his git tree, and rebased on 5.10-rc2. There
> were some conflicts and compilation errors, and one bug that made dsi to
> not work (videomode variable was not initialized to 0).
> 
> I then fixed the few checkpatch and sparse issues. Overall, Sebastian's
> patches are pretty much as they were previously. I did drop Laurent's
> reviewed-bys, as it's been a long time since the previous series, and
> the patches are not identical anyway.
> 
> The topmost 5 patches are new ones, cleanups enabled by the DSI
> conversion. They could be handled separately, but it's such a nice
> cleanup, and I've been waiting for years to get this done, so here they
> are. That said, there are still a _lot_ of cleanups to do.
> 
> Almost all of the patches are omapdrm changes. The two non-omapdrm
> changes are:
> - After converting panel-dsi-cm to common DRM panel model, it is moved
>  to drm's panel directory.
> - Add MIPI_DSI_MODE_ULPS_IDLE flag
> 
> I have tested these with OMAP4 SDP, AM5 EVM and OMAP4 Panda. SDP has
> command mode panel, and I don't have any videomode panels.
> 
> Sebastian, I hope you're ok with all this? I did send you an email, but
> didn't get a reply yet, so I thought to just proceed. If you want to
> handle this in some other way, or don't want your
> authorship/signed-off-by in some of the commits, just tell.

That all is great.
I was able to apply the patch set cleanly and compile.

Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
I followed the latest existing panel-orisetech-otm8009a.c which uses a
similar video mode controller and mipi-dsi.

That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.

Unfortunately my panel driver is not even loaded by drm/omap so I can't
debug. Does this set of drm/omap drivers need a modification of the device
tree? If yes, which one?

BR and thanks,
Nikolaus


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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-05 17:15   ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-05 17:15 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

Hi Tomi,

> Am 05.11.2020 um 13:02 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> Hi,
> 
> This is third version of the series sent by Sebastian in February:
> 
> https://www.spinics.net/lists/linux-omap/msg153465.html
> 
> I took the patches from his git tree, and rebased on 5.10-rc2. There
> were some conflicts and compilation errors, and one bug that made dsi to
> not work (videomode variable was not initialized to 0).
> 
> I then fixed the few checkpatch and sparse issues. Overall, Sebastian's
> patches are pretty much as they were previously. I did drop Laurent's
> reviewed-bys, as it's been a long time since the previous series, and
> the patches are not identical anyway.
> 
> The topmost 5 patches are new ones, cleanups enabled by the DSI
> conversion. They could be handled separately, but it's such a nice
> cleanup, and I've been waiting for years to get this done, so here they
> are. That said, there are still a _lot_ of cleanups to do.
> 
> Almost all of the patches are omapdrm changes. The two non-omapdrm
> changes are:
> - After converting panel-dsi-cm to common DRM panel model, it is moved
>  to drm's panel directory.
> - Add MIPI_DSI_MODE_ULPS_IDLE flag
> 
> I have tested these with OMAP4 SDP, AM5 EVM and OMAP4 Panda. SDP has
> command mode panel, and I don't have any videomode panels.
> 
> Sebastian, I hope you're ok with all this? I did send you an email, but
> didn't get a reply yet, so I thought to just proceed. If you want to
> handle this in some other way, or don't want your
> authorship/signed-off-by in some of the commits, just tell.

That all is great.
I was able to apply the patch set cleanly and compile.

Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
I followed the latest existing panel-orisetech-otm8009a.c which uses a
similar video mode controller and mipi-dsi.

That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.

Unfortunately my panel driver is not even loaded by drm/omap so I can't
debug. Does this set of drm/omap drivers need a modification of the device
tree? If yes, which one?

BR and thanks,
Nikolaus

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-05 17:15   ` H. Nikolaus Schaller
@ 2020-11-05 17:36     ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 17:36 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren

Hi,

On 05/11/2020 19:15, H. Nikolaus Schaller wrote:

> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
> I followed the latest existing panel-orisetech-otm8009a.c which uses a
> similar video mode controller and mipi-dsi.
> 
> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
> 
> Unfortunately my panel driver is not even loaded by drm/omap so I can't
> debug. Does this set of drm/omap drivers need a modification of the device
> tree? If yes, which one?

omapdrm doesn't load the panel drivers. If not even your panel's probe is called, then it hints at
DT and/or driver's compatible string issue. The panel's probe should get called even if omapdrm is
not loaded at all.

Can you push your branch somewhere, so I can have a quick look?

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-05 17:36     ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 17:36 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

Hi,

On 05/11/2020 19:15, H. Nikolaus Schaller wrote:

> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
> I followed the latest existing panel-orisetech-otm8009a.c which uses a
> similar video mode controller and mipi-dsi.
> 
> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
> 
> Unfortunately my panel driver is not even loaded by drm/omap so I can't
> debug. Does this set of drm/omap drivers need a modification of the device
> tree? If yes, which one?

omapdrm doesn't load the panel drivers. If not even your panel's probe is called, then it hints at
DT and/or driver's compatible string issue. The panel's probe should get called even if omapdrm is
not loaded at all.

Can you push your branch somewhere, so I can have a quick look?

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-05 17:36     ` Tomi Valkeinen
@ 2020-11-05 18:14       ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-05 18:14 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren


> Am 05.11.2020 um 18:36 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> Hi,
> 
> On 05/11/2020 19:15, H. Nikolaus Schaller wrote:
> 
>> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
>> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
>> I followed the latest existing panel-orisetech-otm8009a.c which uses a
>> similar video mode controller and mipi-dsi.
>> 
>> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
>> 
>> Unfortunately my panel driver is not even loaded by drm/omap so I can't
>> debug. Does this set of drm/omap drivers need a modification of the device
>> tree? If yes, which one?
> 
> omapdrm doesn't load the panel drivers. If not even your panel's probe is called, then it hints at
> DT and/or driver's compatible string issue. The panel's probe should get called even if omapdrm is
> not loaded at all.

Well, I use the same device tree that loads the old driver...

> 
> Can you push your branch somewhere, so I can have a quick look?

Yes, that would be nice!
Here:

https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux-pyra-dsi-5.10-rc2

or:

https://github.com/goldelico/letux-kernel/tree/letux-pyra-dsi-5.10-rc2

(full config is not included).

BR and thanks,
Nikolaus


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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-05 18:14       ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-05 18:14 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar


> Am 05.11.2020 um 18:36 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> Hi,
> 
> On 05/11/2020 19:15, H. Nikolaus Schaller wrote:
> 
>> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
>> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
>> I followed the latest existing panel-orisetech-otm8009a.c which uses a
>> similar video mode controller and mipi-dsi.
>> 
>> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
>> 
>> Unfortunately my panel driver is not even loaded by drm/omap so I can't
>> debug. Does this set of drm/omap drivers need a modification of the device
>> tree? If yes, which one?
> 
> omapdrm doesn't load the panel drivers. If not even your panel's probe is called, then it hints at
> DT and/or driver's compatible string issue. The panel's probe should get called even if omapdrm is
> not loaded at all.

Well, I use the same device tree that loads the old driver...

> 
> Can you push your branch somewhere, so I can have a quick look?

Yes, that would be nice!
Here:

https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux-pyra-dsi-5.10-rc2

or:

https://github.com/goldelico/letux-kernel/tree/letux-pyra-dsi-5.10-rc2

(full config is not included).

BR and thanks,
Nikolaus

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-05 18:14       ` H. Nikolaus Schaller
@ 2020-11-05 18:28         ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 18:28 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren

On 05/11/2020 20:14, H. Nikolaus Schaller wrote:
> 
>> Am 05.11.2020 um 18:36 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>
>> Hi,
>>
>> On 05/11/2020 19:15, H. Nikolaus Schaller wrote:
>>
>>> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
>>> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
>>> I followed the latest existing panel-orisetech-otm8009a.c which uses a
>>> similar video mode controller and mipi-dsi.
>>>
>>> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
>>>
>>> Unfortunately my panel driver is not even loaded by drm/omap so I can't
>>> debug. Does this set of drm/omap drivers need a modification of the device
>>> tree? If yes, which one?
>>
>> omapdrm doesn't load the panel drivers. If not even your panel's probe is called, then it hints at
>> DT and/or driver's compatible string issue. The panel's probe should get called even if omapdrm is
>> not loaded at all.
> 
> Well, I use the same device tree that loads the old driver...

Yeah, I was mistaken above. With DSI the panel (may be) a child of the DSI host, so it will affect.

Can you give pointers to the panel driver source and relevant dts files? BOE BTL507212-W677L?

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-05 18:28         ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-05 18:28 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

On 05/11/2020 20:14, H. Nikolaus Schaller wrote:
> 
>> Am 05.11.2020 um 18:36 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>
>> Hi,
>>
>> On 05/11/2020 19:15, H. Nikolaus Schaller wrote:
>>
>>> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
>>> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
>>> I followed the latest existing panel-orisetech-otm8009a.c which uses a
>>> similar video mode controller and mipi-dsi.
>>>
>>> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
>>>
>>> Unfortunately my panel driver is not even loaded by drm/omap so I can't
>>> debug. Does this set of drm/omap drivers need a modification of the device
>>> tree? If yes, which one?
>>
>> omapdrm doesn't load the panel drivers. If not even your panel's probe is called, then it hints at
>> DT and/or driver's compatible string issue. The panel's probe should get called even if omapdrm is
>> not loaded at all.
> 
> Well, I use the same device tree that loads the old driver...

Yeah, I was mistaken above. With DSI the panel (may be) a child of the DSI host, so it will affect.

Can you give pointers to the panel driver source and relevant dts files? BOE BTL507212-W677L?

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-05 18:28         ` Tomi Valkeinen
@ 2020-11-05 18:56           ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-05 18:56 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren


> Am 05.11.2020 um 19:28 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 05/11/2020 20:14, H. Nikolaus Schaller wrote:
>> 
>>> Am 05.11.2020 um 18:36 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> 
>>> Hi,
>>> 
>>> On 05/11/2020 19:15, H. Nikolaus Schaller wrote:
>>> 
>>>> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
>>>> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
>>>> I followed the latest existing panel-orisetech-otm8009a.c which uses a
>>>> similar video mode controller and mipi-dsi.
>>>> 
>>>> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
>>>> 
>>>> Unfortunately my panel driver is not even loaded by drm/omap so I can't
>>>> debug. Does this set of drm/omap drivers need a modification of the device
>>>> tree? If yes, which one?
>>> 
>>> omapdrm doesn't load the panel drivers. If not even your panel's probe is called, then it hints at
>>> DT and/or driver's compatible string issue. The panel's probe should get called even if omapdrm is
>>> not loaded at all.
>> 
>> Well, I use the same device tree that loads the old driver...
> 
> Yeah, I was mistaken above. With DSI the panel (may be) a child of the DSI host, so it will affect.
> 
> Can you give pointers to the panel driver source and relevant dts files? BOE BTL507212-W677L?

Yes. It is (now) 

drivers/gpu/drm/panel/panel-boe-btl507212-w677l.c

and

arch/arm/boot/dts/omap5-letux-cortex15-common.dtsi (for the basic dsi definitions)
arch/arm/boot/dts/pyra-display.dtsi (for the specific display)

All this is merged by some arch/arm/boot/dts/omap5-letux-cortex15-v5.3+pyra-v5.2.dts

(I know there are quite a lot of variants but it is a modular system potentially able to
accomodate a non-omap processor but the same display).

BR,
Nikolaus


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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-05 18:56           ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-05 18:56 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar


> Am 05.11.2020 um 19:28 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 05/11/2020 20:14, H. Nikolaus Schaller wrote:
>> 
>>> Am 05.11.2020 um 18:36 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> 
>>> Hi,
>>> 
>>> On 05/11/2020 19:15, H. Nikolaus Schaller wrote:
>>> 
>>>> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
>>>> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
>>>> I followed the latest existing panel-orisetech-otm8009a.c which uses a
>>>> similar video mode controller and mipi-dsi.
>>>> 
>>>> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
>>>> 
>>>> Unfortunately my panel driver is not even loaded by drm/omap so I can't
>>>> debug. Does this set of drm/omap drivers need a modification of the device
>>>> tree? If yes, which one?
>>> 
>>> omapdrm doesn't load the panel drivers. If not even your panel's probe is called, then it hints at
>>> DT and/or driver's compatible string issue. The panel's probe should get called even if omapdrm is
>>> not loaded at all.
>> 
>> Well, I use the same device tree that loads the old driver...
> 
> Yeah, I was mistaken above. With DSI the panel (may be) a child of the DSI host, so it will affect.
> 
> Can you give pointers to the panel driver source and relevant dts files? BOE BTL507212-W677L?

Yes. It is (now) 

drivers/gpu/drm/panel/panel-boe-btl507212-w677l.c

and

arch/arm/boot/dts/omap5-letux-cortex15-common.dtsi (for the basic dsi definitions)
arch/arm/boot/dts/pyra-display.dtsi (for the specific display)

All this is merged by some arch/arm/boot/dts/omap5-letux-cortex15-v5.3+pyra-v5.2.dts

(I know there are quite a lot of variants but it is a modular system potentially able to
accomodate a non-omap processor but the same display).

BR,
Nikolaus

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 02/56] Revert "drm/omap: dss: Remove unused omap_dss_device operations"
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-05 21:27     ` Sam Ravnborg
  -1 siblings, 0 replies; 328+ messages in thread
From: Sam Ravnborg @ 2020-11-05 21:27 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Tony Lindgren, H . Nikolaus Schaller,
	Sekhar Nori, Sebastian Reichel

Hi Tomi

On Thu, Nov 05, 2020 at 02:02:39PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This reverts commit 4ff8e98879e6eeae9d125dfcf3b642075d00089d.

Please use proper commit reference like:
2f62f4990dca ("gpu: drm: bridge: bla bla)

The above commit-id does not exist in my drm-misc-next tree.

	Sam

> 
> This is still needed by DSI. E.g. unloading modules without this will
> cause a crash.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c     | 26 +++++++++++++++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  6 ++++
>  drivers/gpu/drm/omapdrm/omap_encoder.c | 44 +++++++++++++++++++++++---
>  3 files changed, 71 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index c7650a7c155d..455b410f7401 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -234,6 +234,18 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
>  
> +void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
> +{
> +	if (!dssdev)
> +		return;
> +
> +	omapdss_device_pre_enable(dssdev->next);
> +
> +	if (dssdev->ops && dssdev->ops->pre_enable)
> +		dssdev->ops->pre_enable(dssdev);
> +}
> +EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
> +
>  void omapdss_device_enable(struct omap_dss_device *dssdev)
>  {
>  	if (!dssdev)
> @@ -260,6 +272,20 @@ void omapdss_device_disable(struct omap_dss_device *dssdev)
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disable);
>  
> +void omapdss_device_post_disable(struct omap_dss_device *dssdev)
> +{
> +	if (!dssdev)
> +		return;
> +
> +	if (dssdev->ops && dssdev->ops->post_disable)
> +		dssdev->ops->post_disable(dssdev);
> +
> +	omapdss_device_post_disable(dssdev->next);
> +
> +	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> +}
> +EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
> +
>  /* -----------------------------------------------------------------------------
>   * Components Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index ab19d4af8de7..cbbe10b2b60d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -342,11 +342,15 @@ struct omap_dss_device_ops {
>  	void (*disconnect)(struct omap_dss_device *dssdev,
>  			struct omap_dss_device *dst);
>  
> +	void (*pre_enable)(struct omap_dss_device *dssdev);
>  	void (*enable)(struct omap_dss_device *dssdev);
>  	void (*disable)(struct omap_dss_device *dssdev);
> +	void (*post_disable)(struct omap_dss_device *dssdev);
>  
>  	int (*check_timings)(struct omap_dss_device *dssdev,
>  			     struct drm_display_mode *mode);
> +	void (*set_timings)(struct omap_dss_device *dssdev,
> +			    const struct drm_display_mode *mode);
>  
>  	int (*get_modes)(struct omap_dss_device *dssdev,
>  			 struct drm_connector *connector);
> @@ -445,8 +449,10 @@ int omapdss_device_connect(struct dss_device *dss,
>  			   struct omap_dss_device *dst);
>  void omapdss_device_disconnect(struct omap_dss_device *src,
>  			       struct omap_dss_device *dst);
> +void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
>  void omapdss_device_enable(struct omap_dss_device *dssdev);
>  void omapdss_device_disable(struct omap_dss_device *dssdev);
> +void omapdss_device_post_disable(struct omap_dss_device *dssdev);
>  
>  int omap_dss_get_num_overlay_managers(void);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index ae4b867a67a3..18a79dde6815 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -113,8 +113,13 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
>  	bus_flags = connector->display_info.bus_flags;
>  	omap_encoder_update_videomode_flags(&vm, bus_flags);
>  
> -	/* Set timings for the dss manager. */
> +	/* Set timings for all devices in the display pipeline. */
>  	dss_mgr_set_timings(output, &vm);
> +
> +	for (dssdev = output; dssdev; dssdev = dssdev->next) {
> +		if (dssdev->ops && dssdev->ops->set_timings)
> +			dssdev->ops->set_timings(dssdev, adjusted_mode);
> +	}
>  }
>  
>  static void omap_encoder_disable(struct drm_encoder *encoder)
> @@ -127,10 +132,26 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
>  
>  	/*
>  	 * Disable the chain of external devices, starting at the one at the
> -	 * internal encoder's output. This is used for DSI outputs only, as
> -	 * dssdev->next is NULL for all other outputs.
> +	 * internal encoder's output.
>  	 */
>  	omapdss_device_disable(dssdev->next);
> +
> +	/*
> +	 * Disable the internal encoder. This will disable the DSS output. The
> +	 * DSI is treated as an exception as DSI pipelines still use the legacy
> +	 * flow where the pipeline output controls the encoder.
> +	 */
> +	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
> +		if (dssdev->ops && dssdev->ops->disable)
> +			dssdev->ops->disable(dssdev);
> +		dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> +	}
> +
> +	/*
> +	 * Perform the post-disable operations on the chain of external devices
> +	 * to complete the display pipeline disable.
> +	 */
> +	omapdss_device_post_disable(dssdev->next);
>  }
>  
>  static void omap_encoder_enable(struct drm_encoder *encoder)
> @@ -141,10 +162,23 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
>  
>  	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
>  
> +	/* Prepare the chain of external devices for pipeline enable. */
> +	omapdss_device_pre_enable(dssdev->next);
> +
> +	/*
> +	 * Enable the internal encoder. This will enable the DSS output. The
> +	 * DSI is treated as an exception as DSI pipelines still use the legacy
> +	 * flow where the pipeline output controls the encoder.
> +	 */
> +	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
> +		if (dssdev->ops && dssdev->ops->enable)
> +			dssdev->ops->enable(dssdev);
> +		dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
> +	}
> +
>  	/*
>  	 * Enable the chain of external devices, starting at the one at the
> -	 * internal encoder's output. This is used for DSI outputs only, as
> -	 * dssdev->next is NULL for all other outputs.
> +	 * internal encoder's output.
>  	 */
>  	omapdss_device_enable(dssdev->next);
>  }
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 02/56] Revert "drm/omap: dss: Remove unused omap_dss_device operations"
@ 2020-11-05 21:27     ` Sam Ravnborg
  0 siblings, 0 replies; 328+ messages in thread
From: Sam Ravnborg @ 2020-11-05 21:27 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

Hi Tomi

On Thu, Nov 05, 2020 at 02:02:39PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This reverts commit 4ff8e98879e6eeae9d125dfcf3b642075d00089d.

Please use proper commit reference like:
2f62f4990dca ("gpu: drm: bridge: bla bla)

The above commit-id does not exist in my drm-misc-next tree.

	Sam

> 
> This is still needed by DSI. E.g. unloading modules without this will
> cause a crash.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c     | 26 +++++++++++++++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  6 ++++
>  drivers/gpu/drm/omapdrm/omap_encoder.c | 44 +++++++++++++++++++++++---
>  3 files changed, 71 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index c7650a7c155d..455b410f7401 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -234,6 +234,18 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
>  
> +void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
> +{
> +	if (!dssdev)
> +		return;
> +
> +	omapdss_device_pre_enable(dssdev->next);
> +
> +	if (dssdev->ops && dssdev->ops->pre_enable)
> +		dssdev->ops->pre_enable(dssdev);
> +}
> +EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
> +
>  void omapdss_device_enable(struct omap_dss_device *dssdev)
>  {
>  	if (!dssdev)
> @@ -260,6 +272,20 @@ void omapdss_device_disable(struct omap_dss_device *dssdev)
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disable);
>  
> +void omapdss_device_post_disable(struct omap_dss_device *dssdev)
> +{
> +	if (!dssdev)
> +		return;
> +
> +	if (dssdev->ops && dssdev->ops->post_disable)
> +		dssdev->ops->post_disable(dssdev);
> +
> +	omapdss_device_post_disable(dssdev->next);
> +
> +	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> +}
> +EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
> +
>  /* -----------------------------------------------------------------------------
>   * Components Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index ab19d4af8de7..cbbe10b2b60d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -342,11 +342,15 @@ struct omap_dss_device_ops {
>  	void (*disconnect)(struct omap_dss_device *dssdev,
>  			struct omap_dss_device *dst);
>  
> +	void (*pre_enable)(struct omap_dss_device *dssdev);
>  	void (*enable)(struct omap_dss_device *dssdev);
>  	void (*disable)(struct omap_dss_device *dssdev);
> +	void (*post_disable)(struct omap_dss_device *dssdev);
>  
>  	int (*check_timings)(struct omap_dss_device *dssdev,
>  			     struct drm_display_mode *mode);
> +	void (*set_timings)(struct omap_dss_device *dssdev,
> +			    const struct drm_display_mode *mode);
>  
>  	int (*get_modes)(struct omap_dss_device *dssdev,
>  			 struct drm_connector *connector);
> @@ -445,8 +449,10 @@ int omapdss_device_connect(struct dss_device *dss,
>  			   struct omap_dss_device *dst);
>  void omapdss_device_disconnect(struct omap_dss_device *src,
>  			       struct omap_dss_device *dst);
> +void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
>  void omapdss_device_enable(struct omap_dss_device *dssdev);
>  void omapdss_device_disable(struct omap_dss_device *dssdev);
> +void omapdss_device_post_disable(struct omap_dss_device *dssdev);
>  
>  int omap_dss_get_num_overlay_managers(void);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index ae4b867a67a3..18a79dde6815 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -113,8 +113,13 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
>  	bus_flags = connector->display_info.bus_flags;
>  	omap_encoder_update_videomode_flags(&vm, bus_flags);
>  
> -	/* Set timings for the dss manager. */
> +	/* Set timings for all devices in the display pipeline. */
>  	dss_mgr_set_timings(output, &vm);
> +
> +	for (dssdev = output; dssdev; dssdev = dssdev->next) {
> +		if (dssdev->ops && dssdev->ops->set_timings)
> +			dssdev->ops->set_timings(dssdev, adjusted_mode);
> +	}
>  }
>  
>  static void omap_encoder_disable(struct drm_encoder *encoder)
> @@ -127,10 +132,26 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
>  
>  	/*
>  	 * Disable the chain of external devices, starting at the one at the
> -	 * internal encoder's output. This is used for DSI outputs only, as
> -	 * dssdev->next is NULL for all other outputs.
> +	 * internal encoder's output.
>  	 */
>  	omapdss_device_disable(dssdev->next);
> +
> +	/*
> +	 * Disable the internal encoder. This will disable the DSS output. The
> +	 * DSI is treated as an exception as DSI pipelines still use the legacy
> +	 * flow where the pipeline output controls the encoder.
> +	 */
> +	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
> +		if (dssdev->ops && dssdev->ops->disable)
> +			dssdev->ops->disable(dssdev);
> +		dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> +	}
> +
> +	/*
> +	 * Perform the post-disable operations on the chain of external devices
> +	 * to complete the display pipeline disable.
> +	 */
> +	omapdss_device_post_disable(dssdev->next);
>  }
>  
>  static void omap_encoder_enable(struct drm_encoder *encoder)
> @@ -141,10 +162,23 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
>  
>  	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
>  
> +	/* Prepare the chain of external devices for pipeline enable. */
> +	omapdss_device_pre_enable(dssdev->next);
> +
> +	/*
> +	 * Enable the internal encoder. This will enable the DSS output. The
> +	 * DSI is treated as an exception as DSI pipelines still use the legacy
> +	 * flow where the pipeline output controls the encoder.
> +	 */
> +	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
> +		if (dssdev->ops && dssdev->ops->enable)
> +			dssdev->ops->enable(dssdev);
> +		dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
> +	}
> +
>  	/*
>  	 * Enable the chain of external devices, starting at the one at the
> -	 * internal encoder's output. This is used for DSI outputs only, as
> -	 * dssdev->next is NULL for all other outputs.
> +	 * internal encoder's output.
>  	 */
>  	omapdss_device_enable(dssdev->next);
>  }
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-05 21:31   ` Sam Ravnborg
  -1 siblings, 0 replies; 328+ messages in thread
From: Sam Ravnborg @ 2020-11-05 21:31 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Tony Lindgren, H . Nikolaus Schaller,
	Sekhar Nori

Hi Tomi

On Thu, Nov 05, 2020 at 02:02:37PM +0200, Tomi Valkeinen wrote:
> Hi,
> 
> This is third version of the series sent by Sebastian in February:
> 
> https://www.spinics.net/lists/linux-omap/msg153465.html
> 
> I took the patches from his git tree, and rebased on 5.10-rc2. There
> were some conflicts and compilation errors, and one bug that made dsi to
> not work (videomode variable was not initialized to 0).

I for one would be more than happy to see these patches go in.
I have looked at them before but was lost in all the conversions.
But the general impression is that the drivers are left in a much better
shape after the patch set. And the individual patches all looks good.

So I am all for getting the patches applied.
Perferably soonish so there is some time to fix any regressions that may
be reported.

	Sam


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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-05 21:31   ` Sam Ravnborg
  0 siblings, 0 replies; 328+ messages in thread
From: Sam Ravnborg @ 2020-11-05 21:31 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Laurent Pinchart, linux-omap,
	Nikhil Devshatwar

Hi Tomi

On Thu, Nov 05, 2020 at 02:02:37PM +0200, Tomi Valkeinen wrote:
> Hi,
> 
> This is third version of the series sent by Sebastian in February:
> 
> https://www.spinics.net/lists/linux-omap/msg153465.html
> 
> I took the patches from his git tree, and rebased on 5.10-rc2. There
> were some conflicts and compilation errors, and one bug that made dsi to
> not work (videomode variable was not initialized to 0).

I for one would be more than happy to see these patches go in.
I have looked at them before but was lost in all the conversions.
But the general impression is that the drivers are left in a much better
shape after the patch set. And the individual patches all looks good.

So I am all for getting the patches applied.
Perferably soonish so there is some time to fix any regressions that may
be reported.

	Sam

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 01/56] drm/dsi: add MIPI_DSI_MODE_ULPS_IDLE
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-06  4:41     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  4:41 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:38PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> DSI command mode panels are self-refreshing displays, that
> can be updated very rarely for static images. For this kind
> of scenario some panels support, that the DSI bus switches
> into ULPS mode until the panel needs to be refreshed.
> 
> This is problematic on some panels, so introduce a flag to
> signal the DSI host implementation that the panel allows
> going into ULPS mode.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  include/drm/drm_mipi_dsi.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index 360e6377e84b..f36f89c14b4a 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -132,6 +132,8 @@ struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
>  #define MIPI_DSI_CLOCK_NON_CONTINUOUS	BIT(10)
>  /* transmit data in low power */
>  #define MIPI_DSI_MODE_LPM		BIT(11)
> +/* allow going into ULPS mode while command mode panel is not updated */
> +#define MIPI_DSI_MODE_ULPS_IDLE		BIT(12)
>  
>  enum mipi_dsi_pixel_format {
>  	MIPI_DSI_FMT_RGB888,

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 01/56] drm/dsi: add MIPI_DSI_MODE_ULPS_IDLE
@ 2020-11-06  4:41     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  4:41 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:38PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> DSI command mode panels are self-refreshing displays, that
> can be updated very rarely for static images. For this kind
> of scenario some panels support, that the DSI bus switches
> into ULPS mode until the panel needs to be refreshed.
> 
> This is problematic on some panels, so introduce a flag to
> signal the DSI host implementation that the panel allows
> going into ULPS mode.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  include/drm/drm_mipi_dsi.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index 360e6377e84b..f36f89c14b4a 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -132,6 +132,8 @@ struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
>  #define MIPI_DSI_CLOCK_NON_CONTINUOUS	BIT(10)
>  /* transmit data in low power */
>  #define MIPI_DSI_MODE_LPM		BIT(11)
> +/* allow going into ULPS mode while command mode panel is not updated */
> +#define MIPI_DSI_MODE_ULPS_IDLE		BIT(12)
>  
>  enum mipi_dsi_pixel_format {
>  	MIPI_DSI_FMT_RGB888,

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 02/56] Revert "drm/omap: dss: Remove unused omap_dss_device operations"
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-06  4:50     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  4:50 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:39PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This reverts commit 4ff8e98879e6eeae9d125dfcf3b642075d00089d.

With this fixed as requested by Sam,

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

> This is still needed by DSI. E.g. unloading modules without this will
> cause a crash.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c     | 26 +++++++++++++++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  6 ++++
>  drivers/gpu/drm/omapdrm/omap_encoder.c | 44 +++++++++++++++++++++++---
>  3 files changed, 71 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index c7650a7c155d..455b410f7401 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -234,6 +234,18 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
>  
> +void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
> +{
> +	if (!dssdev)
> +		return;
> +
> +	omapdss_device_pre_enable(dssdev->next);
> +
> +	if (dssdev->ops && dssdev->ops->pre_enable)
> +		dssdev->ops->pre_enable(dssdev);
> +}
> +EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
> +
>  void omapdss_device_enable(struct omap_dss_device *dssdev)
>  {
>  	if (!dssdev)
> @@ -260,6 +272,20 @@ void omapdss_device_disable(struct omap_dss_device *dssdev)
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disable);
>  
> +void omapdss_device_post_disable(struct omap_dss_device *dssdev)
> +{
> +	if (!dssdev)
> +		return;
> +
> +	if (dssdev->ops && dssdev->ops->post_disable)
> +		dssdev->ops->post_disable(dssdev);
> +
> +	omapdss_device_post_disable(dssdev->next);
> +
> +	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> +}
> +EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
> +
>  /* -----------------------------------------------------------------------------
>   * Components Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index ab19d4af8de7..cbbe10b2b60d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -342,11 +342,15 @@ struct omap_dss_device_ops {
>  	void (*disconnect)(struct omap_dss_device *dssdev,
>  			struct omap_dss_device *dst);
>  
> +	void (*pre_enable)(struct omap_dss_device *dssdev);
>  	void (*enable)(struct omap_dss_device *dssdev);
>  	void (*disable)(struct omap_dss_device *dssdev);
> +	void (*post_disable)(struct omap_dss_device *dssdev);
>  
>  	int (*check_timings)(struct omap_dss_device *dssdev,
>  			     struct drm_display_mode *mode);
> +	void (*set_timings)(struct omap_dss_device *dssdev,
> +			    const struct drm_display_mode *mode);
>  
>  	int (*get_modes)(struct omap_dss_device *dssdev,
>  			 struct drm_connector *connector);
> @@ -445,8 +449,10 @@ int omapdss_device_connect(struct dss_device *dss,
>  			   struct omap_dss_device *dst);
>  void omapdss_device_disconnect(struct omap_dss_device *src,
>  			       struct omap_dss_device *dst);
> +void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
>  void omapdss_device_enable(struct omap_dss_device *dssdev);
>  void omapdss_device_disable(struct omap_dss_device *dssdev);
> +void omapdss_device_post_disable(struct omap_dss_device *dssdev);
>  
>  int omap_dss_get_num_overlay_managers(void);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index ae4b867a67a3..18a79dde6815 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -113,8 +113,13 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
>  	bus_flags = connector->display_info.bus_flags;
>  	omap_encoder_update_videomode_flags(&vm, bus_flags);
>  
> -	/* Set timings for the dss manager. */
> +	/* Set timings for all devices in the display pipeline. */
>  	dss_mgr_set_timings(output, &vm);
> +
> +	for (dssdev = output; dssdev; dssdev = dssdev->next) {
> +		if (dssdev->ops && dssdev->ops->set_timings)
> +			dssdev->ops->set_timings(dssdev, adjusted_mode);
> +	}
>  }
>  
>  static void omap_encoder_disable(struct drm_encoder *encoder)
> @@ -127,10 +132,26 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
>  
>  	/*
>  	 * Disable the chain of external devices, starting at the one at the
> -	 * internal encoder's output. This is used for DSI outputs only, as
> -	 * dssdev->next is NULL for all other outputs.
> +	 * internal encoder's output.
>  	 */
>  	omapdss_device_disable(dssdev->next);
> +
> +	/*
> +	 * Disable the internal encoder. This will disable the DSS output. The
> +	 * DSI is treated as an exception as DSI pipelines still use the legacy
> +	 * flow where the pipeline output controls the encoder.
> +	 */
> +	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
> +		if (dssdev->ops && dssdev->ops->disable)
> +			dssdev->ops->disable(dssdev);
> +		dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> +	}
> +
> +	/*
> +	 * Perform the post-disable operations on the chain of external devices
> +	 * to complete the display pipeline disable.
> +	 */
> +	omapdss_device_post_disable(dssdev->next);
>  }
>  
>  static void omap_encoder_enable(struct drm_encoder *encoder)
> @@ -141,10 +162,23 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
>  
>  	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
>  
> +	/* Prepare the chain of external devices for pipeline enable. */
> +	omapdss_device_pre_enable(dssdev->next);
> +
> +	/*
> +	 * Enable the internal encoder. This will enable the DSS output. The
> +	 * DSI is treated as an exception as DSI pipelines still use the legacy
> +	 * flow where the pipeline output controls the encoder.
> +	 */
> +	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
> +		if (dssdev->ops && dssdev->ops->enable)
> +			dssdev->ops->enable(dssdev);
> +		dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
> +	}
> +
>  	/*
>  	 * Enable the chain of external devices, starting at the one at the
> -	 * internal encoder's output. This is used for DSI outputs only, as
> -	 * dssdev->next is NULL for all other outputs.
> +	 * internal encoder's output.
>  	 */
>  	omapdss_device_enable(dssdev->next);
>  }

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 02/56] Revert "drm/omap: dss: Remove unused omap_dss_device operations"
@ 2020-11-06  4:50     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  4:50 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:39PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This reverts commit 4ff8e98879e6eeae9d125dfcf3b642075d00089d.

With this fixed as requested by Sam,

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

> This is still needed by DSI. E.g. unloading modules without this will
> cause a crash.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c     | 26 +++++++++++++++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  6 ++++
>  drivers/gpu/drm/omapdrm/omap_encoder.c | 44 +++++++++++++++++++++++---
>  3 files changed, 71 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index c7650a7c155d..455b410f7401 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -234,6 +234,18 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
>  
> +void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
> +{
> +	if (!dssdev)
> +		return;
> +
> +	omapdss_device_pre_enable(dssdev->next);
> +
> +	if (dssdev->ops && dssdev->ops->pre_enable)
> +		dssdev->ops->pre_enable(dssdev);
> +}
> +EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
> +
>  void omapdss_device_enable(struct omap_dss_device *dssdev)
>  {
>  	if (!dssdev)
> @@ -260,6 +272,20 @@ void omapdss_device_disable(struct omap_dss_device *dssdev)
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disable);
>  
> +void omapdss_device_post_disable(struct omap_dss_device *dssdev)
> +{
> +	if (!dssdev)
> +		return;
> +
> +	if (dssdev->ops && dssdev->ops->post_disable)
> +		dssdev->ops->post_disable(dssdev);
> +
> +	omapdss_device_post_disable(dssdev->next);
> +
> +	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> +}
> +EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
> +
>  /* -----------------------------------------------------------------------------
>   * Components Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index ab19d4af8de7..cbbe10b2b60d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -342,11 +342,15 @@ struct omap_dss_device_ops {
>  	void (*disconnect)(struct omap_dss_device *dssdev,
>  			struct omap_dss_device *dst);
>  
> +	void (*pre_enable)(struct omap_dss_device *dssdev);
>  	void (*enable)(struct omap_dss_device *dssdev);
>  	void (*disable)(struct omap_dss_device *dssdev);
> +	void (*post_disable)(struct omap_dss_device *dssdev);
>  
>  	int (*check_timings)(struct omap_dss_device *dssdev,
>  			     struct drm_display_mode *mode);
> +	void (*set_timings)(struct omap_dss_device *dssdev,
> +			    const struct drm_display_mode *mode);
>  
>  	int (*get_modes)(struct omap_dss_device *dssdev,
>  			 struct drm_connector *connector);
> @@ -445,8 +449,10 @@ int omapdss_device_connect(struct dss_device *dss,
>  			   struct omap_dss_device *dst);
>  void omapdss_device_disconnect(struct omap_dss_device *src,
>  			       struct omap_dss_device *dst);
> +void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
>  void omapdss_device_enable(struct omap_dss_device *dssdev);
>  void omapdss_device_disable(struct omap_dss_device *dssdev);
> +void omapdss_device_post_disable(struct omap_dss_device *dssdev);
>  
>  int omap_dss_get_num_overlay_managers(void);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index ae4b867a67a3..18a79dde6815 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -113,8 +113,13 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
>  	bus_flags = connector->display_info.bus_flags;
>  	omap_encoder_update_videomode_flags(&vm, bus_flags);
>  
> -	/* Set timings for the dss manager. */
> +	/* Set timings for all devices in the display pipeline. */
>  	dss_mgr_set_timings(output, &vm);
> +
> +	for (dssdev = output; dssdev; dssdev = dssdev->next) {
> +		if (dssdev->ops && dssdev->ops->set_timings)
> +			dssdev->ops->set_timings(dssdev, adjusted_mode);
> +	}
>  }
>  
>  static void omap_encoder_disable(struct drm_encoder *encoder)
> @@ -127,10 +132,26 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
>  
>  	/*
>  	 * Disable the chain of external devices, starting at the one at the
> -	 * internal encoder's output. This is used for DSI outputs only, as
> -	 * dssdev->next is NULL for all other outputs.
> +	 * internal encoder's output.
>  	 */
>  	omapdss_device_disable(dssdev->next);
> +
> +	/*
> +	 * Disable the internal encoder. This will disable the DSS output. The
> +	 * DSI is treated as an exception as DSI pipelines still use the legacy
> +	 * flow where the pipeline output controls the encoder.
> +	 */
> +	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
> +		if (dssdev->ops && dssdev->ops->disable)
> +			dssdev->ops->disable(dssdev);
> +		dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> +	}
> +
> +	/*
> +	 * Perform the post-disable operations on the chain of external devices
> +	 * to complete the display pipeline disable.
> +	 */
> +	omapdss_device_post_disable(dssdev->next);
>  }
>  
>  static void omap_encoder_enable(struct drm_encoder *encoder)
> @@ -141,10 +162,23 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
>  
>  	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
>  
> +	/* Prepare the chain of external devices for pipeline enable. */
> +	omapdss_device_pre_enable(dssdev->next);
> +
> +	/*
> +	 * Enable the internal encoder. This will enable the DSS output. The
> +	 * DSI is treated as an exception as DSI pipelines still use the legacy
> +	 * flow where the pipeline output controls the encoder.
> +	 */
> +	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
> +		if (dssdev->ops && dssdev->ops->enable)
> +			dssdev->ops->enable(dssdev);
> +		dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
> +	}
> +
>  	/*
>  	 * Enable the chain of external devices, starting at the one at the
> -	 * internal encoder's output. This is used for DSI outputs only, as
> -	 * dssdev->next is NULL for all other outputs.
> +	 * internal encoder's output.
>  	 */
>  	omapdss_device_enable(dssdev->next);
>  }

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 03/56] drm/omap: drop unused dsi.configure_pins
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-06  4:50     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  4:50 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:40PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The panel-dsi-cm's ddata->pin_config is always NULL, so this
> callback is never called. Instead the DSI encoder gets the pin
> configuration directly from DT.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 11 -----------
>  drivers/gpu/drm/omapdrm/dss/dsi.c               |  1 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h           |  2 --
>  3 files changed, 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index faca5c873bde..ff610d2a13fd 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -68,8 +68,6 @@ struct panel_drv_data {
>  	int width_mm;
>  	int height_mm;
>  
> -	struct omap_dsi_pin_config pin_config;
> -
>  	/* runtime variables */
>  	bool enabled;
>  
> @@ -623,15 +621,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  		}
>  	}
>  
> -	if (ddata->pin_config.num_pins > 0) {
> -		r = src->ops->dsi.configure_pins(src, &ddata->pin_config);
> -		if (r) {
> -			dev_err(&ddata->pdev->dev,
> -				"failed to configure DSI pins\n");
> -			goto err_vddi;
> -		}
> -	}
> -
>  	r = src->ops->dsi.set_config(src, &dsi_config);
>  	if (r) {
>  		dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index eeccf40bae41..5598fc8f91db 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4892,7 +4892,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  
>  		.enable_hs = dsi_vc_enable_hs,
>  
> -		.configure_pins = dsi_configure_pins,
>  		.set_config = dsi_set_config,
>  
>  		.enable_video_output = dsi_enable_video_output,
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index cbbe10b2b60d..b0424daaceed 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -292,8 +292,6 @@ struct omapdss_dsi_ops {
>  	/* bus configuration */
>  	int (*set_config)(struct omap_dss_device *dssdev,
>  			const struct omap_dss_dsi_config *cfg);
> -	int (*configure_pins)(struct omap_dss_device *dssdev,
> -			const struct omap_dsi_pin_config *pin_cfg);
>  
>  	void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
>  			bool enable);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 03/56] drm/omap: drop unused dsi.configure_pins
@ 2020-11-06  4:50     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  4:50 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:40PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The panel-dsi-cm's ddata->pin_config is always NULL, so this
> callback is never called. Instead the DSI encoder gets the pin
> configuration directly from DT.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 11 -----------
>  drivers/gpu/drm/omapdrm/dss/dsi.c               |  1 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h           |  2 --
>  3 files changed, 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index faca5c873bde..ff610d2a13fd 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -68,8 +68,6 @@ struct panel_drv_data {
>  	int width_mm;
>  	int height_mm;
>  
> -	struct omap_dsi_pin_config pin_config;
> -
>  	/* runtime variables */
>  	bool enabled;
>  
> @@ -623,15 +621,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  		}
>  	}
>  
> -	if (ddata->pin_config.num_pins > 0) {
> -		r = src->ops->dsi.configure_pins(src, &ddata->pin_config);
> -		if (r) {
> -			dev_err(&ddata->pdev->dev,
> -				"failed to configure DSI pins\n");
> -			goto err_vddi;
> -		}
> -	}
> -
>  	r = src->ops->dsi.set_config(src, &dsi_config);
>  	if (r) {
>  		dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index eeccf40bae41..5598fc8f91db 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4892,7 +4892,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  
>  		.enable_hs = dsi_vc_enable_hs,
>  
> -		.configure_pins = dsi_configure_pins,
>  		.set_config = dsi_set_config,
>  
>  		.enable_video_output = dsi_enable_video_output,
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index cbbe10b2b60d..b0424daaceed 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -292,8 +292,6 @@ struct omapdss_dsi_ops {
>  	/* bus configuration */
>  	int (*set_config)(struct omap_dss_device *dssdev,
>  			const struct omap_dss_dsi_config *cfg);
> -	int (*configure_pins)(struct omap_dss_device *dssdev,
> -			const struct omap_dsi_pin_config *pin_cfg);
>  
>  	void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
>  			bool enable);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 04/56] drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_*
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-06  4:56     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  4:56 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:41PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This replaces OMAP specific enum for pixel format with
> common implementation.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 +-
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 55 ++++++++-----------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         | 13 ++---
>  3 files changed, 28 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index ff610d2a13fd..b8f3a7aacbf4 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -595,7 +595,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	int r;
>  	struct omap_dss_dsi_config dsi_config = {
>  		.mode = OMAP_DSS_DSI_CMD_MODE,
> -		.pixel_format = OMAP_DSS_DSI_FMT_RGB888,
> +		.pixel_format = MIPI_DSI_FMT_RGB888,
>  		.vm = &ddata->vm,
>  		.hs_clk_min = 150000000,
>  		.hs_clk_max = 300000000,
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 5598fc8f91db..86b9d435fb94 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -33,6 +33,7 @@
>  #include <linux/component.h>
>  #include <linux/sys_soc.h>
>  
> +#include <drm/drm_mipi_dsi.h>
>  #include <video/mipi_display.h>
>  
>  #include "omapdss.h"
> @@ -410,7 +411,7 @@ struct dsi_data {
>  
>  	struct dss_lcd_mgr_config mgr_config;
>  	struct videomode vm;
> -	enum omap_dss_dsi_pixel_format pix_fmt;
> +	enum mipi_dsi_pixel_format pix_fmt;
>  	enum omap_dss_dsi_mode mode;
>  	struct omap_dss_dsi_videomode_timings vm_timings;
>  
> @@ -514,22 +515,6 @@ static inline bool wait_for_bit_change(struct dsi_data *dsi,
>  	return false;
>  }
>  
> -static u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt)
> -{
> -	switch (fmt) {
> -	case OMAP_DSS_DSI_FMT_RGB888:
> -	case OMAP_DSS_DSI_FMT_RGB666:
> -		return 24;
> -	case OMAP_DSS_DSI_FMT_RGB666_PACKED:
> -		return 18;
> -	case OMAP_DSS_DSI_FMT_RGB565:
> -		return 16;
> -	default:
> -		BUG();
> -		return 0;
> -	}
> -}
> -
>  #ifdef DSI_PERF_MEASURE
>  static void dsi_perf_mark_setup(struct dsi_data *dsi)
>  {
> @@ -3239,7 +3224,7 @@ static void dsi_config_vp_num_line_buffers(struct dsi_data *dsi)
>  	int num_line_buffers;
>  
>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
> -		int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> +		int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>  		const struct videomode *vm = &dsi->vm;
>  		/*
>  		 * Don't use line buffers if width is greater than the video
> @@ -3370,7 +3355,7 @@ static void dsi_config_cmd_mode_interleaving(struct dsi_data *dsi)
>  	int tclk_trail, ths_exit, exiths_clk;
>  	bool ddr_alwon;
>  	const struct videomode *vm = &dsi->vm;
> -	int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> +	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>  	int ndl = dsi->num_lanes_used - 1;
>  	int dsi_fclk_hsdiv = dsi->user_dsi_cinfo.mX[HSDIV_DSI] + 1;
>  	int hsa_interleave_hs = 0, hsa_interleave_lp = 0;
> @@ -3498,7 +3483,7 @@ static int dsi_proto_config(struct dsi_data *dsi)
>  	dsi_set_lp_rx_timeout(dsi, 0x1fff, true, true);
>  	dsi_set_hs_tx_timeout(dsi, 0x1fff, true, true);
>  
> -	switch (dsi_get_pixel_size(dsi->pix_fmt)) {
> +	switch (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt)) {
>  	case 16:
>  		buswidth = 0;
>  		break;
> @@ -3619,7 +3604,7 @@ static void dsi_proto_timings(struct dsi_data *dsi)
>  		int window_sync = dsi->vm_timings.window_sync;
>  		bool hsync_end;
>  		const struct videomode *vm = &dsi->vm;
> -		int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> +		int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>  		int tl, t_he, width_bytes;
>  
>  		hsync_end = dsi->vm_timings.trans_mode == OMAP_DSS_DSI_PULSE_MODE;
> @@ -3726,7 +3711,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>  static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> +	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>  	u8 data_type;
>  	u16 word_count;
>  	int r;
> @@ -3737,16 +3722,16 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>  
>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
>  		switch (dsi->pix_fmt) {
> -		case OMAP_DSS_DSI_FMT_RGB888:
> +		case MIPI_DSI_FMT_RGB888:
>  			data_type = MIPI_DSI_PACKED_PIXEL_STREAM_24;
>  			break;
> -		case OMAP_DSS_DSI_FMT_RGB666:
> +		case MIPI_DSI_FMT_RGB666:
>  			data_type = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
>  			break;
> -		case OMAP_DSS_DSI_FMT_RGB666_PACKED:
> +		case MIPI_DSI_FMT_RGB666_PACKED:
>  			data_type = MIPI_DSI_PACKED_PIXEL_STREAM_18;
>  			break;
> -		case OMAP_DSS_DSI_FMT_RGB565:
> +		case MIPI_DSI_FMT_RGB565:
>  			data_type = MIPI_DSI_PACKED_PIXEL_STREAM_16;
>  			break;
>  		default:
> @@ -3824,7 +3809,7 @@ static void dsi_update_screen_dispc(struct dsi_data *dsi)
>  
>  	dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_VP);
>  
> -	bytespp	= dsi_get_pixel_size(dsi->pix_fmt) / 8;
> +	bytespp	= mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) / 8;
>  	bytespl = w * bytespp;
>  	bytespf = bytespl * h;
>  
> @@ -3954,7 +3939,7 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>  
>  #ifdef DSI_PERF_MEASURE
>  	dsi->update_bytes = dw * dh *
> -		dsi_get_pixel_size(dsi->pix_fmt) / 8;
> +		mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) / 8;
>  #endif
>  	dsi_update_screen_dispc(dsi);
>  
> @@ -4015,7 +4000,7 @@ static int dsi_display_init_dispc(struct dsi_data *dsi)
>  
>  	dsi->mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS;
>  	dsi->mgr_config.video_port_width =
> -			dsi_get_pixel_size(dsi->pix_fmt);
> +			mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>  	dsi->mgr_config.lcden_sig_polarity = 0;
>  
>  	dss_mgr_set_lcd_config(&dsi->output, &dsi->mgr_config);
> @@ -4353,7 +4338,7 @@ static bool dsi_cm_calc(struct dsi_data *dsi,
>  	unsigned long pck, txbyteclk;
>  
>  	clkin = clk_get_rate(dsi->pll.clkin);
> -	bitspp = dsi_get_pixel_size(cfg->pixel_format);
> +	bitspp = mipi_dsi_pixel_format_to_bpp(cfg->pixel_format);
>  	ndl = dsi->num_lanes_used - 1;
>  
>  	/*
> @@ -4386,7 +4371,7 @@ static bool dsi_vm_calc_blanking(struct dsi_clk_calc_ctx *ctx)
>  {
>  	struct dsi_data *dsi = ctx->dsi;
>  	const struct omap_dss_dsi_config *cfg = ctx->config;
> -	int bitspp = dsi_get_pixel_size(cfg->pixel_format);
> +	int bitspp = mipi_dsi_pixel_format_to_bpp(cfg->pixel_format);
>  	int ndl = dsi->num_lanes_used - 1;
>  	unsigned long hsclk = ctx->dsi_cinfo.clkdco / 4;
>  	unsigned long byteclk = hsclk / 4;
> @@ -4653,7 +4638,7 @@ static bool dsi_vm_calc(struct dsi_data *dsi,
>  	unsigned long pll_min;
>  	unsigned long pll_max;
>  	int ndl = dsi->num_lanes_used - 1;
> -	int bitspp = dsi_get_pixel_size(cfg->pixel_format);
> +	int bitspp = mipi_dsi_pixel_format_to_bpp(cfg->pixel_format);
>  	unsigned long byteclk_min;
>  
>  	clkin = clk_get_rate(dsi->pll.clkin);
> @@ -4699,6 +4684,12 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
>  	dsi->pix_fmt = config->pixel_format;
>  	dsi->mode = config->mode;
>  
> +	if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) {
> +		DSSERR("invalid pixel format\n");
> +		r = -EINVAL;
> +		goto err;
> +	}
> +
>  	if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
>  		ok = dsi_vm_calc(dsi, config, &ctx);
>  	else
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index b0424daaceed..c4bc1f919ab4 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -12,8 +12,10 @@
>  #include <linux/interrupt.h>
>  #include <video/videomode.h>
>  #include <linux/platform_data/omapdss.h>
> -#include <uapi/drm/drm_mode.h>
> +
>  #include <drm/drm_crtc.h>
> +#include <drm/drm_mipi_dsi.h>
> +#include <drm/drm_mode.h>
>  
>  #define DISPC_IRQ_FRAMEDONE		(1 << 0)
>  #define DISPC_IRQ_VSYNC			(1 << 1)
> @@ -116,13 +118,6 @@ enum omap_dss_venc_type {
>  	OMAP_DSS_VENC_TYPE_SVIDEO,
>  };
>  
> -enum omap_dss_dsi_pixel_format {
> -	OMAP_DSS_DSI_FMT_RGB888,
> -	OMAP_DSS_DSI_FMT_RGB666,
> -	OMAP_DSS_DSI_FMT_RGB666_PACKED,
> -	OMAP_DSS_DSI_FMT_RGB565,
> -};
> -
>  enum omap_dss_dsi_mode {
>  	OMAP_DSS_DSI_CMD_MODE = 0,
>  	OMAP_DSS_DSI_VIDEO_MODE,
> @@ -210,7 +205,7 @@ struct omap_dss_dsi_videomode_timings {
>  
>  struct omap_dss_dsi_config {
>  	enum omap_dss_dsi_mode mode;
> -	enum omap_dss_dsi_pixel_format pixel_format;
> +	enum mipi_dsi_pixel_format pixel_format;
>  	const struct videomode *vm;
>  
>  	unsigned long hs_clk_min, hs_clk_max;

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 04/56] drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_*
@ 2020-11-06  4:56     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  4:56 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:41PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This replaces OMAP specific enum for pixel format with
> common implementation.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 +-
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 55 ++++++++-----------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         | 13 ++---
>  3 files changed, 28 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index ff610d2a13fd..b8f3a7aacbf4 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -595,7 +595,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	int r;
>  	struct omap_dss_dsi_config dsi_config = {
>  		.mode = OMAP_DSS_DSI_CMD_MODE,
> -		.pixel_format = OMAP_DSS_DSI_FMT_RGB888,
> +		.pixel_format = MIPI_DSI_FMT_RGB888,
>  		.vm = &ddata->vm,
>  		.hs_clk_min = 150000000,
>  		.hs_clk_max = 300000000,
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 5598fc8f91db..86b9d435fb94 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -33,6 +33,7 @@
>  #include <linux/component.h>
>  #include <linux/sys_soc.h>
>  
> +#include <drm/drm_mipi_dsi.h>
>  #include <video/mipi_display.h>
>  
>  #include "omapdss.h"
> @@ -410,7 +411,7 @@ struct dsi_data {
>  
>  	struct dss_lcd_mgr_config mgr_config;
>  	struct videomode vm;
> -	enum omap_dss_dsi_pixel_format pix_fmt;
> +	enum mipi_dsi_pixel_format pix_fmt;
>  	enum omap_dss_dsi_mode mode;
>  	struct omap_dss_dsi_videomode_timings vm_timings;
>  
> @@ -514,22 +515,6 @@ static inline bool wait_for_bit_change(struct dsi_data *dsi,
>  	return false;
>  }
>  
> -static u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt)
> -{
> -	switch (fmt) {
> -	case OMAP_DSS_DSI_FMT_RGB888:
> -	case OMAP_DSS_DSI_FMT_RGB666:
> -		return 24;
> -	case OMAP_DSS_DSI_FMT_RGB666_PACKED:
> -		return 18;
> -	case OMAP_DSS_DSI_FMT_RGB565:
> -		return 16;
> -	default:
> -		BUG();
> -		return 0;
> -	}
> -}
> -
>  #ifdef DSI_PERF_MEASURE
>  static void dsi_perf_mark_setup(struct dsi_data *dsi)
>  {
> @@ -3239,7 +3224,7 @@ static void dsi_config_vp_num_line_buffers(struct dsi_data *dsi)
>  	int num_line_buffers;
>  
>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
> -		int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> +		int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>  		const struct videomode *vm = &dsi->vm;
>  		/*
>  		 * Don't use line buffers if width is greater than the video
> @@ -3370,7 +3355,7 @@ static void dsi_config_cmd_mode_interleaving(struct dsi_data *dsi)
>  	int tclk_trail, ths_exit, exiths_clk;
>  	bool ddr_alwon;
>  	const struct videomode *vm = &dsi->vm;
> -	int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> +	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>  	int ndl = dsi->num_lanes_used - 1;
>  	int dsi_fclk_hsdiv = dsi->user_dsi_cinfo.mX[HSDIV_DSI] + 1;
>  	int hsa_interleave_hs = 0, hsa_interleave_lp = 0;
> @@ -3498,7 +3483,7 @@ static int dsi_proto_config(struct dsi_data *dsi)
>  	dsi_set_lp_rx_timeout(dsi, 0x1fff, true, true);
>  	dsi_set_hs_tx_timeout(dsi, 0x1fff, true, true);
>  
> -	switch (dsi_get_pixel_size(dsi->pix_fmt)) {
> +	switch (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt)) {
>  	case 16:
>  		buswidth = 0;
>  		break;
> @@ -3619,7 +3604,7 @@ static void dsi_proto_timings(struct dsi_data *dsi)
>  		int window_sync = dsi->vm_timings.window_sync;
>  		bool hsync_end;
>  		const struct videomode *vm = &dsi->vm;
> -		int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> +		int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>  		int tl, t_he, width_bytes;
>  
>  		hsync_end = dsi->vm_timings.trans_mode == OMAP_DSS_DSI_PULSE_MODE;
> @@ -3726,7 +3711,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>  static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	int bpp = dsi_get_pixel_size(dsi->pix_fmt);
> +	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>  	u8 data_type;
>  	u16 word_count;
>  	int r;
> @@ -3737,16 +3722,16 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>  
>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
>  		switch (dsi->pix_fmt) {
> -		case OMAP_DSS_DSI_FMT_RGB888:
> +		case MIPI_DSI_FMT_RGB888:
>  			data_type = MIPI_DSI_PACKED_PIXEL_STREAM_24;
>  			break;
> -		case OMAP_DSS_DSI_FMT_RGB666:
> +		case MIPI_DSI_FMT_RGB666:
>  			data_type = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
>  			break;
> -		case OMAP_DSS_DSI_FMT_RGB666_PACKED:
> +		case MIPI_DSI_FMT_RGB666_PACKED:
>  			data_type = MIPI_DSI_PACKED_PIXEL_STREAM_18;
>  			break;
> -		case OMAP_DSS_DSI_FMT_RGB565:
> +		case MIPI_DSI_FMT_RGB565:
>  			data_type = MIPI_DSI_PACKED_PIXEL_STREAM_16;
>  			break;
>  		default:
> @@ -3824,7 +3809,7 @@ static void dsi_update_screen_dispc(struct dsi_data *dsi)
>  
>  	dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_VP);
>  
> -	bytespp	= dsi_get_pixel_size(dsi->pix_fmt) / 8;
> +	bytespp	= mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) / 8;
>  	bytespl = w * bytespp;
>  	bytespf = bytespl * h;
>  
> @@ -3954,7 +3939,7 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>  
>  #ifdef DSI_PERF_MEASURE
>  	dsi->update_bytes = dw * dh *
> -		dsi_get_pixel_size(dsi->pix_fmt) / 8;
> +		mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) / 8;
>  #endif
>  	dsi_update_screen_dispc(dsi);
>  
> @@ -4015,7 +4000,7 @@ static int dsi_display_init_dispc(struct dsi_data *dsi)
>  
>  	dsi->mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS;
>  	dsi->mgr_config.video_port_width =
> -			dsi_get_pixel_size(dsi->pix_fmt);
> +			mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>  	dsi->mgr_config.lcden_sig_polarity = 0;
>  
>  	dss_mgr_set_lcd_config(&dsi->output, &dsi->mgr_config);
> @@ -4353,7 +4338,7 @@ static bool dsi_cm_calc(struct dsi_data *dsi,
>  	unsigned long pck, txbyteclk;
>  
>  	clkin = clk_get_rate(dsi->pll.clkin);
> -	bitspp = dsi_get_pixel_size(cfg->pixel_format);
> +	bitspp = mipi_dsi_pixel_format_to_bpp(cfg->pixel_format);
>  	ndl = dsi->num_lanes_used - 1;
>  
>  	/*
> @@ -4386,7 +4371,7 @@ static bool dsi_vm_calc_blanking(struct dsi_clk_calc_ctx *ctx)
>  {
>  	struct dsi_data *dsi = ctx->dsi;
>  	const struct omap_dss_dsi_config *cfg = ctx->config;
> -	int bitspp = dsi_get_pixel_size(cfg->pixel_format);
> +	int bitspp = mipi_dsi_pixel_format_to_bpp(cfg->pixel_format);
>  	int ndl = dsi->num_lanes_used - 1;
>  	unsigned long hsclk = ctx->dsi_cinfo.clkdco / 4;
>  	unsigned long byteclk = hsclk / 4;
> @@ -4653,7 +4638,7 @@ static bool dsi_vm_calc(struct dsi_data *dsi,
>  	unsigned long pll_min;
>  	unsigned long pll_max;
>  	int ndl = dsi->num_lanes_used - 1;
> -	int bitspp = dsi_get_pixel_size(cfg->pixel_format);
> +	int bitspp = mipi_dsi_pixel_format_to_bpp(cfg->pixel_format);
>  	unsigned long byteclk_min;
>  
>  	clkin = clk_get_rate(dsi->pll.clkin);
> @@ -4699,6 +4684,12 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
>  	dsi->pix_fmt = config->pixel_format;
>  	dsi->mode = config->mode;
>  
> +	if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) {
> +		DSSERR("invalid pixel format\n");
> +		r = -EINVAL;
> +		goto err;
> +	}
> +
>  	if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
>  		ok = dsi_vm_calc(dsi, config, &ctx);
>  	else
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index b0424daaceed..c4bc1f919ab4 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -12,8 +12,10 @@
>  #include <linux/interrupt.h>
>  #include <video/videomode.h>
>  #include <linux/platform_data/omapdss.h>
> -#include <uapi/drm/drm_mode.h>
> +
>  #include <drm/drm_crtc.h>
> +#include <drm/drm_mipi_dsi.h>
> +#include <drm/drm_mode.h>
>  
>  #define DISPC_IRQ_FRAMEDONE		(1 << 0)
>  #define DISPC_IRQ_VSYNC			(1 << 1)
> @@ -116,13 +118,6 @@ enum omap_dss_venc_type {
>  	OMAP_DSS_VENC_TYPE_SVIDEO,
>  };
>  
> -enum omap_dss_dsi_pixel_format {
> -	OMAP_DSS_DSI_FMT_RGB888,
> -	OMAP_DSS_DSI_FMT_RGB666,
> -	OMAP_DSS_DSI_FMT_RGB666_PACKED,
> -	OMAP_DSS_DSI_FMT_RGB565,
> -};
> -
>  enum omap_dss_dsi_mode {
>  	OMAP_DSS_DSI_CMD_MODE = 0,
>  	OMAP_DSS_DSI_VIDEO_MODE,
> @@ -210,7 +205,7 @@ struct omap_dss_dsi_videomode_timings {
>  
>  struct omap_dss_dsi_config {
>  	enum omap_dss_dsi_mode mode;
> -	enum omap_dss_dsi_pixel_format pixel_format;
> +	enum mipi_dsi_pixel_format pixel_format;
>  	const struct videomode *vm;
>  
>  	unsigned long hs_clk_min, hs_clk_max;

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 05/56] drm/omap: constify write buffers
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-06  4:57     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  4:57 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:42PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The write buffers are not modified, so they can be constant.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 24 ++++++++++++------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 10 +++++-----
>  2 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 86b9d435fb94..22d74d762a10 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2601,11 +2601,11 @@ static inline void dsi_vc_write_long_payload(struct dsi_data *dsi, int channel,
>  }
>  
>  static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
> -			    u8 *data, u16 len, u8 ecc)
> +			    const u8 *data, u16 len, u8 ecc)
>  {
>  	/*u32 val; */
>  	int i;
> -	u8 *p;
> +	const u8 *p;
>  	int r = 0;
>  	u8 b1, b2, b3, b4;
>  
> @@ -2698,7 +2698,7 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
>  }
>  
>  static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
> -				      u8 *data, int len,
> +				      const u8 *data, int len,
>  				      enum dss_dsi_content_type type)
>  {
>  	int r;
> @@ -2729,7 +2729,7 @@ static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
>  }
>  
>  static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
> -		u8 *data, int len)
> +		const u8 *data, int len)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  
> @@ -2738,7 +2738,7 @@ static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
>  }
>  
>  static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
> -		u8 *data, int len)
> +		const u8 *data, int len)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  
> @@ -2747,7 +2747,7 @@ static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int chann
>  }
>  
>  static int dsi_vc_write_common(struct omap_dss_device *dssdev,
> -			       int channel, u8 *data, int len,
> +			       int channel, const u8 *data, int len,
>  			       enum dss_dsi_content_type type)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> @@ -2776,15 +2776,15 @@ static int dsi_vc_write_common(struct omap_dss_device *dssdev,
>  	return r;
>  }
>  
> -static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data,
> -		int len)
> +static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel,
> +		const u8 *data, int len)
>  {
>  	return dsi_vc_write_common(dssdev, channel, data, len,
>  			DSS_DSI_CONTENT_DCS);
>  }
>  
> -static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 *data,
> -		int len)
> +static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel,
> +		const u8 *data, int len)
>  {
>  	return dsi_vc_write_common(dssdev, channel, data, len,
>  			DSS_DSI_CONTENT_GENERIC);
> @@ -2810,7 +2810,7 @@ static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
>  }
>  
>  static int dsi_vc_generic_send_read_request(struct dsi_data *dsi, int channel,
> -					    u8 *reqdata, int reqlen)
> +					    const u8 *reqdata, int reqlen)
>  {
>  	u16 data;
>  	u8 data_type;
> @@ -2983,7 +2983,7 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_c
>  }
>  
>  static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
> -		u8 *reqdata, int reqlen, u8 *buf, int buflen)
> +		const u8 *reqdata, int reqlen, u8 *buf, int buflen)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	int r;
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index c4bc1f919ab4..8e96ab2f20b6 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -309,18 +309,18 @@ struct omapdss_dsi_ops {
>  
>  	/* data transfer */
>  	int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
> -			u8 *data, int len);
> +			const u8 *data, int len);
>  	int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
> -			u8 *data, int len);
> +			const u8 *data, int len);
>  	int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
>  			u8 *data, int len);
>  
>  	int (*gen_write)(struct omap_dss_device *dssdev, int channel,
> -			u8 *data, int len);
> +			const u8 *data, int len);
>  	int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
> -			u8 *data, int len);
> +			const u8 *data, int len);
>  	int (*gen_read)(struct omap_dss_device *dssdev, int channel,
> -			u8 *reqdata, int reqlen,
> +			const u8 *reqdata, int reqlen,
>  			u8 *data, int len);
>  
>  	int (*bta_sync)(struct omap_dss_device *dssdev, int channel);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 05/56] drm/omap: constify write buffers
@ 2020-11-06  4:57     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  4:57 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:42PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The write buffers are not modified, so they can be constant.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 24 ++++++++++++------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 10 +++++-----
>  2 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 86b9d435fb94..22d74d762a10 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2601,11 +2601,11 @@ static inline void dsi_vc_write_long_payload(struct dsi_data *dsi, int channel,
>  }
>  
>  static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
> -			    u8 *data, u16 len, u8 ecc)
> +			    const u8 *data, u16 len, u8 ecc)
>  {
>  	/*u32 val; */
>  	int i;
> -	u8 *p;
> +	const u8 *p;
>  	int r = 0;
>  	u8 b1, b2, b3, b4;
>  
> @@ -2698,7 +2698,7 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
>  }
>  
>  static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
> -				      u8 *data, int len,
> +				      const u8 *data, int len,
>  				      enum dss_dsi_content_type type)
>  {
>  	int r;
> @@ -2729,7 +2729,7 @@ static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
>  }
>  
>  static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
> -		u8 *data, int len)
> +		const u8 *data, int len)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  
> @@ -2738,7 +2738,7 @@ static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
>  }
>  
>  static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
> -		u8 *data, int len)
> +		const u8 *data, int len)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  
> @@ -2747,7 +2747,7 @@ static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int chann
>  }
>  
>  static int dsi_vc_write_common(struct omap_dss_device *dssdev,
> -			       int channel, u8 *data, int len,
> +			       int channel, const u8 *data, int len,
>  			       enum dss_dsi_content_type type)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> @@ -2776,15 +2776,15 @@ static int dsi_vc_write_common(struct omap_dss_device *dssdev,
>  	return r;
>  }
>  
> -static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data,
> -		int len)
> +static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel,
> +		const u8 *data, int len)
>  {
>  	return dsi_vc_write_common(dssdev, channel, data, len,
>  			DSS_DSI_CONTENT_DCS);
>  }
>  
> -static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 *data,
> -		int len)
> +static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel,
> +		const u8 *data, int len)
>  {
>  	return dsi_vc_write_common(dssdev, channel, data, len,
>  			DSS_DSI_CONTENT_GENERIC);
> @@ -2810,7 +2810,7 @@ static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
>  }
>  
>  static int dsi_vc_generic_send_read_request(struct dsi_data *dsi, int channel,
> -					    u8 *reqdata, int reqlen)
> +					    const u8 *reqdata, int reqlen)
>  {
>  	u16 data;
>  	u8 data_type;
> @@ -2983,7 +2983,7 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_c
>  }
>  
>  static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
> -		u8 *reqdata, int reqlen, u8 *buf, int buflen)
> +		const u8 *reqdata, int reqlen, u8 *buf, int buflen)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	int r;
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index c4bc1f919ab4..8e96ab2f20b6 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -309,18 +309,18 @@ struct omapdss_dsi_ops {
>  
>  	/* data transfer */
>  	int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
> -			u8 *data, int len);
> +			const u8 *data, int len);
>  	int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
> -			u8 *data, int len);
> +			const u8 *data, int len);
>  	int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
>  			u8 *data, int len);
>  
>  	int (*gen_write)(struct omap_dss_device *dssdev, int channel,
> -			u8 *data, int len);
> +			const u8 *data, int len);
>  	int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
> -			u8 *data, int len);
> +			const u8 *data, int len);
>  	int (*gen_read)(struct omap_dss_device *dssdev, int channel,
> -			u8 *reqdata, int reqlen,
> +			const u8 *reqdata, int reqlen,
>  			u8 *data, int len);
>  
>  	int (*bta_sync)(struct omap_dss_device *dssdev, int channel);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 06/56] drm/omap: dsi: add generic transfer function
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-06  5:05     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  5:05 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:43PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This prepares the driver for becoming a mipi_dsi_host implementation,
> which provides a generic transfer function instead of all kind of
> different read/write functions. The implementation will become more
> elegant after unexporting the specific functions in the following
> patches.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 54 +++++++++++++++++++++++++++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 ++
>  2 files changed, 57 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 22d74d762a10..59a62d1d41cb 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4842,6 +4842,58 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
>  	}
>  }
>  
> +static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
> +				 const struct mipi_dsi_msg *msg)
> +{
> +	/*
> +	 * no_sync can be used to optimize performance by sending e.g. column

Can we start this with "TODO: no_sync can ..." to make it standout as
something to be addressed ?

> +	 * and page information without syncing in between. It's not absolutley

s/absolutley/absolutely/

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

> +	 * required, so postpone this feature for now.
> +	 */
> +	bool no_sync = false;
> +	u16 val;
> +
> +	switch (msg->type) {
> +	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
> +	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
> +	case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
> +	case MIPI_DSI_GENERIC_LONG_WRITE:
> +		if (no_sync)
> +			return dsi_vc_generic_write_nosync(dssdev, msg->channel,
> +							   msg->tx_buf,
> +							   msg->tx_len);
> +		else
> +			return dsi_vc_generic_write(dssdev, msg->channel,
> +						    msg->tx_buf, msg->tx_len);
> +	case MIPI_DSI_DCS_SHORT_WRITE:
> +	case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
> +	case MIPI_DSI_DCS_LONG_WRITE:
> +		if (no_sync)
> +			return dsi_vc_dcs_write_nosync(dssdev, msg->channel,
> +						       msg->tx_buf,
> +						       msg->tx_len);
> +		else
> +			return dsi_vc_dcs_write(dssdev, msg->channel,
> +						msg->tx_buf, msg->tx_len);
> +	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
> +	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
> +	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
> +		return dsi_vc_generic_read(dssdev, msg->channel,
> +					   msg->tx_buf, msg->tx_len,
> +					   msg->rx_buf, msg->rx_len);
> +	case MIPI_DSI_DCS_READ:
> +		return dsi_vc_dcs_read(dssdev, msg->channel,
> +				       ((u8 *)msg->tx_buf)[0],
> +				       msg->rx_buf, msg->rx_len);
> +	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
> +		val = le16_to_cpu(*((__le16 *)msg->tx_buf));
> +		return dsi_vc_set_max_rx_packet_size(dssdev, msg->channel, val);
> +	case MIPI_DSI_NULL_PACKET:
> +		return dsi_vc_send_null(to_dsi_data(dssdev), msg->channel);
> +	}
> +
> +	return -EINVAL;
> +}
>  
>  static int dsi_get_clocks(struct dsi_data *dsi)
>  {
> @@ -4896,6 +4948,8 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.set_vc_id = dsi_set_vc_id,
>  		.release_vc = dsi_release_vc,
>  
> +		.transfer = omap_dsi_transfer,
> +
>  		.dcs_write = dsi_vc_dcs_write,
>  		.dcs_write_nosync = dsi_vc_dcs_write_nosync,
>  		.dcs_read = dsi_vc_dcs_read,
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 8e96ab2f20b6..654618e5a4e5 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -308,6 +308,9 @@ struct omapdss_dsi_ops {
>  	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
>  
>  	/* data transfer */
> +	ssize_t (*transfer)(struct omap_dss_device *dssdev,
> +			    const struct mipi_dsi_msg *msg);
> +
>  	int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
>  			const u8 *data, int len);
>  	int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 06/56] drm/omap: dsi: add generic transfer function
@ 2020-11-06  5:05     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  5:05 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:43PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This prepares the driver for becoming a mipi_dsi_host implementation,
> which provides a generic transfer function instead of all kind of
> different read/write functions. The implementation will become more
> elegant after unexporting the specific functions in the following
> patches.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 54 +++++++++++++++++++++++++++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 ++
>  2 files changed, 57 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 22d74d762a10..59a62d1d41cb 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4842,6 +4842,58 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
>  	}
>  }
>  
> +static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
> +				 const struct mipi_dsi_msg *msg)
> +{
> +	/*
> +	 * no_sync can be used to optimize performance by sending e.g. column

Can we start this with "TODO: no_sync can ..." to make it standout as
something to be addressed ?

> +	 * and page information without syncing in between. It's not absolutley

s/absolutley/absolutely/

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

> +	 * required, so postpone this feature for now.
> +	 */
> +	bool no_sync = false;
> +	u16 val;
> +
> +	switch (msg->type) {
> +	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
> +	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
> +	case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
> +	case MIPI_DSI_GENERIC_LONG_WRITE:
> +		if (no_sync)
> +			return dsi_vc_generic_write_nosync(dssdev, msg->channel,
> +							   msg->tx_buf,
> +							   msg->tx_len);
> +		else
> +			return dsi_vc_generic_write(dssdev, msg->channel,
> +						    msg->tx_buf, msg->tx_len);
> +	case MIPI_DSI_DCS_SHORT_WRITE:
> +	case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
> +	case MIPI_DSI_DCS_LONG_WRITE:
> +		if (no_sync)
> +			return dsi_vc_dcs_write_nosync(dssdev, msg->channel,
> +						       msg->tx_buf,
> +						       msg->tx_len);
> +		else
> +			return dsi_vc_dcs_write(dssdev, msg->channel,
> +						msg->tx_buf, msg->tx_len);
> +	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
> +	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
> +	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
> +		return dsi_vc_generic_read(dssdev, msg->channel,
> +					   msg->tx_buf, msg->tx_len,
> +					   msg->rx_buf, msg->rx_len);
> +	case MIPI_DSI_DCS_READ:
> +		return dsi_vc_dcs_read(dssdev, msg->channel,
> +				       ((u8 *)msg->tx_buf)[0],
> +				       msg->rx_buf, msg->rx_len);
> +	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
> +		val = le16_to_cpu(*((__le16 *)msg->tx_buf));
> +		return dsi_vc_set_max_rx_packet_size(dssdev, msg->channel, val);
> +	case MIPI_DSI_NULL_PACKET:
> +		return dsi_vc_send_null(to_dsi_data(dssdev), msg->channel);
> +	}
> +
> +	return -EINVAL;
> +}
>  
>  static int dsi_get_clocks(struct dsi_data *dsi)
>  {
> @@ -4896,6 +4948,8 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.set_vc_id = dsi_set_vc_id,
>  		.release_vc = dsi_release_vc,
>  
> +		.transfer = omap_dsi_transfer,
> +
>  		.dcs_write = dsi_vc_dcs_write,
>  		.dcs_write_nosync = dsi_vc_dcs_write_nosync,
>  		.dcs_read = dsi_vc_dcs_read,
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 8e96ab2f20b6..654618e5a4e5 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -308,6 +308,9 @@ struct omapdss_dsi_ops {
>  	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
>  
>  	/* data transfer */
> +	ssize_t (*transfer)(struct omap_dss_device *dssdev,
> +			    const struct mipi_dsi_msg *msg);
> +
>  	int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
>  			const u8 *data, int len);
>  	int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 07/56] drm/omap: panel-dsi-cm: convert to transfer API
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-06  5:08     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  5:08 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:44PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This converts the panel-dsi-cm driver to use the transfer
> API instead of specific functions, so that the specific
> functions can be unexported and squashed into the generic
> transfer function.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

There are a few very minor comments I would have made below, but as this
file is going away later in this series, it doesn't matter.

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 132 +++++++++++++-----
>  1 file changed, 95 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index b8f3a7aacbf4..8b2e80129bd8 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -140,45 +140,61 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
>  static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
>  {
>  	struct omap_dss_device *src = ddata->src;
> -	int r;
> -	u8 buf[1];
> -
> -	r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd, buf, 1);
> -
> -	if (r < 0)
> -		return r;
> -
> -	*data = buf[0];
> +	const struct mipi_dsi_msg msg = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_DCS_READ,
> +		.tx_len = 1,
> +		.tx_buf = &dcs_cmd,
> +		.rx_len = 1,
> +		.rx_buf = data
> +	};
>  
> -	return 0;
> +	return src->ops->dsi.transfer(src, &msg);
>  }
>  
>  static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
>  {
>  	struct omap_dss_device *src = ddata->src;
> +	const struct mipi_dsi_msg msg = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_DCS_SHORT_WRITE,
> +		.tx_buf = &dcs_cmd,
> +		.tx_len = 1,
> +	};
>  
> -	return src->ops->dsi.dcs_write(src, ddata->channel, &dcs_cmd, 1);
> +	return src->ops->dsi.transfer(src, &msg);
>  }
>  
>  static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
>  {
>  	struct omap_dss_device *src = ddata->src;
> -	u8 buf[2] = { dcs_cmd, param };
> +	const u8 buf[] = { dcs_cmd, param };
> +	const struct mipi_dsi_msg msg = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_DCS_SHORT_WRITE_PARAM,
> +		.tx_buf = &buf,
> +		.tx_len = 2,
> +	};
>  
> -	return src->ops->dsi.dcs_write(src, ddata->channel, buf, 2);
> +	return src->ops->dsi.transfer(src, &msg);
>  }
>  
>  static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>  {
>  	struct omap_dss_device *src = ddata->src;
> -	u8 cmd;
>  	int r;
> +	const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
> +	const struct mipi_dsi_msg msg = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_DCS_SHORT_WRITE,
> +		.tx_buf = &cmd,
> +		.tx_len = 1,
> +	};
>  
>  	hw_guard_wait(ddata);
>  
> -	cmd = MIPI_DCS_ENTER_SLEEP_MODE;
> -	r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, &cmd, 1);
> +	r = src->ops->dsi.transfer(src, &msg);
>  	if (r)
>  		return r;
>  
> @@ -233,28 +249,43 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
>  	u16 y1 = y;
>  	u16 y2 = y + h - 1;
>  
> -	u8 buf[5];
> -	buf[0] = MIPI_DCS_SET_COLUMN_ADDRESS;
> -	buf[1] = (x1 >> 8) & 0xff;
> -	buf[2] = (x1 >> 0) & 0xff;
> -	buf[3] = (x2 >> 8) & 0xff;
> -	buf[4] = (x2 >> 0) & 0xff;
> +	const u8 paramX[] = {
> +		MIPI_DCS_SET_COLUMN_ADDRESS,
> +		(x1 >> 8) & 0xff,
> +		(x1 >> 0) & 0xff,
> +		(x2 >> 8) & 0xff,
> +		(x2 >> 0) & 0xff,
> +	};
>  
> -	r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, sizeof(buf));
> -	if (r)
> -		return r;
> +	const struct mipi_dsi_msg msgX = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_GENERIC_LONG_WRITE,
> +		.tx_buf = paramX,
> +		.tx_len = 5,
> +	};
> +
> +	const u8 paramY[] = {
> +		MIPI_DCS_SET_PAGE_ADDRESS,
> +		(y1 >> 8) & 0xff,
> +		(y1 >> 0) & 0xff,
> +		(y2 >> 8) & 0xff,
> +		(y2 >> 0) & 0xff,
> +	};
>  
> -	buf[0] = MIPI_DCS_SET_PAGE_ADDRESS;
> -	buf[1] = (y1 >> 8) & 0xff;
> -	buf[2] = (y1 >> 0) & 0xff;
> -	buf[3] = (y2 >> 8) & 0xff;
> -	buf[4] = (y2 >> 0) & 0xff;
> +	const struct mipi_dsi_msg msgY = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_GENERIC_LONG_WRITE,
> +		.tx_buf = paramY,
> +		.tx_len = 5,
> +	};
>  
> -	r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, sizeof(buf));
> +	r = src->ops->dsi.transfer(src, &msgX);
>  	if (r)
>  		return r;
>  
> -	src->ops->dsi.bta_sync(src, ddata->channel);
> +	r = src->ops->dsi.transfer(src, &msgY);
> +	if (r)
> +		return r;
>  
>  	return r;
>  }
> @@ -991,6 +1022,27 @@ static int dsicm_get_te(struct omap_dss_device *dssdev)
>  	return r;
>  }
>  
> +static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
> +					u16 size)
> +{
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	struct omap_dss_device *src = ddata->src;
> +
> +	const u8 buf[] = {
> +		size & 0xff,
> +		size >> 8 & 0xff,
> +	};
> +
> +	const struct mipi_dsi_msg msg = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
> +		.tx_buf = buf,
> +		.tx_len = 2,
> +	};
> +
> +	return src->ops->dsi.transfer(src, &msg);
> +}
> +
>  static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  		void *buf, size_t size,
>  		u16 x, u16 y, u16 w, u16 h)
> @@ -1031,17 +1083,23 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  
>  	dsicm_set_update_window(ddata, x, y, w, h);
>  
> -	r = src->ops->dsi.set_max_rx_packet_size(src, ddata->channel, plen);
> +	r = dsicm_set_max_rx_packet_size(dssdev, plen);
>  	if (r)
>  		goto err2;
>  
>  	while (buf_used < size) {
>  		u8 dcs_cmd = first ? 0x2e : 0x3e;
> +		const struct mipi_dsi_msg msg = {
> +			.channel = ddata->channel,
> +			.type = MIPI_DSI_DCS_READ,
> +			.tx_buf = &dcs_cmd,
> +			.tx_len = 1,
> +			.rx_buf = buf + buf_used,
> +			.rx_len = size - buf_used,
> +		};
>  		first = 0;
>  
> -		r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd,
> -				buf + buf_used, size - buf_used);
> -
> +		r = src->ops->dsi.transfer(src, &msg);
>  		if (r < 0) {
>  			dev_err(dssdev->dev, "read error\n");
>  			goto err3;
> @@ -1065,7 +1123,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  	r = buf_used;
>  
>  err3:
> -	src->ops->dsi.set_max_rx_packet_size(src, ddata->channel, 1);
> +	dsicm_set_max_rx_packet_size(dssdev, 1);
>  err2:
>  	src->ops->dsi.bus_unlock(src);
>  err1:

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 07/56] drm/omap: panel-dsi-cm: convert to transfer API
@ 2020-11-06  5:08     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-06  5:08 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:44PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This converts the panel-dsi-cm driver to use the transfer
> API instead of specific functions, so that the specific
> functions can be unexported and squashed into the generic
> transfer function.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

There are a few very minor comments I would have made below, but as this
file is going away later in this series, it doesn't matter.

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 132 +++++++++++++-----
>  1 file changed, 95 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index b8f3a7aacbf4..8b2e80129bd8 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -140,45 +140,61 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
>  static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
>  {
>  	struct omap_dss_device *src = ddata->src;
> -	int r;
> -	u8 buf[1];
> -
> -	r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd, buf, 1);
> -
> -	if (r < 0)
> -		return r;
> -
> -	*data = buf[0];
> +	const struct mipi_dsi_msg msg = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_DCS_READ,
> +		.tx_len = 1,
> +		.tx_buf = &dcs_cmd,
> +		.rx_len = 1,
> +		.rx_buf = data
> +	};
>  
> -	return 0;
> +	return src->ops->dsi.transfer(src, &msg);
>  }
>  
>  static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
>  {
>  	struct omap_dss_device *src = ddata->src;
> +	const struct mipi_dsi_msg msg = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_DCS_SHORT_WRITE,
> +		.tx_buf = &dcs_cmd,
> +		.tx_len = 1,
> +	};
>  
> -	return src->ops->dsi.dcs_write(src, ddata->channel, &dcs_cmd, 1);
> +	return src->ops->dsi.transfer(src, &msg);
>  }
>  
>  static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
>  {
>  	struct omap_dss_device *src = ddata->src;
> -	u8 buf[2] = { dcs_cmd, param };
> +	const u8 buf[] = { dcs_cmd, param };
> +	const struct mipi_dsi_msg msg = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_DCS_SHORT_WRITE_PARAM,
> +		.tx_buf = &buf,
> +		.tx_len = 2,
> +	};
>  
> -	return src->ops->dsi.dcs_write(src, ddata->channel, buf, 2);
> +	return src->ops->dsi.transfer(src, &msg);
>  }
>  
>  static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>  {
>  	struct omap_dss_device *src = ddata->src;
> -	u8 cmd;
>  	int r;
> +	const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
> +	const struct mipi_dsi_msg msg = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_DCS_SHORT_WRITE,
> +		.tx_buf = &cmd,
> +		.tx_len = 1,
> +	};
>  
>  	hw_guard_wait(ddata);
>  
> -	cmd = MIPI_DCS_ENTER_SLEEP_MODE;
> -	r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, &cmd, 1);
> +	r = src->ops->dsi.transfer(src, &msg);
>  	if (r)
>  		return r;
>  
> @@ -233,28 +249,43 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
>  	u16 y1 = y;
>  	u16 y2 = y + h - 1;
>  
> -	u8 buf[5];
> -	buf[0] = MIPI_DCS_SET_COLUMN_ADDRESS;
> -	buf[1] = (x1 >> 8) & 0xff;
> -	buf[2] = (x1 >> 0) & 0xff;
> -	buf[3] = (x2 >> 8) & 0xff;
> -	buf[4] = (x2 >> 0) & 0xff;
> +	const u8 paramX[] = {
> +		MIPI_DCS_SET_COLUMN_ADDRESS,
> +		(x1 >> 8) & 0xff,
> +		(x1 >> 0) & 0xff,
> +		(x2 >> 8) & 0xff,
> +		(x2 >> 0) & 0xff,
> +	};
>  
> -	r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, sizeof(buf));
> -	if (r)
> -		return r;
> +	const struct mipi_dsi_msg msgX = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_GENERIC_LONG_WRITE,
> +		.tx_buf = paramX,
> +		.tx_len = 5,
> +	};
> +
> +	const u8 paramY[] = {
> +		MIPI_DCS_SET_PAGE_ADDRESS,
> +		(y1 >> 8) & 0xff,
> +		(y1 >> 0) & 0xff,
> +		(y2 >> 8) & 0xff,
> +		(y2 >> 0) & 0xff,
> +	};
>  
> -	buf[0] = MIPI_DCS_SET_PAGE_ADDRESS;
> -	buf[1] = (y1 >> 8) & 0xff;
> -	buf[2] = (y1 >> 0) & 0xff;
> -	buf[3] = (y2 >> 8) & 0xff;
> -	buf[4] = (y2 >> 0) & 0xff;
> +	const struct mipi_dsi_msg msgY = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_GENERIC_LONG_WRITE,
> +		.tx_buf = paramY,
> +		.tx_len = 5,
> +	};
>  
> -	r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, sizeof(buf));
> +	r = src->ops->dsi.transfer(src, &msgX);
>  	if (r)
>  		return r;
>  
> -	src->ops->dsi.bta_sync(src, ddata->channel);
> +	r = src->ops->dsi.transfer(src, &msgY);
> +	if (r)
> +		return r;
>  
>  	return r;
>  }
> @@ -991,6 +1022,27 @@ static int dsicm_get_te(struct omap_dss_device *dssdev)
>  	return r;
>  }
>  
> +static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
> +					u16 size)
> +{
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	struct omap_dss_device *src = ddata->src;
> +
> +	const u8 buf[] = {
> +		size & 0xff,
> +		size >> 8 & 0xff,
> +	};
> +
> +	const struct mipi_dsi_msg msg = {
> +		.channel = ddata->channel,
> +		.type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
> +		.tx_buf = buf,
> +		.tx_len = 2,
> +	};
> +
> +	return src->ops->dsi.transfer(src, &msg);
> +}
> +
>  static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  		void *buf, size_t size,
>  		u16 x, u16 y, u16 w, u16 h)
> @@ -1031,17 +1083,23 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  
>  	dsicm_set_update_window(ddata, x, y, w, h);
>  
> -	r = src->ops->dsi.set_max_rx_packet_size(src, ddata->channel, plen);
> +	r = dsicm_set_max_rx_packet_size(dssdev, plen);
>  	if (r)
>  		goto err2;
>  
>  	while (buf_used < size) {
>  		u8 dcs_cmd = first ? 0x2e : 0x3e;
> +		const struct mipi_dsi_msg msg = {
> +			.channel = ddata->channel,
> +			.type = MIPI_DSI_DCS_READ,
> +			.tx_buf = &dcs_cmd,
> +			.tx_len = 1,
> +			.rx_buf = buf + buf_used,
> +			.rx_len = size - buf_used,
> +		};
>  		first = 0;
>  
> -		r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd,
> -				buf + buf_used, size - buf_used);
> -
> +		r = src->ops->dsi.transfer(src, &msg);
>  		if (r < 0) {
>  			dev_err(dssdev->dev, "read error\n");
>  			goto err3;
> @@ -1065,7 +1123,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  	r = buf_used;
>  
>  err3:
> -	src->ops->dsi.set_max_rx_packet_size(src, ddata->channel, 1);
> +	dsicm_set_max_rx_packet_size(dssdev, 1);
>  err2:
>  	src->ops->dsi.bus_unlock(src);
>  err1:

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-05 18:56           ` H. Nikolaus Schaller
@ 2020-11-06 14:37             ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-06 14:37 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren

On 05/11/2020 20:56, H. Nikolaus Schaller wrote:
> 
>> Am 05.11.2020 um 19:28 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>
>> On 05/11/2020 20:14, H. Nikolaus Schaller wrote:
>>>
>>>> Am 05.11.2020 um 18:36 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>>
>>>> Hi,
>>>>
>>>> On 05/11/2020 19:15, H. Nikolaus Schaller wrote:
>>>>
>>>>> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
>>>>> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
>>>>> I followed the latest existing panel-orisetech-otm8009a.c which uses a
>>>>> similar video mode controller and mipi-dsi.
>>>>>
>>>>> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
>>>>>
>>>>> Unfortunately my panel driver is not even loaded by drm/omap so I can't
>>>>> debug. Does this set of drm/omap drivers need a modification of the device
>>>>> tree? If yes, which one?
>>>>
>>>> omapdrm doesn't load the panel drivers. If not even your panel's probe is called, then it hints at
>>>> DT and/or driver's compatible string issue. The panel's probe should get called even if omapdrm is
>>>> not loaded at all.
>>>
>>> Well, I use the same device tree that loads the old driver...
>>
>> Yeah, I was mistaken above. With DSI the panel (may be) a child of the DSI host, so it will affect.
>>
>> Can you give pointers to the panel driver source and relevant dts files? BOE BTL507212-W677L?
> 
> Yes. It is (now) 
> 
> drivers/gpu/drm/panel/panel-boe-btl507212-w677l.c
> 
> and
> 
> arch/arm/boot/dts/omap5-letux-cortex15-common.dtsi (for the basic dsi definitions)
> arch/arm/boot/dts/pyra-display.dtsi (for the specific display)
> 
> All this is merged by some arch/arm/boot/dts/omap5-letux-cortex15-v5.3+pyra-v5.2.dts

I took the driver and make my omap4-sdp dts to use it. It probes for me, but stop after that:

[  119.346374] omapdss_dss 58000000.dss: supply vdda_video not found, using dummy regulator
[  119.358398] DSS: OMAP DSS rev 4.0
[  119.680053] panel-dsi-cm 58004000.encoder.0: failed to get video timing, using defaults
[  119.695709] panel-dsi-cm 58004000.encoder.0: supply vpnl not found, using dummy regulator
[  119.711242] panel-dsi-cm 58004000.encoder.0: supply vddi not found, using dummy regulator
[  119.769470] panel-btl507212-w677l 58005000.encoder.0: w677l_probe
[  119.779388] panel-btl507212-w677l 58005000.encoder.0: w677l_probe ok
[  119.846679] omapdss_dss 58000000.dss: bound 58001000.dispc (ops dispc_component_ops [omapdrm])
[  119.858673] omapdss_dss 58000000.dss: bound 58004000.encoder (ops dsi_component_ops [omapdrm])
[  119.882629] omapdss_dss 58000000.dss: bound 58005000.encoder (ops dsi_component_ops [omapdrm])
[  119.902069] omapdss_dss 58000000.dss: bound 58006000.encoder (ops hdmi4_component_ops [omapdrm])
[  119.962066] dmm 4e000000.dmm: initialized all PAT entries
[  120.014770] panel-btl507212-w677l 58005000.encoder.0: w677l_get_modes

I didn't debug yet where it's hanging. So you're not even getting the probe?

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-06 14:37             ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-06 14:37 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

On 05/11/2020 20:56, H. Nikolaus Schaller wrote:
> 
>> Am 05.11.2020 um 19:28 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>
>> On 05/11/2020 20:14, H. Nikolaus Schaller wrote:
>>>
>>>> Am 05.11.2020 um 18:36 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>>
>>>> Hi,
>>>>
>>>> On 05/11/2020 19:15, H. Nikolaus Schaller wrote:
>>>>
>>>>> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
>>>>> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
>>>>> I followed the latest existing panel-orisetech-otm8009a.c which uses a
>>>>> similar video mode controller and mipi-dsi.
>>>>>
>>>>> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
>>>>>
>>>>> Unfortunately my panel driver is not even loaded by drm/omap so I can't
>>>>> debug. Does this set of drm/omap drivers need a modification of the device
>>>>> tree? If yes, which one?
>>>>
>>>> omapdrm doesn't load the panel drivers. If not even your panel's probe is called, then it hints at
>>>> DT and/or driver's compatible string issue. The panel's probe should get called even if omapdrm is
>>>> not loaded at all.
>>>
>>> Well, I use the same device tree that loads the old driver...
>>
>> Yeah, I was mistaken above. With DSI the panel (may be) a child of the DSI host, so it will affect.
>>
>> Can you give pointers to the panel driver source and relevant dts files? BOE BTL507212-W677L?
> 
> Yes. It is (now) 
> 
> drivers/gpu/drm/panel/panel-boe-btl507212-w677l.c
> 
> and
> 
> arch/arm/boot/dts/omap5-letux-cortex15-common.dtsi (for the basic dsi definitions)
> arch/arm/boot/dts/pyra-display.dtsi (for the specific display)
> 
> All this is merged by some arch/arm/boot/dts/omap5-letux-cortex15-v5.3+pyra-v5.2.dts

I took the driver and make my omap4-sdp dts to use it. It probes for me, but stop after that:

[  119.346374] omapdss_dss 58000000.dss: supply vdda_video not found, using dummy regulator
[  119.358398] DSS: OMAP DSS rev 4.0
[  119.680053] panel-dsi-cm 58004000.encoder.0: failed to get video timing, using defaults
[  119.695709] panel-dsi-cm 58004000.encoder.0: supply vpnl not found, using dummy regulator
[  119.711242] panel-dsi-cm 58004000.encoder.0: supply vddi not found, using dummy regulator
[  119.769470] panel-btl507212-w677l 58005000.encoder.0: w677l_probe
[  119.779388] panel-btl507212-w677l 58005000.encoder.0: w677l_probe ok
[  119.846679] omapdss_dss 58000000.dss: bound 58001000.dispc (ops dispc_component_ops [omapdrm])
[  119.858673] omapdss_dss 58000000.dss: bound 58004000.encoder (ops dsi_component_ops [omapdrm])
[  119.882629] omapdss_dss 58000000.dss: bound 58005000.encoder (ops dsi_component_ops [omapdrm])
[  119.902069] omapdss_dss 58000000.dss: bound 58006000.encoder (ops hdmi4_component_ops [omapdrm])
[  119.962066] dmm 4e000000.dmm: initialized all PAT entries
[  120.014770] panel-btl507212-w677l 58005000.encoder.0: w677l_get_modes

I didn't debug yet where it's hanging. So you're not even getting the probe?

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-06 14:37             ` Tomi Valkeinen
@ 2020-11-06 15:04               ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-06 15:04 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren

On 06/11/2020 16:37, Tomi Valkeinen wrote:
> On 05/11/2020 20:56, H. Nikolaus Schaller wrote:
>>
>>> Am 05.11.2020 um 19:28 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>
>>> On 05/11/2020 20:14, H. Nikolaus Schaller wrote:
>>>>
>>>>> Am 05.11.2020 um 18:36 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>>>
>>>>> Hi,
>>>>>
>>>>> On 05/11/2020 19:15, H. Nikolaus Schaller wrote:
>>>>>
>>>>>> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
>>>>>> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
>>>>>> I followed the latest existing panel-orisetech-otm8009a.c which uses a
>>>>>> similar video mode controller and mipi-dsi.
>>>>>>
>>>>>> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
>>>>>>
>>>>>> Unfortunately my panel driver is not even loaded by drm/omap so I can't
>>>>>> debug. Does this set of drm/omap drivers need a modification of the device
>>>>>> tree? If yes, which one?
>>>>>
>>>>> omapdrm doesn't load the panel drivers. If not even your panel's probe is called, then it hints at
>>>>> DT and/or driver's compatible string issue. The panel's probe should get called even if omapdrm is
>>>>> not loaded at all.
>>>>
>>>> Well, I use the same device tree that loads the old driver...
>>>
>>> Yeah, I was mistaken above. With DSI the panel (may be) a child of the DSI host, so it will affect.
>>>
>>> Can you give pointers to the panel driver source and relevant dts files? BOE BTL507212-W677L?
>>
>> Yes. It is (now) 
>>
>> drivers/gpu/drm/panel/panel-boe-btl507212-w677l.c
>>
>> and
>>
>> arch/arm/boot/dts/omap5-letux-cortex15-common.dtsi (for the basic dsi definitions)
>> arch/arm/boot/dts/pyra-display.dtsi (for the specific display)
>>
>> All this is merged by some arch/arm/boot/dts/omap5-letux-cortex15-v5.3+pyra-v5.2.dts
> 
> I took the driver and make my omap4-sdp dts to use it. It probes for me, but stop after that:
> 
> [  119.346374] omapdss_dss 58000000.dss: supply vdda_video not found, using dummy regulator
> [  119.358398] DSS: OMAP DSS rev 4.0
> [  119.680053] panel-dsi-cm 58004000.encoder.0: failed to get video timing, using defaults
> [  119.695709] panel-dsi-cm 58004000.encoder.0: supply vpnl not found, using dummy regulator
> [  119.711242] panel-dsi-cm 58004000.encoder.0: supply vddi not found, using dummy regulator
> [  119.769470] panel-btl507212-w677l 58005000.encoder.0: w677l_probe
> [  119.779388] panel-btl507212-w677l 58005000.encoder.0: w677l_probe ok
> [  119.846679] omapdss_dss 58000000.dss: bound 58001000.dispc (ops dispc_component_ops [omapdrm])
> [  119.858673] omapdss_dss 58000000.dss: bound 58004000.encoder (ops dsi_component_ops [omapdrm])
> [  119.882629] omapdss_dss 58000000.dss: bound 58005000.encoder (ops dsi_component_ops [omapdrm])
> [  119.902069] omapdss_dss 58000000.dss: bound 58006000.encoder (ops hdmi4_component_ops [omapdrm])
> [  119.962066] dmm 4e000000.dmm: initialized all PAT entries
> [  120.014770] panel-btl507212-w677l 58005000.encoder.0: w677l_get_modes
> 
> I didn't debug yet where it's hanging. So you're not even getting the probe?

Oh, it's stuck in a loop trying to calculate suitable timings. It doesn't find it, as I'm running on
omap4, with just 2 datalanes instead of 4 which the panel needs. Looks like the code could use some
improvement there.

Anyway, possibly on omap5 it goes fine.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-06 15:04               ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-06 15:04 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

On 06/11/2020 16:37, Tomi Valkeinen wrote:
> On 05/11/2020 20:56, H. Nikolaus Schaller wrote:
>>
>>> Am 05.11.2020 um 19:28 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>
>>> On 05/11/2020 20:14, H. Nikolaus Schaller wrote:
>>>>
>>>>> Am 05.11.2020 um 18:36 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>>>
>>>>> Hi,
>>>>>
>>>>> On 05/11/2020 19:15, H. Nikolaus Schaller wrote:
>>>>>
>>>>>> Next, I migrated my long waiting mipi_dsi/drm_panel driver conversion for
>>>>>> the panel of the Pyra handheld (omap 5 based) to compile on 5.10-rc2. And
>>>>>> I followed the latest existing panel-orisetech-otm8009a.c which uses a
>>>>>> similar video mode controller and mipi-dsi.
>>>>>>
>>>>>> That one seems to be used by arch/arm/boot/dts/stm32f469-disco.dts.
>>>>>>
>>>>>> Unfortunately my panel driver is not even loaded by drm/omap so I can't
>>>>>> debug. Does this set of drm/omap drivers need a modification of the device
>>>>>> tree? If yes, which one?
>>>>>
>>>>> omapdrm doesn't load the panel drivers. If not even your panel's probe is called, then it hints at
>>>>> DT and/or driver's compatible string issue. The panel's probe should get called even if omapdrm is
>>>>> not loaded at all.
>>>>
>>>> Well, I use the same device tree that loads the old driver...
>>>
>>> Yeah, I was mistaken above. With DSI the panel (may be) a child of the DSI host, so it will affect.
>>>
>>> Can you give pointers to the panel driver source and relevant dts files? BOE BTL507212-W677L?
>>
>> Yes. It is (now) 
>>
>> drivers/gpu/drm/panel/panel-boe-btl507212-w677l.c
>>
>> and
>>
>> arch/arm/boot/dts/omap5-letux-cortex15-common.dtsi (for the basic dsi definitions)
>> arch/arm/boot/dts/pyra-display.dtsi (for the specific display)
>>
>> All this is merged by some arch/arm/boot/dts/omap5-letux-cortex15-v5.3+pyra-v5.2.dts
> 
> I took the driver and make my omap4-sdp dts to use it. It probes for me, but stop after that:
> 
> [  119.346374] omapdss_dss 58000000.dss: supply vdda_video not found, using dummy regulator
> [  119.358398] DSS: OMAP DSS rev 4.0
> [  119.680053] panel-dsi-cm 58004000.encoder.0: failed to get video timing, using defaults
> [  119.695709] panel-dsi-cm 58004000.encoder.0: supply vpnl not found, using dummy regulator
> [  119.711242] panel-dsi-cm 58004000.encoder.0: supply vddi not found, using dummy regulator
> [  119.769470] panel-btl507212-w677l 58005000.encoder.0: w677l_probe
> [  119.779388] panel-btl507212-w677l 58005000.encoder.0: w677l_probe ok
> [  119.846679] omapdss_dss 58000000.dss: bound 58001000.dispc (ops dispc_component_ops [omapdrm])
> [  119.858673] omapdss_dss 58000000.dss: bound 58004000.encoder (ops dsi_component_ops [omapdrm])
> [  119.882629] omapdss_dss 58000000.dss: bound 58005000.encoder (ops dsi_component_ops [omapdrm])
> [  119.902069] omapdss_dss 58000000.dss: bound 58006000.encoder (ops hdmi4_component_ops [omapdrm])
> [  119.962066] dmm 4e000000.dmm: initialized all PAT entries
> [  120.014770] panel-btl507212-w677l 58005000.encoder.0: w677l_get_modes
> 
> I didn't debug yet where it's hanging. So you're not even getting the probe?

Oh, it's stuck in a loop trying to calculate suitable timings. It doesn't find it, as I'm running on
omap4, with just 2 datalanes instead of 4 which the panel needs. Looks like the code could use some
improvement there.

Anyway, possibly on omap5 it goes fine.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-06 15:04               ` Tomi Valkeinen
@ 2020-11-07 12:19                 ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-07 12:19 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren

Hi Tomi,

> Am 06.11.2020 um 16:04 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
>> 
>> I took the driver and make my omap4-sdp dts to use it. It probes for me, but stop after that:
>> 
>> [  119.346374] omapdss_dss 58000000.dss: supply vdda_video not found, using dummy regulator
>> [  119.358398] DSS: OMAP DSS rev 4.0
>> [  119.680053] panel-dsi-cm 58004000.encoder.0: failed to get video timing, using defaults
>> [  119.695709] panel-dsi-cm 58004000.encoder.0: supply vpnl not found, using dummy regulator
>> [  119.711242] panel-dsi-cm 58004000.encoder.0: supply vddi not found, using dummy regulator
>> [  119.769470] panel-btl507212-w677l 58005000.encoder.0: w677l_probe
>> [  119.779388] panel-btl507212-w677l 58005000.encoder.0: w677l_probe ok
>> [  119.846679] omapdss_dss 58000000.dss: bound 58001000.dispc (ops dispc_component_ops [omapdrm])
>> [  119.858673] omapdss_dss 58000000.dss: bound 58004000.encoder (ops dsi_component_ops [omapdrm])
>> [  119.882629] omapdss_dss 58000000.dss: bound 58005000.encoder (ops dsi_component_ops [omapdrm])
>> [  119.902069] omapdss_dss 58000000.dss: bound 58006000.encoder (ops hdmi4_component_ops [omapdrm])
>> [  119.962066] dmm 4e000000.dmm: initialized all PAT entries
>> [  120.014770] panel-btl507212-w677l 58005000.encoder.0: w677l_get_modes
>> 
>> I didn't debug yet where it's hanging. So you're not even getting the probe?
> 
> Oh, it's stuck in a loop trying to calculate suitable timings. It doesn't find it, as I'm running on
> omap4, with just 2 datalanes instead of 4 which the panel needs. Looks like the code could use some
> improvement there.
> 
> Anyway, possibly on omap5 it goes fine.

I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().

I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
And hopefully we are close to push the panel driver for review. And in a second step some device
tree for the Pyra.

The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel

BR and thanks,
Nikolaus


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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-07 12:19                 ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-07 12:19 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

Hi Tomi,

> Am 06.11.2020 um 16:04 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
>> 
>> I took the driver and make my omap4-sdp dts to use it. It probes for me, but stop after that:
>> 
>> [  119.346374] omapdss_dss 58000000.dss: supply vdda_video not found, using dummy regulator
>> [  119.358398] DSS: OMAP DSS rev 4.0
>> [  119.680053] panel-dsi-cm 58004000.encoder.0: failed to get video timing, using defaults
>> [  119.695709] panel-dsi-cm 58004000.encoder.0: supply vpnl not found, using dummy regulator
>> [  119.711242] panel-dsi-cm 58004000.encoder.0: supply vddi not found, using dummy regulator
>> [  119.769470] panel-btl507212-w677l 58005000.encoder.0: w677l_probe
>> [  119.779388] panel-btl507212-w677l 58005000.encoder.0: w677l_probe ok
>> [  119.846679] omapdss_dss 58000000.dss: bound 58001000.dispc (ops dispc_component_ops [omapdrm])
>> [  119.858673] omapdss_dss 58000000.dss: bound 58004000.encoder (ops dsi_component_ops [omapdrm])
>> [  119.882629] omapdss_dss 58000000.dss: bound 58005000.encoder (ops dsi_component_ops [omapdrm])
>> [  119.902069] omapdss_dss 58000000.dss: bound 58006000.encoder (ops hdmi4_component_ops [omapdrm])
>> [  119.962066] dmm 4e000000.dmm: initialized all PAT entries
>> [  120.014770] panel-btl507212-w677l 58005000.encoder.0: w677l_get_modes
>> 
>> I didn't debug yet where it's hanging. So you're not even getting the probe?
> 
> Oh, it's stuck in a loop trying to calculate suitable timings. It doesn't find it, as I'm running on
> omap4, with just 2 datalanes instead of 4 which the panel needs. Looks like the code could use some
> improvement there.
> 
> Anyway, possibly on omap5 it goes fine.

I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().

I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
And hopefully we are close to push the panel driver for review. And in a second step some device
tree for the Pyra.

The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel

BR and thanks,
Nikolaus

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-05 12:02 ` Tomi Valkeinen
@ 2020-11-08 16:33   ` Nikhil Devshatwar
  -1 siblings, 0 replies; 328+ messages in thread
From: Nikhil Devshatwar @ 2020-11-08 16:33 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller

On 14:02-20201105, Tomi Valkeinen wrote:
> Hi,
> 
> This is third version of the series sent by Sebastian in February:
> 
> https://www.spinics.net/lists/linux-omap/msg153465.html
> 
> I took the patches from his git tree, and rebased on 5.10-rc2. There
> were some conflicts and compilation errors, and one bug that made dsi to
> not work (videomode variable was not initialized to 0).
> 
> I then fixed the few checkpatch and sparse issues. Overall, Sebastian's
> patches are pretty much as they were previously. I did drop Laurent's
> reviewed-bys, as it's been a long time since the previous series, and
> the patches are not identical anyway.
> 
> The topmost 5 patches are new ones, cleanups enabled by the DSI
> conversion. They could be handled separately, but it's such a nice
> cleanup, and I've been waiting for years to get this done, so here they
> are. That said, there are still a _lot_ of cleanups to do.
> 
> Almost all of the patches are omapdrm changes. The two non-omapdrm
> changes are:
> - After converting panel-dsi-cm to common DRM panel model, it is moved
>   to drm's panel directory.
> - Add MIPI_DSI_MODE_ULPS_IDLE flag
> 
> I have tested these with OMAP4 SDP, AM5 EVM and OMAP4 Panda. SDP has
> command mode panel, and I don't have any videomode panels.
> 
> Sebastian, I hope you're ok with all this? I did send you an email, but
> didn't get a reply yet, so I thought to just proceed. If you want to
> handle this in some other way, or don't want your
> authorship/signed-off-by in some of the commits, just tell.
> 
>  Tomi
> 
> Sebastian Reichel (51):
>   drm/dsi: add MIPI_DSI_MODE_ULPS_IDLE
>   Revert "drm/omap: dss: Remove unused omap_dss_device operations"
>   drm/omap: drop unused dsi.configure_pins
>   drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_*
>   drm/omap: constify write buffers
>   drm/omap: dsi: add generic transfer function
>   drm/omap: panel-dsi-cm: convert to transfer API
>   drm/omap: dsi: unexport specific data transfer functions
>   drm/omap: dsi: drop virtual channel logic
>   drm/omap: dsi: simplify write function
>   drm/omap: dsi: simplify read functions
>   drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg
>   drm/omap: dsi: introduce mipi_dsi_host
>   drm/omap: panel-dsi-cm: use DSI helpers
>   drm/omap: dsi: request VC via mipi_dsi_attach
>   drm/omap: panel-dsi-cm: drop hardcoded VC
>   drm/omap: panel-dsi-cm: use common MIPI DCS 1.3 defines
>   drm/omap: dsi: drop unused memory_read()
>   drm/omap: dsi: drop unused get_te()
>   drm/omap: dsi: drop unused enable_te()
>   drm/omap: dsi: drop useless sync()
>   drm/omap: dsi: use pixel-format and mode from attach
>   drm/omap: panel-dsi-cm: use bulk regulator API
>   drm/omap: dsi: lp/hs switching support for transfer()
>   drm/omap: dsi: move TE GPIO handling into core
>   drm/omap: dsi: drop custom enable_te() API
>   drm/omap: dsi: do bus locking in host driver
>   drm/omap: dsi: untangle ulps ops from enable/disable
>   drm/omap: dsi: do ULPS in host driver
>   drm/omap: dsi: move panel refresh function to host
>   drm/omap: dsi: Reverse direction of the DSS device enable/disable
>     operations
>   drm/omap: dsi: drop custom panel capability support
>   drm/omap: dsi: convert to drm_panel
>   drm/omap: drop omapdss-boot-init
>   drm/omap: dsi: implement check timings
>   drm/omap: panel-dsi-cm: use DEVICE_ATTR_RO
>   drm/omap: panel-dsi-cm: support unbinding
>   drm/omap: panel-dsi-cm: fix remove()
>   drm/omap: remove global dss_device variable
>   drm/panel: Move OMAP's DSI command mode panel driver
>   drm/omap: dsi: Register a drm_bridge
>   drm/omap: remove legacy DSS device operations
>   drm/omap: remove unused omap_connector
>   drm/omap: simplify omap_display_id
>   drm/omap: drop unused DSS next pointer
>   drm/omap: drop empty omap_encoder helper functions
>   drm/omap: drop DSS ops_flags
>   drm/omap: drop dssdev display field
>   drm/omap: simplify DSI manual update code
>   drm/omap: dsi: simplify pin config
>   ARM: omap2plus_defconfig: Update for moved DSI command mode panel
> 
> Tomi Valkeinen (5):
>   drm/omap: squash omapdrm sub-modules into one
>   drm/omap: remove unused display.c
>   drm/omap: drop unused owner field
>   drm/omap: remove dispc_ops
>   drm/omap: remove dss_mgr_ops
> 

Reviewed-by: Nikhil Devshatwar <nikhil.nd@ti.com>

Thanks
Nikhil D

>  arch/arm/configs/omap2plus_defconfig          |    2 +-
>  drivers/gpu/drm/omapdrm/Kconfig               |  120 +-
>  drivers/gpu/drm/omapdrm/Makefile              |   19 +-
>  drivers/gpu/drm/omapdrm/displays/Kconfig      |   10 -
>  drivers/gpu/drm/omapdrm/displays/Makefile     |    2 -
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 1385 -----------------
>  drivers/gpu/drm/omapdrm/dss/Kconfig           |  135 --
>  drivers/gpu/drm/omapdrm/dss/Makefile          |   20 -
>  drivers/gpu/drm/omapdrm/dss/base.c            |   87 +-
>  drivers/gpu/drm/omapdrm/dss/dispc.c           |  101 +-
>  drivers/gpu/drm/omapdrm/dss/display.c         |   60 -
>  drivers/gpu/drm/omapdrm/dss/dpi.c             |    1 -
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 1069 ++++++++-----
>  drivers/gpu/drm/omapdrm/dss/dss.c             |   28 +-
>  drivers/gpu/drm/omapdrm/dss/dss.h             |   72 +-
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c           |    1 -
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c           |    1 -
>  .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |  229 ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  278 +---
>  drivers/gpu/drm/omapdrm/dss/output.c          |   57 +-
>  drivers/gpu/drm/omapdrm/dss/sdi.c             |    1 -
>  drivers/gpu/drm/omapdrm/dss/venc.c            |    2 -
>  drivers/gpu/drm/omapdrm/omap_connector.c      |  157 --
>  drivers/gpu/drm/omapdrm/omap_connector.h      |   28 -
>  drivers/gpu/drm/omapdrm/omap_crtc.c           |  103 +-
>  drivers/gpu/drm/omapdrm/omap_crtc.h           |    2 -
>  drivers/gpu/drm/omapdrm/omap_drv.c            |   65 +-
>  drivers/gpu/drm/omapdrm/omap_drv.h            |    3 +-
>  drivers/gpu/drm/omapdrm/omap_encoder.c        |   59 +-
>  drivers/gpu/drm/omapdrm/omap_irq.c            |   34 +-
>  drivers/gpu/drm/omapdrm/omap_plane.c          |   12 +-
>  drivers/gpu/drm/panel/Kconfig                 |    9 +
>  drivers/gpu/drm/panel/Makefile                |    1 +
>  drivers/gpu/drm/panel/panel-dsi-cm.c          |  647 ++++++++
>  include/drm/drm_mipi_dsi.h                    |    2 +
>  35 files changed, 1718 insertions(+), 3084 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/Kconfig
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/Makefile
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/display.c
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
>  delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.c
>  delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.h
>  create mode 100644 drivers/gpu/drm/panel/panel-dsi-cm.c
> 
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-08 16:33   ` Nikhil Devshatwar
  0 siblings, 0 replies; 328+ messages in thread
From: Nikhil Devshatwar @ 2020-11-08 16:33 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Laurent Pinchart, linux-omap

On 14:02-20201105, Tomi Valkeinen wrote:
> Hi,
> 
> This is third version of the series sent by Sebastian in February:
> 
> https://www.spinics.net/lists/linux-omap/msg153465.html
> 
> I took the patches from his git tree, and rebased on 5.10-rc2. There
> were some conflicts and compilation errors, and one bug that made dsi to
> not work (videomode variable was not initialized to 0).
> 
> I then fixed the few checkpatch and sparse issues. Overall, Sebastian's
> patches are pretty much as they were previously. I did drop Laurent's
> reviewed-bys, as it's been a long time since the previous series, and
> the patches are not identical anyway.
> 
> The topmost 5 patches are new ones, cleanups enabled by the DSI
> conversion. They could be handled separately, but it's such a nice
> cleanup, and I've been waiting for years to get this done, so here they
> are. That said, there are still a _lot_ of cleanups to do.
> 
> Almost all of the patches are omapdrm changes. The two non-omapdrm
> changes are:
> - After converting panel-dsi-cm to common DRM panel model, it is moved
>   to drm's panel directory.
> - Add MIPI_DSI_MODE_ULPS_IDLE flag
> 
> I have tested these with OMAP4 SDP, AM5 EVM and OMAP4 Panda. SDP has
> command mode panel, and I don't have any videomode panels.
> 
> Sebastian, I hope you're ok with all this? I did send you an email, but
> didn't get a reply yet, so I thought to just proceed. If you want to
> handle this in some other way, or don't want your
> authorship/signed-off-by in some of the commits, just tell.
> 
>  Tomi
> 
> Sebastian Reichel (51):
>   drm/dsi: add MIPI_DSI_MODE_ULPS_IDLE
>   Revert "drm/omap: dss: Remove unused omap_dss_device operations"
>   drm/omap: drop unused dsi.configure_pins
>   drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_*
>   drm/omap: constify write buffers
>   drm/omap: dsi: add generic transfer function
>   drm/omap: panel-dsi-cm: convert to transfer API
>   drm/omap: dsi: unexport specific data transfer functions
>   drm/omap: dsi: drop virtual channel logic
>   drm/omap: dsi: simplify write function
>   drm/omap: dsi: simplify read functions
>   drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg
>   drm/omap: dsi: introduce mipi_dsi_host
>   drm/omap: panel-dsi-cm: use DSI helpers
>   drm/omap: dsi: request VC via mipi_dsi_attach
>   drm/omap: panel-dsi-cm: drop hardcoded VC
>   drm/omap: panel-dsi-cm: use common MIPI DCS 1.3 defines
>   drm/omap: dsi: drop unused memory_read()
>   drm/omap: dsi: drop unused get_te()
>   drm/omap: dsi: drop unused enable_te()
>   drm/omap: dsi: drop useless sync()
>   drm/omap: dsi: use pixel-format and mode from attach
>   drm/omap: panel-dsi-cm: use bulk regulator API
>   drm/omap: dsi: lp/hs switching support for transfer()
>   drm/omap: dsi: move TE GPIO handling into core
>   drm/omap: dsi: drop custom enable_te() API
>   drm/omap: dsi: do bus locking in host driver
>   drm/omap: dsi: untangle ulps ops from enable/disable
>   drm/omap: dsi: do ULPS in host driver
>   drm/omap: dsi: move panel refresh function to host
>   drm/omap: dsi: Reverse direction of the DSS device enable/disable
>     operations
>   drm/omap: dsi: drop custom panel capability support
>   drm/omap: dsi: convert to drm_panel
>   drm/omap: drop omapdss-boot-init
>   drm/omap: dsi: implement check timings
>   drm/omap: panel-dsi-cm: use DEVICE_ATTR_RO
>   drm/omap: panel-dsi-cm: support unbinding
>   drm/omap: panel-dsi-cm: fix remove()
>   drm/omap: remove global dss_device variable
>   drm/panel: Move OMAP's DSI command mode panel driver
>   drm/omap: dsi: Register a drm_bridge
>   drm/omap: remove legacy DSS device operations
>   drm/omap: remove unused omap_connector
>   drm/omap: simplify omap_display_id
>   drm/omap: drop unused DSS next pointer
>   drm/omap: drop empty omap_encoder helper functions
>   drm/omap: drop DSS ops_flags
>   drm/omap: drop dssdev display field
>   drm/omap: simplify DSI manual update code
>   drm/omap: dsi: simplify pin config
>   ARM: omap2plus_defconfig: Update for moved DSI command mode panel
> 
> Tomi Valkeinen (5):
>   drm/omap: squash omapdrm sub-modules into one
>   drm/omap: remove unused display.c
>   drm/omap: drop unused owner field
>   drm/omap: remove dispc_ops
>   drm/omap: remove dss_mgr_ops
> 

Reviewed-by: Nikhil Devshatwar <nikhil.nd@ti.com>

Thanks
Nikhil D

>  arch/arm/configs/omap2plus_defconfig          |    2 +-
>  drivers/gpu/drm/omapdrm/Kconfig               |  120 +-
>  drivers/gpu/drm/omapdrm/Makefile              |   19 +-
>  drivers/gpu/drm/omapdrm/displays/Kconfig      |   10 -
>  drivers/gpu/drm/omapdrm/displays/Makefile     |    2 -
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 1385 -----------------
>  drivers/gpu/drm/omapdrm/dss/Kconfig           |  135 --
>  drivers/gpu/drm/omapdrm/dss/Makefile          |   20 -
>  drivers/gpu/drm/omapdrm/dss/base.c            |   87 +-
>  drivers/gpu/drm/omapdrm/dss/dispc.c           |  101 +-
>  drivers/gpu/drm/omapdrm/dss/display.c         |   60 -
>  drivers/gpu/drm/omapdrm/dss/dpi.c             |    1 -
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 1069 ++++++++-----
>  drivers/gpu/drm/omapdrm/dss/dss.c             |   28 +-
>  drivers/gpu/drm/omapdrm/dss/dss.h             |   72 +-
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c           |    1 -
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c           |    1 -
>  .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |  229 ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  278 +---
>  drivers/gpu/drm/omapdrm/dss/output.c          |   57 +-
>  drivers/gpu/drm/omapdrm/dss/sdi.c             |    1 -
>  drivers/gpu/drm/omapdrm/dss/venc.c            |    2 -
>  drivers/gpu/drm/omapdrm/omap_connector.c      |  157 --
>  drivers/gpu/drm/omapdrm/omap_connector.h      |   28 -
>  drivers/gpu/drm/omapdrm/omap_crtc.c           |  103 +-
>  drivers/gpu/drm/omapdrm/omap_crtc.h           |    2 -
>  drivers/gpu/drm/omapdrm/omap_drv.c            |   65 +-
>  drivers/gpu/drm/omapdrm/omap_drv.h            |    3 +-
>  drivers/gpu/drm/omapdrm/omap_encoder.c        |   59 +-
>  drivers/gpu/drm/omapdrm/omap_irq.c            |   34 +-
>  drivers/gpu/drm/omapdrm/omap_plane.c          |   12 +-
>  drivers/gpu/drm/panel/Kconfig                 |    9 +
>  drivers/gpu/drm/panel/Makefile                |    1 +
>  drivers/gpu/drm/panel/panel-dsi-cm.c          |  647 ++++++++
>  include/drm/drm_mipi_dsi.h                    |    2 +
>  35 files changed, 1718 insertions(+), 3084 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/Kconfig
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/Makefile
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/display.c
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
>  delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.c
>  delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.h
>  create mode 100644 drivers/gpu/drm/panel/panel-dsi-cm.c
> 
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-07 12:19                 ` H. Nikolaus Schaller
@ 2020-11-09  8:04                   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09  8:04 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren

On 07/11/2020 14:19, H. Nikolaus Schaller wrote:

> I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
> the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().
> 
> I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
> And hopefully we are close to push the panel driver for review. And in a second step some device
> tree for the Pyra.
> 
> The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel

Ok, good. Do you have a link the previous driver that works (omapdrm specific panel driver)? I think
it's good to have that as a reference.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-09  8:04                   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09  8:04 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

On 07/11/2020 14:19, H. Nikolaus Schaller wrote:

> I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
> the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().
> 
> I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
> And hopefully we are close to push the panel driver for review. And in a second step some device
> tree for the Pyra.
> 
> The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel

Ok, good. Do you have a link the previous driver that works (omapdrm specific panel driver)? I think
it's good to have that as a reference.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 08/56] drm/omap: dsi: unexport specific data transfer functions
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:10     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:10 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:45PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> After converting all DSI drivers, unexport the specific transfer
> functions.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 12 ------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 20 --------------------
>  2 files changed, 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 59a62d1d41cb..2270730b16db 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4949,18 +4949,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.release_vc = dsi_release_vc,
>  
>  		.transfer = omap_dsi_transfer,
> -
> -		.dcs_write = dsi_vc_dcs_write,
> -		.dcs_write_nosync = dsi_vc_dcs_write_nosync,
> -		.dcs_read = dsi_vc_dcs_read,
> -
> -		.gen_write = dsi_vc_generic_write,
> -		.gen_write_nosync = dsi_vc_generic_write_nosync,
> -		.gen_read = dsi_vc_generic_read,
> -
> -		.bta_sync = dsi_vc_send_bta_sync,
> -
> -		.set_max_rx_packet_size = dsi_vc_set_max_rx_packet_size,
>  	},
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 654618e5a4e5..9ead877cb24c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -310,26 +310,6 @@ struct omapdss_dsi_ops {
>  	/* data transfer */
>  	ssize_t (*transfer)(struct omap_dss_device *dssdev,
>  			    const struct mipi_dsi_msg *msg);
> -
> -	int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
> -			const u8 *data, int len);
> -	int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
> -			const u8 *data, int len);
> -	int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
> -			u8 *data, int len);
> -
> -	int (*gen_write)(struct omap_dss_device *dssdev, int channel,
> -			const u8 *data, int len);
> -	int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
> -			const u8 *data, int len);
> -	int (*gen_read)(struct omap_dss_device *dssdev, int channel,
> -			const u8 *reqdata, int reqlen,
> -			u8 *data, int len);
> -
> -	int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
> -
> -	int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
> -			int channel, u16 plen);
>  };
>  
>  struct omap_dss_device_ops {

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 08/56] drm/omap: dsi: unexport specific data transfer functions
@ 2020-11-09  8:10     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:10 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:45PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> After converting all DSI drivers, unexport the specific transfer
> functions.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 12 ------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 20 --------------------
>  2 files changed, 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 59a62d1d41cb..2270730b16db 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4949,18 +4949,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.release_vc = dsi_release_vc,
>  
>  		.transfer = omap_dsi_transfer,
> -
> -		.dcs_write = dsi_vc_dcs_write,
> -		.dcs_write_nosync = dsi_vc_dcs_write_nosync,
> -		.dcs_read = dsi_vc_dcs_read,
> -
> -		.gen_write = dsi_vc_generic_write,
> -		.gen_write_nosync = dsi_vc_generic_write_nosync,
> -		.gen_read = dsi_vc_generic_read,
> -
> -		.bta_sync = dsi_vc_send_bta_sync,
> -
> -		.set_max_rx_packet_size = dsi_vc_set_max_rx_packet_size,
>  	},
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 654618e5a4e5..9ead877cb24c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -310,26 +310,6 @@ struct omapdss_dsi_ops {
>  	/* data transfer */
>  	ssize_t (*transfer)(struct omap_dss_device *dssdev,
>  			    const struct mipi_dsi_msg *msg);
> -
> -	int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
> -			const u8 *data, int len);
> -	int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
> -			const u8 *data, int len);
> -	int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
> -			u8 *data, int len);
> -
> -	int (*gen_write)(struct omap_dss_device *dssdev, int channel,
> -			const u8 *data, int len);
> -	int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
> -			const u8 *data, int len);
> -	int (*gen_read)(struct omap_dss_device *dssdev, int channel,
> -			const u8 *reqdata, int reqlen,
> -			u8 *data, int len);
> -
> -	int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
> -
> -	int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
> -			int channel, u16 plen);
>  };
>  
>  struct omap_dss_device_ops {

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 09/56] drm/omap: dsi: drop virtual channel logic
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:14     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:14 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:46PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This drops the virtual channel logic. Afterwards DSI clients
> request their channel number and get the virtual channel with
> the same number or -EBUSY if already in use.

It could be useful to explain the reason for this patch (which, if I
understand the patch correctly, is to replace dynamic allocation of
virtual channels with a fixed allocation by the DSI panel, I assume
because dynamic allocation isn't actually useful ?).

> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 11 ++---
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 46 ++++---------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  4 +-
>  3 files changed, 12 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 8b2e80129bd8..ea76a89d1833 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -768,19 +768,12 @@ static int dsicm_connect(struct omap_dss_device *src,
>  	struct device *dev = &ddata->pdev->dev;
>  	int r;
>  
> -	r = src->ops->dsi.request_vc(src, &ddata->channel);
> +	r = src->ops->dsi.request_vc(src, ddata->channel);
>  	if (r) {
>  		dev_err(dev, "failed to get virtual channel\n");
>  		return r;
>  	}
>  
> -	r = src->ops->dsi.set_vc_id(src, ddata->channel, TCH);
> -	if (r) {
> -		dev_err(dev, "failed to set VC_ID\n");
> -		src->ops->dsi.release_vc(src, ddata->channel);
> -		return r;
> -	}
> -
>  	ddata->src = src;
>  	return 0;
>  }
> @@ -1215,6 +1208,8 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  	struct display_timing timing;
>  	int err;
>  
> +	ddata->channel = TCH;

I'd drop the macro, but no big deal.

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

> +
>  	ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
>  	if (IS_ERR(ddata->reset_gpio)) {
>  		err = PTR_ERR(ddata->reset_gpio);
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 2270730b16db..348be32505a2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -350,7 +350,6 @@ struct dsi_data {
>  		struct omap_dss_device *dssdev;
>  		enum fifo_size tx_fifo_size;
>  		enum fifo_size rx_fifo_size;
> -		int vc_id;
>  	} vc[4];
>  
>  	struct mutex lock;
> @@ -2579,7 +2578,7 @@ static inline void dsi_vc_write_long_header(struct dsi_data *dsi, int channel,
>  
>  	WARN_ON(!dsi_bus_is_locked(dsi));
>  
> -	data_id = data_type | dsi->vc[channel].vc_id << 6;
> +	data_id = data_type | channel << 6;
>  
>  	val = FLD_VAL(data_id, 7, 0) | FLD_VAL(len, 23, 8) |
>  		FLD_VAL(ecc, 31, 24);
> @@ -2683,7 +2682,7 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int channel, u8 data_type,
>  		return -EINVAL;
>  	}
>  
> -	data_id = data_type | dsi->vc[channel].vc_id << 6;
> +	data_id = data_type | channel << 6;
>  
>  	r = (data_id << 0) | (data << 8) | (ecc << 24);
>  
> @@ -4789,45 +4788,19 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)
>  	}
>  }
>  
> -static int dsi_request_vc(struct omap_dss_device *dssdev, int *channel)
> +static int dsi_request_vc(struct omap_dss_device *dssdev, int channel)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	int i;
> -
> -	for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
> -		if (!dsi->vc[i].dssdev) {
> -			dsi->vc[i].dssdev = dssdev;
> -			*channel = i;
> -			return 0;
> -		}
> -	}
>  
> -	DSSERR("cannot get VC for display %s", dssdev->name);
> -	return -ENOSPC;
> -}
> -
> -static int dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> -	if (vc_id < 0 || vc_id > 3) {
> -		DSSERR("VC ID out of range\n");
> -		return -EINVAL;
> -	}
> -
> -	if (channel < 0 || channel > 3) {
> -		DSSERR("Virtual Channel out of range\n");
> +	if (channel < 0 || channel > 3)
>  		return -EINVAL;
> -	}
>  
> -	if (dsi->vc[channel].dssdev != dssdev) {
> -		DSSERR("Virtual Channel not allocated to display %s\n",
> -			dssdev->name);
> -		return -EINVAL;
> +	if (dsi->vc[channel].dssdev) {
> +		DSSERR("cannot get VC for display %s", dssdev->name);
> +		return -EBUSY;
>  	}
>  
> -	dsi->vc[channel].vc_id = vc_id;
> -
> +	dsi->vc[channel].dssdev = dssdev;
>  	return 0;
>  }
>  
> @@ -4838,7 +4811,6 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
>  	if ((channel >= 0 && channel <= 3) &&
>  		dsi->vc[channel].dssdev == dssdev) {
>  		dsi->vc[channel].dssdev = NULL;
> -		dsi->vc[channel].vc_id = 0;
>  	}
>  }
>  
> @@ -4945,7 +4917,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.enable_te = dsi_enable_te,
>  
>  		.request_vc = dsi_request_vc,
> -		.set_vc_id = dsi_set_vc_id,
>  		.release_vc = dsi_release_vc,
>  
>  		.transfer = omap_dsi_transfer,
> @@ -5401,7 +5372,6 @@ static int dsi_probe(struct platform_device *pdev)
>  	for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
>  		dsi->vc[i].source = DSI_VC_SOURCE_L4;
>  		dsi->vc[i].dssdev = NULL;
> -		dsi->vc[i].vc_id = 0;
>  	}
>  
>  	r = dsi_get_clocks(dsi);
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 9ead877cb24c..40e1ce9e256e 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -302,9 +302,7 @@ struct omapdss_dsi_ops {
>  	void (*disable_video_output)(struct omap_dss_device *dssdev,
>  			int channel);
>  
> -	int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
> -	int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
> -			int vc_id);
> +	int (*request_vc)(struct omap_dss_device *dssdev, int channel);
>  	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
>  
>  	/* data transfer */

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 09/56] drm/omap: dsi: drop virtual channel logic
@ 2020-11-09  8:14     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:14 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:46PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This drops the virtual channel logic. Afterwards DSI clients
> request their channel number and get the virtual channel with
> the same number or -EBUSY if already in use.

It could be useful to explain the reason for this patch (which, if I
understand the patch correctly, is to replace dynamic allocation of
virtual channels with a fixed allocation by the DSI panel, I assume
because dynamic allocation isn't actually useful ?).

> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 11 ++---
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 46 ++++---------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  4 +-
>  3 files changed, 12 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 8b2e80129bd8..ea76a89d1833 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -768,19 +768,12 @@ static int dsicm_connect(struct omap_dss_device *src,
>  	struct device *dev = &ddata->pdev->dev;
>  	int r;
>  
> -	r = src->ops->dsi.request_vc(src, &ddata->channel);
> +	r = src->ops->dsi.request_vc(src, ddata->channel);
>  	if (r) {
>  		dev_err(dev, "failed to get virtual channel\n");
>  		return r;
>  	}
>  
> -	r = src->ops->dsi.set_vc_id(src, ddata->channel, TCH);
> -	if (r) {
> -		dev_err(dev, "failed to set VC_ID\n");
> -		src->ops->dsi.release_vc(src, ddata->channel);
> -		return r;
> -	}
> -
>  	ddata->src = src;
>  	return 0;
>  }
> @@ -1215,6 +1208,8 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  	struct display_timing timing;
>  	int err;
>  
> +	ddata->channel = TCH;

I'd drop the macro, but no big deal.

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

> +
>  	ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
>  	if (IS_ERR(ddata->reset_gpio)) {
>  		err = PTR_ERR(ddata->reset_gpio);
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 2270730b16db..348be32505a2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -350,7 +350,6 @@ struct dsi_data {
>  		struct omap_dss_device *dssdev;
>  		enum fifo_size tx_fifo_size;
>  		enum fifo_size rx_fifo_size;
> -		int vc_id;
>  	} vc[4];
>  
>  	struct mutex lock;
> @@ -2579,7 +2578,7 @@ static inline void dsi_vc_write_long_header(struct dsi_data *dsi, int channel,
>  
>  	WARN_ON(!dsi_bus_is_locked(dsi));
>  
> -	data_id = data_type | dsi->vc[channel].vc_id << 6;
> +	data_id = data_type | channel << 6;
>  
>  	val = FLD_VAL(data_id, 7, 0) | FLD_VAL(len, 23, 8) |
>  		FLD_VAL(ecc, 31, 24);
> @@ -2683,7 +2682,7 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int channel, u8 data_type,
>  		return -EINVAL;
>  	}
>  
> -	data_id = data_type | dsi->vc[channel].vc_id << 6;
> +	data_id = data_type | channel << 6;
>  
>  	r = (data_id << 0) | (data << 8) | (ecc << 24);
>  
> @@ -4789,45 +4788,19 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)
>  	}
>  }
>  
> -static int dsi_request_vc(struct omap_dss_device *dssdev, int *channel)
> +static int dsi_request_vc(struct omap_dss_device *dssdev, int channel)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	int i;
> -
> -	for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
> -		if (!dsi->vc[i].dssdev) {
> -			dsi->vc[i].dssdev = dssdev;
> -			*channel = i;
> -			return 0;
> -		}
> -	}
>  
> -	DSSERR("cannot get VC for display %s", dssdev->name);
> -	return -ENOSPC;
> -}
> -
> -static int dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> -	if (vc_id < 0 || vc_id > 3) {
> -		DSSERR("VC ID out of range\n");
> -		return -EINVAL;
> -	}
> -
> -	if (channel < 0 || channel > 3) {
> -		DSSERR("Virtual Channel out of range\n");
> +	if (channel < 0 || channel > 3)
>  		return -EINVAL;
> -	}
>  
> -	if (dsi->vc[channel].dssdev != dssdev) {
> -		DSSERR("Virtual Channel not allocated to display %s\n",
> -			dssdev->name);
> -		return -EINVAL;
> +	if (dsi->vc[channel].dssdev) {
> +		DSSERR("cannot get VC for display %s", dssdev->name);
> +		return -EBUSY;
>  	}
>  
> -	dsi->vc[channel].vc_id = vc_id;
> -
> +	dsi->vc[channel].dssdev = dssdev;
>  	return 0;
>  }
>  
> @@ -4838,7 +4811,6 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
>  	if ((channel >= 0 && channel <= 3) &&
>  		dsi->vc[channel].dssdev == dssdev) {
>  		dsi->vc[channel].dssdev = NULL;
> -		dsi->vc[channel].vc_id = 0;
>  	}
>  }
>  
> @@ -4945,7 +4917,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.enable_te = dsi_enable_te,
>  
>  		.request_vc = dsi_request_vc,
> -		.set_vc_id = dsi_set_vc_id,
>  		.release_vc = dsi_release_vc,
>  
>  		.transfer = omap_dsi_transfer,
> @@ -5401,7 +5372,6 @@ static int dsi_probe(struct platform_device *pdev)
>  	for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
>  		dsi->vc[i].source = DSI_VC_SOURCE_L4;
>  		dsi->vc[i].dssdev = NULL;
> -		dsi->vc[i].vc_id = 0;
>  	}
>  
>  	r = dsi_get_clocks(dsi);
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 9ead877cb24c..40e1ce9e256e 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -302,9 +302,7 @@ struct omapdss_dsi_ops {
>  	void (*disable_video_output)(struct omap_dss_device *dssdev,
>  			int channel);
>  
> -	int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
> -	int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
> -			int vc_id);
> +	int (*request_vc)(struct omap_dss_device *dssdev, int channel);
>  	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
>  
>  	/* data transfer */

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 09/56] drm/omap: dsi: drop virtual channel logic
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:18     ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09  8:18 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller, Sebastian Reichel

On 05/11/2020 14:02, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This drops the virtual channel logic. Afterwards DSI clients
> request their channel number and get the virtual channel with
> the same number or -EBUSY if already in use.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 11 ++---
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 46 ++++---------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  4 +-
>  3 files changed, 12 insertions(+), 49 deletions(-)

A comment about this (and other virtual channel logic changes): When Sebastian sent the series in
Feb, I commented that the VC change is not correct. That's still true, and I did not fix it as I'm
not sure how to fix it, and however it is fixed has to be fully inside dsi.c (so it doesn't affect
e.g. the panel drivers).

However, it works just fine. The case where things will break is when we need to use multiple VCs
(OMAP DSI's "configuration blocks", not virtual channel ID numbers). Command mode panels don't need
this. Video mode panels might need it, but it's not quite clear to me if it's strictly needed, or is
it just an optimization.

I hope to get a board with video mode panel soonish, or help Nikolaus to debug this.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 09/56] drm/omap: dsi: drop virtual channel logic
@ 2020-11-09  8:18     ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09  8:18 UTC (permalink / raw)
  To: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori, Sebastian Reichel

On 05/11/2020 14:02, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This drops the virtual channel logic. Afterwards DSI clients
> request their channel number and get the virtual channel with
> the same number or -EBUSY if already in use.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 11 ++---
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 46 ++++---------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  4 +-
>  3 files changed, 12 insertions(+), 49 deletions(-)

A comment about this (and other virtual channel logic changes): When Sebastian sent the series in
Feb, I commented that the VC change is not correct. That's still true, and I did not fix it as I'm
not sure how to fix it, and however it is fixed has to be fully inside dsi.c (so it doesn't affect
e.g. the panel drivers).

However, it works just fine. The case where things will break is when we need to use multiple VCs
(OMAP DSI's "configuration blocks", not virtual channel ID numbers). Command mode panels don't need
this. Video mode panels might need it, but it's not quite clear to me if it's strictly needed, or is
it just an optimization.

I hope to get a board with video mode panel soonish, or help Nikolaus to debug this.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 09/56] drm/omap: dsi: drop virtual channel logic
  2020-11-09  8:14     ` Laurent Pinchart
@ 2020-11-09  8:20       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09  8:20 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 09/11/2020 10:14, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:02:46PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> This drops the virtual channel logic. Afterwards DSI clients
>> request their channel number and get the virtual channel with
>> the same number or -EBUSY if already in use.
> 
> It could be useful to explain the reason for this patch (which, if I
> understand the patch correctly, is to replace dynamic allocation of
> virtual channels with a fixed allocation by the DSI panel, I assume
> because dynamic allocation isn't actually useful ?).

Yes, I can elaborate on that in v4. I also just sent a separate mail about it.

>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 11 ++---
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 46 ++++---------------
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  4 +-
>>  3 files changed, 12 insertions(+), 49 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index 8b2e80129bd8..ea76a89d1833 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -768,19 +768,12 @@ static int dsicm_connect(struct omap_dss_device *src,
>>  	struct device *dev = &ddata->pdev->dev;
>>  	int r;
>>  
>> -	r = src->ops->dsi.request_vc(src, &ddata->channel);
>> +	r = src->ops->dsi.request_vc(src, ddata->channel);
>>  	if (r) {
>>  		dev_err(dev, "failed to get virtual channel\n");
>>  		return r;
>>  	}
>>  
>> -	r = src->ops->dsi.set_vc_id(src, ddata->channel, TCH);
>> -	if (r) {
>> -		dev_err(dev, "failed to set VC_ID\n");
>> -		src->ops->dsi.release_vc(src, ddata->channel);
>> -		return r;
>> -	}
>> -
>>  	ddata->src = src;
>>  	return 0;
>>  }
>> @@ -1215,6 +1208,8 @@ static int dsicm_probe_of(struct platform_device *pdev)
>>  	struct display_timing timing;
>>  	int err;
>>  
>> +	ddata->channel = TCH;
> 
> I'd drop the macro, but no big deal.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

It's dropped in a later patch.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 09/56] drm/omap: dsi: drop virtual channel logic
@ 2020-11-09  8:20       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09  8:20 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 09/11/2020 10:14, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:02:46PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> This drops the virtual channel logic. Afterwards DSI clients
>> request their channel number and get the virtual channel with
>> the same number or -EBUSY if already in use.
> 
> It could be useful to explain the reason for this patch (which, if I
> understand the patch correctly, is to replace dynamic allocation of
> virtual channels with a fixed allocation by the DSI panel, I assume
> because dynamic allocation isn't actually useful ?).

Yes, I can elaborate on that in v4. I also just sent a separate mail about it.

>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 11 ++---
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 46 ++++---------------
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  4 +-
>>  3 files changed, 12 insertions(+), 49 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index 8b2e80129bd8..ea76a89d1833 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -768,19 +768,12 @@ static int dsicm_connect(struct omap_dss_device *src,
>>  	struct device *dev = &ddata->pdev->dev;
>>  	int r;
>>  
>> -	r = src->ops->dsi.request_vc(src, &ddata->channel);
>> +	r = src->ops->dsi.request_vc(src, ddata->channel);
>>  	if (r) {
>>  		dev_err(dev, "failed to get virtual channel\n");
>>  		return r;
>>  	}
>>  
>> -	r = src->ops->dsi.set_vc_id(src, ddata->channel, TCH);
>> -	if (r) {
>> -		dev_err(dev, "failed to set VC_ID\n");
>> -		src->ops->dsi.release_vc(src, ddata->channel);
>> -		return r;
>> -	}
>> -
>>  	ddata->src = src;
>>  	return 0;
>>  }
>> @@ -1215,6 +1208,8 @@ static int dsicm_probe_of(struct platform_device *pdev)
>>  	struct display_timing timing;
>>  	int err;
>>  
>> +	ddata->channel = TCH;
> 
> I'd drop the macro, but no big deal.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

It's dropped in a later patch.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 10/56] drm/omap: dsi: simplify write function
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:21     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:21 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:47PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Simplify the write related messages handling by using the functionality
> provided by CONFIG_DRM_MIPI_DSI.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/Kconfig |   1 +
>  drivers/gpu/drm/omapdrm/dss/dsi.c   | 146 +++++++---------------------
>  2 files changed, 34 insertions(+), 113 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig b/drivers/gpu/drm/omapdrm/dss/Kconfig
> index 2658c521b702..fd7dfa28ce97 100644
> --- a/drivers/gpu/drm/omapdrm/dss/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
> @@ -95,6 +95,7 @@ config OMAP2_DSS_SDI
>  config OMAP2_DSS_DSI
>  	bool "DSI support"
>  	default n
> +	select DRM_MIPI_DSI
>  	help
>  	  MIPI DSI (Display Serial Interface) support.
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 348be32505a2..e1595c0608f2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2696,97 +2696,50 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
>  	return dsi_vc_send_long(dsi, channel, MIPI_DSI_NULL_PACKET, NULL, 0, 0);
>  }
>  
> -static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
> -				      const u8 *data, int len,
> -				      enum dss_dsi_content_type type)
> -{
> -	int r;
> -
> -	if (len == 0) {
> -		BUG_ON(type == DSS_DSI_CONTENT_DCS);
> -		r = dsi_vc_send_short(dsi, channel,
> -				MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM, 0, 0);
> -	} else if (len == 1) {
> -		r = dsi_vc_send_short(dsi, channel,
> -				type == DSS_DSI_CONTENT_GENERIC ?
> -				MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM :
> -				MIPI_DSI_DCS_SHORT_WRITE, data[0], 0);
> -	} else if (len == 2) {
> -		r = dsi_vc_send_short(dsi, channel,
> -				type == DSS_DSI_CONTENT_GENERIC ?
> -				MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM :
> -				MIPI_DSI_DCS_SHORT_WRITE_PARAM,
> -				data[0] | (data[1] << 8), 0);
> -	} else {
> -		r = dsi_vc_send_long(dsi, channel,
> -				type == DSS_DSI_CONTENT_GENERIC ?
> -				MIPI_DSI_GENERIC_LONG_WRITE :
> -				MIPI_DSI_DCS_LONG_WRITE, data, len, 0);
> -	}
> -
> -	return r;
> -}
> -
> -static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
> -		const u8 *data, int len)
> +static int dsi_vc_write_common(struct omap_dss_device *dssdev,
> +			       const struct mipi_dsi_msg *msg)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	struct mipi_dsi_packet packet;
> +	int r;
>  
> -	return dsi_vc_write_nosync_common(dsi, channel, data, len,
> -			DSS_DSI_CONTENT_DCS);
> -}
> +	r = mipi_dsi_create_packet(&packet, msg);
> +	if (r < 0)
> +		return r;
>  
> -static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
> -		const u8 *data, int len)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	if (mipi_dsi_packet_format_is_short(msg->type)) {
> +		u16 data = packet.header[1] | (packet.header[2] << 8);

packet is only used here, should the variable and
mipi_dsi_create_packet() call be moved to this branch of the if ? Feel
free to ignore if a patch further down the series makes use of packet in
different locations.

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

>  
> -	return dsi_vc_write_nosync_common(dsi, channel, data, len,
> -			DSS_DSI_CONTENT_GENERIC);
> -}
> +		r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
> +	} else {
> +		r = dsi_vc_send_long(dsi, msg->channel, msg->type,
> +				     msg->tx_buf, msg->tx_len, 0);
> +	}
>  
> -static int dsi_vc_write_common(struct omap_dss_device *dssdev,
> -			       int channel, const u8 *data, int len,
> -			       enum dss_dsi_content_type type)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	int r;
> +	if (r < 0)
> +		return r;
>  
> -	r = dsi_vc_write_nosync_common(dsi, channel, data, len, type);
> -	if (r)
> -		goto err;
> +	/*
> +	 * TODO: we do not always have to do the BTA sync, for example
> +	 * we can improve performance by setting the update window
> +	 * information without sending BTA sync between the commands.
> +	 * In that case we can return early.
> +	 */
>  
> -	r = dsi_vc_send_bta_sync(dssdev, channel);
> -	if (r)
> -		goto err;
> +	r = dsi_vc_send_bta_sync(dssdev, msg->channel);
> +	if (r) {
> +		DSSERR("bta sync failed\n");
> +		return r;
> +	}
>  
>  	/* RX_FIFO_NOT_EMPTY */
> -	if (REG_GET(dsi, DSI_VC_CTRL(channel), 20, 20)) {
> +	if (REG_GET(dsi, DSI_VC_CTRL(msg->channel), 20, 20)) {
>  		DSSERR("rx fifo not empty after write, dumping data:\n");
> -		dsi_vc_flush_receive_data(dsi, channel);
> -		r = -EIO;
> -		goto err;
> +		dsi_vc_flush_receive_data(dsi, msg->channel);
> +		return -EIO;
>  	}
>  
>  	return 0;
> -err:
> -	DSSERR("dsi_vc_write_common(ch %d, cmd 0x%02x, len %d) failed\n",
> -			channel, data[0], len);
> -	return r;
> -}
> -
> -static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel,
> -		const u8 *data, int len)
> -{
> -	return dsi_vc_write_common(dssdev, channel, data, len,
> -			DSS_DSI_CONTENT_DCS);
> -}
> -
> -static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel,
> -		const u8 *data, int len)
> -{
> -	return dsi_vc_write_common(dssdev, channel, data, len,
> -			DSS_DSI_CONTENT_GENERIC);
>  }
>  
>  static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
> @@ -3008,15 +2961,6 @@ static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
>  	return 0;
>  }
>  
> -static int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
> -		u16 len)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> -	return dsi_vc_send_short(dsi, channel,
> -			MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE, len, 0);
> -}
> -
>  static int dsi_enter_ulps(struct dsi_data *dsi)
>  {
>  	DECLARE_COMPLETION_ONSTACK(completion);
> @@ -4817,36 +4761,17 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
>  static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
>  				 const struct mipi_dsi_msg *msg)
>  {
> -	/*
> -	 * no_sync can be used to optimize performance by sending e.g. column
> -	 * and page information without syncing in between. It's not absolutley
> -	 * required, so postpone this feature for now.
> -	 */
> -	bool no_sync = false;
> -	u16 val;
> -
>  	switch (msg->type) {
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
>  	case MIPI_DSI_GENERIC_LONG_WRITE:
> -		if (no_sync)
> -			return dsi_vc_generic_write_nosync(dssdev, msg->channel,
> -							   msg->tx_buf,
> -							   msg->tx_len);
> -		else
> -			return dsi_vc_generic_write(dssdev, msg->channel,
> -						    msg->tx_buf, msg->tx_len);
>  	case MIPI_DSI_DCS_SHORT_WRITE:
>  	case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
>  	case MIPI_DSI_DCS_LONG_WRITE:
> -		if (no_sync)
> -			return dsi_vc_dcs_write_nosync(dssdev, msg->channel,
> -						       msg->tx_buf,
> -						       msg->tx_len);
> -		else
> -			return dsi_vc_dcs_write(dssdev, msg->channel,
> -						msg->tx_buf, msg->tx_len);
> +	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
> +	case MIPI_DSI_NULL_PACKET:
> +		return dsi_vc_write_common(dssdev, msg);
>  	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
>  	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
>  	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
> @@ -4857,11 +4782,6 @@ static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
>  		return dsi_vc_dcs_read(dssdev, msg->channel,
>  				       ((u8 *)msg->tx_buf)[0],
>  				       msg->rx_buf, msg->rx_len);
> -	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
> -		val = le16_to_cpu(*((__le16 *)msg->tx_buf));
> -		return dsi_vc_set_max_rx_packet_size(dssdev, msg->channel, val);
> -	case MIPI_DSI_NULL_PACKET:
> -		return dsi_vc_send_null(to_dsi_data(dssdev), msg->channel);
>  	}
>  
>  	return -EINVAL;

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 10/56] drm/omap: dsi: simplify write function
@ 2020-11-09  8:21     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:21 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:47PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Simplify the write related messages handling by using the functionality
> provided by CONFIG_DRM_MIPI_DSI.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/Kconfig |   1 +
>  drivers/gpu/drm/omapdrm/dss/dsi.c   | 146 +++++++---------------------
>  2 files changed, 34 insertions(+), 113 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig b/drivers/gpu/drm/omapdrm/dss/Kconfig
> index 2658c521b702..fd7dfa28ce97 100644
> --- a/drivers/gpu/drm/omapdrm/dss/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
> @@ -95,6 +95,7 @@ config OMAP2_DSS_SDI
>  config OMAP2_DSS_DSI
>  	bool "DSI support"
>  	default n
> +	select DRM_MIPI_DSI
>  	help
>  	  MIPI DSI (Display Serial Interface) support.
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 348be32505a2..e1595c0608f2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2696,97 +2696,50 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
>  	return dsi_vc_send_long(dsi, channel, MIPI_DSI_NULL_PACKET, NULL, 0, 0);
>  }
>  
> -static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
> -				      const u8 *data, int len,
> -				      enum dss_dsi_content_type type)
> -{
> -	int r;
> -
> -	if (len == 0) {
> -		BUG_ON(type == DSS_DSI_CONTENT_DCS);
> -		r = dsi_vc_send_short(dsi, channel,
> -				MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM, 0, 0);
> -	} else if (len == 1) {
> -		r = dsi_vc_send_short(dsi, channel,
> -				type == DSS_DSI_CONTENT_GENERIC ?
> -				MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM :
> -				MIPI_DSI_DCS_SHORT_WRITE, data[0], 0);
> -	} else if (len == 2) {
> -		r = dsi_vc_send_short(dsi, channel,
> -				type == DSS_DSI_CONTENT_GENERIC ?
> -				MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM :
> -				MIPI_DSI_DCS_SHORT_WRITE_PARAM,
> -				data[0] | (data[1] << 8), 0);
> -	} else {
> -		r = dsi_vc_send_long(dsi, channel,
> -				type == DSS_DSI_CONTENT_GENERIC ?
> -				MIPI_DSI_GENERIC_LONG_WRITE :
> -				MIPI_DSI_DCS_LONG_WRITE, data, len, 0);
> -	}
> -
> -	return r;
> -}
> -
> -static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
> -		const u8 *data, int len)
> +static int dsi_vc_write_common(struct omap_dss_device *dssdev,
> +			       const struct mipi_dsi_msg *msg)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	struct mipi_dsi_packet packet;
> +	int r;
>  
> -	return dsi_vc_write_nosync_common(dsi, channel, data, len,
> -			DSS_DSI_CONTENT_DCS);
> -}
> +	r = mipi_dsi_create_packet(&packet, msg);
> +	if (r < 0)
> +		return r;
>  
> -static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
> -		const u8 *data, int len)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	if (mipi_dsi_packet_format_is_short(msg->type)) {
> +		u16 data = packet.header[1] | (packet.header[2] << 8);

packet is only used here, should the variable and
mipi_dsi_create_packet() call be moved to this branch of the if ? Feel
free to ignore if a patch further down the series makes use of packet in
different locations.

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

>  
> -	return dsi_vc_write_nosync_common(dsi, channel, data, len,
> -			DSS_DSI_CONTENT_GENERIC);
> -}
> +		r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
> +	} else {
> +		r = dsi_vc_send_long(dsi, msg->channel, msg->type,
> +				     msg->tx_buf, msg->tx_len, 0);
> +	}
>  
> -static int dsi_vc_write_common(struct omap_dss_device *dssdev,
> -			       int channel, const u8 *data, int len,
> -			       enum dss_dsi_content_type type)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	int r;
> +	if (r < 0)
> +		return r;
>  
> -	r = dsi_vc_write_nosync_common(dsi, channel, data, len, type);
> -	if (r)
> -		goto err;
> +	/*
> +	 * TODO: we do not always have to do the BTA sync, for example
> +	 * we can improve performance by setting the update window
> +	 * information without sending BTA sync between the commands.
> +	 * In that case we can return early.
> +	 */
>  
> -	r = dsi_vc_send_bta_sync(dssdev, channel);
> -	if (r)
> -		goto err;
> +	r = dsi_vc_send_bta_sync(dssdev, msg->channel);
> +	if (r) {
> +		DSSERR("bta sync failed\n");
> +		return r;
> +	}
>  
>  	/* RX_FIFO_NOT_EMPTY */
> -	if (REG_GET(dsi, DSI_VC_CTRL(channel), 20, 20)) {
> +	if (REG_GET(dsi, DSI_VC_CTRL(msg->channel), 20, 20)) {
>  		DSSERR("rx fifo not empty after write, dumping data:\n");
> -		dsi_vc_flush_receive_data(dsi, channel);
> -		r = -EIO;
> -		goto err;
> +		dsi_vc_flush_receive_data(dsi, msg->channel);
> +		return -EIO;
>  	}
>  
>  	return 0;
> -err:
> -	DSSERR("dsi_vc_write_common(ch %d, cmd 0x%02x, len %d) failed\n",
> -			channel, data[0], len);
> -	return r;
> -}
> -
> -static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel,
> -		const u8 *data, int len)
> -{
> -	return dsi_vc_write_common(dssdev, channel, data, len,
> -			DSS_DSI_CONTENT_DCS);
> -}
> -
> -static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel,
> -		const u8 *data, int len)
> -{
> -	return dsi_vc_write_common(dssdev, channel, data, len,
> -			DSS_DSI_CONTENT_GENERIC);
>  }
>  
>  static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
> @@ -3008,15 +2961,6 @@ static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
>  	return 0;
>  }
>  
> -static int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
> -		u16 len)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> -	return dsi_vc_send_short(dsi, channel,
> -			MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE, len, 0);
> -}
> -
>  static int dsi_enter_ulps(struct dsi_data *dsi)
>  {
>  	DECLARE_COMPLETION_ONSTACK(completion);
> @@ -4817,36 +4761,17 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
>  static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
>  				 const struct mipi_dsi_msg *msg)
>  {
> -	/*
> -	 * no_sync can be used to optimize performance by sending e.g. column
> -	 * and page information without syncing in between. It's not absolutley
> -	 * required, so postpone this feature for now.
> -	 */
> -	bool no_sync = false;
> -	u16 val;
> -
>  	switch (msg->type) {
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
>  	case MIPI_DSI_GENERIC_LONG_WRITE:
> -		if (no_sync)
> -			return dsi_vc_generic_write_nosync(dssdev, msg->channel,
> -							   msg->tx_buf,
> -							   msg->tx_len);
> -		else
> -			return dsi_vc_generic_write(dssdev, msg->channel,
> -						    msg->tx_buf, msg->tx_len);
>  	case MIPI_DSI_DCS_SHORT_WRITE:
>  	case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
>  	case MIPI_DSI_DCS_LONG_WRITE:
> -		if (no_sync)
> -			return dsi_vc_dcs_write_nosync(dssdev, msg->channel,
> -						       msg->tx_buf,
> -						       msg->tx_len);
> -		else
> -			return dsi_vc_dcs_write(dssdev, msg->channel,
> -						msg->tx_buf, msg->tx_len);
> +	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
> +	case MIPI_DSI_NULL_PACKET:
> +		return dsi_vc_write_common(dssdev, msg);
>  	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
>  	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
>  	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
> @@ -4857,11 +4782,6 @@ static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
>  		return dsi_vc_dcs_read(dssdev, msg->channel,
>  				       ((u8 *)msg->tx_buf)[0],
>  				       msg->rx_buf, msg->rx_len);
> -	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
> -		val = le16_to_cpu(*((__le16 *)msg->tx_buf));
> -		return dsi_vc_set_max_rx_packet_size(dssdev, msg->channel, val);
> -	case MIPI_DSI_NULL_PACKET:
> -		return dsi_vc_send_null(to_dsi_data(dssdev), msg->channel);
>  	}
>  
>  	return -EINVAL;

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 11/56] drm/omap: dsi: simplify read functions
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:28     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:28 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:48PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Simplify the read related message handling by using the functionality
> provided by CONFIG_DRM_MIPI_DSI.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 110 +++++++++---------------------
>  1 file changed, 34 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index e1595c0608f2..bbdc52ee3559 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2742,60 +2742,6 @@ static int dsi_vc_write_common(struct omap_dss_device *dssdev,
>  	return 0;
>  }
>  
> -static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
> -					u8 dcs_cmd)
> -{
> -	int r;
> -
> -	if (dsi->debug_read)
> -		DSSDBG("dsi_vc_dcs_send_read_request(ch%d, dcs_cmd %x)\n",
> -			channel, dcs_cmd);
> -
> -	r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
> -	if (r) {
> -		DSSERR("dsi_vc_dcs_send_read_request(ch %d, cmd 0x%02x)"
> -			" failed\n", channel, dcs_cmd);
> -		return r;
> -	}
> -
> -	return 0;
> -}
> -
> -static int dsi_vc_generic_send_read_request(struct dsi_data *dsi, int channel,
> -					    const u8 *reqdata, int reqlen)
> -{
> -	u16 data;
> -	u8 data_type;
> -	int r;
> -
> -	if (dsi->debug_read)
> -		DSSDBG("dsi_vc_generic_send_read_request(ch %d, reqlen %d)\n",
> -			channel, reqlen);
> -
> -	if (reqlen == 0) {
> -		data_type = MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM;
> -		data = 0;
> -	} else if (reqlen == 1) {
> -		data_type = MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM;
> -		data = reqdata[0];
> -	} else if (reqlen == 2) {
> -		data_type = MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM;
> -		data = reqdata[0] | (reqdata[1] << 8);
> -	} else {
> -		BUG();
> -		return -EINVAL;
> -	}
> -
> -	r = dsi_vc_send_short(dsi, channel, data_type, data, 0);
> -	if (r) {
> -		DSSERR("dsi_vc_generic_send_read_request(ch %d, reqlen %d)"
> -			" failed\n", channel, reqlen);
> -		return r;
> -	}
> -
> -	return 0;
> -}
> -
>  static int dsi_vc_read_rx_fifo(struct dsi_data *dsi, int channel, u8 *buf,
>  			       int buflen, enum dss_dsi_content_type type)
>  {
> @@ -2904,13 +2850,18 @@ static int dsi_vc_read_rx_fifo(struct dsi_data *dsi, int channel, u8 *buf,
>  	return r;
>  }
>  
> -static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
> -		u8 *buf, int buflen)
> +static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
> +			   const struct mipi_dsi_msg *msg)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	u8 dcs_cmd = ((u8 *)msg->tx_buf)[0];
> +	u8 channel = msg->channel;
>  	int r;
>  
> -	r = dsi_vc_dcs_send_read_request(dsi, channel, dcs_cmd);
> +	if (dsi->debug_read)
> +		DSSDBG("%s(ch %d, cmd %x)\n", __func__, channel, dcs_cmd);
> +
> +	r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
>  	if (r)
>  		goto err;
>  
> @@ -2918,47 +2869,58 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_c
>  	if (r)
>  		goto err;
>  
> -	r = dsi_vc_read_rx_fifo(dsi, channel, buf, buflen,
> +	r = dsi_vc_read_rx_fifo(dsi, channel, msg->rx_buf, msg->rx_len,
>  		DSS_DSI_CONTENT_DCS);
>  	if (r < 0)
>  		goto err;
>  
> -	if (r != buflen) {
> +	if (r != msg->rx_len) {
>  		r = -EIO;
>  		goto err;
>  	}
>  
>  	return 0;
>  err:
> -	DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n", channel, dcs_cmd);
> +	DSSERR("%s(ch %d, cmd 0x%02x) failed\n", __func__, msg->channel, dcs_cmd);
>  	return r;
>  }
>  
> -static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
> -		const u8 *reqdata, int reqlen, u8 *buf, int buflen)
> +static int dsi_vc_generic_read(struct omap_dss_device *dssdev,
> +			       const struct mipi_dsi_msg *msg)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	struct mipi_dsi_packet packet;
> +	u16 data;
>  	int r;
>  
> -	r = dsi_vc_generic_send_read_request(dsi, channel, reqdata, reqlen);
> +	r = mipi_dsi_create_packet(&packet, msg);
> +	if (r < 0)
> +		goto err;
> +
> +	data = packet.header[1] | (packet.header[2] << 8);
> +
> +	r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
>  	if (r)
> -		return r;
> +		goto err;
>  
> -	r = dsi_vc_send_bta_sync(dssdev, channel);
> +	r = dsi_vc_send_bta_sync(dssdev, msg->channel);
>  	if (r)
> -		return r;
> +		goto err;
>  
> -	r = dsi_vc_read_rx_fifo(dsi, channel, buf, buflen,
> +	r = dsi_vc_read_rx_fifo(dsi, msg->channel, msg->rx_buf, msg->rx_len,
>  		DSS_DSI_CONTENT_GENERIC);
>  	if (r < 0)
> -		return r;
> +		goto err;
>  
> -	if (r != buflen) {
> +	if (r != msg->rx_len) {
>  		r = -EIO;
> -		return r;
> +		goto err;
>  	}
>  
>  	return 0;
> +err:
> +	DSSERR("%s(ch %d, reqlen %d) failed\n", __func__,  msg->channel, msg->tx_len);
> +	return r;
>  }
>  
>  static int dsi_enter_ulps(struct dsi_data *dsi)
> @@ -4775,13 +4737,9 @@ static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
>  	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
>  	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
>  	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
> -		return dsi_vc_generic_read(dssdev, msg->channel,
> -					   msg->tx_buf, msg->tx_len,
> -					   msg->rx_buf, msg->rx_len);
> +		return dsi_vc_generic_read(dssdev, msg);
>  	case MIPI_DSI_DCS_READ:
> -		return dsi_vc_dcs_read(dssdev, msg->channel,
> -				       ((u8 *)msg->tx_buf)[0],
> -				       msg->rx_buf, msg->rx_len);
> +		return dsi_vc_dcs_read(dssdev, msg);
>  	}
>  
>  	return -EINVAL;

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 11/56] drm/omap: dsi: simplify read functions
@ 2020-11-09  8:28     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:28 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:48PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Simplify the read related message handling by using the functionality
> provided by CONFIG_DRM_MIPI_DSI.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 110 +++++++++---------------------
>  1 file changed, 34 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index e1595c0608f2..bbdc52ee3559 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2742,60 +2742,6 @@ static int dsi_vc_write_common(struct omap_dss_device *dssdev,
>  	return 0;
>  }
>  
> -static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
> -					u8 dcs_cmd)
> -{
> -	int r;
> -
> -	if (dsi->debug_read)
> -		DSSDBG("dsi_vc_dcs_send_read_request(ch%d, dcs_cmd %x)\n",
> -			channel, dcs_cmd);
> -
> -	r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
> -	if (r) {
> -		DSSERR("dsi_vc_dcs_send_read_request(ch %d, cmd 0x%02x)"
> -			" failed\n", channel, dcs_cmd);
> -		return r;
> -	}
> -
> -	return 0;
> -}
> -
> -static int dsi_vc_generic_send_read_request(struct dsi_data *dsi, int channel,
> -					    const u8 *reqdata, int reqlen)
> -{
> -	u16 data;
> -	u8 data_type;
> -	int r;
> -
> -	if (dsi->debug_read)
> -		DSSDBG("dsi_vc_generic_send_read_request(ch %d, reqlen %d)\n",
> -			channel, reqlen);
> -
> -	if (reqlen == 0) {
> -		data_type = MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM;
> -		data = 0;
> -	} else if (reqlen == 1) {
> -		data_type = MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM;
> -		data = reqdata[0];
> -	} else if (reqlen == 2) {
> -		data_type = MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM;
> -		data = reqdata[0] | (reqdata[1] << 8);
> -	} else {
> -		BUG();
> -		return -EINVAL;
> -	}
> -
> -	r = dsi_vc_send_short(dsi, channel, data_type, data, 0);
> -	if (r) {
> -		DSSERR("dsi_vc_generic_send_read_request(ch %d, reqlen %d)"
> -			" failed\n", channel, reqlen);
> -		return r;
> -	}
> -
> -	return 0;
> -}
> -
>  static int dsi_vc_read_rx_fifo(struct dsi_data *dsi, int channel, u8 *buf,
>  			       int buflen, enum dss_dsi_content_type type)
>  {
> @@ -2904,13 +2850,18 @@ static int dsi_vc_read_rx_fifo(struct dsi_data *dsi, int channel, u8 *buf,
>  	return r;
>  }
>  
> -static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
> -		u8 *buf, int buflen)
> +static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
> +			   const struct mipi_dsi_msg *msg)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	u8 dcs_cmd = ((u8 *)msg->tx_buf)[0];
> +	u8 channel = msg->channel;
>  	int r;
>  
> -	r = dsi_vc_dcs_send_read_request(dsi, channel, dcs_cmd);
> +	if (dsi->debug_read)
> +		DSSDBG("%s(ch %d, cmd %x)\n", __func__, channel, dcs_cmd);
> +
> +	r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
>  	if (r)
>  		goto err;
>  
> @@ -2918,47 +2869,58 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_c
>  	if (r)
>  		goto err;
>  
> -	r = dsi_vc_read_rx_fifo(dsi, channel, buf, buflen,
> +	r = dsi_vc_read_rx_fifo(dsi, channel, msg->rx_buf, msg->rx_len,
>  		DSS_DSI_CONTENT_DCS);
>  	if (r < 0)
>  		goto err;
>  
> -	if (r != buflen) {
> +	if (r != msg->rx_len) {
>  		r = -EIO;
>  		goto err;
>  	}
>  
>  	return 0;
>  err:
> -	DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n", channel, dcs_cmd);
> +	DSSERR("%s(ch %d, cmd 0x%02x) failed\n", __func__, msg->channel, dcs_cmd);
>  	return r;
>  }
>  
> -static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
> -		const u8 *reqdata, int reqlen, u8 *buf, int buflen)
> +static int dsi_vc_generic_read(struct omap_dss_device *dssdev,
> +			       const struct mipi_dsi_msg *msg)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	struct mipi_dsi_packet packet;
> +	u16 data;
>  	int r;
>  
> -	r = dsi_vc_generic_send_read_request(dsi, channel, reqdata, reqlen);
> +	r = mipi_dsi_create_packet(&packet, msg);
> +	if (r < 0)
> +		goto err;
> +
> +	data = packet.header[1] | (packet.header[2] << 8);
> +
> +	r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
>  	if (r)
> -		return r;
> +		goto err;
>  
> -	r = dsi_vc_send_bta_sync(dssdev, channel);
> +	r = dsi_vc_send_bta_sync(dssdev, msg->channel);
>  	if (r)
> -		return r;
> +		goto err;
>  
> -	r = dsi_vc_read_rx_fifo(dsi, channel, buf, buflen,
> +	r = dsi_vc_read_rx_fifo(dsi, msg->channel, msg->rx_buf, msg->rx_len,
>  		DSS_DSI_CONTENT_GENERIC);
>  	if (r < 0)
> -		return r;
> +		goto err;
>  
> -	if (r != buflen) {
> +	if (r != msg->rx_len) {
>  		r = -EIO;
> -		return r;
> +		goto err;
>  	}
>  
>  	return 0;
> +err:
> +	DSSERR("%s(ch %d, reqlen %d) failed\n", __func__,  msg->channel, msg->tx_len);
> +	return r;
>  }
>  
>  static int dsi_enter_ulps(struct dsi_data *dsi)
> @@ -4775,13 +4737,9 @@ static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
>  	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
>  	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
>  	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
> -		return dsi_vc_generic_read(dssdev, msg->channel,
> -					   msg->tx_buf, msg->tx_len,
> -					   msg->rx_buf, msg->rx_len);
> +		return dsi_vc_generic_read(dssdev, msg);
>  	case MIPI_DSI_DCS_READ:
> -		return dsi_vc_dcs_read(dssdev, msg->channel,
> -				       ((u8 *)msg->tx_buf)[0],
> -				       msg->rx_buf, msg->rx_len);
> +		return dsi_vc_dcs_read(dssdev, msg);
>  	}
>  
>  	return -EINVAL;

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 12/56] drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:33     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:33 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:49PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Simplify the DSI encoder by using mipi_dsi_msg for
> dsi_vc_send_long and dsi_vc_send_short. Further improvements
> require cleaning up the channel allocation code first.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 89 ++++++++++++++-----------------
>  1 file changed, 40 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index bbdc52ee3559..6fa7833e32ad 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2599,8 +2599,8 @@ static inline void dsi_vc_write_long_payload(struct dsi_data *dsi, int channel,
>  	dsi_write_reg(dsi, DSI_VC_LONG_PACKET_PAYLOAD(channel), val);
>  }
>  
> -static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
> -			    const u8 *data, u16 len, u8 ecc)
> +static int dsi_vc_send_long(struct dsi_data *dsi,
> +			    const struct mipi_dsi_msg *msg)
>  {
>  	/*u32 val; */
>  	int i;
> @@ -2609,20 +2609,20 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
>  	u8 b1, b2, b3, b4;
>  
>  	if (dsi->debug_write)
> -		DSSDBG("dsi_vc_send_long, %d bytes\n", len);
> +		DSSDBG("dsi_vc_send_long, %d bytes\n", msg->tx_len);
>  
>  	/* len + header */
> -	if (dsi->vc[channel].tx_fifo_size * 32 * 4 < len + 4) {
> +	if (dsi->vc[msg->channel].tx_fifo_size * 32 * 4 < msg->tx_len + 4) {
>  		DSSERR("unable to send long packet: packet too long.\n");
>  		return -EINVAL;
>  	}
>  
> -	dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_L4);
> +	dsi_vc_config_source(dsi, msg->channel, DSI_VC_SOURCE_L4);
>  
> -	dsi_vc_write_long_header(dsi, channel, data_type, len, ecc);
> +	dsi_vc_write_long_header(dsi, msg->channel, msg->type, msg->tx_len, 0);
>  
> -	p = data;
> -	for (i = 0; i < len >> 2; i++) {
> +	p = msg->tx_buf;
> +	for (i = 0; i < msg->tx_len >> 2; i++) {
>  		if (dsi->debug_write)
>  			DSSDBG("\tsending full packet %d\n", i);
>  
> @@ -2631,10 +2631,10 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
>  		b3 = *p++;
>  		b4 = *p++;
>  
> -		dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, b4);
> +		dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, b4);
>  	}
>  
> -	i = len % 4;
> +	i = msg->tx_len % 4;
>  	if (i) {
>  		b1 = 0; b2 = 0; b3 = 0;
>  
> @@ -2656,65 +2656,64 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
>  			break;
>  		}
>  
> -		dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, 0);
> +		dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, 0);
>  	}
>  
>  	return r;
>  }
>  
> -static int dsi_vc_send_short(struct dsi_data *dsi, int channel, u8 data_type,
> -			     u16 data, u8 ecc)
> +static int dsi_vc_send_short(struct dsi_data *dsi,
> +			     const struct mipi_dsi_msg *msg)
>  {
> +	struct mipi_dsi_packet pkt;
>  	u32 r;
> -	u8 data_id;
> +
> +	r = mipi_dsi_create_packet(&pkt, msg);
> +	if (r < 0)
> +		return r;
>  
>  	WARN_ON(!dsi_bus_is_locked(dsi));
>  
>  	if (dsi->debug_write)
>  		DSSDBG("dsi_vc_send_short(ch%d, dt %#x, b1 %#x, b2 %#x)\n",
> -				channel,
> -				data_type, data & 0xff, (data >> 8) & 0xff);
> +				msg->channel,
> +				msg->type, pkt.header[1], pkt.header[2]);

You could fix the indentation while at it.

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

>  
> -	dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_L4);
> +	dsi_vc_config_source(dsi, msg->channel, DSI_VC_SOURCE_L4);
>  
> -	if (FLD_GET(dsi_read_reg(dsi, DSI_VC_CTRL(channel)), 16, 16)) {
> +	if (FLD_GET(dsi_read_reg(dsi, DSI_VC_CTRL(msg->channel)), 16, 16)) {
>  		DSSERR("ERROR FIFO FULL, aborting transfer\n");
>  		return -EINVAL;
>  	}
>  
> -	data_id = data_type | channel << 6;
> -
> -	r = (data_id << 0) | (data << 8) | (ecc << 24);
> +	r = pkt.header[3] << 24 | pkt.header[2] << 16 | pkt.header[1] << 8 |
> +	    pkt.header[0];
>  
> -	dsi_write_reg(dsi, DSI_VC_SHORT_PACKET_HEADER(channel), r);
> +	dsi_write_reg(dsi, DSI_VC_SHORT_PACKET_HEADER(msg->channel), r);
>  
>  	return 0;
>  }
>  
>  static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
>  {
> -	return dsi_vc_send_long(dsi, channel, MIPI_DSI_NULL_PACKET, NULL, 0, 0);
> +	const struct mipi_dsi_msg msg = {
> +		.channel = channel,
> +		.type = MIPI_DSI_NULL_PACKET,
> +	};
> +
> +	return dsi_vc_send_long(dsi, &msg);
>  }
>  
>  static int dsi_vc_write_common(struct omap_dss_device *dssdev,
>  			       const struct mipi_dsi_msg *msg)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	struct mipi_dsi_packet packet;
>  	int r;
>  
> -	r = mipi_dsi_create_packet(&packet, msg);
> -	if (r < 0)
> -		return r;
> -
> -	if (mipi_dsi_packet_format_is_short(msg->type)) {
> -		u16 data = packet.header[1] | (packet.header[2] << 8);
> -
> -		r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
> -	} else {
> -		r = dsi_vc_send_long(dsi, msg->channel, msg->type,
> -				     msg->tx_buf, msg->tx_len, 0);
> -	}
> +	if (mipi_dsi_packet_format_is_short(msg->type))
> +		r = dsi_vc_send_short(dsi, msg);
> +	else
> +		r = dsi_vc_send_long(dsi, msg);
>  
>  	if (r < 0)
>  		return r;
> @@ -2854,14 +2853,14 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
>  			   const struct mipi_dsi_msg *msg)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	u8 dcs_cmd = ((u8 *)msg->tx_buf)[0];
> +	u8 cmd = ((u8 *)msg->tx_buf)[0];
>  	u8 channel = msg->channel;
>  	int r;
>  
>  	if (dsi->debug_read)
> -		DSSDBG("%s(ch %d, cmd %x)\n", __func__, channel, dcs_cmd);
> +		DSSDBG("%s(ch %d, cmd %x)\n", __func__, channel, cmd);
>  
> -	r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
> +	r = dsi_vc_send_short(dsi, msg);
>  	if (r)
>  		goto err;
>  
> @@ -2881,7 +2880,7 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
>  
>  	return 0;
>  err:
> -	DSSERR("%s(ch %d, cmd 0x%02x) failed\n", __func__, msg->channel, dcs_cmd);
> +	DSSERR("%s(ch %d, cmd 0x%02x) failed\n", __func__,  msg->channel, cmd);
>  	return r;
>  }
>  
> @@ -2889,17 +2888,9 @@ static int dsi_vc_generic_read(struct omap_dss_device *dssdev,
>  			       const struct mipi_dsi_msg *msg)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	struct mipi_dsi_packet packet;
> -	u16 data;
>  	int r;
>  
> -	r = mipi_dsi_create_packet(&packet, msg);
> -	if (r < 0)
> -		goto err;
> -
> -	data = packet.header[1] | (packet.header[2] << 8);
> -
> -	r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
> +	r = dsi_vc_send_short(dsi, msg);
>  	if (r)
>  		goto err;
>  

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 12/56] drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg
@ 2020-11-09  8:33     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:33 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:49PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Simplify the DSI encoder by using mipi_dsi_msg for
> dsi_vc_send_long and dsi_vc_send_short. Further improvements
> require cleaning up the channel allocation code first.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 89 ++++++++++++++-----------------
>  1 file changed, 40 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index bbdc52ee3559..6fa7833e32ad 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2599,8 +2599,8 @@ static inline void dsi_vc_write_long_payload(struct dsi_data *dsi, int channel,
>  	dsi_write_reg(dsi, DSI_VC_LONG_PACKET_PAYLOAD(channel), val);
>  }
>  
> -static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
> -			    const u8 *data, u16 len, u8 ecc)
> +static int dsi_vc_send_long(struct dsi_data *dsi,
> +			    const struct mipi_dsi_msg *msg)
>  {
>  	/*u32 val; */
>  	int i;
> @@ -2609,20 +2609,20 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
>  	u8 b1, b2, b3, b4;
>  
>  	if (dsi->debug_write)
> -		DSSDBG("dsi_vc_send_long, %d bytes\n", len);
> +		DSSDBG("dsi_vc_send_long, %d bytes\n", msg->tx_len);
>  
>  	/* len + header */
> -	if (dsi->vc[channel].tx_fifo_size * 32 * 4 < len + 4) {
> +	if (dsi->vc[msg->channel].tx_fifo_size * 32 * 4 < msg->tx_len + 4) {
>  		DSSERR("unable to send long packet: packet too long.\n");
>  		return -EINVAL;
>  	}
>  
> -	dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_L4);
> +	dsi_vc_config_source(dsi, msg->channel, DSI_VC_SOURCE_L4);
>  
> -	dsi_vc_write_long_header(dsi, channel, data_type, len, ecc);
> +	dsi_vc_write_long_header(dsi, msg->channel, msg->type, msg->tx_len, 0);
>  
> -	p = data;
> -	for (i = 0; i < len >> 2; i++) {
> +	p = msg->tx_buf;
> +	for (i = 0; i < msg->tx_len >> 2; i++) {
>  		if (dsi->debug_write)
>  			DSSDBG("\tsending full packet %d\n", i);
>  
> @@ -2631,10 +2631,10 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
>  		b3 = *p++;
>  		b4 = *p++;
>  
> -		dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, b4);
> +		dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, b4);
>  	}
>  
> -	i = len % 4;
> +	i = msg->tx_len % 4;
>  	if (i) {
>  		b1 = 0; b2 = 0; b3 = 0;
>  
> @@ -2656,65 +2656,64 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
>  			break;
>  		}
>  
> -		dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, 0);
> +		dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, 0);
>  	}
>  
>  	return r;
>  }
>  
> -static int dsi_vc_send_short(struct dsi_data *dsi, int channel, u8 data_type,
> -			     u16 data, u8 ecc)
> +static int dsi_vc_send_short(struct dsi_data *dsi,
> +			     const struct mipi_dsi_msg *msg)
>  {
> +	struct mipi_dsi_packet pkt;
>  	u32 r;
> -	u8 data_id;
> +
> +	r = mipi_dsi_create_packet(&pkt, msg);
> +	if (r < 0)
> +		return r;
>  
>  	WARN_ON(!dsi_bus_is_locked(dsi));
>  
>  	if (dsi->debug_write)
>  		DSSDBG("dsi_vc_send_short(ch%d, dt %#x, b1 %#x, b2 %#x)\n",
> -				channel,
> -				data_type, data & 0xff, (data >> 8) & 0xff);
> +				msg->channel,
> +				msg->type, pkt.header[1], pkt.header[2]);

You could fix the indentation while at it.

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

>  
> -	dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_L4);
> +	dsi_vc_config_source(dsi, msg->channel, DSI_VC_SOURCE_L4);
>  
> -	if (FLD_GET(dsi_read_reg(dsi, DSI_VC_CTRL(channel)), 16, 16)) {
> +	if (FLD_GET(dsi_read_reg(dsi, DSI_VC_CTRL(msg->channel)), 16, 16)) {
>  		DSSERR("ERROR FIFO FULL, aborting transfer\n");
>  		return -EINVAL;
>  	}
>  
> -	data_id = data_type | channel << 6;
> -
> -	r = (data_id << 0) | (data << 8) | (ecc << 24);
> +	r = pkt.header[3] << 24 | pkt.header[2] << 16 | pkt.header[1] << 8 |
> +	    pkt.header[0];
>  
> -	dsi_write_reg(dsi, DSI_VC_SHORT_PACKET_HEADER(channel), r);
> +	dsi_write_reg(dsi, DSI_VC_SHORT_PACKET_HEADER(msg->channel), r);
>  
>  	return 0;
>  }
>  
>  static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
>  {
> -	return dsi_vc_send_long(dsi, channel, MIPI_DSI_NULL_PACKET, NULL, 0, 0);
> +	const struct mipi_dsi_msg msg = {
> +		.channel = channel,
> +		.type = MIPI_DSI_NULL_PACKET,
> +	};
> +
> +	return dsi_vc_send_long(dsi, &msg);
>  }
>  
>  static int dsi_vc_write_common(struct omap_dss_device *dssdev,
>  			       const struct mipi_dsi_msg *msg)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	struct mipi_dsi_packet packet;
>  	int r;
>  
> -	r = mipi_dsi_create_packet(&packet, msg);
> -	if (r < 0)
> -		return r;
> -
> -	if (mipi_dsi_packet_format_is_short(msg->type)) {
> -		u16 data = packet.header[1] | (packet.header[2] << 8);
> -
> -		r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
> -	} else {
> -		r = dsi_vc_send_long(dsi, msg->channel, msg->type,
> -				     msg->tx_buf, msg->tx_len, 0);
> -	}
> +	if (mipi_dsi_packet_format_is_short(msg->type))
> +		r = dsi_vc_send_short(dsi, msg);
> +	else
> +		r = dsi_vc_send_long(dsi, msg);
>  
>  	if (r < 0)
>  		return r;
> @@ -2854,14 +2853,14 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
>  			   const struct mipi_dsi_msg *msg)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	u8 dcs_cmd = ((u8 *)msg->tx_buf)[0];
> +	u8 cmd = ((u8 *)msg->tx_buf)[0];
>  	u8 channel = msg->channel;
>  	int r;
>  
>  	if (dsi->debug_read)
> -		DSSDBG("%s(ch %d, cmd %x)\n", __func__, channel, dcs_cmd);
> +		DSSDBG("%s(ch %d, cmd %x)\n", __func__, channel, cmd);
>  
> -	r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
> +	r = dsi_vc_send_short(dsi, msg);
>  	if (r)
>  		goto err;
>  
> @@ -2881,7 +2880,7 @@ static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
>  
>  	return 0;
>  err:
> -	DSSERR("%s(ch %d, cmd 0x%02x) failed\n", __func__, msg->channel, dcs_cmd);
> +	DSSERR("%s(ch %d, cmd 0x%02x) failed\n", __func__,  msg->channel, cmd);
>  	return r;
>  }
>  
> @@ -2889,17 +2888,9 @@ static int dsi_vc_generic_read(struct omap_dss_device *dssdev,
>  			       const struct mipi_dsi_msg *msg)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	struct mipi_dsi_packet packet;
> -	u16 data;
>  	int r;
>  
> -	r = mipi_dsi_create_packet(&packet, msg);
> -	if (r < 0)
> -		goto err;
> -
> -	data = packet.header[1] | (packet.header[2] << 8);
> -
> -	r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
> +	r = dsi_vc_send_short(dsi, msg);
>  	if (r)
>  		goto err;
>  

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 13/56] drm/omap: dsi: introduce mipi_dsi_host
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:38     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:38 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:50PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This moves from custom platform driver infrastructure to mipi_dsi_host
> and mipi_dsi_device. Note, that this is a graduate step and the driver
> only uses the devices types and transfer function, but not yet the new
> device binding style or drm_panel.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 121 +++++++++---------
>  drivers/gpu/drm/omapdrm/dss/dsi.c             |  54 ++++++--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |   4 -
>  3 files changed, 103 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index ea76a89d1833..c3190223d192 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -14,7 +14,6 @@
>  #include <linux/interrupt.h>
>  #include <linux/jiffies.h>
>  #include <linux/module.h>
> -#include <linux/platform_device.h>
>  #include <linux/sched/signal.h>
>  #include <linux/slab.h>
>  #include <linux/workqueue.h>
> @@ -39,13 +38,13 @@
>  #define DCS_GET_ID3		0xdc
>  
>  struct panel_drv_data {
> +	struct mipi_dsi_device *dsi;
> +
>  	struct omap_dss_device dssdev;
>  	struct omap_dss_device *src;
>  
>  	struct videomode vm;
>  
> -	struct platform_device *pdev;
> -
>  	struct mutex lock;
>  
>  	struct backlight_device *bldev;
> @@ -139,7 +138,7 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
>  
>  static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	const struct mipi_dsi_msg msg = {
>  		.channel = ddata->channel,
>  		.type = MIPI_DSI_DCS_READ,
> @@ -149,12 +148,12 @@ static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
>  		.rx_buf = data
>  	};
>  
> -	return src->ops->dsi.transfer(src, &msg);
> +	return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	const struct mipi_dsi_msg msg = {
>  		.channel = ddata->channel,
>  		.type = MIPI_DSI_DCS_SHORT_WRITE,
> @@ -162,12 +161,12 @@ static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
>  		.tx_len = 1,
>  	};
>  
> -	return src->ops->dsi.transfer(src, &msg);
> +	return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	const u8 buf[] = { dcs_cmd, param };
>  	const struct mipi_dsi_msg msg = {
>  		.channel = ddata->channel,
> @@ -176,13 +175,13 @@ static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
>  		.tx_len = 2,
>  	};
>  
> -	return src->ops->dsi.transfer(src, &msg);
> +	return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	int r;
>  	const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
>  	const struct mipi_dsi_msg msg = {
> @@ -194,7 +193,7 @@ static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>  	hw_guard_wait(ddata);
>  
> -	r = src->ops->dsi.transfer(src, &msg);
> +	r = dsi->host->ops->transfer(dsi->host, &msg);
>  	if (r)
>  		return r;
>  
> @@ -242,7 +241,7 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
>  static int dsicm_set_update_window(struct panel_drv_data *ddata,
>  		u16 x, u16 y, u16 w, u16 h)
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	int r;
>  	u16 x1 = x;
>  	u16 x2 = x + w - 1;
> @@ -279,11 +278,11 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
>  		.tx_len = 5,
>  	};
>  
> -	r = src->ops->dsi.transfer(src, &msgX);
> +	r = dsi->host->ops->transfer(dsi->host, &msgX);
>  	if (r)
>  		return r;
>  
> -	r = src->ops->dsi.transfer(src, &msgY);
> +	r = dsi->host->ops->transfer(dsi->host, &msgY);
>  	if (r)
>  		return r;
>  
> @@ -326,7 +325,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>  	return 0;
>  
>  err:
> -	dev_err(&ddata->pdev->dev, "enter ULPS failed");
> +	dev_err(&ddata->dsi->dev, "enter ULPS failed");
>  	dsicm_panel_reset(ddata);
>  
>  	ddata->ulps_enabled = false;
> @@ -349,7 +348,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  
>  	r = _dsicm_enable_te(ddata, true);
>  	if (r) {
> -		dev_err(&ddata->pdev->dev, "failed to re-enable TE");
> +		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
>  		goto err2;
>  	}
>  
> @@ -363,7 +362,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  	return 0;
>  
>  err2:
> -	dev_err(&ddata->pdev->dev, "failed to exit ULPS");
> +	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
>  
>  	r = dsicm_panel_reset(ddata);
>  	if (!r) {
> @@ -400,7 +399,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
>  	else
>  		level = 0;
>  
> -	dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level);
> +	dev_dbg(&ddata->dsi->dev, "update brightness to %d\n", level);
>  
>  	mutex_lock(&ddata->lock);
>  
> @@ -637,7 +636,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (ddata->vpnl) {
>  		r = regulator_enable(ddata->vpnl);
>  		if (r) {
> -			dev_err(&ddata->pdev->dev,
> +			dev_err(&ddata->dsi->dev,
>  				"failed to enable VPNL: %d\n", r);
>  			return r;
>  		}
> @@ -646,7 +645,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (ddata->vddi) {
>  		r = regulator_enable(ddata->vddi);
>  		if (r) {
> -			dev_err(&ddata->pdev->dev,
> +			dev_err(&ddata->dsi->dev,
>  				"failed to enable VDDI: %d\n", r);
>  			goto err_vpnl;
>  		}
> @@ -654,7 +653,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	r = src->ops->dsi.set_config(src, &dsi_config);
>  	if (r) {
> -		dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
> +		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
>  		goto err_vddi;
>  	}
>  
> @@ -701,7 +700,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	ddata->enabled = true;
>  
>  	if (!ddata->intro_printed) {
> -		dev_info(&ddata->pdev->dev, "panel revision %02x.%02x.%02x\n",
> +		dev_info(&ddata->dsi->dev, "panel revision %02x.%02x.%02x\n",
>  			id1, id2, id3);
>  		ddata->intro_printed = true;
>  	}
> @@ -710,7 +709,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	return 0;
>  err:
> -	dev_err(&ddata->pdev->dev, "error while enabling panel, issuing HW reset\n");
> +	dev_err(&ddata->dsi->dev, "error while enabling panel, issuing HW reset\n");
>  
>  	dsicm_hw_reset(ddata);
>  
> @@ -737,7 +736,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  		r = dsicm_sleep_in(ddata);
>  
>  	if (r) {
> -		dev_err(&ddata->pdev->dev,
> +		dev_err(&ddata->dsi->dev,
>  				"error disabling panel, issuing HW reset\n");
>  		dsicm_hw_reset(ddata);
>  	}
> @@ -754,7 +753,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  
>  static int dsicm_panel_reset(struct panel_drv_data *ddata)
>  {
> -	dev_err(&ddata->pdev->dev, "performing LCD reset\n");
> +	dev_err(&ddata->dsi->dev, "performing LCD reset\n");
>  
>  	dsicm_power_off(ddata);
>  	dsicm_hw_reset(ddata);
> @@ -765,7 +764,7 @@ static int dsicm_connect(struct omap_dss_device *src,
>  			 struct omap_dss_device *dst)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dst);
> -	struct device *dev = &ddata->pdev->dev;
> +	struct device *dev = &ddata->dsi->dev;
>  	int r;
>  
>  	r = src->ops->dsi.request_vc(src, ddata->channel);
> @@ -810,7 +809,7 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>  
>  	return;
>  err:
> -	dev_dbg(&ddata->pdev->dev, "enable failed (%d)\n", r);
> +	dev_dbg(&ddata->dsi->dev, "enable failed (%d)\n", r);
>  	mutex_unlock(&ddata->lock);
>  }
>  
> @@ -842,7 +841,7 @@ static void dsicm_framedone_cb(int err, void *data)
>  	struct panel_drv_data *ddata = data;
>  	struct omap_dss_device *src = ddata->src;
>  
> -	dev_dbg(&ddata->pdev->dev, "framedone, err %d\n", err);
> +	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
>  	src->ops->dsi.bus_unlock(src);
>  }
>  
> @@ -866,7 +865,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data)
>  
>  	return IRQ_HANDLED;
>  err:
> -	dev_err(&ddata->pdev->dev, "start update failed\n");
> +	dev_err(&ddata->dsi->dev, "start update failed\n");
>  	src->ops->dsi.bus_unlock(src);
>  	return IRQ_HANDLED;
>  }
> @@ -877,7 +876,7 @@ static void dsicm_te_timeout_work_callback(struct work_struct *work)
>  					te_timeout_work.work);
>  	struct omap_dss_device *src = ddata->src;
>  
> -	dev_err(&ddata->pdev->dev, "TE not received for 250ms!\n");
> +	dev_err(&ddata->dsi->dev, "TE not received for 250ms!\n");
>  
>  	atomic_set(&ddata->do_update, 0);
>  	src->ops->dsi.bus_unlock(src);
> @@ -890,7 +889,7 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  	struct omap_dss_device *src = ddata->src;
>  	int r;
>  
> -	dev_dbg(&ddata->pdev->dev, "update %d, %d, %d x %d\n", x, y, w, h);
> +	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>  
>  	mutex_lock(&ddata->lock);
>  	src->ops->dsi.bus_lock(src);
> @@ -935,14 +934,14 @@ static int dsicm_sync(struct omap_dss_device *dssdev)
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
>  	struct omap_dss_device *src = ddata->src;
>  
> -	dev_dbg(&ddata->pdev->dev, "sync\n");
> +	dev_dbg(&ddata->dsi->dev, "sync\n");
>  
>  	mutex_lock(&ddata->lock);
>  	src->ops->dsi.bus_lock(src);
>  	src->ops->dsi.bus_unlock(src);
>  	mutex_unlock(&ddata->lock);
>  
> -	dev_dbg(&ddata->pdev->dev, "sync done\n");
> +	dev_dbg(&ddata->dsi->dev, "sync done\n");
>  
>  	return 0;
>  }
> @@ -1019,7 +1018,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
>  					u16 size)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  
>  	const u8 buf[] = {
>  		size & 0xff,
> @@ -1033,7 +1032,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
>  		.tx_len = 2,
>  	};
>  
> -	return src->ops->dsi.transfer(src, &msg);
> +	return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_memory_read(struct omap_dss_device *dssdev,
> @@ -1041,6 +1040,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  		u16 x, u16 y, u16 w, u16 h)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	struct omap_dss_device *src = ddata->src;
>  	int r;
>  	int first = 1;
> @@ -1092,7 +1092,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  		};
>  		first = 0;
>  
> -		r = src->ops->dsi.transfer(src, &msg);
> +		r = dsi->host->ops->transfer(dsi->host, &msg);
>  		if (r < 0) {
>  			dev_err(dssdev->dev, "read error\n");
>  			goto err3;
> @@ -1101,12 +1101,12 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  		buf_used += r;
>  
>  		if (r < plen) {
> -			dev_err(&ddata->pdev->dev, "short read\n");
> +			dev_err(&ddata->dsi->dev, "short read\n");
>  			break;
>  		}
>  
>  		if (signal_pending(current)) {
> -			dev_err(&ddata->pdev->dev, "signal pending, "
> +			dev_err(&ddata->dsi->dev, "signal pending, "
>  					"aborting memory read\n");
>  			r = -ERESTARTSYS;
>  			goto err3;
> @@ -1200,28 +1200,28 @@ static const struct omap_dss_driver dsicm_dss_driver = {
>  	.memory_read	= dsicm_memory_read,
>  };
>  
> -static int dsicm_probe_of(struct platform_device *pdev)
> +static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  {
> -	struct device_node *node = pdev->dev.of_node;
> +	struct device_node *node = dsi->dev.of_node;
>  	struct backlight_device *backlight;
> -	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> +	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>  	struct display_timing timing;
>  	int err;
>  
>  	ddata->channel = TCH;
>  
> -	ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
> +	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
>  	if (IS_ERR(ddata->reset_gpio)) {
>  		err = PTR_ERR(ddata->reset_gpio);
> -		dev_err(&pdev->dev, "reset gpio request failed: %d", err);
> +		dev_err(&dsi->dev, "reset gpio request failed: %d", err);
>  		return err;
>  	}
>  
> -	ddata->ext_te_gpio = devm_gpiod_get_optional(&pdev->dev, "te",
> +	ddata->ext_te_gpio = devm_gpiod_get_optional(&dsi->dev, "te",
>  						     GPIOD_IN);
>  	if (IS_ERR(ddata->ext_te_gpio)) {
>  		err = PTR_ERR(ddata->ext_te_gpio);
> -		dev_err(&pdev->dev, "TE gpio request failed: %d", err);
> +		dev_err(&dsi->dev, "TE gpio request failed: %d", err);
>  		return err;
>  	}
>  
> @@ -1232,7 +1232,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  			ddata->vm.pixelclock =
>  				ddata->vm.hactive * ddata->vm.vactive * 60;
>  	} else {
> -		dev_warn(&pdev->dev,
> +		dev_warn(&dsi->dev,
>  			 "failed to get video timing, using defaults\n");
>  	}
>  
> @@ -1242,7 +1242,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  	ddata->height_mm = 0;
>  	of_property_read_u32(node, "height-mm", &ddata->height_mm);
>  
> -	ddata->vpnl = devm_regulator_get_optional(&pdev->dev, "vpnl");
> +	ddata->vpnl = devm_regulator_get_optional(&dsi->dev, "vpnl");
>  	if (IS_ERR(ddata->vpnl)) {
>  		err = PTR_ERR(ddata->vpnl);
>  		if (err == -EPROBE_DEFER)
> @@ -1250,7 +1250,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  		ddata->vpnl = NULL;
>  	}
>  
> -	ddata->vddi = devm_regulator_get_optional(&pdev->dev, "vddi");
> +	ddata->vddi = devm_regulator_get_optional(&dsi->dev, "vddi");
>  	if (IS_ERR(ddata->vddi)) {
>  		err = PTR_ERR(ddata->vddi);
>  		if (err == -EPROBE_DEFER)
> @@ -1258,7 +1258,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  		ddata->vddi = NULL;
>  	}
>  
> -	backlight = devm_of_find_backlight(&pdev->dev);
> +	backlight = devm_of_find_backlight(&dsi->dev);
>  	if (IS_ERR(backlight))
>  		return PTR_ERR(backlight);
>  
> @@ -1273,11 +1273,11 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int dsicm_probe(struct platform_device *pdev)
> +static int dsicm_probe(struct mipi_dsi_device *dsi)
>  {
>  	struct panel_drv_data *ddata;
>  	struct backlight_device *bldev = NULL;
> -	struct device *dev = &pdev->dev;
> +	struct device *dev = &dsi->dev;
>  	struct omap_dss_device *dssdev;
>  	int r;
>  
> @@ -1287,14 +1287,14 @@ static int dsicm_probe(struct platform_device *pdev)
>  	if (!ddata)
>  		return -ENOMEM;
>  
> -	platform_set_drvdata(pdev, ddata);
> -	ddata->pdev = pdev;
> +	mipi_dsi_set_drvdata(dsi, ddata);
> +	ddata->dsi = dsi;
>  
>  	ddata->vm.hactive = 864;
>  	ddata->vm.vactive = 480;
>  	ddata->vm.pixelclock = 864 * 480 * 60;
>  
> -	r = dsicm_probe_of(pdev);
> +	r = dsicm_probe_of(dsi);
>  	if (r)
>  		return r;
>  
> @@ -1376,12 +1376,12 @@ static int dsicm_probe(struct platform_device *pdev)
>  	return r;
>  }
>  
> -static int __exit dsicm_remove(struct platform_device *pdev)
> +static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>  {
> -	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> +	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>  	struct omap_dss_device *dssdev = &ddata->dssdev;
>  
> -	dev_dbg(&pdev->dev, "remove\n");
> +	dev_dbg(&dsi->dev, "remove\n");
>  
>  	omapdss_device_unregister(dssdev);
>  
> @@ -1389,7 +1389,7 @@ static int __exit dsicm_remove(struct platform_device *pdev)
>  		dsicm_disable(dssdev);
>  	omapdss_device_disconnect(ddata->src, dssdev);
>  
> -	sysfs_remove_group(&pdev->dev.kobj, &dsicm_attr_group);
> +	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>  
>  	if (ddata->extbldev)
>  		put_device(&ddata->extbldev->dev);
> @@ -1410,7 +1410,7 @@ static const struct of_device_id dsicm_of_match[] = {
>  
>  MODULE_DEVICE_TABLE(of, dsicm_of_match);
>  
> -static struct platform_driver dsicm_driver = {
> +static struct mipi_dsi_driver dsicm_driver = {
>  	.probe = dsicm_probe,
>  	.remove = __exit_p(dsicm_remove),
>  	.driver = {
> @@ -1419,8 +1419,7 @@ static struct platform_driver dsicm_driver = {
>  		.suppress_bind_attrs = true,
>  	},
>  };
> -
> -module_platform_driver(dsicm_driver);
> +module_mipi_dsi_driver(dsicm_driver);
>  
>  MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
>  MODULE_DESCRIPTION("Generic DSI Command Mode Panel Driver");
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 6fa7833e32ad..d1187a8af37f 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -334,6 +334,8 @@ struct dsi_data {
>  	struct regmap *syscon;
>  	struct dss_device *dss;
>  
> +	struct mipi_dsi_host host;
> +
>  	struct dispc_clock_info user_dispc_cinfo;
>  	struct dss_pll_clock_info user_dsi_cinfo;
>  
> @@ -432,6 +434,11 @@ static inline struct dsi_data *to_dsi_data(struct omap_dss_device *dssdev)
>  	return dev_get_drvdata(dssdev->dev);
>  }
>  
> +static inline struct dsi_data *host_to_omap(struct mipi_dsi_host *host)
> +{
> +	return container_of(host, struct dsi_data, host);
> +}
> +
>  static inline void dsi_write_reg(struct dsi_data *dsi,
>  				 const struct dsi_reg idx, u32 val)
>  {
> @@ -4711,9 +4718,12 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
>  	}
>  }
>  
> -static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
> -				 const struct mipi_dsi_msg *msg)
> +static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
> +				      const struct mipi_dsi_msg *msg)
>  {
> +	struct dsi_data *dsi = host_to_omap(host);
> +	struct omap_dss_device *dssdev = &dsi->output;
> +
>  	switch (msg->type) {
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
> @@ -4787,11 +4797,30 @@ static const struct omap_dss_device_ops dsi_ops = {
>  
>  		.request_vc = dsi_request_vc,
>  		.release_vc = dsi_release_vc,
> -
> -		.transfer = omap_dsi_transfer,
>  	},
>  };
>  
> +static int omap_dsi_host_attach(struct mipi_dsi_host *host,
> +			 struct mipi_dsi_device *dsi)
> +{
> +	/* TODO: convert driver from custom binding method to this one */
> +	return 0;
> +}
> +
> +static int omap_dsi_host_detach(struct mipi_dsi_host *host,
> +			 struct mipi_dsi_device *dsi)
> +{
> +	/* TODO: convert driver from custom binding method to this one */
> +	return 0;
> +}
> +
> +static const struct mipi_dsi_host_ops omap_dsi_host_ops = {
> +	.attach = omap_dsi_host_attach,
> +	.detach = omap_dsi_host_detach,
> +	.transfer = omap_dsi_host_transfer,
> +};
> +
> +

A single blank line is enough.

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

>  /* -----------------------------------------------------------------------------
>   * PLL
>   */
> @@ -5260,15 +5289,18 @@ static int dsi_probe(struct platform_device *pdev)
>  		dsi->num_lanes_supported = 3;
>  	}
>  
> -	r = of_platform_populate(dev->of_node, NULL, NULL, dev);
> -	if (r) {
> -		DSSERR("Failed to populate DSI child devices: %d\n", r);
> +	dsi->host.ops = &omap_dsi_host_ops;
> +	dsi->host.dev = &pdev->dev;
> +
> +	r = mipi_dsi_host_register(&dsi->host);
> +	if (r < 0) {
> +		dev_err(&pdev->dev, "failed to register DSI host: %d\n", r);
>  		goto err_pm_disable;
>  	}
>  
>  	r = dsi_init_output(dsi);
>  	if (r)
> -		goto err_of_depopulate;
> +		goto err_dsi_host_unregister;
>  
>  	r = dsi_probe_of(dsi);
>  	if (r) {
> @@ -5284,8 +5316,8 @@ static int dsi_probe(struct platform_device *pdev)
>  
>  err_uninit_output:
>  	dsi_uninit_output(dsi);
> -err_of_depopulate:
> -	of_platform_depopulate(dev);
> +err_dsi_host_unregister:
> +	mipi_dsi_host_unregister(&dsi->host);
>  err_pm_disable:
>  	pm_runtime_disable(dev);
>  	return r;
> @@ -5299,7 +5331,7 @@ static int dsi_remove(struct platform_device *pdev)
>  
>  	dsi_uninit_output(dsi);
>  
> -	of_platform_depopulate(&pdev->dev);
> +	mipi_dsi_host_unregister(&dsi->host);
>  
>  	pm_runtime_disable(&pdev->dev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 40e1ce9e256e..8cd2c800922e 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -304,10 +304,6 @@ struct omapdss_dsi_ops {
>  
>  	int (*request_vc)(struct omap_dss_device *dssdev, int channel);
>  	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
> -
> -	/* data transfer */
> -	ssize_t (*transfer)(struct omap_dss_device *dssdev,
> -			    const struct mipi_dsi_msg *msg);
>  };
>  
>  struct omap_dss_device_ops {

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 13/56] drm/omap: dsi: introduce mipi_dsi_host
@ 2020-11-09  8:38     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:38 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:50PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This moves from custom platform driver infrastructure to mipi_dsi_host
> and mipi_dsi_device. Note, that this is a graduate step and the driver
> only uses the devices types and transfer function, but not yet the new
> device binding style or drm_panel.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 121 +++++++++---------
>  drivers/gpu/drm/omapdrm/dss/dsi.c             |  54 ++++++--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |   4 -
>  3 files changed, 103 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index ea76a89d1833..c3190223d192 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -14,7 +14,6 @@
>  #include <linux/interrupt.h>
>  #include <linux/jiffies.h>
>  #include <linux/module.h>
> -#include <linux/platform_device.h>
>  #include <linux/sched/signal.h>
>  #include <linux/slab.h>
>  #include <linux/workqueue.h>
> @@ -39,13 +38,13 @@
>  #define DCS_GET_ID3		0xdc
>  
>  struct panel_drv_data {
> +	struct mipi_dsi_device *dsi;
> +
>  	struct omap_dss_device dssdev;
>  	struct omap_dss_device *src;
>  
>  	struct videomode vm;
>  
> -	struct platform_device *pdev;
> -
>  	struct mutex lock;
>  
>  	struct backlight_device *bldev;
> @@ -139,7 +138,7 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
>  
>  static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	const struct mipi_dsi_msg msg = {
>  		.channel = ddata->channel,
>  		.type = MIPI_DSI_DCS_READ,
> @@ -149,12 +148,12 @@ static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
>  		.rx_buf = data
>  	};
>  
> -	return src->ops->dsi.transfer(src, &msg);
> +	return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	const struct mipi_dsi_msg msg = {
>  		.channel = ddata->channel,
>  		.type = MIPI_DSI_DCS_SHORT_WRITE,
> @@ -162,12 +161,12 @@ static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
>  		.tx_len = 1,
>  	};
>  
> -	return src->ops->dsi.transfer(src, &msg);
> +	return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	const u8 buf[] = { dcs_cmd, param };
>  	const struct mipi_dsi_msg msg = {
>  		.channel = ddata->channel,
> @@ -176,13 +175,13 @@ static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
>  		.tx_len = 2,
>  	};
>  
> -	return src->ops->dsi.transfer(src, &msg);
> +	return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	int r;
>  	const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
>  	const struct mipi_dsi_msg msg = {
> @@ -194,7 +193,7 @@ static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>  	hw_guard_wait(ddata);
>  
> -	r = src->ops->dsi.transfer(src, &msg);
> +	r = dsi->host->ops->transfer(dsi->host, &msg);
>  	if (r)
>  		return r;
>  
> @@ -242,7 +241,7 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
>  static int dsicm_set_update_window(struct panel_drv_data *ddata,
>  		u16 x, u16 y, u16 w, u16 h)
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	int r;
>  	u16 x1 = x;
>  	u16 x2 = x + w - 1;
> @@ -279,11 +278,11 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
>  		.tx_len = 5,
>  	};
>  
> -	r = src->ops->dsi.transfer(src, &msgX);
> +	r = dsi->host->ops->transfer(dsi->host, &msgX);
>  	if (r)
>  		return r;
>  
> -	r = src->ops->dsi.transfer(src, &msgY);
> +	r = dsi->host->ops->transfer(dsi->host, &msgY);
>  	if (r)
>  		return r;
>  
> @@ -326,7 +325,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>  	return 0;
>  
>  err:
> -	dev_err(&ddata->pdev->dev, "enter ULPS failed");
> +	dev_err(&ddata->dsi->dev, "enter ULPS failed");
>  	dsicm_panel_reset(ddata);
>  
>  	ddata->ulps_enabled = false;
> @@ -349,7 +348,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  
>  	r = _dsicm_enable_te(ddata, true);
>  	if (r) {
> -		dev_err(&ddata->pdev->dev, "failed to re-enable TE");
> +		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
>  		goto err2;
>  	}
>  
> @@ -363,7 +362,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  	return 0;
>  
>  err2:
> -	dev_err(&ddata->pdev->dev, "failed to exit ULPS");
> +	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
>  
>  	r = dsicm_panel_reset(ddata);
>  	if (!r) {
> @@ -400,7 +399,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
>  	else
>  		level = 0;
>  
> -	dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level);
> +	dev_dbg(&ddata->dsi->dev, "update brightness to %d\n", level);
>  
>  	mutex_lock(&ddata->lock);
>  
> @@ -637,7 +636,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (ddata->vpnl) {
>  		r = regulator_enable(ddata->vpnl);
>  		if (r) {
> -			dev_err(&ddata->pdev->dev,
> +			dev_err(&ddata->dsi->dev,
>  				"failed to enable VPNL: %d\n", r);
>  			return r;
>  		}
> @@ -646,7 +645,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (ddata->vddi) {
>  		r = regulator_enable(ddata->vddi);
>  		if (r) {
> -			dev_err(&ddata->pdev->dev,
> +			dev_err(&ddata->dsi->dev,
>  				"failed to enable VDDI: %d\n", r);
>  			goto err_vpnl;
>  		}
> @@ -654,7 +653,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	r = src->ops->dsi.set_config(src, &dsi_config);
>  	if (r) {
> -		dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
> +		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
>  		goto err_vddi;
>  	}
>  
> @@ -701,7 +700,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	ddata->enabled = true;
>  
>  	if (!ddata->intro_printed) {
> -		dev_info(&ddata->pdev->dev, "panel revision %02x.%02x.%02x\n",
> +		dev_info(&ddata->dsi->dev, "panel revision %02x.%02x.%02x\n",
>  			id1, id2, id3);
>  		ddata->intro_printed = true;
>  	}
> @@ -710,7 +709,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	return 0;
>  err:
> -	dev_err(&ddata->pdev->dev, "error while enabling panel, issuing HW reset\n");
> +	dev_err(&ddata->dsi->dev, "error while enabling panel, issuing HW reset\n");
>  
>  	dsicm_hw_reset(ddata);
>  
> @@ -737,7 +736,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  		r = dsicm_sleep_in(ddata);
>  
>  	if (r) {
> -		dev_err(&ddata->pdev->dev,
> +		dev_err(&ddata->dsi->dev,
>  				"error disabling panel, issuing HW reset\n");
>  		dsicm_hw_reset(ddata);
>  	}
> @@ -754,7 +753,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  
>  static int dsicm_panel_reset(struct panel_drv_data *ddata)
>  {
> -	dev_err(&ddata->pdev->dev, "performing LCD reset\n");
> +	dev_err(&ddata->dsi->dev, "performing LCD reset\n");
>  
>  	dsicm_power_off(ddata);
>  	dsicm_hw_reset(ddata);
> @@ -765,7 +764,7 @@ static int dsicm_connect(struct omap_dss_device *src,
>  			 struct omap_dss_device *dst)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dst);
> -	struct device *dev = &ddata->pdev->dev;
> +	struct device *dev = &ddata->dsi->dev;
>  	int r;
>  
>  	r = src->ops->dsi.request_vc(src, ddata->channel);
> @@ -810,7 +809,7 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>  
>  	return;
>  err:
> -	dev_dbg(&ddata->pdev->dev, "enable failed (%d)\n", r);
> +	dev_dbg(&ddata->dsi->dev, "enable failed (%d)\n", r);
>  	mutex_unlock(&ddata->lock);
>  }
>  
> @@ -842,7 +841,7 @@ static void dsicm_framedone_cb(int err, void *data)
>  	struct panel_drv_data *ddata = data;
>  	struct omap_dss_device *src = ddata->src;
>  
> -	dev_dbg(&ddata->pdev->dev, "framedone, err %d\n", err);
> +	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
>  	src->ops->dsi.bus_unlock(src);
>  }
>  
> @@ -866,7 +865,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data)
>  
>  	return IRQ_HANDLED;
>  err:
> -	dev_err(&ddata->pdev->dev, "start update failed\n");
> +	dev_err(&ddata->dsi->dev, "start update failed\n");
>  	src->ops->dsi.bus_unlock(src);
>  	return IRQ_HANDLED;
>  }
> @@ -877,7 +876,7 @@ static void dsicm_te_timeout_work_callback(struct work_struct *work)
>  					te_timeout_work.work);
>  	struct omap_dss_device *src = ddata->src;
>  
> -	dev_err(&ddata->pdev->dev, "TE not received for 250ms!\n");
> +	dev_err(&ddata->dsi->dev, "TE not received for 250ms!\n");
>  
>  	atomic_set(&ddata->do_update, 0);
>  	src->ops->dsi.bus_unlock(src);
> @@ -890,7 +889,7 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  	struct omap_dss_device *src = ddata->src;
>  	int r;
>  
> -	dev_dbg(&ddata->pdev->dev, "update %d, %d, %d x %d\n", x, y, w, h);
> +	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>  
>  	mutex_lock(&ddata->lock);
>  	src->ops->dsi.bus_lock(src);
> @@ -935,14 +934,14 @@ static int dsicm_sync(struct omap_dss_device *dssdev)
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
>  	struct omap_dss_device *src = ddata->src;
>  
> -	dev_dbg(&ddata->pdev->dev, "sync\n");
> +	dev_dbg(&ddata->dsi->dev, "sync\n");
>  
>  	mutex_lock(&ddata->lock);
>  	src->ops->dsi.bus_lock(src);
>  	src->ops->dsi.bus_unlock(src);
>  	mutex_unlock(&ddata->lock);
>  
> -	dev_dbg(&ddata->pdev->dev, "sync done\n");
> +	dev_dbg(&ddata->dsi->dev, "sync done\n");
>  
>  	return 0;
>  }
> @@ -1019,7 +1018,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
>  					u16 size)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  
>  	const u8 buf[] = {
>  		size & 0xff,
> @@ -1033,7 +1032,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
>  		.tx_len = 2,
>  	};
>  
> -	return src->ops->dsi.transfer(src, &msg);
> +	return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_memory_read(struct omap_dss_device *dssdev,
> @@ -1041,6 +1040,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  		u16 x, u16 y, u16 w, u16 h)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	struct omap_dss_device *src = ddata->src;
>  	int r;
>  	int first = 1;
> @@ -1092,7 +1092,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  		};
>  		first = 0;
>  
> -		r = src->ops->dsi.transfer(src, &msg);
> +		r = dsi->host->ops->transfer(dsi->host, &msg);
>  		if (r < 0) {
>  			dev_err(dssdev->dev, "read error\n");
>  			goto err3;
> @@ -1101,12 +1101,12 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  		buf_used += r;
>  
>  		if (r < plen) {
> -			dev_err(&ddata->pdev->dev, "short read\n");
> +			dev_err(&ddata->dsi->dev, "short read\n");
>  			break;
>  		}
>  
>  		if (signal_pending(current)) {
> -			dev_err(&ddata->pdev->dev, "signal pending, "
> +			dev_err(&ddata->dsi->dev, "signal pending, "
>  					"aborting memory read\n");
>  			r = -ERESTARTSYS;
>  			goto err3;
> @@ -1200,28 +1200,28 @@ static const struct omap_dss_driver dsicm_dss_driver = {
>  	.memory_read	= dsicm_memory_read,
>  };
>  
> -static int dsicm_probe_of(struct platform_device *pdev)
> +static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  {
> -	struct device_node *node = pdev->dev.of_node;
> +	struct device_node *node = dsi->dev.of_node;
>  	struct backlight_device *backlight;
> -	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> +	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>  	struct display_timing timing;
>  	int err;
>  
>  	ddata->channel = TCH;
>  
> -	ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
> +	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
>  	if (IS_ERR(ddata->reset_gpio)) {
>  		err = PTR_ERR(ddata->reset_gpio);
> -		dev_err(&pdev->dev, "reset gpio request failed: %d", err);
> +		dev_err(&dsi->dev, "reset gpio request failed: %d", err);
>  		return err;
>  	}
>  
> -	ddata->ext_te_gpio = devm_gpiod_get_optional(&pdev->dev, "te",
> +	ddata->ext_te_gpio = devm_gpiod_get_optional(&dsi->dev, "te",
>  						     GPIOD_IN);
>  	if (IS_ERR(ddata->ext_te_gpio)) {
>  		err = PTR_ERR(ddata->ext_te_gpio);
> -		dev_err(&pdev->dev, "TE gpio request failed: %d", err);
> +		dev_err(&dsi->dev, "TE gpio request failed: %d", err);
>  		return err;
>  	}
>  
> @@ -1232,7 +1232,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  			ddata->vm.pixelclock =
>  				ddata->vm.hactive * ddata->vm.vactive * 60;
>  	} else {
> -		dev_warn(&pdev->dev,
> +		dev_warn(&dsi->dev,
>  			 "failed to get video timing, using defaults\n");
>  	}
>  
> @@ -1242,7 +1242,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  	ddata->height_mm = 0;
>  	of_property_read_u32(node, "height-mm", &ddata->height_mm);
>  
> -	ddata->vpnl = devm_regulator_get_optional(&pdev->dev, "vpnl");
> +	ddata->vpnl = devm_regulator_get_optional(&dsi->dev, "vpnl");
>  	if (IS_ERR(ddata->vpnl)) {
>  		err = PTR_ERR(ddata->vpnl);
>  		if (err == -EPROBE_DEFER)
> @@ -1250,7 +1250,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  		ddata->vpnl = NULL;
>  	}
>  
> -	ddata->vddi = devm_regulator_get_optional(&pdev->dev, "vddi");
> +	ddata->vddi = devm_regulator_get_optional(&dsi->dev, "vddi");
>  	if (IS_ERR(ddata->vddi)) {
>  		err = PTR_ERR(ddata->vddi);
>  		if (err == -EPROBE_DEFER)
> @@ -1258,7 +1258,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  		ddata->vddi = NULL;
>  	}
>  
> -	backlight = devm_of_find_backlight(&pdev->dev);
> +	backlight = devm_of_find_backlight(&dsi->dev);
>  	if (IS_ERR(backlight))
>  		return PTR_ERR(backlight);
>  
> @@ -1273,11 +1273,11 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int dsicm_probe(struct platform_device *pdev)
> +static int dsicm_probe(struct mipi_dsi_device *dsi)
>  {
>  	struct panel_drv_data *ddata;
>  	struct backlight_device *bldev = NULL;
> -	struct device *dev = &pdev->dev;
> +	struct device *dev = &dsi->dev;
>  	struct omap_dss_device *dssdev;
>  	int r;
>  
> @@ -1287,14 +1287,14 @@ static int dsicm_probe(struct platform_device *pdev)
>  	if (!ddata)
>  		return -ENOMEM;
>  
> -	platform_set_drvdata(pdev, ddata);
> -	ddata->pdev = pdev;
> +	mipi_dsi_set_drvdata(dsi, ddata);
> +	ddata->dsi = dsi;
>  
>  	ddata->vm.hactive = 864;
>  	ddata->vm.vactive = 480;
>  	ddata->vm.pixelclock = 864 * 480 * 60;
>  
> -	r = dsicm_probe_of(pdev);
> +	r = dsicm_probe_of(dsi);
>  	if (r)
>  		return r;
>  
> @@ -1376,12 +1376,12 @@ static int dsicm_probe(struct platform_device *pdev)
>  	return r;
>  }
>  
> -static int __exit dsicm_remove(struct platform_device *pdev)
> +static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>  {
> -	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> +	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>  	struct omap_dss_device *dssdev = &ddata->dssdev;
>  
> -	dev_dbg(&pdev->dev, "remove\n");
> +	dev_dbg(&dsi->dev, "remove\n");
>  
>  	omapdss_device_unregister(dssdev);
>  
> @@ -1389,7 +1389,7 @@ static int __exit dsicm_remove(struct platform_device *pdev)
>  		dsicm_disable(dssdev);
>  	omapdss_device_disconnect(ddata->src, dssdev);
>  
> -	sysfs_remove_group(&pdev->dev.kobj, &dsicm_attr_group);
> +	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>  
>  	if (ddata->extbldev)
>  		put_device(&ddata->extbldev->dev);
> @@ -1410,7 +1410,7 @@ static const struct of_device_id dsicm_of_match[] = {
>  
>  MODULE_DEVICE_TABLE(of, dsicm_of_match);
>  
> -static struct platform_driver dsicm_driver = {
> +static struct mipi_dsi_driver dsicm_driver = {
>  	.probe = dsicm_probe,
>  	.remove = __exit_p(dsicm_remove),
>  	.driver = {
> @@ -1419,8 +1419,7 @@ static struct platform_driver dsicm_driver = {
>  		.suppress_bind_attrs = true,
>  	},
>  };
> -
> -module_platform_driver(dsicm_driver);
> +module_mipi_dsi_driver(dsicm_driver);
>  
>  MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
>  MODULE_DESCRIPTION("Generic DSI Command Mode Panel Driver");
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 6fa7833e32ad..d1187a8af37f 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -334,6 +334,8 @@ struct dsi_data {
>  	struct regmap *syscon;
>  	struct dss_device *dss;
>  
> +	struct mipi_dsi_host host;
> +
>  	struct dispc_clock_info user_dispc_cinfo;
>  	struct dss_pll_clock_info user_dsi_cinfo;
>  
> @@ -432,6 +434,11 @@ static inline struct dsi_data *to_dsi_data(struct omap_dss_device *dssdev)
>  	return dev_get_drvdata(dssdev->dev);
>  }
>  
> +static inline struct dsi_data *host_to_omap(struct mipi_dsi_host *host)
> +{
> +	return container_of(host, struct dsi_data, host);
> +}
> +
>  static inline void dsi_write_reg(struct dsi_data *dsi,
>  				 const struct dsi_reg idx, u32 val)
>  {
> @@ -4711,9 +4718,12 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
>  	}
>  }
>  
> -static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
> -				 const struct mipi_dsi_msg *msg)
> +static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
> +				      const struct mipi_dsi_msg *msg)
>  {
> +	struct dsi_data *dsi = host_to_omap(host);
> +	struct omap_dss_device *dssdev = &dsi->output;
> +
>  	switch (msg->type) {
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
> @@ -4787,11 +4797,30 @@ static const struct omap_dss_device_ops dsi_ops = {
>  
>  		.request_vc = dsi_request_vc,
>  		.release_vc = dsi_release_vc,
> -
> -		.transfer = omap_dsi_transfer,
>  	},
>  };
>  
> +static int omap_dsi_host_attach(struct mipi_dsi_host *host,
> +			 struct mipi_dsi_device *dsi)
> +{
> +	/* TODO: convert driver from custom binding method to this one */
> +	return 0;
> +}
> +
> +static int omap_dsi_host_detach(struct mipi_dsi_host *host,
> +			 struct mipi_dsi_device *dsi)
> +{
> +	/* TODO: convert driver from custom binding method to this one */
> +	return 0;
> +}
> +
> +static const struct mipi_dsi_host_ops omap_dsi_host_ops = {
> +	.attach = omap_dsi_host_attach,
> +	.detach = omap_dsi_host_detach,
> +	.transfer = omap_dsi_host_transfer,
> +};
> +
> +

A single blank line is enough.

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

>  /* -----------------------------------------------------------------------------
>   * PLL
>   */
> @@ -5260,15 +5289,18 @@ static int dsi_probe(struct platform_device *pdev)
>  		dsi->num_lanes_supported = 3;
>  	}
>  
> -	r = of_platform_populate(dev->of_node, NULL, NULL, dev);
> -	if (r) {
> -		DSSERR("Failed to populate DSI child devices: %d\n", r);
> +	dsi->host.ops = &omap_dsi_host_ops;
> +	dsi->host.dev = &pdev->dev;
> +
> +	r = mipi_dsi_host_register(&dsi->host);
> +	if (r < 0) {
> +		dev_err(&pdev->dev, "failed to register DSI host: %d\n", r);
>  		goto err_pm_disable;
>  	}
>  
>  	r = dsi_init_output(dsi);
>  	if (r)
> -		goto err_of_depopulate;
> +		goto err_dsi_host_unregister;
>  
>  	r = dsi_probe_of(dsi);
>  	if (r) {
> @@ -5284,8 +5316,8 @@ static int dsi_probe(struct platform_device *pdev)
>  
>  err_uninit_output:
>  	dsi_uninit_output(dsi);
> -err_of_depopulate:
> -	of_platform_depopulate(dev);
> +err_dsi_host_unregister:
> +	mipi_dsi_host_unregister(&dsi->host);
>  err_pm_disable:
>  	pm_runtime_disable(dev);
>  	return r;
> @@ -5299,7 +5331,7 @@ static int dsi_remove(struct platform_device *pdev)
>  
>  	dsi_uninit_output(dsi);
>  
> -	of_platform_depopulate(&pdev->dev);
> +	mipi_dsi_host_unregister(&dsi->host);
>  
>  	pm_runtime_disable(&pdev->dev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 40e1ce9e256e..8cd2c800922e 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -304,10 +304,6 @@ struct omapdss_dsi_ops {
>  
>  	int (*request_vc)(struct omap_dss_device *dssdev, int channel);
>  	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
> -
> -	/* data transfer */
> -	ssize_t (*transfer)(struct omap_dss_device *dssdev,
> -			    const struct mipi_dsi_msg *msg);
>  };
>  
>  struct omap_dss_device_ops {

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 14/56] drm/omap: panel-dsi-cm: use DSI helpers
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:40     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:40 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:51PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> After converting the driver to mipi_dsi_device we can use the generic
> message helpers to simplify the driver a lot.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 125 +++---------------
>  1 file changed, 18 insertions(+), 107 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index c3190223d192..ec36e62ddc3a 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -138,62 +138,22 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
>  
>  static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
>  {
> -	struct mipi_dsi_device *dsi = ddata->dsi;
> -	const struct mipi_dsi_msg msg = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_DCS_READ,
> -		.tx_len = 1,
> -		.tx_buf = &dcs_cmd,
> -		.rx_len = 1,
> -		.rx_buf = data
> -	};
> -
> -	return dsi->host->ops->transfer(dsi->host, &msg);
> -}
> -
> -static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
> -{
> -	struct mipi_dsi_device *dsi = ddata->dsi;
> -	const struct mipi_dsi_msg msg = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_DCS_SHORT_WRITE,
> -		.tx_buf = &dcs_cmd,
> -		.tx_len = 1,
> -	};
> -
> -	return dsi->host->ops->transfer(dsi->host, &msg);
> +	return mipi_dsi_dcs_read(ddata->dsi, dcs_cmd, data, 1);
>  }
>  
>  static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
>  {
> -	struct mipi_dsi_device *dsi = ddata->dsi;
> -	const u8 buf[] = { dcs_cmd, param };
> -	const struct mipi_dsi_msg msg = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_DCS_SHORT_WRITE_PARAM,
> -		.tx_buf = &buf,
> -		.tx_len = 2,
> -	};
> -
> -	return dsi->host->ops->transfer(dsi->host, &msg);
> +	return mipi_dsi_dcs_write(ddata->dsi, dcs_cmd, &param, 1);
>  }
>  
>  static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>  {
> -	struct mipi_dsi_device *dsi = ddata->dsi;
>  	int r;
> -	const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
> -	const struct mipi_dsi_msg msg = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_DCS_SHORT_WRITE,
> -		.tx_buf = &cmd,
> -		.tx_len = 1,
> -	};
>  
>  	hw_guard_wait(ddata);
>  
> -	r = dsi->host->ops->transfer(dsi->host, &msg);
> +	r = mipi_dsi_dcs_enter_sleep_mode(ddata->dsi);
>  	if (r)
>  		return r;
>  
> @@ -210,7 +170,7 @@ static int dsicm_sleep_out(struct panel_drv_data *ddata)
>  
>  	hw_guard_wait(ddata);
>  
> -	r = dsicm_dcs_write_0(ddata, MIPI_DCS_EXIT_SLEEP_MODE);
> +	r = mipi_dsi_dcs_exit_sleep_mode(ddata->dsi);
>  	if (r)
>  		return r;
>  
> @@ -248,45 +208,15 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
>  	u16 y1 = y;
>  	u16 y2 = y + h - 1;
>  
> -	const u8 paramX[] = {
> -		MIPI_DCS_SET_COLUMN_ADDRESS,
> -		(x1 >> 8) & 0xff,
> -		(x1 >> 0) & 0xff,
> -		(x2 >> 8) & 0xff,
> -		(x2 >> 0) & 0xff,
> -	};
> -
> -	const struct mipi_dsi_msg msgX = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_GENERIC_LONG_WRITE,
> -		.tx_buf = paramX,
> -		.tx_len = 5,
> -	};
> -
> -	const u8 paramY[] = {
> -		MIPI_DCS_SET_PAGE_ADDRESS,
> -		(y1 >> 8) & 0xff,
> -		(y1 >> 0) & 0xff,
> -		(y2 >> 8) & 0xff,
> -		(y2 >> 0) & 0xff,
> -	};
> -
> -	const struct mipi_dsi_msg msgY = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_GENERIC_LONG_WRITE,
> -		.tx_buf = paramY,
> -		.tx_len = 5,
> -	};
> -
> -	r = dsi->host->ops->transfer(dsi->host, &msgX);
> -	if (r)
> +	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
> +	if (r < 0)
>  		return r;
>  
> -	r = dsi->host->ops->transfer(dsi->host, &msgY);
> -	if (r)
> +	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
> +	if (r < 0)
>  		return r;
>  
> -	return r;
> +	return 0;
>  }
>  
>  static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
> @@ -680,12 +610,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (r)
>  		goto err;
>  
> -	r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_PIXEL_FORMAT,
> -		MIPI_DCS_PIXEL_FMT_24BIT);
> +	r = mipi_dsi_dcs_set_pixel_format(ddata->dsi, MIPI_DCS_PIXEL_FMT_24BIT);
>  	if (r)
>  		goto err;
>  
> -	r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_DISPLAY_ON);
> +	r = mipi_dsi_dcs_set_display_on(ddata->dsi);
>  	if (r)
>  		goto err;
>  
> @@ -731,7 +660,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  
>  	src->ops->dsi.disable_video_output(src, ddata->channel);
>  
> -	r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_DISPLAY_OFF);
> +	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
>  	if (!r)
>  		r = dsicm_sleep_in(ddata);
>  
> @@ -949,12 +878,13 @@ static int dsicm_sync(struct omap_dss_device *dssdev)
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
>  	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	int r;
>  
>  	if (enable)
> -		r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_TEAR_ON, 0);
> +		r = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK);
>  	else
> -		r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_TEAR_OFF);
> +		r = mipi_dsi_dcs_set_tear_off(dsi);
>  
>  	if (!ddata->ext_te_gpio)
>  		src->ops->dsi.enable_te(src, enable);
> @@ -1020,19 +950,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
>  	struct mipi_dsi_device *dsi = ddata->dsi;
>  
> -	const u8 buf[] = {
> -		size & 0xff,
> -		size >> 8 & 0xff,
> -	};
> -
> -	const struct mipi_dsi_msg msg = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
> -		.tx_buf = buf,
> -		.tx_len = 2,
> -	};
> -
> -	return dsi->host->ops->transfer(dsi->host, &msg);
> +	return mipi_dsi_set_maximum_return_packet_size(dsi, size);
>  }
>  
>  static int dsicm_memory_read(struct omap_dss_device *dssdev,
> @@ -1082,17 +1000,10 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  
>  	while (buf_used < size) {
>  		u8 dcs_cmd = first ? 0x2e : 0x3e;
> -		const struct mipi_dsi_msg msg = {
> -			.channel = ddata->channel,
> -			.type = MIPI_DSI_DCS_READ,
> -			.tx_buf = &dcs_cmd,
> -			.tx_len = 1,
> -			.rx_buf = buf + buf_used,
> -			.rx_len = size - buf_used,
> -		};
>  		first = 0;
>  
> -		r = dsi->host->ops->transfer(dsi->host, &msg);
> +		r = mipi_dsi_dcs_read(dsi, dcs_cmd,
> +				      buf + buf_used, size - buf_used);
>  		if (r < 0) {
>  			dev_err(dssdev->dev, "read error\n");
>  			goto err3;

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 14/56] drm/omap: panel-dsi-cm: use DSI helpers
@ 2020-11-09  8:40     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:40 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:51PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> After converting the driver to mipi_dsi_device we can use the generic
> message helpers to simplify the driver a lot.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 125 +++---------------
>  1 file changed, 18 insertions(+), 107 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index c3190223d192..ec36e62ddc3a 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -138,62 +138,22 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
>  
>  static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
>  {
> -	struct mipi_dsi_device *dsi = ddata->dsi;
> -	const struct mipi_dsi_msg msg = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_DCS_READ,
> -		.tx_len = 1,
> -		.tx_buf = &dcs_cmd,
> -		.rx_len = 1,
> -		.rx_buf = data
> -	};
> -
> -	return dsi->host->ops->transfer(dsi->host, &msg);
> -}
> -
> -static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
> -{
> -	struct mipi_dsi_device *dsi = ddata->dsi;
> -	const struct mipi_dsi_msg msg = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_DCS_SHORT_WRITE,
> -		.tx_buf = &dcs_cmd,
> -		.tx_len = 1,
> -	};
> -
> -	return dsi->host->ops->transfer(dsi->host, &msg);
> +	return mipi_dsi_dcs_read(ddata->dsi, dcs_cmd, data, 1);
>  }
>  
>  static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
>  {
> -	struct mipi_dsi_device *dsi = ddata->dsi;
> -	const u8 buf[] = { dcs_cmd, param };
> -	const struct mipi_dsi_msg msg = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_DCS_SHORT_WRITE_PARAM,
> -		.tx_buf = &buf,
> -		.tx_len = 2,
> -	};
> -
> -	return dsi->host->ops->transfer(dsi->host, &msg);
> +	return mipi_dsi_dcs_write(ddata->dsi, dcs_cmd, &param, 1);
>  }
>  
>  static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>  {
> -	struct mipi_dsi_device *dsi = ddata->dsi;
>  	int r;
> -	const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
> -	const struct mipi_dsi_msg msg = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_DCS_SHORT_WRITE,
> -		.tx_buf = &cmd,
> -		.tx_len = 1,
> -	};
>  
>  	hw_guard_wait(ddata);
>  
> -	r = dsi->host->ops->transfer(dsi->host, &msg);
> +	r = mipi_dsi_dcs_enter_sleep_mode(ddata->dsi);
>  	if (r)
>  		return r;
>  
> @@ -210,7 +170,7 @@ static int dsicm_sleep_out(struct panel_drv_data *ddata)
>  
>  	hw_guard_wait(ddata);
>  
> -	r = dsicm_dcs_write_0(ddata, MIPI_DCS_EXIT_SLEEP_MODE);
> +	r = mipi_dsi_dcs_exit_sleep_mode(ddata->dsi);
>  	if (r)
>  		return r;
>  
> @@ -248,45 +208,15 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
>  	u16 y1 = y;
>  	u16 y2 = y + h - 1;
>  
> -	const u8 paramX[] = {
> -		MIPI_DCS_SET_COLUMN_ADDRESS,
> -		(x1 >> 8) & 0xff,
> -		(x1 >> 0) & 0xff,
> -		(x2 >> 8) & 0xff,
> -		(x2 >> 0) & 0xff,
> -	};
> -
> -	const struct mipi_dsi_msg msgX = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_GENERIC_LONG_WRITE,
> -		.tx_buf = paramX,
> -		.tx_len = 5,
> -	};
> -
> -	const u8 paramY[] = {
> -		MIPI_DCS_SET_PAGE_ADDRESS,
> -		(y1 >> 8) & 0xff,
> -		(y1 >> 0) & 0xff,
> -		(y2 >> 8) & 0xff,
> -		(y2 >> 0) & 0xff,
> -	};
> -
> -	const struct mipi_dsi_msg msgY = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_GENERIC_LONG_WRITE,
> -		.tx_buf = paramY,
> -		.tx_len = 5,
> -	};
> -
> -	r = dsi->host->ops->transfer(dsi->host, &msgX);
> -	if (r)
> +	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
> +	if (r < 0)
>  		return r;
>  
> -	r = dsi->host->ops->transfer(dsi->host, &msgY);
> -	if (r)
> +	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
> +	if (r < 0)
>  		return r;
>  
> -	return r;
> +	return 0;
>  }
>  
>  static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
> @@ -680,12 +610,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (r)
>  		goto err;
>  
> -	r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_PIXEL_FORMAT,
> -		MIPI_DCS_PIXEL_FMT_24BIT);
> +	r = mipi_dsi_dcs_set_pixel_format(ddata->dsi, MIPI_DCS_PIXEL_FMT_24BIT);
>  	if (r)
>  		goto err;
>  
> -	r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_DISPLAY_ON);
> +	r = mipi_dsi_dcs_set_display_on(ddata->dsi);
>  	if (r)
>  		goto err;
>  
> @@ -731,7 +660,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  
>  	src->ops->dsi.disable_video_output(src, ddata->channel);
>  
> -	r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_DISPLAY_OFF);
> +	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
>  	if (!r)
>  		r = dsicm_sleep_in(ddata);
>  
> @@ -949,12 +878,13 @@ static int dsicm_sync(struct omap_dss_device *dssdev)
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
>  	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	int r;
>  
>  	if (enable)
> -		r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_TEAR_ON, 0);
> +		r = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK);
>  	else
> -		r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_TEAR_OFF);
> +		r = mipi_dsi_dcs_set_tear_off(dsi);
>  
>  	if (!ddata->ext_te_gpio)
>  		src->ops->dsi.enable_te(src, enable);
> @@ -1020,19 +950,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
>  	struct mipi_dsi_device *dsi = ddata->dsi;
>  
> -	const u8 buf[] = {
> -		size & 0xff,
> -		size >> 8 & 0xff,
> -	};
> -
> -	const struct mipi_dsi_msg msg = {
> -		.channel = ddata->channel,
> -		.type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
> -		.tx_buf = buf,
> -		.tx_len = 2,
> -	};
> -
> -	return dsi->host->ops->transfer(dsi->host, &msg);
> +	return mipi_dsi_set_maximum_return_packet_size(dsi, size);
>  }
>  
>  static int dsicm_memory_read(struct omap_dss_device *dssdev,
> @@ -1082,17 +1000,10 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  
>  	while (buf_used < size) {
>  		u8 dcs_cmd = first ? 0x2e : 0x3e;
> -		const struct mipi_dsi_msg msg = {
> -			.channel = ddata->channel,
> -			.type = MIPI_DSI_DCS_READ,
> -			.tx_buf = &dcs_cmd,
> -			.tx_len = 1,
> -			.rx_buf = buf + buf_used,
> -			.rx_len = size - buf_used,
> -		};
>  		first = 0;
>  
> -		r = dsi->host->ops->transfer(dsi->host, &msg);
> +		r = mipi_dsi_dcs_read(dsi, dcs_cmd,
> +				      buf + buf_used, size - buf_used);
>  		if (r < 0) {
>  			dev_err(dssdev->dev, "read error\n");
>  			goto err3;

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 15/56] drm/omap: dsi: request VC via mipi_dsi_attach
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:42     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:42 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:52PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Drop custom request_vc/release_vc callbacks by using the
> generic mipi_dsi_attach/mipi_dsi_detach functions.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 24 +++++---
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 61 ++++++++-----------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  3 -
>  3 files changed, 41 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index ec36e62ddc3a..b1ca9b34ce17 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -693,14 +693,6 @@ static int dsicm_connect(struct omap_dss_device *src,
>  			 struct omap_dss_device *dst)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dst);
> -	struct device *dev = &ddata->dsi->dev;
> -	int r;
> -
> -	r = src->ops->dsi.request_vc(src, ddata->channel);
> -	if (r) {
> -		dev_err(dev, "failed to get virtual channel\n");
> -		return r;
> -	}
>  
>  	ddata->src = src;
>  	return 0;
> @@ -711,7 +703,6 @@ static void dsicm_disconnect(struct omap_dss_device *src,
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dst);
>  
> -	src->ops->dsi.release_vc(src, ddata->channel);
>  	ddata->src = NULL;
>  }
>  
> @@ -1276,8 +1267,21 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  		goto err_bl;
>  	}
>  
> +	dsi->lanes = 3;
> +	dsi->format = MIPI_DSI_FMT_RGB888;
> +	dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
> +			  MIPI_DSI_MODE_EOT_PACKET;
> +	dsi->hs_rate = 300000000;
> +	dsi->lp_rate = 10000000;

Should this change be explained in the commit message ?

> +
> +	r = mipi_dsi_attach(dsi);
> +	if (r < 0)
> +		goto err_dsi_attach;
> +
>  	return 0;
>  
> +err_dsi_attach:
> +	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>  err_bl:
>  	destroy_workqueue(ddata->workqueue);
>  err_reg:
> @@ -1294,6 +1298,8 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>  
>  	dev_dbg(&dsi->dev, "remove\n");
>  
> +	mipi_dsi_detach(dsi);
> +
>  	omapdss_device_unregister(dssdev);
>  
>  	if (omapdss_device_is_enabled(dssdev))
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index d1187a8af37f..a16427f3bc23 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -349,7 +349,7 @@ struct dsi_data {
>  
>  	struct {
>  		enum dsi_vc_source source;
> -		struct omap_dss_device *dssdev;
> +		struct mipi_dsi_device *dest;

How about naming this dsidev ?

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

>  		enum fifo_size tx_fifo_size;
>  		enum fifo_size rx_fifo_size;
>  	} vc[4];
> @@ -4692,32 +4692,6 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)
>  	}
>  }
>  
> -static int dsi_request_vc(struct omap_dss_device *dssdev, int channel)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> -	if (channel < 0 || channel > 3)
> -		return -EINVAL;
> -
> -	if (dsi->vc[channel].dssdev) {
> -		DSSERR("cannot get VC for display %s", dssdev->name);
> -		return -EBUSY;
> -	}
> -
> -	dsi->vc[channel].dssdev = dssdev;
> -	return 0;
> -}
> -
> -static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> -	if ((channel >= 0 && channel <= 3) &&
> -		dsi->vc[channel].dssdev == dssdev) {
> -		dsi->vc[channel].dssdev = NULL;
> -	}
> -}
> -
>  static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  				      const struct mipi_dsi_msg *msg)
>  {
> @@ -4794,23 +4768,40 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.update = dsi_update,
>  
>  		.enable_te = dsi_enable_te,
> -
> -		.request_vc = dsi_request_vc,
> -		.release_vc = dsi_release_vc,
>  	},
>  };
>  
>  static int omap_dsi_host_attach(struct mipi_dsi_host *host,
> -			 struct mipi_dsi_device *dsi)
> +				struct mipi_dsi_device *client)
>  {
> -	/* TODO: convert driver from custom binding method to this one */
> +	struct dsi_data *dsi = host_to_omap(host);
> +	unsigned int channel = client->channel;
> +
> +	if (channel > 3)
> +		return -EINVAL;
> +
> +	if (dsi->vc[channel].dest) {
> +		DSSERR("cannot get VC for display %s", dev_name(&client->dev));
> +		return -EBUSY;
> +	}
> +
> +	dsi->vc[channel].dest = client;
>  	return 0;
>  }
>  
>  static int omap_dsi_host_detach(struct mipi_dsi_host *host,
> -			 struct mipi_dsi_device *dsi)
> +				struct mipi_dsi_device *client)
>  {
> -	/* TODO: convert driver from custom binding method to this one */
> +	struct dsi_data *dsi = host_to_omap(host);
> +	unsigned int channel = client->channel;
> +
> +	if (channel > 3)
> +		return -EINVAL;
> +
> +	if (dsi->vc[channel].dest != client)
> +		return -EINVAL;
> +
> +	dsi->vc[channel].dest = NULL;
>  	return 0;
>  }
>  
> @@ -5269,7 +5260,7 @@ static int dsi_probe(struct platform_device *pdev)
>  	/* DSI VCs initialization */
>  	for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
>  		dsi->vc[i].source = DSI_VC_SOURCE_L4;
> -		dsi->vc[i].dssdev = NULL;
> +		dsi->vc[i].dest = NULL;
>  	}
>  
>  	r = dsi_get_clocks(dsi);
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 8cd2c800922e..78041ef922cc 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -301,9 +301,6 @@ struct omapdss_dsi_ops {
>  	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
>  	void (*disable_video_output)(struct omap_dss_device *dssdev,
>  			int channel);
> -
> -	int (*request_vc)(struct omap_dss_device *dssdev, int channel);
> -	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
>  };
>  
>  struct omap_dss_device_ops {

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 15/56] drm/omap: dsi: request VC via mipi_dsi_attach
@ 2020-11-09  8:42     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:42 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:52PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Drop custom request_vc/release_vc callbacks by using the
> generic mipi_dsi_attach/mipi_dsi_detach functions.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 24 +++++---
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 61 ++++++++-----------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  3 -
>  3 files changed, 41 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index ec36e62ddc3a..b1ca9b34ce17 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -693,14 +693,6 @@ static int dsicm_connect(struct omap_dss_device *src,
>  			 struct omap_dss_device *dst)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dst);
> -	struct device *dev = &ddata->dsi->dev;
> -	int r;
> -
> -	r = src->ops->dsi.request_vc(src, ddata->channel);
> -	if (r) {
> -		dev_err(dev, "failed to get virtual channel\n");
> -		return r;
> -	}
>  
>  	ddata->src = src;
>  	return 0;
> @@ -711,7 +703,6 @@ static void dsicm_disconnect(struct omap_dss_device *src,
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dst);
>  
> -	src->ops->dsi.release_vc(src, ddata->channel);
>  	ddata->src = NULL;
>  }
>  
> @@ -1276,8 +1267,21 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  		goto err_bl;
>  	}
>  
> +	dsi->lanes = 3;
> +	dsi->format = MIPI_DSI_FMT_RGB888;
> +	dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
> +			  MIPI_DSI_MODE_EOT_PACKET;
> +	dsi->hs_rate = 300000000;
> +	dsi->lp_rate = 10000000;

Should this change be explained in the commit message ?

> +
> +	r = mipi_dsi_attach(dsi);
> +	if (r < 0)
> +		goto err_dsi_attach;
> +
>  	return 0;
>  
> +err_dsi_attach:
> +	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>  err_bl:
>  	destroy_workqueue(ddata->workqueue);
>  err_reg:
> @@ -1294,6 +1298,8 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>  
>  	dev_dbg(&dsi->dev, "remove\n");
>  
> +	mipi_dsi_detach(dsi);
> +
>  	omapdss_device_unregister(dssdev);
>  
>  	if (omapdss_device_is_enabled(dssdev))
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index d1187a8af37f..a16427f3bc23 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -349,7 +349,7 @@ struct dsi_data {
>  
>  	struct {
>  		enum dsi_vc_source source;
> -		struct omap_dss_device *dssdev;
> +		struct mipi_dsi_device *dest;

How about naming this dsidev ?

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

>  		enum fifo_size tx_fifo_size;
>  		enum fifo_size rx_fifo_size;
>  	} vc[4];
> @@ -4692,32 +4692,6 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)
>  	}
>  }
>  
> -static int dsi_request_vc(struct omap_dss_device *dssdev, int channel)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> -	if (channel < 0 || channel > 3)
> -		return -EINVAL;
> -
> -	if (dsi->vc[channel].dssdev) {
> -		DSSERR("cannot get VC for display %s", dssdev->name);
> -		return -EBUSY;
> -	}
> -
> -	dsi->vc[channel].dssdev = dssdev;
> -	return 0;
> -}
> -
> -static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> -	if ((channel >= 0 && channel <= 3) &&
> -		dsi->vc[channel].dssdev == dssdev) {
> -		dsi->vc[channel].dssdev = NULL;
> -	}
> -}
> -
>  static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  				      const struct mipi_dsi_msg *msg)
>  {
> @@ -4794,23 +4768,40 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.update = dsi_update,
>  
>  		.enable_te = dsi_enable_te,
> -
> -		.request_vc = dsi_request_vc,
> -		.release_vc = dsi_release_vc,
>  	},
>  };
>  
>  static int omap_dsi_host_attach(struct mipi_dsi_host *host,
> -			 struct mipi_dsi_device *dsi)
> +				struct mipi_dsi_device *client)
>  {
> -	/* TODO: convert driver from custom binding method to this one */
> +	struct dsi_data *dsi = host_to_omap(host);
> +	unsigned int channel = client->channel;
> +
> +	if (channel > 3)
> +		return -EINVAL;
> +
> +	if (dsi->vc[channel].dest) {
> +		DSSERR("cannot get VC for display %s", dev_name(&client->dev));
> +		return -EBUSY;
> +	}
> +
> +	dsi->vc[channel].dest = client;
>  	return 0;
>  }
>  
>  static int omap_dsi_host_detach(struct mipi_dsi_host *host,
> -			 struct mipi_dsi_device *dsi)
> +				struct mipi_dsi_device *client)
>  {
> -	/* TODO: convert driver from custom binding method to this one */
> +	struct dsi_data *dsi = host_to_omap(host);
> +	unsigned int channel = client->channel;
> +
> +	if (channel > 3)
> +		return -EINVAL;
> +
> +	if (dsi->vc[channel].dest != client)
> +		return -EINVAL;
> +
> +	dsi->vc[channel].dest = NULL;
>  	return 0;
>  }
>  
> @@ -5269,7 +5260,7 @@ static int dsi_probe(struct platform_device *pdev)
>  	/* DSI VCs initialization */
>  	for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
>  		dsi->vc[i].source = DSI_VC_SOURCE_L4;
> -		dsi->vc[i].dssdev = NULL;
> +		dsi->vc[i].dest = NULL;
>  	}
>  
>  	r = dsi_get_clocks(dsi);
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 8cd2c800922e..78041ef922cc 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -301,9 +301,6 @@ struct omapdss_dsi_ops {
>  	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
>  	void (*disable_video_output)(struct omap_dss_device *dssdev,
>  			int channel);
> -
> -	int (*request_vc)(struct omap_dss_device *dssdev, int channel);
> -	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
>  };
>  
>  struct omap_dss_device_ops {

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 16/56] drm/omap: panel-dsi-cm: drop hardcoded VC
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:43     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:43 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:53PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Use dsi->channel everywhere, which originates from DT.

I'm not sure DT is the right place to provide this information, but
that's an issue broader than this patch series.

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

> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 20 +++++++------------
>  1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index b1ca9b34ce17..25183744a61d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -27,9 +27,6 @@
>  
>  #include "../dss/omapdss.h"
>  
> -/* DSI Virtual channel. Hardcoded for now. */
> -#define TCH 0
> -
>  #define DCS_READ_NUM_ERRORS	0x05
>  #define DCS_BRIGHTNESS		0x51
>  #define DCS_CTRL_DISPLAY	0x53
> @@ -73,7 +70,6 @@ struct panel_drv_data {
>  	bool te_enabled;
>  
>  	atomic_t do_update;
> -	int channel;
>  
>  	struct delayed_work te_timeout_work;
>  
> @@ -274,7 +270,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  		return 0;
>  
>  	src->ops->enable(src);
> -	src->ops->dsi.enable_hs(src, ddata->channel, true);
> +	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
>  
>  	r = _dsicm_enable_te(ddata, true);
>  	if (r) {
> @@ -591,7 +587,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	dsicm_hw_reset(ddata);
>  
> -	src->ops->dsi.enable_hs(src, ddata->channel, false);
> +	src->ops->dsi.enable_hs(src, ddata->dsi->channel, false);
>  
>  	r = dsicm_sleep_out(ddata);
>  	if (r)
> @@ -622,7 +618,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (r)
>  		goto err;
>  
> -	r = src->ops->dsi.enable_video_output(src, ddata->channel);
> +	r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
>  	if (r)
>  		goto err;
>  
> @@ -634,7 +630,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  		ddata->intro_printed = true;
>  	}
>  
> -	src->ops->dsi.enable_hs(src, ddata->channel, true);
> +	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
>  
>  	return 0;
>  err:
> @@ -658,7 +654,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  	struct omap_dss_device *src = ddata->src;
>  	int r;
>  
> -	src->ops->dsi.disable_video_output(src, ddata->channel);
> +	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
>  
>  	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
>  	if (!r)
> @@ -777,7 +773,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data)
>  	if (old) {
>  		cancel_delayed_work(&ddata->te_timeout_work);
>  
> -		r = src->ops->dsi.update(src, ddata->channel, dsicm_framedone_cb,
> +		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
>  				ddata);
>  		if (r)
>  			goto err;
> @@ -834,7 +830,7 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  				msecs_to_jiffies(250));
>  		atomic_set(&ddata->do_update, 1);
>  	} else {
> -		r = src->ops->dsi.update(src, ddata->channel, dsicm_framedone_cb,
> +		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
>  				ddata);
>  		if (r)
>  			goto err;
> @@ -1110,8 +1106,6 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  	struct display_timing timing;
>  	int err;
>  
> -	ddata->channel = TCH;
> -
>  	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
>  	if (IS_ERR(ddata->reset_gpio)) {
>  		err = PTR_ERR(ddata->reset_gpio);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 16/56] drm/omap: panel-dsi-cm: drop hardcoded VC
@ 2020-11-09  8:43     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:43 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:53PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Use dsi->channel everywhere, which originates from DT.

I'm not sure DT is the right place to provide this information, but
that's an issue broader than this patch series.

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

> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 20 +++++++------------
>  1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index b1ca9b34ce17..25183744a61d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -27,9 +27,6 @@
>  
>  #include "../dss/omapdss.h"
>  
> -/* DSI Virtual channel. Hardcoded for now. */
> -#define TCH 0
> -
>  #define DCS_READ_NUM_ERRORS	0x05
>  #define DCS_BRIGHTNESS		0x51
>  #define DCS_CTRL_DISPLAY	0x53
> @@ -73,7 +70,6 @@ struct panel_drv_data {
>  	bool te_enabled;
>  
>  	atomic_t do_update;
> -	int channel;
>  
>  	struct delayed_work te_timeout_work;
>  
> @@ -274,7 +270,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  		return 0;
>  
>  	src->ops->enable(src);
> -	src->ops->dsi.enable_hs(src, ddata->channel, true);
> +	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
>  
>  	r = _dsicm_enable_te(ddata, true);
>  	if (r) {
> @@ -591,7 +587,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	dsicm_hw_reset(ddata);
>  
> -	src->ops->dsi.enable_hs(src, ddata->channel, false);
> +	src->ops->dsi.enable_hs(src, ddata->dsi->channel, false);
>  
>  	r = dsicm_sleep_out(ddata);
>  	if (r)
> @@ -622,7 +618,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (r)
>  		goto err;
>  
> -	r = src->ops->dsi.enable_video_output(src, ddata->channel);
> +	r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
>  	if (r)
>  		goto err;
>  
> @@ -634,7 +630,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  		ddata->intro_printed = true;
>  	}
>  
> -	src->ops->dsi.enable_hs(src, ddata->channel, true);
> +	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
>  
>  	return 0;
>  err:
> @@ -658,7 +654,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  	struct omap_dss_device *src = ddata->src;
>  	int r;
>  
> -	src->ops->dsi.disable_video_output(src, ddata->channel);
> +	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
>  
>  	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
>  	if (!r)
> @@ -777,7 +773,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data)
>  	if (old) {
>  		cancel_delayed_work(&ddata->te_timeout_work);
>  
> -		r = src->ops->dsi.update(src, ddata->channel, dsicm_framedone_cb,
> +		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
>  				ddata);
>  		if (r)
>  			goto err;
> @@ -834,7 +830,7 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  				msecs_to_jiffies(250));
>  		atomic_set(&ddata->do_update, 1);
>  	} else {
> -		r = src->ops->dsi.update(src, ddata->channel, dsicm_framedone_cb,
> +		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
>  				ddata);
>  		if (r)
>  			goto err;
> @@ -1110,8 +1106,6 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  	struct display_timing timing;
>  	int err;
>  
> -	ddata->channel = TCH;
> -
>  	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
>  	if (IS_ERR(ddata->reset_gpio)) {
>  		err = PTR_ERR(ddata->reset_gpio);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 17/56] drm/omap: panel-dsi-cm: use common MIPI DCS 1.3 defines
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:44     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:44 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:54PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Drop local definition of common MIPI DCS 1.3 defines.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 25183744a61d..a7236d9c3046 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -28,8 +28,6 @@
>  #include "../dss/omapdss.h"
>  
>  #define DCS_READ_NUM_ERRORS	0x05
> -#define DCS_BRIGHTNESS		0x51
> -#define DCS_CTRL_DISPLAY	0x53
>  #define DCS_GET_ID1		0xda
>  #define DCS_GET_ID2		0xdb
>  #define DCS_GET_ID3		0xdc
> @@ -333,8 +331,10 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
>  		src->ops->dsi.bus_lock(src);
>  
>  		r = dsicm_wake_up(ddata);
> -		if (!r)
> -			r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, level);
> +		if (!r) {
> +			r = dsicm_dcs_write_1(ddata,
> +				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
> +		}

Weird indentation, and no need for curly brackets, but no big deal.

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

>  
>  		src->ops->dsi.bus_unlock(src);
>  	}
> @@ -597,11 +597,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (r)
>  		goto err;
>  
> -	r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, 0xff);
> +	r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 0xff);
>  	if (r)
>  		goto err;
>  
> -	r = dsicm_dcs_write_1(ddata, DCS_CTRL_DISPLAY,
> +	r = dsicm_dcs_write_1(ddata, MIPI_DCS_WRITE_CONTROL_DISPLAY,
>  			(1<<2) | (1<<5));	/* BL | BCTRL */
>  	if (r)
>  		goto err;

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 17/56] drm/omap: panel-dsi-cm: use common MIPI DCS 1.3 defines
@ 2020-11-09  8:44     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:44 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:54PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Drop local definition of common MIPI DCS 1.3 defines.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 25183744a61d..a7236d9c3046 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -28,8 +28,6 @@
>  #include "../dss/omapdss.h"
>  
>  #define DCS_READ_NUM_ERRORS	0x05
> -#define DCS_BRIGHTNESS		0x51
> -#define DCS_CTRL_DISPLAY	0x53
>  #define DCS_GET_ID1		0xda
>  #define DCS_GET_ID2		0xdb
>  #define DCS_GET_ID3		0xdc
> @@ -333,8 +331,10 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
>  		src->ops->dsi.bus_lock(src);
>  
>  		r = dsicm_wake_up(ddata);
> -		if (!r)
> -			r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, level);
> +		if (!r) {
> +			r = dsicm_dcs_write_1(ddata,
> +				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
> +		}

Weird indentation, and no need for curly brackets, but no big deal.

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

>  
>  		src->ops->dsi.bus_unlock(src);
>  	}
> @@ -597,11 +597,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (r)
>  		goto err;
>  
> -	r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, 0xff);
> +	r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 0xff);
>  	if (r)
>  		goto err;
>  
> -	r = dsicm_dcs_write_1(ddata, DCS_CTRL_DISPLAY,
> +	r = dsicm_dcs_write_1(ddata, MIPI_DCS_WRITE_CONTROL_DISPLAY,
>  			(1<<2) | (1<<5));	/* BL | BCTRL */
>  	if (r)
>  		goto err;

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 18/56] drm/omap: dsi: drop unused memory_read()
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:45     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:45 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:55PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> memory_read is not used, so we can drop the code.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 93 -------------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  4 -
>  2 files changed, 97 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index a7236d9c3046..dd9112ca76ba 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -931,97 +931,6 @@ static int dsicm_get_te(struct omap_dss_device *dssdev)
>  	return r;
>  }
>  
> -static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
> -					u16 size)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct mipi_dsi_device *dsi = ddata->dsi;
> -
> -	return mipi_dsi_set_maximum_return_packet_size(dsi, size);
> -}
> -
> -static int dsicm_memory_read(struct omap_dss_device *dssdev,
> -		void *buf, size_t size,
> -		u16 x, u16 y, u16 w, u16 h)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct mipi_dsi_device *dsi = ddata->dsi;
> -	struct omap_dss_device *src = ddata->src;
> -	int r;
> -	int first = 1;
> -	int plen;
> -	unsigned int buf_used = 0;
> -
> -	if (size < w * h * 3)
> -		return -ENOMEM;
> -
> -	mutex_lock(&ddata->lock);
> -
> -	if (!ddata->enabled) {
> -		r = -ENODEV;
> -		goto err1;
> -	}
> -
> -	size = min((u32)w * h * 3,
> -		   ddata->vm.hactive * ddata->vm.vactive * 3);
> -
> -	src->ops->dsi.bus_lock(src);
> -
> -	r = dsicm_wake_up(ddata);
> -	if (r)
> -		goto err2;
> -
> -	/* plen 1 or 2 goes into short packet. until checksum error is fixed,
> -	 * use short packets. plen 32 works, but bigger packets seem to cause
> -	 * an error. */
> -	if (size % 2)
> -		plen = 1;
> -	else
> -		plen = 2;
> -
> -	dsicm_set_update_window(ddata, x, y, w, h);
> -
> -	r = dsicm_set_max_rx_packet_size(dssdev, plen);
> -	if (r)
> -		goto err2;
> -
> -	while (buf_used < size) {
> -		u8 dcs_cmd = first ? 0x2e : 0x3e;
> -		first = 0;
> -
> -		r = mipi_dsi_dcs_read(dsi, dcs_cmd,
> -				      buf + buf_used, size - buf_used);
> -		if (r < 0) {
> -			dev_err(dssdev->dev, "read error\n");
> -			goto err3;
> -		}
> -
> -		buf_used += r;
> -
> -		if (r < plen) {
> -			dev_err(&ddata->dsi->dev, "short read\n");
> -			break;
> -		}
> -
> -		if (signal_pending(current)) {
> -			dev_err(&ddata->dsi->dev, "signal pending, "
> -					"aborting memory read\n");
> -			r = -ERESTARTSYS;
> -			goto err3;
> -		}
> -	}
> -
> -	r = buf_used;
> -
> -err3:
> -	dsicm_set_max_rx_packet_size(dssdev, 1);
> -err2:
> -	src->ops->dsi.bus_unlock(src);
> -err1:
> -	mutex_unlock(&ddata->lock);
> -	return r;
> -}
> -
>  static void dsicm_ulps_work(struct work_struct *work)
>  {
>  	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> @@ -1094,8 +1003,6 @@ static const struct omap_dss_driver dsicm_dss_driver = {
>  
>  	.enable_te	= dsicm_enable_te,
>  	.get_te		= dsicm_get_te,
> -
> -	.memory_read	= dsicm_memory_read,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 78041ef922cc..e67928373560 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -389,10 +389,6 @@ struct omap_dss_driver {
>  
>  	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
>  	int (*get_te)(struct omap_dss_device *dssdev);
> -
> -	int (*memory_read)(struct omap_dss_device *dssdev,
> -			void *buf, size_t size,
> -			u16 x, u16 y, u16 w, u16 h);
>  };
>  
>  struct dss_device *omapdss_get_dss(void);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 18/56] drm/omap: dsi: drop unused memory_read()
@ 2020-11-09  8:45     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:45 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:55PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> memory_read is not used, so we can drop the code.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 93 -------------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  4 -
>  2 files changed, 97 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index a7236d9c3046..dd9112ca76ba 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -931,97 +931,6 @@ static int dsicm_get_te(struct omap_dss_device *dssdev)
>  	return r;
>  }
>  
> -static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
> -					u16 size)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct mipi_dsi_device *dsi = ddata->dsi;
> -
> -	return mipi_dsi_set_maximum_return_packet_size(dsi, size);
> -}
> -
> -static int dsicm_memory_read(struct omap_dss_device *dssdev,
> -		void *buf, size_t size,
> -		u16 x, u16 y, u16 w, u16 h)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct mipi_dsi_device *dsi = ddata->dsi;
> -	struct omap_dss_device *src = ddata->src;
> -	int r;
> -	int first = 1;
> -	int plen;
> -	unsigned int buf_used = 0;
> -
> -	if (size < w * h * 3)
> -		return -ENOMEM;
> -
> -	mutex_lock(&ddata->lock);
> -
> -	if (!ddata->enabled) {
> -		r = -ENODEV;
> -		goto err1;
> -	}
> -
> -	size = min((u32)w * h * 3,
> -		   ddata->vm.hactive * ddata->vm.vactive * 3);
> -
> -	src->ops->dsi.bus_lock(src);
> -
> -	r = dsicm_wake_up(ddata);
> -	if (r)
> -		goto err2;
> -
> -	/* plen 1 or 2 goes into short packet. until checksum error is fixed,
> -	 * use short packets. plen 32 works, but bigger packets seem to cause
> -	 * an error. */
> -	if (size % 2)
> -		plen = 1;
> -	else
> -		plen = 2;
> -
> -	dsicm_set_update_window(ddata, x, y, w, h);
> -
> -	r = dsicm_set_max_rx_packet_size(dssdev, plen);
> -	if (r)
> -		goto err2;
> -
> -	while (buf_used < size) {
> -		u8 dcs_cmd = first ? 0x2e : 0x3e;
> -		first = 0;
> -
> -		r = mipi_dsi_dcs_read(dsi, dcs_cmd,
> -				      buf + buf_used, size - buf_used);
> -		if (r < 0) {
> -			dev_err(dssdev->dev, "read error\n");
> -			goto err3;
> -		}
> -
> -		buf_used += r;
> -
> -		if (r < plen) {
> -			dev_err(&ddata->dsi->dev, "short read\n");
> -			break;
> -		}
> -
> -		if (signal_pending(current)) {
> -			dev_err(&ddata->dsi->dev, "signal pending, "
> -					"aborting memory read\n");
> -			r = -ERESTARTSYS;
> -			goto err3;
> -		}
> -	}
> -
> -	r = buf_used;
> -
> -err3:
> -	dsicm_set_max_rx_packet_size(dssdev, 1);
> -err2:
> -	src->ops->dsi.bus_unlock(src);
> -err1:
> -	mutex_unlock(&ddata->lock);
> -	return r;
> -}
> -
>  static void dsicm_ulps_work(struct work_struct *work)
>  {
>  	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> @@ -1094,8 +1003,6 @@ static const struct omap_dss_driver dsicm_dss_driver = {
>  
>  	.enable_te	= dsicm_enable_te,
>  	.get_te		= dsicm_get_te,
> -
> -	.memory_read	= dsicm_memory_read,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 78041ef922cc..e67928373560 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -389,10 +389,6 @@ struct omap_dss_driver {
>  
>  	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
>  	int (*get_te)(struct omap_dss_device *dssdev);
> -
> -	int (*memory_read)(struct omap_dss_device *dssdev,
> -			void *buf, size_t size,
> -			u16 x, u16 y, u16 w, u16 h);
>  };
>  
>  struct dss_device *omapdss_get_dss(void);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 19/56] drm/omap: dsi: drop unused get_te()
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:45     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:45 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:56PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The get_te() callback is not used, so we can drop the
> custom API.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

You could squash this with the previous and next patches.

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

> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 13 -------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h           |  1 -
>  2 files changed, 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index dd9112ca76ba..92ac90035fec 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -919,18 +919,6 @@ static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
>  	return r;
>  }
>  
> -static int dsicm_get_te(struct omap_dss_device *dssdev)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	int r;
> -
> -	mutex_lock(&ddata->lock);
> -	r = ddata->te_enabled;
> -	mutex_unlock(&ddata->lock);
> -
> -	return r;
> -}
> -
>  static void dsicm_ulps_work(struct work_struct *work)
>  {
>  	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> @@ -1002,7 +990,6 @@ static const struct omap_dss_driver dsicm_dss_driver = {
>  	.sync		= dsicm_sync,
>  
>  	.enable_te	= dsicm_enable_te,
> -	.get_te		= dsicm_get_te,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index e67928373560..aa307f5ab9cf 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -388,7 +388,6 @@ struct omap_dss_driver {
>  	int (*sync)(struct omap_dss_device *dssdev);
>  
>  	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
> -	int (*get_te)(struct omap_dss_device *dssdev);
>  };
>  
>  struct dss_device *omapdss_get_dss(void);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 19/56] drm/omap: dsi: drop unused get_te()
@ 2020-11-09  8:45     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:45 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:56PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The get_te() callback is not used, so we can drop the
> custom API.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

You could squash this with the previous and next patches.

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

> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 13 -------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h           |  1 -
>  2 files changed, 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index dd9112ca76ba..92ac90035fec 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -919,18 +919,6 @@ static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
>  	return r;
>  }
>  
> -static int dsicm_get_te(struct omap_dss_device *dssdev)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	int r;
> -
> -	mutex_lock(&ddata->lock);
> -	r = ddata->te_enabled;
> -	mutex_unlock(&ddata->lock);
> -
> -	return r;
> -}
> -
>  static void dsicm_ulps_work(struct work_struct *work)
>  {
>  	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> @@ -1002,7 +990,6 @@ static const struct omap_dss_driver dsicm_dss_driver = {
>  	.sync		= dsicm_sync,
>  
>  	.enable_te	= dsicm_enable_te,
> -	.get_te		= dsicm_get_te,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index e67928373560..aa307f5ab9cf 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -388,7 +388,6 @@ struct omap_dss_driver {
>  	int (*sync)(struct omap_dss_device *dssdev);
>  
>  	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
> -	int (*get_te)(struct omap_dss_device *dssdev);
>  };
>  
>  struct dss_device *omapdss_get_dss(void);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 20/56] drm/omap: dsi: drop unused enable_te()
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:46     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:46 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:57PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> enable_te() is not used, so the custom API can be dropped.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 39 -------------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  2 -
>  2 files changed, 41 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 92ac90035fec..f59775cabe2d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -882,43 +882,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  	return r;
>  }
>  
> -static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
> -	int r;
> -
> -	mutex_lock(&ddata->lock);
> -
> -	if (ddata->te_enabled == enable)
> -		goto end;
> -
> -	src->ops->dsi.bus_lock(src);
> -
> -	if (ddata->enabled) {
> -		r = dsicm_wake_up(ddata);
> -		if (r)
> -			goto err;
> -
> -		r = _dsicm_enable_te(ddata, enable);
> -		if (r)
> -			goto err;
> -	}
> -
> -	ddata->te_enabled = enable;
> -
> -	src->ops->dsi.bus_unlock(src);
> -end:
> -	mutex_unlock(&ddata->lock);
> -
> -	return 0;
> -err:
> -	src->ops->dsi.bus_unlock(src);
> -	mutex_unlock(&ddata->lock);
> -
> -	return r;
> -}
> -
>  static void dsicm_ulps_work(struct work_struct *work)
>  {
>  	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> @@ -988,8 +951,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
>  static const struct omap_dss_driver dsicm_dss_driver = {
>  	.update		= dsicm_update,
>  	.sync		= dsicm_sync,
> -
> -	.enable_te	= dsicm_enable_te,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index aa307f5ab9cf..55d5bca59f81 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -386,8 +386,6 @@ struct omap_dss_driver {
>  	int (*update)(struct omap_dss_device *dssdev,
>  			       u16 x, u16 y, u16 w, u16 h);
>  	int (*sync)(struct omap_dss_device *dssdev);
> -
> -	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
>  };
>  
>  struct dss_device *omapdss_get_dss(void);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 20/56] drm/omap: dsi: drop unused enable_te()
@ 2020-11-09  8:46     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:46 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:57PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> enable_te() is not used, so the custom API can be dropped.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 39 -------------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  2 -
>  2 files changed, 41 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 92ac90035fec..f59775cabe2d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -882,43 +882,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  	return r;
>  }
>  
> -static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
> -	int r;
> -
> -	mutex_lock(&ddata->lock);
> -
> -	if (ddata->te_enabled == enable)
> -		goto end;
> -
> -	src->ops->dsi.bus_lock(src);
> -
> -	if (ddata->enabled) {
> -		r = dsicm_wake_up(ddata);
> -		if (r)
> -			goto err;
> -
> -		r = _dsicm_enable_te(ddata, enable);
> -		if (r)
> -			goto err;
> -	}
> -
> -	ddata->te_enabled = enable;
> -
> -	src->ops->dsi.bus_unlock(src);
> -end:
> -	mutex_unlock(&ddata->lock);
> -
> -	return 0;
> -err:
> -	src->ops->dsi.bus_unlock(src);
> -	mutex_unlock(&ddata->lock);
> -
> -	return r;
> -}
> -
>  static void dsicm_ulps_work(struct work_struct *work)
>  {
>  	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> @@ -988,8 +951,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
>  static const struct omap_dss_driver dsicm_dss_driver = {
>  	.update		= dsicm_update,
>  	.sync		= dsicm_sync,
> -
> -	.enable_te	= dsicm_enable_te,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index aa307f5ab9cf..55d5bca59f81 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -386,8 +386,6 @@ struct omap_dss_driver {
>  	int (*update)(struct omap_dss_device *dssdev,
>  			       u16 x, u16 y, u16 w, u16 h);
>  	int (*sync)(struct omap_dss_device *dssdev);
> -
> -	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
>  };
>  
>  struct dss_device *omapdss_get_dss(void);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 21/56] drm/omap: dsi: drop useless sync()
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:46     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:46 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:58PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The DSI sync() function only locks the bus and then releases
> it again. Currently the only invocation is directly before
> update(), which locks the bus anyways.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c    | 18 ------------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h          |  1 -
>  drivers/gpu/drm/omapdrm/omap_crtc.c            |  3 ---
>  3 files changed, 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index f59775cabe2d..a9609eed6bfa 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -845,23 +845,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  	return r;
>  }
>  
> -static int dsicm_sync(struct omap_dss_device *dssdev)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
> -
> -	dev_dbg(&ddata->dsi->dev, "sync\n");
> -
> -	mutex_lock(&ddata->lock);
> -	src->ops->dsi.bus_lock(src);
> -	src->ops->dsi.bus_unlock(src);
> -	mutex_unlock(&ddata->lock);
> -
> -	dev_dbg(&ddata->dsi->dev, "sync done\n");
> -
> -	return 0;
> -}
> -
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
>  	struct omap_dss_device *src = ddata->src;
> @@ -950,7 +933,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
>  
>  static const struct omap_dss_driver dsicm_dss_driver = {
>  	.update		= dsicm_update,
> -	.sync		= dsicm_sync,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 55d5bca59f81..9bbd2c0f3187 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -385,7 +385,6 @@ struct omap_dss_device {
>  struct omap_dss_driver {
>  	int (*update)(struct omap_dss_device *dssdev,
>  			       u16 x, u16 y, u16 w, u16 h);
> -	int (*sync)(struct omap_dss_device *dssdev);
>  };
>  
>  struct dss_device *omapdss_get_dss(void);
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 328a4a74f534..dac9ccda98df 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -379,9 +379,6 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
>  		return;
>  	}
>  
> -	if (dssdrv->sync)
> -		dssdrv->sync(dssdev);
> -
>  	ret = dssdrv->update(dssdev, 0, 0, mode->hdisplay, mode->vdisplay);
>  	if (ret < 0) {
>  		spin_lock_irq(&dev->event_lock);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 21/56] drm/omap: dsi: drop useless sync()
@ 2020-11-09  8:46     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:46 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:58PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The DSI sync() function only locks the bus and then releases
> it again. Currently the only invocation is directly before
> update(), which locks the bus anyways.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c    | 18 ------------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h          |  1 -
>  drivers/gpu/drm/omapdrm/omap_crtc.c            |  3 ---
>  3 files changed, 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index f59775cabe2d..a9609eed6bfa 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -845,23 +845,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  	return r;
>  }
>  
> -static int dsicm_sync(struct omap_dss_device *dssdev)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
> -
> -	dev_dbg(&ddata->dsi->dev, "sync\n");
> -
> -	mutex_lock(&ddata->lock);
> -	src->ops->dsi.bus_lock(src);
> -	src->ops->dsi.bus_unlock(src);
> -	mutex_unlock(&ddata->lock);
> -
> -	dev_dbg(&ddata->dsi->dev, "sync done\n");
> -
> -	return 0;
> -}
> -
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
>  	struct omap_dss_device *src = ddata->src;
> @@ -950,7 +933,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
>  
>  static const struct omap_dss_driver dsicm_dss_driver = {
>  	.update		= dsicm_update,
> -	.sync		= dsicm_sync,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 55d5bca59f81..9bbd2c0f3187 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -385,7 +385,6 @@ struct omap_dss_device {
>  struct omap_dss_driver {
>  	int (*update)(struct omap_dss_device *dssdev,
>  			       u16 x, u16 y, u16 w, u16 h);
> -	int (*sync)(struct omap_dss_device *dssdev);
>  };
>  
>  struct dss_device *omapdss_get_dss(void);
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 328a4a74f534..dac9ccda98df 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -379,9 +379,6 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
>  		return;
>  	}
>  
> -	if (dssdrv->sync)
> -		dssdrv->sync(dssdev);
> -
>  	ret = dssdrv->update(dssdev, 0, 0, mode->hdisplay, mode->vdisplay);
>  	if (ret < 0) {
>  		spin_lock_irq(&dev->event_lock);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 22/56] drm/omap: dsi: use pixel-format and mode from attach
  2020-11-05 12:02   ` Tomi Valkeinen
@ 2020-11-09  8:49     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:49 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:59PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> In order to reduce the amount of custom functionality, this moves
> handling of pixel format and DSI mode from set_config() to dsi
> attach.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 --
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 31 ++++++++++++-------
>  2 files changed, 19 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index a9609eed6bfa..2e9de33fc8d4 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -550,8 +550,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	u8 id1, id2, id3;
>  	int r;
>  	struct omap_dss_dsi_config dsi_config = {
> -		.mode = OMAP_DSS_DSI_CMD_MODE,
> -		.pixel_format = MIPI_DSI_FMT_RGB888,
>  		.vm = &ddata->vm,
>  		.hs_clk_min = 150000000,
>  		.hs_clk_max = 300000000,
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index a16427f3bc23..e341aca92462 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4579,24 +4579,19 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	struct dsi_clk_calc_ctx ctx;
> +	struct omap_dss_dsi_config cfg = *config;
>  	bool ok;
>  	int r;
>  
>  	mutex_lock(&dsi->lock);
>  
> -	dsi->pix_fmt = config->pixel_format;
> -	dsi->mode = config->mode;
> +	cfg.mode = dsi->mode;
> +	cfg.pixel_format = dsi->pix_fmt;
>  
> -	if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) {
> -		DSSERR("invalid pixel format\n");
> -		r = -EINVAL;
> -		goto err;
> -	}
> -
> -	if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
> -		ok = dsi_vm_calc(dsi, config, &ctx);
> +	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
> +		ok = dsi_vm_calc(dsi, &cfg, &ctx);
>  	else
> -		ok = dsi_cm_calc(dsi, config, &ctx);
> +		ok = dsi_cm_calc(dsi, &cfg, &ctx);
>  
>  	if (!ok) {
>  		DSSERR("failed to find suitable DSI clock settings\n");
> @@ -4607,7 +4602,7 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
>  	dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
>  
>  	r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
> -		config->lp_clk_min, config->lp_clk_max, &dsi->user_lp_cinfo);
> +		cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
>  	if (r) {
>  		DSSERR("failed to find suitable DSI LP clock settings\n");
>  		goto err;
> @@ -4785,7 +4780,19 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  		return -EBUSY;
>  	}
>  
> +	if (mipi_dsi_pixel_format_to_bpp(client->format) < 0) {
> +		DSSERR("invalid pixel format\n");
> +		return -EINVAL;
> +	}
> +
>  	dsi->vc[channel].dest = client;
> +
> +	dsi->pix_fmt = client->format;

Does this mean that all clients must use the same pixel format ? Do we
even support multiple clients ? If no the VC allocation could be
simplified.

> +	if (client->mode_flags & MIPI_DSI_MODE_VIDEO)
> +		dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
> +	else
> +		dsi->mode = OMAP_DSS_DSI_CMD_MODE;
> +
>  	return 0;
>  }
>  

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 22/56] drm/omap: dsi: use pixel-format and mode from attach
@ 2020-11-09  8:49     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:49 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:59PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> In order to reduce the amount of custom functionality, this moves
> handling of pixel format and DSI mode from set_config() to dsi
> attach.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 --
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 31 ++++++++++++-------
>  2 files changed, 19 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index a9609eed6bfa..2e9de33fc8d4 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -550,8 +550,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	u8 id1, id2, id3;
>  	int r;
>  	struct omap_dss_dsi_config dsi_config = {
> -		.mode = OMAP_DSS_DSI_CMD_MODE,
> -		.pixel_format = MIPI_DSI_FMT_RGB888,
>  		.vm = &ddata->vm,
>  		.hs_clk_min = 150000000,
>  		.hs_clk_max = 300000000,
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index a16427f3bc23..e341aca92462 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4579,24 +4579,19 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	struct dsi_clk_calc_ctx ctx;
> +	struct omap_dss_dsi_config cfg = *config;
>  	bool ok;
>  	int r;
>  
>  	mutex_lock(&dsi->lock);
>  
> -	dsi->pix_fmt = config->pixel_format;
> -	dsi->mode = config->mode;
> +	cfg.mode = dsi->mode;
> +	cfg.pixel_format = dsi->pix_fmt;
>  
> -	if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) {
> -		DSSERR("invalid pixel format\n");
> -		r = -EINVAL;
> -		goto err;
> -	}
> -
> -	if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
> -		ok = dsi_vm_calc(dsi, config, &ctx);
> +	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
> +		ok = dsi_vm_calc(dsi, &cfg, &ctx);
>  	else
> -		ok = dsi_cm_calc(dsi, config, &ctx);
> +		ok = dsi_cm_calc(dsi, &cfg, &ctx);
>  
>  	if (!ok) {
>  		DSSERR("failed to find suitable DSI clock settings\n");
> @@ -4607,7 +4602,7 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
>  	dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
>  
>  	r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
> -		config->lp_clk_min, config->lp_clk_max, &dsi->user_lp_cinfo);
> +		cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
>  	if (r) {
>  		DSSERR("failed to find suitable DSI LP clock settings\n");
>  		goto err;
> @@ -4785,7 +4780,19 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  		return -EBUSY;
>  	}
>  
> +	if (mipi_dsi_pixel_format_to_bpp(client->format) < 0) {
> +		DSSERR("invalid pixel format\n");
> +		return -EINVAL;
> +	}
> +
>  	dsi->vc[channel].dest = client;
> +
> +	dsi->pix_fmt = client->format;

Does this mean that all clients must use the same pixel format ? Do we
even support multiple clients ? If no the VC allocation could be
simplified.

> +	if (client->mode_flags & MIPI_DSI_MODE_VIDEO)
> +		dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
> +	else
> +		dsi->mode = OMAP_DSS_DSI_CMD_MODE;
> +
>  	return 0;
>  }
>  

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 23/56] drm/omap: panel-dsi-cm: use bulk regulator API
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09  8:51     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:51 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:00PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Use bulk regulator API to simplify the code. This also switches
> from _optional variant to normal variant, which will provide a
> dummy regulator (i.e. if some always-enabled regulator is not
> described in DT).
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 65 ++++++-------------
>  1 file changed, 21 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 2e9de33fc8d4..1e742cf798b6 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -32,6 +32,8 @@
>  #define DCS_GET_ID2		0xdb
>  #define DCS_GET_ID3		0xdc
>  
> +#define DCS_REGULATOR_SUPPLY_NUM 2
> +
>  struct panel_drv_data {
>  	struct mipi_dsi_device *dsi;
>  
> @@ -54,8 +56,7 @@ struct panel_drv_data {
>  	struct gpio_desc *reset_gpio;
>  	struct gpio_desc *ext_te_gpio;
>  
> -	struct regulator *vpnl;
> -	struct regulator *vddi;
> +	struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
>  
>  	bool use_dsi_backlight;
>  
> @@ -557,28 +558,16 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  		.lp_clk_max = 10000000,
>  	};
>  
> -	if (ddata->vpnl) {
> -		r = regulator_enable(ddata->vpnl);
> -		if (r) {
> -			dev_err(&ddata->dsi->dev,
> -				"failed to enable VPNL: %d\n", r);
> -			return r;
> -		}
> -	}
> -
> -	if (ddata->vddi) {
> -		r = regulator_enable(ddata->vddi);
> -		if (r) {
> -			dev_err(&ddata->dsi->dev,
> -				"failed to enable VDDI: %d\n", r);
> -			goto err_vpnl;
> -		}
> +	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);

I'd use ARRAY_SIZE(data->supplies) to replace DCS_REGULATOR_SUPPLY_NUM,
and drop the DCS_REGULATOR_SUPPLY_NUM macro.

> +	if (r) {
> +		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
> +		return r;
>  	}
>  
>  	r = src->ops->dsi.set_config(src, &dsi_config);
>  	if (r) {
>  		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
> -		goto err_vddi;
> +		goto err_regulators;
>  	}
>  
>  	src->ops->enable(src);
> @@ -637,12 +626,10 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	dsicm_hw_reset(ddata);
>  
>  	src->ops->dsi.disable(src, true, false);
> -err_vddi:
> -	if (ddata->vddi)
> -		regulator_disable(ddata->vddi);
> -err_vpnl:
> -	if (ddata->vpnl)
> -		regulator_disable(ddata->vpnl);
> +err_regulators:
> +	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> +	if (r)
> +		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);

Not sure if the error message is needed, but I suppose it doesn't hurt.

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

>  
>  	return r;
>  }
> @@ -666,10 +653,9 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  
>  	src->ops->dsi.disable(src, true, false);
>  
> -	if (ddata->vddi)
> -		regulator_disable(ddata->vddi);
> -	if (ddata->vpnl)
> -		regulator_disable(ddata->vpnl);
> +	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> +	if (r)
> +		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
>  
>  	ddata->enabled = false;
>  }
> @@ -973,21 +959,12 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  	ddata->height_mm = 0;
>  	of_property_read_u32(node, "height-mm", &ddata->height_mm);
>  
> -	ddata->vpnl = devm_regulator_get_optional(&dsi->dev, "vpnl");
> -	if (IS_ERR(ddata->vpnl)) {
> -		err = PTR_ERR(ddata->vpnl);
> -		if (err == -EPROBE_DEFER)
> -			return err;
> -		ddata->vpnl = NULL;
> -	}
> -
> -	ddata->vddi = devm_regulator_get_optional(&dsi->dev, "vddi");
> -	if (IS_ERR(ddata->vddi)) {
> -		err = PTR_ERR(ddata->vddi);
> -		if (err == -EPROBE_DEFER)
> -			return err;
> -		ddata->vddi = NULL;
> -	}
> +	ddata->supplies[0].supply = "vpnl";
> +	ddata->supplies[1].supply = "vddi";
> +	err = devm_regulator_bulk_get(&dsi->dev, DCS_REGULATOR_SUPPLY_NUM,
> +				      ddata->supplies);
> +	if (err)
> +		return err;
>  
>  	backlight = devm_of_find_backlight(&dsi->dev);
>  	if (IS_ERR(backlight))

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 23/56] drm/omap: panel-dsi-cm: use bulk regulator API
@ 2020-11-09  8:51     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:51 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:00PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Use bulk regulator API to simplify the code. This also switches
> from _optional variant to normal variant, which will provide a
> dummy regulator (i.e. if some always-enabled regulator is not
> described in DT).
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 65 ++++++-------------
>  1 file changed, 21 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 2e9de33fc8d4..1e742cf798b6 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -32,6 +32,8 @@
>  #define DCS_GET_ID2		0xdb
>  #define DCS_GET_ID3		0xdc
>  
> +#define DCS_REGULATOR_SUPPLY_NUM 2
> +
>  struct panel_drv_data {
>  	struct mipi_dsi_device *dsi;
>  
> @@ -54,8 +56,7 @@ struct panel_drv_data {
>  	struct gpio_desc *reset_gpio;
>  	struct gpio_desc *ext_te_gpio;
>  
> -	struct regulator *vpnl;
> -	struct regulator *vddi;
> +	struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
>  
>  	bool use_dsi_backlight;
>  
> @@ -557,28 +558,16 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  		.lp_clk_max = 10000000,
>  	};
>  
> -	if (ddata->vpnl) {
> -		r = regulator_enable(ddata->vpnl);
> -		if (r) {
> -			dev_err(&ddata->dsi->dev,
> -				"failed to enable VPNL: %d\n", r);
> -			return r;
> -		}
> -	}
> -
> -	if (ddata->vddi) {
> -		r = regulator_enable(ddata->vddi);
> -		if (r) {
> -			dev_err(&ddata->dsi->dev,
> -				"failed to enable VDDI: %d\n", r);
> -			goto err_vpnl;
> -		}
> +	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);

I'd use ARRAY_SIZE(data->supplies) to replace DCS_REGULATOR_SUPPLY_NUM,
and drop the DCS_REGULATOR_SUPPLY_NUM macro.

> +	if (r) {
> +		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
> +		return r;
>  	}
>  
>  	r = src->ops->dsi.set_config(src, &dsi_config);
>  	if (r) {
>  		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
> -		goto err_vddi;
> +		goto err_regulators;
>  	}
>  
>  	src->ops->enable(src);
> @@ -637,12 +626,10 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	dsicm_hw_reset(ddata);
>  
>  	src->ops->dsi.disable(src, true, false);
> -err_vddi:
> -	if (ddata->vddi)
> -		regulator_disable(ddata->vddi);
> -err_vpnl:
> -	if (ddata->vpnl)
> -		regulator_disable(ddata->vpnl);
> +err_regulators:
> +	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> +	if (r)
> +		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);

Not sure if the error message is needed, but I suppose it doesn't hurt.

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

>  
>  	return r;
>  }
> @@ -666,10 +653,9 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  
>  	src->ops->dsi.disable(src, true, false);
>  
> -	if (ddata->vddi)
> -		regulator_disable(ddata->vddi);
> -	if (ddata->vpnl)
> -		regulator_disable(ddata->vpnl);
> +	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> +	if (r)
> +		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
>  
>  	ddata->enabled = false;
>  }
> @@ -973,21 +959,12 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  	ddata->height_mm = 0;
>  	of_property_read_u32(node, "height-mm", &ddata->height_mm);
>  
> -	ddata->vpnl = devm_regulator_get_optional(&dsi->dev, "vpnl");
> -	if (IS_ERR(ddata->vpnl)) {
> -		err = PTR_ERR(ddata->vpnl);
> -		if (err == -EPROBE_DEFER)
> -			return err;
> -		ddata->vpnl = NULL;
> -	}
> -
> -	ddata->vddi = devm_regulator_get_optional(&dsi->dev, "vddi");
> -	if (IS_ERR(ddata->vddi)) {
> -		err = PTR_ERR(ddata->vddi);
> -		if (err == -EPROBE_DEFER)
> -			return err;
> -		ddata->vddi = NULL;
> -	}
> +	ddata->supplies[0].supply = "vpnl";
> +	ddata->supplies[1].supply = "vddi";
> +	err = devm_regulator_bulk_get(&dsi->dev, DCS_REGULATOR_SUPPLY_NUM,
> +				      ddata->supplies);
> +	if (err)
> +		return err;
>  
>  	backlight = devm_of_find_backlight(&dsi->dev);
>  	if (IS_ERR(backlight))

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 24/56] drm/omap: dsi: lp/hs switching support for transfer()
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09  8:53     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:53 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:01PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Integrate low-power / high-speed bus switching into transfer
> function and drop the omapdrm specific enable_hs() callback.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  6 +++---
>  drivers/gpu/drm/omapdrm/dss/dsi.c               | 10 ++++++++--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h           |  2 --
>  3 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 1e742cf798b6..8890ee2ba830 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -269,7 +269,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  		return 0;
>  
>  	src->ops->enable(src);
> -	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
> +	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>  
>  	r = _dsicm_enable_te(ddata, true);
>  	if (r) {
> @@ -574,7 +574,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	dsicm_hw_reset(ddata);
>  
> -	src->ops->dsi.enable_hs(src, ddata->dsi->channel, false);
> +	ddata->dsi->mode_flags |= MIPI_DSI_MODE_LPM;
>  
>  	r = dsicm_sleep_out(ddata);
>  	if (r)
> @@ -617,7 +617,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  		ddata->intro_printed = true;
>  	}
>  
> -	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
> +	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>  
>  	return 0;
>  err:
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index e341aca92462..003d26cead5a 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -329,6 +329,7 @@ struct dsi_data {
>  	int irq;
>  
>  	bool is_enabled;
> +	bool in_lp_mode;
>  
>  	struct clk *dss_clk;
>  	struct regmap *syscon;
> @@ -2431,6 +2432,8 @@ static void dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
>  	/* start the DDR clock by sending a NULL packet */
>  	if (dsi->vm_timings.ddr_clk_always_on && enable)
>  		dsi_vc_send_null(dsi, channel);
> +
> +	dsi->in_lp_mode = !enable;
>  }
>  
>  static void dsi_vc_flush_long_data(struct dsi_data *dsi, int channel)
> @@ -4693,6 +4696,11 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  	struct dsi_data *dsi = host_to_omap(host);
>  	struct omap_dss_device *dssdev = &dsi->output;
>  
> +	if (!!(msg->flags & MIPI_DSI_MSG_USE_LPM) != dsi->in_lp_mode) {
> +		dsi_vc_enable_hs(dssdev, msg->channel,
> +				 !(msg->flags & MIPI_DSI_MSG_USE_LPM));
> +	}

No need for curly brackets.

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

> +
>  	switch (msg->type) {
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
> @@ -4753,8 +4761,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  
>  		.disable = dsi_display_disable,
>  
> -		.enable_hs = dsi_vc_enable_hs,
> -
>  		.set_config = dsi_set_config,
>  
>  		.enable_video_output = dsi_enable_video_output,
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 9bbd2c0f3187..2d44a8e32fcc 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -288,8 +288,6 @@ struct omapdss_dsi_ops {
>  	int (*set_config)(struct omap_dss_device *dssdev,
>  			const struct omap_dss_dsi_config *cfg);
>  
> -	void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
> -			bool enable);
>  	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
>  
>  	int (*update)(struct omap_dss_device *dssdev, int channel,

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 24/56] drm/omap: dsi: lp/hs switching support for transfer()
@ 2020-11-09  8:53     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  8:53 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:01PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Integrate low-power / high-speed bus switching into transfer
> function and drop the omapdrm specific enable_hs() callback.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  6 +++---
>  drivers/gpu/drm/omapdrm/dss/dsi.c               | 10 ++++++++--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h           |  2 --
>  3 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 1e742cf798b6..8890ee2ba830 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -269,7 +269,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  		return 0;
>  
>  	src->ops->enable(src);
> -	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
> +	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>  
>  	r = _dsicm_enable_te(ddata, true);
>  	if (r) {
> @@ -574,7 +574,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	dsicm_hw_reset(ddata);
>  
> -	src->ops->dsi.enable_hs(src, ddata->dsi->channel, false);
> +	ddata->dsi->mode_flags |= MIPI_DSI_MODE_LPM;
>  
>  	r = dsicm_sleep_out(ddata);
>  	if (r)
> @@ -617,7 +617,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  		ddata->intro_printed = true;
>  	}
>  
> -	src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
> +	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>  
>  	return 0;
>  err:
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index e341aca92462..003d26cead5a 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -329,6 +329,7 @@ struct dsi_data {
>  	int irq;
>  
>  	bool is_enabled;
> +	bool in_lp_mode;
>  
>  	struct clk *dss_clk;
>  	struct regmap *syscon;
> @@ -2431,6 +2432,8 @@ static void dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
>  	/* start the DDR clock by sending a NULL packet */
>  	if (dsi->vm_timings.ddr_clk_always_on && enable)
>  		dsi_vc_send_null(dsi, channel);
> +
> +	dsi->in_lp_mode = !enable;
>  }
>  
>  static void dsi_vc_flush_long_data(struct dsi_data *dsi, int channel)
> @@ -4693,6 +4696,11 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  	struct dsi_data *dsi = host_to_omap(host);
>  	struct omap_dss_device *dssdev = &dsi->output;
>  
> +	if (!!(msg->flags & MIPI_DSI_MSG_USE_LPM) != dsi->in_lp_mode) {
> +		dsi_vc_enable_hs(dssdev, msg->channel,
> +				 !(msg->flags & MIPI_DSI_MSG_USE_LPM));
> +	}

No need for curly brackets.

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

> +
>  	switch (msg->type) {
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
> @@ -4753,8 +4761,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  
>  		.disable = dsi_display_disable,
>  
> -		.enable_hs = dsi_vc_enable_hs,
> -
>  		.set_config = dsi_set_config,
>  
>  		.enable_video_output = dsi_enable_video_output,
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 9bbd2c0f3187..2d44a8e32fcc 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -288,8 +288,6 @@ struct omapdss_dsi_ops {
>  	int (*set_config)(struct omap_dss_device *dssdev,
>  			const struct omap_dss_dsi_config *cfg);
>  
> -	void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
> -			bool enable);
>  	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
>  
>  	int (*update)(struct omap_dss_device *dssdev, int channel,

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 25/56] drm/omap: dsi: move TE GPIO handling into core
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09  9:19     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  9:19 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:02PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> In preparation for removing custom DSS calls from the DSI
> panel driver, this moves support for external tearing event
> GPIOs into the DSI host driver. This way tearing events are
> always handled in the core resulting in simplification of
> the panel drivers.
> 
> The TE GPIO acquisition follows works in the same way as the
> exynos DSI implementation.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 101 +------------
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 138 ++++++++++++++++--
>  2 files changed, 133 insertions(+), 106 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 8890ee2ba830..43f63b5a120b 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -54,7 +54,6 @@ struct panel_drv_data {
>  
>  	/* panel HW configuration from DT or platform data */
>  	struct gpio_desc *reset_gpio;
> -	struct gpio_desc *ext_te_gpio;
>  
>  	struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
>  
> @@ -68,10 +67,6 @@ struct panel_drv_data {
>  
>  	bool te_enabled;
>  
> -	atomic_t do_update;
> -
> -	struct delayed_work te_timeout_work;
> -
>  	bool intro_printed;
>  
>  	struct workqueue_struct *workqueue;
> @@ -83,8 +78,6 @@ struct panel_drv_data {
>  
>  #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
>  
> -static irqreturn_t dsicm_te_isr(int irq, void *data);
> -static void dsicm_te_timeout_work_callback(struct work_struct *work);
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>  
>  static int dsicm_panel_reset(struct panel_drv_data *ddata);
> @@ -240,9 +233,6 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>  	if (r)
>  		goto err;
>  
> -	if (ddata->ext_te_gpio)
> -		disable_irq(gpiod_to_irq(ddata->ext_te_gpio));
> -
>  	src->ops->dsi.disable(src, false, true);
>  
>  	ddata->ulps_enabled = true;
> @@ -271,15 +261,12 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  	src->ops->enable(src);
>  	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>  
> -	r = _dsicm_enable_te(ddata, true);
> +	r = _dsicm_enable_te(ddata, ddata->te_enabled);
>  	if (r) {
>  		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
>  		goto err2;
>  	}
>  
> -	if (ddata->ext_te_gpio)
> -		enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
> -
>  	dsicm_queue_ulps_work(ddata);
>  
>  	ddata->ulps_enabled = false;
> @@ -290,11 +277,8 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
>  
>  	r = dsicm_panel_reset(ddata);
> -	if (!r) {
> -		if (ddata->ext_te_gpio)
> -			enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
> +	if (!r)
>  		ddata->ulps_enabled = false;
> -	}
>  
>  	dsicm_queue_ulps_work(ddata);
>  
> @@ -745,43 +729,6 @@ static void dsicm_framedone_cb(int err, void *data)
>  	src->ops->dsi.bus_unlock(src);
>  }
>  
> -static irqreturn_t dsicm_te_isr(int irq, void *data)
> -{
> -	struct panel_drv_data *ddata = data;
> -	struct omap_dss_device *src = ddata->src;
> -	int old;
> -	int r;
> -
> -	old = atomic_cmpxchg(&ddata->do_update, 1, 0);
> -
> -	if (old) {
> -		cancel_delayed_work(&ddata->te_timeout_work);
> -
> -		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
> -				ddata);
> -		if (r)
> -			goto err;
> -	}
> -
> -	return IRQ_HANDLED;
> -err:
> -	dev_err(&ddata->dsi->dev, "start update failed\n");
> -	src->ops->dsi.bus_unlock(src);
> -	return IRQ_HANDLED;
> -}
> -
> -static void dsicm_te_timeout_work_callback(struct work_struct *work)
> -{
> -	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> -					te_timeout_work.work);
> -	struct omap_dss_device *src = ddata->src;
> -
> -	dev_err(&ddata->dsi->dev, "TE not received for 250ms!\n");
> -
> -	atomic_set(&ddata->do_update, 0);
> -	src->ops->dsi.bus_unlock(src);
> -}
> -
>  static int dsicm_update(struct omap_dss_device *dssdev,
>  				    u16 x, u16 y, u16 w, u16 h)
>  {
> @@ -809,16 +756,10 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  	if (r)
>  		goto err;
>  
> -	if (ddata->te_enabled && ddata->ext_te_gpio) {
> -		schedule_delayed_work(&ddata->te_timeout_work,
> -				msecs_to_jiffies(250));
> -		atomic_set(&ddata->do_update, 1);
> -	} else {
> -		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
> -				ddata);
> -		if (r)
> -			goto err;
> -	}
> +	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
> +			ddata);
> +	if (r)
> +		goto err;
>  
>  	/* note: no bus_unlock here. unlock is src framedone_cb */
>  	mutex_unlock(&ddata->lock);
> @@ -840,8 +781,7 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  	else
>  		r = mipi_dsi_dcs_set_tear_off(dsi);
>  
> -	if (!ddata->ext_te_gpio)
> -		src->ops->dsi.enable_te(src, enable);
> +	src->ops->dsi.enable_te(src, enable);
>  
>  	/* possible panel bug */
>  	msleep(100);
> @@ -934,14 +874,6 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  		return err;
>  	}
>  
> -	ddata->ext_te_gpio = devm_gpiod_get_optional(&dsi->dev, "te",
> -						     GPIOD_IN);
> -	if (IS_ERR(ddata->ext_te_gpio)) {
> -		err = PTR_ERR(ddata->ext_te_gpio);
> -		dev_err(&dsi->dev, "TE gpio request failed: %d", err);
> -		return err;
> -	}
> -
>  	err = of_get_display_timing(node, "panel-timing", &timing);
>  	if (!err) {
>  		videomode_from_timing(&timing, &ddata->vm);
> @@ -1024,25 +956,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  
>  	mutex_init(&ddata->lock);
>  
> -	atomic_set(&ddata->do_update, 0);
> -
> -	if (ddata->ext_te_gpio) {
> -		r = devm_request_irq(dev, gpiod_to_irq(ddata->ext_te_gpio),
> -				dsicm_te_isr,
> -				IRQF_TRIGGER_RISING,
> -				"taal vsync", ddata);
> -
> -		if (r) {
> -			dev_err(dev, "IRQ request failed\n");
> -			goto err_reg;
> -		}
> -
> -		INIT_DEFERRABLE_WORK(&ddata->te_timeout_work,
> -					dsicm_te_timeout_work_callback);
> -
> -		dev_dbg(dev, "Using GPIO TE\n");
> -	}
> -
>  	ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
>  	if (!ddata->workqueue) {
>  		r = -ENOMEM;
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 003d26cead5a..921e7a1e1014 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -14,7 +14,9 @@
>  #include <linux/device.h>
>  #include <linux/err.h>
>  #include <linux/interrupt.h>
> +#include <linux/irq.h>
>  #include <linux/delay.h>
> +#include <linux/gpio/consumer.h>

You could sort the headers while at it :-)

>  #include <linux/mutex.h>
>  #include <linux/module.h>
>  #include <linux/semaphore.h>
> @@ -368,6 +370,11 @@ struct dsi_data {
>  	unsigned int update_bytes;
>  #endif
>  
> +	/* external TE GPIO */
> +	struct gpio_desc *te_gpio;
> +	struct delayed_work te_timeout_work;
> +	atomic_t do_ext_te_update;
> +
>  	bool te_enabled;
>  	bool ulps_enabled;
>  
> @@ -3827,19 +3834,12 @@ static void dsi_framedone_irq_callback(void *data)
>  	dsi_handle_framedone(dsi, 0);
>  }
>  
> -static int dsi_update(struct omap_dss_device *dssdev, int channel,
> -		void (*callback)(int, void *), void *data)
> +static int _dsi_update(struct dsi_data *dsi)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	u16 dw, dh;
>  
>  	dsi_perf_mark_setup(dsi);
>  
> -	dsi->update_channel = channel;
> -
> -	dsi->framedone_callback = callback;
> -	dsi->framedone_data = data;
> -
>  	dw = dsi->vm.hactive;
>  	dh = dsi->vm.vactive;
>  
> @@ -3852,6 +3852,26 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>  	return 0;
>  }
>  
> +static int dsi_update(struct omap_dss_device *dssdev, int channel,
> +		void (*callback)(int, void *), void *data)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +
> +	dsi->update_channel = channel;
> +	dsi->framedone_callback = callback;
> +	dsi->framedone_data = data;
> +
> +	if (dsi->te_enabled && dsi->te_gpio) {
> +		schedule_delayed_work(&dsi->te_timeout_work,
> +				      msecs_to_jiffies(250));
> +		atomic_set(&dsi->do_ext_te_update, 1);
> +	} else {
> +		_dsi_update(dsi);
> +	}
> +
> +	return 0;
> +}
> +
>  /* Display funcs */
>  
>  static int dsi_configure_dispc_clocks(struct dsi_data *dsi)
> @@ -4095,6 +4115,14 @@ static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  
>  	dsi->te_enabled = enable;
> +
> +	if (dsi->te_gpio) {
> +		if (enable)
> +			enable_irq(gpiod_to_irq(dsi->te_gpio));
> +		else
> +			disable_irq(gpiod_to_irq(dsi->te_gpio));
> +	}
> +
>  	return 0;
>  }
>  
> @@ -4772,11 +4800,89 @@ static const struct omap_dss_device_ops dsi_ops = {
>  	},
>  };
>  
> +static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
> +{
> +	struct dsi_data *dsi = (struct dsi_data *)dev_id;
> +	int old;
> +
> +	old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
> +	if (old) {
> +		cancel_delayed_work(&dsi->te_timeout_work);
> +		_dsi_update(dsi);
> +	}
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static void omap_dsi_te_timeout_work_callback(struct work_struct *work)
> +{
> +	struct dsi_data *dsi = container_of(work, struct dsi_data,
> +					te_timeout_work.work);

Strange indentation.

> +	int old;
> +
> +	old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
> +	if (old) {
> +		dev_err(dsi->dev, "TE not received for 250ms!\n");
> +		_dsi_update(dsi);
> +	}
> +}
> +
> +static int omap_dsi_register_te_irq(struct dsi_data *dsi,
> +				    struct mipi_dsi_device *client)
> +{
> +	int err;
> +	int te_irq;
> +
> +	dsi->te_gpio = gpiod_get_from_of_node(client->dev.of_node,

Could we call gpiod_get(&client->dev, "te", ...) instead ?

> +					      "te-gpios", 0, GPIOD_IN,
> +					      "dsi-tearing-effect");
> +	if (IS_ERR(dsi->te_gpio)) {
> +		err = PTR_ERR(dsi->te_gpio);
> +
> +		if (err == -ENOENT) {
> +			dsi->te_gpio = NULL;
> +			return 0;
> +		}
> +
> +		dev_err(dsi->dev, "Could not get TE gpio: %d\n", err);
> +		return err;
> +	}
> +
> +	te_irq = gpiod_to_irq(dsi->te_gpio);

Could this fail ?

> +	irq_set_status_flags(te_irq, IRQ_NOAUTOEN);
> +
> +	err = request_threaded_irq(te_irq, omap_dsi_te_irq_handler, NULL,
> +				   IRQF_TRIGGER_RISING, "TE", dsi);

What's the reason to request a threaded IRQ instead of a regular IRQ if
the threaded handler is NULL ?

> +	if (err) {
> +		dev_err(dsi->dev, "request irq failed with %d\n", err);
> +		gpiod_put(dsi->te_gpio);
> +		return err;
> +	}
> +
> +	INIT_DEFERRABLE_WORK(&dsi->te_timeout_work,
> +			     omap_dsi_te_timeout_work_callback);
> +
> +	dev_dbg(dsi->dev, "Using GPIO TE\n");
> +
> +	return 0;
> +}
> +
> +static void omap_dsi_unregister_te_irq(struct dsi_data *dsi)
> +{
> +	if (dsi->te_gpio) {
> +		free_irq(gpiod_to_irq(dsi->te_gpio), dsi);

You could store the IRQ number in dsi_data to avoid recomputing it.

> +		cancel_delayed_work(&dsi->te_timeout_work);
> +		gpiod_put(dsi->te_gpio);
> +		dsi->te_gpio = NULL;
> +	}
> +}
> +
>  static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  				struct mipi_dsi_device *client)
>  {
>  	struct dsi_data *dsi = host_to_omap(host);
>  	unsigned int channel = client->channel;
> +	int r;
>  
>  	if (channel > 3)
>  		return -EINVAL;
> @@ -4791,13 +4897,20 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  		return -EINVAL;
>  	}
>  
> -	dsi->vc[channel].dest = client;
> +	atomic_set(&dsi->do_ext_te_update, 0);
>  
> -	dsi->pix_fmt = client->format;
> -	if (client->mode_flags & MIPI_DSI_MODE_VIDEO)
> +	if (client->mode_flags & MIPI_DSI_MODE_VIDEO) {
>  		dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
> -	else
> +	} else {
> +		r = omap_dsi_register_te_irq(dsi, client);
> +		if (r)
> +			return r;
> +
>  		dsi->mode = OMAP_DSS_DSI_CMD_MODE;
> +	}
> +
> +	dsi->vc[channel].dest = client;
> +	dsi->pix_fmt = client->format;
>  
>  	return 0;
>  }
> @@ -4814,6 +4927,7 @@ static int omap_dsi_host_detach(struct mipi_dsi_host *host,
>  	if (dsi->vc[channel].dest != client)
>  		return -EINVAL;
>  
> +	omap_dsi_unregister_te_irq(dsi);
>  	dsi->vc[channel].dest = NULL;
>  	return 0;
>  }

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 25/56] drm/omap: dsi: move TE GPIO handling into core
@ 2020-11-09  9:19     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  9:19 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:02PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> In preparation for removing custom DSS calls from the DSI
> panel driver, this moves support for external tearing event
> GPIOs into the DSI host driver. This way tearing events are
> always handled in the core resulting in simplification of
> the panel drivers.
> 
> The TE GPIO acquisition follows works in the same way as the
> exynos DSI implementation.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 101 +------------
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 138 ++++++++++++++++--
>  2 files changed, 133 insertions(+), 106 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 8890ee2ba830..43f63b5a120b 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -54,7 +54,6 @@ struct panel_drv_data {
>  
>  	/* panel HW configuration from DT or platform data */
>  	struct gpio_desc *reset_gpio;
> -	struct gpio_desc *ext_te_gpio;
>  
>  	struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
>  
> @@ -68,10 +67,6 @@ struct panel_drv_data {
>  
>  	bool te_enabled;
>  
> -	atomic_t do_update;
> -
> -	struct delayed_work te_timeout_work;
> -
>  	bool intro_printed;
>  
>  	struct workqueue_struct *workqueue;
> @@ -83,8 +78,6 @@ struct panel_drv_data {
>  
>  #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
>  
> -static irqreturn_t dsicm_te_isr(int irq, void *data);
> -static void dsicm_te_timeout_work_callback(struct work_struct *work);
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>  
>  static int dsicm_panel_reset(struct panel_drv_data *ddata);
> @@ -240,9 +233,6 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>  	if (r)
>  		goto err;
>  
> -	if (ddata->ext_te_gpio)
> -		disable_irq(gpiod_to_irq(ddata->ext_te_gpio));
> -
>  	src->ops->dsi.disable(src, false, true);
>  
>  	ddata->ulps_enabled = true;
> @@ -271,15 +261,12 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  	src->ops->enable(src);
>  	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>  
> -	r = _dsicm_enable_te(ddata, true);
> +	r = _dsicm_enable_te(ddata, ddata->te_enabled);
>  	if (r) {
>  		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
>  		goto err2;
>  	}
>  
> -	if (ddata->ext_te_gpio)
> -		enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
> -
>  	dsicm_queue_ulps_work(ddata);
>  
>  	ddata->ulps_enabled = false;
> @@ -290,11 +277,8 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
>  
>  	r = dsicm_panel_reset(ddata);
> -	if (!r) {
> -		if (ddata->ext_te_gpio)
> -			enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
> +	if (!r)
>  		ddata->ulps_enabled = false;
> -	}
>  
>  	dsicm_queue_ulps_work(ddata);
>  
> @@ -745,43 +729,6 @@ static void dsicm_framedone_cb(int err, void *data)
>  	src->ops->dsi.bus_unlock(src);
>  }
>  
> -static irqreturn_t dsicm_te_isr(int irq, void *data)
> -{
> -	struct panel_drv_data *ddata = data;
> -	struct omap_dss_device *src = ddata->src;
> -	int old;
> -	int r;
> -
> -	old = atomic_cmpxchg(&ddata->do_update, 1, 0);
> -
> -	if (old) {
> -		cancel_delayed_work(&ddata->te_timeout_work);
> -
> -		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
> -				ddata);
> -		if (r)
> -			goto err;
> -	}
> -
> -	return IRQ_HANDLED;
> -err:
> -	dev_err(&ddata->dsi->dev, "start update failed\n");
> -	src->ops->dsi.bus_unlock(src);
> -	return IRQ_HANDLED;
> -}
> -
> -static void dsicm_te_timeout_work_callback(struct work_struct *work)
> -{
> -	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> -					te_timeout_work.work);
> -	struct omap_dss_device *src = ddata->src;
> -
> -	dev_err(&ddata->dsi->dev, "TE not received for 250ms!\n");
> -
> -	atomic_set(&ddata->do_update, 0);
> -	src->ops->dsi.bus_unlock(src);
> -}
> -
>  static int dsicm_update(struct omap_dss_device *dssdev,
>  				    u16 x, u16 y, u16 w, u16 h)
>  {
> @@ -809,16 +756,10 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  	if (r)
>  		goto err;
>  
> -	if (ddata->te_enabled && ddata->ext_te_gpio) {
> -		schedule_delayed_work(&ddata->te_timeout_work,
> -				msecs_to_jiffies(250));
> -		atomic_set(&ddata->do_update, 1);
> -	} else {
> -		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
> -				ddata);
> -		if (r)
> -			goto err;
> -	}
> +	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
> +			ddata);
> +	if (r)
> +		goto err;
>  
>  	/* note: no bus_unlock here. unlock is src framedone_cb */
>  	mutex_unlock(&ddata->lock);
> @@ -840,8 +781,7 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  	else
>  		r = mipi_dsi_dcs_set_tear_off(dsi);
>  
> -	if (!ddata->ext_te_gpio)
> -		src->ops->dsi.enable_te(src, enable);
> +	src->ops->dsi.enable_te(src, enable);
>  
>  	/* possible panel bug */
>  	msleep(100);
> @@ -934,14 +874,6 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  		return err;
>  	}
>  
> -	ddata->ext_te_gpio = devm_gpiod_get_optional(&dsi->dev, "te",
> -						     GPIOD_IN);
> -	if (IS_ERR(ddata->ext_te_gpio)) {
> -		err = PTR_ERR(ddata->ext_te_gpio);
> -		dev_err(&dsi->dev, "TE gpio request failed: %d", err);
> -		return err;
> -	}
> -
>  	err = of_get_display_timing(node, "panel-timing", &timing);
>  	if (!err) {
>  		videomode_from_timing(&timing, &ddata->vm);
> @@ -1024,25 +956,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  
>  	mutex_init(&ddata->lock);
>  
> -	atomic_set(&ddata->do_update, 0);
> -
> -	if (ddata->ext_te_gpio) {
> -		r = devm_request_irq(dev, gpiod_to_irq(ddata->ext_te_gpio),
> -				dsicm_te_isr,
> -				IRQF_TRIGGER_RISING,
> -				"taal vsync", ddata);
> -
> -		if (r) {
> -			dev_err(dev, "IRQ request failed\n");
> -			goto err_reg;
> -		}
> -
> -		INIT_DEFERRABLE_WORK(&ddata->te_timeout_work,
> -					dsicm_te_timeout_work_callback);
> -
> -		dev_dbg(dev, "Using GPIO TE\n");
> -	}
> -
>  	ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
>  	if (!ddata->workqueue) {
>  		r = -ENOMEM;
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 003d26cead5a..921e7a1e1014 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -14,7 +14,9 @@
>  #include <linux/device.h>
>  #include <linux/err.h>
>  #include <linux/interrupt.h>
> +#include <linux/irq.h>
>  #include <linux/delay.h>
> +#include <linux/gpio/consumer.h>

You could sort the headers while at it :-)

>  #include <linux/mutex.h>
>  #include <linux/module.h>
>  #include <linux/semaphore.h>
> @@ -368,6 +370,11 @@ struct dsi_data {
>  	unsigned int update_bytes;
>  #endif
>  
> +	/* external TE GPIO */
> +	struct gpio_desc *te_gpio;
> +	struct delayed_work te_timeout_work;
> +	atomic_t do_ext_te_update;
> +
>  	bool te_enabled;
>  	bool ulps_enabled;
>  
> @@ -3827,19 +3834,12 @@ static void dsi_framedone_irq_callback(void *data)
>  	dsi_handle_framedone(dsi, 0);
>  }
>  
> -static int dsi_update(struct omap_dss_device *dssdev, int channel,
> -		void (*callback)(int, void *), void *data)
> +static int _dsi_update(struct dsi_data *dsi)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	u16 dw, dh;
>  
>  	dsi_perf_mark_setup(dsi);
>  
> -	dsi->update_channel = channel;
> -
> -	dsi->framedone_callback = callback;
> -	dsi->framedone_data = data;
> -
>  	dw = dsi->vm.hactive;
>  	dh = dsi->vm.vactive;
>  
> @@ -3852,6 +3852,26 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>  	return 0;
>  }
>  
> +static int dsi_update(struct omap_dss_device *dssdev, int channel,
> +		void (*callback)(int, void *), void *data)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +
> +	dsi->update_channel = channel;
> +	dsi->framedone_callback = callback;
> +	dsi->framedone_data = data;
> +
> +	if (dsi->te_enabled && dsi->te_gpio) {
> +		schedule_delayed_work(&dsi->te_timeout_work,
> +				      msecs_to_jiffies(250));
> +		atomic_set(&dsi->do_ext_te_update, 1);
> +	} else {
> +		_dsi_update(dsi);
> +	}
> +
> +	return 0;
> +}
> +
>  /* Display funcs */
>  
>  static int dsi_configure_dispc_clocks(struct dsi_data *dsi)
> @@ -4095,6 +4115,14 @@ static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  
>  	dsi->te_enabled = enable;
> +
> +	if (dsi->te_gpio) {
> +		if (enable)
> +			enable_irq(gpiod_to_irq(dsi->te_gpio));
> +		else
> +			disable_irq(gpiod_to_irq(dsi->te_gpio));
> +	}
> +
>  	return 0;
>  }
>  
> @@ -4772,11 +4800,89 @@ static const struct omap_dss_device_ops dsi_ops = {
>  	},
>  };
>  
> +static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
> +{
> +	struct dsi_data *dsi = (struct dsi_data *)dev_id;
> +	int old;
> +
> +	old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
> +	if (old) {
> +		cancel_delayed_work(&dsi->te_timeout_work);
> +		_dsi_update(dsi);
> +	}
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static void omap_dsi_te_timeout_work_callback(struct work_struct *work)
> +{
> +	struct dsi_data *dsi = container_of(work, struct dsi_data,
> +					te_timeout_work.work);

Strange indentation.

> +	int old;
> +
> +	old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
> +	if (old) {
> +		dev_err(dsi->dev, "TE not received for 250ms!\n");
> +		_dsi_update(dsi);
> +	}
> +}
> +
> +static int omap_dsi_register_te_irq(struct dsi_data *dsi,
> +				    struct mipi_dsi_device *client)
> +{
> +	int err;
> +	int te_irq;
> +
> +	dsi->te_gpio = gpiod_get_from_of_node(client->dev.of_node,

Could we call gpiod_get(&client->dev, "te", ...) instead ?

> +					      "te-gpios", 0, GPIOD_IN,
> +					      "dsi-tearing-effect");
> +	if (IS_ERR(dsi->te_gpio)) {
> +		err = PTR_ERR(dsi->te_gpio);
> +
> +		if (err == -ENOENT) {
> +			dsi->te_gpio = NULL;
> +			return 0;
> +		}
> +
> +		dev_err(dsi->dev, "Could not get TE gpio: %d\n", err);
> +		return err;
> +	}
> +
> +	te_irq = gpiod_to_irq(dsi->te_gpio);

Could this fail ?

> +	irq_set_status_flags(te_irq, IRQ_NOAUTOEN);
> +
> +	err = request_threaded_irq(te_irq, omap_dsi_te_irq_handler, NULL,
> +				   IRQF_TRIGGER_RISING, "TE", dsi);

What's the reason to request a threaded IRQ instead of a regular IRQ if
the threaded handler is NULL ?

> +	if (err) {
> +		dev_err(dsi->dev, "request irq failed with %d\n", err);
> +		gpiod_put(dsi->te_gpio);
> +		return err;
> +	}
> +
> +	INIT_DEFERRABLE_WORK(&dsi->te_timeout_work,
> +			     omap_dsi_te_timeout_work_callback);
> +
> +	dev_dbg(dsi->dev, "Using GPIO TE\n");
> +
> +	return 0;
> +}
> +
> +static void omap_dsi_unregister_te_irq(struct dsi_data *dsi)
> +{
> +	if (dsi->te_gpio) {
> +		free_irq(gpiod_to_irq(dsi->te_gpio), dsi);

You could store the IRQ number in dsi_data to avoid recomputing it.

> +		cancel_delayed_work(&dsi->te_timeout_work);
> +		gpiod_put(dsi->te_gpio);
> +		dsi->te_gpio = NULL;
> +	}
> +}
> +
>  static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  				struct mipi_dsi_device *client)
>  {
>  	struct dsi_data *dsi = host_to_omap(host);
>  	unsigned int channel = client->channel;
> +	int r;
>  
>  	if (channel > 3)
>  		return -EINVAL;
> @@ -4791,13 +4897,20 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  		return -EINVAL;
>  	}
>  
> -	dsi->vc[channel].dest = client;
> +	atomic_set(&dsi->do_ext_te_update, 0);
>  
> -	dsi->pix_fmt = client->format;
> -	if (client->mode_flags & MIPI_DSI_MODE_VIDEO)
> +	if (client->mode_flags & MIPI_DSI_MODE_VIDEO) {
>  		dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
> -	else
> +	} else {
> +		r = omap_dsi_register_te_irq(dsi, client);
> +		if (r)
> +			return r;
> +
>  		dsi->mode = OMAP_DSS_DSI_CMD_MODE;
> +	}
> +
> +	dsi->vc[channel].dest = client;
> +	dsi->pix_fmt = client->format;
>  
>  	return 0;
>  }
> @@ -4814,6 +4927,7 @@ static int omap_dsi_host_detach(struct mipi_dsi_host *host,
>  	if (dsi->vc[channel].dest != client)
>  		return -EINVAL;
>  
> +	omap_dsi_unregister_te_irq(dsi);
>  	dsi->vc[channel].dest = NULL;
>  	return 0;
>  }

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-09  8:04                   ` Tomi Valkeinen
@ 2020-11-09  9:30                     ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-09  9:30 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren


> Am 09.11.2020 um 09:04 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 07/11/2020 14:19, H. Nikolaus Schaller wrote:
> 
>> I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
>> the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().
>> 
>> I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
>> And hopefully we are close to push the panel driver for review. And in a second step some device
>> tree for the Pyra.
>> 
>> The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel
> 
> Ok, good. Do you have a link the previous driver that works (omapdrm specific panel driver)? I think
> it's good to have that as a reference.

Yes, here:

https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/panels

BR and thanks,
Nikolaus


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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-09  9:30                     ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-09  9:30 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar


> Am 09.11.2020 um 09:04 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 07/11/2020 14:19, H. Nikolaus Schaller wrote:
> 
>> I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
>> the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().
>> 
>> I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
>> And hopefully we are close to push the panel driver for review. And in a second step some device
>> tree for the Pyra.
>> 
>> The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel
> 
> Ok, good. Do you have a link the previous driver that works (omapdrm specific panel driver)? I think
> it's good to have that as a reference.

Yes, here:

https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/panels

BR and thanks,
Nikolaus

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 26/56] drm/omap: dsi: drop custom enable_te() API
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09  9:32     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  9:32 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:03PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Instead of using the custon enable_te() API, this automatically

s/custon/custom/

> enables/disables TE core support when a matching packet is send

s/send/sent/

> to the panel.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  3 --
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 34 ++++++++++++++-----
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  2 --
>  3 files changed, 25 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 43f63b5a120b..dc2c045cc6b0 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -772,7 +772,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
> -	struct omap_dss_device *src = ddata->src;
>  	struct mipi_dsi_device *dsi = ddata->dsi;
>  	int r;
>  
> @@ -781,8 +780,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  	else
>  		r = mipi_dsi_dcs_set_tear_off(dsi);
>  
> -	src->ops->dsi.enable_te(src, enable);
> -
>  	/* possible panel bug */
>  	msleep(100);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 921e7a1e1014..41431ca34568 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4110,10 +4110,8 @@ static void dsi_display_disable(struct omap_dss_device *dssdev,
>  	mutex_unlock(&dsi->lock);
>  }
>  
> -static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
> +static int dsi_enable_te(struct dsi_data *dsi, bool enable)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
>  	dsi->te_enabled = enable;
>  
>  	if (dsi->te_gpio) {
> @@ -4723,6 +4721,7 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  {
>  	struct dsi_data *dsi = host_to_omap(host);
>  	struct omap_dss_device *dssdev = &dsi->output;
> +	int r;
>  
>  	if (!!(msg->flags & MIPI_DSI_MSG_USE_LPM) != dsi->in_lp_mode) {
>  		dsi_vc_enable_hs(dssdev, msg->channel,
> @@ -4739,16 +4738,35 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  	case MIPI_DSI_DCS_LONG_WRITE:
>  	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
>  	case MIPI_DSI_NULL_PACKET:
> -		return dsi_vc_write_common(dssdev, msg);
> +		r = dsi_vc_write_common(dssdev, msg);
> +		break;
>  	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
>  	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
>  	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
> -		return dsi_vc_generic_read(dssdev, msg);
> +		r = dsi_vc_generic_read(dssdev, msg);
> +		break;
>  	case MIPI_DSI_DCS_READ:
> -		return dsi_vc_dcs_read(dssdev, msg);
> +		r = dsi_vc_dcs_read(dssdev, msg);
> +		break;
> +	default:
> +		r = -EINVAL;
> +		break;
>  	}
>  
> -	return -EINVAL;
> +	if (r < 0)
> +		return r;
> +
> +	if (msg->type == MIPI_DSI_DCS_SHORT_WRITE ||
> +	    msg->type == MIPI_DSI_DCS_SHORT_WRITE_PARAM) {
> +		u8 cmd = ((u8 *)msg->tx_buf)[0];
> +
> +		if (cmd == MIPI_DCS_SET_TEAR_OFF)
> +			dsi_enable_te(dsi, false);
> +		else if (cmd == MIPI_DCS_SET_TEAR_ON)
> +			dsi_enable_te(dsi, true);
> +	}
> +
> +	return 0;
>  }
>  
>  static int dsi_get_clocks(struct dsi_data *dsi)
> @@ -4795,8 +4813,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.disable_video_output = dsi_disable_video_output,
>  
>  		.update = dsi_update,
> -
> -		.enable_te = dsi_enable_te,
>  	},
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 2d44a8e32fcc..1520a5f752b7 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -288,8 +288,6 @@ struct omapdss_dsi_ops {
>  	int (*set_config)(struct omap_dss_device *dssdev,
>  			const struct omap_dss_dsi_config *cfg);
>  
> -	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
> -
>  	int (*update)(struct omap_dss_device *dssdev, int channel,
>  			void (*callback)(int, void *), void *data);
>  

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 26/56] drm/omap: dsi: drop custom enable_te() API
@ 2020-11-09  9:32     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  9:32 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:03PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Instead of using the custon enable_te() API, this automatically

s/custon/custom/

> enables/disables TE core support when a matching packet is send

s/send/sent/

> to the panel.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  3 --
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 34 ++++++++++++++-----
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  2 --
>  3 files changed, 25 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 43f63b5a120b..dc2c045cc6b0 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -772,7 +772,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
> -	struct omap_dss_device *src = ddata->src;
>  	struct mipi_dsi_device *dsi = ddata->dsi;
>  	int r;
>  
> @@ -781,8 +780,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  	else
>  		r = mipi_dsi_dcs_set_tear_off(dsi);
>  
> -	src->ops->dsi.enable_te(src, enable);
> -
>  	/* possible panel bug */
>  	msleep(100);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 921e7a1e1014..41431ca34568 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4110,10 +4110,8 @@ static void dsi_display_disable(struct omap_dss_device *dssdev,
>  	mutex_unlock(&dsi->lock);
>  }
>  
> -static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
> +static int dsi_enable_te(struct dsi_data *dsi, bool enable)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
>  	dsi->te_enabled = enable;
>  
>  	if (dsi->te_gpio) {
> @@ -4723,6 +4721,7 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  {
>  	struct dsi_data *dsi = host_to_omap(host);
>  	struct omap_dss_device *dssdev = &dsi->output;
> +	int r;
>  
>  	if (!!(msg->flags & MIPI_DSI_MSG_USE_LPM) != dsi->in_lp_mode) {
>  		dsi_vc_enable_hs(dssdev, msg->channel,
> @@ -4739,16 +4738,35 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  	case MIPI_DSI_DCS_LONG_WRITE:
>  	case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
>  	case MIPI_DSI_NULL_PACKET:
> -		return dsi_vc_write_common(dssdev, msg);
> +		r = dsi_vc_write_common(dssdev, msg);
> +		break;
>  	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
>  	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
>  	case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
> -		return dsi_vc_generic_read(dssdev, msg);
> +		r = dsi_vc_generic_read(dssdev, msg);
> +		break;
>  	case MIPI_DSI_DCS_READ:
> -		return dsi_vc_dcs_read(dssdev, msg);
> +		r = dsi_vc_dcs_read(dssdev, msg);
> +		break;
> +	default:
> +		r = -EINVAL;
> +		break;
>  	}
>  
> -	return -EINVAL;
> +	if (r < 0)
> +		return r;
> +
> +	if (msg->type == MIPI_DSI_DCS_SHORT_WRITE ||
> +	    msg->type == MIPI_DSI_DCS_SHORT_WRITE_PARAM) {
> +		u8 cmd = ((u8 *)msg->tx_buf)[0];
> +
> +		if (cmd == MIPI_DCS_SET_TEAR_OFF)
> +			dsi_enable_te(dsi, false);
> +		else if (cmd == MIPI_DCS_SET_TEAR_ON)
> +			dsi_enable_te(dsi, true);
> +	}
> +
> +	return 0;
>  }
>  
>  static int dsi_get_clocks(struct dsi_data *dsi)
> @@ -4795,8 +4813,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.disable_video_output = dsi_disable_video_output,
>  
>  		.update = dsi_update,
> -
> -		.enable_te = dsi_enable_te,
>  	},
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 2d44a8e32fcc..1520a5f752b7 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -288,8 +288,6 @@ struct omapdss_dsi_ops {
>  	int (*set_config)(struct omap_dss_device *dssdev,
>  			const struct omap_dss_dsi_config *cfg);
>  
> -	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
> -
>  	int (*update)(struct omap_dss_device *dssdev, int channel,
>  			void (*callback)(int, void *), void *data);
>  

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 22/56] drm/omap: dsi: use pixel-format and mode from attach
  2020-11-09  8:49     ` Laurent Pinchart
@ 2020-11-09  9:45       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09  9:45 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 09/11/2020 10:49, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:02:59PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> In order to reduce the amount of custom functionality, this moves
>> handling of pixel format and DSI mode from set_config() to dsi
>> attach.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 --
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 31 ++++++++++++-------
>>  2 files changed, 19 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index a9609eed6bfa..2e9de33fc8d4 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -550,8 +550,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>>  	u8 id1, id2, id3;
>>  	int r;
>>  	struct omap_dss_dsi_config dsi_config = {
>> -		.mode = OMAP_DSS_DSI_CMD_MODE,
>> -		.pixel_format = MIPI_DSI_FMT_RGB888,
>>  		.vm = &ddata->vm,
>>  		.hs_clk_min = 150000000,
>>  		.hs_clk_max = 300000000,
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index a16427f3bc23..e341aca92462 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -4579,24 +4579,19 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
>>  {
>>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>>  	struct dsi_clk_calc_ctx ctx;
>> +	struct omap_dss_dsi_config cfg = *config;
>>  	bool ok;
>>  	int r;
>>  
>>  	mutex_lock(&dsi->lock);
>>  
>> -	dsi->pix_fmt = config->pixel_format;
>> -	dsi->mode = config->mode;
>> +	cfg.mode = dsi->mode;
>> +	cfg.pixel_format = dsi->pix_fmt;
>>  
>> -	if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) {
>> -		DSSERR("invalid pixel format\n");
>> -		r = -EINVAL;
>> -		goto err;
>> -	}
>> -
>> -	if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
>> -		ok = dsi_vm_calc(dsi, config, &ctx);
>> +	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
>> +		ok = dsi_vm_calc(dsi, &cfg, &ctx);
>>  	else
>> -		ok = dsi_cm_calc(dsi, config, &ctx);
>> +		ok = dsi_cm_calc(dsi, &cfg, &ctx);
>>  
>>  	if (!ok) {
>>  		DSSERR("failed to find suitable DSI clock settings\n");
>> @@ -4607,7 +4602,7 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
>>  	dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
>>  
>>  	r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
>> -		config->lp_clk_min, config->lp_clk_max, &dsi->user_lp_cinfo);
>> +		cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
>>  	if (r) {
>>  		DSSERR("failed to find suitable DSI LP clock settings\n");
>>  		goto err;
>> @@ -4785,7 +4780,19 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>>  		return -EBUSY;
>>  	}
>>  
>> +	if (mipi_dsi_pixel_format_to_bpp(client->format) < 0) {
>> +		DSSERR("invalid pixel format\n");
>> +		return -EINVAL;
>> +	}
>> +
>>  	dsi->vc[channel].dest = client;
>> +
>> +	dsi->pix_fmt = client->format;
> 
> Does this mean that all clients must use the same pixel format ? Do we
> even support multiple clients ? If no the VC allocation could be
> simplified.

The driver does not (and has not) support multiple DSI peripherals, even if the plumbing has been
there. Yes, the VC handling can be made simpler. I would prefer to do that after this series.

As I see it, the main point of this series is to move to DRM model while keeping the current
mainline drivers working (dsi and panel-dsi-cm). That will enable many cleanups also outside the dsi
driver. The series adds some shortcuts in places where they don't affect the supported setup.

When we get to the end, we'll be using DRM bridge and panel model, and re-writing the VC handling
(and some other parts) should fall into place much more neatly than doing them either before the
series (on top of omapdrm's custom APIs) or inside the series.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 22/56] drm/omap: dsi: use pixel-format and mode from attach
@ 2020-11-09  9:45       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09  9:45 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 09/11/2020 10:49, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:02:59PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> In order to reduce the amount of custom functionality, this moves
>> handling of pixel format and DSI mode from set_config() to dsi
>> attach.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 --
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 31 ++++++++++++-------
>>  2 files changed, 19 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index a9609eed6bfa..2e9de33fc8d4 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -550,8 +550,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>>  	u8 id1, id2, id3;
>>  	int r;
>>  	struct omap_dss_dsi_config dsi_config = {
>> -		.mode = OMAP_DSS_DSI_CMD_MODE,
>> -		.pixel_format = MIPI_DSI_FMT_RGB888,
>>  		.vm = &ddata->vm,
>>  		.hs_clk_min = 150000000,
>>  		.hs_clk_max = 300000000,
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index a16427f3bc23..e341aca92462 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -4579,24 +4579,19 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
>>  {
>>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>>  	struct dsi_clk_calc_ctx ctx;
>> +	struct omap_dss_dsi_config cfg = *config;
>>  	bool ok;
>>  	int r;
>>  
>>  	mutex_lock(&dsi->lock);
>>  
>> -	dsi->pix_fmt = config->pixel_format;
>> -	dsi->mode = config->mode;
>> +	cfg.mode = dsi->mode;
>> +	cfg.pixel_format = dsi->pix_fmt;
>>  
>> -	if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) {
>> -		DSSERR("invalid pixel format\n");
>> -		r = -EINVAL;
>> -		goto err;
>> -	}
>> -
>> -	if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
>> -		ok = dsi_vm_calc(dsi, config, &ctx);
>> +	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
>> +		ok = dsi_vm_calc(dsi, &cfg, &ctx);
>>  	else
>> -		ok = dsi_cm_calc(dsi, config, &ctx);
>> +		ok = dsi_cm_calc(dsi, &cfg, &ctx);
>>  
>>  	if (!ok) {
>>  		DSSERR("failed to find suitable DSI clock settings\n");
>> @@ -4607,7 +4602,7 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
>>  	dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
>>  
>>  	r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
>> -		config->lp_clk_min, config->lp_clk_max, &dsi->user_lp_cinfo);
>> +		cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
>>  	if (r) {
>>  		DSSERR("failed to find suitable DSI LP clock settings\n");
>>  		goto err;
>> @@ -4785,7 +4780,19 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>>  		return -EBUSY;
>>  	}
>>  
>> +	if (mipi_dsi_pixel_format_to_bpp(client->format) < 0) {
>> +		DSSERR("invalid pixel format\n");
>> +		return -EINVAL;
>> +	}
>> +
>>  	dsi->vc[channel].dest = client;
>> +
>> +	dsi->pix_fmt = client->format;
> 
> Does this mean that all clients must use the same pixel format ? Do we
> even support multiple clients ? If no the VC allocation could be
> simplified.

The driver does not (and has not) support multiple DSI peripherals, even if the plumbing has been
there. Yes, the VC handling can be made simpler. I would prefer to do that after this series.

As I see it, the main point of this series is to move to DRM model while keeping the current
mainline drivers working (dsi and panel-dsi-cm). That will enable many cleanups also outside the dsi
driver. The series adds some shortcuts in places where they don't affect the supported setup.

When we get to the end, we'll be using DRM bridge and panel model, and re-writing the VC handling
(and some other parts) should fall into place much more neatly than doing them either before the
series (on top of omapdrm's custom APIs) or inside the series.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 19/56] drm/omap: dsi: drop unused get_te()
  2020-11-09  8:45     ` Laurent Pinchart
@ 2020-11-09  9:49       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09  9:49 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 09/11/2020 10:45, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:02:56PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> The get_te() callback is not used, so we can drop the
>> custom API.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> 
> You could squash this with the previous and next patches.

I'd rather keep them separate. They are independent changes, and managing conflicts is easier when
the patches do only a single thing.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 19/56] drm/omap: dsi: drop unused get_te()
@ 2020-11-09  9:49       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09  9:49 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 09/11/2020 10:45, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:02:56PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> The get_te() callback is not used, so we can drop the
>> custom API.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> 
> You could squash this with the previous and next patches.

I'd rather keep them separate. They are independent changes, and managing conflicts is easier when
the patches do only a single thing.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09  9:52     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  9:52 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:04PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This moves the bus locking into the host driver and unexports
> the custom API in preparation for drm_panel support.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 46 +------------------
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 33 ++++++++-----
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  3 --
>  3 files changed, 23 insertions(+), 59 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index dc2c045cc6b0..4be0c9dbcc43 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -298,7 +298,6 @@ static int dsicm_wake_up(struct panel_drv_data *ddata)
>  static int dsicm_bl_update_status(struct backlight_device *dev)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
> -	struct omap_dss_device *src = ddata->src;
>  	int r = 0;
>  	int level;
>  
> @@ -313,15 +312,11 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
>  	mutex_lock(&ddata->lock);
>  
>  	if (ddata->enabled) {
> -		src->ops->dsi.bus_lock(src);
> -
>  		r = dsicm_wake_up(ddata);
>  		if (!r) {
>  			r = dsicm_dcs_write_1(ddata,
>  				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
>  		}
> -
> -		src->ops->dsi.bus_unlock(src);
>  	}
>  
>  	mutex_unlock(&ddata->lock);
> @@ -347,21 +342,16 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	struct omap_dss_device *src = ddata->src;
>  	u8 errors = 0;
>  	int r;
>  
>  	mutex_lock(&ddata->lock);
>  
>  	if (ddata->enabled) {
> -		src->ops->dsi.bus_lock(src);
> -
>  		r = dsicm_wake_up(ddata);
>  		if (!r)
>  			r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
>  					&errors);
> -
> -		src->ops->dsi.bus_unlock(src);
>  	} else {
>  		r = -ENODEV;
>  	}
> @@ -378,20 +368,15 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	struct omap_dss_device *src = ddata->src;
>  	u8 id1, id2, id3;
>  	int r;
>  
>  	mutex_lock(&ddata->lock);
>  
>  	if (ddata->enabled) {
> -		src->ops->dsi.bus_lock(src);
> -
>  		r = dsicm_wake_up(ddata);
>  		if (!r)
>  			r = dsicm_get_id(ddata, &id1, &id2, &id3);
> -
> -		src->ops->dsi.bus_unlock(src);
>  	} else {
>  		r = -ENODEV;
>  	}
> @@ -409,7 +394,6 @@ static ssize_t dsicm_store_ulps(struct device *dev,
>  		const char *buf, size_t count)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	struct omap_dss_device *src = ddata->src;
>  	unsigned long t;
>  	int r;
>  
> @@ -420,14 +404,10 @@ static ssize_t dsicm_store_ulps(struct device *dev,
>  	mutex_lock(&ddata->lock);
>  
>  	if (ddata->enabled) {
> -		src->ops->dsi.bus_lock(src);
> -
>  		if (t)
>  			r = dsicm_enter_ulps(ddata);
>  		else
>  			r = dsicm_wake_up(ddata);
> -
> -		src->ops->dsi.bus_unlock(src);
>  	}
>  
>  	mutex_unlock(&ddata->lock);
> @@ -457,7 +437,6 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
>  		const char *buf, size_t count)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	struct omap_dss_device *src = ddata->src;
>  	unsigned long t;
>  	int r;
>  
> @@ -470,9 +449,7 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
>  
>  	if (ddata->enabled) {
>  		/* dsicm_wake_up will restart the timer */
> -		src->ops->dsi.bus_lock(src);
>  		r = dsicm_wake_up(ddata);
> -		src->ops->dsi.bus_unlock(src);
>  	}
>  
>  	mutex_unlock(&ddata->lock);
> @@ -673,17 +650,11 @@ static void dsicm_disconnect(struct omap_dss_device *src,
>  static void dsicm_enable(struct omap_dss_device *dssdev)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
>  	int r;
>  
>  	mutex_lock(&ddata->lock);
>  
> -	src->ops->dsi.bus_lock(src);
> -
>  	r = dsicm_power_on(ddata);
> -
> -	src->ops->dsi.bus_unlock(src);
> -
>  	if (r)
>  		goto err;
>  
> @@ -700,7 +671,6 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>  static void dsicm_disable(struct omap_dss_device *dssdev)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
>  	int r;
>  
>  	dsicm_bl_power(ddata, false);
> @@ -709,24 +679,19 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
>  
>  	dsicm_cancel_ulps_work(ddata);
>  
> -	src->ops->dsi.bus_lock(src);
> -
>  	r = dsicm_wake_up(ddata);
>  	if (!r)
>  		dsicm_power_off(ddata);
>  
> -	src->ops->dsi.bus_unlock(src);
> -
>  	mutex_unlock(&ddata->lock);
>  }
>  
>  static void dsicm_framedone_cb(int err, void *data)
>  {
>  	struct panel_drv_data *ddata = data;
> -	struct omap_dss_device *src = ddata->src;
>  
>  	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
> -	src->ops->dsi.bus_unlock(src);
> +	mutex_unlock(&ddata->lock);
>  }
>  
>  static int dsicm_update(struct omap_dss_device *dssdev,
> @@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>  
>  	mutex_lock(&ddata->lock);
> -	src->ops->dsi.bus_lock(src);
>  
>  	r = dsicm_wake_up(ddata);
>  	if (r)
> @@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  	if (r)
>  		goto err;
>  
> -	/* note: no bus_unlock here. unlock is src framedone_cb */
> -	mutex_unlock(&ddata->lock);
> +	/* note: no unlock here. unlock is src framedone_cb */

This change isn't described in the commit message. Could you explain why
it's needed ? Locking a mutex in a function and unlocking it elsewhere
always scares me.

>  	return 0;
>  err:
> -	src->ops->dsi.bus_unlock(src);
>  	mutex_unlock(&ddata->lock);
>  	return r;
>  }
> @@ -791,7 +753,6 @@ static void dsicm_ulps_work(struct work_struct *work)
>  	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
>  			ulps_work.work);
>  	struct omap_dss_device *dssdev = &ddata->dssdev;
> -	struct omap_dss_device *src = ddata->src;
>  
>  	mutex_lock(&ddata->lock);
>  
> @@ -800,11 +761,8 @@ static void dsicm_ulps_work(struct work_struct *work)
>  		return;
>  	}
>  
> -	src->ops->dsi.bus_lock(src);
> -
>  	dsicm_enter_ulps(ddata);
>  
> -	src->ops->dsi.bus_unlock(src);
>  	mutex_unlock(&ddata->lock);
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 41431ca34568..d54b743c2b48 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -476,17 +476,13 @@ static inline u32 dsi_read_reg(struct dsi_data *dsi, const struct dsi_reg idx)
>  	return __raw_readl(base + idx.idx);
>  }
>  
> -static void dsi_bus_lock(struct omap_dss_device *dssdev)
> +static void dsi_bus_lock(struct dsi_data *dsi)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
>  	down(&dsi->bus_lock);

Nothing to be addressed in this patch, but is there a reason to use a
semaphore instead of a mutex ?

>  }
>  
> -static void dsi_bus_unlock(struct omap_dss_device *dssdev)
> +static void dsi_bus_unlock(struct dsi_data *dsi)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
>  	up(&dsi->bus_lock);
>  }
>  
> @@ -3798,6 +3794,8 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
>  		REG_FLD_MOD(dsi, DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */
>  	}
>  
> +	dsi_bus_unlock(dsi);
> +
>  	dsi->framedone_callback(error, dsi->framedone_data);
>  
>  	if (!error)
> @@ -3857,6 +3855,8 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  
> +	dsi_bus_lock(dsi);
> +
>  	dsi->update_channel = channel;
>  	dsi->framedone_callback = callback;
>  	dsi->framedone_data = data;
> @@ -4716,10 +4716,9 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)
>  	}
>  }
>  
> -static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
> -				      const struct mipi_dsi_msg *msg)
> +static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
> +				       const struct mipi_dsi_msg *msg)
>  {
> -	struct dsi_data *dsi = host_to_omap(host);
>  	struct omap_dss_device *dssdev = &dsi->output;
>  	int r;
>  
> @@ -4769,6 +4768,19 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  	return 0;
>  }
>  
> +static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
> +				      const struct mipi_dsi_msg *msg)
> +{
> +	struct dsi_data *dsi = host_to_omap(host);
> +	int r;
> +
> +	dsi_bus_lock(dsi);
> +	r = _omap_dsi_host_transfer(dsi, msg);
> +	dsi_bus_unlock(dsi);
> +
> +	return r;
> +}
> +
>  static int dsi_get_clocks(struct dsi_data *dsi)
>  {
>  	struct clk *clk;
> @@ -4802,9 +4814,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  	.enable = dsi_display_enable,
>  
>  	.dsi = {
> -		.bus_lock = dsi_bus_lock,
> -		.bus_unlock = dsi_bus_unlock,
> -
>  		.disable = dsi_display_disable,
>  
>  		.set_config = dsi_set_config,
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 1520a5f752b7..43eba2ea1f96 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -291,9 +291,6 @@ struct omapdss_dsi_ops {
>  	int (*update)(struct omap_dss_device *dssdev, int channel,
>  			void (*callback)(int, void *), void *data);
>  
> -	void (*bus_lock)(struct omap_dss_device *dssdev);
> -	void (*bus_unlock)(struct omap_dss_device *dssdev);
> -
>  	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
>  	void (*disable_video_output)(struct omap_dss_device *dssdev,
>  			int channel);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver
@ 2020-11-09  9:52     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  9:52 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:04PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This moves the bus locking into the host driver and unexports
> the custom API in preparation for drm_panel support.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 46 +------------------
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 33 ++++++++-----
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  3 --
>  3 files changed, 23 insertions(+), 59 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index dc2c045cc6b0..4be0c9dbcc43 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -298,7 +298,6 @@ static int dsicm_wake_up(struct panel_drv_data *ddata)
>  static int dsicm_bl_update_status(struct backlight_device *dev)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
> -	struct omap_dss_device *src = ddata->src;
>  	int r = 0;
>  	int level;
>  
> @@ -313,15 +312,11 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
>  	mutex_lock(&ddata->lock);
>  
>  	if (ddata->enabled) {
> -		src->ops->dsi.bus_lock(src);
> -
>  		r = dsicm_wake_up(ddata);
>  		if (!r) {
>  			r = dsicm_dcs_write_1(ddata,
>  				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
>  		}
> -
> -		src->ops->dsi.bus_unlock(src);
>  	}
>  
>  	mutex_unlock(&ddata->lock);
> @@ -347,21 +342,16 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	struct omap_dss_device *src = ddata->src;
>  	u8 errors = 0;
>  	int r;
>  
>  	mutex_lock(&ddata->lock);
>  
>  	if (ddata->enabled) {
> -		src->ops->dsi.bus_lock(src);
> -
>  		r = dsicm_wake_up(ddata);
>  		if (!r)
>  			r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
>  					&errors);
> -
> -		src->ops->dsi.bus_unlock(src);
>  	} else {
>  		r = -ENODEV;
>  	}
> @@ -378,20 +368,15 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	struct omap_dss_device *src = ddata->src;
>  	u8 id1, id2, id3;
>  	int r;
>  
>  	mutex_lock(&ddata->lock);
>  
>  	if (ddata->enabled) {
> -		src->ops->dsi.bus_lock(src);
> -
>  		r = dsicm_wake_up(ddata);
>  		if (!r)
>  			r = dsicm_get_id(ddata, &id1, &id2, &id3);
> -
> -		src->ops->dsi.bus_unlock(src);
>  	} else {
>  		r = -ENODEV;
>  	}
> @@ -409,7 +394,6 @@ static ssize_t dsicm_store_ulps(struct device *dev,
>  		const char *buf, size_t count)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	struct omap_dss_device *src = ddata->src;
>  	unsigned long t;
>  	int r;
>  
> @@ -420,14 +404,10 @@ static ssize_t dsicm_store_ulps(struct device *dev,
>  	mutex_lock(&ddata->lock);
>  
>  	if (ddata->enabled) {
> -		src->ops->dsi.bus_lock(src);
> -
>  		if (t)
>  			r = dsicm_enter_ulps(ddata);
>  		else
>  			r = dsicm_wake_up(ddata);
> -
> -		src->ops->dsi.bus_unlock(src);
>  	}
>  
>  	mutex_unlock(&ddata->lock);
> @@ -457,7 +437,6 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
>  		const char *buf, size_t count)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	struct omap_dss_device *src = ddata->src;
>  	unsigned long t;
>  	int r;
>  
> @@ -470,9 +449,7 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
>  
>  	if (ddata->enabled) {
>  		/* dsicm_wake_up will restart the timer */
> -		src->ops->dsi.bus_lock(src);
>  		r = dsicm_wake_up(ddata);
> -		src->ops->dsi.bus_unlock(src);
>  	}
>  
>  	mutex_unlock(&ddata->lock);
> @@ -673,17 +650,11 @@ static void dsicm_disconnect(struct omap_dss_device *src,
>  static void dsicm_enable(struct omap_dss_device *dssdev)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
>  	int r;
>  
>  	mutex_lock(&ddata->lock);
>  
> -	src->ops->dsi.bus_lock(src);
> -
>  	r = dsicm_power_on(ddata);
> -
> -	src->ops->dsi.bus_unlock(src);
> -
>  	if (r)
>  		goto err;
>  
> @@ -700,7 +671,6 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>  static void dsicm_disable(struct omap_dss_device *dssdev)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
>  	int r;
>  
>  	dsicm_bl_power(ddata, false);
> @@ -709,24 +679,19 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
>  
>  	dsicm_cancel_ulps_work(ddata);
>  
> -	src->ops->dsi.bus_lock(src);
> -
>  	r = dsicm_wake_up(ddata);
>  	if (!r)
>  		dsicm_power_off(ddata);
>  
> -	src->ops->dsi.bus_unlock(src);
> -
>  	mutex_unlock(&ddata->lock);
>  }
>  
>  static void dsicm_framedone_cb(int err, void *data)
>  {
>  	struct panel_drv_data *ddata = data;
> -	struct omap_dss_device *src = ddata->src;
>  
>  	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
> -	src->ops->dsi.bus_unlock(src);
> +	mutex_unlock(&ddata->lock);
>  }
>  
>  static int dsicm_update(struct omap_dss_device *dssdev,
> @@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>  
>  	mutex_lock(&ddata->lock);
> -	src->ops->dsi.bus_lock(src);
>  
>  	r = dsicm_wake_up(ddata);
>  	if (r)
> @@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  	if (r)
>  		goto err;
>  
> -	/* note: no bus_unlock here. unlock is src framedone_cb */
> -	mutex_unlock(&ddata->lock);
> +	/* note: no unlock here. unlock is src framedone_cb */

This change isn't described in the commit message. Could you explain why
it's needed ? Locking a mutex in a function and unlocking it elsewhere
always scares me.

>  	return 0;
>  err:
> -	src->ops->dsi.bus_unlock(src);
>  	mutex_unlock(&ddata->lock);
>  	return r;
>  }
> @@ -791,7 +753,6 @@ static void dsicm_ulps_work(struct work_struct *work)
>  	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
>  			ulps_work.work);
>  	struct omap_dss_device *dssdev = &ddata->dssdev;
> -	struct omap_dss_device *src = ddata->src;
>  
>  	mutex_lock(&ddata->lock);
>  
> @@ -800,11 +761,8 @@ static void dsicm_ulps_work(struct work_struct *work)
>  		return;
>  	}
>  
> -	src->ops->dsi.bus_lock(src);
> -
>  	dsicm_enter_ulps(ddata);
>  
> -	src->ops->dsi.bus_unlock(src);
>  	mutex_unlock(&ddata->lock);
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 41431ca34568..d54b743c2b48 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -476,17 +476,13 @@ static inline u32 dsi_read_reg(struct dsi_data *dsi, const struct dsi_reg idx)
>  	return __raw_readl(base + idx.idx);
>  }
>  
> -static void dsi_bus_lock(struct omap_dss_device *dssdev)
> +static void dsi_bus_lock(struct dsi_data *dsi)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
>  	down(&dsi->bus_lock);

Nothing to be addressed in this patch, but is there a reason to use a
semaphore instead of a mutex ?

>  }
>  
> -static void dsi_bus_unlock(struct omap_dss_device *dssdev)
> +static void dsi_bus_unlock(struct dsi_data *dsi)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
>  	up(&dsi->bus_lock);
>  }
>  
> @@ -3798,6 +3794,8 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
>  		REG_FLD_MOD(dsi, DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */
>  	}
>  
> +	dsi_bus_unlock(dsi);
> +
>  	dsi->framedone_callback(error, dsi->framedone_data);
>  
>  	if (!error)
> @@ -3857,6 +3855,8 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  
> +	dsi_bus_lock(dsi);
> +
>  	dsi->update_channel = channel;
>  	dsi->framedone_callback = callback;
>  	dsi->framedone_data = data;
> @@ -4716,10 +4716,9 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)
>  	}
>  }
>  
> -static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
> -				      const struct mipi_dsi_msg *msg)
> +static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
> +				       const struct mipi_dsi_msg *msg)
>  {
> -	struct dsi_data *dsi = host_to_omap(host);
>  	struct omap_dss_device *dssdev = &dsi->output;
>  	int r;
>  
> @@ -4769,6 +4768,19 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  	return 0;
>  }
>  
> +static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
> +				      const struct mipi_dsi_msg *msg)
> +{
> +	struct dsi_data *dsi = host_to_omap(host);
> +	int r;
> +
> +	dsi_bus_lock(dsi);
> +	r = _omap_dsi_host_transfer(dsi, msg);
> +	dsi_bus_unlock(dsi);
> +
> +	return r;
> +}
> +
>  static int dsi_get_clocks(struct dsi_data *dsi)
>  {
>  	struct clk *clk;
> @@ -4802,9 +4814,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  	.enable = dsi_display_enable,
>  
>  	.dsi = {
> -		.bus_lock = dsi_bus_lock,
> -		.bus_unlock = dsi_bus_unlock,
> -
>  		.disable = dsi_display_disable,
>  
>  		.set_config = dsi_set_config,
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 1520a5f752b7..43eba2ea1f96 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -291,9 +291,6 @@ struct omapdss_dsi_ops {
>  	int (*update)(struct omap_dss_device *dssdev, int channel,
>  			void (*callback)(int, void *), void *data);
>  
> -	void (*bus_lock)(struct omap_dss_device *dssdev);
> -	void (*bus_unlock)(struct omap_dss_device *dssdev);
> -
>  	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
>  	void (*disable_video_output)(struct omap_dss_device *dssdev,
>  			int channel);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 28/56] drm/omap: dsi: untangle ulps ops from enable/disable
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09  9:57     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  9:57 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:05PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Create a custom function pointer for ULPS and use it instead of
> reusing disable/enable functions for ULPS mode switch. This allows
> us to use the common disable/enable functions pointers for DSI.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  8 ++--
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 42 ++++++++++++++-----
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  5 +--
>  3 files changed, 38 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 4be0c9dbcc43..78247dcb1848 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -233,7 +233,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>  	if (r)
>  		goto err;
>  
> -	src->ops->dsi.disable(src, false, true);
> +	src->ops->dsi.ulps(src, true);
>  
>  	ddata->ulps_enabled = true;
>  
> @@ -258,7 +258,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  	if (!ddata->ulps_enabled)
>  		return 0;
>  
> -	src->ops->enable(src);
> +	src->ops->dsi.ulps(src, false);
>  	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>  
>  	r = _dsicm_enable_te(ddata, ddata->te_enabled);
> @@ -586,7 +586,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	dsicm_hw_reset(ddata);
>  
> -	src->ops->dsi.disable(src, true, false);
> +	src->ops->disable(src);
>  err_regulators:
>  	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>  	if (r)
> @@ -612,7 +612,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  		dsicm_hw_reset(ddata);
>  	}
>  
> -	src->ops->dsi.disable(src, true, false);
> +	src->ops->disable(src);
>  
>  	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>  	if (r)
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index d54b743c2b48..937362ade4b4 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4055,13 +4055,10 @@ static void dsi_display_uninit_dsi(struct dsi_data *dsi, bool disconnect_lanes,
>  	}
>  }
>  
> -static void dsi_display_enable(struct omap_dss_device *dssdev)
> +static void dsi_display_ulps_enable(struct dsi_data *dsi)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	int r;
>  
> -	DSSDBG("dsi_display_enable\n");
> -
>  	WARN_ON(!dsi_bus_is_locked(dsi));
>  
>  	mutex_lock(&dsi->lock);
> @@ -4084,16 +4081,19 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
>  	dsi_runtime_put(dsi);
>  err_get_dsi:
>  	mutex_unlock(&dsi->lock);
> -	DSSDBG("dsi_display_enable FAILED\n");
> +	DSSDBG("dsi_display_ulps_enable FAILED\n");
>  }
>  
> -static void dsi_display_disable(struct omap_dss_device *dssdev,
> -		bool disconnect_lanes, bool enter_ulps)
> +static void dsi_display_enable(struct omap_dss_device *dssdev)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	DSSDBG("dsi_display_enable\n");
> +	dsi_display_ulps_enable(dsi);
> +}
>  
> -	DSSDBG("dsi_display_disable\n");
> -
> +static void dsi_display_ulps_disable(struct dsi_data *dsi,
> +		bool disconnect_lanes, bool enter_ulps)
> +{
>  	WARN_ON(!dsi_bus_is_locked(dsi));
>  
>  	mutex_lock(&dsi->lock);
> @@ -4110,6 +4110,27 @@ static void dsi_display_disable(struct omap_dss_device *dssdev,
>  	mutex_unlock(&dsi->lock);
>  }
>  
> +static void dsi_display_disable(struct omap_dss_device *dssdev)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +
> +	DSSDBG("dsi_display_disable\n");
> +
> +	dsi_display_ulps_disable(dsi, true, false);
> +}
> +
> +static void dsi_ulps(struct omap_dss_device *dssdev, bool enable)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +
> +	DSSDBG("dsi_ulps\n");
> +
> +	if (enable)
> +		dsi_display_ulps_disable(dsi, false, true);
> +	else
> +		dsi_display_ulps_enable(dsi);

The names are fairly confusing. I would expect
dsi_display_ulps_disable() to disable ULPS mode.

> +}
> +
>  static int dsi_enable_te(struct dsi_data *dsi, bool enable)
>  {
>  	dsi->te_enabled = enable;
> @@ -4812,9 +4833,10 @@ static const struct omap_dss_device_ops dsi_ops = {
>  	.connect = dsi_connect,
>  	.disconnect = dsi_disconnect,
>  	.enable = dsi_display_enable,
> +	.disable = dsi_display_disable,
>  
>  	.dsi = {
> -		.disable = dsi_display_disable,
> +		.ulps = dsi_ulps,
>  
>  		.set_config = dsi_set_config,
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 43eba2ea1f96..0d82ba34ca89 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -281,10 +281,9 @@ struct omap_dss_writeback_info {
>  };
>  
>  struct omapdss_dsi_ops {
> -	void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
> -			bool enter_ulps);
> -
>  	/* bus configuration */
> +	void (*ulps)(struct omap_dss_device *dssdev, bool enable);
> +
>  	int (*set_config)(struct omap_dss_device *dssdev,
>  			const struct omap_dss_dsi_config *cfg);
>  

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 28/56] drm/omap: dsi: untangle ulps ops from enable/disable
@ 2020-11-09  9:57     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09  9:57 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:05PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Create a custom function pointer for ULPS and use it instead of
> reusing disable/enable functions for ULPS mode switch. This allows
> us to use the common disable/enable functions pointers for DSI.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  8 ++--
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 42 ++++++++++++++-----
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  5 +--
>  3 files changed, 38 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 4be0c9dbcc43..78247dcb1848 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -233,7 +233,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>  	if (r)
>  		goto err;
>  
> -	src->ops->dsi.disable(src, false, true);
> +	src->ops->dsi.ulps(src, true);
>  
>  	ddata->ulps_enabled = true;
>  
> @@ -258,7 +258,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  	if (!ddata->ulps_enabled)
>  		return 0;
>  
> -	src->ops->enable(src);
> +	src->ops->dsi.ulps(src, false);
>  	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>  
>  	r = _dsicm_enable_te(ddata, ddata->te_enabled);
> @@ -586,7 +586,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	dsicm_hw_reset(ddata);
>  
> -	src->ops->dsi.disable(src, true, false);
> +	src->ops->disable(src);
>  err_regulators:
>  	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>  	if (r)
> @@ -612,7 +612,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  		dsicm_hw_reset(ddata);
>  	}
>  
> -	src->ops->dsi.disable(src, true, false);
> +	src->ops->disable(src);
>  
>  	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>  	if (r)
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index d54b743c2b48..937362ade4b4 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4055,13 +4055,10 @@ static void dsi_display_uninit_dsi(struct dsi_data *dsi, bool disconnect_lanes,
>  	}
>  }
>  
> -static void dsi_display_enable(struct omap_dss_device *dssdev)
> +static void dsi_display_ulps_enable(struct dsi_data *dsi)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	int r;
>  
> -	DSSDBG("dsi_display_enable\n");
> -
>  	WARN_ON(!dsi_bus_is_locked(dsi));
>  
>  	mutex_lock(&dsi->lock);
> @@ -4084,16 +4081,19 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
>  	dsi_runtime_put(dsi);
>  err_get_dsi:
>  	mutex_unlock(&dsi->lock);
> -	DSSDBG("dsi_display_enable FAILED\n");
> +	DSSDBG("dsi_display_ulps_enable FAILED\n");
>  }
>  
> -static void dsi_display_disable(struct omap_dss_device *dssdev,
> -		bool disconnect_lanes, bool enter_ulps)
> +static void dsi_display_enable(struct omap_dss_device *dssdev)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	DSSDBG("dsi_display_enable\n");
> +	dsi_display_ulps_enable(dsi);
> +}
>  
> -	DSSDBG("dsi_display_disable\n");
> -
> +static void dsi_display_ulps_disable(struct dsi_data *dsi,
> +		bool disconnect_lanes, bool enter_ulps)
> +{
>  	WARN_ON(!dsi_bus_is_locked(dsi));
>  
>  	mutex_lock(&dsi->lock);
> @@ -4110,6 +4110,27 @@ static void dsi_display_disable(struct omap_dss_device *dssdev,
>  	mutex_unlock(&dsi->lock);
>  }
>  
> +static void dsi_display_disable(struct omap_dss_device *dssdev)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +
> +	DSSDBG("dsi_display_disable\n");
> +
> +	dsi_display_ulps_disable(dsi, true, false);
> +}
> +
> +static void dsi_ulps(struct omap_dss_device *dssdev, bool enable)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +
> +	DSSDBG("dsi_ulps\n");
> +
> +	if (enable)
> +		dsi_display_ulps_disable(dsi, false, true);
> +	else
> +		dsi_display_ulps_enable(dsi);

The names are fairly confusing. I would expect
dsi_display_ulps_disable() to disable ULPS mode.

> +}
> +
>  static int dsi_enable_te(struct dsi_data *dsi, bool enable)
>  {
>  	dsi->te_enabled = enable;
> @@ -4812,9 +4833,10 @@ static const struct omap_dss_device_ops dsi_ops = {
>  	.connect = dsi_connect,
>  	.disconnect = dsi_disconnect,
>  	.enable = dsi_display_enable,
> +	.disable = dsi_display_disable,
>  
>  	.dsi = {
> -		.disable = dsi_display_disable,
> +		.ulps = dsi_ulps,
>  
>  		.set_config = dsi_set_config,
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 43eba2ea1f96..0d82ba34ca89 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -281,10 +281,9 @@ struct omap_dss_writeback_info {
>  };
>  
>  struct omapdss_dsi_ops {
> -	void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
> -			bool enter_ulps);
> -
>  	/* bus configuration */
> +	void (*ulps)(struct omap_dss_device *dssdev, bool enable);
> +
>  	int (*set_config)(struct omap_dss_device *dssdev,
>  			const struct omap_dss_dsi_config *cfg);
>  

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 29/56] drm/omap: dsi: do ULPS in host driver
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 10:03     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:03 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:06PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Move ULPS handling into the DSI host controller, so that we
> no longer need a custom API for the DSI client.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 273 +-----------------
>  drivers/gpu/drm/omapdrm/dss/dsi.c             |  63 +++-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |   2 -
>  3 files changed, 62 insertions(+), 276 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 78247dcb1848..030a8fa140db 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -16,7 +16,6 @@
>  #include <linux/module.h>
>  #include <linux/sched/signal.h>
>  #include <linux/slab.h>
> -#include <linux/workqueue.h>
>  #include <linux/of_device.h>
>  #include <linux/regulator/consumer.h>
>  
> @@ -69,21 +68,13 @@ struct panel_drv_data {
>  
>  	bool intro_printed;
>  
> -	struct workqueue_struct *workqueue;
> -
>  	bool ulps_enabled;
> -	unsigned int ulps_timeout;
> -	struct delayed_work ulps_work;
>  };
>  
>  #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
>  
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>  
> -static int dsicm_panel_reset(struct panel_drv_data *ddata);
> -
> -static void dsicm_ulps_work(struct work_struct *work);
> -
>  static void dsicm_bl_power(struct panel_drv_data *ddata, bool enable)
>  {
>  	struct backlight_device *backlight;
> @@ -207,94 +198,6 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
>  	return 0;
>  }
>  
> -static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
> -{
> -	if (ddata->ulps_timeout > 0)
> -		queue_delayed_work(ddata->workqueue, &ddata->ulps_work,
> -				msecs_to_jiffies(ddata->ulps_timeout));
> -}
> -
> -static void dsicm_cancel_ulps_work(struct panel_drv_data *ddata)
> -{
> -	cancel_delayed_work(&ddata->ulps_work);
> -}
> -
> -static int dsicm_enter_ulps(struct panel_drv_data *ddata)
> -{
> -	struct omap_dss_device *src = ddata->src;
> -	int r;
> -
> -	if (ddata->ulps_enabled)
> -		return 0;
> -
> -	dsicm_cancel_ulps_work(ddata);
> -
> -	r = _dsicm_enable_te(ddata, false);
> -	if (r)
> -		goto err;
> -
> -	src->ops->dsi.ulps(src, true);
> -
> -	ddata->ulps_enabled = true;
> -
> -	return 0;
> -
> -err:
> -	dev_err(&ddata->dsi->dev, "enter ULPS failed");
> -	dsicm_panel_reset(ddata);
> -
> -	ddata->ulps_enabled = false;
> -
> -	dsicm_queue_ulps_work(ddata);
> -
> -	return r;
> -}
> -
> -static int dsicm_exit_ulps(struct panel_drv_data *ddata)
> -{
> -	struct omap_dss_device *src = ddata->src;
> -	int r;
> -
> -	if (!ddata->ulps_enabled)
> -		return 0;
> -
> -	src->ops->dsi.ulps(src, false);
> -	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
> -
> -	r = _dsicm_enable_te(ddata, ddata->te_enabled);
> -	if (r) {
> -		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
> -		goto err2;
> -	}
> -
> -	dsicm_queue_ulps_work(ddata);
> -
> -	ddata->ulps_enabled = false;
> -
> -	return 0;
> -
> -err2:
> -	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
> -
> -	r = dsicm_panel_reset(ddata);
> -	if (!r)
> -		ddata->ulps_enabled = false;
> -
> -	dsicm_queue_ulps_work(ddata);
> -
> -	return r;
> -}
> -
> -static int dsicm_wake_up(struct panel_drv_data *ddata)
> -{
> -	if (ddata->ulps_enabled)
> -		return dsicm_exit_ulps(ddata);
> -
> -	dsicm_cancel_ulps_work(ddata);
> -	dsicm_queue_ulps_work(ddata);
> -	return 0;
> -}
> -
>  static int dsicm_bl_update_status(struct backlight_device *dev)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
> @@ -312,11 +215,8 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
>  	mutex_lock(&ddata->lock);
>  
>  	if (ddata->enabled) {
> -		r = dsicm_wake_up(ddata);
> -		if (!r) {
> -			r = dsicm_dcs_write_1(ddata,
> -				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
> -		}
> +		r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
> +				      level);
>  	}
>  
>  	mutex_unlock(&ddata->lock);
> @@ -343,18 +243,12 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>  	u8 errors = 0;
> -	int r;
> +	int r = -ENODEV;
>  
>  	mutex_lock(&ddata->lock);
>  
> -	if (ddata->enabled) {
> -		r = dsicm_wake_up(ddata);
> -		if (!r)
> -			r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
> -					&errors);
> -	} else {
> -		r = -ENODEV;
> -	}
> +	if (ddata->enabled)
> +		r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS, &errors);
>  
>  	mutex_unlock(&ddata->lock);
>  
> @@ -369,17 +263,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>  	u8 id1, id2, id3;
> -	int r;
> +	int r = -ENODEV;
>  
>  	mutex_lock(&ddata->lock);
>  
> -	if (ddata->enabled) {
> -		r = dsicm_wake_up(ddata);
> -		if (!r)
> -			r = dsicm_get_id(ddata, &id1, &id2, &id3);
> -	} else {
> -		r = -ENODEV;
> -	}
> +	if (ddata->enabled)
> +		r = dsicm_get_id(ddata, &id1, &id2, &id3);
>  
>  	mutex_unlock(&ddata->lock);
>  
> @@ -389,103 +278,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
>  	return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
>  }
>  
> -static ssize_t dsicm_store_ulps(struct device *dev,
> -		struct device_attribute *attr,
> -		const char *buf, size_t count)
> -{
> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	unsigned long t;
> -	int r;
> -
> -	r = kstrtoul(buf, 0, &t);
> -	if (r)
> -		return r;
> -
> -	mutex_lock(&ddata->lock);
> -
> -	if (ddata->enabled) {
> -		if (t)
> -			r = dsicm_enter_ulps(ddata);
> -		else
> -			r = dsicm_wake_up(ddata);
> -	}
> -
> -	mutex_unlock(&ddata->lock);
> -
> -	if (r)
> -		return r;
> -
> -	return count;
> -}
> -
> -static ssize_t dsicm_show_ulps(struct device *dev,
> -		struct device_attribute *attr,
> -		char *buf)
> -{
> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	unsigned int t;
> -
> -	mutex_lock(&ddata->lock);
> -	t = ddata->ulps_enabled;
> -	mutex_unlock(&ddata->lock);
> -
> -	return snprintf(buf, PAGE_SIZE, "%u\n", t);
> -}
> -
> -static ssize_t dsicm_store_ulps_timeout(struct device *dev,
> -		struct device_attribute *attr,
> -		const char *buf, size_t count)
> -{
> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	unsigned long t;
> -	int r;
> -
> -	r = kstrtoul(buf, 0, &t);
> -	if (r)
> -		return r;
> -
> -	mutex_lock(&ddata->lock);
> -	ddata->ulps_timeout = t;
> -
> -	if (ddata->enabled) {
> -		/* dsicm_wake_up will restart the timer */
> -		r = dsicm_wake_up(ddata);
> -	}
> -
> -	mutex_unlock(&ddata->lock);
> -
> -	if (r)
> -		return r;
> -
> -	return count;
> -}
> -
> -static ssize_t dsicm_show_ulps_timeout(struct device *dev,
> -		struct device_attribute *attr,
> -		char *buf)
> -{
> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	unsigned int t;
> -
> -	mutex_lock(&ddata->lock);
> -	t = ddata->ulps_timeout;
> -	mutex_unlock(&ddata->lock);
> -
> -	return snprintf(buf, PAGE_SIZE, "%u\n", t);
> -}
> -
>  static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
>  static DEVICE_ATTR(hw_revision, S_IRUGO, dsicm_hw_revision_show, NULL);
> -static DEVICE_ATTR(ulps, S_IRUGO | S_IWUSR,
> -		dsicm_show_ulps, dsicm_store_ulps);
> -static DEVICE_ATTR(ulps_timeout, S_IRUGO | S_IWUSR,
> -		dsicm_show_ulps_timeout, dsicm_store_ulps_timeout);
>  
>  static struct attribute *dsicm_attrs[] = {
>  	&dev_attr_num_dsi_errors.attr,
>  	&dev_attr_hw_revision.attr,
> -	&dev_attr_ulps.attr,
> -	&dev_attr_ulps_timeout.attr,
>  	NULL,
>  };
>  
> @@ -621,15 +419,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  	ddata->enabled = false;
>  }
>  
> -static int dsicm_panel_reset(struct panel_drv_data *ddata)
> -{
> -	dev_err(&ddata->dsi->dev, "performing LCD reset\n");
> -
> -	dsicm_power_off(ddata);
> -	dsicm_hw_reset(ddata);
> -	return dsicm_power_on(ddata);
> -}
> -
>  static int dsicm_connect(struct omap_dss_device *src,
>  			 struct omap_dss_device *dst)
>  {
> @@ -671,17 +460,12 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>  static void dsicm_disable(struct omap_dss_device *dssdev)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	int r;
>  
>  	dsicm_bl_power(ddata, false);
>  
>  	mutex_lock(&ddata->lock);
>  
> -	dsicm_cancel_ulps_work(ddata);
> -
> -	r = dsicm_wake_up(ddata);
> -	if (!r)
> -		dsicm_power_off(ddata);
> +	dsicm_power_off(ddata);
>  
>  	mutex_unlock(&ddata->lock);
>  }
> @@ -705,10 +489,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  
>  	mutex_lock(&ddata->lock);
>  
> -	r = dsicm_wake_up(ddata);
> -	if (r)
> -		goto err;
> -
>  	if (!ddata->enabled) {
>  		r = 0;
>  		goto err;
> @@ -748,24 +528,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  	return r;
>  }
>  
> -static void dsicm_ulps_work(struct work_struct *work)
> -{
> -	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> -			ulps_work.work);
> -	struct omap_dss_device *dssdev = &ddata->dssdev;
> -
> -	mutex_lock(&ddata->lock);
> -
> -	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || !ddata->enabled) {
> -		mutex_unlock(&ddata->lock);
> -		return;
> -	}
> -
> -	dsicm_enter_ulps(ddata);
> -
> -	mutex_unlock(&ddata->lock);
> -}
> -
>  static int dsicm_get_modes(struct omap_dss_device *dssdev,
>  			   struct drm_connector *connector)
>  {
> @@ -863,7 +625,7 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  	else
>  		ddata->use_dsi_backlight = true;
>  
> -	/* TODO: ulps */
> +	/* TODO: ulps_enabled */
>  
>  	return 0;
>  }
> @@ -911,13 +673,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  
>  	mutex_init(&ddata->lock);
>  
> -	ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
> -	if (!ddata->workqueue) {
> -		r = -ENOMEM;
> -		goto err_reg;
> -	}
> -	INIT_DELAYED_WORK(&ddata->ulps_work, dsicm_ulps_work);
> -
>  	dsicm_hw_reset(ddata);
>  
>  	if (ddata->use_dsi_backlight) {
> @@ -948,6 +703,9 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	dsi->hs_rate = 300000000;
>  	dsi->lp_rate = 10000000;
>  
> +	if (ddata->ulps_enabled)
> +		dsi->mode_flags |= MIPI_DSI_MODE_ULPS_IDLE;
> +
>  	r = mipi_dsi_attach(dsi);
>  	if (r < 0)
>  		goto err_dsi_attach;
> @@ -957,8 +715,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  err_dsi_attach:
>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>  err_bl:
> -	destroy_workqueue(ddata->workqueue);
> -err_reg:
>  	if (ddata->extbldev)
>  		put_device(&ddata->extbldev->dev);
>  
> @@ -985,9 +741,6 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>  	if (ddata->extbldev)
>  		put_device(&ddata->extbldev->dev);
>  
> -	dsicm_cancel_ulps_work(ddata);
> -	destroy_workqueue(ddata->workqueue);
> -
>  	/* reset, to be sure that the panel is in a valid state */
>  	dsicm_hw_reset(ddata);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 937362ade4b4..0f264654792d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -207,6 +207,8 @@ struct dsi_reg { u16 module; u16 idx; };
>  typedef void (*omap_dsi_isr_t) (void *arg, u32 mask);
>  struct dsi_data;
>  
> +static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable);
> +

Would it be possible to avoid forward declarations by reordering
functions ?

This patch removes the ability for userspace to configure the ULPS
timeout (and thus, if I understand correctly, to disable the auto-ULPS
feature). I understand the simplification is needed, but I can't tell if
the feature removal could have an adverse effect.

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

>  static int dsi_display_init_dispc(struct dsi_data *dsi);
>  static void dsi_display_uninit_dispc(struct dsi_data *dsi);
>  
> @@ -377,6 +379,9 @@ struct dsi_data {
>  
>  	bool te_enabled;
>  	bool ulps_enabled;
> +	bool ulps_auto_idle;
> +
> +	struct delayed_work ulps_work;
>  
>  	void (*framedone_callback)(int, void *);
>  	void *framedone_data;
> @@ -3794,6 +3799,7 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
>  		REG_FLD_MOD(dsi, DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */
>  	}
>  
> +	dsi_set_ulps_auto(dsi, true);
>  	dsi_bus_unlock(dsi);
>  
>  	dsi->framedone_callback(error, dsi->framedone_data);
> @@ -3856,6 +3862,7 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  
>  	dsi_bus_lock(dsi);
> +	dsi_set_ulps_auto(dsi, false);
>  
>  	dsi->update_channel = channel;
>  	dsi->framedone_callback = callback;
> @@ -4119,18 +4126,6 @@ static void dsi_display_disable(struct omap_dss_device *dssdev)
>  	dsi_display_ulps_disable(dsi, true, false);
>  }
>  
> -static void dsi_ulps(struct omap_dss_device *dssdev, bool enable)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> -	DSSDBG("dsi_ulps\n");
> -
> -	if (enable)
> -		dsi_display_ulps_disable(dsi, false, true);
> -	else
> -		dsi_display_ulps_enable(dsi);
> -}
> -
>  static int dsi_enable_te(struct dsi_data *dsi, bool enable)
>  {
>  	dsi->te_enabled = enable;
> @@ -4145,6 +4140,40 @@ static int dsi_enable_te(struct dsi_data *dsi, bool enable)
>  	return 0;
>  }
>  
> +static void omap_dsi_ulps_work_callback(struct work_struct *work)
> +{
> +	struct dsi_data *dsi = container_of(work, struct dsi_data,
> +					    ulps_work.work);
> +
> +	dsi_bus_lock(dsi);
> +
> +	dsi_enable_te(dsi, false);
> +
> +	dsi_display_ulps_disable(dsi, false, true);
> +
> +	dsi_bus_unlock(dsi);
> +}
> +
> +static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable)
> +{
> +	WARN_ON(!dsi_bus_is_locked(dsi));
> +
> +	if (!dsi->ulps_auto_idle)
> +		return;
> +
> +	if (enable) {
> +		schedule_delayed_work(&dsi->ulps_work, msecs_to_jiffies(250));
> +	} else {
> +		cancel_delayed_work_sync(&dsi->ulps_work);
> +
> +		if (!dsi->ulps_enabled)
> +			return;
> +
> +		dsi_display_ulps_enable(dsi);
> +		dsi_enable_te(dsi, true);
> +	}
> +}
> +
>  #ifdef PRINT_VERBOSE_VM_TIMINGS
>  static void print_dsi_vm(const char *str,
>  		const struct omap_dss_dsi_videomode_timings *t)
> @@ -4796,7 +4825,9 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  	int r;
>  
>  	dsi_bus_lock(dsi);
> +	dsi_set_ulps_auto(dsi, false);
>  	r = _omap_dsi_host_transfer(dsi, msg);
> +	dsi_set_ulps_auto(dsi, true);
>  	dsi_bus_unlock(dsi);
>  
>  	return r;
> @@ -4836,8 +4867,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  	.disable = dsi_display_disable,
>  
>  	.dsi = {
> -		.ulps = dsi_ulps,
> -
>  		.set_config = dsi_set_config,
>  
>  		.enable_video_output = dsi_enable_video_output,
> @@ -4959,6 +4988,12 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  	dsi->vc[channel].dest = client;
>  	dsi->pix_fmt = client->format;
>  
> +	INIT_DEFERRABLE_WORK(&dsi->ulps_work,
> +			     omap_dsi_ulps_work_callback);
> +
> +	dsi->ulps_auto_idle = !!(client->mode_flags & MIPI_DSI_MODE_ULPS_IDLE);
> +	dsi_set_ulps_auto(dsi, true);
> +
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 0d82ba34ca89..524cb87cd9ea 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -282,8 +282,6 @@ struct omap_dss_writeback_info {
>  
>  struct omapdss_dsi_ops {
>  	/* bus configuration */
> -	void (*ulps)(struct omap_dss_device *dssdev, bool enable);
> -
>  	int (*set_config)(struct omap_dss_device *dssdev,
>  			const struct omap_dss_dsi_config *cfg);
>  

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 29/56] drm/omap: dsi: do ULPS in host driver
@ 2020-11-09 10:03     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:03 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:06PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Move ULPS handling into the DSI host controller, so that we
> no longer need a custom API for the DSI client.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 273 +-----------------
>  drivers/gpu/drm/omapdrm/dss/dsi.c             |  63 +++-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |   2 -
>  3 files changed, 62 insertions(+), 276 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 78247dcb1848..030a8fa140db 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -16,7 +16,6 @@
>  #include <linux/module.h>
>  #include <linux/sched/signal.h>
>  #include <linux/slab.h>
> -#include <linux/workqueue.h>
>  #include <linux/of_device.h>
>  #include <linux/regulator/consumer.h>
>  
> @@ -69,21 +68,13 @@ struct panel_drv_data {
>  
>  	bool intro_printed;
>  
> -	struct workqueue_struct *workqueue;
> -
>  	bool ulps_enabled;
> -	unsigned int ulps_timeout;
> -	struct delayed_work ulps_work;
>  };
>  
>  #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
>  
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>  
> -static int dsicm_panel_reset(struct panel_drv_data *ddata);
> -
> -static void dsicm_ulps_work(struct work_struct *work);
> -
>  static void dsicm_bl_power(struct panel_drv_data *ddata, bool enable)
>  {
>  	struct backlight_device *backlight;
> @@ -207,94 +198,6 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
>  	return 0;
>  }
>  
> -static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
> -{
> -	if (ddata->ulps_timeout > 0)
> -		queue_delayed_work(ddata->workqueue, &ddata->ulps_work,
> -				msecs_to_jiffies(ddata->ulps_timeout));
> -}
> -
> -static void dsicm_cancel_ulps_work(struct panel_drv_data *ddata)
> -{
> -	cancel_delayed_work(&ddata->ulps_work);
> -}
> -
> -static int dsicm_enter_ulps(struct panel_drv_data *ddata)
> -{
> -	struct omap_dss_device *src = ddata->src;
> -	int r;
> -
> -	if (ddata->ulps_enabled)
> -		return 0;
> -
> -	dsicm_cancel_ulps_work(ddata);
> -
> -	r = _dsicm_enable_te(ddata, false);
> -	if (r)
> -		goto err;
> -
> -	src->ops->dsi.ulps(src, true);
> -
> -	ddata->ulps_enabled = true;
> -
> -	return 0;
> -
> -err:
> -	dev_err(&ddata->dsi->dev, "enter ULPS failed");
> -	dsicm_panel_reset(ddata);
> -
> -	ddata->ulps_enabled = false;
> -
> -	dsicm_queue_ulps_work(ddata);
> -
> -	return r;
> -}
> -
> -static int dsicm_exit_ulps(struct panel_drv_data *ddata)
> -{
> -	struct omap_dss_device *src = ddata->src;
> -	int r;
> -
> -	if (!ddata->ulps_enabled)
> -		return 0;
> -
> -	src->ops->dsi.ulps(src, false);
> -	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
> -
> -	r = _dsicm_enable_te(ddata, ddata->te_enabled);
> -	if (r) {
> -		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
> -		goto err2;
> -	}
> -
> -	dsicm_queue_ulps_work(ddata);
> -
> -	ddata->ulps_enabled = false;
> -
> -	return 0;
> -
> -err2:
> -	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
> -
> -	r = dsicm_panel_reset(ddata);
> -	if (!r)
> -		ddata->ulps_enabled = false;
> -
> -	dsicm_queue_ulps_work(ddata);
> -
> -	return r;
> -}
> -
> -static int dsicm_wake_up(struct panel_drv_data *ddata)
> -{
> -	if (ddata->ulps_enabled)
> -		return dsicm_exit_ulps(ddata);
> -
> -	dsicm_cancel_ulps_work(ddata);
> -	dsicm_queue_ulps_work(ddata);
> -	return 0;
> -}
> -
>  static int dsicm_bl_update_status(struct backlight_device *dev)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
> @@ -312,11 +215,8 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
>  	mutex_lock(&ddata->lock);
>  
>  	if (ddata->enabled) {
> -		r = dsicm_wake_up(ddata);
> -		if (!r) {
> -			r = dsicm_dcs_write_1(ddata,
> -				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
> -		}
> +		r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
> +				      level);
>  	}
>  
>  	mutex_unlock(&ddata->lock);
> @@ -343,18 +243,12 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>  	u8 errors = 0;
> -	int r;
> +	int r = -ENODEV;
>  
>  	mutex_lock(&ddata->lock);
>  
> -	if (ddata->enabled) {
> -		r = dsicm_wake_up(ddata);
> -		if (!r)
> -			r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
> -					&errors);
> -	} else {
> -		r = -ENODEV;
> -	}
> +	if (ddata->enabled)
> +		r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS, &errors);
>  
>  	mutex_unlock(&ddata->lock);
>  
> @@ -369,17 +263,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>  	u8 id1, id2, id3;
> -	int r;
> +	int r = -ENODEV;
>  
>  	mutex_lock(&ddata->lock);
>  
> -	if (ddata->enabled) {
> -		r = dsicm_wake_up(ddata);
> -		if (!r)
> -			r = dsicm_get_id(ddata, &id1, &id2, &id3);
> -	} else {
> -		r = -ENODEV;
> -	}
> +	if (ddata->enabled)
> +		r = dsicm_get_id(ddata, &id1, &id2, &id3);
>  
>  	mutex_unlock(&ddata->lock);
>  
> @@ -389,103 +278,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
>  	return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
>  }
>  
> -static ssize_t dsicm_store_ulps(struct device *dev,
> -		struct device_attribute *attr,
> -		const char *buf, size_t count)
> -{
> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	unsigned long t;
> -	int r;
> -
> -	r = kstrtoul(buf, 0, &t);
> -	if (r)
> -		return r;
> -
> -	mutex_lock(&ddata->lock);
> -
> -	if (ddata->enabled) {
> -		if (t)
> -			r = dsicm_enter_ulps(ddata);
> -		else
> -			r = dsicm_wake_up(ddata);
> -	}
> -
> -	mutex_unlock(&ddata->lock);
> -
> -	if (r)
> -		return r;
> -
> -	return count;
> -}
> -
> -static ssize_t dsicm_show_ulps(struct device *dev,
> -		struct device_attribute *attr,
> -		char *buf)
> -{
> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	unsigned int t;
> -
> -	mutex_lock(&ddata->lock);
> -	t = ddata->ulps_enabled;
> -	mutex_unlock(&ddata->lock);
> -
> -	return snprintf(buf, PAGE_SIZE, "%u\n", t);
> -}
> -
> -static ssize_t dsicm_store_ulps_timeout(struct device *dev,
> -		struct device_attribute *attr,
> -		const char *buf, size_t count)
> -{
> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	unsigned long t;
> -	int r;
> -
> -	r = kstrtoul(buf, 0, &t);
> -	if (r)
> -		return r;
> -
> -	mutex_lock(&ddata->lock);
> -	ddata->ulps_timeout = t;
> -
> -	if (ddata->enabled) {
> -		/* dsicm_wake_up will restart the timer */
> -		r = dsicm_wake_up(ddata);
> -	}
> -
> -	mutex_unlock(&ddata->lock);
> -
> -	if (r)
> -		return r;
> -
> -	return count;
> -}
> -
> -static ssize_t dsicm_show_ulps_timeout(struct device *dev,
> -		struct device_attribute *attr,
> -		char *buf)
> -{
> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> -	unsigned int t;
> -
> -	mutex_lock(&ddata->lock);
> -	t = ddata->ulps_timeout;
> -	mutex_unlock(&ddata->lock);
> -
> -	return snprintf(buf, PAGE_SIZE, "%u\n", t);
> -}
> -
>  static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
>  static DEVICE_ATTR(hw_revision, S_IRUGO, dsicm_hw_revision_show, NULL);
> -static DEVICE_ATTR(ulps, S_IRUGO | S_IWUSR,
> -		dsicm_show_ulps, dsicm_store_ulps);
> -static DEVICE_ATTR(ulps_timeout, S_IRUGO | S_IWUSR,
> -		dsicm_show_ulps_timeout, dsicm_store_ulps_timeout);
>  
>  static struct attribute *dsicm_attrs[] = {
>  	&dev_attr_num_dsi_errors.attr,
>  	&dev_attr_hw_revision.attr,
> -	&dev_attr_ulps.attr,
> -	&dev_attr_ulps_timeout.attr,
>  	NULL,
>  };
>  
> @@ -621,15 +419,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  	ddata->enabled = false;
>  }
>  
> -static int dsicm_panel_reset(struct panel_drv_data *ddata)
> -{
> -	dev_err(&ddata->dsi->dev, "performing LCD reset\n");
> -
> -	dsicm_power_off(ddata);
> -	dsicm_hw_reset(ddata);
> -	return dsicm_power_on(ddata);
> -}
> -
>  static int dsicm_connect(struct omap_dss_device *src,
>  			 struct omap_dss_device *dst)
>  {
> @@ -671,17 +460,12 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>  static void dsicm_disable(struct omap_dss_device *dssdev)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	int r;
>  
>  	dsicm_bl_power(ddata, false);
>  
>  	mutex_lock(&ddata->lock);
>  
> -	dsicm_cancel_ulps_work(ddata);
> -
> -	r = dsicm_wake_up(ddata);
> -	if (!r)
> -		dsicm_power_off(ddata);
> +	dsicm_power_off(ddata);
>  
>  	mutex_unlock(&ddata->lock);
>  }
> @@ -705,10 +489,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  
>  	mutex_lock(&ddata->lock);
>  
> -	r = dsicm_wake_up(ddata);
> -	if (r)
> -		goto err;
> -
>  	if (!ddata->enabled) {
>  		r = 0;
>  		goto err;
> @@ -748,24 +528,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  	return r;
>  }
>  
> -static void dsicm_ulps_work(struct work_struct *work)
> -{
> -	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> -			ulps_work.work);
> -	struct omap_dss_device *dssdev = &ddata->dssdev;
> -
> -	mutex_lock(&ddata->lock);
> -
> -	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || !ddata->enabled) {
> -		mutex_unlock(&ddata->lock);
> -		return;
> -	}
> -
> -	dsicm_enter_ulps(ddata);
> -
> -	mutex_unlock(&ddata->lock);
> -}
> -
>  static int dsicm_get_modes(struct omap_dss_device *dssdev,
>  			   struct drm_connector *connector)
>  {
> @@ -863,7 +625,7 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  	else
>  		ddata->use_dsi_backlight = true;
>  
> -	/* TODO: ulps */
> +	/* TODO: ulps_enabled */
>  
>  	return 0;
>  }
> @@ -911,13 +673,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  
>  	mutex_init(&ddata->lock);
>  
> -	ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
> -	if (!ddata->workqueue) {
> -		r = -ENOMEM;
> -		goto err_reg;
> -	}
> -	INIT_DELAYED_WORK(&ddata->ulps_work, dsicm_ulps_work);
> -
>  	dsicm_hw_reset(ddata);
>  
>  	if (ddata->use_dsi_backlight) {
> @@ -948,6 +703,9 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	dsi->hs_rate = 300000000;
>  	dsi->lp_rate = 10000000;
>  
> +	if (ddata->ulps_enabled)
> +		dsi->mode_flags |= MIPI_DSI_MODE_ULPS_IDLE;
> +
>  	r = mipi_dsi_attach(dsi);
>  	if (r < 0)
>  		goto err_dsi_attach;
> @@ -957,8 +715,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  err_dsi_attach:
>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>  err_bl:
> -	destroy_workqueue(ddata->workqueue);
> -err_reg:
>  	if (ddata->extbldev)
>  		put_device(&ddata->extbldev->dev);
>  
> @@ -985,9 +741,6 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>  	if (ddata->extbldev)
>  		put_device(&ddata->extbldev->dev);
>  
> -	dsicm_cancel_ulps_work(ddata);
> -	destroy_workqueue(ddata->workqueue);
> -
>  	/* reset, to be sure that the panel is in a valid state */
>  	dsicm_hw_reset(ddata);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 937362ade4b4..0f264654792d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -207,6 +207,8 @@ struct dsi_reg { u16 module; u16 idx; };
>  typedef void (*omap_dsi_isr_t) (void *arg, u32 mask);
>  struct dsi_data;
>  
> +static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable);
> +

Would it be possible to avoid forward declarations by reordering
functions ?

This patch removes the ability for userspace to configure the ULPS
timeout (and thus, if I understand correctly, to disable the auto-ULPS
feature). I understand the simplification is needed, but I can't tell if
the feature removal could have an adverse effect.

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

>  static int dsi_display_init_dispc(struct dsi_data *dsi);
>  static void dsi_display_uninit_dispc(struct dsi_data *dsi);
>  
> @@ -377,6 +379,9 @@ struct dsi_data {
>  
>  	bool te_enabled;
>  	bool ulps_enabled;
> +	bool ulps_auto_idle;
> +
> +	struct delayed_work ulps_work;
>  
>  	void (*framedone_callback)(int, void *);
>  	void *framedone_data;
> @@ -3794,6 +3799,7 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
>  		REG_FLD_MOD(dsi, DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */
>  	}
>  
> +	dsi_set_ulps_auto(dsi, true);
>  	dsi_bus_unlock(dsi);
>  
>  	dsi->framedone_callback(error, dsi->framedone_data);
> @@ -3856,6 +3862,7 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  
>  	dsi_bus_lock(dsi);
> +	dsi_set_ulps_auto(dsi, false);
>  
>  	dsi->update_channel = channel;
>  	dsi->framedone_callback = callback;
> @@ -4119,18 +4126,6 @@ static void dsi_display_disable(struct omap_dss_device *dssdev)
>  	dsi_display_ulps_disable(dsi, true, false);
>  }
>  
> -static void dsi_ulps(struct omap_dss_device *dssdev, bool enable)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> -	DSSDBG("dsi_ulps\n");
> -
> -	if (enable)
> -		dsi_display_ulps_disable(dsi, false, true);
> -	else
> -		dsi_display_ulps_enable(dsi);
> -}
> -
>  static int dsi_enable_te(struct dsi_data *dsi, bool enable)
>  {
>  	dsi->te_enabled = enable;
> @@ -4145,6 +4140,40 @@ static int dsi_enable_te(struct dsi_data *dsi, bool enable)
>  	return 0;
>  }
>  
> +static void omap_dsi_ulps_work_callback(struct work_struct *work)
> +{
> +	struct dsi_data *dsi = container_of(work, struct dsi_data,
> +					    ulps_work.work);
> +
> +	dsi_bus_lock(dsi);
> +
> +	dsi_enable_te(dsi, false);
> +
> +	dsi_display_ulps_disable(dsi, false, true);
> +
> +	dsi_bus_unlock(dsi);
> +}
> +
> +static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable)
> +{
> +	WARN_ON(!dsi_bus_is_locked(dsi));
> +
> +	if (!dsi->ulps_auto_idle)
> +		return;
> +
> +	if (enable) {
> +		schedule_delayed_work(&dsi->ulps_work, msecs_to_jiffies(250));
> +	} else {
> +		cancel_delayed_work_sync(&dsi->ulps_work);
> +
> +		if (!dsi->ulps_enabled)
> +			return;
> +
> +		dsi_display_ulps_enable(dsi);
> +		dsi_enable_te(dsi, true);
> +	}
> +}
> +
>  #ifdef PRINT_VERBOSE_VM_TIMINGS
>  static void print_dsi_vm(const char *str,
>  		const struct omap_dss_dsi_videomode_timings *t)
> @@ -4796,7 +4825,9 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  	int r;
>  
>  	dsi_bus_lock(dsi);
> +	dsi_set_ulps_auto(dsi, false);
>  	r = _omap_dsi_host_transfer(dsi, msg);
> +	dsi_set_ulps_auto(dsi, true);
>  	dsi_bus_unlock(dsi);
>  
>  	return r;
> @@ -4836,8 +4867,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  	.disable = dsi_display_disable,
>  
>  	.dsi = {
> -		.ulps = dsi_ulps,
> -
>  		.set_config = dsi_set_config,
>  
>  		.enable_video_output = dsi_enable_video_output,
> @@ -4959,6 +4988,12 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  	dsi->vc[channel].dest = client;
>  	dsi->pix_fmt = client->format;
>  
> +	INIT_DEFERRABLE_WORK(&dsi->ulps_work,
> +			     omap_dsi_ulps_work_callback);
> +
> +	dsi->ulps_auto_idle = !!(client->mode_flags & MIPI_DSI_MODE_ULPS_IDLE);
> +	dsi_set_ulps_auto(dsi, true);
> +
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 0d82ba34ca89..524cb87cd9ea 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -282,8 +282,6 @@ struct omap_dss_writeback_info {
>  
>  struct omapdss_dsi_ops {
>  	/* bus configuration */
> -	void (*ulps)(struct omap_dss_device *dssdev, bool enable);
> -
>  	int (*set_config)(struct omap_dss_device *dssdev,
>  			const struct omap_dss_dsi_config *cfg);
>  

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver
  2020-11-09  9:52     ` Laurent Pinchart
@ 2020-11-09 10:08       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09 10:08 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 09/11/2020 11:52, Laurent Pinchart wrote:
> Hi Tomi,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:04PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> This moves the bus locking into the host driver and unexports
>> the custom API in preparation for drm_panel support.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

<snip>

>>  static int dsicm_update(struct omap_dss_device *dssdev,
>> @@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>  	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>>  
>>  	mutex_lock(&ddata->lock);
>> -	src->ops->dsi.bus_lock(src);
>>  
>>  	r = dsicm_wake_up(ddata);
>>  	if (r)
>> @@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>  	if (r)
>>  		goto err;
>>  
>> -	/* note: no bus_unlock here. unlock is src framedone_cb */
>> -	mutex_unlock(&ddata->lock);
>> +	/* note: no unlock here. unlock is src framedone_cb */
> 
> This change isn't described in the commit message. Could you explain why
> it's needed ? Locking a mutex in a function and unlocking it elsewhere
> always scares me.

Good catch. I don't know why it is needed. I don't think it is, as the dsi driver handles the bus lock.

Sebastian, what was the reason for this lock?

Note that this goes away in the series, and there's no such lock in the end.

>>  	return 0;
>>  err:
>> -	src->ops->dsi.bus_unlock(src);
>>  	mutex_unlock(&ddata->lock);
>>  	return r;
>>  }
>> @@ -791,7 +753,6 @@ static void dsicm_ulps_work(struct work_struct *work)
>>  	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
>>  			ulps_work.work);
>>  	struct omap_dss_device *dssdev = &ddata->dssdev;
>> -	struct omap_dss_device *src = ddata->src;
>>  
>>  	mutex_lock(&ddata->lock);
>>  
>> @@ -800,11 +761,8 @@ static void dsicm_ulps_work(struct work_struct *work)
>>  		return;
>>  	}
>>  
>> -	src->ops->dsi.bus_lock(src);
>> -
>>  	dsicm_enter_ulps(ddata);
>>  
>> -	src->ops->dsi.bus_unlock(src);
>>  	mutex_unlock(&ddata->lock);
>>  }
>>  
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index 41431ca34568..d54b743c2b48 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -476,17 +476,13 @@ static inline u32 dsi_read_reg(struct dsi_data *dsi, const struct dsi_reg idx)
>>  	return __raw_readl(base + idx.idx);
>>  }
>>  
>> -static void dsi_bus_lock(struct omap_dss_device *dssdev)
>> +static void dsi_bus_lock(struct dsi_data *dsi)
>>  {
>> -	struct dsi_data *dsi = to_dsi_data(dssdev);
>> -
>>  	down(&dsi->bus_lock);
> 
> Nothing to be addressed in this patch, but is there a reason to use a
> semaphore instead of a mutex ?

It's been a long time, but I think the reason was that mutex gave a warning after being locked for a
bit longer time, and semaphore didn't. The resource is reserved while a DSI transfer is active, so
it could be almost 2 frames (wait for vsync and then transfer frame). Or reading the frame buffer
back from the panel, which could take a long time (seconds).

There are better ways to implement it (after this series =).

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver
@ 2020-11-09 10:08       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09 10:08 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 09/11/2020 11:52, Laurent Pinchart wrote:
> Hi Tomi,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:04PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> This moves the bus locking into the host driver and unexports
>> the custom API in preparation for drm_panel support.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

<snip>

>>  static int dsicm_update(struct omap_dss_device *dssdev,
>> @@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>  	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>>  
>>  	mutex_lock(&ddata->lock);
>> -	src->ops->dsi.bus_lock(src);
>>  
>>  	r = dsicm_wake_up(ddata);
>>  	if (r)
>> @@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>  	if (r)
>>  		goto err;
>>  
>> -	/* note: no bus_unlock here. unlock is src framedone_cb */
>> -	mutex_unlock(&ddata->lock);
>> +	/* note: no unlock here. unlock is src framedone_cb */
> 
> This change isn't described in the commit message. Could you explain why
> it's needed ? Locking a mutex in a function and unlocking it elsewhere
> always scares me.

Good catch. I don't know why it is needed. I don't think it is, as the dsi driver handles the bus lock.

Sebastian, what was the reason for this lock?

Note that this goes away in the series, and there's no such lock in the end.

>>  	return 0;
>>  err:
>> -	src->ops->dsi.bus_unlock(src);
>>  	mutex_unlock(&ddata->lock);
>>  	return r;
>>  }
>> @@ -791,7 +753,6 @@ static void dsicm_ulps_work(struct work_struct *work)
>>  	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
>>  			ulps_work.work);
>>  	struct omap_dss_device *dssdev = &ddata->dssdev;
>> -	struct omap_dss_device *src = ddata->src;
>>  
>>  	mutex_lock(&ddata->lock);
>>  
>> @@ -800,11 +761,8 @@ static void dsicm_ulps_work(struct work_struct *work)
>>  		return;
>>  	}
>>  
>> -	src->ops->dsi.bus_lock(src);
>> -
>>  	dsicm_enter_ulps(ddata);
>>  
>> -	src->ops->dsi.bus_unlock(src);
>>  	mutex_unlock(&ddata->lock);
>>  }
>>  
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index 41431ca34568..d54b743c2b48 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -476,17 +476,13 @@ static inline u32 dsi_read_reg(struct dsi_data *dsi, const struct dsi_reg idx)
>>  	return __raw_readl(base + idx.idx);
>>  }
>>  
>> -static void dsi_bus_lock(struct omap_dss_device *dssdev)
>> +static void dsi_bus_lock(struct dsi_data *dsi)
>>  {
>> -	struct dsi_data *dsi = to_dsi_data(dssdev);
>> -
>>  	down(&dsi->bus_lock);
> 
> Nothing to be addressed in this patch, but is there a reason to use a
> semaphore instead of a mutex ?

It's been a long time, but I think the reason was that mutex gave a warning after being locked for a
bit longer time, and semaphore didn't. The resource is reserved while a DSI transfer is active, so
it could be almost 2 frames (wait for vsync and then transfer frame). Or reading the frame buffer
back from the panel, which could take a long time (seconds).

There are better ways to implement it (after this series =).

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 10:10     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:10 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:07PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This moves the panel refresh/update function from the panel
> driver into the DSI host driver to prepare for common drm_panel
> support.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  68 ------------
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 101 ++++++++++++++++--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  13 +--
>  drivers/gpu/drm/omapdrm/omap_crtc.c           |  11 +-
>  4 files changed, 97 insertions(+), 96 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 030a8fa140db..1582960f9e90 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
>  	return 0;
>  }
>  
> -static int dsicm_set_update_window(struct panel_drv_data *ddata,
> -		u16 x, u16 y, u16 w, u16 h)
> -{
> -	struct mipi_dsi_device *dsi = ddata->dsi;
> -	int r;
> -	u16 x1 = x;
> -	u16 x2 = x + w - 1;
> -	u16 y1 = y;
> -	u16 y2 = y + h - 1;
> -
> -	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
> -	if (r < 0)
> -		return r;
> -
> -	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
> -	if (r < 0)
> -		return r;
> -
> -	return 0;
> -}
> -

I can't tell whether this is common to all command-mode panels, or if
there could be a need for panel-specific update procedures, so I can't
really ack this patch.

>  static int dsicm_bl_update_status(struct backlight_device *dev)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
> @@ -470,48 +449,6 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
>  	mutex_unlock(&ddata->lock);
>  }
>  
> -static void dsicm_framedone_cb(int err, void *data)
> -{
> -	struct panel_drv_data *ddata = data;
> -
> -	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
> -	mutex_unlock(&ddata->lock);
> -}
> -
> -static int dsicm_update(struct omap_dss_device *dssdev,
> -				    u16 x, u16 y, u16 w, u16 h)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
> -	int r;
> -
> -	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
> -
> -	mutex_lock(&ddata->lock);
> -
> -	if (!ddata->enabled) {
> -		r = 0;
> -		goto err;
> -	}
> -
> -	/* XXX no need to send this every frame, but dsi break if not done */
> -	r = dsicm_set_update_window(ddata, 0, 0, ddata->vm.hactive,
> -				    ddata->vm.vactive);
> -	if (r)
> -		goto err;
> -
> -	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
> -			ddata);
> -	if (r)
> -		goto err;
> -
> -	/* note: no unlock here. unlock is src framedone_cb */
> -	return 0;
> -err:
> -	mutex_unlock(&ddata->lock);
> -	return r;
> -}
> -
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
>  	struct mipi_dsi_device *dsi = ddata->dsi;
> @@ -572,10 +509,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
>  	.check_timings	= dsicm_check_timings,
>  };
>  
> -static const struct omap_dss_driver dsicm_dss_driver = {
> -	.update		= dsicm_update,
> -};
> -
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  {
>  	struct device_node *node = dsi->dev.of_node;
> @@ -658,7 +591,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	dssdev = &ddata->dssdev;
>  	dssdev->dev = dev;
>  	dssdev->ops = &dsicm_ops;
> -	dssdev->driver = &dsicm_dss_driver;
>  	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
>  	dssdev->display = true;
>  	dssdev->owner = THIS_MODULE;
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 0f264654792d..0aa0d21cf896 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -214,6 +214,9 @@ static void dsi_display_uninit_dispc(struct dsi_data *dsi);
>  
>  static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
>  
> +static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
> +				       const struct mipi_dsi_msg *msg);
> +
>  /* DSI PLL HSDIV indices */
>  #define HSDIV_DISPC	0
>  #define HSDIV_DSI	1
> @@ -383,9 +386,6 @@ struct dsi_data {
>  
>  	struct delayed_work ulps_work;
>  
> -	void (*framedone_callback)(int, void *);
> -	void *framedone_data;
> -
>  	struct delayed_work framedone_timeout_work;
>  
>  #ifdef DSI_CATCH_MISSING_TE
> @@ -3802,8 +3802,6 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
>  	dsi_set_ulps_auto(dsi, true);
>  	dsi_bus_unlock(dsi);
>  
> -	dsi->framedone_callback(error, dsi->framedone_data);
> -
>  	if (!error)
>  		dsi_perf_show(dsi, "DISPC");
>  }
> @@ -3835,6 +3833,8 @@ static void dsi_framedone_irq_callback(void *data)
>  
>  	cancel_delayed_work(&dsi->framedone_timeout_work);
>  
> +	DSSDBG("Framedone received!\n");
> +
>  	dsi_handle_framedone(dsi, 0);
>  }
>  
> @@ -3856,17 +3856,69 @@ static int _dsi_update(struct dsi_data *dsi)
>  	return 0;
>  }
>  
> -static int dsi_update(struct omap_dss_device *dssdev, int channel,
> -		void (*callback)(int, void *), void *data)
> +static int _dsi_update_window(struct dsi_data *dsi, int channel,
> +			      int x, int y, int w, int h)
> +{
> +	int x1 = x, x2 = (x + w - 1);
> +	int y1 = y, y2 = (y + h - 1);
> +	u8 payloadX[5] = { MIPI_DCS_SET_COLUMN_ADDRESS,
> +			   x1 >> 8, x1 & 0xff, x2 >> 8, x2 & 0xff };
> +	u8 payloadY[5] = { MIPI_DCS_SET_PAGE_ADDRESS,
> +			   y1 >> 8, y1 & 0xff, y2 >> 8, y2 & 0xff };
> +	struct mipi_dsi_msg msgX = { 0 }, msgY = { 0 };
> +	int ret;
> +
> +	WARN_ON(!dsi_bus_is_locked(dsi));
> +
> +	msgX.type = MIPI_DSI_DCS_LONG_WRITE;
> +	msgX.channel = channel;
> +	msgX.tx_buf = payloadX;
> +	msgX.tx_len = sizeof(payloadX);
> +
> +	msgY.type = MIPI_DSI_DCS_LONG_WRITE;
> +	msgY.channel = channel;
> +	msgY.tx_buf = payloadY;
> +	msgY.tx_len = sizeof(payloadY);
> +
> +	ret = _omap_dsi_host_transfer(dsi, &msgX);
> +	if (ret != 0)
> +		return ret;
> +
> +	return _omap_dsi_host_transfer(dsi, &msgY);
> +}
> +
> +static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	int r;
> +
> +	if (channel > 3)
> +		return -EINVAL;
>  
>  	dsi_bus_lock(dsi);
> +
> +	if (!dsi->vc[channel].dest) {
> +		r = -ENODEV;
> +		goto err;
> +	}
> +
> +	if (dsi->vm.hactive == 0 || dsi->vm.vactive == 0) {
> +		r = -EINVAL;
> +		goto err;
> +	}
> +
> +	DSSDBG("dsi_update_channel: %d", channel);
> +
>  	dsi_set_ulps_auto(dsi, false);
>  
> +	r = _dsi_update_window(dsi, channel, 0, 0, dsi->vm.hactive,
> +			       dsi->vm.vactive);
> +	if (r < 0) {
> +		DSSWARN("window update error: %d\n", r);
> +		goto err;
> +	}
> +
>  	dsi->update_channel = channel;
> -	dsi->framedone_callback = callback;
> -	dsi->framedone_data = data;
>  
>  	if (dsi->te_enabled && dsi->te_gpio) {
>  		schedule_delayed_work(&dsi->te_timeout_work,
> @@ -3877,6 +3929,24 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>  	}
>  
>  	return 0;
> +
> +err:
> +	dsi_set_ulps_auto(dsi, true);
> +	dsi_bus_unlock(dsi);
> +	return r;
> +}
> +
> +static int dsi_update_all(struct omap_dss_device *dssdev)
> +{
> +	int i, r;

i should be unsigned as it's never negative.

> +
> +	for (i = 0; i < 4; i++) {
> +		r = dsi_update_channel(dssdev, i);
> +		if (r != -ENODEV)
> +			return r;
> +	}
> +
> +	return r;
>  }
>  
>  /* Display funcs */
> @@ -4095,7 +4165,9 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	DSSDBG("dsi_display_enable\n");
> +	dsi_bus_lock(dsi);

Why is the lock needed here now ? Should it be part of a previous patch
? Or, if I'm missing something, should the commit message explain this ?
Same for the other locations below.

>  	dsi_display_ulps_enable(dsi);
> +	dsi_bus_unlock(dsi);
>  }
>  
>  static void dsi_display_ulps_disable(struct dsi_data *dsi,
> @@ -4123,7 +4195,9 @@ static void dsi_display_disable(struct omap_dss_device *dssdev)
>  
>  	DSSDBG("dsi_display_disable\n");
>  
> +	dsi_bus_lock(dsi);
>  	dsi_display_ulps_disable(dsi, true, false);
> +	dsi_bus_unlock(dsi);
>  }
>  
>  static int dsi_enable_te(struct dsi_data *dsi, bool enable)
> @@ -4872,7 +4946,7 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.enable_video_output = dsi_enable_video_output,
>  		.disable_video_output = dsi_disable_video_output,
>  
> -		.update = dsi_update,
> +		.update = dsi_update_all,
>  	},
>  };
>  
> @@ -4973,14 +5047,18 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  		return -EINVAL;
>  	}
>  
> +	dsi_bus_lock(dsi);
> +
>  	atomic_set(&dsi->do_ext_te_update, 0);
>  
>  	if (client->mode_flags & MIPI_DSI_MODE_VIDEO) {
>  		dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
>  	} else {
>  		r = omap_dsi_register_te_irq(dsi, client);
> -		if (r)
> +		if (r) {
> +			dsi_bus_unlock(dsi);
>  			return r;
> +		}
>  
>  		dsi->mode = OMAP_DSS_DSI_CMD_MODE;
>  	}
> @@ -4994,6 +5072,7 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  	dsi->ulps_auto_idle = !!(client->mode_flags & MIPI_DSI_MODE_ULPS_IDLE);
>  	dsi_set_ulps_auto(dsi, true);
>  
> +	dsi_bus_unlock(dsi);
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 524cb87cd9ea..de4c779c358a 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -281,13 +281,12 @@ struct omap_dss_writeback_info {
>  };
>  
>  struct omapdss_dsi_ops {
> -	/* bus configuration */
> +	int (*update)(struct omap_dss_device *dssdev);
> +
> +	/* legacy API used by omapdss panels */
>  	int (*set_config)(struct omap_dss_device *dssdev,
>  			const struct omap_dss_dsi_config *cfg);
>  
> -	int (*update)(struct omap_dss_device *dssdev, int channel,
> -			void (*callback)(int, void *), void *data);
> -
>  	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
>  	void (*disable_video_output)(struct omap_dss_device *dssdev,
>  			int channel);
> @@ -351,7 +350,6 @@ struct omap_dss_device {
>  
>  	const char *name;
>  
> -	const struct omap_dss_driver *driver;
>  	const struct omap_dss_device_ops *ops;
>  	unsigned long ops_flags;
>  	u32 bus_flags;
> @@ -372,11 +370,6 @@ struct omap_dss_device {
>  	unsigned int of_port;
>  };
>  
> -struct omap_dss_driver {
> -	int (*update)(struct omap_dss_device *dssdev,
> -			       u16 x, u16 y, u16 w, u16 h);
> -};
> -
>  struct dss_device *omapdss_get_dss(void);
>  void omapdss_set_dss(struct dss_device *dss);
>  static inline bool omapdss_is_initialized(void)
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index dac9ccda98df..3068e4fffa16 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -362,10 +362,8 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
>  {
>  	struct omap_crtc *omap_crtc =
>  			container_of(data, struct omap_crtc, update_work.work);
> -	struct drm_display_mode *mode = &omap_crtc->pipe->crtc->mode;
> -	struct omap_dss_device *dssdev = omap_crtc->pipe->output->next;
> +	struct omap_dss_device *dssdev = omap_crtc->pipe->output;
>  	struct drm_device *dev = omap_crtc->base.dev;
> -	const struct omap_dss_driver *dssdrv;
>  	int ret;
>  
>  	if (!dssdev) {
> @@ -373,13 +371,12 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
>  		return;
>  	}
>  
> -	dssdrv = dssdev->driver;
> -	if (!dssdrv || !dssdrv->update) {
> -		dev_err_once(dev->dev, "missing or incorrect dssdrv!");
> +	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI || !dssdev->ops->dsi.update) {
> +		dev_err_once(dev->dev, "no DSI update callback found!");
>  		return;
>  	}
>  
> -	ret = dssdrv->update(dssdev, 0, 0, mode->hdisplay, mode->vdisplay);
> +	ret = dssdev->ops->dsi.update(dssdev);
>  	if (ret < 0) {
>  		spin_lock_irq(&dev->event_lock);
>  		omap_crtc->pending = false;

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
@ 2020-11-09 10:10     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:10 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:07PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This moves the panel refresh/update function from the panel
> driver into the DSI host driver to prepare for common drm_panel
> support.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  68 ------------
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 101 ++++++++++++++++--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  13 +--
>  drivers/gpu/drm/omapdrm/omap_crtc.c           |  11 +-
>  4 files changed, 97 insertions(+), 96 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 030a8fa140db..1582960f9e90 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
>  	return 0;
>  }
>  
> -static int dsicm_set_update_window(struct panel_drv_data *ddata,
> -		u16 x, u16 y, u16 w, u16 h)
> -{
> -	struct mipi_dsi_device *dsi = ddata->dsi;
> -	int r;
> -	u16 x1 = x;
> -	u16 x2 = x + w - 1;
> -	u16 y1 = y;
> -	u16 y2 = y + h - 1;
> -
> -	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
> -	if (r < 0)
> -		return r;
> -
> -	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
> -	if (r < 0)
> -		return r;
> -
> -	return 0;
> -}
> -

I can't tell whether this is common to all command-mode panels, or if
there could be a need for panel-specific update procedures, so I can't
really ack this patch.

>  static int dsicm_bl_update_status(struct backlight_device *dev)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
> @@ -470,48 +449,6 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
>  	mutex_unlock(&ddata->lock);
>  }
>  
> -static void dsicm_framedone_cb(int err, void *data)
> -{
> -	struct panel_drv_data *ddata = data;
> -
> -	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
> -	mutex_unlock(&ddata->lock);
> -}
> -
> -static int dsicm_update(struct omap_dss_device *dssdev,
> -				    u16 x, u16 y, u16 w, u16 h)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
> -	int r;
> -
> -	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
> -
> -	mutex_lock(&ddata->lock);
> -
> -	if (!ddata->enabled) {
> -		r = 0;
> -		goto err;
> -	}
> -
> -	/* XXX no need to send this every frame, but dsi break if not done */
> -	r = dsicm_set_update_window(ddata, 0, 0, ddata->vm.hactive,
> -				    ddata->vm.vactive);
> -	if (r)
> -		goto err;
> -
> -	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
> -			ddata);
> -	if (r)
> -		goto err;
> -
> -	/* note: no unlock here. unlock is src framedone_cb */
> -	return 0;
> -err:
> -	mutex_unlock(&ddata->lock);
> -	return r;
> -}
> -
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
>  	struct mipi_dsi_device *dsi = ddata->dsi;
> @@ -572,10 +509,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
>  	.check_timings	= dsicm_check_timings,
>  };
>  
> -static const struct omap_dss_driver dsicm_dss_driver = {
> -	.update		= dsicm_update,
> -};
> -
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  {
>  	struct device_node *node = dsi->dev.of_node;
> @@ -658,7 +591,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	dssdev = &ddata->dssdev;
>  	dssdev->dev = dev;
>  	dssdev->ops = &dsicm_ops;
> -	dssdev->driver = &dsicm_dss_driver;
>  	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
>  	dssdev->display = true;
>  	dssdev->owner = THIS_MODULE;
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 0f264654792d..0aa0d21cf896 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -214,6 +214,9 @@ static void dsi_display_uninit_dispc(struct dsi_data *dsi);
>  
>  static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
>  
> +static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
> +				       const struct mipi_dsi_msg *msg);
> +
>  /* DSI PLL HSDIV indices */
>  #define HSDIV_DISPC	0
>  #define HSDIV_DSI	1
> @@ -383,9 +386,6 @@ struct dsi_data {
>  
>  	struct delayed_work ulps_work;
>  
> -	void (*framedone_callback)(int, void *);
> -	void *framedone_data;
> -
>  	struct delayed_work framedone_timeout_work;
>  
>  #ifdef DSI_CATCH_MISSING_TE
> @@ -3802,8 +3802,6 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
>  	dsi_set_ulps_auto(dsi, true);
>  	dsi_bus_unlock(dsi);
>  
> -	dsi->framedone_callback(error, dsi->framedone_data);
> -
>  	if (!error)
>  		dsi_perf_show(dsi, "DISPC");
>  }
> @@ -3835,6 +3833,8 @@ static void dsi_framedone_irq_callback(void *data)
>  
>  	cancel_delayed_work(&dsi->framedone_timeout_work);
>  
> +	DSSDBG("Framedone received!\n");
> +
>  	dsi_handle_framedone(dsi, 0);
>  }
>  
> @@ -3856,17 +3856,69 @@ static int _dsi_update(struct dsi_data *dsi)
>  	return 0;
>  }
>  
> -static int dsi_update(struct omap_dss_device *dssdev, int channel,
> -		void (*callback)(int, void *), void *data)
> +static int _dsi_update_window(struct dsi_data *dsi, int channel,
> +			      int x, int y, int w, int h)
> +{
> +	int x1 = x, x2 = (x + w - 1);
> +	int y1 = y, y2 = (y + h - 1);
> +	u8 payloadX[5] = { MIPI_DCS_SET_COLUMN_ADDRESS,
> +			   x1 >> 8, x1 & 0xff, x2 >> 8, x2 & 0xff };
> +	u8 payloadY[5] = { MIPI_DCS_SET_PAGE_ADDRESS,
> +			   y1 >> 8, y1 & 0xff, y2 >> 8, y2 & 0xff };
> +	struct mipi_dsi_msg msgX = { 0 }, msgY = { 0 };
> +	int ret;
> +
> +	WARN_ON(!dsi_bus_is_locked(dsi));
> +
> +	msgX.type = MIPI_DSI_DCS_LONG_WRITE;
> +	msgX.channel = channel;
> +	msgX.tx_buf = payloadX;
> +	msgX.tx_len = sizeof(payloadX);
> +
> +	msgY.type = MIPI_DSI_DCS_LONG_WRITE;
> +	msgY.channel = channel;
> +	msgY.tx_buf = payloadY;
> +	msgY.tx_len = sizeof(payloadY);
> +
> +	ret = _omap_dsi_host_transfer(dsi, &msgX);
> +	if (ret != 0)
> +		return ret;
> +
> +	return _omap_dsi_host_transfer(dsi, &msgY);
> +}
> +
> +static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	int r;
> +
> +	if (channel > 3)
> +		return -EINVAL;
>  
>  	dsi_bus_lock(dsi);
> +
> +	if (!dsi->vc[channel].dest) {
> +		r = -ENODEV;
> +		goto err;
> +	}
> +
> +	if (dsi->vm.hactive == 0 || dsi->vm.vactive == 0) {
> +		r = -EINVAL;
> +		goto err;
> +	}
> +
> +	DSSDBG("dsi_update_channel: %d", channel);
> +
>  	dsi_set_ulps_auto(dsi, false);
>  
> +	r = _dsi_update_window(dsi, channel, 0, 0, dsi->vm.hactive,
> +			       dsi->vm.vactive);
> +	if (r < 0) {
> +		DSSWARN("window update error: %d\n", r);
> +		goto err;
> +	}
> +
>  	dsi->update_channel = channel;
> -	dsi->framedone_callback = callback;
> -	dsi->framedone_data = data;
>  
>  	if (dsi->te_enabled && dsi->te_gpio) {
>  		schedule_delayed_work(&dsi->te_timeout_work,
> @@ -3877,6 +3929,24 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>  	}
>  
>  	return 0;
> +
> +err:
> +	dsi_set_ulps_auto(dsi, true);
> +	dsi_bus_unlock(dsi);
> +	return r;
> +}
> +
> +static int dsi_update_all(struct omap_dss_device *dssdev)
> +{
> +	int i, r;

i should be unsigned as it's never negative.

> +
> +	for (i = 0; i < 4; i++) {
> +		r = dsi_update_channel(dssdev, i);
> +		if (r != -ENODEV)
> +			return r;
> +	}
> +
> +	return r;
>  }
>  
>  /* Display funcs */
> @@ -4095,7 +4165,9 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	DSSDBG("dsi_display_enable\n");
> +	dsi_bus_lock(dsi);

Why is the lock needed here now ? Should it be part of a previous patch
? Or, if I'm missing something, should the commit message explain this ?
Same for the other locations below.

>  	dsi_display_ulps_enable(dsi);
> +	dsi_bus_unlock(dsi);
>  }
>  
>  static void dsi_display_ulps_disable(struct dsi_data *dsi,
> @@ -4123,7 +4195,9 @@ static void dsi_display_disable(struct omap_dss_device *dssdev)
>  
>  	DSSDBG("dsi_display_disable\n");
>  
> +	dsi_bus_lock(dsi);
>  	dsi_display_ulps_disable(dsi, true, false);
> +	dsi_bus_unlock(dsi);
>  }
>  
>  static int dsi_enable_te(struct dsi_data *dsi, bool enable)
> @@ -4872,7 +4946,7 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.enable_video_output = dsi_enable_video_output,
>  		.disable_video_output = dsi_disable_video_output,
>  
> -		.update = dsi_update,
> +		.update = dsi_update_all,
>  	},
>  };
>  
> @@ -4973,14 +5047,18 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  		return -EINVAL;
>  	}
>  
> +	dsi_bus_lock(dsi);
> +
>  	atomic_set(&dsi->do_ext_te_update, 0);
>  
>  	if (client->mode_flags & MIPI_DSI_MODE_VIDEO) {
>  		dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
>  	} else {
>  		r = omap_dsi_register_te_irq(dsi, client);
> -		if (r)
> +		if (r) {
> +			dsi_bus_unlock(dsi);
>  			return r;
> +		}
>  
>  		dsi->mode = OMAP_DSS_DSI_CMD_MODE;
>  	}
> @@ -4994,6 +5072,7 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  	dsi->ulps_auto_idle = !!(client->mode_flags & MIPI_DSI_MODE_ULPS_IDLE);
>  	dsi_set_ulps_auto(dsi, true);
>  
> +	dsi_bus_unlock(dsi);
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 524cb87cd9ea..de4c779c358a 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -281,13 +281,12 @@ struct omap_dss_writeback_info {
>  };
>  
>  struct omapdss_dsi_ops {
> -	/* bus configuration */
> +	int (*update)(struct omap_dss_device *dssdev);
> +
> +	/* legacy API used by omapdss panels */
>  	int (*set_config)(struct omap_dss_device *dssdev,
>  			const struct omap_dss_dsi_config *cfg);
>  
> -	int (*update)(struct omap_dss_device *dssdev, int channel,
> -			void (*callback)(int, void *), void *data);
> -
>  	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
>  	void (*disable_video_output)(struct omap_dss_device *dssdev,
>  			int channel);
> @@ -351,7 +350,6 @@ struct omap_dss_device {
>  
>  	const char *name;
>  
> -	const struct omap_dss_driver *driver;
>  	const struct omap_dss_device_ops *ops;
>  	unsigned long ops_flags;
>  	u32 bus_flags;
> @@ -372,11 +370,6 @@ struct omap_dss_device {
>  	unsigned int of_port;
>  };
>  
> -struct omap_dss_driver {
> -	int (*update)(struct omap_dss_device *dssdev,
> -			       u16 x, u16 y, u16 w, u16 h);
> -};
> -
>  struct dss_device *omapdss_get_dss(void);
>  void omapdss_set_dss(struct dss_device *dss);
>  static inline bool omapdss_is_initialized(void)
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index dac9ccda98df..3068e4fffa16 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -362,10 +362,8 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
>  {
>  	struct omap_crtc *omap_crtc =
>  			container_of(data, struct omap_crtc, update_work.work);
> -	struct drm_display_mode *mode = &omap_crtc->pipe->crtc->mode;
> -	struct omap_dss_device *dssdev = omap_crtc->pipe->output->next;
> +	struct omap_dss_device *dssdev = omap_crtc->pipe->output;
>  	struct drm_device *dev = omap_crtc->base.dev;
> -	const struct omap_dss_driver *dssdrv;
>  	int ret;
>  
>  	if (!dssdev) {
> @@ -373,13 +371,12 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
>  		return;
>  	}
>  
> -	dssdrv = dssdev->driver;
> -	if (!dssdrv || !dssdrv->update) {
> -		dev_err_once(dev->dev, "missing or incorrect dssdrv!");
> +	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI || !dssdev->ops->dsi.update) {
> +		dev_err_once(dev->dev, "no DSI update callback found!");
>  		return;
>  	}
>  
> -	ret = dssdrv->update(dssdev, 0, 0, mode->hdisplay, mode->vdisplay);
> +	ret = dssdev->ops->dsi.update(dssdev);
>  	if (ret < 0) {
>  		spin_lock_irq(&dev->event_lock);
>  		omap_crtc->pending = false;

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 31/56] drm/omap: dsi: Reverse direction of the DSS device enable/disable operations
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 10:17     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:17 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:08PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Complete the direction reversal of the DSS device enable/disable
> operations started by 19b4200d8f4b ("drm/omap: Reverse direction
> of the DSS device enable/disable operations").
> 
> This effectively drops the requirement of calling DSS specific
> code from the DSI panel driver moving it a bit further to a
> standard drm_panel driver.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 74 +++++++++----------
>  drivers/gpu/drm/omapdrm/omap_encoder.c        | 24 ++----
>  2 files changed, 45 insertions(+), 53 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 1582960f9e90..45d417870498 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -288,27 +288,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	struct omap_dss_device *src = ddata->src;
>  	u8 id1, id2, id3;
>  	int r;
> -	struct omap_dss_dsi_config dsi_config = {
> -		.vm = &ddata->vm,
> -		.hs_clk_min = 150000000,
> -		.hs_clk_max = 300000000,
> -		.lp_clk_min = 7000000,
> -		.lp_clk_max = 10000000,
> -	};
> -
> -	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> -	if (r) {
> -		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
> -		return r;
> -	}
> -
> -	r = src->ops->dsi.set_config(src, &dsi_config);
> -	if (r) {
> -		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
> -		goto err_regulators;
> -	}
> -
> -	src->ops->enable(src);
>  
>  	dsicm_hw_reset(ddata);
>  
> @@ -363,12 +342,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	dsicm_hw_reset(ddata);
>  
> -	src->ops->disable(src);
> -err_regulators:
> -	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> -	if (r)
> -		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
> -
>  	return r;
>  }
>  
> @@ -377,6 +350,8 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  	struct omap_dss_device *src = ddata->src;
>  	int r;
>  
> +	ddata->enabled = false;
> +
>  	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
>  
>  	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
> @@ -388,14 +363,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  				"error disabling panel, issuing HW reset\n");
>  		dsicm_hw_reset(ddata);
>  	}
> -
> -	src->ops->disable(src);
> -
> -	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> -	if (r)
> -		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
> -
> -	ddata->enabled = false;
>  }
>  
>  static int dsicm_connect(struct omap_dss_device *src,
> @@ -415,6 +382,29 @@ static void dsicm_disconnect(struct omap_dss_device *src,
>  	ddata->src = NULL;
>  }
>  
> +static void dsicm_pre_enable(struct omap_dss_device *dssdev)
> +{
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	struct omap_dss_device *src = ddata->src;
> +	int r;
> +	struct omap_dss_dsi_config dsi_config = {
> +		.vm = &ddata->vm,
> +		.hs_clk_min = 150000000,
> +		.hs_clk_max = 300000000,
> +		.lp_clk_min = 7000000,
> +		.lp_clk_max = 10000000,
> +	};
> +
> +	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> +	if (r)
> +		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
> +
> +	r = src->ops->dsi.set_config(src, &dsi_config);
> +	if (r) {
> +		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
> +	}
> +}
> +
>  static void dsicm_enable(struct omap_dss_device *dssdev)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> @@ -449,6 +439,16 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
>  	mutex_unlock(&ddata->lock);
>  }
>  
> +static void dsicm_post_disable(struct omap_dss_device *dssdev)
> +{
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	int r;
> +
> +	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> +	if (r)
> +		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
> +}
> +
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
>  	struct mipi_dsi_device *dsi = ddata->dsi;
> @@ -502,8 +502,10 @@ static const struct omap_dss_device_ops dsicm_ops = {
>  	.connect	= dsicm_connect,
>  	.disconnect	= dsicm_disconnect,
>  
> +	.pre_enable	= dsicm_pre_enable,
>  	.enable		= dsicm_enable,
>  	.disable	= dsicm_disable,
> +	.post_disable	= dsicm_post_disable,
>  
>  	.get_modes	= dsicm_get_modes,
>  	.check_timings	= dsicm_check_timings,
> @@ -664,8 +666,6 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>  
>  	omapdss_device_unregister(dssdev);
>  
> -	if (omapdss_device_is_enabled(dssdev))
> -		dsicm_disable(dssdev);
>  	omapdss_device_disconnect(ddata->src, dssdev);
>  
>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index 18a79dde6815..10abe4d01b0b 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -137,15 +137,11 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
>  	omapdss_device_disable(dssdev->next);
>  
>  	/*
> -	 * Disable the internal encoder. This will disable the DSS output. The
> -	 * DSI is treated as an exception as DSI pipelines still use the legacy
> -	 * flow where the pipeline output controls the encoder.
> +	 * Disable the internal encoder. This will disable the DSS output.
>  	 */

You could write this

	/* Disable the internal encoder. This will disable the DSS output. */

Same below.

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

> -	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
> -		if (dssdev->ops && dssdev->ops->disable)
> -			dssdev->ops->disable(dssdev);
> -		dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> -	}
> +	if (dssdev->ops && dssdev->ops->disable)
> +		dssdev->ops->disable(dssdev);
> +	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
>  
>  	/*
>  	 * Perform the post-disable operations on the chain of external devices
> @@ -166,15 +162,11 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
>  	omapdss_device_pre_enable(dssdev->next);
>  
>  	/*
> -	 * Enable the internal encoder. This will enable the DSS output. The
> -	 * DSI is treated as an exception as DSI pipelines still use the legacy
> -	 * flow where the pipeline output controls the encoder.
> +	 * Enable the internal encoder. This will enable the DSS output.
>  	 */
> -	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
> -		if (dssdev->ops && dssdev->ops->enable)
> -			dssdev->ops->enable(dssdev);
> -		dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
> -	}
> +	if (dssdev->ops && dssdev->ops->enable)
> +		dssdev->ops->enable(dssdev);
> +	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
>  
>  	/*
>  	 * Enable the chain of external devices, starting at the one at the

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 31/56] drm/omap: dsi: Reverse direction of the DSS device enable/disable operations
@ 2020-11-09 10:17     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:17 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:08PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Complete the direction reversal of the DSS device enable/disable
> operations started by 19b4200d8f4b ("drm/omap: Reverse direction
> of the DSS device enable/disable operations").
> 
> This effectively drops the requirement of calling DSS specific
> code from the DSI panel driver moving it a bit further to a
> standard drm_panel driver.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 74 +++++++++----------
>  drivers/gpu/drm/omapdrm/omap_encoder.c        | 24 ++----
>  2 files changed, 45 insertions(+), 53 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 1582960f9e90..45d417870498 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -288,27 +288,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	struct omap_dss_device *src = ddata->src;
>  	u8 id1, id2, id3;
>  	int r;
> -	struct omap_dss_dsi_config dsi_config = {
> -		.vm = &ddata->vm,
> -		.hs_clk_min = 150000000,
> -		.hs_clk_max = 300000000,
> -		.lp_clk_min = 7000000,
> -		.lp_clk_max = 10000000,
> -	};
> -
> -	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> -	if (r) {
> -		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
> -		return r;
> -	}
> -
> -	r = src->ops->dsi.set_config(src, &dsi_config);
> -	if (r) {
> -		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
> -		goto err_regulators;
> -	}
> -
> -	src->ops->enable(src);
>  
>  	dsicm_hw_reset(ddata);
>  
> @@ -363,12 +342,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	dsicm_hw_reset(ddata);
>  
> -	src->ops->disable(src);
> -err_regulators:
> -	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> -	if (r)
> -		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
> -
>  	return r;
>  }
>  
> @@ -377,6 +350,8 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  	struct omap_dss_device *src = ddata->src;
>  	int r;
>  
> +	ddata->enabled = false;
> +
>  	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
>  
>  	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
> @@ -388,14 +363,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  				"error disabling panel, issuing HW reset\n");
>  		dsicm_hw_reset(ddata);
>  	}
> -
> -	src->ops->disable(src);
> -
> -	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> -	if (r)
> -		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
> -
> -	ddata->enabled = false;
>  }
>  
>  static int dsicm_connect(struct omap_dss_device *src,
> @@ -415,6 +382,29 @@ static void dsicm_disconnect(struct omap_dss_device *src,
>  	ddata->src = NULL;
>  }
>  
> +static void dsicm_pre_enable(struct omap_dss_device *dssdev)
> +{
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	struct omap_dss_device *src = ddata->src;
> +	int r;
> +	struct omap_dss_dsi_config dsi_config = {
> +		.vm = &ddata->vm,
> +		.hs_clk_min = 150000000,
> +		.hs_clk_max = 300000000,
> +		.lp_clk_min = 7000000,
> +		.lp_clk_max = 10000000,
> +	};
> +
> +	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> +	if (r)
> +		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
> +
> +	r = src->ops->dsi.set_config(src, &dsi_config);
> +	if (r) {
> +		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
> +	}
> +}
> +
>  static void dsicm_enable(struct omap_dss_device *dssdev)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> @@ -449,6 +439,16 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
>  	mutex_unlock(&ddata->lock);
>  }
>  
> +static void dsicm_post_disable(struct omap_dss_device *dssdev)
> +{
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	int r;
> +
> +	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> +	if (r)
> +		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
> +}
> +
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
>  	struct mipi_dsi_device *dsi = ddata->dsi;
> @@ -502,8 +502,10 @@ static const struct omap_dss_device_ops dsicm_ops = {
>  	.connect	= dsicm_connect,
>  	.disconnect	= dsicm_disconnect,
>  
> +	.pre_enable	= dsicm_pre_enable,
>  	.enable		= dsicm_enable,
>  	.disable	= dsicm_disable,
> +	.post_disable	= dsicm_post_disable,
>  
>  	.get_modes	= dsicm_get_modes,
>  	.check_timings	= dsicm_check_timings,
> @@ -664,8 +666,6 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>  
>  	omapdss_device_unregister(dssdev);
>  
> -	if (omapdss_device_is_enabled(dssdev))
> -		dsicm_disable(dssdev);
>  	omapdss_device_disconnect(ddata->src, dssdev);
>  
>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index 18a79dde6815..10abe4d01b0b 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -137,15 +137,11 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
>  	omapdss_device_disable(dssdev->next);
>  
>  	/*
> -	 * Disable the internal encoder. This will disable the DSS output. The
> -	 * DSI is treated as an exception as DSI pipelines still use the legacy
> -	 * flow where the pipeline output controls the encoder.
> +	 * Disable the internal encoder. This will disable the DSS output.
>  	 */

You could write this

	/* Disable the internal encoder. This will disable the DSS output. */

Same below.

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

> -	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
> -		if (dssdev->ops && dssdev->ops->disable)
> -			dssdev->ops->disable(dssdev);
> -		dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> -	}
> +	if (dssdev->ops && dssdev->ops->disable)
> +		dssdev->ops->disable(dssdev);
> +	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
>  
>  	/*
>  	 * Perform the post-disable operations on the chain of external devices
> @@ -166,15 +162,11 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
>  	omapdss_device_pre_enable(dssdev->next);
>  
>  	/*
> -	 * Enable the internal encoder. This will enable the DSS output. The
> -	 * DSI is treated as an exception as DSI pipelines still use the legacy
> -	 * flow where the pipeline output controls the encoder.
> +	 * Enable the internal encoder. This will enable the DSS output.
>  	 */
> -	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
> -		if (dssdev->ops && dssdev->ops->enable)
> -			dssdev->ops->enable(dssdev);
> -		dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
> -	}
> +	if (dssdev->ops && dssdev->ops->enable)
> +		dssdev->ops->enable(dssdev);
> +	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
>  
>  	/*
>  	 * Enable the chain of external devices, starting at the one at the

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 32/56] drm/omap: dsi: drop custom panel capability support
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 10:20     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:20 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:09PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Due to previous changes the DSI encoder gets the capabilities
> via DSI client's mode_flags and no longer needs the omapdss
> specific caps. The core code now checks if the DSI encoder
> is actually configured into command mode instead of just checking
> the panel capabilities.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  3 ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c               |  8 ++++++++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h           |  8 +-------
>  drivers/gpu/drm/omapdrm/omap_crtc.c             | 17 ++++++++---------
>  4 files changed, 17 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 45d417870498..d9b3444b4faf 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -599,9 +599,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	dssdev->of_port = 0;
>  	dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
>  
> -	dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
> -		OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;
> -
>  	omapdss_display_init(dssdev);
>  	omapdss_device_register(dssdev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 0aa0d21cf896..620cef8bb1f2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4727,6 +4727,13 @@ static bool dsi_vm_calc(struct dsi_data *dsi,
>  			dsi_vm_calc_pll_cb, ctx);
>  }
>  
> +static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +
> +	return (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE);

No need for parentheses.

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

> +}
> +
>  static int dsi_set_config(struct omap_dss_device *dssdev,
>  		const struct omap_dss_dsi_config *config)
>  {
> @@ -4947,6 +4954,7 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.disable_video_output = dsi_disable_video_output,
>  
>  		.update = dsi_update_all,
> +		.is_video_mode = dsi_is_video_mode,
>  	},
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index de4c779c358a..4200611525d5 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -123,11 +123,6 @@ enum omap_dss_dsi_mode {
>  	OMAP_DSS_DSI_VIDEO_MODE,
>  };
>  
> -enum omap_display_caps {
> -	OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE	= 1 << 0,
> -	OMAP_DSS_DISPLAY_CAP_TEAR_ELIM		= 1 << 1,
> -};
> -
>  enum omap_dss_display_state {
>  	OMAP_DSS_DISPLAY_DISABLED = 0,
>  	OMAP_DSS_DISPLAY_ACTIVE,
> @@ -282,6 +277,7 @@ struct omap_dss_writeback_info {
>  
>  struct omapdss_dsi_ops {
>  	int (*update)(struct omap_dss_device *dssdev);
> +	bool (*is_video_mode)(struct omap_dss_device *dssdev);
>  
>  	/* legacy API used by omapdss panels */
>  	int (*set_config)(struct omap_dss_device *dssdev,
> @@ -354,8 +350,6 @@ struct omap_dss_device {
>  	unsigned long ops_flags;
>  	u32 bus_flags;
>  
> -	enum omap_display_caps caps;
> -
>  	enum omap_dss_display_state state;
>  
>  	/* OMAP DSS output specific fields */
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 3068e4fffa16..f6b968060cf0 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -496,8 +496,7 @@ static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
>  	 * valid DISPC mode. DSI will calculate and configure the
>  	 * proper DISPC mode later.
>  	 */
> -	if (omap_crtc->pipe->output->next == NULL ||
> -	    omap_crtc->pipe->output->next->type != OMAP_DISPLAY_TYPE_DSI) {
> +	if (omap_crtc->pipe->output->type != OMAP_DISPLAY_TYPE_DSI) {
>  		r = priv->dispc_ops->mgr_check_timings(priv->dispc,
>  						       omap_crtc->channel,
>  						       &vm);
> @@ -549,17 +548,17 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc)
>  static bool omap_crtc_is_manually_updated(struct drm_crtc *crtc)
>  {
>  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> -	struct omap_dss_device *display = omap_crtc->pipe->output->next;
> +	struct omap_dss_device *dssdev = omap_crtc->pipe->output;
>  
> -	if (!display)
> +	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
> +	    !dssdev->ops->dsi.is_video_mode)
>  		return false;
>  
> -	if (display->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) {
> -		DBG("detected manually updated display!");
> -		return true;
> -	}
> +	if (dssdev->ops->dsi.is_video_mode(dssdev))
> +		return false;
>  
> -	return false;
> +	DBG("detected manually updated display!");
> +	return true;
>  }
>  
>  static int omap_crtc_atomic_check(struct drm_crtc *crtc,

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 32/56] drm/omap: dsi: drop custom panel capability support
@ 2020-11-09 10:20     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:20 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:09PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Due to previous changes the DSI encoder gets the capabilities
> via DSI client's mode_flags and no longer needs the omapdss
> specific caps. The core code now checks if the DSI encoder
> is actually configured into command mode instead of just checking
> the panel capabilities.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  3 ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c               |  8 ++++++++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h           |  8 +-------
>  drivers/gpu/drm/omapdrm/omap_crtc.c             | 17 ++++++++---------
>  4 files changed, 17 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 45d417870498..d9b3444b4faf 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -599,9 +599,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	dssdev->of_port = 0;
>  	dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
>  
> -	dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
> -		OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;
> -
>  	omapdss_display_init(dssdev);
>  	omapdss_device_register(dssdev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 0aa0d21cf896..620cef8bb1f2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4727,6 +4727,13 @@ static bool dsi_vm_calc(struct dsi_data *dsi,
>  			dsi_vm_calc_pll_cb, ctx);
>  }
>  
> +static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +
> +	return (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE);

No need for parentheses.

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

> +}
> +
>  static int dsi_set_config(struct omap_dss_device *dssdev,
>  		const struct omap_dss_dsi_config *config)
>  {
> @@ -4947,6 +4954,7 @@ static const struct omap_dss_device_ops dsi_ops = {
>  		.disable_video_output = dsi_disable_video_output,
>  
>  		.update = dsi_update_all,
> +		.is_video_mode = dsi_is_video_mode,
>  	},
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index de4c779c358a..4200611525d5 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -123,11 +123,6 @@ enum omap_dss_dsi_mode {
>  	OMAP_DSS_DSI_VIDEO_MODE,
>  };
>  
> -enum omap_display_caps {
> -	OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE	= 1 << 0,
> -	OMAP_DSS_DISPLAY_CAP_TEAR_ELIM		= 1 << 1,
> -};
> -
>  enum omap_dss_display_state {
>  	OMAP_DSS_DISPLAY_DISABLED = 0,
>  	OMAP_DSS_DISPLAY_ACTIVE,
> @@ -282,6 +277,7 @@ struct omap_dss_writeback_info {
>  
>  struct omapdss_dsi_ops {
>  	int (*update)(struct omap_dss_device *dssdev);
> +	bool (*is_video_mode)(struct omap_dss_device *dssdev);
>  
>  	/* legacy API used by omapdss panels */
>  	int (*set_config)(struct omap_dss_device *dssdev,
> @@ -354,8 +350,6 @@ struct omap_dss_device {
>  	unsigned long ops_flags;
>  	u32 bus_flags;
>  
> -	enum omap_display_caps caps;
> -
>  	enum omap_dss_display_state state;
>  
>  	/* OMAP DSS output specific fields */
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 3068e4fffa16..f6b968060cf0 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -496,8 +496,7 @@ static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
>  	 * valid DISPC mode. DSI will calculate and configure the
>  	 * proper DISPC mode later.
>  	 */
> -	if (omap_crtc->pipe->output->next == NULL ||
> -	    omap_crtc->pipe->output->next->type != OMAP_DISPLAY_TYPE_DSI) {
> +	if (omap_crtc->pipe->output->type != OMAP_DISPLAY_TYPE_DSI) {
>  		r = priv->dispc_ops->mgr_check_timings(priv->dispc,
>  						       omap_crtc->channel,
>  						       &vm);
> @@ -549,17 +548,17 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc)
>  static bool omap_crtc_is_manually_updated(struct drm_crtc *crtc)
>  {
>  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> -	struct omap_dss_device *display = omap_crtc->pipe->output->next;
> +	struct omap_dss_device *dssdev = omap_crtc->pipe->output;
>  
> -	if (!display)
> +	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
> +	    !dssdev->ops->dsi.is_video_mode)
>  		return false;
>  
> -	if (display->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) {
> -		DBG("detected manually updated display!");
> -		return true;
> -	}
> +	if (dssdev->ops->dsi.is_video_mode(dssdev))
> +		return false;
>  
> -	return false;
> +	DBG("detected manually updated display!");
> +	return true;
>  }
>  
>  static int omap_crtc_atomic_check(struct drm_crtc *crtc,

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-09  9:30                     ` H. Nikolaus Schaller
@ 2020-11-09 10:22                       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09 10:22 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren

On 09/11/2020 11:30, H. Nikolaus Schaller wrote:
> 
>> Am 09.11.2020 um 09:04 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>
>> On 07/11/2020 14:19, H. Nikolaus Schaller wrote:
>>
>>> I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
>>> the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().
>>>
>>> I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
>>> And hopefully we are close to push the panel driver for review. And in a second step some device
>>> tree for the Pyra.
>>>
>>> The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel
>>
>> Ok, good. Do you have a link the previous driver that works (omapdrm specific panel driver)? I think
>> it's good to have that as a reference.
> 
> Yes, here:
> 
> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/panels

Ok. The old driver uses two separate VC configurations (request_vc calls), so it may not work with
this series. I think we need to implement logic to the dsi driver to somehow handle this kind of setup.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-09 10:22                       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09 10:22 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

On 09/11/2020 11:30, H. Nikolaus Schaller wrote:
> 
>> Am 09.11.2020 um 09:04 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>
>> On 07/11/2020 14:19, H. Nikolaus Schaller wrote:
>>
>>> I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
>>> the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().
>>>
>>> I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
>>> And hopefully we are close to push the panel driver for review. And in a second step some device
>>> tree for the Pyra.
>>>
>>> The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel
>>
>> Ok, good. Do you have a link the previous driver that works (omapdrm specific panel driver)? I think
>> it's good to have that as a reference.
> 
> Yes, here:
> 
> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/panels

Ok. The old driver uses two separate VC configurations (request_vc calls), so it may not work with
this series. I think we need to implement logic to the dsi driver to somehow handle this kind of setup.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-09 10:22                       ` Tomi Valkeinen
@ 2020-11-09 10:31                         ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-09 10:31 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren


> Am 09.11.2020 um 11:22 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 09/11/2020 11:30, H. Nikolaus Schaller wrote:
>> 
>>> Am 09.11.2020 um 09:04 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> 
>>> On 07/11/2020 14:19, H. Nikolaus Schaller wrote:
>>> 
>>>> I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
>>>> the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().
>>>> 
>>>> I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
>>>> And hopefully we are close to push the panel driver for review. And in a second step some device
>>>> tree for the Pyra.
>>>> 
>>>> The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel
>>> 
>>> Ok, good. Do you have a link the previous driver that works (omapdrm specific panel driver)? I think
>>> it's good to have that as a reference.
>> 
>> Yes, here:
>> 
>> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/panels
> 
> Ok. The old driver uses two separate VC configurations (request_vc calls),

yes indeed. I was not sure how to handle this with the new omapdrm drivers.

> so it may not work with
> this series. I think we need to implement logic to the dsi driver to somehow handle this kind of setup.

I see.
Anyways there is missing some simple thing which makes the driver not prepared/enabled.
Or is this related to VC?

BR and thanks,
Nikolaus



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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-09 10:31                         ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-09 10:31 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar


> Am 09.11.2020 um 11:22 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 09/11/2020 11:30, H. Nikolaus Schaller wrote:
>> 
>>> Am 09.11.2020 um 09:04 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> 
>>> On 07/11/2020 14:19, H. Nikolaus Schaller wrote:
>>> 
>>>> I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
>>>> the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().
>>>> 
>>>> I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
>>>> And hopefully we are close to push the panel driver for review. And in a second step some device
>>>> tree for the Pyra.
>>>> 
>>>> The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel
>>> 
>>> Ok, good. Do you have a link the previous driver that works (omapdrm specific panel driver)? I think
>>> it's good to have that as a reference.
>> 
>> Yes, here:
>> 
>> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/panels
> 
> Ok. The old driver uses two separate VC configurations (request_vc calls),

yes indeed. I was not sure how to handle this with the new omapdrm drivers.

> so it may not work with
> this series. I think we need to implement logic to the dsi driver to somehow handle this kind of setup.

I see.
Anyways there is missing some simple thing which makes the driver not prepared/enabled.
Or is this related to VC?

BR and thanks,
Nikolaus


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-09 10:31                         ` H. Nikolaus Schaller
@ 2020-11-09 10:34                           ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09 10:34 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren

On 09/11/2020 12:31, H. Nikolaus Schaller wrote:
> 
>> Am 09.11.2020 um 11:22 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>
>> On 09/11/2020 11:30, H. Nikolaus Schaller wrote:
>>>
>>>> Am 09.11.2020 um 09:04 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>>
>>>> On 07/11/2020 14:19, H. Nikolaus Schaller wrote:
>>>>
>>>>> I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
>>>>> the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().
>>>>>
>>>>> I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
>>>>> And hopefully we are close to push the panel driver for review. And in a second step some device
>>>>> tree for the Pyra.
>>>>>
>>>>> The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel
>>>>
>>>> Ok, good. Do you have a link the previous driver that works (omapdrm specific panel driver)? I think
>>>> it's good to have that as a reference.
>>>
>>> Yes, here:
>>>
>>> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/panels
>>
>> Ok. The old driver uses two separate VC configurations (request_vc calls),
> 
> yes indeed. I was not sure how to handle this with the new omapdrm drivers.
> 
>> so it may not work with
>> this series. I think we need to implement logic to the dsi driver to somehow handle this kind of setup.
> 
> I see.
> Anyways there is missing some simple thing which makes the driver not prepared/enabled.
> Or is this related to VC?

No, that's not related to the VC.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-09 10:34                           ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09 10:34 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

On 09/11/2020 12:31, H. Nikolaus Schaller wrote:
> 
>> Am 09.11.2020 um 11:22 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>
>> On 09/11/2020 11:30, H. Nikolaus Schaller wrote:
>>>
>>>> Am 09.11.2020 um 09:04 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>>
>>>> On 07/11/2020 14:19, H. Nikolaus Schaller wrote:
>>>>
>>>>> I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
>>>>> the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().
>>>>>
>>>>> I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
>>>>> And hopefully we are close to push the panel driver for review. And in a second step some device
>>>>> tree for the Pyra.
>>>>>
>>>>> The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel
>>>>
>>>> Ok, good. Do you have a link the previous driver that works (omapdrm specific panel driver)? I think
>>>> it's good to have that as a reference.
>>>
>>> Yes, here:
>>>
>>> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/panels
>>
>> Ok. The old driver uses two separate VC configurations (request_vc calls),
> 
> yes indeed. I was not sure how to handle this with the new omapdrm drivers.
> 
>> so it may not work with
>> this series. I think we need to implement logic to the dsi driver to somehow handle this kind of setup.
> 
> I see.
> Anyways there is missing some simple thing which makes the driver not prepared/enabled.
> Or is this related to VC?

No, that's not related to the VC.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 33/56] drm/omap: dsi: convert to drm_panel
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 10:39     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:39 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On Thu, Nov 05, 2020 at 02:03:10PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This converts the DSI module to expect common drm_panel display
> drivers instead of dssdev based ones.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 204 +++++++-----------
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 133 ++++++++++--
>  .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |   1 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |   8 -
>  4 files changed, 189 insertions(+), 157 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index d9b3444b4faf..3668b3f0aff2 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -6,8 +6,6 @@
>   * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
>   */
>  
> -/* #define DEBUG */
> -
>  #include <linux/backlight.h>
>  #include <linux/delay.h>
>  #include <linux/gpio/consumer.h>
> @@ -20,11 +18,14 @@
>  #include <linux/regulator/consumer.h>
>  
>  #include <drm/drm_connector.h>
> +#include <drm/drm_mipi_dsi.h>
> +#include <drm/drm_panel.h>
> +#include <drm/drm_modes.h>

Alphabetically ordered please.

>  
> +#include <video/display_timing.h>
>  #include <video/mipi_display.h>
>  #include <video/of_display_timing.h>
> -
> -#include "../dss/omapdss.h"
> +#include <video/videomode.h>
>  
>  #define DCS_READ_NUM_ERRORS	0x05
>  #define DCS_GET_ID1		0xda
> @@ -35,11 +36,8 @@
>  
>  struct panel_drv_data {
>  	struct mipi_dsi_device *dsi;
> -
> -	struct omap_dss_device dssdev;
> -	struct omap_dss_device *src;
> -
> -	struct videomode vm;
> +	struct drm_panel panel;
> +	struct drm_display_mode mode;
>  
>  	struct mutex lock;
>  
> @@ -71,7 +69,11 @@ struct panel_drv_data {
>  	bool ulps_enabled;
>  };
>  
> -#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
> +

A single blank line is enough.

> +static inline struct panel_drv_data *panel_to_ddata(struct drm_panel *panel)
> +{
> +	return container_of(panel, struct panel_drv_data, panel);
> +}
>  
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>  
> @@ -285,7 +287,6 @@ static void dsicm_hw_reset(struct panel_drv_data *ddata)
>  
>  static int dsicm_power_on(struct panel_drv_data *ddata)
>  {
> -	struct omap_dss_device *src = ddata->src;
>  	u8 id1, id2, id3;
>  	int r;
>  
> @@ -322,10 +323,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (r)
>  		goto err;
>  
> -	r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
> -	if (r)
> -		goto err;
> -
>  	ddata->enabled = true;
>  
>  	if (!ddata->intro_printed) {
> @@ -345,15 +342,12 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	return r;
>  }
>  
> -static void dsicm_power_off(struct panel_drv_data *ddata)
> +static int dsicm_power_off(struct panel_drv_data *ddata)
>  {
> -	struct omap_dss_device *src = ddata->src;
>  	int r;
>  
>  	ddata->enabled = false;
>  
> -	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
> -
>  	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
>  	if (!r)
>  		r = dsicm_sleep_in(ddata);
> @@ -363,51 +357,25 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  				"error disabling panel, issuing HW reset\n");
>  		dsicm_hw_reset(ddata);
>  	}
> -}
> -
> -static int dsicm_connect(struct omap_dss_device *src,
> -			 struct omap_dss_device *dst)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dst);
> -
> -	ddata->src = src;
> -	return 0;
> -}
> -
> -static void dsicm_disconnect(struct omap_dss_device *src,
> -			     struct omap_dss_device *dst)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dst);
>  
> -	ddata->src = NULL;
> +	return r;
>  }
>  
> -static void dsicm_pre_enable(struct omap_dss_device *dssdev)
> +static int dsicm_prepare(struct drm_panel *panel)
>  {
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>  	int r;
> -	struct omap_dss_dsi_config dsi_config = {
> -		.vm = &ddata->vm,
> -		.hs_clk_min = 150000000,
> -		.hs_clk_max = 300000000,
> -		.lp_clk_min = 7000000,
> -		.lp_clk_max = 10000000,
> -	};
>  
>  	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>  	if (r)
>  		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
>  
> -	r = src->ops->dsi.set_config(src, &dsi_config);
> -	if (r) {
> -		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
> -	}
> +	return r;
>  }
>  
> -static void dsicm_enable(struct omap_dss_device *dssdev)
> +static int dsicm_enable(struct drm_panel *panel)
>  {
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>  	int r;
>  
>  	mutex_lock(&ddata->lock);
> @@ -420,33 +388,39 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>  
>  	dsicm_bl_power(ddata, true);
>  
> -	return;
> +	return 0;
>  err:
> -	dev_dbg(&ddata->dsi->dev, "enable failed (%d)\n", r);
> +	dev_err(&ddata->dsi->dev, "enable failed (%d)\n", r);
>  	mutex_unlock(&ddata->lock);
> +	return r;
> +}
> +
> +static int dsicm_unprepare(struct drm_panel *panel)
> +{
> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
> +	int r;
> +
> +	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> +	if (r)
> +		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
> +
> +	return r;
>  }
>  
> -static void dsicm_disable(struct omap_dss_device *dssdev)
> +static int dsicm_disable(struct drm_panel *panel)
>  {
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
> +	int r;
>  
>  	dsicm_bl_power(ddata, false);
>  
>  	mutex_lock(&ddata->lock);
>  
> -	dsicm_power_off(ddata);
> +	r = dsicm_power_off(ddata);
>  
>  	mutex_unlock(&ddata->lock);
> -}
> -
> -static void dsicm_post_disable(struct omap_dss_device *dssdev)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	int r;
>  
> -	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> -	if (r)
> -		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
> +	return r;
>  }
>  
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
> @@ -465,50 +439,37 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  	return r;
>  }
>  
> -static int dsicm_get_modes(struct omap_dss_device *dssdev,
> +static int dsicm_get_modes(struct drm_panel *panel,
>  			   struct drm_connector *connector)
>  {
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
> +	struct drm_display_mode *mode;
> +
> +	mode = drm_mode_duplicate(connector->dev, &ddata->mode);
> +	if (!mode) {
> +		dev_err(&ddata->dsi->dev, "failed to add mode %ux%ux@%u kHz\n",
> +			ddata->mode.hdisplay, ddata->mode.vdisplay,
> +			ddata->mode.clock);
> +		return -ENOMEM;
> +	}
> +
> +	drm_mode_set_name(mode);
> +	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>  
>  	connector->display_info.width_mm = ddata->width_mm;
>  	connector->display_info.height_mm = ddata->height_mm;
>  
> -	return omapdss_display_get_modes(connector, &ddata->vm);
> -}
> -
> -static int dsicm_check_timings(struct omap_dss_device *dssdev,
> -			       struct drm_display_mode *mode)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	int ret = 0;
> -
> -	if (mode->hdisplay != ddata->vm.hactive)
> -		ret = -EINVAL;
> -
> -	if (mode->vdisplay != ddata->vm.vactive)
> -		ret = -EINVAL;
> +	drm_mode_probed_add(connector, mode);
>  
> -	if (ret) {
> -		dev_warn(dssdev->dev, "wrong resolution: %d x %d",
> -			 mode->hdisplay, mode->vdisplay);
> -		dev_warn(dssdev->dev, "panel resolution: %d x %d",
> -			 ddata->vm.hactive, ddata->vm.vactive);
> -	}
> -
> -	return ret;
> +	return 1;
>  }
>  
> -static const struct omap_dss_device_ops dsicm_ops = {
> -	.connect	= dsicm_connect,
> -	.disconnect	= dsicm_disconnect,
> -
> -	.pre_enable	= dsicm_pre_enable,
> -	.enable		= dsicm_enable,
> -	.disable	= dsicm_disable,
> -	.post_disable	= dsicm_post_disable,
> -
> -	.get_modes	= dsicm_get_modes,
> -	.check_timings	= dsicm_check_timings,
> +static const struct drm_panel_funcs dsicm_panel_funcs = {
> +	.unprepare = dsicm_unprepare,
> +	.disable = dsicm_disable,
> +	.prepare = dsicm_prepare,
> +	.enable = dsicm_enable,
> +	.get_modes = dsicm_get_modes,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> @@ -517,8 +478,12 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  	struct backlight_device *backlight;
>  	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>  	struct display_timing timing;
> +	struct videomode vm = { 0 };

How about

	struct videomode vm = {
		.hactive = 864,
		.vactive = 480,
	};

>  	int err;
>  
> +	vm.hactive = 864;
> +	vm.vactive = 480;
> +
>  	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
>  	if (IS_ERR(ddata->reset_gpio)) {
>  		err = PTR_ERR(ddata->reset_gpio);
> @@ -528,15 +493,16 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  
>  	err = of_get_display_timing(node, "panel-timing", &timing);
>  	if (!err) {
> -		videomode_from_timing(&timing, &ddata->vm);
> -		if (!ddata->vm.pixelclock)
> -			ddata->vm.pixelclock =
> -				ddata->vm.hactive * ddata->vm.vactive * 60;
> +		videomode_from_timing(&timing, &vm);
>  	} else {
>  		dev_warn(&dsi->dev,
>  			 "failed to get video timing, using defaults\n");
>  	}
>  
> +	if (!vm.pixelclock)
> +		vm.pixelclock = vm.hactive * vm.vactive * 60;
> +	drm_display_mode_from_videomode(&vm, &ddata->mode);
> +
>  	ddata->width_mm = 0;
>  	of_property_read_u32(node, "width-mm", &ddata->width_mm);
>  
> @@ -570,7 +536,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	struct panel_drv_data *ddata;
>  	struct backlight_device *bldev = NULL;
>  	struct device *dev = &dsi->dev;
> -	struct omap_dss_device *dssdev;
>  	int r;
>  
>  	dev_dbg(dev, "probe\n");
> @@ -582,30 +547,17 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	mipi_dsi_set_drvdata(dsi, ddata);
>  	ddata->dsi = dsi;
>  
> -	ddata->vm.hactive = 864;
> -	ddata->vm.vactive = 480;
> -	ddata->vm.pixelclock = 864 * 480 * 60;
> -
>  	r = dsicm_probe_of(dsi);
>  	if (r)
>  		return r;
>  
> -	dssdev = &ddata->dssdev;
> -	dssdev->dev = dev;
> -	dssdev->ops = &dsicm_ops;
> -	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
> -	dssdev->display = true;
> -	dssdev->owner = THIS_MODULE;
> -	dssdev->of_port = 0;
> -	dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
> -
> -	omapdss_display_init(dssdev);
> -	omapdss_device_register(dssdev);
> -
>  	mutex_init(&ddata->lock);
>  
>  	dsicm_hw_reset(ddata);
>  
> +	drm_panel_init(&ddata->panel, dev, &dsicm_panel_funcs,
> +		       DRM_MODE_CONNECTOR_DSI);
> +
>  	if (ddata->use_dsi_backlight) {
>  		struct backlight_properties props = { 0 };
>  		props.max_brightness = 255;
> @@ -637,6 +589,8 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	if (ddata->ulps_enabled)
>  		dsi->mode_flags |= MIPI_DSI_MODE_ULPS_IDLE;
>  
> +	drm_panel_add(&ddata->panel);
> +
>  	r = mipi_dsi_attach(dsi);
>  	if (r < 0)
>  		goto err_dsi_attach;
> @@ -644,6 +598,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	return 0;
>  
>  err_dsi_attach:
> +	drm_panel_remove(&ddata->panel);
>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>  err_bl:
>  	if (ddata->extbldev)
> @@ -655,15 +610,12 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>  {
>  	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
> -	struct omap_dss_device *dssdev = &ddata->dssdev;
>  
>  	dev_dbg(&dsi->dev, "remove\n");
>  
>  	mipi_dsi_detach(dsi);
>  
> -	omapdss_device_unregister(dssdev);
> -
> -	omapdss_device_disconnect(ddata->src, dssdev);
> +	drm_panel_remove(&ddata->panel);
>  
>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>  
> @@ -677,7 +629,7 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>  }
>  
>  static const struct of_device_id dsicm_of_match[] = {
> -	{ .compatible = "omapdss,panel-dsi-cm", },
> +	{ .compatible = "panel-dsi-cm", },
>  	{},
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 620cef8bb1f2..a1a867a7d91d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -36,6 +36,7 @@
>  #include <linux/sys_soc.h>
>  
>  #include <drm/drm_mipi_dsi.h>
> +#include <drm/drm_panel.h>
>  #include <video/mipi_display.h>
>  
>  #include "omapdss.h"
> @@ -217,6 +218,8 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
>  static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
>  				       const struct mipi_dsi_msg *msg);
>  
> +static void dsi_display_disable(struct omap_dss_device *dssdev);
> +

Could you reorder functions to avoid forward-declarations ? This can be
done on top if it generates annoying conflicts.

>  /* DSI PLL HSDIV indices */
>  #define HSDIV_DISPC	0
>  #define HSDIV_DSI	1
> @@ -383,6 +386,7 @@ struct dsi_data {
>  	bool te_enabled;
>  	bool ulps_enabled;
>  	bool ulps_auto_idle;
> +	bool video_enabled;
>  
>  	struct delayed_work ulps_work;
>  
> @@ -423,6 +427,8 @@ struct dsi_data {
>  
>  	unsigned int scp_clk_refcount;
>  
> +	struct omap_dss_dsi_config config;
> +
>  	struct dss_lcd_mgr_config mgr_config;
>  	struct videomode vm;
>  	enum mipi_dsi_pixel_format pix_fmt;
> @@ -3622,7 +3628,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>  	return 0;
>  }
>  
> -static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
> +static void dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
> @@ -3631,8 +3637,10 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>  	int r;
>  
>  	r = dsi_display_init_dispc(dsi);
> -	if (r)
> -		return r;
> +	if (r) {
> +		dev_err(dsi->dev, "failed to init dispc!\n");
> +		return;
> +	}
>  
>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
>  		switch (dsi->pix_fmt) {
> @@ -3672,7 +3680,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>  	if (r)
>  		goto err_mgr_enable;
>  
> -	return 0;
> +	return;
>  
>  err_mgr_enable:
>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
> @@ -3681,7 +3689,8 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>  	}
>  err_pix_fmt:
>  	dsi_display_uninit_dispc(dsi);
> -	return r;
> +	dev_err(dsi->dev, "failed to enable DSI encoder!\n");
> +	return;
>  }
>  
>  static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel)
> @@ -3704,6 +3713,25 @@ static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel
>  	dsi_display_uninit_dispc(dsi);
>  }
>  
> +static void dsi_disable_video_outputs(struct omap_dss_device *dssdev)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	int i;
> +
> +	dsi_bus_lock(dsi);
> +	dsi->video_enabled = false;
> +
> +	for (i = 0; i < 3; i++) {
> +		if (!dsi->vc[i].dest)
> +			continue;
> +		dsi_disable_video_output(dssdev, i);
> +	}
> +
> +	dsi_display_disable(dssdev);
> +
> +	dsi_bus_unlock(dsi);
> +}
> +
>  static void dsi_update_screen_dispc(struct dsi_data *dsi)
>  {
>  	unsigned int bytespp;
> @@ -3897,6 +3925,11 @@ static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
>  
>  	dsi_bus_lock(dsi);
>  
> +	if (!dsi->video_enabled) {
> +		r = -EIO;
> +		goto err;
> +	}
> +
>  	if (!dsi->vc[channel].dest) {
>  		r = -ENODEV;
>  		goto err;
> @@ -3942,7 +3975,7 @@ static int dsi_update_all(struct omap_dss_device *dssdev)
>  
>  	for (i = 0; i < 4; i++) {
>  		r = dsi_update_channel(dssdev, i);
> -		if (r != -ENODEV)
> +		if (r && r != -ENODEV)

Does this belong to this patch ? I haven't flagged it when reviwing the
patch that introduced this code, assuming that you meant to exit from
the loop once a channel with a client is found, given that we don't
support multiple clients. In any case this should be coordinated with
dsi_enable_video_outputs() and dsi_disable_video_outputs(), all should
stop on the first client, or loop over all clients.

>  			return r;
>  	}
>  
> @@ -4165,8 +4198,30 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	DSSDBG("dsi_display_enable\n");
> -	dsi_bus_lock(dsi);
> +	WARN_ON(!dsi_bus_is_locked(dsi));
> +
>  	dsi_display_ulps_enable(dsi);
> +}
> +
> +static void dsi_enable_video_outputs(struct omap_dss_device *dssdev)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	int i;

i should be unsigned.

> +
> +	dsi_bus_lock(dsi);
> +
> +	dsi_display_enable(dssdev);
> +
> +	for (i = 0; i < 3; i++) {
> +		if (!dsi->vc[i].dest)
> +			continue;
> +		dsi_enable_video_output(dssdev, i);
> +	}
> +
> +	dsi->video_enabled = true;
> +
> +	dsi_set_ulps_auto(dsi, true);
> +
>  	dsi_bus_unlock(dsi);
>  }
>  
> @@ -4193,11 +4248,11 @@ static void dsi_display_disable(struct omap_dss_device *dssdev)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  
> +	WARN_ON(!dsi_bus_is_locked(dsi));
> +
>  	DSSDBG("dsi_display_disable\n");
>  
> -	dsi_bus_lock(dsi);
>  	dsi_display_ulps_disable(dsi, true, false);
> -	dsi_bus_unlock(dsi);
>  }
>  
>  static int dsi_enable_te(struct dsi_data *dsi, bool enable)
> @@ -4735,14 +4790,18 @@ static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
>  }
>  
>  static int dsi_set_config(struct omap_dss_device *dssdev,
> -		const struct omap_dss_dsi_config *config)
> +		const struct drm_display_mode *mode)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	struct dsi_clk_calc_ctx ctx;
> -	struct omap_dss_dsi_config cfg = *config;
> +	struct videomode vm;
> +	struct omap_dss_dsi_config cfg = dsi->config;
>  	bool ok;
>  	int r;
>  
> +	drm_display_mode_to_videomode(mode, &vm);
> +	cfg.vm = &vm;
> +
>  	mutex_lock(&dsi->lock);
>  
>  	cfg.mode = dsi->mode;
> @@ -4906,9 +4965,15 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  	int r;
>  
>  	dsi_bus_lock(dsi);
> -	dsi_set_ulps_auto(dsi, false);
> -	r = _omap_dsi_host_transfer(dsi, msg);
> -	dsi_set_ulps_auto(dsi, true);
> +
> +	if (dsi->video_enabled) {
> +		dsi_set_ulps_auto(dsi, false);
> +		r = _omap_dsi_host_transfer(dsi, msg);
> +		dsi_set_ulps_auto(dsi, true);
> +	} else {
> +		r = -EIO;
> +	}
> +
>  	dsi_bus_unlock(dsi);
>  
>  	return r;
> @@ -4929,6 +4994,23 @@ static int dsi_get_clocks(struct dsi_data *dsi)
>  	return 0;
>  }
>  
> +static void dsi_set_timings(struct omap_dss_device *dssdev,
> +			    const struct drm_display_mode *mode)
> +{
> +	DSSDBG("dsi_set_timings\n");
> +	dsi_set_config(dssdev, mode);
> +}
> +
> +static int dsi_check_timings(struct omap_dss_device *dssdev,
> +			     struct drm_display_mode *mode)
> +{
> +	DSSDBG("dsi_check_timings\n");
> +
> +	/* TODO */
> +
> +	return 0;
> +}
> +
>  static int dsi_connect(struct omap_dss_device *src,
>  		       struct omap_dss_device *dst)
>  {
> @@ -4944,15 +5026,13 @@ static void dsi_disconnect(struct omap_dss_device *src,
>  static const struct omap_dss_device_ops dsi_ops = {
>  	.connect = dsi_connect,
>  	.disconnect = dsi_disconnect,
> -	.enable = dsi_display_enable,
> -	.disable = dsi_display_disable,
> -
> -	.dsi = {
> -		.set_config = dsi_set_config,
> +	.enable = dsi_enable_video_outputs,
> +	.disable = dsi_disable_video_outputs,
>  
> -		.enable_video_output = dsi_enable_video_output,
> -		.disable_video_output = dsi_disable_video_output,
> +	.check_timings = dsi_check_timings,
> +	.set_timings = dsi_set_timings,
>  
> +	.dsi = {
>  		.update = dsi_update_all,
>  		.is_video_mode = dsi_is_video_mode,
>  	},
> @@ -5040,6 +5120,7 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  {
>  	struct dsi_data *dsi = host_to_omap(host);
>  	unsigned int channel = client->channel;
> +	struct drm_panel *panel;
>  	int r;
>  
>  	if (channel > 3)
> @@ -5057,6 +5138,10 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  
>  	dsi_bus_lock(dsi);
>  
> +	panel = of_drm_find_panel(client->dev.of_node);
> +	if (IS_ERR(panel))
> +		return PTR_ERR(panel);

Is it intended that the panel isn't used ?

> +
>  	atomic_set(&dsi->do_ext_te_update, 0);
>  
>  	if (client->mode_flags & MIPI_DSI_MODE_VIDEO) {
> @@ -5077,8 +5162,12 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  	INIT_DEFERRABLE_WORK(&dsi->ulps_work,
>  			     omap_dsi_ulps_work_callback);
>  
> +	dsi->config.hs_clk_min = 150000000; // TODO: get from client?
> +	dsi->config.hs_clk_max = client->hs_rate;
> +	dsi->config.lp_clk_min = 7000000; // TODO: get from client?
> +	dsi->config.lp_clk_max = client->lp_rate;
> +
>  	dsi->ulps_auto_idle = !!(client->mode_flags & MIPI_DSI_MODE_ULPS_IDLE);
> -	dsi_set_ulps_auto(dsi, true);
>  
>  	dsi_bus_unlock(dsi);
>  	return 0;
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> index 72a7da7bfff1..18560ca4bbb0 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> @@ -174,7 +174,6 @@ static const struct of_device_id omapdss_of_match[] __initconst = {
>  };
>  
>  static const struct of_device_id omapdss_of_fixups_whitelist[] __initconst = {
> -	{ .compatible = "panel-dsi-cm" },
>  	{},
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 4200611525d5..3ee3063b6a2d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -278,14 +278,6 @@ struct omap_dss_writeback_info {
>  struct omapdss_dsi_ops {
>  	int (*update)(struct omap_dss_device *dssdev);
>  	bool (*is_video_mode)(struct omap_dss_device *dssdev);
> -
> -	/* legacy API used by omapdss panels */
> -	int (*set_config)(struct omap_dss_device *dssdev,
> -			const struct omap_dss_dsi_config *cfg);
> -
> -	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
> -	void (*disable_video_output)(struct omap_dss_device *dssdev,
> -			int channel);
>  };
>  
>  struct omap_dss_device_ops {

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 33/56] drm/omap: dsi: convert to drm_panel
@ 2020-11-09 10:39     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:39 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On Thu, Nov 05, 2020 at 02:03:10PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This converts the DSI module to expect common drm_panel display
> drivers instead of dssdev based ones.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 204 +++++++-----------
>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 133 ++++++++++--
>  .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |   1 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |   8 -
>  4 files changed, 189 insertions(+), 157 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index d9b3444b4faf..3668b3f0aff2 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -6,8 +6,6 @@
>   * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
>   */
>  
> -/* #define DEBUG */
> -
>  #include <linux/backlight.h>
>  #include <linux/delay.h>
>  #include <linux/gpio/consumer.h>
> @@ -20,11 +18,14 @@
>  #include <linux/regulator/consumer.h>
>  
>  #include <drm/drm_connector.h>
> +#include <drm/drm_mipi_dsi.h>
> +#include <drm/drm_panel.h>
> +#include <drm/drm_modes.h>

Alphabetically ordered please.

>  
> +#include <video/display_timing.h>
>  #include <video/mipi_display.h>
>  #include <video/of_display_timing.h>
> -
> -#include "../dss/omapdss.h"
> +#include <video/videomode.h>
>  
>  #define DCS_READ_NUM_ERRORS	0x05
>  #define DCS_GET_ID1		0xda
> @@ -35,11 +36,8 @@
>  
>  struct panel_drv_data {
>  	struct mipi_dsi_device *dsi;
> -
> -	struct omap_dss_device dssdev;
> -	struct omap_dss_device *src;
> -
> -	struct videomode vm;
> +	struct drm_panel panel;
> +	struct drm_display_mode mode;
>  
>  	struct mutex lock;
>  
> @@ -71,7 +69,11 @@ struct panel_drv_data {
>  	bool ulps_enabled;
>  };
>  
> -#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
> +

A single blank line is enough.

> +static inline struct panel_drv_data *panel_to_ddata(struct drm_panel *panel)
> +{
> +	return container_of(panel, struct panel_drv_data, panel);
> +}
>  
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>  
> @@ -285,7 +287,6 @@ static void dsicm_hw_reset(struct panel_drv_data *ddata)
>  
>  static int dsicm_power_on(struct panel_drv_data *ddata)
>  {
> -	struct omap_dss_device *src = ddata->src;
>  	u8 id1, id2, id3;
>  	int r;
>  
> @@ -322,10 +323,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (r)
>  		goto err;
>  
> -	r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
> -	if (r)
> -		goto err;
> -
>  	ddata->enabled = true;
>  
>  	if (!ddata->intro_printed) {
> @@ -345,15 +342,12 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	return r;
>  }
>  
> -static void dsicm_power_off(struct panel_drv_data *ddata)
> +static int dsicm_power_off(struct panel_drv_data *ddata)
>  {
> -	struct omap_dss_device *src = ddata->src;
>  	int r;
>  
>  	ddata->enabled = false;
>  
> -	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
> -
>  	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
>  	if (!r)
>  		r = dsicm_sleep_in(ddata);
> @@ -363,51 +357,25 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  				"error disabling panel, issuing HW reset\n");
>  		dsicm_hw_reset(ddata);
>  	}
> -}
> -
> -static int dsicm_connect(struct omap_dss_device *src,
> -			 struct omap_dss_device *dst)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dst);
> -
> -	ddata->src = src;
> -	return 0;
> -}
> -
> -static void dsicm_disconnect(struct omap_dss_device *src,
> -			     struct omap_dss_device *dst)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dst);
>  
> -	ddata->src = NULL;
> +	return r;
>  }
>  
> -static void dsicm_pre_enable(struct omap_dss_device *dssdev)
> +static int dsicm_prepare(struct drm_panel *panel)
>  {
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>  	int r;
> -	struct omap_dss_dsi_config dsi_config = {
> -		.vm = &ddata->vm,
> -		.hs_clk_min = 150000000,
> -		.hs_clk_max = 300000000,
> -		.lp_clk_min = 7000000,
> -		.lp_clk_max = 10000000,
> -	};
>  
>  	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>  	if (r)
>  		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
>  
> -	r = src->ops->dsi.set_config(src, &dsi_config);
> -	if (r) {
> -		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
> -	}
> +	return r;
>  }
>  
> -static void dsicm_enable(struct omap_dss_device *dssdev)
> +static int dsicm_enable(struct drm_panel *panel)
>  {
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>  	int r;
>  
>  	mutex_lock(&ddata->lock);
> @@ -420,33 +388,39 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>  
>  	dsicm_bl_power(ddata, true);
>  
> -	return;
> +	return 0;
>  err:
> -	dev_dbg(&ddata->dsi->dev, "enable failed (%d)\n", r);
> +	dev_err(&ddata->dsi->dev, "enable failed (%d)\n", r);
>  	mutex_unlock(&ddata->lock);
> +	return r;
> +}
> +
> +static int dsicm_unprepare(struct drm_panel *panel)
> +{
> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
> +	int r;
> +
> +	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> +	if (r)
> +		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
> +
> +	return r;
>  }
>  
> -static void dsicm_disable(struct omap_dss_device *dssdev)
> +static int dsicm_disable(struct drm_panel *panel)
>  {
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
> +	int r;
>  
>  	dsicm_bl_power(ddata, false);
>  
>  	mutex_lock(&ddata->lock);
>  
> -	dsicm_power_off(ddata);
> +	r = dsicm_power_off(ddata);
>  
>  	mutex_unlock(&ddata->lock);
> -}
> -
> -static void dsicm_post_disable(struct omap_dss_device *dssdev)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	int r;
>  
> -	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> -	if (r)
> -		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
> +	return r;
>  }
>  
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
> @@ -465,50 +439,37 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  	return r;
>  }
>  
> -static int dsicm_get_modes(struct omap_dss_device *dssdev,
> +static int dsicm_get_modes(struct drm_panel *panel,
>  			   struct drm_connector *connector)
>  {
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
> +	struct drm_display_mode *mode;
> +
> +	mode = drm_mode_duplicate(connector->dev, &ddata->mode);
> +	if (!mode) {
> +		dev_err(&ddata->dsi->dev, "failed to add mode %ux%ux@%u kHz\n",
> +			ddata->mode.hdisplay, ddata->mode.vdisplay,
> +			ddata->mode.clock);
> +		return -ENOMEM;
> +	}
> +
> +	drm_mode_set_name(mode);
> +	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>  
>  	connector->display_info.width_mm = ddata->width_mm;
>  	connector->display_info.height_mm = ddata->height_mm;
>  
> -	return omapdss_display_get_modes(connector, &ddata->vm);
> -}
> -
> -static int dsicm_check_timings(struct omap_dss_device *dssdev,
> -			       struct drm_display_mode *mode)
> -{
> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	int ret = 0;
> -
> -	if (mode->hdisplay != ddata->vm.hactive)
> -		ret = -EINVAL;
> -
> -	if (mode->vdisplay != ddata->vm.vactive)
> -		ret = -EINVAL;
> +	drm_mode_probed_add(connector, mode);
>  
> -	if (ret) {
> -		dev_warn(dssdev->dev, "wrong resolution: %d x %d",
> -			 mode->hdisplay, mode->vdisplay);
> -		dev_warn(dssdev->dev, "panel resolution: %d x %d",
> -			 ddata->vm.hactive, ddata->vm.vactive);
> -	}
> -
> -	return ret;
> +	return 1;
>  }
>  
> -static const struct omap_dss_device_ops dsicm_ops = {
> -	.connect	= dsicm_connect,
> -	.disconnect	= dsicm_disconnect,
> -
> -	.pre_enable	= dsicm_pre_enable,
> -	.enable		= dsicm_enable,
> -	.disable	= dsicm_disable,
> -	.post_disable	= dsicm_post_disable,
> -
> -	.get_modes	= dsicm_get_modes,
> -	.check_timings	= dsicm_check_timings,
> +static const struct drm_panel_funcs dsicm_panel_funcs = {
> +	.unprepare = dsicm_unprepare,
> +	.disable = dsicm_disable,
> +	.prepare = dsicm_prepare,
> +	.enable = dsicm_enable,
> +	.get_modes = dsicm_get_modes,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> @@ -517,8 +478,12 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  	struct backlight_device *backlight;
>  	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>  	struct display_timing timing;
> +	struct videomode vm = { 0 };

How about

	struct videomode vm = {
		.hactive = 864,
		.vactive = 480,
	};

>  	int err;
>  
> +	vm.hactive = 864;
> +	vm.vactive = 480;
> +
>  	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
>  	if (IS_ERR(ddata->reset_gpio)) {
>  		err = PTR_ERR(ddata->reset_gpio);
> @@ -528,15 +493,16 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  
>  	err = of_get_display_timing(node, "panel-timing", &timing);
>  	if (!err) {
> -		videomode_from_timing(&timing, &ddata->vm);
> -		if (!ddata->vm.pixelclock)
> -			ddata->vm.pixelclock =
> -				ddata->vm.hactive * ddata->vm.vactive * 60;
> +		videomode_from_timing(&timing, &vm);
>  	} else {
>  		dev_warn(&dsi->dev,
>  			 "failed to get video timing, using defaults\n");
>  	}
>  
> +	if (!vm.pixelclock)
> +		vm.pixelclock = vm.hactive * vm.vactive * 60;
> +	drm_display_mode_from_videomode(&vm, &ddata->mode);
> +
>  	ddata->width_mm = 0;
>  	of_property_read_u32(node, "width-mm", &ddata->width_mm);
>  
> @@ -570,7 +536,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	struct panel_drv_data *ddata;
>  	struct backlight_device *bldev = NULL;
>  	struct device *dev = &dsi->dev;
> -	struct omap_dss_device *dssdev;
>  	int r;
>  
>  	dev_dbg(dev, "probe\n");
> @@ -582,30 +547,17 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	mipi_dsi_set_drvdata(dsi, ddata);
>  	ddata->dsi = dsi;
>  
> -	ddata->vm.hactive = 864;
> -	ddata->vm.vactive = 480;
> -	ddata->vm.pixelclock = 864 * 480 * 60;
> -
>  	r = dsicm_probe_of(dsi);
>  	if (r)
>  		return r;
>  
> -	dssdev = &ddata->dssdev;
> -	dssdev->dev = dev;
> -	dssdev->ops = &dsicm_ops;
> -	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
> -	dssdev->display = true;
> -	dssdev->owner = THIS_MODULE;
> -	dssdev->of_port = 0;
> -	dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
> -
> -	omapdss_display_init(dssdev);
> -	omapdss_device_register(dssdev);
> -
>  	mutex_init(&ddata->lock);
>  
>  	dsicm_hw_reset(ddata);
>  
> +	drm_panel_init(&ddata->panel, dev, &dsicm_panel_funcs,
> +		       DRM_MODE_CONNECTOR_DSI);
> +
>  	if (ddata->use_dsi_backlight) {
>  		struct backlight_properties props = { 0 };
>  		props.max_brightness = 255;
> @@ -637,6 +589,8 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	if (ddata->ulps_enabled)
>  		dsi->mode_flags |= MIPI_DSI_MODE_ULPS_IDLE;
>  
> +	drm_panel_add(&ddata->panel);
> +
>  	r = mipi_dsi_attach(dsi);
>  	if (r < 0)
>  		goto err_dsi_attach;
> @@ -644,6 +598,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	return 0;
>  
>  err_dsi_attach:
> +	drm_panel_remove(&ddata->panel);
>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>  err_bl:
>  	if (ddata->extbldev)
> @@ -655,15 +610,12 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>  {
>  	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
> -	struct omap_dss_device *dssdev = &ddata->dssdev;
>  
>  	dev_dbg(&dsi->dev, "remove\n");
>  
>  	mipi_dsi_detach(dsi);
>  
> -	omapdss_device_unregister(dssdev);
> -
> -	omapdss_device_disconnect(ddata->src, dssdev);
> +	drm_panel_remove(&ddata->panel);
>  
>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>  
> @@ -677,7 +629,7 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>  }
>  
>  static const struct of_device_id dsicm_of_match[] = {
> -	{ .compatible = "omapdss,panel-dsi-cm", },
> +	{ .compatible = "panel-dsi-cm", },
>  	{},
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 620cef8bb1f2..a1a867a7d91d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -36,6 +36,7 @@
>  #include <linux/sys_soc.h>
>  
>  #include <drm/drm_mipi_dsi.h>
> +#include <drm/drm_panel.h>
>  #include <video/mipi_display.h>
>  
>  #include "omapdss.h"
> @@ -217,6 +218,8 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
>  static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
>  				       const struct mipi_dsi_msg *msg);
>  
> +static void dsi_display_disable(struct omap_dss_device *dssdev);
> +

Could you reorder functions to avoid forward-declarations ? This can be
done on top if it generates annoying conflicts.

>  /* DSI PLL HSDIV indices */
>  #define HSDIV_DISPC	0
>  #define HSDIV_DSI	1
> @@ -383,6 +386,7 @@ struct dsi_data {
>  	bool te_enabled;
>  	bool ulps_enabled;
>  	bool ulps_auto_idle;
> +	bool video_enabled;
>  
>  	struct delayed_work ulps_work;
>  
> @@ -423,6 +427,8 @@ struct dsi_data {
>  
>  	unsigned int scp_clk_refcount;
>  
> +	struct omap_dss_dsi_config config;
> +
>  	struct dss_lcd_mgr_config mgr_config;
>  	struct videomode vm;
>  	enum mipi_dsi_pixel_format pix_fmt;
> @@ -3622,7 +3628,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>  	return 0;
>  }
>  
> -static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
> +static void dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
> @@ -3631,8 +3637,10 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>  	int r;
>  
>  	r = dsi_display_init_dispc(dsi);
> -	if (r)
> -		return r;
> +	if (r) {
> +		dev_err(dsi->dev, "failed to init dispc!\n");
> +		return;
> +	}
>  
>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
>  		switch (dsi->pix_fmt) {
> @@ -3672,7 +3680,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>  	if (r)
>  		goto err_mgr_enable;
>  
> -	return 0;
> +	return;
>  
>  err_mgr_enable:
>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
> @@ -3681,7 +3689,8 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>  	}
>  err_pix_fmt:
>  	dsi_display_uninit_dispc(dsi);
> -	return r;
> +	dev_err(dsi->dev, "failed to enable DSI encoder!\n");
> +	return;
>  }
>  
>  static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel)
> @@ -3704,6 +3713,25 @@ static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel
>  	dsi_display_uninit_dispc(dsi);
>  }
>  
> +static void dsi_disable_video_outputs(struct omap_dss_device *dssdev)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	int i;
> +
> +	dsi_bus_lock(dsi);
> +	dsi->video_enabled = false;
> +
> +	for (i = 0; i < 3; i++) {
> +		if (!dsi->vc[i].dest)
> +			continue;
> +		dsi_disable_video_output(dssdev, i);
> +	}
> +
> +	dsi_display_disable(dssdev);
> +
> +	dsi_bus_unlock(dsi);
> +}
> +
>  static void dsi_update_screen_dispc(struct dsi_data *dsi)
>  {
>  	unsigned int bytespp;
> @@ -3897,6 +3925,11 @@ static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
>  
>  	dsi_bus_lock(dsi);
>  
> +	if (!dsi->video_enabled) {
> +		r = -EIO;
> +		goto err;
> +	}
> +
>  	if (!dsi->vc[channel].dest) {
>  		r = -ENODEV;
>  		goto err;
> @@ -3942,7 +3975,7 @@ static int dsi_update_all(struct omap_dss_device *dssdev)
>  
>  	for (i = 0; i < 4; i++) {
>  		r = dsi_update_channel(dssdev, i);
> -		if (r != -ENODEV)
> +		if (r && r != -ENODEV)

Does this belong to this patch ? I haven't flagged it when reviwing the
patch that introduced this code, assuming that you meant to exit from
the loop once a channel with a client is found, given that we don't
support multiple clients. In any case this should be coordinated with
dsi_enable_video_outputs() and dsi_disable_video_outputs(), all should
stop on the first client, or loop over all clients.

>  			return r;
>  	}
>  
> @@ -4165,8 +4198,30 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	DSSDBG("dsi_display_enable\n");
> -	dsi_bus_lock(dsi);
> +	WARN_ON(!dsi_bus_is_locked(dsi));
> +
>  	dsi_display_ulps_enable(dsi);
> +}
> +
> +static void dsi_enable_video_outputs(struct omap_dss_device *dssdev)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	int i;

i should be unsigned.

> +
> +	dsi_bus_lock(dsi);
> +
> +	dsi_display_enable(dssdev);
> +
> +	for (i = 0; i < 3; i++) {
> +		if (!dsi->vc[i].dest)
> +			continue;
> +		dsi_enable_video_output(dssdev, i);
> +	}
> +
> +	dsi->video_enabled = true;
> +
> +	dsi_set_ulps_auto(dsi, true);
> +
>  	dsi_bus_unlock(dsi);
>  }
>  
> @@ -4193,11 +4248,11 @@ static void dsi_display_disable(struct omap_dss_device *dssdev)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  
> +	WARN_ON(!dsi_bus_is_locked(dsi));
> +
>  	DSSDBG("dsi_display_disable\n");
>  
> -	dsi_bus_lock(dsi);
>  	dsi_display_ulps_disable(dsi, true, false);
> -	dsi_bus_unlock(dsi);
>  }
>  
>  static int dsi_enable_te(struct dsi_data *dsi, bool enable)
> @@ -4735,14 +4790,18 @@ static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
>  }
>  
>  static int dsi_set_config(struct omap_dss_device *dssdev,
> -		const struct omap_dss_dsi_config *config)
> +		const struct drm_display_mode *mode)
>  {
>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>  	struct dsi_clk_calc_ctx ctx;
> -	struct omap_dss_dsi_config cfg = *config;
> +	struct videomode vm;
> +	struct omap_dss_dsi_config cfg = dsi->config;
>  	bool ok;
>  	int r;
>  
> +	drm_display_mode_to_videomode(mode, &vm);
> +	cfg.vm = &vm;
> +
>  	mutex_lock(&dsi->lock);
>  
>  	cfg.mode = dsi->mode;
> @@ -4906,9 +4965,15 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
>  	int r;
>  
>  	dsi_bus_lock(dsi);
> -	dsi_set_ulps_auto(dsi, false);
> -	r = _omap_dsi_host_transfer(dsi, msg);
> -	dsi_set_ulps_auto(dsi, true);
> +
> +	if (dsi->video_enabled) {
> +		dsi_set_ulps_auto(dsi, false);
> +		r = _omap_dsi_host_transfer(dsi, msg);
> +		dsi_set_ulps_auto(dsi, true);
> +	} else {
> +		r = -EIO;
> +	}
> +
>  	dsi_bus_unlock(dsi);
>  
>  	return r;
> @@ -4929,6 +4994,23 @@ static int dsi_get_clocks(struct dsi_data *dsi)
>  	return 0;
>  }
>  
> +static void dsi_set_timings(struct omap_dss_device *dssdev,
> +			    const struct drm_display_mode *mode)
> +{
> +	DSSDBG("dsi_set_timings\n");
> +	dsi_set_config(dssdev, mode);
> +}
> +
> +static int dsi_check_timings(struct omap_dss_device *dssdev,
> +			     struct drm_display_mode *mode)
> +{
> +	DSSDBG("dsi_check_timings\n");
> +
> +	/* TODO */
> +
> +	return 0;
> +}
> +
>  static int dsi_connect(struct omap_dss_device *src,
>  		       struct omap_dss_device *dst)
>  {
> @@ -4944,15 +5026,13 @@ static void dsi_disconnect(struct omap_dss_device *src,
>  static const struct omap_dss_device_ops dsi_ops = {
>  	.connect = dsi_connect,
>  	.disconnect = dsi_disconnect,
> -	.enable = dsi_display_enable,
> -	.disable = dsi_display_disable,
> -
> -	.dsi = {
> -		.set_config = dsi_set_config,
> +	.enable = dsi_enable_video_outputs,
> +	.disable = dsi_disable_video_outputs,
>  
> -		.enable_video_output = dsi_enable_video_output,
> -		.disable_video_output = dsi_disable_video_output,
> +	.check_timings = dsi_check_timings,
> +	.set_timings = dsi_set_timings,
>  
> +	.dsi = {
>  		.update = dsi_update_all,
>  		.is_video_mode = dsi_is_video_mode,
>  	},
> @@ -5040,6 +5120,7 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  {
>  	struct dsi_data *dsi = host_to_omap(host);
>  	unsigned int channel = client->channel;
> +	struct drm_panel *panel;
>  	int r;
>  
>  	if (channel > 3)
> @@ -5057,6 +5138,10 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  
>  	dsi_bus_lock(dsi);
>  
> +	panel = of_drm_find_panel(client->dev.of_node);
> +	if (IS_ERR(panel))
> +		return PTR_ERR(panel);

Is it intended that the panel isn't used ?

> +
>  	atomic_set(&dsi->do_ext_te_update, 0);
>  
>  	if (client->mode_flags & MIPI_DSI_MODE_VIDEO) {
> @@ -5077,8 +5162,12 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>  	INIT_DEFERRABLE_WORK(&dsi->ulps_work,
>  			     omap_dsi_ulps_work_callback);
>  
> +	dsi->config.hs_clk_min = 150000000; // TODO: get from client?
> +	dsi->config.hs_clk_max = client->hs_rate;
> +	dsi->config.lp_clk_min = 7000000; // TODO: get from client?
> +	dsi->config.lp_clk_max = client->lp_rate;
> +
>  	dsi->ulps_auto_idle = !!(client->mode_flags & MIPI_DSI_MODE_ULPS_IDLE);
> -	dsi_set_ulps_auto(dsi, true);
>  
>  	dsi_bus_unlock(dsi);
>  	return 0;
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> index 72a7da7bfff1..18560ca4bbb0 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> @@ -174,7 +174,6 @@ static const struct of_device_id omapdss_of_match[] __initconst = {
>  };
>  
>  static const struct of_device_id omapdss_of_fixups_whitelist[] __initconst = {
> -	{ .compatible = "panel-dsi-cm" },
>  	{},
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 4200611525d5..3ee3063b6a2d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -278,14 +278,6 @@ struct omap_dss_writeback_info {
>  struct omapdss_dsi_ops {
>  	int (*update)(struct omap_dss_device *dssdev);
>  	bool (*is_video_mode)(struct omap_dss_device *dssdev);
> -
> -	/* legacy API used by omapdss panels */
> -	int (*set_config)(struct omap_dss_device *dssdev,
> -			const struct omap_dss_dsi_config *cfg);
> -
> -	int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
> -	void (*disable_video_output)(struct omap_dss_device *dssdev,
> -			int channel);
>  };
>  
>  struct omap_dss_device_ops {

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 34/56] drm/omap: drop omapdss-boot-init
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 10:40     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:40 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:11PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The table of compatible values needed to be prefixed with "omapdss,"
> is empty, so all of this code is doing nothing now. Let's drop it.

\o/

> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/Kconfig           |   4 -
>  drivers/gpu/drm/omapdrm/dss/Makefile          |   2 -
>  .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   | 228 ------------------
>  3 files changed, 234 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig b/drivers/gpu/drm/omapdrm/dss/Kconfig
> index fd7dfa28ce97..6ec80771af3d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
> @@ -1,7 +1,4 @@
>  # SPDX-License-Identifier: GPL-2.0-only
> -config OMAP2_DSS_INIT
> -	bool
> -
>  config OMAP_DSS_BASE
>  	tristate
>  
> @@ -9,7 +6,6 @@ menuconfig OMAP2_DSS
>  	tristate "OMAP2+ Display Subsystem support"
>  	select OMAP_DSS_BASE
>  	select VIDEOMODE_HELPERS
> -	select OMAP2_DSS_INIT
>  	select HDMI
>  	help
>  	  OMAP2+ Display Subsystem support.
> diff --git a/drivers/gpu/drm/omapdrm/dss/Makefile b/drivers/gpu/drm/omapdrm/dss/Makefile
> index f967e6948f2e..811966cd7468 100644
> --- a/drivers/gpu/drm/omapdrm/dss/Makefile
> +++ b/drivers/gpu/drm/omapdrm/dss/Makefile
> @@ -1,6 +1,4 @@
>  # SPDX-License-Identifier: GPL-2.0
> -obj-$(CONFIG_OMAP2_DSS_INIT) += omapdss-boot-init.o
> -
>  obj-$(CONFIG_OMAP_DSS_BASE) += omapdss-base.o
>  omapdss-base-y := base.o display.o output.o
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> deleted file mode 100644
> index 18560ca4bbb0..000000000000
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> +++ /dev/null
> @@ -1,228 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-only
> -/*
> - * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
> - * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
> - */
> -
> -/*
> - * As omapdss panel drivers are omapdss specific, but we want to define the
> - * DT-data in generic manner, we convert the compatible strings of the panel and
> - * encoder nodes from "panel-foo" to "omapdss,panel-foo". This way we can have
> - * both correct DT data and omapdss specific drivers.
> - *
> - * When we get generic panel drivers to the kernel, this file will be removed.
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/of.h>
> -#include <linux/of_graph.h>
> -#include <linux/slab.h>
> -#include <linux/list.h>
> -
> -static struct list_head dss_conv_list __initdata;
> -
> -static const char prefix[] __initconst = "omapdss,";
> -
> -struct dss_conv_node {
> -	struct list_head list;
> -	struct device_node *node;
> -	bool root;
> -};
> -
> -static int __init omapdss_count_strings(const struct property *prop)
> -{
> -	const char *p = prop->value;
> -	int l = 0, total = 0;
> -	int i;
> -
> -	for (i = 0; total < prop->length; total += l, p += l, i++)
> -		l = strlen(p) + 1;
> -
> -	return i;
> -}
> -
> -static void __init omapdss_update_prop(struct device_node *node, char *compat,
> -	int len)
> -{
> -	struct property *prop;
> -
> -	prop = kzalloc(sizeof(*prop), GFP_KERNEL);
> -	if (!prop)
> -		return;
> -
> -	prop->name = "compatible";
> -	prop->value = compat;
> -	prop->length = len;
> -
> -	of_update_property(node, prop);
> -}
> -
> -static void __init omapdss_prefix_strcpy(char *dst, int dst_len,
> -	const char *src, int src_len)
> -{
> -	size_t total = 0;
> -
> -	while (total < src_len) {
> -		size_t l = strlen(src) + 1;
> -
> -		strcpy(dst, prefix);
> -		dst += strlen(prefix);
> -
> -		strcpy(dst, src);
> -		dst += l;
> -
> -		src += l;
> -		total += l;
> -	}
> -}
> -
> -/* prepend compatible property strings with "omapdss," */
> -static void __init omapdss_omapify_node(struct device_node *node)
> -{
> -	struct property *prop;
> -	char *new_compat;
> -	int num_strs;
> -	int new_len;
> -
> -	prop = of_find_property(node, "compatible", NULL);
> -
> -	if (!prop || !prop->value)
> -		return;
> -
> -	if (strnlen(prop->value, prop->length) >= prop->length)
> -		return;
> -
> -	/* is it already prefixed? */
> -	if (strncmp(prefix, prop->value, strlen(prefix)) == 0)
> -		return;
> -
> -	num_strs = omapdss_count_strings(prop);
> -
> -	new_len = prop->length + strlen(prefix) * num_strs;
> -	new_compat = kmalloc(new_len, GFP_KERNEL);
> -
> -	omapdss_prefix_strcpy(new_compat, new_len, prop->value, prop->length);
> -
> -	omapdss_update_prop(node, new_compat, new_len);
> -}
> -
> -static void __init omapdss_add_to_list(struct device_node *node, bool root)
> -{
> -	struct dss_conv_node *n = kmalloc(sizeof(*n), GFP_KERNEL);
> -	if (n) {
> -		n->node = node;
> -		n->root = root;
> -		list_add(&n->list, &dss_conv_list);
> -	}
> -}
> -
> -static bool __init omapdss_list_contains(const struct device_node *node)
> -{
> -	struct dss_conv_node *n;
> -
> -	list_for_each_entry(n, &dss_conv_list, list) {
> -		if (n->node == node)
> -			return true;
> -	}
> -
> -	return false;
> -}
> -
> -static void __init omapdss_walk_device(struct device_node *node, bool root)
> -{
> -	struct device_node *n;
> -
> -	omapdss_add_to_list(node, root);
> -
> -	/*
> -	 * of_graph_get_remote_port_parent() prints an error if there is no
> -	 * port/ports node. To avoid that, check first that there's the node.
> -	 */
> -	n = of_get_child_by_name(node, "ports");
> -	if (!n)
> -		n = of_get_child_by_name(node, "port");
> -	if (!n)
> -		return;
> -
> -	of_node_put(n);
> -
> -	n = NULL;
> -	while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
> -		struct device_node *pn;
> -
> -		pn = of_graph_get_remote_port_parent(n);
> -
> -		if (!pn)
> -			continue;
> -
> -		if (!of_device_is_available(pn) || omapdss_list_contains(pn)) {
> -			of_node_put(pn);
> -			continue;
> -		}
> -
> -		omapdss_walk_device(pn, false);
> -	}
> -}
> -
> -static const struct of_device_id omapdss_of_match[] __initconst = {
> -	{ .compatible = "ti,omap2-dss", },
> -	{ .compatible = "ti,omap3-dss", },
> -	{ .compatible = "ti,omap4-dss", },
> -	{ .compatible = "ti,omap5-dss", },
> -	{ .compatible = "ti,dra7-dss", },
> -	{},
> -};
> -
> -static const struct of_device_id omapdss_of_fixups_whitelist[] __initconst = {
> -	{},
> -};
> -
> -static void __init omapdss_find_children(struct device_node *np)
> -{
> -	struct device_node *child;
> -
> -	for_each_available_child_of_node(np, child) {
> -		if (!of_find_property(child, "compatible", NULL))
> -			continue;
> -
> -		omapdss_walk_device(child, true);
> -
> -		if (of_device_is_compatible(child, "ti,sysc"))
> -			omapdss_find_children(child);
> -	}
> -}
> -
> -static int __init omapdss_boot_init(void)
> -{
> -	struct device_node *dss;
> -
> -	INIT_LIST_HEAD(&dss_conv_list);
> -
> -	dss = of_find_matching_node(NULL, omapdss_of_match);
> -
> -	if (dss == NULL || !of_device_is_available(dss))
> -		goto put_node;
> -
> -	omapdss_walk_device(dss, true);
> -	omapdss_find_children(dss);
> -
> -	while (!list_empty(&dss_conv_list)) {
> -		struct dss_conv_node *n;
> -
> -		n = list_first_entry(&dss_conv_list, struct dss_conv_node,
> -			list);
> -
> -		if (of_match_node(omapdss_of_fixups_whitelist, n->node))
> -			omapdss_omapify_node(n->node);
> -
> -		list_del(&n->list);
> -		of_node_put(n->node);
> -		kfree(n);
> -	}
> -
> -put_node:
> -	of_node_put(dss);
> -	return 0;
> -}
> -
> -subsys_initcall(omapdss_boot_init);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 34/56] drm/omap: drop omapdss-boot-init
@ 2020-11-09 10:40     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:40 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:11PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The table of compatible values needed to be prefixed with "omapdss,"
> is empty, so all of this code is doing nothing now. Let's drop it.

\o/

> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/Kconfig           |   4 -
>  drivers/gpu/drm/omapdrm/dss/Makefile          |   2 -
>  .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   | 228 ------------------
>  3 files changed, 234 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig b/drivers/gpu/drm/omapdrm/dss/Kconfig
> index fd7dfa28ce97..6ec80771af3d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
> @@ -1,7 +1,4 @@
>  # SPDX-License-Identifier: GPL-2.0-only
> -config OMAP2_DSS_INIT
> -	bool
> -
>  config OMAP_DSS_BASE
>  	tristate
>  
> @@ -9,7 +6,6 @@ menuconfig OMAP2_DSS
>  	tristate "OMAP2+ Display Subsystem support"
>  	select OMAP_DSS_BASE
>  	select VIDEOMODE_HELPERS
> -	select OMAP2_DSS_INIT
>  	select HDMI
>  	help
>  	  OMAP2+ Display Subsystem support.
> diff --git a/drivers/gpu/drm/omapdrm/dss/Makefile b/drivers/gpu/drm/omapdrm/dss/Makefile
> index f967e6948f2e..811966cd7468 100644
> --- a/drivers/gpu/drm/omapdrm/dss/Makefile
> +++ b/drivers/gpu/drm/omapdrm/dss/Makefile
> @@ -1,6 +1,4 @@
>  # SPDX-License-Identifier: GPL-2.0
> -obj-$(CONFIG_OMAP2_DSS_INIT) += omapdss-boot-init.o
> -
>  obj-$(CONFIG_OMAP_DSS_BASE) += omapdss-base.o
>  omapdss-base-y := base.o display.o output.o
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> deleted file mode 100644
> index 18560ca4bbb0..000000000000
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> +++ /dev/null
> @@ -1,228 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-only
> -/*
> - * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
> - * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
> - */
> -
> -/*
> - * As omapdss panel drivers are omapdss specific, but we want to define the
> - * DT-data in generic manner, we convert the compatible strings of the panel and
> - * encoder nodes from "panel-foo" to "omapdss,panel-foo". This way we can have
> - * both correct DT data and omapdss specific drivers.
> - *
> - * When we get generic panel drivers to the kernel, this file will be removed.
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/of.h>
> -#include <linux/of_graph.h>
> -#include <linux/slab.h>
> -#include <linux/list.h>
> -
> -static struct list_head dss_conv_list __initdata;
> -
> -static const char prefix[] __initconst = "omapdss,";
> -
> -struct dss_conv_node {
> -	struct list_head list;
> -	struct device_node *node;
> -	bool root;
> -};
> -
> -static int __init omapdss_count_strings(const struct property *prop)
> -{
> -	const char *p = prop->value;
> -	int l = 0, total = 0;
> -	int i;
> -
> -	for (i = 0; total < prop->length; total += l, p += l, i++)
> -		l = strlen(p) + 1;
> -
> -	return i;
> -}
> -
> -static void __init omapdss_update_prop(struct device_node *node, char *compat,
> -	int len)
> -{
> -	struct property *prop;
> -
> -	prop = kzalloc(sizeof(*prop), GFP_KERNEL);
> -	if (!prop)
> -		return;
> -
> -	prop->name = "compatible";
> -	prop->value = compat;
> -	prop->length = len;
> -
> -	of_update_property(node, prop);
> -}
> -
> -static void __init omapdss_prefix_strcpy(char *dst, int dst_len,
> -	const char *src, int src_len)
> -{
> -	size_t total = 0;
> -
> -	while (total < src_len) {
> -		size_t l = strlen(src) + 1;
> -
> -		strcpy(dst, prefix);
> -		dst += strlen(prefix);
> -
> -		strcpy(dst, src);
> -		dst += l;
> -
> -		src += l;
> -		total += l;
> -	}
> -}
> -
> -/* prepend compatible property strings with "omapdss," */
> -static void __init omapdss_omapify_node(struct device_node *node)
> -{
> -	struct property *prop;
> -	char *new_compat;
> -	int num_strs;
> -	int new_len;
> -
> -	prop = of_find_property(node, "compatible", NULL);
> -
> -	if (!prop || !prop->value)
> -		return;
> -
> -	if (strnlen(prop->value, prop->length) >= prop->length)
> -		return;
> -
> -	/* is it already prefixed? */
> -	if (strncmp(prefix, prop->value, strlen(prefix)) == 0)
> -		return;
> -
> -	num_strs = omapdss_count_strings(prop);
> -
> -	new_len = prop->length + strlen(prefix) * num_strs;
> -	new_compat = kmalloc(new_len, GFP_KERNEL);
> -
> -	omapdss_prefix_strcpy(new_compat, new_len, prop->value, prop->length);
> -
> -	omapdss_update_prop(node, new_compat, new_len);
> -}
> -
> -static void __init omapdss_add_to_list(struct device_node *node, bool root)
> -{
> -	struct dss_conv_node *n = kmalloc(sizeof(*n), GFP_KERNEL);
> -	if (n) {
> -		n->node = node;
> -		n->root = root;
> -		list_add(&n->list, &dss_conv_list);
> -	}
> -}
> -
> -static bool __init omapdss_list_contains(const struct device_node *node)
> -{
> -	struct dss_conv_node *n;
> -
> -	list_for_each_entry(n, &dss_conv_list, list) {
> -		if (n->node == node)
> -			return true;
> -	}
> -
> -	return false;
> -}
> -
> -static void __init omapdss_walk_device(struct device_node *node, bool root)
> -{
> -	struct device_node *n;
> -
> -	omapdss_add_to_list(node, root);
> -
> -	/*
> -	 * of_graph_get_remote_port_parent() prints an error if there is no
> -	 * port/ports node. To avoid that, check first that there's the node.
> -	 */
> -	n = of_get_child_by_name(node, "ports");
> -	if (!n)
> -		n = of_get_child_by_name(node, "port");
> -	if (!n)
> -		return;
> -
> -	of_node_put(n);
> -
> -	n = NULL;
> -	while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
> -		struct device_node *pn;
> -
> -		pn = of_graph_get_remote_port_parent(n);
> -
> -		if (!pn)
> -			continue;
> -
> -		if (!of_device_is_available(pn) || omapdss_list_contains(pn)) {
> -			of_node_put(pn);
> -			continue;
> -		}
> -
> -		omapdss_walk_device(pn, false);
> -	}
> -}
> -
> -static const struct of_device_id omapdss_of_match[] __initconst = {
> -	{ .compatible = "ti,omap2-dss", },
> -	{ .compatible = "ti,omap3-dss", },
> -	{ .compatible = "ti,omap4-dss", },
> -	{ .compatible = "ti,omap5-dss", },
> -	{ .compatible = "ti,dra7-dss", },
> -	{},
> -};
> -
> -static const struct of_device_id omapdss_of_fixups_whitelist[] __initconst = {
> -	{},
> -};
> -
> -static void __init omapdss_find_children(struct device_node *np)
> -{
> -	struct device_node *child;
> -
> -	for_each_available_child_of_node(np, child) {
> -		if (!of_find_property(child, "compatible", NULL))
> -			continue;
> -
> -		omapdss_walk_device(child, true);
> -
> -		if (of_device_is_compatible(child, "ti,sysc"))
> -			omapdss_find_children(child);
> -	}
> -}
> -
> -static int __init omapdss_boot_init(void)
> -{
> -	struct device_node *dss;
> -
> -	INIT_LIST_HEAD(&dss_conv_list);
> -
> -	dss = of_find_matching_node(NULL, omapdss_of_match);
> -
> -	if (dss == NULL || !of_device_is_available(dss))
> -		goto put_node;
> -
> -	omapdss_walk_device(dss, true);
> -	omapdss_find_children(dss);
> -
> -	while (!list_empty(&dss_conv_list)) {
> -		struct dss_conv_node *n;
> -
> -		n = list_first_entry(&dss_conv_list, struct dss_conv_node,
> -			list);
> -
> -		if (of_match_node(omapdss_of_fixups_whitelist, n->node))
> -			omapdss_omapify_node(n->node);
> -
> -		list_del(&n->list);
> -		of_node_put(n->node);
> -		kfree(n);
> -	}
> -
> -put_node:
> -	of_node_put(dss);
> -	return 0;
> -}
> -
> -subsys_initcall(omapdss_boot_init);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 35/56] drm/omap: dsi: implement check timings
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 10:47     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:47 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:12PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Implement check timings, which will check if its possible to

s/its/it's/

> configure the clocks for the provided mode using the same code
> as the set_config() hook.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 70 +++++++++++++++++++------------
>  1 file changed, 44 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index a1a867a7d91d..f643321434e9 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -280,6 +280,11 @@ struct dsi_isr_tables {
>  	struct dsi_isr_data isr_table_cio[DSI_MAX_NR_ISRS];
>  };
>  
> +struct dsi_lp_clock_info {
> +	unsigned long lp_clk;
> +	u16 lp_clk_div;
> +};
> +
>  struct dsi_clk_calc_ctx {
>  	struct dsi_data *dsi;
>  	struct dss_pll *pll;
> @@ -294,16 +299,12 @@ struct dsi_clk_calc_ctx {
>  
>  	struct dss_pll_clock_info dsi_cinfo;
>  	struct dispc_clock_info dispc_cinfo;
> +	struct dsi_lp_clock_info user_lp_cinfo;

Any reason for the user_ prefix here ?

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

>  
>  	struct videomode vm;
>  	struct omap_dss_dsi_videomode_timings dsi_vm;
>  };
>  
> -struct dsi_lp_clock_info {
> -	unsigned long lp_clk;
> -	u16 lp_clk_div;
> -};
> -
>  struct dsi_module_id_data {
>  	u32 address;
>  	int id;
> @@ -4789,44 +4790,55 @@ static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
>  	return (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE);
>  }
>  
> -static int dsi_set_config(struct omap_dss_device *dssdev,
> -		const struct drm_display_mode *mode)
> +static int __dsi_calc_config(struct dsi_data *dsi,
> +		const struct drm_display_mode *mode,
> +		struct dsi_clk_calc_ctx *ctx)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	struct dsi_clk_calc_ctx ctx;
> -	struct videomode vm;
>  	struct omap_dss_dsi_config cfg = dsi->config;
> +	struct videomode vm;
>  	bool ok;
>  	int r;
>  
>  	drm_display_mode_to_videomode(mode, &vm);
> -	cfg.vm = &vm;
> -
> -	mutex_lock(&dsi->lock);
>  
> +	cfg.vm = &vm;
>  	cfg.mode = dsi->mode;
>  	cfg.pixel_format = dsi->pix_fmt;
>  
>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
> -		ok = dsi_vm_calc(dsi, &cfg, &ctx);
> +		ok = dsi_vm_calc(dsi, &cfg, ctx);
>  	else
> -		ok = dsi_cm_calc(dsi, &cfg, &ctx);
> +		ok = dsi_cm_calc(dsi, &cfg, ctx);
>  
> -	if (!ok) {
> -		DSSERR("failed to find suitable DSI clock settings\n");
> -		r = -EINVAL;
> -		goto err;
> -	}
> +	if (!ok)
> +		return -EINVAL;
> +
> +	dsi_pll_calc_dsi_fck(dsi, &ctx->dsi_cinfo);
>  
> -	dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
> +	r = dsi_lp_clock_calc(ctx->dsi_cinfo.clkout[HSDIV_DSI],
> +		cfg.lp_clk_min, cfg.lp_clk_max, &ctx->user_lp_cinfo);
> +	if (r)
> +		return r;
> +
> +	return 0;
> +}
>  
> -	r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
> -		cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
> +static int dsi_set_config(struct omap_dss_device *dssdev,
> +		const struct drm_display_mode *mode)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	struct dsi_clk_calc_ctx ctx;
> +	int r;
> +
> +	mutex_lock(&dsi->lock);
> +
> +	r = __dsi_calc_config(dsi, mode, &ctx);
>  	if (r) {
> -		DSSERR("failed to find suitable DSI LP clock settings\n");
> +		DSSERR("failed to find suitable DSI clock settings\n");
>  		goto err;
>  	}
>  
> +	dsi->user_lp_cinfo = ctx.user_lp_cinfo;
>  	dsi->user_dsi_cinfo = ctx.dsi_cinfo;
>  	dsi->user_dispc_cinfo = ctx.dispc_cinfo;
>  
> @@ -5004,11 +5016,17 @@ static void dsi_set_timings(struct omap_dss_device *dssdev,
>  static int dsi_check_timings(struct omap_dss_device *dssdev,
>  			     struct drm_display_mode *mode)
>  {
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	struct dsi_clk_calc_ctx ctx;
> +	int r;
> +
>  	DSSDBG("dsi_check_timings\n");
>  
> -	/* TODO */
> +	mutex_lock(&dsi->lock);
> +	r = __dsi_calc_config(dsi, mode, &ctx);
> +	mutex_unlock(&dsi->lock);
>  
> -	return 0;
> +	return r;
>  }
>  
>  static int dsi_connect(struct omap_dss_device *src,

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 35/56] drm/omap: dsi: implement check timings
@ 2020-11-09 10:47     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:47 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:12PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Implement check timings, which will check if its possible to

s/its/it's/

> configure the clocks for the provided mode using the same code
> as the set_config() hook.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 70 +++++++++++++++++++------------
>  1 file changed, 44 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index a1a867a7d91d..f643321434e9 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -280,6 +280,11 @@ struct dsi_isr_tables {
>  	struct dsi_isr_data isr_table_cio[DSI_MAX_NR_ISRS];
>  };
>  
> +struct dsi_lp_clock_info {
> +	unsigned long lp_clk;
> +	u16 lp_clk_div;
> +};
> +
>  struct dsi_clk_calc_ctx {
>  	struct dsi_data *dsi;
>  	struct dss_pll *pll;
> @@ -294,16 +299,12 @@ struct dsi_clk_calc_ctx {
>  
>  	struct dss_pll_clock_info dsi_cinfo;
>  	struct dispc_clock_info dispc_cinfo;
> +	struct dsi_lp_clock_info user_lp_cinfo;

Any reason for the user_ prefix here ?

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

>  
>  	struct videomode vm;
>  	struct omap_dss_dsi_videomode_timings dsi_vm;
>  };
>  
> -struct dsi_lp_clock_info {
> -	unsigned long lp_clk;
> -	u16 lp_clk_div;
> -};
> -
>  struct dsi_module_id_data {
>  	u32 address;
>  	int id;
> @@ -4789,44 +4790,55 @@ static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
>  	return (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE);
>  }
>  
> -static int dsi_set_config(struct omap_dss_device *dssdev,
> -		const struct drm_display_mode *mode)
> +static int __dsi_calc_config(struct dsi_data *dsi,
> +		const struct drm_display_mode *mode,
> +		struct dsi_clk_calc_ctx *ctx)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	struct dsi_clk_calc_ctx ctx;
> -	struct videomode vm;
>  	struct omap_dss_dsi_config cfg = dsi->config;
> +	struct videomode vm;
>  	bool ok;
>  	int r;
>  
>  	drm_display_mode_to_videomode(mode, &vm);
> -	cfg.vm = &vm;
> -
> -	mutex_lock(&dsi->lock);
>  
> +	cfg.vm = &vm;
>  	cfg.mode = dsi->mode;
>  	cfg.pixel_format = dsi->pix_fmt;
>  
>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
> -		ok = dsi_vm_calc(dsi, &cfg, &ctx);
> +		ok = dsi_vm_calc(dsi, &cfg, ctx);
>  	else
> -		ok = dsi_cm_calc(dsi, &cfg, &ctx);
> +		ok = dsi_cm_calc(dsi, &cfg, ctx);
>  
> -	if (!ok) {
> -		DSSERR("failed to find suitable DSI clock settings\n");
> -		r = -EINVAL;
> -		goto err;
> -	}
> +	if (!ok)
> +		return -EINVAL;
> +
> +	dsi_pll_calc_dsi_fck(dsi, &ctx->dsi_cinfo);
>  
> -	dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
> +	r = dsi_lp_clock_calc(ctx->dsi_cinfo.clkout[HSDIV_DSI],
> +		cfg.lp_clk_min, cfg.lp_clk_max, &ctx->user_lp_cinfo);
> +	if (r)
> +		return r;
> +
> +	return 0;
> +}
>  
> -	r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
> -		cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
> +static int dsi_set_config(struct omap_dss_device *dssdev,
> +		const struct drm_display_mode *mode)
> +{
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	struct dsi_clk_calc_ctx ctx;
> +	int r;
> +
> +	mutex_lock(&dsi->lock);
> +
> +	r = __dsi_calc_config(dsi, mode, &ctx);
>  	if (r) {
> -		DSSERR("failed to find suitable DSI LP clock settings\n");
> +		DSSERR("failed to find suitable DSI clock settings\n");
>  		goto err;
>  	}
>  
> +	dsi->user_lp_cinfo = ctx.user_lp_cinfo;
>  	dsi->user_dsi_cinfo = ctx.dsi_cinfo;
>  	dsi->user_dispc_cinfo = ctx.dispc_cinfo;
>  
> @@ -5004,11 +5016,17 @@ static void dsi_set_timings(struct omap_dss_device *dssdev,
>  static int dsi_check_timings(struct omap_dss_device *dssdev,
>  			     struct drm_display_mode *mode)
>  {
> +	struct dsi_data *dsi = to_dsi_data(dssdev);
> +	struct dsi_clk_calc_ctx ctx;
> +	int r;
> +
>  	DSSDBG("dsi_check_timings\n");
>  
> -	/* TODO */
> +	mutex_lock(&dsi->lock);
> +	r = __dsi_calc_config(dsi, mode, &ctx);
> +	mutex_unlock(&dsi->lock);
>  
> -	return 0;
> +	return r;
>  }
>  
>  static int dsi_connect(struct omap_dss_device *src,

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 36/56] drm/omap: panel-dsi-cm: use DEVICE_ATTR_RO
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 10:48     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:48 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:13PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Use DEVICE_ATTR_RO helper instead of plain DEVICE_ATTR,
> which makes the code a bit shorter and easier to read.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---

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

>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 3668b3f0aff2..5159dd51a353 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -219,7 +219,7 @@ static const struct backlight_ops dsicm_bl_ops = {
>  	.update_status  = dsicm_bl_update_status,
>  };
>  
> -static ssize_t dsicm_num_errors_show(struct device *dev,
> +static ssize_t num_dsi_errors_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> @@ -239,7 +239,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
>  	return snprintf(buf, PAGE_SIZE, "%d\n", errors);
>  }
>  
> -static ssize_t dsicm_hw_revision_show(struct device *dev,
> +static ssize_t hw_revision_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> @@ -259,8 +259,8 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
>  	return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
>  }
>  
> -static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
> -static DEVICE_ATTR(hw_revision, S_IRUGO, dsicm_hw_revision_show, NULL);
> +static DEVICE_ATTR_RO(num_dsi_errors);
> +static DEVICE_ATTR_RO(hw_revision);
>  
>  static struct attribute *dsicm_attrs[] = {
>  	&dev_attr_num_dsi_errors.attr,

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 36/56] drm/omap: panel-dsi-cm: use DEVICE_ATTR_RO
@ 2020-11-09 10:48     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:48 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:13PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Use DEVICE_ATTR_RO helper instead of plain DEVICE_ATTR,
> which makes the code a bit shorter and easier to read.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---

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

>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 3668b3f0aff2..5159dd51a353 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -219,7 +219,7 @@ static const struct backlight_ops dsicm_bl_ops = {
>  	.update_status  = dsicm_bl_update_status,
>  };
>  
> -static ssize_t dsicm_num_errors_show(struct device *dev,
> +static ssize_t num_dsi_errors_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> @@ -239,7 +239,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
>  	return snprintf(buf, PAGE_SIZE, "%d\n", errors);
>  }
>  
> -static ssize_t dsicm_hw_revision_show(struct device *dev,
> +static ssize_t hw_revision_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
> @@ -259,8 +259,8 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
>  	return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
>  }
>  
> -static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
> -static DEVICE_ATTR(hw_revision, S_IRUGO, dsicm_hw_revision_show, NULL);
> +static DEVICE_ATTR_RO(num_dsi_errors);
> +static DEVICE_ATTR_RO(hw_revision);
>  
>  static struct attribute *dsicm_attrs[] = {
>  	&dev_attr_num_dsi_errors.attr,

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 37/56] drm/omap: panel-dsi-cm: support unbinding
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 10:49     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:49 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

On Thu, Nov 05, 2020 at 02:03:14PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Now, that the driver implements the common DRM panel API
> the unbind no longer needs to be suppressed.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

I'd be curious to know what happens when you try to unbind through sysfs
though...

> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 5159dd51a353..086c7d71fe17 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -607,7 +607,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	return r;
>  }
>  
> -static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
> +static int dsicm_remove(struct mipi_dsi_device *dsi)
>  {
>  	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>  
> @@ -637,11 +637,10 @@ MODULE_DEVICE_TABLE(of, dsicm_of_match);
>  
>  static struct mipi_dsi_driver dsicm_driver = {
>  	.probe = dsicm_probe,
> -	.remove = __exit_p(dsicm_remove),
> +	.remove = dsicm_remove,
>  	.driver = {
>  		.name = "panel-dsi-cm",
>  		.of_match_table = dsicm_of_match,
> -		.suppress_bind_attrs = true,
>  	},
>  };
>  module_mipi_dsi_driver(dsicm_driver);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 37/56] drm/omap: panel-dsi-cm: support unbinding
@ 2020-11-09 10:49     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:49 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

On Thu, Nov 05, 2020 at 02:03:14PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Now, that the driver implements the common DRM panel API
> the unbind no longer needs to be suppressed.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

I'd be curious to know what happens when you try to unbind through sysfs
though...

> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 5159dd51a353..086c7d71fe17 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -607,7 +607,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>  	return r;
>  }
>  
> -static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
> +static int dsicm_remove(struct mipi_dsi_device *dsi)
>  {
>  	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>  
> @@ -637,11 +637,10 @@ MODULE_DEVICE_TABLE(of, dsicm_of_match);
>  
>  static struct mipi_dsi_driver dsicm_driver = {
>  	.probe = dsicm_probe,
> -	.remove = __exit_p(dsicm_remove),
> +	.remove = dsicm_remove,
>  	.driver = {
>  		.name = "panel-dsi-cm",
>  		.of_match_table = dsicm_of_match,
> -		.suppress_bind_attrs = true,
>  	},
>  };
>  module_mipi_dsi_driver(dsicm_driver);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 38/56] drm/omap: panel-dsi-cm: fix remove()
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 10:50     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:50 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:15PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Do not try to reset the panel after DSI has been
> detached, since the DSI clocks may have been disabled
> at this point. The panel will be disabled and unprepared
> before being removed and a reset will be done when being
> probed again.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 086c7d71fe17..795db22d148d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -622,9 +622,6 @@ static int dsicm_remove(struct mipi_dsi_device *dsi)
>  	if (ddata->extbldev)
>  		put_device(&ddata->extbldev->dev);
>  
> -	/* reset, to be sure that the panel is in a valid state */
> -	dsicm_hw_reset(ddata);
> -
>  	return 0;
>  }
>  

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 38/56] drm/omap: panel-dsi-cm: fix remove()
@ 2020-11-09 10:50     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:50 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:15PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Do not try to reset the panel after DSI has been
> detached, since the DSI clocks may have been disabled
> at this point. The panel will be disabled and unprepared
> before being removed and a reset will be done when being
> probed again.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 086c7d71fe17..795db22d148d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -622,9 +622,6 @@ static int dsicm_remove(struct mipi_dsi_device *dsi)
>  	if (ddata->extbldev)
>  		put_device(&ddata->extbldev->dev);
>  
> -	/* reset, to be sure that the panel is in a valid state */
> -	dsicm_hw_reset(ddata);
> -
>  	return 0;
>  }
>  

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 39/56] drm/omap: remove global dss_device variable
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 10:51     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:51 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:16PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> We can simply provide the device to the omapdrm driver
> via pdata. omapdss_is_initialized() is no longer required
> (even before this patch), since omapdrm device is only
> registered after the pointer is initialized.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/base.c    | 14 --------------
>  drivers/gpu/drm/omapdrm/dss/dss.c     |  9 ++++-----
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  9 +++------
>  drivers/gpu/drm/omapdrm/omap_drv.c    |  6 ++----
>  4 files changed, 9 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index 455b410f7401..8e08c49b4f97 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -16,20 +16,6 @@
>  #include "dss.h"
>  #include "omapdss.h"
>  
> -static struct dss_device *dss_device;
> -
> -struct dss_device *omapdss_get_dss(void)
> -{
> -	return dss_device;
> -}
> -EXPORT_SYMBOL(omapdss_get_dss);
> -
> -void omapdss_set_dss(struct dss_device *dss)
> -{
> -	dss_device = dss;
> -}
> -EXPORT_SYMBOL(omapdss_set_dss);
> -
>  struct dispc_device *dispc_get_dispc(struct dss_device *dss)
>  {
>  	return dss->dispc;
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
> index 6ccbc29c4ce4..6e86f4e67a2c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1305,6 +1305,7 @@ static int dss_bind(struct device *dev)
>  {
>  	struct dss_device *dss = dev_get_drvdata(dev);
>  	struct platform_device *drm_pdev;
> +	struct dss_pdata pdata;
>  	int r;
>  
>  	r = component_bind_all(dev, NULL);
> @@ -1313,9 +1314,9 @@ static int dss_bind(struct device *dev)
>  
>  	pm_set_vt_switch(0);
>  
> -	omapdss_set_dss(dss);
> -
> -	drm_pdev = platform_device_register_simple("omapdrm", 0, NULL, 0);
> +	pdata.dss = dss;
> +	drm_pdev = platform_device_register_data(NULL, "omapdrm", 0,
> +						 &pdata, sizeof(pdata));
>  	if (IS_ERR(drm_pdev)) {
>  		component_unbind_all(dev, NULL);
>  		return PTR_ERR(drm_pdev);
> @@ -1332,8 +1333,6 @@ static void dss_unbind(struct device *dev)
>  
>  	platform_device_unregister(dss->drm_pdev);
>  
> -	omapdss_set_dss(NULL);
> -
>  	component_unbind_all(dev, NULL);
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 3ee3063b6a2d..42d1ec3aaf0c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -356,12 +356,9 @@ struct omap_dss_device {
>  	unsigned int of_port;
>  };
>  
> -struct dss_device *omapdss_get_dss(void);
> -void omapdss_set_dss(struct dss_device *dss);
> -static inline bool omapdss_is_initialized(void)
> -{
> -	return !!omapdss_get_dss();
> -}
> +struct dss_pdata {
> +	struct dss_device *dss;
> +};
>  
>  void omapdss_display_init(struct omap_dss_device *dssdev);
>  int omapdss_display_get_modes(struct drm_connector *connector,
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 53d5e184ee77..b342f5b6ced0 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -577,6 +577,7 @@ static const struct soc_device_attribute omapdrm_soc_devices[] = {
>  static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  {
>  	const struct soc_device_attribute *soc;
> +	struct dss_pdata *pdata = dev->platform_data;
>  	struct drm_device *ddev;
>  	int ret;
>  
> @@ -591,7 +592,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  	ddev->dev_private = priv;
>  
>  	priv->dev = dev;
> -	priv->dss = omapdss_get_dss();
> +	priv->dss = pdata->dss;
>  	priv->dispc = dispc_get_dispc(priv->dss);
>  	priv->dispc_ops = dispc_get_ops(priv->dss);
>  
> @@ -686,9 +687,6 @@ static int pdev_probe(struct platform_device *pdev)
>  	struct omap_drm_private *priv;
>  	int ret;
>  
> -	if (omapdss_is_initialized() == false)
> -		return -EPROBE_DEFER;
> -
>  	ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to set the DMA mask\n");

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 39/56] drm/omap: remove global dss_device variable
@ 2020-11-09 10:51     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:51 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:16PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> We can simply provide the device to the omapdrm driver
> via pdata. omapdss_is_initialized() is no longer required
> (even before this patch), since omapdrm device is only
> registered after the pointer is initialized.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/base.c    | 14 --------------
>  drivers/gpu/drm/omapdrm/dss/dss.c     |  9 ++++-----
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  9 +++------
>  drivers/gpu/drm/omapdrm/omap_drv.c    |  6 ++----
>  4 files changed, 9 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index 455b410f7401..8e08c49b4f97 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -16,20 +16,6 @@
>  #include "dss.h"
>  #include "omapdss.h"
>  
> -static struct dss_device *dss_device;
> -
> -struct dss_device *omapdss_get_dss(void)
> -{
> -	return dss_device;
> -}
> -EXPORT_SYMBOL(omapdss_get_dss);
> -
> -void omapdss_set_dss(struct dss_device *dss)
> -{
> -	dss_device = dss;
> -}
> -EXPORT_SYMBOL(omapdss_set_dss);
> -
>  struct dispc_device *dispc_get_dispc(struct dss_device *dss)
>  {
>  	return dss->dispc;
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
> index 6ccbc29c4ce4..6e86f4e67a2c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1305,6 +1305,7 @@ static int dss_bind(struct device *dev)
>  {
>  	struct dss_device *dss = dev_get_drvdata(dev);
>  	struct platform_device *drm_pdev;
> +	struct dss_pdata pdata;
>  	int r;
>  
>  	r = component_bind_all(dev, NULL);
> @@ -1313,9 +1314,9 @@ static int dss_bind(struct device *dev)
>  
>  	pm_set_vt_switch(0);
>  
> -	omapdss_set_dss(dss);
> -
> -	drm_pdev = platform_device_register_simple("omapdrm", 0, NULL, 0);
> +	pdata.dss = dss;
> +	drm_pdev = platform_device_register_data(NULL, "omapdrm", 0,
> +						 &pdata, sizeof(pdata));
>  	if (IS_ERR(drm_pdev)) {
>  		component_unbind_all(dev, NULL);
>  		return PTR_ERR(drm_pdev);
> @@ -1332,8 +1333,6 @@ static void dss_unbind(struct device *dev)
>  
>  	platform_device_unregister(dss->drm_pdev);
>  
> -	omapdss_set_dss(NULL);
> -
>  	component_unbind_all(dev, NULL);
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 3ee3063b6a2d..42d1ec3aaf0c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -356,12 +356,9 @@ struct omap_dss_device {
>  	unsigned int of_port;
>  };
>  
> -struct dss_device *omapdss_get_dss(void);
> -void omapdss_set_dss(struct dss_device *dss);
> -static inline bool omapdss_is_initialized(void)
> -{
> -	return !!omapdss_get_dss();
> -}
> +struct dss_pdata {
> +	struct dss_device *dss;
> +};
>  
>  void omapdss_display_init(struct omap_dss_device *dssdev);
>  int omapdss_display_get_modes(struct drm_connector *connector,
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 53d5e184ee77..b342f5b6ced0 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -577,6 +577,7 @@ static const struct soc_device_attribute omapdrm_soc_devices[] = {
>  static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  {
>  	const struct soc_device_attribute *soc;
> +	struct dss_pdata *pdata = dev->platform_data;
>  	struct drm_device *ddev;
>  	int ret;
>  
> @@ -591,7 +592,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  	ddev->dev_private = priv;
>  
>  	priv->dev = dev;
> -	priv->dss = omapdss_get_dss();
> +	priv->dss = pdata->dss;
>  	priv->dispc = dispc_get_dispc(priv->dss);
>  	priv->dispc_ops = dispc_get_ops(priv->dss);
>  
> @@ -686,9 +687,6 @@ static int pdev_probe(struct platform_device *pdev)
>  	struct omap_drm_private *priv;
>  	int ret;
>  
> -	if (omapdss_is_initialized() == false)
> -		return -EPROBE_DEFER;
> -
>  	ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to set the DMA mask\n");

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 40/56] drm/panel: Move OMAP's DSI command mode panel driver
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 10:53     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:53 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel, Thierry Reding, Sam Ravnborg

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:17PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The panel driver is no longer using any OMAP specific APIs, so
> let's move it into the generic panel directory.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>

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

> ---
>  drivers/gpu/drm/omapdrm/Kconfig                        |  1 -
>  drivers/gpu/drm/omapdrm/Makefile                       |  1 -
>  drivers/gpu/drm/omapdrm/displays/Kconfig               | 10 ----------
>  drivers/gpu/drm/omapdrm/displays/Makefile              |  2 --
>  drivers/gpu/drm/panel/Kconfig                          |  9 +++++++++
>  drivers/gpu/drm/panel/Makefile                         |  1 +
>  .../gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c |  0
>  7 files changed, 10 insertions(+), 14 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
>  rename drivers/gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c (100%)
> 
> diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
> index 5417e7a47072..cea3f44ea6d4 100644
> --- a/drivers/gpu/drm/omapdrm/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/Kconfig
> @@ -12,6 +12,5 @@ config DRM_OMAP
>  if DRM_OMAP
>  
>  source "drivers/gpu/drm/omapdrm/dss/Kconfig"
> -source "drivers/gpu/drm/omapdrm/displays/Kconfig"
>  
>  endif
> diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
> index f115253115c5..66a73eae6f7c 100644
> --- a/drivers/gpu/drm/omapdrm/Makefile
> +++ b/drivers/gpu/drm/omapdrm/Makefile
> @@ -5,7 +5,6 @@
>  #
>  
>  obj-y += dss/
> -obj-y += displays/
>  
>  omapdrm-y := omap_drv.o \
>  	omap_irq.o \
> diff --git a/drivers/gpu/drm/omapdrm/displays/Kconfig b/drivers/gpu/drm/omapdrm/displays/Kconfig
> deleted file mode 100644
> index f2be594c7eff..000000000000
> --- a/drivers/gpu/drm/omapdrm/displays/Kconfig
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0-only
> -menu "OMAPDRM External Display Device Drivers"
> -
> -config DRM_OMAP_PANEL_DSI_CM
> -	tristate "Generic DSI Command Mode Panel"
> -	depends on BACKLIGHT_CLASS_DEVICE
> -	help
> -	  Driver for generic DSI command mode panels.
> -
> -endmenu
> diff --git a/drivers/gpu/drm/omapdrm/displays/Makefile b/drivers/gpu/drm/omapdrm/displays/Makefile
> deleted file mode 100644
> index 488ddf153613..000000000000
> --- a/drivers/gpu/drm/omapdrm/displays/Makefile
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -obj-$(CONFIG_DRM_OMAP_PANEL_DSI_CM) += panel-dsi-cm.o
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index b9dbedf8f15e..a71f95afc52e 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -48,6 +48,15 @@ config DRM_PANEL_BOE_TV101WUM_NL6
>  	  Say Y here if you want to support for BOE TV101WUM and AUO KD101N80
>  	  45NA WUXGA PANEL DSI Video Mode panel
>  
> +config DRM_PANEL_DSI_CM
> +	tristate "Generic DSI command mode panels"
> +	depends on OF
> +	depends on DRM_MIPI_DSI
> +	depends on BACKLIGHT_CLASS_DEVICE
> +	help
> +	  DRM panel driver for DSI command mode panels with support for
> +	  embedded and external backlights.
> +
>  config DRM_PANEL_LVDS
>  	tristate "Generic LVDS panel driver"
>  	depends on OF
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index 2ba560bca61d..c553e968e9a9 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_PANEL_ARM_VERSATILE) += panel-arm-versatile.o
>  obj-$(CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596) += panel-asus-z00t-tm5p5-n35596.o
>  obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o
>  obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o
> +obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o
>  obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
>  obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
>  obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/panel/panel-dsi-cm.c
> similarity index 100%
> rename from drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> rename to drivers/gpu/drm/panel/panel-dsi-cm.c

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 40/56] drm/panel: Move OMAP's DSI command mode panel driver
@ 2020-11-09 10:53     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:53 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, Thierry Reding,
	linux-omap, Sam Ravnborg, Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:17PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The panel driver is no longer using any OMAP specific APIs, so
> let's move it into the generic panel directory.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>

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

> ---
>  drivers/gpu/drm/omapdrm/Kconfig                        |  1 -
>  drivers/gpu/drm/omapdrm/Makefile                       |  1 -
>  drivers/gpu/drm/omapdrm/displays/Kconfig               | 10 ----------
>  drivers/gpu/drm/omapdrm/displays/Makefile              |  2 --
>  drivers/gpu/drm/panel/Kconfig                          |  9 +++++++++
>  drivers/gpu/drm/panel/Makefile                         |  1 +
>  .../gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c |  0
>  7 files changed, 10 insertions(+), 14 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
>  rename drivers/gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c (100%)
> 
> diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
> index 5417e7a47072..cea3f44ea6d4 100644
> --- a/drivers/gpu/drm/omapdrm/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/Kconfig
> @@ -12,6 +12,5 @@ config DRM_OMAP
>  if DRM_OMAP
>  
>  source "drivers/gpu/drm/omapdrm/dss/Kconfig"
> -source "drivers/gpu/drm/omapdrm/displays/Kconfig"
>  
>  endif
> diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
> index f115253115c5..66a73eae6f7c 100644
> --- a/drivers/gpu/drm/omapdrm/Makefile
> +++ b/drivers/gpu/drm/omapdrm/Makefile
> @@ -5,7 +5,6 @@
>  #
>  
>  obj-y += dss/
> -obj-y += displays/
>  
>  omapdrm-y := omap_drv.o \
>  	omap_irq.o \
> diff --git a/drivers/gpu/drm/omapdrm/displays/Kconfig b/drivers/gpu/drm/omapdrm/displays/Kconfig
> deleted file mode 100644
> index f2be594c7eff..000000000000
> --- a/drivers/gpu/drm/omapdrm/displays/Kconfig
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0-only
> -menu "OMAPDRM External Display Device Drivers"
> -
> -config DRM_OMAP_PANEL_DSI_CM
> -	tristate "Generic DSI Command Mode Panel"
> -	depends on BACKLIGHT_CLASS_DEVICE
> -	help
> -	  Driver for generic DSI command mode panels.
> -
> -endmenu
> diff --git a/drivers/gpu/drm/omapdrm/displays/Makefile b/drivers/gpu/drm/omapdrm/displays/Makefile
> deleted file mode 100644
> index 488ddf153613..000000000000
> --- a/drivers/gpu/drm/omapdrm/displays/Makefile
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -obj-$(CONFIG_DRM_OMAP_PANEL_DSI_CM) += panel-dsi-cm.o
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index b9dbedf8f15e..a71f95afc52e 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -48,6 +48,15 @@ config DRM_PANEL_BOE_TV101WUM_NL6
>  	  Say Y here if you want to support for BOE TV101WUM and AUO KD101N80
>  	  45NA WUXGA PANEL DSI Video Mode panel
>  
> +config DRM_PANEL_DSI_CM
> +	tristate "Generic DSI command mode panels"
> +	depends on OF
> +	depends on DRM_MIPI_DSI
> +	depends on BACKLIGHT_CLASS_DEVICE
> +	help
> +	  DRM panel driver for DSI command mode panels with support for
> +	  embedded and external backlights.
> +
>  config DRM_PANEL_LVDS
>  	tristate "Generic LVDS panel driver"
>  	depends on OF
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index 2ba560bca61d..c553e968e9a9 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_PANEL_ARM_VERSATILE) += panel-arm-versatile.o
>  obj-$(CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596) += panel-asus-z00t-tm5p5-n35596.o
>  obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o
>  obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o
> +obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o
>  obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
>  obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
>  obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/panel/panel-dsi-cm.c
> similarity index 100%
> rename from drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> rename to drivers/gpu/drm/panel/panel-dsi-cm.c

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 41/56] drm/omap: dsi: Register a drm_bridge
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 10:54     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:54 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:18PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> In order to integrate with a chain of drm_bridge, the internal DSI
> output has to expose its operations through the drm_bridge API.
> Register a bridge at initialisation time to do so and remove the
> omap_dss_device operations that are now unused.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 134 ++++++++++++++++++++----------
>  1 file changed, 89 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index f643321434e9..bbcdb62e1571 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -35,6 +35,7 @@
>  #include <linux/component.h>
>  #include <linux/sys_soc.h>
>  
> +#include <drm/drm_bridge.h>
>  #include <drm/drm_mipi_dsi.h>
>  #include <drm/drm_panel.h>
>  #include <video/mipi_display.h>
> @@ -437,6 +438,7 @@ struct dsi_data {
>  	struct omap_dss_dsi_videomode_timings vm_timings;
>  
>  	struct omap_dss_device output;
> +	struct drm_bridge bridge;
>  };
>  
>  struct dsi_packet_sent_handler_data {
> @@ -449,6 +451,9 @@ static bool dsi_perf;
>  module_param(dsi_perf, bool, 0644);
>  #endif
>  
> +#define drm_bridge_to_dsi(bridge) \
> +	container_of(bridge, struct dsi_data, bridge)
> +
>  static inline struct dsi_data *to_dsi_data(struct omap_dss_device *dssdev)
>  {
>  	return dev_get_drvdata(dssdev->dev);
> @@ -5006,50 +5011,7 @@ static int dsi_get_clocks(struct dsi_data *dsi)
>  	return 0;
>  }
>  
> -static void dsi_set_timings(struct omap_dss_device *dssdev,
> -			    const struct drm_display_mode *mode)
> -{
> -	DSSDBG("dsi_set_timings\n");
> -	dsi_set_config(dssdev, mode);
> -}
> -
> -static int dsi_check_timings(struct omap_dss_device *dssdev,
> -			     struct drm_display_mode *mode)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	struct dsi_clk_calc_ctx ctx;
> -	int r;
> -
> -	DSSDBG("dsi_check_timings\n");
> -
> -	mutex_lock(&dsi->lock);
> -	r = __dsi_calc_config(dsi, mode, &ctx);
> -	mutex_unlock(&dsi->lock);
> -
> -	return r;
> -}
> -
> -static int dsi_connect(struct omap_dss_device *src,
> -		       struct omap_dss_device *dst)
> -{
> -	return omapdss_device_connect(dst->dss, dst, dst->next);
> -}
> -
> -static void dsi_disconnect(struct omap_dss_device *src,
> -			   struct omap_dss_device *dst)
> -{
> -	omapdss_device_disconnect(dst, dst->next);
> -}
> -
>  static const struct omap_dss_device_ops dsi_ops = {
> -	.connect = dsi_connect,
> -	.disconnect = dsi_disconnect,
> -	.enable = dsi_enable_video_outputs,
> -	.disable = dsi_disable_video_outputs,
> -
> -	.check_timings = dsi_check_timings,
> -	.set_timings = dsi_set_timings,
> -
>  	.dsi = {
>  		.update = dsi_update_all,
>  		.is_video_mode = dsi_is_video_mode,
> @@ -5393,6 +5355,83 @@ static const struct component_ops dsi_component_ops = {
>  	.unbind	= dsi_unbind,
>  };
>  
> +/* -----------------------------------------------------------------------------
> + * DRM Bridge Operations
> + */
> +
> +static int dsi_bridge_attach(struct drm_bridge *bridge,
> +			     enum drm_bridge_attach_flags flags)
> +{
> +	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +
> +	if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
> +		return -EINVAL;
> +
> +	return drm_bridge_attach(bridge->encoder, dsi->output.next_bridge,
> +				 bridge, flags);
> +}
> +
> +static enum drm_mode_status
> +dsi_bridge_mode_valid(struct drm_bridge *bridge,
> +		      const struct drm_display_info *info,
> +		      const struct drm_display_mode *mode)
> +{
> +	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +	struct dsi_clk_calc_ctx ctx;
> +	int r;
> +
> +	mutex_lock(&dsi->lock);
> +	r = __dsi_calc_config(dsi, mode, &ctx);
> +	mutex_unlock(&dsi->lock);
> +
> +	return r ? MODE_CLOCK_RANGE : MODE_OK;
> +}
> +
> +static void dsi_bridge_mode_set(struct drm_bridge *bridge,
> +				const struct drm_display_mode *mode,
> +				const struct drm_display_mode *adjusted_mode)
> +{
> +	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +
> +	dsi_set_config(&dsi->output, adjusted_mode);
> +}
> +
> +static void dsi_bridge_enable(struct drm_bridge *bridge)
> +{
> +	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +
> +	dsi_enable_video_outputs(&dsi->output);
> +}
> +
> +static void dsi_bridge_disable(struct drm_bridge *bridge)
> +{
> +	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +
> +	dsi_disable_video_outputs(&dsi->output);
> +}
> +
> +static const struct drm_bridge_funcs dsi_bridge_funcs = {
> +	.attach = dsi_bridge_attach,
> +	.mode_valid = dsi_bridge_mode_valid,
> +	.mode_set = dsi_bridge_mode_set,
> +	.enable = dsi_bridge_enable,
> +	.disable = dsi_bridge_disable,
> +};
> +
> +static void dsi_bridge_init(struct dsi_data *dsi)
> +{
> +	dsi->bridge.funcs = &dsi_bridge_funcs;
> +	dsi->bridge.of_node = dsi->host.dev->of_node;
> +	dsi->bridge.type = DRM_MODE_CONNECTOR_DSI;
> +
> +	drm_bridge_add(&dsi->bridge);
> +}
> +
> +static void dsi_bridge_cleanup(struct dsi_data *dsi)
> +{
> +	drm_bridge_remove(&dsi->bridge);
> +}
> +
>  /* -----------------------------------------------------------------------------
>   * Probe & Remove, Suspend & Resume
>   */
> @@ -5402,6 +5441,8 @@ static int dsi_init_output(struct dsi_data *dsi)
>  	struct omap_dss_device *out = &dsi->output;
>  	int r;
>  
> +	dsi_bridge_init(dsi);
> +
>  	out->dev = dsi->dev;
>  	out->id = dsi->module_id == 0 ?
>  			OMAP_DSS_OUTPUT_DSI1 : OMAP_DSS_OUTPUT_DSI2;
> @@ -5416,9 +5457,11 @@ static int dsi_init_output(struct dsi_data *dsi)
>  		       | DRM_BUS_FLAG_DE_HIGH
>  		       | DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE;
>  
> -	r = omapdss_device_init_output(out, NULL);
> -	if (r < 0)
> +	r = omapdss_device_init_output(out, &dsi->bridge);
> +	if (r < 0) {
> +		dsi_bridge_cleanup(dsi);
>  		return r;
> +	}
>  
>  	omapdss_device_register(out);
>  
> @@ -5431,6 +5474,7 @@ static void dsi_uninit_output(struct dsi_data *dsi)
>  
>  	omapdss_device_unregister(out);
>  	omapdss_device_cleanup_output(out);
> +	dsi_bridge_cleanup(dsi);
>  }
>  
>  static int dsi_probe_of(struct dsi_data *dsi)

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 41/56] drm/omap: dsi: Register a drm_bridge
@ 2020-11-09 10:54     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 10:54 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:18PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> In order to integrate with a chain of drm_bridge, the internal DSI
> output has to expose its operations through the drm_bridge API.
> Register a bridge at initialisation time to do so and remove the
> omap_dss_device operations that are now unused.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 134 ++++++++++++++++++++----------
>  1 file changed, 89 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index f643321434e9..bbcdb62e1571 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -35,6 +35,7 @@
>  #include <linux/component.h>
>  #include <linux/sys_soc.h>
>  
> +#include <drm/drm_bridge.h>
>  #include <drm/drm_mipi_dsi.h>
>  #include <drm/drm_panel.h>
>  #include <video/mipi_display.h>
> @@ -437,6 +438,7 @@ struct dsi_data {
>  	struct omap_dss_dsi_videomode_timings vm_timings;
>  
>  	struct omap_dss_device output;
> +	struct drm_bridge bridge;
>  };
>  
>  struct dsi_packet_sent_handler_data {
> @@ -449,6 +451,9 @@ static bool dsi_perf;
>  module_param(dsi_perf, bool, 0644);
>  #endif
>  
> +#define drm_bridge_to_dsi(bridge) \
> +	container_of(bridge, struct dsi_data, bridge)
> +
>  static inline struct dsi_data *to_dsi_data(struct omap_dss_device *dssdev)
>  {
>  	return dev_get_drvdata(dssdev->dev);
> @@ -5006,50 +5011,7 @@ static int dsi_get_clocks(struct dsi_data *dsi)
>  	return 0;
>  }
>  
> -static void dsi_set_timings(struct omap_dss_device *dssdev,
> -			    const struct drm_display_mode *mode)
> -{
> -	DSSDBG("dsi_set_timings\n");
> -	dsi_set_config(dssdev, mode);
> -}
> -
> -static int dsi_check_timings(struct omap_dss_device *dssdev,
> -			     struct drm_display_mode *mode)
> -{
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	struct dsi_clk_calc_ctx ctx;
> -	int r;
> -
> -	DSSDBG("dsi_check_timings\n");
> -
> -	mutex_lock(&dsi->lock);
> -	r = __dsi_calc_config(dsi, mode, &ctx);
> -	mutex_unlock(&dsi->lock);
> -
> -	return r;
> -}
> -
> -static int dsi_connect(struct omap_dss_device *src,
> -		       struct omap_dss_device *dst)
> -{
> -	return omapdss_device_connect(dst->dss, dst, dst->next);
> -}
> -
> -static void dsi_disconnect(struct omap_dss_device *src,
> -			   struct omap_dss_device *dst)
> -{
> -	omapdss_device_disconnect(dst, dst->next);
> -}
> -
>  static const struct omap_dss_device_ops dsi_ops = {
> -	.connect = dsi_connect,
> -	.disconnect = dsi_disconnect,
> -	.enable = dsi_enable_video_outputs,
> -	.disable = dsi_disable_video_outputs,
> -
> -	.check_timings = dsi_check_timings,
> -	.set_timings = dsi_set_timings,
> -
>  	.dsi = {
>  		.update = dsi_update_all,
>  		.is_video_mode = dsi_is_video_mode,
> @@ -5393,6 +5355,83 @@ static const struct component_ops dsi_component_ops = {
>  	.unbind	= dsi_unbind,
>  };
>  
> +/* -----------------------------------------------------------------------------
> + * DRM Bridge Operations
> + */
> +
> +static int dsi_bridge_attach(struct drm_bridge *bridge,
> +			     enum drm_bridge_attach_flags flags)
> +{
> +	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +
> +	if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
> +		return -EINVAL;
> +
> +	return drm_bridge_attach(bridge->encoder, dsi->output.next_bridge,
> +				 bridge, flags);
> +}
> +
> +static enum drm_mode_status
> +dsi_bridge_mode_valid(struct drm_bridge *bridge,
> +		      const struct drm_display_info *info,
> +		      const struct drm_display_mode *mode)
> +{
> +	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +	struct dsi_clk_calc_ctx ctx;
> +	int r;
> +
> +	mutex_lock(&dsi->lock);
> +	r = __dsi_calc_config(dsi, mode, &ctx);
> +	mutex_unlock(&dsi->lock);
> +
> +	return r ? MODE_CLOCK_RANGE : MODE_OK;
> +}
> +
> +static void dsi_bridge_mode_set(struct drm_bridge *bridge,
> +				const struct drm_display_mode *mode,
> +				const struct drm_display_mode *adjusted_mode)
> +{
> +	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +
> +	dsi_set_config(&dsi->output, adjusted_mode);
> +}
> +
> +static void dsi_bridge_enable(struct drm_bridge *bridge)
> +{
> +	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +
> +	dsi_enable_video_outputs(&dsi->output);
> +}
> +
> +static void dsi_bridge_disable(struct drm_bridge *bridge)
> +{
> +	struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +
> +	dsi_disable_video_outputs(&dsi->output);
> +}
> +
> +static const struct drm_bridge_funcs dsi_bridge_funcs = {
> +	.attach = dsi_bridge_attach,
> +	.mode_valid = dsi_bridge_mode_valid,
> +	.mode_set = dsi_bridge_mode_set,
> +	.enable = dsi_bridge_enable,
> +	.disable = dsi_bridge_disable,
> +};
> +
> +static void dsi_bridge_init(struct dsi_data *dsi)
> +{
> +	dsi->bridge.funcs = &dsi_bridge_funcs;
> +	dsi->bridge.of_node = dsi->host.dev->of_node;
> +	dsi->bridge.type = DRM_MODE_CONNECTOR_DSI;
> +
> +	drm_bridge_add(&dsi->bridge);
> +}
> +
> +static void dsi_bridge_cleanup(struct dsi_data *dsi)
> +{
> +	drm_bridge_remove(&dsi->bridge);
> +}
> +
>  /* -----------------------------------------------------------------------------
>   * Probe & Remove, Suspend & Resume
>   */
> @@ -5402,6 +5441,8 @@ static int dsi_init_output(struct dsi_data *dsi)
>  	struct omap_dss_device *out = &dsi->output;
>  	int r;
>  
> +	dsi_bridge_init(dsi);
> +
>  	out->dev = dsi->dev;
>  	out->id = dsi->module_id == 0 ?
>  			OMAP_DSS_OUTPUT_DSI1 : OMAP_DSS_OUTPUT_DSI2;
> @@ -5416,9 +5457,11 @@ static int dsi_init_output(struct dsi_data *dsi)
>  		       | DRM_BUS_FLAG_DE_HIGH
>  		       | DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE;
>  
> -	r = omapdss_device_init_output(out, NULL);
> -	if (r < 0)
> +	r = omapdss_device_init_output(out, &dsi->bridge);
> +	if (r < 0) {
> +		dsi_bridge_cleanup(dsi);
>  		return r;
> +	}
>  
>  	omapdss_device_register(out);
>  
> @@ -5431,6 +5474,7 @@ static void dsi_uninit_output(struct dsi_data *dsi)
>  
>  	omapdss_device_unregister(out);
>  	omapdss_device_cleanup_output(out);
> +	dsi_bridge_cleanup(dsi);
>  }
>  
>  static int dsi_probe_of(struct dsi_data *dsi)

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 42/56] drm/omap: remove legacy DSS device operations
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:01     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:01 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:19PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> All DSS devices have been converted to bridge API, so
> the device operations are always NULL. This removes
> the device ops function pointers and all code using it.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c       | 66 ------------------------
>  drivers/gpu/drm/omapdrm/dss/dss.c        |  8 ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h    | 34 ------------
>  drivers/gpu/drm/omapdrm/omap_connector.c | 29 -----------
>  drivers/gpu/drm/omapdrm/omap_encoder.c   | 40 --------------
>  5 files changed, 177 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index 8e08c49b4f97..c2791305c332 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -161,8 +161,6 @@ int omapdss_device_connect(struct dss_device *dss,
>  			   struct omap_dss_device *src,
>  			   struct omap_dss_device *dst)
>  {
> -	int ret;
> -
>  	dev_dbg(&dss->pdev->dev, "connect(%s, %s)\n",
>  		src ? dev_name(src->dev) : "NULL",
>  		dst ? dev_name(dst->dev) : "NULL");
> @@ -181,14 +179,6 @@ int omapdss_device_connect(struct dss_device *dss,
>  
>  	dst->dss = dss;
>  
> -	if (dst->ops && dst->ops->connect) {
> -		ret = dst->ops->connect(src, dst);
> -		if (ret < 0) {
> -			dst->dss = NULL;
> -			return ret;
> -		}
> -	}
> -
>  	return 0;
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_connect);
> @@ -212,66 +202,10 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
>  		return;
>  	}
>  
> -	WARN_ON(dst->state != OMAP_DSS_DISPLAY_DISABLED);
> -
> -	if (dst->ops && dst->ops->disconnect)
> -		dst->ops->disconnect(src, dst);
>  	dst->dss = NULL;
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
>  
> -void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
> -{
> -	if (!dssdev)
> -		return;
> -
> -	omapdss_device_pre_enable(dssdev->next);
> -
> -	if (dssdev->ops && dssdev->ops->pre_enable)
> -		dssdev->ops->pre_enable(dssdev);
> -}
> -EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
> -
> -void omapdss_device_enable(struct omap_dss_device *dssdev)
> -{
> -	if (!dssdev)
> -		return;
> -
> -	if (dssdev->ops && dssdev->ops->enable)
> -		dssdev->ops->enable(dssdev);
> -
> -	omapdss_device_enable(dssdev->next);
> -
> -	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
> -}
> -EXPORT_SYMBOL_GPL(omapdss_device_enable);
> -
> -void omapdss_device_disable(struct omap_dss_device *dssdev)
> -{
> -	if (!dssdev)
> -		return;
> -
> -	omapdss_device_disable(dssdev->next);
> -
> -	if (dssdev->ops && dssdev->ops->disable)
> -		dssdev->ops->disable(dssdev);
> -}
> -EXPORT_SYMBOL_GPL(omapdss_device_disable);
> -
> -void omapdss_device_post_disable(struct omap_dss_device *dssdev)
> -{
> -	if (!dssdev)
> -		return;
> -
> -	if (dssdev->ops && dssdev->ops->post_disable)
> -		dssdev->ops->post_disable(dssdev);
> -
> -	omapdss_device_post_disable(dssdev->next);
> -
> -	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> -}
> -EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
> -
>  /* -----------------------------------------------------------------------------
>   * Components Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
> index 6e86f4e67a2c..6a160138bf88 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1565,15 +1565,7 @@ static int dss_remove(struct platform_device *pdev)
>  
>  static void dss_shutdown(struct platform_device *pdev)
>  {
> -	struct omap_dss_device *dssdev = NULL;
> -
>  	DSSDBG("shutdown\n");
> -
> -	for_each_dss_output(dssdev) {
> -		if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE &&
> -		    dssdev->ops && dssdev->ops->disable)
> -			dssdev->ops->disable(dssdev);
> -	}
>  }

Should we call drm_atomic_helper_shutdown() here (in another patch) ?

>  
>  static int dss_runtime_suspend(struct device *dev)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 42d1ec3aaf0c..5d6edec5a427 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -123,11 +123,6 @@ enum omap_dss_dsi_mode {
>  	OMAP_DSS_DSI_VIDEO_MODE,
>  };
>  
> -enum omap_dss_display_state {
> -	OMAP_DSS_DISPLAY_DISABLED = 0,
> -	OMAP_DSS_DISPLAY_ACTIVE,
> -};
> -
>  enum omap_dss_rotation_type {
>  	OMAP_DSS_ROT_NONE	= 0,
>  	OMAP_DSS_ROT_TILER	= 1 << 0,
> @@ -281,24 +276,6 @@ struct omapdss_dsi_ops {
>  };
>  
>  struct omap_dss_device_ops {
> -	int (*connect)(struct omap_dss_device *dssdev,
> -			struct omap_dss_device *dst);
> -	void (*disconnect)(struct omap_dss_device *dssdev,
> -			struct omap_dss_device *dst);
> -
> -	void (*pre_enable)(struct omap_dss_device *dssdev);
> -	void (*enable)(struct omap_dss_device *dssdev);
> -	void (*disable)(struct omap_dss_device *dssdev);
> -	void (*post_disable)(struct omap_dss_device *dssdev);
> -
> -	int (*check_timings)(struct omap_dss_device *dssdev,
> -			     struct drm_display_mode *mode);
> -	void (*set_timings)(struct omap_dss_device *dssdev,
> -			    const struct drm_display_mode *mode);
> -
> -	int (*get_modes)(struct omap_dss_device *dssdev,
> -			 struct drm_connector *connector);
> -
>  	const struct omapdss_dsi_ops dsi;
>  };
>  
> @@ -342,8 +319,6 @@ struct omap_dss_device {
>  	unsigned long ops_flags;
>  	u32 bus_flags;
>  
> -	enum omap_dss_display_state state;
> -
>  	/* OMAP DSS output specific fields */
>  
>  	/* DISPC channel for this output */
> @@ -374,10 +349,6 @@ int omapdss_device_connect(struct dss_device *dss,
>  			   struct omap_dss_device *dst);
>  void omapdss_device_disconnect(struct omap_dss_device *src,
>  			       struct omap_dss_device *dst);
> -void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
> -void omapdss_device_enable(struct omap_dss_device *dssdev);
> -void omapdss_device_disable(struct omap_dss_device *dssdev);
> -void omapdss_device_post_disable(struct omap_dss_device *dssdev);
>  
>  int omap_dss_get_num_overlay_managers(void);
>  
> @@ -397,11 +368,6 @@ int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
>  int omapdss_compat_init(void);
>  void omapdss_compat_uninit(void);
>  
> -static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
> -{
> -	return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
> -}
> -
>  enum dss_writeback_channel {
>  	DSS_WB_LCD1_MGR =	0,
>  	DSS_WB_LCD2_MGR =	1,
> diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
> index de95dc1b861c..c6d9b4268841 100644
> --- a/drivers/gpu/drm/omapdrm/omap_connector.c
> +++ b/drivers/gpu/drm/omapdrm/omap_connector.c
> @@ -43,24 +43,8 @@ static void omap_connector_destroy(struct drm_connector *connector)
>  
>  static int omap_connector_get_modes(struct drm_connector *connector)
>  {
> -	struct omap_connector *omap_connector = to_omap_connector(connector);
> -	struct omap_dss_device *dssdev = NULL;
> -	struct omap_dss_device *d;
> -
>  	DBG("%s", connector->name);
>  
> -	/*
> -	 * If the display pipeline reports modes (e.g. with a fixed resolution
> -	 * panel or an analog TV output), query it.
> -	 */
> -	for (d = omap_connector->output; d; d = d->next) {
> -		if (d->ops_flags & OMAP_DSS_DEVICE_OP_MODES)
> -			dssdev = d;
> -	}
> -
> -	if (dssdev)
> -		return dssdev->ops->get_modes(dssdev, connector);
> -
>  	/* We can't retrieve modes. The KMS core will add the default modes. */
>  	return 0;
>  }
> @@ -69,19 +53,6 @@ enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
>  					const struct drm_display_mode *mode,
>  					struct drm_display_mode *adjusted_mode)
>  {
> -	int ret;
> -
> -	drm_mode_copy(adjusted_mode, mode);
> -
> -	for (; dssdev; dssdev = dssdev->next) {
> -		if (!dssdev->ops || !dssdev->ops->check_timings)
> -			continue;
> -
> -		ret = dssdev->ops->check_timings(dssdev, adjusted_mode);
> -		if (ret)
> -			return MODE_BAD;
> -	}
> -
>  	return MODE_OK;
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index 10abe4d01b0b..abb3821de8b8 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -115,11 +115,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
>  
>  	/* Set timings for all devices in the display pipeline. */
>  	dss_mgr_set_timings(output, &vm);
> -
> -	for (dssdev = output; dssdev; dssdev = dssdev->next) {
> -		if (dssdev->ops && dssdev->ops->set_timings)
> -			dssdev->ops->set_timings(dssdev, adjusted_mode);
> -	}
>  }
>  
>  static void omap_encoder_disable(struct drm_encoder *encoder)
> @@ -129,25 +124,6 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
>  	struct drm_device *dev = encoder->dev;
>  
>  	dev_dbg(dev->dev, "disable(%s)\n", dssdev->name);
> -
> -	/*
> -	 * Disable the chain of external devices, starting at the one at the
> -	 * internal encoder's output.
> -	 */
> -	omapdss_device_disable(dssdev->next);
> -
> -	/*
> -	 * Disable the internal encoder. This will disable the DSS output.
> -	 */
> -	if (dssdev->ops && dssdev->ops->disable)
> -		dssdev->ops->disable(dssdev);
> -	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> -
> -	/*
> -	 * Perform the post-disable operations on the chain of external devices
> -	 * to complete the display pipeline disable.
> -	 */
> -	omapdss_device_post_disable(dssdev->next);
>  }
>  
>  static void omap_encoder_enable(struct drm_encoder *encoder)
> @@ -157,22 +133,6 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
>  	struct drm_device *dev = encoder->dev;
>  
>  	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
> -
> -	/* Prepare the chain of external devices for pipeline enable. */
> -	omapdss_device_pre_enable(dssdev->next);
> -
> -	/*
> -	 * Enable the internal encoder. This will enable the DSS output.
> -	 */
> -	if (dssdev->ops && dssdev->ops->enable)
> -		dssdev->ops->enable(dssdev);
> -	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
> -
> -	/*
> -	 * Enable the chain of external devices, starting at the one at the
> -	 * internal encoder's output.
> -	 */
> -	omapdss_device_enable(dssdev->next);
>  }

Now that the enable and disable functions are empty, we can drop them
completely.

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

>  
>  static int omap_encoder_atomic_check(struct drm_encoder *encoder,

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 42/56] drm/omap: remove legacy DSS device operations
@ 2020-11-09 11:01     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:01 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:19PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> All DSS devices have been converted to bridge API, so
> the device operations are always NULL. This removes
> the device ops function pointers and all code using it.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c       | 66 ------------------------
>  drivers/gpu/drm/omapdrm/dss/dss.c        |  8 ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h    | 34 ------------
>  drivers/gpu/drm/omapdrm/omap_connector.c | 29 -----------
>  drivers/gpu/drm/omapdrm/omap_encoder.c   | 40 --------------
>  5 files changed, 177 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index 8e08c49b4f97..c2791305c332 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -161,8 +161,6 @@ int omapdss_device_connect(struct dss_device *dss,
>  			   struct omap_dss_device *src,
>  			   struct omap_dss_device *dst)
>  {
> -	int ret;
> -
>  	dev_dbg(&dss->pdev->dev, "connect(%s, %s)\n",
>  		src ? dev_name(src->dev) : "NULL",
>  		dst ? dev_name(dst->dev) : "NULL");
> @@ -181,14 +179,6 @@ int omapdss_device_connect(struct dss_device *dss,
>  
>  	dst->dss = dss;
>  
> -	if (dst->ops && dst->ops->connect) {
> -		ret = dst->ops->connect(src, dst);
> -		if (ret < 0) {
> -			dst->dss = NULL;
> -			return ret;
> -		}
> -	}
> -
>  	return 0;
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_connect);
> @@ -212,66 +202,10 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
>  		return;
>  	}
>  
> -	WARN_ON(dst->state != OMAP_DSS_DISPLAY_DISABLED);
> -
> -	if (dst->ops && dst->ops->disconnect)
> -		dst->ops->disconnect(src, dst);
>  	dst->dss = NULL;
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
>  
> -void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
> -{
> -	if (!dssdev)
> -		return;
> -
> -	omapdss_device_pre_enable(dssdev->next);
> -
> -	if (dssdev->ops && dssdev->ops->pre_enable)
> -		dssdev->ops->pre_enable(dssdev);
> -}
> -EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
> -
> -void omapdss_device_enable(struct omap_dss_device *dssdev)
> -{
> -	if (!dssdev)
> -		return;
> -
> -	if (dssdev->ops && dssdev->ops->enable)
> -		dssdev->ops->enable(dssdev);
> -
> -	omapdss_device_enable(dssdev->next);
> -
> -	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
> -}
> -EXPORT_SYMBOL_GPL(omapdss_device_enable);
> -
> -void omapdss_device_disable(struct omap_dss_device *dssdev)
> -{
> -	if (!dssdev)
> -		return;
> -
> -	omapdss_device_disable(dssdev->next);
> -
> -	if (dssdev->ops && dssdev->ops->disable)
> -		dssdev->ops->disable(dssdev);
> -}
> -EXPORT_SYMBOL_GPL(omapdss_device_disable);
> -
> -void omapdss_device_post_disable(struct omap_dss_device *dssdev)
> -{
> -	if (!dssdev)
> -		return;
> -
> -	if (dssdev->ops && dssdev->ops->post_disable)
> -		dssdev->ops->post_disable(dssdev);
> -
> -	omapdss_device_post_disable(dssdev->next);
> -
> -	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> -}
> -EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
> -
>  /* -----------------------------------------------------------------------------
>   * Components Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
> index 6e86f4e67a2c..6a160138bf88 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1565,15 +1565,7 @@ static int dss_remove(struct platform_device *pdev)
>  
>  static void dss_shutdown(struct platform_device *pdev)
>  {
> -	struct omap_dss_device *dssdev = NULL;
> -
>  	DSSDBG("shutdown\n");
> -
> -	for_each_dss_output(dssdev) {
> -		if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE &&
> -		    dssdev->ops && dssdev->ops->disable)
> -			dssdev->ops->disable(dssdev);
> -	}
>  }

Should we call drm_atomic_helper_shutdown() here (in another patch) ?

>  
>  static int dss_runtime_suspend(struct device *dev)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 42d1ec3aaf0c..5d6edec5a427 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -123,11 +123,6 @@ enum omap_dss_dsi_mode {
>  	OMAP_DSS_DSI_VIDEO_MODE,
>  };
>  
> -enum omap_dss_display_state {
> -	OMAP_DSS_DISPLAY_DISABLED = 0,
> -	OMAP_DSS_DISPLAY_ACTIVE,
> -};
> -
>  enum omap_dss_rotation_type {
>  	OMAP_DSS_ROT_NONE	= 0,
>  	OMAP_DSS_ROT_TILER	= 1 << 0,
> @@ -281,24 +276,6 @@ struct omapdss_dsi_ops {
>  };
>  
>  struct omap_dss_device_ops {
> -	int (*connect)(struct omap_dss_device *dssdev,
> -			struct omap_dss_device *dst);
> -	void (*disconnect)(struct omap_dss_device *dssdev,
> -			struct omap_dss_device *dst);
> -
> -	void (*pre_enable)(struct omap_dss_device *dssdev);
> -	void (*enable)(struct omap_dss_device *dssdev);
> -	void (*disable)(struct omap_dss_device *dssdev);
> -	void (*post_disable)(struct omap_dss_device *dssdev);
> -
> -	int (*check_timings)(struct omap_dss_device *dssdev,
> -			     struct drm_display_mode *mode);
> -	void (*set_timings)(struct omap_dss_device *dssdev,
> -			    const struct drm_display_mode *mode);
> -
> -	int (*get_modes)(struct omap_dss_device *dssdev,
> -			 struct drm_connector *connector);
> -
>  	const struct omapdss_dsi_ops dsi;
>  };
>  
> @@ -342,8 +319,6 @@ struct omap_dss_device {
>  	unsigned long ops_flags;
>  	u32 bus_flags;
>  
> -	enum omap_dss_display_state state;
> -
>  	/* OMAP DSS output specific fields */
>  
>  	/* DISPC channel for this output */
> @@ -374,10 +349,6 @@ int omapdss_device_connect(struct dss_device *dss,
>  			   struct omap_dss_device *dst);
>  void omapdss_device_disconnect(struct omap_dss_device *src,
>  			       struct omap_dss_device *dst);
> -void omapdss_device_pre_enable(struct omap_dss_device *dssdev);
> -void omapdss_device_enable(struct omap_dss_device *dssdev);
> -void omapdss_device_disable(struct omap_dss_device *dssdev);
> -void omapdss_device_post_disable(struct omap_dss_device *dssdev);
>  
>  int omap_dss_get_num_overlay_managers(void);
>  
> @@ -397,11 +368,6 @@ int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
>  int omapdss_compat_init(void);
>  void omapdss_compat_uninit(void);
>  
> -static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
> -{
> -	return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
> -}
> -
>  enum dss_writeback_channel {
>  	DSS_WB_LCD1_MGR =	0,
>  	DSS_WB_LCD2_MGR =	1,
> diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
> index de95dc1b861c..c6d9b4268841 100644
> --- a/drivers/gpu/drm/omapdrm/omap_connector.c
> +++ b/drivers/gpu/drm/omapdrm/omap_connector.c
> @@ -43,24 +43,8 @@ static void omap_connector_destroy(struct drm_connector *connector)
>  
>  static int omap_connector_get_modes(struct drm_connector *connector)
>  {
> -	struct omap_connector *omap_connector = to_omap_connector(connector);
> -	struct omap_dss_device *dssdev = NULL;
> -	struct omap_dss_device *d;
> -
>  	DBG("%s", connector->name);
>  
> -	/*
> -	 * If the display pipeline reports modes (e.g. with a fixed resolution
> -	 * panel or an analog TV output), query it.
> -	 */
> -	for (d = omap_connector->output; d; d = d->next) {
> -		if (d->ops_flags & OMAP_DSS_DEVICE_OP_MODES)
> -			dssdev = d;
> -	}
> -
> -	if (dssdev)
> -		return dssdev->ops->get_modes(dssdev, connector);
> -
>  	/* We can't retrieve modes. The KMS core will add the default modes. */
>  	return 0;
>  }
> @@ -69,19 +53,6 @@ enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
>  					const struct drm_display_mode *mode,
>  					struct drm_display_mode *adjusted_mode)
>  {
> -	int ret;
> -
> -	drm_mode_copy(adjusted_mode, mode);
> -
> -	for (; dssdev; dssdev = dssdev->next) {
> -		if (!dssdev->ops || !dssdev->ops->check_timings)
> -			continue;
> -
> -		ret = dssdev->ops->check_timings(dssdev, adjusted_mode);
> -		if (ret)
> -			return MODE_BAD;
> -	}
> -
>  	return MODE_OK;
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index 10abe4d01b0b..abb3821de8b8 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -115,11 +115,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
>  
>  	/* Set timings for all devices in the display pipeline. */
>  	dss_mgr_set_timings(output, &vm);
> -
> -	for (dssdev = output; dssdev; dssdev = dssdev->next) {
> -		if (dssdev->ops && dssdev->ops->set_timings)
> -			dssdev->ops->set_timings(dssdev, adjusted_mode);
> -	}
>  }
>  
>  static void omap_encoder_disable(struct drm_encoder *encoder)
> @@ -129,25 +124,6 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
>  	struct drm_device *dev = encoder->dev;
>  
>  	dev_dbg(dev->dev, "disable(%s)\n", dssdev->name);
> -
> -	/*
> -	 * Disable the chain of external devices, starting at the one at the
> -	 * internal encoder's output.
> -	 */
> -	omapdss_device_disable(dssdev->next);
> -
> -	/*
> -	 * Disable the internal encoder. This will disable the DSS output.
> -	 */
> -	if (dssdev->ops && dssdev->ops->disable)
> -		dssdev->ops->disable(dssdev);
> -	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> -
> -	/*
> -	 * Perform the post-disable operations on the chain of external devices
> -	 * to complete the display pipeline disable.
> -	 */
> -	omapdss_device_post_disable(dssdev->next);
>  }
>  
>  static void omap_encoder_enable(struct drm_encoder *encoder)
> @@ -157,22 +133,6 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
>  	struct drm_device *dev = encoder->dev;
>  
>  	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
> -
> -	/* Prepare the chain of external devices for pipeline enable. */
> -	omapdss_device_pre_enable(dssdev->next);
> -
> -	/*
> -	 * Enable the internal encoder. This will enable the DSS output.
> -	 */
> -	if (dssdev->ops && dssdev->ops->enable)
> -		dssdev->ops->enable(dssdev);
> -	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
> -
> -	/*
> -	 * Enable the chain of external devices, starting at the one at the
> -	 * internal encoder's output.
> -	 */
> -	omapdss_device_enable(dssdev->next);
>  }

Now that the enable and disable functions are empty, we can drop them
completely.

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

>  
>  static int omap_encoder_atomic_check(struct drm_encoder *encoder,

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 43/56] drm/omap: remove unused omap_connector
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:02     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:02 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:20PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Remove unused code. Connectors are now created via drm_bridge_connector_init()
> and no longer OMAP specific.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/Makefile         |   1 -
>  drivers/gpu/drm/omapdrm/omap_connector.c | 128 -----------------------
>  drivers/gpu/drm/omapdrm/omap_connector.h |  28 -----
>  drivers/gpu/drm/omapdrm/omap_drv.c       |  19 ++--
>  drivers/gpu/drm/omapdrm/omap_drv.h       |   1 -
>  drivers/gpu/drm/omapdrm/omap_encoder.c   |  11 --
>  6 files changed, 6 insertions(+), 182 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.c
>  delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.h
> 
> diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
> index 66a73eae6f7c..2a404e045b78 100644
> --- a/drivers/gpu/drm/omapdrm/Makefile
> +++ b/drivers/gpu/drm/omapdrm/Makefile
> @@ -12,7 +12,6 @@ omapdrm-y := omap_drv.o \
>  	omap_crtc.o \
>  	omap_plane.o \
>  	omap_encoder.o \
> -	omap_connector.o \
>  	omap_fb.o \
>  	omap_gem.o \
>  	omap_gem_dmabuf.o \
> diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
> deleted file mode 100644
> index c6d9b4268841..000000000000
> --- a/drivers/gpu/drm/omapdrm/omap_connector.c
> +++ /dev/null
> @@ -1,128 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-only
> -/*
> - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
> - * Author: Rob Clark <rob@ti.com>
> - */
> -
> -#include <drm/drm_atomic_helper.h>
> -#include <drm/drm_crtc.h>
> -#include <drm/drm_probe_helper.h>
> -
> -#include "omap_drv.h"
> -
> -/*
> - * connector funcs
> - */
> -
> -#define to_omap_connector(x) container_of(x, struct omap_connector, base)
> -
> -struct omap_connector {
> -	struct drm_connector base;
> -	struct omap_dss_device *output;
> -};
> -
> -static enum drm_connector_status omap_connector_detect(
> -		struct drm_connector *connector, bool force)
> -{
> -	return connector_status_connected;
> -}
> -
> -static void omap_connector_destroy(struct drm_connector *connector)
> -{
> -	struct omap_connector *omap_connector = to_omap_connector(connector);
> -
> -	DBG("%s", connector->name);
> -
> -	drm_connector_unregister(connector);
> -	drm_connector_cleanup(connector);
> -
> -	omapdss_device_put(omap_connector->output);
> -
> -	kfree(omap_connector);
> -}
> -
> -static int omap_connector_get_modes(struct drm_connector *connector)
> -{
> -	DBG("%s", connector->name);
> -
> -	/* We can't retrieve modes. The KMS core will add the default modes. */
> -	return 0;
> -}
> -
> -enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
> -					const struct drm_display_mode *mode,
> -					struct drm_display_mode *adjusted_mode)
> -{
> -	return MODE_OK;
> -}
> -
> -static enum drm_mode_status omap_connector_mode_valid(struct drm_connector *connector,
> -				 struct drm_display_mode *mode)
> -{
> -	struct omap_connector *omap_connector = to_omap_connector(connector);
> -	struct drm_display_mode new_mode = {};
> -	enum drm_mode_status status;
> -
> -	status = omap_connector_mode_fixup(omap_connector->output, mode,
> -					   &new_mode);
> -	if (status != MODE_OK)
> -		goto done;
> -
> -	/* Check if vrefresh is still valid. */
> -	if (drm_mode_vrefresh(mode) != drm_mode_vrefresh(&new_mode))
> -		status = MODE_NOCLOCK;
> -
> -done:
> -	DBG("connector: mode %s: " DRM_MODE_FMT,
> -			(status == MODE_OK) ? "valid" : "invalid",
> -			DRM_MODE_ARG(mode));
> -
> -	return status;
> -}
> -
> -static const struct drm_connector_funcs omap_connector_funcs = {
> -	.reset = drm_atomic_helper_connector_reset,
> -	.detect = omap_connector_detect,
> -	.fill_modes = drm_helper_probe_single_connector_modes,
> -	.destroy = omap_connector_destroy,
> -	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> -	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> -};
> -
> -static const struct drm_connector_helper_funcs omap_connector_helper_funcs = {
> -	.get_modes = omap_connector_get_modes,
> -	.mode_valid = omap_connector_mode_valid,
> -};
> -
> -/* initialize connector */
> -struct drm_connector *omap_connector_init(struct drm_device *dev,
> -					  struct omap_dss_device *output,
> -					  struct drm_encoder *encoder)
> -{
> -	struct drm_connector *connector = NULL;
> -	struct omap_connector *omap_connector;
> -
> -	DBG("%s", output->name);
> -
> -	omap_connector = kzalloc(sizeof(*omap_connector), GFP_KERNEL);
> -	if (!omap_connector)
> -		goto fail;
> -
> -	omap_connector->output = omapdss_device_get(output);
> -
> -	connector = &omap_connector->base;
> -	connector->interlace_allowed = 1;
> -	connector->doublescan_allowed = 0;
> -
> -	drm_connector_init(dev, connector, &omap_connector_funcs,
> -			   DRM_MODE_CONNECTOR_DSI);
> -	drm_connector_helper_add(connector, &omap_connector_helper_funcs);
> -
> -	return connector;
> -
> -fail:
> -	if (connector)
> -		omap_connector_destroy(connector);
> -
> -	return NULL;
> -}
> diff --git a/drivers/gpu/drm/omapdrm/omap_connector.h b/drivers/gpu/drm/omapdrm/omap_connector.h
> deleted file mode 100644
> index 0ecd4f1655b7..000000000000
> --- a/drivers/gpu/drm/omapdrm/omap_connector.h
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0-only */
> -/*
> - * omap_connector.h -- OMAP DRM Connector
> - *
> - * Copyright (C) 2011 Texas Instruments
> - * Author: Rob Clark <rob@ti.com>
> - */
> -
> -#ifndef __OMAPDRM_CONNECTOR_H__
> -#define __OMAPDRM_CONNECTOR_H__
> -
> -#include <linux/types.h>
> -
> -enum drm_mode_status;
> -
> -struct drm_connector;
> -struct drm_device;
> -struct drm_encoder;
> -struct omap_dss_device;
> -
> -struct drm_connector *omap_connector_init(struct drm_device *dev,
> -					  struct omap_dss_device *output,
> -					  struct drm_encoder *encoder);
> -enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
> -					const struct drm_display_mode *mode,
> -					struct drm_display_mode *adjusted_mode);
> -
> -#endif /* __OMAPDRM_CONNECTOR_H__ */
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index b342f5b6ced0..20b5b4e9071c 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -332,19 +332,12 @@ static int omap_modeset_init(struct drm_device *dev)
>  		struct drm_encoder *encoder = pipe->encoder;
>  		struct drm_crtc *crtc;
>  
> -		if (pipe->output->next) {
> -			pipe->connector = omap_connector_init(dev, pipe->output,
> -							      encoder);
> -			if (!pipe->connector)
> -				return -ENOMEM;
> -		} else {
> -			pipe->connector = drm_bridge_connector_init(dev, encoder);
> -			if (IS_ERR(pipe->connector)) {
> -				dev_err(priv->dev,
> -					"unable to create bridge connector for %s\n",
> -					pipe->output->name);
> -				return PTR_ERR(pipe->connector);
> -			}
> +		pipe->connector = drm_bridge_connector_init(dev, encoder);
> +		if (IS_ERR(pipe->connector)) {
> +			dev_err(priv->dev,
> +				"unable to create bridge connector for %s\n",
> +				pipe->output->name);
> +			return PTR_ERR(pipe->connector);
>  		}
>  
>  		drm_connector_attach_encoder(pipe->connector, encoder);
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
> index 8a1fac680138..93d171ffd26d 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.h
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.h
> @@ -16,7 +16,6 @@
>  #include <drm/drm_gem.h>
>  #include <drm/omap_drm.h>
>  
> -#include "omap_connector.h"
>  #include "omap_crtc.h"
>  #include "omap_encoder.h"
>  #include "omap_fb.h"
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index abb3821de8b8..610c5a2f2771 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -139,17 +139,6 @@ static int omap_encoder_atomic_check(struct drm_encoder *encoder,
>  				     struct drm_crtc_state *crtc_state,
>  				     struct drm_connector_state *conn_state)
>  {
> -	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
> -	enum drm_mode_status status;
> -
> -	status = omap_connector_mode_fixup(omap_encoder->output,
> -					   &crtc_state->mode,
> -					   &crtc_state->adjusted_mode);
> -	if (status != MODE_OK) {
> -		dev_err(encoder->dev->dev, "invalid timings: %d\n", status);
> -		return -EINVAL;
> -	}
> -
>  	return 0;
>  }

We can drop this function.

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

>  

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 43/56] drm/omap: remove unused omap_connector
@ 2020-11-09 11:02     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:02 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:20PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Remove unused code. Connectors are now created via drm_bridge_connector_init()
> and no longer OMAP specific.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/Makefile         |   1 -
>  drivers/gpu/drm/omapdrm/omap_connector.c | 128 -----------------------
>  drivers/gpu/drm/omapdrm/omap_connector.h |  28 -----
>  drivers/gpu/drm/omapdrm/omap_drv.c       |  19 ++--
>  drivers/gpu/drm/omapdrm/omap_drv.h       |   1 -
>  drivers/gpu/drm/omapdrm/omap_encoder.c   |  11 --
>  6 files changed, 6 insertions(+), 182 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.c
>  delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.h
> 
> diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
> index 66a73eae6f7c..2a404e045b78 100644
> --- a/drivers/gpu/drm/omapdrm/Makefile
> +++ b/drivers/gpu/drm/omapdrm/Makefile
> @@ -12,7 +12,6 @@ omapdrm-y := omap_drv.o \
>  	omap_crtc.o \
>  	omap_plane.o \
>  	omap_encoder.o \
> -	omap_connector.o \
>  	omap_fb.o \
>  	omap_gem.o \
>  	omap_gem_dmabuf.o \
> diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
> deleted file mode 100644
> index c6d9b4268841..000000000000
> --- a/drivers/gpu/drm/omapdrm/omap_connector.c
> +++ /dev/null
> @@ -1,128 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-only
> -/*
> - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
> - * Author: Rob Clark <rob@ti.com>
> - */
> -
> -#include <drm/drm_atomic_helper.h>
> -#include <drm/drm_crtc.h>
> -#include <drm/drm_probe_helper.h>
> -
> -#include "omap_drv.h"
> -
> -/*
> - * connector funcs
> - */
> -
> -#define to_omap_connector(x) container_of(x, struct omap_connector, base)
> -
> -struct omap_connector {
> -	struct drm_connector base;
> -	struct omap_dss_device *output;
> -};
> -
> -static enum drm_connector_status omap_connector_detect(
> -		struct drm_connector *connector, bool force)
> -{
> -	return connector_status_connected;
> -}
> -
> -static void omap_connector_destroy(struct drm_connector *connector)
> -{
> -	struct omap_connector *omap_connector = to_omap_connector(connector);
> -
> -	DBG("%s", connector->name);
> -
> -	drm_connector_unregister(connector);
> -	drm_connector_cleanup(connector);
> -
> -	omapdss_device_put(omap_connector->output);
> -
> -	kfree(omap_connector);
> -}
> -
> -static int omap_connector_get_modes(struct drm_connector *connector)
> -{
> -	DBG("%s", connector->name);
> -
> -	/* We can't retrieve modes. The KMS core will add the default modes. */
> -	return 0;
> -}
> -
> -enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
> -					const struct drm_display_mode *mode,
> -					struct drm_display_mode *adjusted_mode)
> -{
> -	return MODE_OK;
> -}
> -
> -static enum drm_mode_status omap_connector_mode_valid(struct drm_connector *connector,
> -				 struct drm_display_mode *mode)
> -{
> -	struct omap_connector *omap_connector = to_omap_connector(connector);
> -	struct drm_display_mode new_mode = {};
> -	enum drm_mode_status status;
> -
> -	status = omap_connector_mode_fixup(omap_connector->output, mode,
> -					   &new_mode);
> -	if (status != MODE_OK)
> -		goto done;
> -
> -	/* Check if vrefresh is still valid. */
> -	if (drm_mode_vrefresh(mode) != drm_mode_vrefresh(&new_mode))
> -		status = MODE_NOCLOCK;
> -
> -done:
> -	DBG("connector: mode %s: " DRM_MODE_FMT,
> -			(status == MODE_OK) ? "valid" : "invalid",
> -			DRM_MODE_ARG(mode));
> -
> -	return status;
> -}
> -
> -static const struct drm_connector_funcs omap_connector_funcs = {
> -	.reset = drm_atomic_helper_connector_reset,
> -	.detect = omap_connector_detect,
> -	.fill_modes = drm_helper_probe_single_connector_modes,
> -	.destroy = omap_connector_destroy,
> -	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> -	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> -};
> -
> -static const struct drm_connector_helper_funcs omap_connector_helper_funcs = {
> -	.get_modes = omap_connector_get_modes,
> -	.mode_valid = omap_connector_mode_valid,
> -};
> -
> -/* initialize connector */
> -struct drm_connector *omap_connector_init(struct drm_device *dev,
> -					  struct omap_dss_device *output,
> -					  struct drm_encoder *encoder)
> -{
> -	struct drm_connector *connector = NULL;
> -	struct omap_connector *omap_connector;
> -
> -	DBG("%s", output->name);
> -
> -	omap_connector = kzalloc(sizeof(*omap_connector), GFP_KERNEL);
> -	if (!omap_connector)
> -		goto fail;
> -
> -	omap_connector->output = omapdss_device_get(output);
> -
> -	connector = &omap_connector->base;
> -	connector->interlace_allowed = 1;
> -	connector->doublescan_allowed = 0;
> -
> -	drm_connector_init(dev, connector, &omap_connector_funcs,
> -			   DRM_MODE_CONNECTOR_DSI);
> -	drm_connector_helper_add(connector, &omap_connector_helper_funcs);
> -
> -	return connector;
> -
> -fail:
> -	if (connector)
> -		omap_connector_destroy(connector);
> -
> -	return NULL;
> -}
> diff --git a/drivers/gpu/drm/omapdrm/omap_connector.h b/drivers/gpu/drm/omapdrm/omap_connector.h
> deleted file mode 100644
> index 0ecd4f1655b7..000000000000
> --- a/drivers/gpu/drm/omapdrm/omap_connector.h
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0-only */
> -/*
> - * omap_connector.h -- OMAP DRM Connector
> - *
> - * Copyright (C) 2011 Texas Instruments
> - * Author: Rob Clark <rob@ti.com>
> - */
> -
> -#ifndef __OMAPDRM_CONNECTOR_H__
> -#define __OMAPDRM_CONNECTOR_H__
> -
> -#include <linux/types.h>
> -
> -enum drm_mode_status;
> -
> -struct drm_connector;
> -struct drm_device;
> -struct drm_encoder;
> -struct omap_dss_device;
> -
> -struct drm_connector *omap_connector_init(struct drm_device *dev,
> -					  struct omap_dss_device *output,
> -					  struct drm_encoder *encoder);
> -enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
> -					const struct drm_display_mode *mode,
> -					struct drm_display_mode *adjusted_mode);
> -
> -#endif /* __OMAPDRM_CONNECTOR_H__ */
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index b342f5b6ced0..20b5b4e9071c 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -332,19 +332,12 @@ static int omap_modeset_init(struct drm_device *dev)
>  		struct drm_encoder *encoder = pipe->encoder;
>  		struct drm_crtc *crtc;
>  
> -		if (pipe->output->next) {
> -			pipe->connector = omap_connector_init(dev, pipe->output,
> -							      encoder);
> -			if (!pipe->connector)
> -				return -ENOMEM;
> -		} else {
> -			pipe->connector = drm_bridge_connector_init(dev, encoder);
> -			if (IS_ERR(pipe->connector)) {
> -				dev_err(priv->dev,
> -					"unable to create bridge connector for %s\n",
> -					pipe->output->name);
> -				return PTR_ERR(pipe->connector);
> -			}
> +		pipe->connector = drm_bridge_connector_init(dev, encoder);
> +		if (IS_ERR(pipe->connector)) {
> +			dev_err(priv->dev,
> +				"unable to create bridge connector for %s\n",
> +				pipe->output->name);
> +			return PTR_ERR(pipe->connector);
>  		}
>  
>  		drm_connector_attach_encoder(pipe->connector, encoder);
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
> index 8a1fac680138..93d171ffd26d 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.h
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.h
> @@ -16,7 +16,6 @@
>  #include <drm/drm_gem.h>
>  #include <drm/omap_drm.h>
>  
> -#include "omap_connector.h"
>  #include "omap_crtc.h"
>  #include "omap_encoder.h"
>  #include "omap_fb.h"
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index abb3821de8b8..610c5a2f2771 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -139,17 +139,6 @@ static int omap_encoder_atomic_check(struct drm_encoder *encoder,
>  				     struct drm_crtc_state *crtc_state,
>  				     struct drm_connector_state *conn_state)
>  {
> -	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
> -	enum drm_mode_status status;
> -
> -	status = omap_connector_mode_fixup(omap_encoder->output,
> -					   &crtc_state->mode,
> -					   &crtc_state->adjusted_mode);
> -	if (status != MODE_OK) {
> -		dev_err(encoder->dev->dev, "invalid timings: %d\n", status);
> -		return -EINVAL;
> -	}
> -
>  	return 0;
>  }

We can drop this function.

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

>  

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 44/56] drm/omap: simplify omap_display_id
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:03     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:03 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:21PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> We no longer need to check for the DSS API, since all encoders,
> panels and connectors have been converted to the bridge API.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/omap_drv.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 20b5b4e9071c..dbb8e95234b3 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -206,14 +206,7 @@ static int omap_display_id(struct omap_dss_device *output)
>  {
>  	struct device_node *node = NULL;
>  
> -	if (output->next) {
> -		struct omap_dss_device *display = output;
> -
> -		while (display->next)
> -			display = display->next;
> -
> -		node = display->dev->of_node;
> -	} else if (output->bridge) {
> +	if (output->bridge) {
>  		struct drm_bridge *bridge = output->bridge;
>  
>  		while (drm_bridge_get_next_bridge(bridge))
> 

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 44/56] drm/omap: simplify omap_display_id
@ 2020-11-09 11:03     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:03 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:21PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> We no longer need to check for the DSS API, since all encoders,
> panels and connectors have been converted to the bridge API.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/omap_drv.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 20b5b4e9071c..dbb8e95234b3 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -206,14 +206,7 @@ static int omap_display_id(struct omap_dss_device *output)
>  {
>  	struct device_node *node = NULL;
>  
> -	if (output->next) {
> -		struct omap_dss_device *display = output;
> -
> -		while (display->next)
> -			display = display->next;
> -
> -		node = display->dev->of_node;
> -	} else if (output->bridge) {
> +	if (output->bridge) {
>  		struct drm_bridge *bridge = output->bridge;
>  
>  		while (drm_bridge_get_next_bridge(bridge))
> 

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 45/56] drm/omap: drop unused DSS next pointer
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:04     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:04 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:22PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Since all encoders and panels are using the bridge API now,
> we next pointer is no longer useful and can be dropped.

I would squash this with the previous patch.

> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c     |  2 +-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  1 -
>  drivers/gpu/drm/omapdrm/dss/output.c   | 13 +------------
>  drivers/gpu/drm/omapdrm/omap_encoder.c |  4 ----
>  4 files changed, 2 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index c2791305c332..d62713b241d2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -135,7 +135,7 @@ struct omap_dss_device *omapdss_device_next_output(struct omap_dss_device *from)
>  			goto done;
>  		}
>  
> -		if (dssdev->id && (dssdev->next || dssdev->bridge))
> +		if (dssdev->id && (dssdev->bridge))

No need for the inner parentheses.

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

>  			goto done;
>  	}
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 5d6edec5a427..1f02d3e406dc 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -293,7 +293,6 @@ struct omap_dss_device {
>  	struct module *owner;
>  
>  	struct dss_device *dss;
> -	struct omap_dss_device *next;
>  	struct drm_bridge *bridge;
>  	struct drm_bridge *next_bridge;
>  	struct drm_panel *panel;
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
> index ce21c798cca6..40cb353572f6 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -30,7 +30,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>  		return 0;
>  	}
>  
> -	out->next = omapdss_find_device_by_node(remote_node);
>  	out->bridge = of_drm_find_bridge(remote_node);
>  	out->panel = of_drm_find_panel(remote_node);
>  	if (IS_ERR(out->panel))
> @@ -38,12 +37,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>  
>  	of_node_put(remote_node);
>  
> -	if (out->next && out->type != out->next->type) {
> -		dev_err(out->dev, "output type and display type don't match\n");
> -		ret = -EINVAL;
> -		goto error;
> -	}
> -
>  	if (out->panel) {
>  		struct drm_bridge *bridge;
>  
> @@ -69,7 +62,7 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>  		out->bridge = local_bridge;
>  	}
>  
> -	if (!out->next && !out->bridge) {
> +	if (!out->bridge) {
>  		ret = -EPROBE_DEFER;
>  		goto error;
>  	}
> @@ -78,7 +71,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>  
>  error:
>  	omapdss_device_cleanup_output(out);
> -	out->next = NULL;
>  	return ret;
>  }
>  EXPORT_SYMBOL(omapdss_device_init_output);
> @@ -88,9 +80,6 @@ void omapdss_device_cleanup_output(struct omap_dss_device *out)
>  	if (out->bridge && out->panel)
>  		drm_panel_bridge_remove(out->next_bridge ?
>  					out->next_bridge : out->bridge);
> -
> -	if (out->next)
> -		omapdss_device_put(out->next);
>  }
>  EXPORT_SYMBOL(omapdss_device_cleanup_output);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index 610c5a2f2771..5f5fa01240a7 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -75,7 +75,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
>  {
>  	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
>  	struct omap_dss_device *output = omap_encoder->output;
> -	struct omap_dss_device *dssdev;
>  	struct drm_device *dev = encoder->dev;
>  	struct drm_connector *connector;
>  	struct drm_bridge *bridge;
> @@ -98,9 +97,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
>  	 *
>  	 * A better solution is to use DRM's bus-flags through the whole driver.
>  	 */
> -	for (dssdev = output; dssdev; dssdev = dssdev->next)
> -		omap_encoder_update_videomode_flags(&vm, dssdev->bus_flags);
> -
>  	for (bridge = output->bridge; bridge;
>  	     bridge = drm_bridge_get_next_bridge(bridge)) {
>  		if (!bridge->timings)

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 45/56] drm/omap: drop unused DSS next pointer
@ 2020-11-09 11:04     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:04 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:22PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Since all encoders and panels are using the bridge API now,
> we next pointer is no longer useful and can be dropped.

I would squash this with the previous patch.

> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c     |  2 +-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  1 -
>  drivers/gpu/drm/omapdrm/dss/output.c   | 13 +------------
>  drivers/gpu/drm/omapdrm/omap_encoder.c |  4 ----
>  4 files changed, 2 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index c2791305c332..d62713b241d2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -135,7 +135,7 @@ struct omap_dss_device *omapdss_device_next_output(struct omap_dss_device *from)
>  			goto done;
>  		}
>  
> -		if (dssdev->id && (dssdev->next || dssdev->bridge))
> +		if (dssdev->id && (dssdev->bridge))

No need for the inner parentheses.

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

>  			goto done;
>  	}
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 5d6edec5a427..1f02d3e406dc 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -293,7 +293,6 @@ struct omap_dss_device {
>  	struct module *owner;
>  
>  	struct dss_device *dss;
> -	struct omap_dss_device *next;
>  	struct drm_bridge *bridge;
>  	struct drm_bridge *next_bridge;
>  	struct drm_panel *panel;
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
> index ce21c798cca6..40cb353572f6 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -30,7 +30,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>  		return 0;
>  	}
>  
> -	out->next = omapdss_find_device_by_node(remote_node);
>  	out->bridge = of_drm_find_bridge(remote_node);
>  	out->panel = of_drm_find_panel(remote_node);
>  	if (IS_ERR(out->panel))
> @@ -38,12 +37,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>  
>  	of_node_put(remote_node);
>  
> -	if (out->next && out->type != out->next->type) {
> -		dev_err(out->dev, "output type and display type don't match\n");
> -		ret = -EINVAL;
> -		goto error;
> -	}
> -
>  	if (out->panel) {
>  		struct drm_bridge *bridge;
>  
> @@ -69,7 +62,7 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>  		out->bridge = local_bridge;
>  	}
>  
> -	if (!out->next && !out->bridge) {
> +	if (!out->bridge) {
>  		ret = -EPROBE_DEFER;
>  		goto error;
>  	}
> @@ -78,7 +71,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>  
>  error:
>  	omapdss_device_cleanup_output(out);
> -	out->next = NULL;
>  	return ret;
>  }
>  EXPORT_SYMBOL(omapdss_device_init_output);
> @@ -88,9 +80,6 @@ void omapdss_device_cleanup_output(struct omap_dss_device *out)
>  	if (out->bridge && out->panel)
>  		drm_panel_bridge_remove(out->next_bridge ?
>  					out->next_bridge : out->bridge);
> -
> -	if (out->next)
> -		omapdss_device_put(out->next);
>  }
>  EXPORT_SYMBOL(omapdss_device_cleanup_output);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index 610c5a2f2771..5f5fa01240a7 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -75,7 +75,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
>  {
>  	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
>  	struct omap_dss_device *output = omap_encoder->output;
> -	struct omap_dss_device *dssdev;
>  	struct drm_device *dev = encoder->dev;
>  	struct drm_connector *connector;
>  	struct drm_bridge *bridge;
> @@ -98,9 +97,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
>  	 *
>  	 * A better solution is to use DRM's bus-flags through the whole driver.
>  	 */
> -	for (dssdev = output; dssdev; dssdev = dssdev->next)
> -		omap_encoder_update_videomode_flags(&vm, dssdev->bus_flags);
> -
>  	for (bridge = output->bridge; bridge;
>  	     bridge = drm_bridge_get_next_bridge(bridge)) {
>  		if (!bridge->timings)

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 46/56] drm/omap: drop empty omap_encoder helper functions
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:05     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:05 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:23PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Cleanup empty functions for encoder enable, disable and atomic check.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/omap_encoder.c | 28 --------------------------
>  1 file changed, 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index 5f5fa01240a7..e24411fb9dac 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -113,36 +113,8 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
>  	dss_mgr_set_timings(output, &vm);
>  }
>  
> -static void omap_encoder_disable(struct drm_encoder *encoder)
> -{
> -	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
> -	struct omap_dss_device *dssdev = omap_encoder->output;
> -	struct drm_device *dev = encoder->dev;
> -
> -	dev_dbg(dev->dev, "disable(%s)\n", dssdev->name);
> -}
> -
> -static void omap_encoder_enable(struct drm_encoder *encoder)
> -{
> -	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
> -	struct omap_dss_device *dssdev = omap_encoder->output;
> -	struct drm_device *dev = encoder->dev;
> -
> -	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
> -}
> -
> -static int omap_encoder_atomic_check(struct drm_encoder *encoder,
> -				     struct drm_crtc_state *crtc_state,
> -				     struct drm_connector_state *conn_state)
> -{
> -	return 0;
> -}
> -
>  static const struct drm_encoder_helper_funcs omap_encoder_helper_funcs = {
>  	.mode_set = omap_encoder_mode_set,
> -	.disable = omap_encoder_disable,
> -	.enable = omap_encoder_enable,
> -	.atomic_check = omap_encoder_atomic_check,
>  };
>  
>  /* initialize encoder */

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 46/56] drm/omap: drop empty omap_encoder helper functions
@ 2020-11-09 11:05     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:05 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:23PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Cleanup empty functions for encoder enable, disable and atomic check.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/omap_encoder.c | 28 --------------------------
>  1 file changed, 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index 5f5fa01240a7..e24411fb9dac 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -113,36 +113,8 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
>  	dss_mgr_set_timings(output, &vm);
>  }
>  
> -static void omap_encoder_disable(struct drm_encoder *encoder)
> -{
> -	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
> -	struct omap_dss_device *dssdev = omap_encoder->output;
> -	struct drm_device *dev = encoder->dev;
> -
> -	dev_dbg(dev->dev, "disable(%s)\n", dssdev->name);
> -}
> -
> -static void omap_encoder_enable(struct drm_encoder *encoder)
> -{
> -	struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
> -	struct omap_dss_device *dssdev = omap_encoder->output;
> -	struct drm_device *dev = encoder->dev;
> -
> -	dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
> -}
> -
> -static int omap_encoder_atomic_check(struct drm_encoder *encoder,
> -				     struct drm_crtc_state *crtc_state,
> -				     struct drm_connector_state *conn_state)
> -{
> -	return 0;
> -}
> -
>  static const struct drm_encoder_helper_funcs omap_encoder_helper_funcs = {
>  	.mode_set = omap_encoder_mode_set,
> -	.disable = omap_encoder_disable,
> -	.enable = omap_encoder_enable,
> -	.atomic_check = omap_encoder_atomic_check,
>  };
>  
>  /* initialize encoder */

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 47/56] drm/omap: drop DSS ops_flags
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:05     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:05 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:24PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The omapdss device's ops_flags field is no longer
> used and can be dropped.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 9 ---------
>  drivers/gpu/drm/omapdrm/dss/venc.c    | 1 -
>  2 files changed, 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 1f02d3e406dc..916c55101629 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -279,14 +279,6 @@ struct omap_dss_device_ops {
>  	const struct omapdss_dsi_ops dsi;
>  };
>  
> -/**
> - * enum omap_dss_device_ops_flag - Indicates which device ops are supported
> - * @OMAP_DSS_DEVICE_OP_MODES: The device supports reading modes
> - */
> -enum omap_dss_device_ops_flag {
> -	OMAP_DSS_DEVICE_OP_MODES = BIT(3),
> -};
> -
>  struct omap_dss_device {
>  	struct device *dev;
>  
> @@ -315,7 +307,6 @@ struct omap_dss_device {
>  	const char *name;
>  
>  	const struct omap_dss_device_ops *ops;
> -	unsigned long ops_flags;
>  	u32 bus_flags;
>  
>  	/* OMAP DSS output specific fields */
> diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
> index 5c027c81760f..6e418a0f7572 100644
> --- a/drivers/gpu/drm/omapdrm/dss/venc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/venc.c
> @@ -732,7 +732,6 @@ static int venc_init_output(struct venc_device *venc)
>  	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
>  	out->owner = THIS_MODULE;
>  	out->of_port = 0;
> -	out->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
>  
>  	r = omapdss_device_init_output(out, &venc->bridge);
>  	if (r < 0) {

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 47/56] drm/omap: drop DSS ops_flags
@ 2020-11-09 11:05     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:05 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:24PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The omapdss device's ops_flags field is no longer
> used and can be dropped.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 9 ---------
>  drivers/gpu/drm/omapdrm/dss/venc.c    | 1 -
>  2 files changed, 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 1f02d3e406dc..916c55101629 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -279,14 +279,6 @@ struct omap_dss_device_ops {
>  	const struct omapdss_dsi_ops dsi;
>  };
>  
> -/**
> - * enum omap_dss_device_ops_flag - Indicates which device ops are supported
> - * @OMAP_DSS_DEVICE_OP_MODES: The device supports reading modes
> - */
> -enum omap_dss_device_ops_flag {
> -	OMAP_DSS_DEVICE_OP_MODES = BIT(3),
> -};
> -
>  struct omap_dss_device {
>  	struct device *dev;
>  
> @@ -315,7 +307,6 @@ struct omap_dss_device {
>  	const char *name;
>  
>  	const struct omap_dss_device_ops *ops;
> -	unsigned long ops_flags;
>  	u32 bus_flags;
>  
>  	/* OMAP DSS output specific fields */
> diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
> index 5c027c81760f..6e418a0f7572 100644
> --- a/drivers/gpu/drm/omapdrm/dss/venc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/venc.c
> @@ -732,7 +732,6 @@ static int venc_init_output(struct venc_device *venc)
>  	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
>  	out->owner = THIS_MODULE;
>  	out->of_port = 0;
> -	out->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
>  
>  	r = omapdss_device_init_output(out, &venc->bridge);
>  	if (r < 0) {

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 48/56] drm/omap: drop dssdev display field
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:06     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:06 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:25PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> All displays are using drm_panel instead off dssdev

drm_panel or a drm_bridge that models the connected.

> now, so this field is always 0 and can be dropped.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/base.c    | 2 +-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 6 ------
>  2 files changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index d62713b241d2..d9a5e7b9d401 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -198,7 +198,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
>  	}
>  
>  	if (!dst->id && !omapdss_device_is_connected(dst)) {
> -		WARN_ON(!dst->display);
> +		WARN_ON(1);
>  		return;
>  	}
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 916c55101629..c2199c4946ec 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -298,12 +298,6 @@ struct omap_dss_device {
>  	 */
>  	enum omap_display_type type;
>  
> -	/*
> -	 * True if the device is a display (panel or connector) at the end of
> -	 * the pipeline, false otherwise.
> -	 */
> -	bool display;
> -
>  	const char *name;
>  
>  	const struct omap_dss_device_ops *ops;

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 48/56] drm/omap: drop dssdev display field
@ 2020-11-09 11:06     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:06 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:25PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> All displays are using drm_panel instead off dssdev

drm_panel or a drm_bridge that models the connected.

> now, so this field is always 0 and can be dropped.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/base.c    | 2 +-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 6 ------
>  2 files changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index d62713b241d2..d9a5e7b9d401 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -198,7 +198,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
>  	}
>  
>  	if (!dst->id && !omapdss_device_is_connected(dst)) {
> -		WARN_ON(!dst->display);
> +		WARN_ON(1);
>  		return;
>  	}
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 916c55101629..c2199c4946ec 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -298,12 +298,6 @@ struct omap_dss_device {
>  	 */
>  	enum omap_display_type type;
>  
> -	/*
> -	 * True if the device is a display (panel or connector) at the end of
> -	 * the pipeline, false otherwise.
> -	 */
> -	bool display;
> -
>  	const char *name;
>  
>  	const struct omap_dss_device_ops *ops;

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 49/56] drm/omap: simplify DSI manual update code
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:07     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:07 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:26PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Move dsi_ops into the main structure, since all other ops
> are gone. Instead of checking the device type we can simply
> check if dsi_ops are set.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 10 ++++------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  6 +-----
>  drivers/gpu/drm/omapdrm/omap_crtc.c   | 16 ++++------------
>  3 files changed, 9 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index bbcdb62e1571..f47d7e3bb631 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -5011,11 +5011,9 @@ static int dsi_get_clocks(struct dsi_data *dsi)
>  	return 0;
>  }
>  
> -static const struct omap_dss_device_ops dsi_ops = {
> -	.dsi = {
> -		.update = dsi_update_all,
> -		.is_video_mode = dsi_is_video_mode,
> -	},
> +static const struct omapdss_dsi_ops dsi_ops = {
> +	.update = dsi_update_all,
> +	.is_video_mode = dsi_is_video_mode,
>  };
>  
>  static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
> @@ -5450,7 +5448,7 @@ static int dsi_init_output(struct dsi_data *dsi)
>  	out->type = OMAP_DISPLAY_TYPE_DSI;
>  	out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
>  	out->dispc_channel = dsi_get_channel(dsi);
> -	out->ops = &dsi_ops;
> +	out->dsi_ops = &dsi_ops;
>  	out->owner = THIS_MODULE;
>  	out->of_port = 0;
>  	out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index c2199c4946ec..a1236b8ef7ea 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -275,10 +275,6 @@ struct omapdss_dsi_ops {
>  	bool (*is_video_mode)(struct omap_dss_device *dssdev);
>  };
>  
> -struct omap_dss_device_ops {
> -	const struct omapdss_dsi_ops dsi;
> -};
> -
>  struct omap_dss_device {
>  	struct device *dev;
>  
> @@ -300,7 +296,7 @@ struct omap_dss_device {
>  
>  	const char *name;
>  
> -	const struct omap_dss_device_ops *ops;
> +	const struct omapdss_dsi_ops *dsi_ops;
>  	u32 bus_flags;
>  
>  	/* OMAP DSS output specific fields */
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index f6b968060cf0..5ab557c477ef 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -366,17 +366,10 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
>  	struct drm_device *dev = omap_crtc->base.dev;
>  	int ret;
>  
> -	if (!dssdev) {
> -		dev_err_once(dev->dev, "missing display dssdev!");
> +	if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->update)
>  		return;
> -	}
> -
> -	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI || !dssdev->ops->dsi.update) {
> -		dev_err_once(dev->dev, "no DSI update callback found!");
> -		return;
> -	}
>  
> -	ret = dssdev->ops->dsi.update(dssdev);
> +	ret = dssdev->dsi_ops->update(dssdev);
>  	if (ret < 0) {
>  		spin_lock_irq(&dev->event_lock);
>  		omap_crtc->pending = false;
> @@ -550,11 +543,10 @@ static bool omap_crtc_is_manually_updated(struct drm_crtc *crtc)
>  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
>  	struct omap_dss_device *dssdev = omap_crtc->pipe->output;
>  
> -	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
> -	    !dssdev->ops->dsi.is_video_mode)
> +	if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->is_video_mode)
>  		return false;
>  
> -	if (dssdev->ops->dsi.is_video_mode(dssdev))
> +	if (dssdev->dsi_ops->is_video_mode(dssdev))
>  		return false;
>  
>  	DBG("detected manually updated display!");

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 49/56] drm/omap: simplify DSI manual update code
@ 2020-11-09 11:07     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:07 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:26PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Move dsi_ops into the main structure, since all other ops
> are gone. Instead of checking the device type we can simply
> check if dsi_ops are set.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 10 ++++------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  6 +-----
>  drivers/gpu/drm/omapdrm/omap_crtc.c   | 16 ++++------------
>  3 files changed, 9 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index bbcdb62e1571..f47d7e3bb631 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -5011,11 +5011,9 @@ static int dsi_get_clocks(struct dsi_data *dsi)
>  	return 0;
>  }
>  
> -static const struct omap_dss_device_ops dsi_ops = {
> -	.dsi = {
> -		.update = dsi_update_all,
> -		.is_video_mode = dsi_is_video_mode,
> -	},
> +static const struct omapdss_dsi_ops dsi_ops = {
> +	.update = dsi_update_all,
> +	.is_video_mode = dsi_is_video_mode,
>  };
>  
>  static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
> @@ -5450,7 +5448,7 @@ static int dsi_init_output(struct dsi_data *dsi)
>  	out->type = OMAP_DISPLAY_TYPE_DSI;
>  	out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
>  	out->dispc_channel = dsi_get_channel(dsi);
> -	out->ops = &dsi_ops;
> +	out->dsi_ops = &dsi_ops;
>  	out->owner = THIS_MODULE;
>  	out->of_port = 0;
>  	out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index c2199c4946ec..a1236b8ef7ea 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -275,10 +275,6 @@ struct omapdss_dsi_ops {
>  	bool (*is_video_mode)(struct omap_dss_device *dssdev);
>  };
>  
> -struct omap_dss_device_ops {
> -	const struct omapdss_dsi_ops dsi;
> -};
> -
>  struct omap_dss_device {
>  	struct device *dev;
>  
> @@ -300,7 +296,7 @@ struct omap_dss_device {
>  
>  	const char *name;
>  
> -	const struct omap_dss_device_ops *ops;
> +	const struct omapdss_dsi_ops *dsi_ops;
>  	u32 bus_flags;
>  
>  	/* OMAP DSS output specific fields */
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index f6b968060cf0..5ab557c477ef 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -366,17 +366,10 @@ static void omap_crtc_manual_display_update(struct work_struct *data)
>  	struct drm_device *dev = omap_crtc->base.dev;
>  	int ret;
>  
> -	if (!dssdev) {
> -		dev_err_once(dev->dev, "missing display dssdev!");
> +	if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->update)
>  		return;
> -	}
> -
> -	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI || !dssdev->ops->dsi.update) {
> -		dev_err_once(dev->dev, "no DSI update callback found!");
> -		return;
> -	}
>  
> -	ret = dssdev->ops->dsi.update(dssdev);
> +	ret = dssdev->dsi_ops->update(dssdev);
>  	if (ret < 0) {
>  		spin_lock_irq(&dev->event_lock);
>  		omap_crtc->pending = false;
> @@ -550,11 +543,10 @@ static bool omap_crtc_is_manually_updated(struct drm_crtc *crtc)
>  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
>  	struct omap_dss_device *dssdev = omap_crtc->pipe->output;
>  
> -	if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
> -	    !dssdev->ops->dsi.is_video_mode)
> +	if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->is_video_mode)
>  		return false;
>  
> -	if (dssdev->ops->dsi.is_video_mode(dssdev))
> +	if (dssdev->dsi_ops->is_video_mode(dssdev))
>  		return false;
>  
>  	DBG("detected manually updated display!");

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-09 10:34                           ` Tomi Valkeinen
@ 2020-11-09 11:09                             ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-09 11:09 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren


> Am 09.11.2020 um 11:34 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 09/11/2020 12:31, H. Nikolaus Schaller wrote:
>> 
>>> Am 09.11.2020 um 11:22 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> 
>>> On 09/11/2020 11:30, H. Nikolaus Schaller wrote:
>>>> 
>>>>> Am 09.11.2020 um 09:04 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>>> 
>>>>> On 07/11/2020 14:19, H. Nikolaus Schaller wrote:
>>>>> 
>>>>>> I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
>>>>>> the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().
>>>>>> 
>>>>>> I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
>>>>>> And hopefully we are close to push the panel driver for review. And in a second step some device
>>>>>> tree for the Pyra.
>>>>>> 
>>>>>> The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel
>>>>> 
>>>>> Ok, good. Do you have a link the previous driver that works (omapdrm specific panel driver)? I think
>>>>> it's good to have that as a reference.
>>>> 
>>>> Yes, here:
>>>> 
>>>> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/panels
>>> 
>>> Ok. The old driver uses two separate VC configurations (request_vc calls),
>> 
>> yes indeed. I was not sure how to handle this with the new omapdrm drivers.
>> 
>>> so it may not work with
>>> this series. I think we need to implement logic to the dsi driver to somehow handle this kind of setup.
>> 
>> I see.
>> Anyways there is missing some simple thing which makes the driver not prepared/enabled.
>> Or is this related to VC?
> 
> No, that's not related to the VC.

Ok, then it is worth searching for that independently. Any idea/hint what could be missing?

BR and thanks,
Nikolaus


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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-09 11:09                             ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-09 11:09 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar


> Am 09.11.2020 um 11:34 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 09/11/2020 12:31, H. Nikolaus Schaller wrote:
>> 
>>> Am 09.11.2020 um 11:22 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> 
>>> On 09/11/2020 11:30, H. Nikolaus Schaller wrote:
>>>> 
>>>>> Am 09.11.2020 um 09:04 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>>> 
>>>>> On 07/11/2020 14:19, H. Nikolaus Schaller wrote:
>>>>> 
>>>>>> I have set up based on our complete letux-5.10-rc2 tree and maybe using our private config makes
>>>>>> the difference. Anyways, the driver is now probed and I can see the call to w677l_get_modes().
>>>>>> 
>>>>>> I have still no image and no calls to prepare/unprepare etc. but now I can start to debug on omap5.
>>>>>> And hopefully we are close to push the panel driver for review. And in a second step some device
>>>>>> tree for the Pyra.
>>>>>> 
>>>>>> The new tree is here: https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel
>>>>> 
>>>>> Ok, good. Do you have a link the previous driver that works (omapdrm specific panel driver)? I think
>>>>> it's good to have that as a reference.
>>>> 
>>>> Yes, here:
>>>> 
>>>> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/panels
>>> 
>>> Ok. The old driver uses two separate VC configurations (request_vc calls),
>> 
>> yes indeed. I was not sure how to handle this with the new omapdrm drivers.
>> 
>>> so it may not work with
>>> this series. I think we need to implement logic to the dsi driver to somehow handle this kind of setup.
>> 
>> I see.
>> Anyways there is missing some simple thing which makes the driver not prepared/enabled.
>> Or is this related to VC?
> 
> No, that's not related to the VC.

Ok, then it is worth searching for that independently. Any idea/hint what could be missing?

BR and thanks,
Nikolaus

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 50/56] drm/omap: dsi: simplify pin config
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:09     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:09 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:27PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Simplify DSI pin config, which always originates from DT
> nowadays. With the code being fully contained in the DSI
> encoder, we can drop the public structure.
> 
> Since the function is no longer exposed, it now directly
> takes the private DSI data pointer. This drop a pointless

s/drop/drops/

> conversion and means the pins can be configured earlier.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 33 +++++++++------------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 15 ------------
>  2 files changed, 11 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index f47d7e3bb631..76e4f607d8cf 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -3568,12 +3568,9 @@ static void dsi_proto_timings(struct dsi_data *dsi)
>  	}
>  }
>  
> -static int dsi_configure_pins(struct omap_dss_device *dssdev,
> -		const struct omap_dsi_pin_config *pin_cfg)
> +static int dsi_configure_pins(struct dsi_data *dsi,
> +		int num_pins, const u32 *pins)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	int num_pins;
> -	const int *pins;
>  	struct dsi_lane_config lanes[DSI_MAX_NR_LANES];
>  	int num_lanes;
>  	int i;
> @@ -3586,9 +3583,6 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>  		DSI_LANE_DATA4,
>  	};
>  
> -	num_pins = pin_cfg->num_pins;
> -	pins = pin_cfg->pins;
> -
>  	if (num_pins < 4 || num_pins > dsi->num_lanes_supported * 2
>  			|| num_pins % 2 != 0)
>  		return -EINVAL;
> @@ -3600,7 +3594,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>  
>  	for (i = 0; i < num_pins; i += 2) {
>  		u8 lane, pol;
> -		int dx, dy;
> +		u32 dx, dy;

Is this change needed ?

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

>  
>  		dx = pins[i];
>  		dy = pins[i + 1];
> @@ -5481,9 +5475,8 @@ static int dsi_probe_of(struct dsi_data *dsi)
>  	struct property *prop;
>  	u32 lane_arr[10];
>  	int len, num_pins;
> -	int r, i;
> +	int r;
>  	struct device_node *ep;
> -	struct omap_dsi_pin_config pin_cfg;
>  
>  	ep = of_graph_get_endpoint_by_regs(node, 0, 0);
>  	if (!ep)
> @@ -5511,11 +5504,7 @@ static int dsi_probe_of(struct dsi_data *dsi)
>  		goto err;
>  	}
>  
> -	pin_cfg.num_pins = num_pins;
> -	for (i = 0; i < num_pins; ++i)
> -		pin_cfg.pins[i] = (int)lane_arr[i];
> -
> -	r = dsi_configure_pins(&dsi->output, &pin_cfg);
> +	r = dsi_configure_pins(dsi, num_pins, lane_arr);
>  	if (r) {
>  		dev_err(dsi->dev, "failed to configure pins");
>  		goto err;
> @@ -5728,6 +5717,12 @@ static int dsi_probe(struct platform_device *pdev)
>  	dsi->host.ops = &omap_dsi_host_ops;
>  	dsi->host.dev = &pdev->dev;
>  
> +	r = dsi_probe_of(dsi);
> +	if (r) {
> +		DSSERR("Invalid DSI DT data\n");
> +		goto err_pm_disable;
> +	}
> +
>  	r = mipi_dsi_host_register(&dsi->host);
>  	if (r < 0) {
>  		dev_err(&pdev->dev, "failed to register DSI host: %d\n", r);
> @@ -5738,12 +5733,6 @@ static int dsi_probe(struct platform_device *pdev)
>  	if (r)
>  		goto err_dsi_host_unregister;
>  
> -	r = dsi_probe_of(dsi);
> -	if (r) {
> -		DSSERR("Invalid DSI DT data\n");
> -		goto err_uninit_output;
> -	}
> -
>  	r = component_add(&pdev->dev, &dsi_component_ops);
>  	if (r)
>  		goto err_uninit_output;
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index a1236b8ef7ea..4a0826c8fed5 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -243,21 +243,6 @@ struct omap_overlay_manager_info {
>  	struct omap_dss_cpr_coefs cpr_coefs;
>  };
>  
> -/* 22 pins means 1 clk lane and 10 data lanes */
> -#define OMAP_DSS_MAX_DSI_PINS 22
> -
> -struct omap_dsi_pin_config {
> -	int num_pins;
> -	/*
> -	 * pin numbers in the following order:
> -	 * clk+, clk-
> -	 * data1+, data1-
> -	 * data2+, data2-
> -	 * ...
> -	 */
> -	int pins[OMAP_DSS_MAX_DSI_PINS];
> -};
> -
>  struct omap_dss_writeback_info {
>  	u32 paddr;
>  	u32 p_uv_addr;

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 50/56] drm/omap: dsi: simplify pin config
@ 2020-11-09 11:09     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:09 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:27PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> Simplify DSI pin config, which always originates from DT
> nowadays. With the code being fully contained in the DSI
> encoder, we can drop the public structure.
> 
> Since the function is no longer exposed, it now directly
> takes the private DSI data pointer. This drop a pointless

s/drop/drops/

> conversion and means the pins can be configured earlier.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 33 +++++++++------------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 15 ------------
>  2 files changed, 11 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index f47d7e3bb631..76e4f607d8cf 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -3568,12 +3568,9 @@ static void dsi_proto_timings(struct dsi_data *dsi)
>  	}
>  }
>  
> -static int dsi_configure_pins(struct omap_dss_device *dssdev,
> -		const struct omap_dsi_pin_config *pin_cfg)
> +static int dsi_configure_pins(struct dsi_data *dsi,
> +		int num_pins, const u32 *pins)
>  {
> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> -	int num_pins;
> -	const int *pins;
>  	struct dsi_lane_config lanes[DSI_MAX_NR_LANES];
>  	int num_lanes;
>  	int i;
> @@ -3586,9 +3583,6 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>  		DSI_LANE_DATA4,
>  	};
>  
> -	num_pins = pin_cfg->num_pins;
> -	pins = pin_cfg->pins;
> -
>  	if (num_pins < 4 || num_pins > dsi->num_lanes_supported * 2
>  			|| num_pins % 2 != 0)
>  		return -EINVAL;
> @@ -3600,7 +3594,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>  
>  	for (i = 0; i < num_pins; i += 2) {
>  		u8 lane, pol;
> -		int dx, dy;
> +		u32 dx, dy;

Is this change needed ?

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

>  
>  		dx = pins[i];
>  		dy = pins[i + 1];
> @@ -5481,9 +5475,8 @@ static int dsi_probe_of(struct dsi_data *dsi)
>  	struct property *prop;
>  	u32 lane_arr[10];
>  	int len, num_pins;
> -	int r, i;
> +	int r;
>  	struct device_node *ep;
> -	struct omap_dsi_pin_config pin_cfg;
>  
>  	ep = of_graph_get_endpoint_by_regs(node, 0, 0);
>  	if (!ep)
> @@ -5511,11 +5504,7 @@ static int dsi_probe_of(struct dsi_data *dsi)
>  		goto err;
>  	}
>  
> -	pin_cfg.num_pins = num_pins;
> -	for (i = 0; i < num_pins; ++i)
> -		pin_cfg.pins[i] = (int)lane_arr[i];
> -
> -	r = dsi_configure_pins(&dsi->output, &pin_cfg);
> +	r = dsi_configure_pins(dsi, num_pins, lane_arr);
>  	if (r) {
>  		dev_err(dsi->dev, "failed to configure pins");
>  		goto err;
> @@ -5728,6 +5717,12 @@ static int dsi_probe(struct platform_device *pdev)
>  	dsi->host.ops = &omap_dsi_host_ops;
>  	dsi->host.dev = &pdev->dev;
>  
> +	r = dsi_probe_of(dsi);
> +	if (r) {
> +		DSSERR("Invalid DSI DT data\n");
> +		goto err_pm_disable;
> +	}
> +
>  	r = mipi_dsi_host_register(&dsi->host);
>  	if (r < 0) {
>  		dev_err(&pdev->dev, "failed to register DSI host: %d\n", r);
> @@ -5738,12 +5733,6 @@ static int dsi_probe(struct platform_device *pdev)
>  	if (r)
>  		goto err_dsi_host_unregister;
>  
> -	r = dsi_probe_of(dsi);
> -	if (r) {
> -		DSSERR("Invalid DSI DT data\n");
> -		goto err_uninit_output;
> -	}
> -
>  	r = component_add(&pdev->dev, &dsi_component_ops);
>  	if (r)
>  		goto err_uninit_output;
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index a1236b8ef7ea..4a0826c8fed5 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -243,21 +243,6 @@ struct omap_overlay_manager_info {
>  	struct omap_dss_cpr_coefs cpr_coefs;
>  };
>  
> -/* 22 pins means 1 clk lane and 10 data lanes */
> -#define OMAP_DSS_MAX_DSI_PINS 22
> -
> -struct omap_dsi_pin_config {
> -	int num_pins;
> -	/*
> -	 * pin numbers in the following order:
> -	 * clk+, clk-
> -	 * data1+, data1-
> -	 * data2+, data2-
> -	 * ...
> -	 */
> -	int pins[OMAP_DSS_MAX_DSI_PINS];
> -};
> -
>  struct omap_dss_writeback_info {
>  	u32 paddr;
>  	u32 p_uv_addr;

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 51/56] ARM: omap2plus_defconfig: Update for moved DSI command mode panel
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:10     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:10 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:28PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The DSI command mode panel is no longer specific
> to OMAP and thus the config option has been renamed
> slightly.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/configs/omap2plus_defconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
> index 34793aabdb65..d329d0829fce 100644
> --- a/arch/arm/configs/omap2plus_defconfig
> +++ b/arch/arm/configs/omap2plus_defconfig
> @@ -369,7 +369,7 @@ CONFIG_DRM_OMAP=m
>  CONFIG_OMAP5_DSS_HDMI=y
>  CONFIG_OMAP2_DSS_SDI=y
>  CONFIG_OMAP2_DSS_DSI=y
> -CONFIG_DRM_OMAP_PANEL_DSI_CM=m
> +CONFIG_DRM_PANEL_DSI_CM=m

Is thi the right location, have you regenerated the defconfig from a
.config, or just renamed the option ? With the location fixed if needed,

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

>  CONFIG_DRM_TILCDC=m
>  CONFIG_DRM_PANEL_SIMPLE=m
>  CONFIG_DRM_PANEL_LG_LB035Q02=m

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 51/56] ARM: omap2plus_defconfig: Update for moved DSI command mode panel
@ 2020-11-09 11:10     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:10 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:28PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> The DSI command mode panel is no longer specific
> to OMAP and thus the config option has been renamed
> slightly.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/configs/omap2plus_defconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
> index 34793aabdb65..d329d0829fce 100644
> --- a/arch/arm/configs/omap2plus_defconfig
> +++ b/arch/arm/configs/omap2plus_defconfig
> @@ -369,7 +369,7 @@ CONFIG_DRM_OMAP=m
>  CONFIG_OMAP5_DSS_HDMI=y
>  CONFIG_OMAP2_DSS_SDI=y
>  CONFIG_OMAP2_DSS_DSI=y
> -CONFIG_DRM_OMAP_PANEL_DSI_CM=m
> +CONFIG_DRM_PANEL_DSI_CM=m

Is thi the right location, have you regenerated the defconfig from a
.config, or just renamed the option ? With the location fixed if needed,

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

>  CONFIG_DRM_TILCDC=m
>  CONFIG_DRM_PANEL_SIMPLE=m
>  CONFIG_DRM_PANEL_LG_LB035Q02=m

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 52/56] drm/omap: squash omapdrm sub-modules into one
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:15     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:15 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:29PM +0200, Tomi Valkeinen wrote:
> At the moment we have three different modules: omapdss-base, omapdss,
> omapdrm. This setup is finally obsolete, as the last omapdrm specific
> panel has been converted to DRM panel.
> 
> We can thus remove omapdss-base and omapdss, and just compile everything
> into omapdrm.ko.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/Kconfig       | 119 ++++++++++++++++++++++-
>  drivers/gpu/drm/omapdrm/Makefile      |  17 +++-
>  drivers/gpu/drm/omapdrm/dss/Kconfig   | 132 --------------------------
>  drivers/gpu/drm/omapdrm/dss/Makefile  |  18 ----
>  drivers/gpu/drm/omapdrm/dss/base.c    |  23 +----
>  drivers/gpu/drm/omapdrm/dss/display.c |   2 -
>  drivers/gpu/drm/omapdrm/dss/dss.c     |  11 +--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |   3 +
>  drivers/gpu/drm/omapdrm/dss/output.c  |  11 ---
>  drivers/gpu/drm/omapdrm/omap_drv.c    |  12 ++-
>  10 files changed, 148 insertions(+), 200 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/Kconfig
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/Makefile
> 
> diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
> index cea3f44ea6d4..e7281da5bc6a 100644
> --- a/drivers/gpu/drm/omapdrm/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/Kconfig
> @@ -5,12 +5,129 @@ config DRM_OMAP
>  	depends on ARCH_OMAP2PLUS || ARCH_MULTIPLATFORM
>  	select OMAP2_DSS
>  	select DRM_KMS_HELPER
> +	select VIDEOMODE_HELPERS
> +	select HDMI
>  	default n
>  	help
>  	  DRM display driver for OMAP2/3/4 based boards.
>  
>  if DRM_OMAP
>  
> -source "drivers/gpu/drm/omapdrm/dss/Kconfig"
> +config OMAP2_DSS_DEBUG
> +	bool "Debug support"
> +	default n
> +	help
> +	  This enables printing of debug messages. Alternatively, debug messages
> +	  can also be enabled by setting CONFIG_DYNAMIC_DEBUG and then setting
> +	  appropriate flags in <debugfs>/dynamic_debug/control.
> +
> +config OMAP2_DSS_DEBUGFS
> +	bool "Debugfs filesystem support"
> +	depends on DEBUG_FS
> +	default n
> +	help
> +	  This enables debugfs for OMAPDSS at <debugfs>/omapdss. This enables
> +	  querying about clock configuration and register configuration of dss,
> +	  dispc, dsi, hdmi and rfbi.
> +
> +config OMAP2_DSS_COLLECT_IRQ_STATS
> +	bool "Collect DSS IRQ statistics"
> +	depends on OMAP2_DSS_DEBUGFS
> +	default n
> +	help
> +	  Collect DSS IRQ statistics, printable via debugfs.
> +
> +	  The statistics can be found from
> +	  <debugfs>/omapdss/dispc_irq for DISPC interrupts, and
> +	  <debugfs>/omapdss/dsi_irq for DSI interrupts.
> +
> +config OMAP2_DSS_DPI
> +	bool "DPI support"
> +	default y
> +	help
> +	  DPI Interface. This is the Parallel Display Interface.
> +
> +config OMAP2_DSS_VENC
> +	bool "VENC support"
> +	default y
> +	help
> +	  OMAP Video Encoder support for S-Video and composite TV-out.
> +
> +config OMAP2_DSS_HDMI_COMMON
> +	bool
> +
> +config OMAP4_DSS_HDMI
> +	bool "HDMI support for OMAP4"
> +	default y
> +	select OMAP2_DSS_HDMI_COMMON
> +	help
> +	  HDMI support for OMAP4 based SoCs.
> +
> +config OMAP4_DSS_HDMI_CEC
> +	bool "Enable HDMI CEC support for OMAP4"
> +	depends on OMAP4_DSS_HDMI
> +	select CEC_CORE
> +	default y
> +	help
> +	  When selected the HDMI transmitter will support the CEC feature.
> +
> +config OMAP5_DSS_HDMI
> +	bool "HDMI support for OMAP5"
> +	default n
> +	select OMAP2_DSS_HDMI_COMMON
> +	help
> +	  HDMI Interface for OMAP5 and similar cores. This adds the High
> +	  Definition Multimedia Interface. See http://www.hdmi.org/ for HDMI
> +	  specification.
> +
> +config OMAP2_DSS_SDI
> +	bool "SDI support"
> +	default n
> +	help
> +	  SDI (Serial Display Interface) support.
> +
> +	  SDI is a high speed one-way display serial bus between the host
> +	  processor and a display.
> +
> +config OMAP2_DSS_DSI
> +	bool "DSI support"
> +	default n
> +	select DRM_MIPI_DSI
> +	help
> +	  MIPI DSI (Display Serial Interface) support.
> +
> +	  DSI is a high speed half-duplex serial interface between the host
> +	  processor and a peripheral, such as a display or a framebuffer chip.
> +
> +	  See http://www.mipi.org/ for DSI specifications.
> +
> +config OMAP2_DSS_MIN_FCK_PER_PCK
> +	int "Minimum FCK/PCK ratio (for scaling)"
> +	range 0 32
> +	default 0
> +	help
> +	  This can be used to adjust the minimum FCK/PCK ratio.
> +
> +	  With this you can make sure that DISPC FCK is at least
> +	  n x PCK. Video plane scaling requires higher FCK than
> +	  normally.
> +
> +	  If this is set to 0, there's no extra constraint on the
> +	  DISPC FCK. However, the FCK will at minimum be
> +	  2xPCK (if active matrix) or 3xPCK (if passive matrix).
> +
> +	  Max FCK is 173MHz, so this doesn't work if your PCK
> +	  is very high.
> +
> +config OMAP2_DSS_SLEEP_AFTER_VENC_RESET
> +	bool "Sleep 20ms after VENC reset"
> +	default y
> +	help
> +	  There is a 20ms sleep after VENC reset which seemed to fix the
> +	  reset. The reason for the bug is unclear, and it's also unclear
> +	  on what platforms this happens.
> +
> +	  This option enables the sleep, and is enabled by default. You can
> +	  disable the sleep if it doesn't cause problems on your platform.
>  
>  endif
> diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
> index 2a404e045b78..33fe7e937680 100644
> --- a/drivers/gpu/drm/omapdrm/Makefile
> +++ b/drivers/gpu/drm/omapdrm/Makefile
> @@ -4,8 +4,6 @@
>  # Direct Rendering Infrastructure (DRI)
>  #
>  
> -obj-y += dss/
> -
>  omapdrm-y := omap_drv.o \
>  	omap_irq.o \
>  	omap_debugfs.o \
> @@ -20,4 +18,17 @@ omapdrm-y := omap_drv.o \
>  
>  omapdrm-$(CONFIG_DRM_FBDEV_EMULATION) += omap_fbdev.o
>  
> -obj-$(CONFIG_DRM_OMAP)	+= omapdrm.o
> +omapdrm-y += dss/base.o dss/display.o dss/output.o dss/dss.o dss/dispc.o \
> +		dss/dispc_coefs.o dss/pll.o dss/video-pll.o
> +omapdrm-$(CONFIG_OMAP2_DSS_DPI) += dss/dpi.o
> +omapdrm-$(CONFIG_OMAP2_DSS_VENC) += dss/venc.o
> +omapdrm-$(CONFIG_OMAP2_DSS_SDI) += dss/sdi.o
> +omapdrm-$(CONFIG_OMAP2_DSS_DSI) += dss/dsi.o
> +omapdrm-$(CONFIG_OMAP2_DSS_HDMI_COMMON) += dss/hdmi_common.o dss/hdmi_wp.o \
> +		dss/hdmi_pll.o dss/hdmi_phy.o
> +omapdrm-$(CONFIG_OMAP4_DSS_HDMI) += dss/hdmi4.o dss/hdmi4_core.o
> +omapdrm-$(CONFIG_OMAP4_DSS_HDMI_CEC) += dss/hdmi4_cec.o
> +omapdrm-$(CONFIG_OMAP5_DSS_HDMI) += dss/hdmi5.o dss/hdmi5_core.o
> +ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG
> +
> +obj-$(CONFIG_DRM_OMAP) += omapdrm.o
> diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig b/drivers/gpu/drm/omapdrm/dss/Kconfig
> deleted file mode 100644
> index 6ec80771af3d..000000000000
> --- a/drivers/gpu/drm/omapdrm/dss/Kconfig
> +++ /dev/null
> @@ -1,132 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0-only
> -config OMAP_DSS_BASE
> -	tristate
> -
> -menuconfig OMAP2_DSS
> -	tristate "OMAP2+ Display Subsystem support"
> -	select OMAP_DSS_BASE
> -	select VIDEOMODE_HELPERS
> -	select HDMI
> -	help
> -	  OMAP2+ Display Subsystem support.
> -
> -if OMAP2_DSS
> -
> -config OMAP2_DSS_DEBUG
> -	bool "Debug support"
> -	default n
> -	help
> -	  This enables printing of debug messages. Alternatively, debug messages
> -	  can also be enabled by setting CONFIG_DYNAMIC_DEBUG and then setting
> -	  appropriate flags in <debugfs>/dynamic_debug/control.
> -
> -config OMAP2_DSS_DEBUGFS
> -	bool "Debugfs filesystem support"
> -	depends on DEBUG_FS
> -	default n
> -	help
> -	  This enables debugfs for OMAPDSS at <debugfs>/omapdss. This enables
> -	  querying about clock configuration and register configuration of dss,
> -	  dispc, dsi, hdmi and rfbi.
> -
> -config OMAP2_DSS_COLLECT_IRQ_STATS
> -	bool "Collect DSS IRQ statistics"
> -	depends on OMAP2_DSS_DEBUGFS
> -	default n
> -	help
> -	  Collect DSS IRQ statistics, printable via debugfs.
> -
> -	  The statistics can be found from
> -	  <debugfs>/omapdss/dispc_irq for DISPC interrupts, and
> -	  <debugfs>/omapdss/dsi_irq for DSI interrupts.
> -
> -config OMAP2_DSS_DPI
> -	bool "DPI support"
> -	default y
> -	help
> -	  DPI Interface. This is the Parallel Display Interface.
> -
> -config OMAP2_DSS_VENC
> -	bool "VENC support"
> -	default y
> -	help
> -	  OMAP Video Encoder support for S-Video and composite TV-out.
> -
> -config OMAP2_DSS_HDMI_COMMON
> -	bool
> -
> -config OMAP4_DSS_HDMI
> -	bool "HDMI support for OMAP4"
> -	default y
> -	select OMAP2_DSS_HDMI_COMMON
> -	help
> -	  HDMI support for OMAP4 based SoCs.
> -
> -config OMAP4_DSS_HDMI_CEC
> -	bool "Enable HDMI CEC support for OMAP4"
> -	depends on OMAP4_DSS_HDMI
> -	select CEC_CORE
> -	default y
> -	help
> -	  When selected the HDMI transmitter will support the CEC feature.
> -
> -config OMAP5_DSS_HDMI
> -	bool "HDMI support for OMAP5"
> -	default n
> -	select OMAP2_DSS_HDMI_COMMON
> -	help
> -	  HDMI Interface for OMAP5 and similar cores. This adds the High
> -	  Definition Multimedia Interface. See http://www.hdmi.org/ for HDMI
> -	  specification.
> -
> -config OMAP2_DSS_SDI
> -	bool "SDI support"
> -	default n
> -	help
> -	  SDI (Serial Display Interface) support.
> -
> -	  SDI is a high speed one-way display serial bus between the host
> -	  processor and a display.
> -
> -config OMAP2_DSS_DSI
> -	bool "DSI support"
> -	default n
> -	select DRM_MIPI_DSI
> -	help
> -	  MIPI DSI (Display Serial Interface) support.
> -
> -	  DSI is a high speed half-duplex serial interface between the host
> -	  processor and a peripheral, such as a display or a framebuffer chip.
> -
> -	  See http://www.mipi.org/ for DSI specifications.
> -
> -config OMAP2_DSS_MIN_FCK_PER_PCK
> -	int "Minimum FCK/PCK ratio (for scaling)"
> -	range 0 32
> -	default 0
> -	help
> -	  This can be used to adjust the minimum FCK/PCK ratio.
> -
> -	  With this you can make sure that DISPC FCK is at least
> -	  n x PCK. Video plane scaling requires higher FCK than
> -	  normally.
> -
> -	  If this is set to 0, there's no extra constraint on the
> -	  DISPC FCK. However, the FCK will at minimum be
> -	  2xPCK (if active matrix) or 3xPCK (if passive matrix).
> -
> -	  Max FCK is 173MHz, so this doesn't work if your PCK
> -	  is very high.
> -
> -config OMAP2_DSS_SLEEP_AFTER_VENC_RESET
> -	bool "Sleep 20ms after VENC reset"
> -	default y
> -	help
> -	  There is a 20ms sleep after VENC reset which seemed to fix the
> -	  reset. The reason for the bug is unclear, and it's also unclear
> -	  on what platforms this happens.
> -
> -	  This option enables the sleep, and is enabled by default. You can
> -	  disable the sleep if it doesn't cause problems on your platform.
> -
> -endif
> diff --git a/drivers/gpu/drm/omapdrm/dss/Makefile b/drivers/gpu/drm/omapdrm/dss/Makefile
> deleted file mode 100644
> index 811966cd7468..000000000000
> --- a/drivers/gpu/drm/omapdrm/dss/Makefile
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -obj-$(CONFIG_OMAP_DSS_BASE) += omapdss-base.o
> -omapdss-base-y := base.o display.o output.o
> -
> -obj-$(CONFIG_OMAP2_DSS) += omapdss.o
> -# Core DSS files
> -omapdss-y := dss.o dispc.o dispc_coefs.o \
> -	pll.o video-pll.o
> -omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o
> -omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
> -omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o
> -omapdss-$(CONFIG_OMAP2_DSS_DSI) += dsi.o
> -omapdss-$(CONFIG_OMAP2_DSS_HDMI_COMMON) += hdmi_common.o hdmi_wp.o hdmi_pll.o \
> -	hdmi_phy.o
> -omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi4.o hdmi4_core.o
> -omapdss-$(CONFIG_OMAP4_DSS_HDMI_CEC) += hdmi4_cec.o
> -omapdss-$(CONFIG_OMAP5_DSS_HDMI) += hdmi5.o hdmi5_core.o
> -ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index d9a5e7b9d401..08c7c5024896 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -20,13 +20,11 @@ struct dispc_device *dispc_get_dispc(struct dss_device *dss)
>  {
>  	return dss->dispc;
>  }
> -EXPORT_SYMBOL(dispc_get_dispc);
>  
>  const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
>  {
>  	return dss->dispc_ops;
>  }
> -EXPORT_SYMBOL(dispc_get_ops);
>  

While at it, could you remove the extra blank line ?

>  
>  /* -----------------------------------------------------------------------------
> @@ -42,7 +40,6 @@ void omapdss_device_register(struct omap_dss_device *dssdev)
>  	list_add_tail(&dssdev->list, &omapdss_devices_list);
>  	mutex_unlock(&omapdss_devices_lock);
>  }
> -EXPORT_SYMBOL_GPL(omapdss_device_register);
>  
>  void omapdss_device_unregister(struct omap_dss_device *dssdev)
>  {
> @@ -50,7 +47,6 @@ void omapdss_device_unregister(struct omap_dss_device *dssdev)
>  	list_del(&dssdev->list);
>  	mutex_unlock(&omapdss_devices_lock);
>  }
> -EXPORT_SYMBOL_GPL(omapdss_device_unregister);
>  
>  static bool omapdss_device_is_registered(struct device_node *node)
>  {
> @@ -72,24 +68,16 @@ static bool omapdss_device_is_registered(struct device_node *node)
>  
>  struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev)
>  {
> -	if (!try_module_get(dssdev->owner))
> +	if (get_device(dssdev->dev) == NULL)
>  		return NULL;
>  
> -	if (get_device(dssdev->dev) == NULL) {
> -		module_put(dssdev->owner);
> -		return NULL;
> -	}
> -
>  	return dssdev;
>  }
> -EXPORT_SYMBOL(omapdss_device_get);
>  
>  void omapdss_device_put(struct omap_dss_device *dssdev)
>  {
>  	put_device(dssdev->dev);
> -	module_put(dssdev->owner);
>  }
> -EXPORT_SYMBOL(omapdss_device_put);
>  
>  struct omap_dss_device *omapdss_find_device_by_node(struct device_node *node)
>  {
> @@ -150,7 +138,6 @@ struct omap_dss_device *omapdss_device_next_output(struct omap_dss_device *from)
>  	mutex_unlock(&omapdss_devices_lock);
>  	return dssdev;
>  }
> -EXPORT_SYMBOL(omapdss_device_next_output);
>  
>  static bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
>  {
> @@ -181,7 +168,6 @@ int omapdss_device_connect(struct dss_device *dss,
>  
>  	return 0;
>  }
> -EXPORT_SYMBOL_GPL(omapdss_device_connect);
>  
>  void omapdss_device_disconnect(struct omap_dss_device *src,
>  			       struct omap_dss_device *dst)
> @@ -204,7 +190,6 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
>  
>  	dst->dss = NULL;
>  }
> -EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
>  
>  /* -----------------------------------------------------------------------------
>   * Components Handling
> @@ -290,7 +275,6 @@ void omapdss_gather_components(struct device *dev)
>  	for_each_available_child_of_node(dev->of_node, child)
>  		omapdss_walk_device(dev, child, true);
>  }
> -EXPORT_SYMBOL(omapdss_gather_components);
>  
>  static bool omapdss_component_is_loaded(struct omapdss_comp_node *comp)
>  {
> @@ -315,8 +299,3 @@ bool omapdss_stack_is_ready(void)
>  
>  	return true;
>  }
> -EXPORT_SYMBOL(omapdss_stack_is_ready);
> -
> -MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
> -MODULE_DESCRIPTION("OMAP Display Subsystem Base");
> -MODULE_LICENSE("GPL v2");
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c
> index 3b82158b1bfd..7b7ee2019eae 100644
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ b/drivers/gpu/drm/omapdrm/dss/display.c
> @@ -38,7 +38,6 @@ void omapdss_display_init(struct omap_dss_device *dssdev)
>  		dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
>  					      "display%u", id);
>  }
> -EXPORT_SYMBOL_GPL(omapdss_display_init);
>  
>  int omapdss_display_get_modes(struct drm_connector *connector,
>  			      const struct videomode *vm)
> @@ -57,4 +56,3 @@ int omapdss_display_get_modes(struct drm_connector *connector,
>  
>  	return 1;
>  }
> -EXPORT_SYMBOL_GPL(omapdss_display_get_modes);
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
> index 6a160138bf88..6547a9f4b388 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1638,21 +1638,14 @@ static struct platform_driver * const omap_dss_drivers[] = {
>  #endif
>  };
>  
> -static int __init omap_dss_init(void)
> +int __init omap_dss_init(void)
>  {
>  	return platform_register_drivers(omap_dss_drivers,
>  					 ARRAY_SIZE(omap_dss_drivers));
>  }
>  
> -static void __exit omap_dss_exit(void)
> +void __exit omap_dss_exit(void)
>  {
>  	platform_unregister_drivers(omap_dss_drivers,
>  				    ARRAY_SIZE(omap_dss_drivers));
>  }
> -
> -module_init(omap_dss_init);
> -module_exit(omap_dss_exit);
> -
> -MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
> -MODULE_DESCRIPTION("OMAP2/3/4/5 Display Subsystem");
> -MODULE_LICENSE("GPL v2");
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 4a0826c8fed5..4e7ae164de4f 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -458,4 +458,7 @@ const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
>  bool omapdss_stack_is_ready(void);
>  void omapdss_gather_components(struct device *dev);
>  
> +int omap_dss_init(void);
> +void omap_dss_exit(void);
> +
>  #endif /* __OMAP_DRM_DSS_H */
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
> index 40cb353572f6..7a14d2b5b2f7 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -73,7 +73,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>  	omapdss_device_cleanup_output(out);
>  	return ret;
>  }
> -EXPORT_SYMBOL(omapdss_device_init_output);
>  
>  void omapdss_device_cleanup_output(struct omap_dss_device *out)
>  {
> @@ -81,7 +80,6 @@ void omapdss_device_cleanup_output(struct omap_dss_device *out)
>  		drm_panel_bridge_remove(out->next_bridge ?
>  					out->next_bridge : out->bridge);
>  }
> -EXPORT_SYMBOL(omapdss_device_cleanup_output);
>  
>  int dss_install_mgr_ops(struct dss_device *dss,
>  			const struct dss_mgr_ops *mgr_ops,
> @@ -95,14 +93,12 @@ int dss_install_mgr_ops(struct dss_device *dss,
>  
>  	return 0;
>  }
> -EXPORT_SYMBOL(dss_install_mgr_ops);
>  
>  void dss_uninstall_mgr_ops(struct dss_device *dss)
>  {
>  	dss->mgr_ops = NULL;
>  	dss->mgr_ops_priv = NULL;
>  }
> -EXPORT_SYMBOL(dss_uninstall_mgr_ops);
>  
>  void dss_mgr_set_timings(struct omap_dss_device *dssdev,
>  			 const struct videomode *vm)
> @@ -110,7 +106,6 @@ void dss_mgr_set_timings(struct omap_dss_device *dssdev,
>  	dssdev->dss->mgr_ops->set_timings(dssdev->dss->mgr_ops_priv,
>  					  dssdev->dispc_channel, vm);
>  }
> -EXPORT_SYMBOL(dss_mgr_set_timings);
>  
>  void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
>  		const struct dss_lcd_mgr_config *config)
> @@ -118,28 +113,24 @@ void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
>  	dssdev->dss->mgr_ops->set_lcd_config(dssdev->dss->mgr_ops_priv,
>  					     dssdev->dispc_channel, config);
>  }
> -EXPORT_SYMBOL(dss_mgr_set_lcd_config);
>  
>  int dss_mgr_enable(struct omap_dss_device *dssdev)
>  {
>  	return dssdev->dss->mgr_ops->enable(dssdev->dss->mgr_ops_priv,
>  					    dssdev->dispc_channel);
>  }
> -EXPORT_SYMBOL(dss_mgr_enable);
>  
>  void dss_mgr_disable(struct omap_dss_device *dssdev)
>  {
>  	dssdev->dss->mgr_ops->disable(dssdev->dss->mgr_ops_priv,
>  				      dssdev->dispc_channel);
>  }
> -EXPORT_SYMBOL(dss_mgr_disable);
>  
>  void dss_mgr_start_update(struct omap_dss_device *dssdev)
>  {
>  	dssdev->dss->mgr_ops->start_update(dssdev->dss->mgr_ops_priv,
>  					   dssdev->dispc_channel);
>  }
> -EXPORT_SYMBOL(dss_mgr_start_update);
>  
>  int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
>  		void (*handler)(void *), void *data)
> @@ -150,7 +141,6 @@ int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
>  							dssdev->dispc_channel,
>  							handler, data);
>  }
> -EXPORT_SYMBOL(dss_mgr_register_framedone_handler);
>  
>  void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
>  		void (*handler)(void *), void *data)
> @@ -161,4 +151,3 @@ void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
>  						   dssdev->dispc_channel,
>  						   handler, data);
>  }
> -EXPORT_SYMBOL(dss_mgr_unregister_framedone_handler);
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index dbb8e95234b3..9d5f53e774ef 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -741,8 +741,14 @@ static struct platform_driver * const drivers[] = {
>  
>  static int __init omap_drm_init(void)
>  {
> +	int r;
> +
>  	DBG("init");
>  
> +	r = omap_dss_init();
> +	if (r)
> +		return r;
> +
>  	return platform_register_drivers(drivers, ARRAY_SIZE(drivers));

Shouldn't you call omap_dss_exit() if this fails ?

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

>  }
>  
> @@ -751,13 +757,15 @@ static void __exit omap_drm_fini(void)
>  	DBG("fini");
>  
>  	platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
> +
> +	omap_dss_exit();
>  }
>  
> -/* need late_initcall() so we load after dss_driver's are loaded */
> -late_initcall(omap_drm_init);
> +module_init(omap_drm_init);
>  module_exit(omap_drm_fini);
>  
>  MODULE_AUTHOR("Rob Clark <rob@ti.com>");
> +MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
>  MODULE_DESCRIPTION("OMAP DRM Display Driver");
>  MODULE_ALIAS("platform:" DRIVER_NAME);
>  MODULE_LICENSE("GPL v2");

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 52/56] drm/omap: squash omapdrm sub-modules into one
@ 2020-11-09 11:15     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:15 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, linux-omap, Nikhil Devshatwar

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:29PM +0200, Tomi Valkeinen wrote:
> At the moment we have three different modules: omapdss-base, omapdss,
> omapdrm. This setup is finally obsolete, as the last omapdrm specific
> panel has been converted to DRM panel.
> 
> We can thus remove omapdss-base and omapdss, and just compile everything
> into omapdrm.ko.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/Kconfig       | 119 ++++++++++++++++++++++-
>  drivers/gpu/drm/omapdrm/Makefile      |  17 +++-
>  drivers/gpu/drm/omapdrm/dss/Kconfig   | 132 --------------------------
>  drivers/gpu/drm/omapdrm/dss/Makefile  |  18 ----
>  drivers/gpu/drm/omapdrm/dss/base.c    |  23 +----
>  drivers/gpu/drm/omapdrm/dss/display.c |   2 -
>  drivers/gpu/drm/omapdrm/dss/dss.c     |  11 +--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |   3 +
>  drivers/gpu/drm/omapdrm/dss/output.c  |  11 ---
>  drivers/gpu/drm/omapdrm/omap_drv.c    |  12 ++-
>  10 files changed, 148 insertions(+), 200 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/Kconfig
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/Makefile
> 
> diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
> index cea3f44ea6d4..e7281da5bc6a 100644
> --- a/drivers/gpu/drm/omapdrm/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/Kconfig
> @@ -5,12 +5,129 @@ config DRM_OMAP
>  	depends on ARCH_OMAP2PLUS || ARCH_MULTIPLATFORM
>  	select OMAP2_DSS
>  	select DRM_KMS_HELPER
> +	select VIDEOMODE_HELPERS
> +	select HDMI
>  	default n
>  	help
>  	  DRM display driver for OMAP2/3/4 based boards.
>  
>  if DRM_OMAP
>  
> -source "drivers/gpu/drm/omapdrm/dss/Kconfig"
> +config OMAP2_DSS_DEBUG
> +	bool "Debug support"
> +	default n
> +	help
> +	  This enables printing of debug messages. Alternatively, debug messages
> +	  can also be enabled by setting CONFIG_DYNAMIC_DEBUG and then setting
> +	  appropriate flags in <debugfs>/dynamic_debug/control.
> +
> +config OMAP2_DSS_DEBUGFS
> +	bool "Debugfs filesystem support"
> +	depends on DEBUG_FS
> +	default n
> +	help
> +	  This enables debugfs for OMAPDSS at <debugfs>/omapdss. This enables
> +	  querying about clock configuration and register configuration of dss,
> +	  dispc, dsi, hdmi and rfbi.
> +
> +config OMAP2_DSS_COLLECT_IRQ_STATS
> +	bool "Collect DSS IRQ statistics"
> +	depends on OMAP2_DSS_DEBUGFS
> +	default n
> +	help
> +	  Collect DSS IRQ statistics, printable via debugfs.
> +
> +	  The statistics can be found from
> +	  <debugfs>/omapdss/dispc_irq for DISPC interrupts, and
> +	  <debugfs>/omapdss/dsi_irq for DSI interrupts.
> +
> +config OMAP2_DSS_DPI
> +	bool "DPI support"
> +	default y
> +	help
> +	  DPI Interface. This is the Parallel Display Interface.
> +
> +config OMAP2_DSS_VENC
> +	bool "VENC support"
> +	default y
> +	help
> +	  OMAP Video Encoder support for S-Video and composite TV-out.
> +
> +config OMAP2_DSS_HDMI_COMMON
> +	bool
> +
> +config OMAP4_DSS_HDMI
> +	bool "HDMI support for OMAP4"
> +	default y
> +	select OMAP2_DSS_HDMI_COMMON
> +	help
> +	  HDMI support for OMAP4 based SoCs.
> +
> +config OMAP4_DSS_HDMI_CEC
> +	bool "Enable HDMI CEC support for OMAP4"
> +	depends on OMAP4_DSS_HDMI
> +	select CEC_CORE
> +	default y
> +	help
> +	  When selected the HDMI transmitter will support the CEC feature.
> +
> +config OMAP5_DSS_HDMI
> +	bool "HDMI support for OMAP5"
> +	default n
> +	select OMAP2_DSS_HDMI_COMMON
> +	help
> +	  HDMI Interface for OMAP5 and similar cores. This adds the High
> +	  Definition Multimedia Interface. See http://www.hdmi.org/ for HDMI
> +	  specification.
> +
> +config OMAP2_DSS_SDI
> +	bool "SDI support"
> +	default n
> +	help
> +	  SDI (Serial Display Interface) support.
> +
> +	  SDI is a high speed one-way display serial bus between the host
> +	  processor and a display.
> +
> +config OMAP2_DSS_DSI
> +	bool "DSI support"
> +	default n
> +	select DRM_MIPI_DSI
> +	help
> +	  MIPI DSI (Display Serial Interface) support.
> +
> +	  DSI is a high speed half-duplex serial interface between the host
> +	  processor and a peripheral, such as a display or a framebuffer chip.
> +
> +	  See http://www.mipi.org/ for DSI specifications.
> +
> +config OMAP2_DSS_MIN_FCK_PER_PCK
> +	int "Minimum FCK/PCK ratio (for scaling)"
> +	range 0 32
> +	default 0
> +	help
> +	  This can be used to adjust the minimum FCK/PCK ratio.
> +
> +	  With this you can make sure that DISPC FCK is at least
> +	  n x PCK. Video plane scaling requires higher FCK than
> +	  normally.
> +
> +	  If this is set to 0, there's no extra constraint on the
> +	  DISPC FCK. However, the FCK will at minimum be
> +	  2xPCK (if active matrix) or 3xPCK (if passive matrix).
> +
> +	  Max FCK is 173MHz, so this doesn't work if your PCK
> +	  is very high.
> +
> +config OMAP2_DSS_SLEEP_AFTER_VENC_RESET
> +	bool "Sleep 20ms after VENC reset"
> +	default y
> +	help
> +	  There is a 20ms sleep after VENC reset which seemed to fix the
> +	  reset. The reason for the bug is unclear, and it's also unclear
> +	  on what platforms this happens.
> +
> +	  This option enables the sleep, and is enabled by default. You can
> +	  disable the sleep if it doesn't cause problems on your platform.
>  
>  endif
> diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
> index 2a404e045b78..33fe7e937680 100644
> --- a/drivers/gpu/drm/omapdrm/Makefile
> +++ b/drivers/gpu/drm/omapdrm/Makefile
> @@ -4,8 +4,6 @@
>  # Direct Rendering Infrastructure (DRI)
>  #
>  
> -obj-y += dss/
> -
>  omapdrm-y := omap_drv.o \
>  	omap_irq.o \
>  	omap_debugfs.o \
> @@ -20,4 +18,17 @@ omapdrm-y := omap_drv.o \
>  
>  omapdrm-$(CONFIG_DRM_FBDEV_EMULATION) += omap_fbdev.o
>  
> -obj-$(CONFIG_DRM_OMAP)	+= omapdrm.o
> +omapdrm-y += dss/base.o dss/display.o dss/output.o dss/dss.o dss/dispc.o \
> +		dss/dispc_coefs.o dss/pll.o dss/video-pll.o
> +omapdrm-$(CONFIG_OMAP2_DSS_DPI) += dss/dpi.o
> +omapdrm-$(CONFIG_OMAP2_DSS_VENC) += dss/venc.o
> +omapdrm-$(CONFIG_OMAP2_DSS_SDI) += dss/sdi.o
> +omapdrm-$(CONFIG_OMAP2_DSS_DSI) += dss/dsi.o
> +omapdrm-$(CONFIG_OMAP2_DSS_HDMI_COMMON) += dss/hdmi_common.o dss/hdmi_wp.o \
> +		dss/hdmi_pll.o dss/hdmi_phy.o
> +omapdrm-$(CONFIG_OMAP4_DSS_HDMI) += dss/hdmi4.o dss/hdmi4_core.o
> +omapdrm-$(CONFIG_OMAP4_DSS_HDMI_CEC) += dss/hdmi4_cec.o
> +omapdrm-$(CONFIG_OMAP5_DSS_HDMI) += dss/hdmi5.o dss/hdmi5_core.o
> +ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG
> +
> +obj-$(CONFIG_DRM_OMAP) += omapdrm.o
> diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig b/drivers/gpu/drm/omapdrm/dss/Kconfig
> deleted file mode 100644
> index 6ec80771af3d..000000000000
> --- a/drivers/gpu/drm/omapdrm/dss/Kconfig
> +++ /dev/null
> @@ -1,132 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0-only
> -config OMAP_DSS_BASE
> -	tristate
> -
> -menuconfig OMAP2_DSS
> -	tristate "OMAP2+ Display Subsystem support"
> -	select OMAP_DSS_BASE
> -	select VIDEOMODE_HELPERS
> -	select HDMI
> -	help
> -	  OMAP2+ Display Subsystem support.
> -
> -if OMAP2_DSS
> -
> -config OMAP2_DSS_DEBUG
> -	bool "Debug support"
> -	default n
> -	help
> -	  This enables printing of debug messages. Alternatively, debug messages
> -	  can also be enabled by setting CONFIG_DYNAMIC_DEBUG and then setting
> -	  appropriate flags in <debugfs>/dynamic_debug/control.
> -
> -config OMAP2_DSS_DEBUGFS
> -	bool "Debugfs filesystem support"
> -	depends on DEBUG_FS
> -	default n
> -	help
> -	  This enables debugfs for OMAPDSS at <debugfs>/omapdss. This enables
> -	  querying about clock configuration and register configuration of dss,
> -	  dispc, dsi, hdmi and rfbi.
> -
> -config OMAP2_DSS_COLLECT_IRQ_STATS
> -	bool "Collect DSS IRQ statistics"
> -	depends on OMAP2_DSS_DEBUGFS
> -	default n
> -	help
> -	  Collect DSS IRQ statistics, printable via debugfs.
> -
> -	  The statistics can be found from
> -	  <debugfs>/omapdss/dispc_irq for DISPC interrupts, and
> -	  <debugfs>/omapdss/dsi_irq for DSI interrupts.
> -
> -config OMAP2_DSS_DPI
> -	bool "DPI support"
> -	default y
> -	help
> -	  DPI Interface. This is the Parallel Display Interface.
> -
> -config OMAP2_DSS_VENC
> -	bool "VENC support"
> -	default y
> -	help
> -	  OMAP Video Encoder support for S-Video and composite TV-out.
> -
> -config OMAP2_DSS_HDMI_COMMON
> -	bool
> -
> -config OMAP4_DSS_HDMI
> -	bool "HDMI support for OMAP4"
> -	default y
> -	select OMAP2_DSS_HDMI_COMMON
> -	help
> -	  HDMI support for OMAP4 based SoCs.
> -
> -config OMAP4_DSS_HDMI_CEC
> -	bool "Enable HDMI CEC support for OMAP4"
> -	depends on OMAP4_DSS_HDMI
> -	select CEC_CORE
> -	default y
> -	help
> -	  When selected the HDMI transmitter will support the CEC feature.
> -
> -config OMAP5_DSS_HDMI
> -	bool "HDMI support for OMAP5"
> -	default n
> -	select OMAP2_DSS_HDMI_COMMON
> -	help
> -	  HDMI Interface for OMAP5 and similar cores. This adds the High
> -	  Definition Multimedia Interface. See http://www.hdmi.org/ for HDMI
> -	  specification.
> -
> -config OMAP2_DSS_SDI
> -	bool "SDI support"
> -	default n
> -	help
> -	  SDI (Serial Display Interface) support.
> -
> -	  SDI is a high speed one-way display serial bus between the host
> -	  processor and a display.
> -
> -config OMAP2_DSS_DSI
> -	bool "DSI support"
> -	default n
> -	select DRM_MIPI_DSI
> -	help
> -	  MIPI DSI (Display Serial Interface) support.
> -
> -	  DSI is a high speed half-duplex serial interface between the host
> -	  processor and a peripheral, such as a display or a framebuffer chip.
> -
> -	  See http://www.mipi.org/ for DSI specifications.
> -
> -config OMAP2_DSS_MIN_FCK_PER_PCK
> -	int "Minimum FCK/PCK ratio (for scaling)"
> -	range 0 32
> -	default 0
> -	help
> -	  This can be used to adjust the minimum FCK/PCK ratio.
> -
> -	  With this you can make sure that DISPC FCK is at least
> -	  n x PCK. Video plane scaling requires higher FCK than
> -	  normally.
> -
> -	  If this is set to 0, there's no extra constraint on the
> -	  DISPC FCK. However, the FCK will at minimum be
> -	  2xPCK (if active matrix) or 3xPCK (if passive matrix).
> -
> -	  Max FCK is 173MHz, so this doesn't work if your PCK
> -	  is very high.
> -
> -config OMAP2_DSS_SLEEP_AFTER_VENC_RESET
> -	bool "Sleep 20ms after VENC reset"
> -	default y
> -	help
> -	  There is a 20ms sleep after VENC reset which seemed to fix the
> -	  reset. The reason for the bug is unclear, and it's also unclear
> -	  on what platforms this happens.
> -
> -	  This option enables the sleep, and is enabled by default. You can
> -	  disable the sleep if it doesn't cause problems on your platform.
> -
> -endif
> diff --git a/drivers/gpu/drm/omapdrm/dss/Makefile b/drivers/gpu/drm/omapdrm/dss/Makefile
> deleted file mode 100644
> index 811966cd7468..000000000000
> --- a/drivers/gpu/drm/omapdrm/dss/Makefile
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -obj-$(CONFIG_OMAP_DSS_BASE) += omapdss-base.o
> -omapdss-base-y := base.o display.o output.o
> -
> -obj-$(CONFIG_OMAP2_DSS) += omapdss.o
> -# Core DSS files
> -omapdss-y := dss.o dispc.o dispc_coefs.o \
> -	pll.o video-pll.o
> -omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o
> -omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
> -omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o
> -omapdss-$(CONFIG_OMAP2_DSS_DSI) += dsi.o
> -omapdss-$(CONFIG_OMAP2_DSS_HDMI_COMMON) += hdmi_common.o hdmi_wp.o hdmi_pll.o \
> -	hdmi_phy.o
> -omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi4.o hdmi4_core.o
> -omapdss-$(CONFIG_OMAP4_DSS_HDMI_CEC) += hdmi4_cec.o
> -omapdss-$(CONFIG_OMAP5_DSS_HDMI) += hdmi5.o hdmi5_core.o
> -ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index d9a5e7b9d401..08c7c5024896 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -20,13 +20,11 @@ struct dispc_device *dispc_get_dispc(struct dss_device *dss)
>  {
>  	return dss->dispc;
>  }
> -EXPORT_SYMBOL(dispc_get_dispc);
>  
>  const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
>  {
>  	return dss->dispc_ops;
>  }
> -EXPORT_SYMBOL(dispc_get_ops);
>  

While at it, could you remove the extra blank line ?

>  
>  /* -----------------------------------------------------------------------------
> @@ -42,7 +40,6 @@ void omapdss_device_register(struct omap_dss_device *dssdev)
>  	list_add_tail(&dssdev->list, &omapdss_devices_list);
>  	mutex_unlock(&omapdss_devices_lock);
>  }
> -EXPORT_SYMBOL_GPL(omapdss_device_register);
>  
>  void omapdss_device_unregister(struct omap_dss_device *dssdev)
>  {
> @@ -50,7 +47,6 @@ void omapdss_device_unregister(struct omap_dss_device *dssdev)
>  	list_del(&dssdev->list);
>  	mutex_unlock(&omapdss_devices_lock);
>  }
> -EXPORT_SYMBOL_GPL(omapdss_device_unregister);
>  
>  static bool omapdss_device_is_registered(struct device_node *node)
>  {
> @@ -72,24 +68,16 @@ static bool omapdss_device_is_registered(struct device_node *node)
>  
>  struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev)
>  {
> -	if (!try_module_get(dssdev->owner))
> +	if (get_device(dssdev->dev) == NULL)
>  		return NULL;
>  
> -	if (get_device(dssdev->dev) == NULL) {
> -		module_put(dssdev->owner);
> -		return NULL;
> -	}
> -
>  	return dssdev;
>  }
> -EXPORT_SYMBOL(omapdss_device_get);
>  
>  void omapdss_device_put(struct omap_dss_device *dssdev)
>  {
>  	put_device(dssdev->dev);
> -	module_put(dssdev->owner);
>  }
> -EXPORT_SYMBOL(omapdss_device_put);
>  
>  struct omap_dss_device *omapdss_find_device_by_node(struct device_node *node)
>  {
> @@ -150,7 +138,6 @@ struct omap_dss_device *omapdss_device_next_output(struct omap_dss_device *from)
>  	mutex_unlock(&omapdss_devices_lock);
>  	return dssdev;
>  }
> -EXPORT_SYMBOL(omapdss_device_next_output);
>  
>  static bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
>  {
> @@ -181,7 +168,6 @@ int omapdss_device_connect(struct dss_device *dss,
>  
>  	return 0;
>  }
> -EXPORT_SYMBOL_GPL(omapdss_device_connect);
>  
>  void omapdss_device_disconnect(struct omap_dss_device *src,
>  			       struct omap_dss_device *dst)
> @@ -204,7 +190,6 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
>  
>  	dst->dss = NULL;
>  }
> -EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
>  
>  /* -----------------------------------------------------------------------------
>   * Components Handling
> @@ -290,7 +275,6 @@ void omapdss_gather_components(struct device *dev)
>  	for_each_available_child_of_node(dev->of_node, child)
>  		omapdss_walk_device(dev, child, true);
>  }
> -EXPORT_SYMBOL(omapdss_gather_components);
>  
>  static bool omapdss_component_is_loaded(struct omapdss_comp_node *comp)
>  {
> @@ -315,8 +299,3 @@ bool omapdss_stack_is_ready(void)
>  
>  	return true;
>  }
> -EXPORT_SYMBOL(omapdss_stack_is_ready);
> -
> -MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
> -MODULE_DESCRIPTION("OMAP Display Subsystem Base");
> -MODULE_LICENSE("GPL v2");
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c
> index 3b82158b1bfd..7b7ee2019eae 100644
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ b/drivers/gpu/drm/omapdrm/dss/display.c
> @@ -38,7 +38,6 @@ void omapdss_display_init(struct omap_dss_device *dssdev)
>  		dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
>  					      "display%u", id);
>  }
> -EXPORT_SYMBOL_GPL(omapdss_display_init);
>  
>  int omapdss_display_get_modes(struct drm_connector *connector,
>  			      const struct videomode *vm)
> @@ -57,4 +56,3 @@ int omapdss_display_get_modes(struct drm_connector *connector,
>  
>  	return 1;
>  }
> -EXPORT_SYMBOL_GPL(omapdss_display_get_modes);
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
> index 6a160138bf88..6547a9f4b388 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1638,21 +1638,14 @@ static struct platform_driver * const omap_dss_drivers[] = {
>  #endif
>  };
>  
> -static int __init omap_dss_init(void)
> +int __init omap_dss_init(void)
>  {
>  	return platform_register_drivers(omap_dss_drivers,
>  					 ARRAY_SIZE(omap_dss_drivers));
>  }
>  
> -static void __exit omap_dss_exit(void)
> +void __exit omap_dss_exit(void)
>  {
>  	platform_unregister_drivers(omap_dss_drivers,
>  				    ARRAY_SIZE(omap_dss_drivers));
>  }
> -
> -module_init(omap_dss_init);
> -module_exit(omap_dss_exit);
> -
> -MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
> -MODULE_DESCRIPTION("OMAP2/3/4/5 Display Subsystem");
> -MODULE_LICENSE("GPL v2");
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 4a0826c8fed5..4e7ae164de4f 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -458,4 +458,7 @@ const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
>  bool omapdss_stack_is_ready(void);
>  void omapdss_gather_components(struct device *dev);
>  
> +int omap_dss_init(void);
> +void omap_dss_exit(void);
> +
>  #endif /* __OMAP_DRM_DSS_H */
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
> index 40cb353572f6..7a14d2b5b2f7 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -73,7 +73,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>  	omapdss_device_cleanup_output(out);
>  	return ret;
>  }
> -EXPORT_SYMBOL(omapdss_device_init_output);
>  
>  void omapdss_device_cleanup_output(struct omap_dss_device *out)
>  {
> @@ -81,7 +80,6 @@ void omapdss_device_cleanup_output(struct omap_dss_device *out)
>  		drm_panel_bridge_remove(out->next_bridge ?
>  					out->next_bridge : out->bridge);
>  }
> -EXPORT_SYMBOL(omapdss_device_cleanup_output);
>  
>  int dss_install_mgr_ops(struct dss_device *dss,
>  			const struct dss_mgr_ops *mgr_ops,
> @@ -95,14 +93,12 @@ int dss_install_mgr_ops(struct dss_device *dss,
>  
>  	return 0;
>  }
> -EXPORT_SYMBOL(dss_install_mgr_ops);
>  
>  void dss_uninstall_mgr_ops(struct dss_device *dss)
>  {
>  	dss->mgr_ops = NULL;
>  	dss->mgr_ops_priv = NULL;
>  }
> -EXPORT_SYMBOL(dss_uninstall_mgr_ops);
>  
>  void dss_mgr_set_timings(struct omap_dss_device *dssdev,
>  			 const struct videomode *vm)
> @@ -110,7 +106,6 @@ void dss_mgr_set_timings(struct omap_dss_device *dssdev,
>  	dssdev->dss->mgr_ops->set_timings(dssdev->dss->mgr_ops_priv,
>  					  dssdev->dispc_channel, vm);
>  }
> -EXPORT_SYMBOL(dss_mgr_set_timings);
>  
>  void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
>  		const struct dss_lcd_mgr_config *config)
> @@ -118,28 +113,24 @@ void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
>  	dssdev->dss->mgr_ops->set_lcd_config(dssdev->dss->mgr_ops_priv,
>  					     dssdev->dispc_channel, config);
>  }
> -EXPORT_SYMBOL(dss_mgr_set_lcd_config);
>  
>  int dss_mgr_enable(struct omap_dss_device *dssdev)
>  {
>  	return dssdev->dss->mgr_ops->enable(dssdev->dss->mgr_ops_priv,
>  					    dssdev->dispc_channel);
>  }
> -EXPORT_SYMBOL(dss_mgr_enable);
>  
>  void dss_mgr_disable(struct omap_dss_device *dssdev)
>  {
>  	dssdev->dss->mgr_ops->disable(dssdev->dss->mgr_ops_priv,
>  				      dssdev->dispc_channel);
>  }
> -EXPORT_SYMBOL(dss_mgr_disable);
>  
>  void dss_mgr_start_update(struct omap_dss_device *dssdev)
>  {
>  	dssdev->dss->mgr_ops->start_update(dssdev->dss->mgr_ops_priv,
>  					   dssdev->dispc_channel);
>  }
> -EXPORT_SYMBOL(dss_mgr_start_update);
>  
>  int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
>  		void (*handler)(void *), void *data)
> @@ -150,7 +141,6 @@ int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
>  							dssdev->dispc_channel,
>  							handler, data);
>  }
> -EXPORT_SYMBOL(dss_mgr_register_framedone_handler);
>  
>  void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
>  		void (*handler)(void *), void *data)
> @@ -161,4 +151,3 @@ void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
>  						   dssdev->dispc_channel,
>  						   handler, data);
>  }
> -EXPORT_SYMBOL(dss_mgr_unregister_framedone_handler);
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index dbb8e95234b3..9d5f53e774ef 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -741,8 +741,14 @@ static struct platform_driver * const drivers[] = {
>  
>  static int __init omap_drm_init(void)
>  {
> +	int r;
> +
>  	DBG("init");
>  
> +	r = omap_dss_init();
> +	if (r)
> +		return r;
> +
>  	return platform_register_drivers(drivers, ARRAY_SIZE(drivers));

Shouldn't you call omap_dss_exit() if this fails ?

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

>  }
>  
> @@ -751,13 +757,15 @@ static void __exit omap_drm_fini(void)
>  	DBG("fini");
>  
>  	platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
> +
> +	omap_dss_exit();
>  }
>  
> -/* need late_initcall() so we load after dss_driver's are loaded */
> -late_initcall(omap_drm_init);
> +module_init(omap_drm_init);
>  module_exit(omap_drm_fini);
>  
>  MODULE_AUTHOR("Rob Clark <rob@ti.com>");
> +MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
>  MODULE_DESCRIPTION("OMAP DRM Display Driver");
>  MODULE_ALIAS("platform:" DRIVER_NAME);
>  MODULE_LICENSE("GPL v2");

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 53/56] drm/omap: remove unused display.c
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:16     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:16 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:30PM +0200, Tomi Valkeinen wrote:
> The functions in display.c are not used, so drop the file.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/Makefile      |  2 +-
>  drivers/gpu/drm/omapdrm/dss/display.c | 58 ---------------------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 --
>  3 files changed, 1 insertion(+), 63 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/display.c
> 
> diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
> index 33fe7e937680..21e8277ff88f 100644
> --- a/drivers/gpu/drm/omapdrm/Makefile
> +++ b/drivers/gpu/drm/omapdrm/Makefile
> @@ -18,7 +18,7 @@ omapdrm-y := omap_drv.o \
>  
>  omapdrm-$(CONFIG_DRM_FBDEV_EMULATION) += omap_fbdev.o
>  
> -omapdrm-y += dss/base.o dss/display.o dss/output.o dss/dss.o dss/dispc.o \
> +omapdrm-y += dss/base.o dss/output.o dss/dss.o dss/dispc.o \
>  		dss/dispc_coefs.o dss/pll.o dss/video-pll.o
>  omapdrm-$(CONFIG_OMAP2_DSS_DPI) += dss/dpi.o
>  omapdrm-$(CONFIG_OMAP2_DSS_VENC) += dss/venc.o
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c
> deleted file mode 100644
> index 7b7ee2019eae..000000000000
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ /dev/null
> @@ -1,58 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-only
> -/*
> - * Copyright (C) 2009 Nokia Corporation
> - * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
> - *
> - * Some code and ideas taken from drivers/video/omap/ driver
> - * by Imre Deak.
> - */
> -
> -#define DSS_SUBSYS_NAME "DISPLAY"
> -
> -#include <linux/kernel.h>
> -#include <linux/of.h>
> -
> -#include <drm/drm_connector.h>
> -#include <drm/drm_modes.h>
> -
> -#include "omapdss.h"
> -
> -static int disp_num_counter;
> -
> -void omapdss_display_init(struct omap_dss_device *dssdev)
> -{
> -	int id;
> -
> -	/*
> -	 * Note: this presumes that all displays either have an DT alias, or
> -	 * none has.
> -	 */
> -	id = of_alias_get_id(dssdev->dev->of_node, "display");
> -	if (id < 0)
> -		id = disp_num_counter++;
> -
> -	/* Use 'label' property for name, if it exists */
> -	of_property_read_string(dssdev->dev->of_node, "label", &dssdev->name);
> -
> -	if (dssdev->name == NULL)
> -		dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
> -					      "display%u", id);
> -}
> -
> -int omapdss_display_get_modes(struct drm_connector *connector,
> -			      const struct videomode *vm)
> -{
> -	struct drm_display_mode *mode;
> -
> -	mode = drm_mode_create(connector->dev);
> -	if (!mode)
> -		return 0;
> -
> -	drm_display_mode_from_videomode(vm, mode);
> -
> -	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> -	drm_mode_set_name(mode);
> -	drm_mode_probed_add(connector, mode);
> -
> -	return 1;
> -}
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 4e7ae164de4f..90e41c635e45 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -300,10 +300,6 @@ struct dss_pdata {
>  	struct dss_device *dss;
>  };
>  
> -void omapdss_display_init(struct omap_dss_device *dssdev);
> -int omapdss_display_get_modes(struct drm_connector *connector,
> -			      const struct videomode *vm);
> -
>  void omapdss_device_register(struct omap_dss_device *dssdev);
>  void omapdss_device_unregister(struct omap_dss_device *dssdev);
>  struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 53/56] drm/omap: remove unused display.c
@ 2020-11-09 11:16     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:16 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, linux-omap, Nikhil Devshatwar

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:30PM +0200, Tomi Valkeinen wrote:
> The functions in display.c are not used, so drop the file.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/Makefile      |  2 +-
>  drivers/gpu/drm/omapdrm/dss/display.c | 58 ---------------------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 --
>  3 files changed, 1 insertion(+), 63 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/display.c
> 
> diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
> index 33fe7e937680..21e8277ff88f 100644
> --- a/drivers/gpu/drm/omapdrm/Makefile
> +++ b/drivers/gpu/drm/omapdrm/Makefile
> @@ -18,7 +18,7 @@ omapdrm-y := omap_drv.o \
>  
>  omapdrm-$(CONFIG_DRM_FBDEV_EMULATION) += omap_fbdev.o
>  
> -omapdrm-y += dss/base.o dss/display.o dss/output.o dss/dss.o dss/dispc.o \
> +omapdrm-y += dss/base.o dss/output.o dss/dss.o dss/dispc.o \
>  		dss/dispc_coefs.o dss/pll.o dss/video-pll.o
>  omapdrm-$(CONFIG_OMAP2_DSS_DPI) += dss/dpi.o
>  omapdrm-$(CONFIG_OMAP2_DSS_VENC) += dss/venc.o
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c
> deleted file mode 100644
> index 7b7ee2019eae..000000000000
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ /dev/null
> @@ -1,58 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-only
> -/*
> - * Copyright (C) 2009 Nokia Corporation
> - * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
> - *
> - * Some code and ideas taken from drivers/video/omap/ driver
> - * by Imre Deak.
> - */
> -
> -#define DSS_SUBSYS_NAME "DISPLAY"
> -
> -#include <linux/kernel.h>
> -#include <linux/of.h>
> -
> -#include <drm/drm_connector.h>
> -#include <drm/drm_modes.h>
> -
> -#include "omapdss.h"
> -
> -static int disp_num_counter;
> -
> -void omapdss_display_init(struct omap_dss_device *dssdev)
> -{
> -	int id;
> -
> -	/*
> -	 * Note: this presumes that all displays either have an DT alias, or
> -	 * none has.
> -	 */
> -	id = of_alias_get_id(dssdev->dev->of_node, "display");
> -	if (id < 0)
> -		id = disp_num_counter++;
> -
> -	/* Use 'label' property for name, if it exists */
> -	of_property_read_string(dssdev->dev->of_node, "label", &dssdev->name);
> -
> -	if (dssdev->name == NULL)
> -		dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
> -					      "display%u", id);
> -}
> -
> -int omapdss_display_get_modes(struct drm_connector *connector,
> -			      const struct videomode *vm)
> -{
> -	struct drm_display_mode *mode;
> -
> -	mode = drm_mode_create(connector->dev);
> -	if (!mode)
> -		return 0;
> -
> -	drm_display_mode_from_videomode(vm, mode);
> -
> -	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> -	drm_mode_set_name(mode);
> -	drm_mode_probed_add(connector, mode);
> -
> -	return 1;
> -}
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 4e7ae164de4f..90e41c635e45 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -300,10 +300,6 @@ struct dss_pdata {
>  	struct dss_device *dss;
>  };
>  
> -void omapdss_display_init(struct omap_dss_device *dssdev);
> -int omapdss_display_get_modes(struct drm_connector *connector,
> -			      const struct videomode *vm);
> -
>  void omapdss_device_register(struct omap_dss_device *dssdev);
>  void omapdss_device_unregister(struct omap_dss_device *dssdev);
>  struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 54/56] drm/omap: drop unused owner field
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:16     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:16 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:31PM +0200, Tomi Valkeinen wrote:
> dssdev->owner is set, but never used. We can drop the field.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dpi.c     | 1 -
>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 1 -
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c   | 1 -
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c   | 1 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 --
>  drivers/gpu/drm/omapdrm/dss/sdi.c     | 1 -
>  drivers/gpu/drm/omapdrm/dss/venc.c    | 1 -
>  7 files changed, 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c
> index 1d2992daef40..030f997eccd0 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dpi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
> @@ -641,7 +641,6 @@ static int dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
>  	out->type = OMAP_DISPLAY_TYPE_DPI;
>  	out->dispc_channel = dpi_get_channel(dpi);
>  	out->of_port = port_num;
> -	out->owner = THIS_MODULE;
>  
>  	r = omapdss_device_init_output(out, &dpi->bridge);
>  	if (r < 0) {
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 76e4f607d8cf..22718a771d6d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -5443,7 +5443,6 @@ static int dsi_init_output(struct dsi_data *dsi)
>  	out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
>  	out->dispc_channel = dsi_get_channel(dsi);
>  	out->dsi_ops = &dsi_ops;
> -	out->owner = THIS_MODULE;
>  	out->of_port = 0;
>  	out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
>  		       | DRM_BUS_FLAG_DE_HIGH
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> index a14fbf06cb30..13701571d59b 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> @@ -707,7 +707,6 @@ static int hdmi4_init_output(struct omap_hdmi *hdmi)
>  	out->type = OMAP_DISPLAY_TYPE_HDMI;
>  	out->name = "hdmi.0";
>  	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
> -	out->owner = THIS_MODULE;
>  	out->of_port = 0;
>  
>  	r = omapdss_device_init_output(out, &hdmi->bridge);
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> index b738d9750686..5d627caf90f2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> @@ -681,7 +681,6 @@ static int hdmi5_init_output(struct omap_hdmi *hdmi)
>  	out->type = OMAP_DISPLAY_TYPE_HDMI;
>  	out->name = "hdmi.0";
>  	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
> -	out->owner = THIS_MODULE;
>  	out->of_port = 0;
>  
>  	r = omapdss_device_init_output(out, &hdmi->bridge);
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 90e41c635e45..4442e49ffc5c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -263,8 +263,6 @@ struct omapdss_dsi_ops {
>  struct omap_dss_device {
>  	struct device *dev;
>  
> -	struct module *owner;
> -
>  	struct dss_device *dss;
>  	struct drm_bridge *bridge;
>  	struct drm_bridge *next_bridge;
> diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c b/drivers/gpu/drm/omapdrm/dss/sdi.c
> index 033fd30074b0..35827b4487bd 100644
> --- a/drivers/gpu/drm/omapdrm/dss/sdi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/sdi.c
> @@ -314,7 +314,6 @@ static int sdi_init_output(struct sdi_device *sdi)
>  	out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
>  	/* We have SDI only on OMAP3, where it's on port 1 */
>  	out->of_port = 1;
> -	out->owner = THIS_MODULE;
>  	out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE	/* 15.5.9.1.2 */
>  		       | DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE;
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
> index 6e418a0f7572..8ecffe5bbd29 100644
> --- a/drivers/gpu/drm/omapdrm/dss/venc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/venc.c
> @@ -730,7 +730,6 @@ static int venc_init_output(struct venc_device *venc)
>  	out->type = OMAP_DISPLAY_TYPE_VENC;
>  	out->name = "venc.0";
>  	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
> -	out->owner = THIS_MODULE;
>  	out->of_port = 0;
>  
>  	r = omapdss_device_init_output(out, &venc->bridge);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 54/56] drm/omap: drop unused owner field
@ 2020-11-09 11:16     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:16 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, linux-omap, Nikhil Devshatwar

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:31PM +0200, Tomi Valkeinen wrote:
> dssdev->owner is set, but never used. We can drop the field.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dpi.c     | 1 -
>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 1 -
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c   | 1 -
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c   | 1 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 --
>  drivers/gpu/drm/omapdrm/dss/sdi.c     | 1 -
>  drivers/gpu/drm/omapdrm/dss/venc.c    | 1 -
>  7 files changed, 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c
> index 1d2992daef40..030f997eccd0 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dpi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
> @@ -641,7 +641,6 @@ static int dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
>  	out->type = OMAP_DISPLAY_TYPE_DPI;
>  	out->dispc_channel = dpi_get_channel(dpi);
>  	out->of_port = port_num;
> -	out->owner = THIS_MODULE;
>  
>  	r = omapdss_device_init_output(out, &dpi->bridge);
>  	if (r < 0) {
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 76e4f607d8cf..22718a771d6d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -5443,7 +5443,6 @@ static int dsi_init_output(struct dsi_data *dsi)
>  	out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
>  	out->dispc_channel = dsi_get_channel(dsi);
>  	out->dsi_ops = &dsi_ops;
> -	out->owner = THIS_MODULE;
>  	out->of_port = 0;
>  	out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
>  		       | DRM_BUS_FLAG_DE_HIGH
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> index a14fbf06cb30..13701571d59b 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> @@ -707,7 +707,6 @@ static int hdmi4_init_output(struct omap_hdmi *hdmi)
>  	out->type = OMAP_DISPLAY_TYPE_HDMI;
>  	out->name = "hdmi.0";
>  	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
> -	out->owner = THIS_MODULE;
>  	out->of_port = 0;
>  
>  	r = omapdss_device_init_output(out, &hdmi->bridge);
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> index b738d9750686..5d627caf90f2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> @@ -681,7 +681,6 @@ static int hdmi5_init_output(struct omap_hdmi *hdmi)
>  	out->type = OMAP_DISPLAY_TYPE_HDMI;
>  	out->name = "hdmi.0";
>  	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
> -	out->owner = THIS_MODULE;
>  	out->of_port = 0;
>  
>  	r = omapdss_device_init_output(out, &hdmi->bridge);
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 90e41c635e45..4442e49ffc5c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -263,8 +263,6 @@ struct omapdss_dsi_ops {
>  struct omap_dss_device {
>  	struct device *dev;
>  
> -	struct module *owner;
> -
>  	struct dss_device *dss;
>  	struct drm_bridge *bridge;
>  	struct drm_bridge *next_bridge;
> diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c b/drivers/gpu/drm/omapdrm/dss/sdi.c
> index 033fd30074b0..35827b4487bd 100644
> --- a/drivers/gpu/drm/omapdrm/dss/sdi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/sdi.c
> @@ -314,7 +314,6 @@ static int sdi_init_output(struct sdi_device *sdi)
>  	out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
>  	/* We have SDI only on OMAP3, where it's on port 1 */
>  	out->of_port = 1;
> -	out->owner = THIS_MODULE;
>  	out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE	/* 15.5.9.1.2 */
>  		       | DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE;
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
> index 6e418a0f7572..8ecffe5bbd29 100644
> --- a/drivers/gpu/drm/omapdrm/dss/venc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/venc.c
> @@ -730,7 +730,6 @@ static int venc_init_output(struct venc_device *venc)
>  	out->type = OMAP_DISPLAY_TYPE_VENC;
>  	out->name = "venc.0";
>  	out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
> -	out->owner = THIS_MODULE;
>  	out->of_port = 0;
>  
>  	r = omapdss_device_init_output(out, &venc->bridge);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 15/56] drm/omap: dsi: request VC via mipi_dsi_attach
  2020-11-09  8:42     ` Laurent Pinchart
@ 2020-11-09 11:16       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09 11:16 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 09/11/2020 10:42, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:02:52PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> Drop custom request_vc/release_vc callbacks by using the
>> generic mipi_dsi_attach/mipi_dsi_detach functions.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 24 +++++---
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 61 ++++++++-----------
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  3 -
>>  3 files changed, 41 insertions(+), 47 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index ec36e62ddc3a..b1ca9b34ce17 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -693,14 +693,6 @@ static int dsicm_connect(struct omap_dss_device *src,
>>  			 struct omap_dss_device *dst)
>>  {
>>  	struct panel_drv_data *ddata = to_panel_data(dst);
>> -	struct device *dev = &ddata->dsi->dev;
>> -	int r;
>> -
>> -	r = src->ops->dsi.request_vc(src, ddata->channel);
>> -	if (r) {
>> -		dev_err(dev, "failed to get virtual channel\n");
>> -		return r;
>> -	}
>>  
>>  	ddata->src = src;
>>  	return 0;
>> @@ -711,7 +703,6 @@ static void dsicm_disconnect(struct omap_dss_device *src,
>>  {
>>  	struct panel_drv_data *ddata = to_panel_data(dst);
>>  
>> -	src->ops->dsi.release_vc(src, ddata->channel);
>>  	ddata->src = NULL;
>>  }
>>  
>> @@ -1276,8 +1267,21 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  		goto err_bl;
>>  	}
>>  
>> +	dsi->lanes = 3;
>> +	dsi->format = MIPI_DSI_FMT_RGB888;
>> +	dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
>> +			  MIPI_DSI_MODE_EOT_PACKET;
>> +	dsi->hs_rate = 300000000;
>> +	dsi->lp_rate = 10000000;
> 
> Should this change be explained in the commit message ?

I added:

To use mipi_dsi_attach() we need to fill in the mipi_dsi_device fields,
and some of these fields overlap with the fields in omap_dss_dsi_config.
In later patches the latter will get dropped.

>> +
>> +	r = mipi_dsi_attach(dsi);
>> +	if (r < 0)
>> +		goto err_dsi_attach;
>> +
>>  	return 0;
>>  
>> +err_dsi_attach:
>> +	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>>  err_bl:
>>  	destroy_workqueue(ddata->workqueue);
>>  err_reg:
>> @@ -1294,6 +1298,8 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>>  
>>  	dev_dbg(&dsi->dev, "remove\n");
>>  
>> +	mipi_dsi_detach(dsi);
>> +
>>  	omapdss_device_unregister(dssdev);
>>  
>>  	if (omapdss_device_is_enabled(dssdev))
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index d1187a8af37f..a16427f3bc23 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -349,7 +349,7 @@ struct dsi_data {
>>  
>>  	struct {
>>  		enum dsi_vc_source source;
>> -		struct omap_dss_device *dssdev;
>> +		struct mipi_dsi_device *dest;
> 
> How about naming this dsidev ?

Maybe, but... dsidev was used to refer to the DSI host not that long ago. While going through these
patches, I thought about renaming "dest", but then I decided that "dest" a new name and perhaps a
good one to have during this transition period.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 15/56] drm/omap: dsi: request VC via mipi_dsi_attach
@ 2020-11-09 11:16       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09 11:16 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 09/11/2020 10:42, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:02:52PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> Drop custom request_vc/release_vc callbacks by using the
>> generic mipi_dsi_attach/mipi_dsi_detach functions.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 24 +++++---
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 61 ++++++++-----------
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  3 -
>>  3 files changed, 41 insertions(+), 47 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index ec36e62ddc3a..b1ca9b34ce17 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -693,14 +693,6 @@ static int dsicm_connect(struct omap_dss_device *src,
>>  			 struct omap_dss_device *dst)
>>  {
>>  	struct panel_drv_data *ddata = to_panel_data(dst);
>> -	struct device *dev = &ddata->dsi->dev;
>> -	int r;
>> -
>> -	r = src->ops->dsi.request_vc(src, ddata->channel);
>> -	if (r) {
>> -		dev_err(dev, "failed to get virtual channel\n");
>> -		return r;
>> -	}
>>  
>>  	ddata->src = src;
>>  	return 0;
>> @@ -711,7 +703,6 @@ static void dsicm_disconnect(struct omap_dss_device *src,
>>  {
>>  	struct panel_drv_data *ddata = to_panel_data(dst);
>>  
>> -	src->ops->dsi.release_vc(src, ddata->channel);
>>  	ddata->src = NULL;
>>  }
>>  
>> @@ -1276,8 +1267,21 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  		goto err_bl;
>>  	}
>>  
>> +	dsi->lanes = 3;
>> +	dsi->format = MIPI_DSI_FMT_RGB888;
>> +	dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
>> +			  MIPI_DSI_MODE_EOT_PACKET;
>> +	dsi->hs_rate = 300000000;
>> +	dsi->lp_rate = 10000000;
> 
> Should this change be explained in the commit message ?

I added:

To use mipi_dsi_attach() we need to fill in the mipi_dsi_device fields,
and some of these fields overlap with the fields in omap_dss_dsi_config.
In later patches the latter will get dropped.

>> +
>> +	r = mipi_dsi_attach(dsi);
>> +	if (r < 0)
>> +		goto err_dsi_attach;
>> +
>>  	return 0;
>>  
>> +err_dsi_attach:
>> +	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>>  err_bl:
>>  	destroy_workqueue(ddata->workqueue);
>>  err_reg:
>> @@ -1294,6 +1298,8 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>>  
>>  	dev_dbg(&dsi->dev, "remove\n");
>>  
>> +	mipi_dsi_detach(dsi);
>> +
>>  	omapdss_device_unregister(dssdev);
>>  
>>  	if (omapdss_device_is_enabled(dssdev))
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index d1187a8af37f..a16427f3bc23 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -349,7 +349,7 @@ struct dsi_data {
>>  
>>  	struct {
>>  		enum dsi_vc_source source;
>> -		struct omap_dss_device *dssdev;
>> +		struct mipi_dsi_device *dest;
> 
> How about naming this dsidev ?

Maybe, but... dsidev was used to refer to the DSI host not that long ago. While going through these
patches, I thought about renaming "dest", but then I decided that "dest" a new name and perhaps a
good one to have during this transition period.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 55/56] drm/omap: remove dispc_ops
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:17     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:17 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:32PM +0200, Tomi Valkeinen wrote:
> dispc_ops was created to help with the multi-module architecture and
> giving us the possibility of multiple dispc implementations. Neither of
> these is valid anymore, and we can remove dispc_ops and use direct
> calls to dispc.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/base.c    |   6 --
>  drivers/gpu/drm/omapdrm/dss/dispc.c   | 101 +++++++-------------------
>  drivers/gpu/drm/omapdrm/dss/dss.h     |  71 +++++++++++++++++-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  71 ------------------
>  drivers/gpu/drm/omapdrm/omap_crtc.c   |  30 ++++----
>  drivers/gpu/drm/omapdrm/omap_drv.c    |  15 ++--
>  drivers/gpu/drm/omapdrm/omap_drv.h    |   2 +-
>  drivers/gpu/drm/omapdrm/omap_irq.c    |  34 ++++-----
>  drivers/gpu/drm/omapdrm/omap_plane.c  |  12 +--
>  9 files changed, 143 insertions(+), 199 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index 08c7c5024896..0aff16bf6edb 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -21,12 +21,6 @@ struct dispc_device *dispc_get_dispc(struct dss_device *dss)
>  	return dss->dispc;
>  }
>  
> -const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
> -{
> -	return dss->dispc_ops;
> -}
> -
> -
>  /* -----------------------------------------------------------------------------
>   * OMAP DSS Devices Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
> index 48593932bddf..509bac99cb57 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -351,8 +351,6 @@ static unsigned long dispc_plane_pclk_rate(struct dispc_device *dispc,
>  static unsigned long dispc_plane_lclk_rate(struct dispc_device *dispc,
>  					   enum omap_plane_id plane);
>  
> -static void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask);
> -
>  static inline void dispc_write_reg(struct dispc_device *dispc, u16 idx, u32 val)
>  {
>  	__raw_writel(val, dispc->base + idx);
> @@ -379,12 +377,12 @@ static void mgr_fld_write(struct dispc_device *dispc, enum omap_channel channel,
>  	REG_FLD_MOD(dispc, rfld->reg, val, rfld->high, rfld->low);
>  }
>  
> -static int dispc_get_num_ovls(struct dispc_device *dispc)
> +int dispc_get_num_ovls(struct dispc_device *dispc)
>  {
>  	return dispc->feat->num_ovls;
>  }
>  
> -static int dispc_get_num_mgrs(struct dispc_device *dispc)
> +int dispc_get_num_mgrs(struct dispc_device *dispc)
>  {
>  	return dispc->feat->num_mgrs;
>  }
> @@ -667,13 +665,13 @@ void dispc_runtime_put(struct dispc_device *dispc)
>  	WARN_ON(r < 0 && r != -ENOSYS);
>  }
>  
> -static u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
> +u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
>  				   enum omap_channel channel)
>  {
>  	return mgr_desc[channel].vsync_irq;
>  }
>  
> -static u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
> +u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
>  				       enum omap_channel channel)
>  {
>  	if (channel == OMAP_DSS_CHANNEL_DIGIT && dispc->feat->no_framedone_tv)
> @@ -682,18 +680,18 @@ static u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
>  	return mgr_desc[channel].framedone_irq;
>  }
>  
> -static u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
> +u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
>  				       enum omap_channel channel)
>  {
>  	return mgr_desc[channel].sync_lost_irq;
>  }
>  
> -static u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
> +u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
>  {
>  	return DISPC_IRQ_FRAMEDONEWB;
>  }
>  
> -static void dispc_mgr_enable(struct dispc_device *dispc,
> +void dispc_mgr_enable(struct dispc_device *dispc,
>  			     enum omap_channel channel, bool enable)
>  {
>  	mgr_fld_write(dispc, channel, DISPC_MGR_FLD_ENABLE, enable);
> @@ -707,13 +705,13 @@ static bool dispc_mgr_is_enabled(struct dispc_device *dispc,
>  	return !!mgr_fld_read(dispc, channel, DISPC_MGR_FLD_ENABLE);
>  }
>  
> -static bool dispc_mgr_go_busy(struct dispc_device *dispc,
> +bool dispc_mgr_go_busy(struct dispc_device *dispc,
>  			      enum omap_channel channel)
>  {
>  	return mgr_fld_read(dispc, channel, DISPC_MGR_FLD_GO) == 1;
>  }
>  
> -static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
> +void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
>  {
>  	WARN_ON(!dispc_mgr_is_enabled(dispc, channel));
>  	WARN_ON(dispc_mgr_go_busy(dispc, channel));
> @@ -723,12 +721,12 @@ static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
>  	mgr_fld_write(dispc, channel, DISPC_MGR_FLD_GO, 1);
>  }
>  
> -static bool dispc_wb_go_busy(struct dispc_device *dispc)
> +bool dispc_wb_go_busy(struct dispc_device *dispc)
>  {
>  	return REG_GET(dispc, DISPC_CONTROL2, 6, 6) == 1;
>  }
>  
> -static void dispc_wb_go(struct dispc_device *dispc)
> +void dispc_wb_go(struct dispc_device *dispc)
>  {
>  	enum omap_plane_id plane = OMAP_DSS_WB;
>  	bool enable, go;
> @@ -1282,7 +1280,7 @@ static bool dispc_ovl_color_mode_supported(struct dispc_device *dispc,
>  	return false;
>  }
>  
> -static const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc,
> +const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc,
>  					    enum omap_plane_id plane)
>  {
>  	return dispc->feat->supported_color_modes[plane];
> @@ -2761,7 +2759,7 @@ static int dispc_ovl_setup_common(struct dispc_device *dispc,
>  	return 0;
>  }
>  
> -static int dispc_ovl_setup(struct dispc_device *dispc,
> +int dispc_ovl_setup(struct dispc_device *dispc,
>  			   enum omap_plane_id plane,
>  			   const struct omap_overlay_info *oi,
>  			   const struct videomode *vm, bool mem_to_mem,
> @@ -2788,7 +2786,7 @@ static int dispc_ovl_setup(struct dispc_device *dispc,
>  	return r;
>  }
>  
> -static int dispc_wb_setup(struct dispc_device *dispc,
> +int dispc_wb_setup(struct dispc_device *dispc,
>  		   const struct omap_dss_writeback_info *wi,
>  		   bool mem_to_mem, const struct videomode *vm,
>  		   enum dss_writeback_channel channel_in)
> @@ -2871,12 +2869,12 @@ static int dispc_wb_setup(struct dispc_device *dispc,
>  	return 0;
>  }
>  
> -static bool dispc_has_writeback(struct dispc_device *dispc)
> +bool dispc_has_writeback(struct dispc_device *dispc)
>  {
>  	return dispc->feat->has_writeback;
>  }
>  
> -static int dispc_ovl_enable(struct dispc_device *dispc,
> +int dispc_ovl_enable(struct dispc_device *dispc,
>  			    enum omap_plane_id plane, bool enable)
>  {
>  	DSSDBG("dispc_enable_plane %d, %d\n", plane, enable);
> @@ -2967,7 +2965,7 @@ static void dispc_mgr_enable_alpha_fixed_zorder(struct dispc_device *dispc,
>  		REG_FLD_MOD(dispc, DISPC_CONFIG, enable, 19, 19);
>  }
>  
> -static void dispc_mgr_setup(struct dispc_device *dispc,
> +void dispc_mgr_setup(struct dispc_device *dispc,
>  			    enum omap_channel channel,
>  			    const struct omap_overlay_manager_info *info)
>  {
> @@ -3046,7 +3044,7 @@ static void dispc_mgr_enable_stallmode(struct dispc_device *dispc,
>  	mgr_fld_write(dispc, channel, DISPC_MGR_FLD_STALLMODE, enable);
>  }
>  
> -static void dispc_mgr_set_lcd_config(struct dispc_device *dispc,
> +void dispc_mgr_set_lcd_config(struct dispc_device *dispc,
>  				     enum omap_channel channel,
>  				     const struct dss_lcd_mgr_config *config)
>  {
> @@ -3095,7 +3093,7 @@ static bool _dispc_mgr_pclk_ok(struct dispc_device *dispc,
>  		return pclk <= dispc->feat->max_tv_pclk;
>  }
>  
> -static int dispc_mgr_check_timings(struct dispc_device *dispc,
> +int dispc_mgr_check_timings(struct dispc_device *dispc,
>  				   enum omap_channel channel,
>  				   const struct videomode *vm)
>  {
> @@ -3188,7 +3186,7 @@ static int vm_flag_to_int(enum display_flags flags, enum display_flags high,
>  }
>  
>  /* change name to mode? */
> -static void dispc_mgr_set_timings(struct dispc_device *dispc,
> +void dispc_mgr_set_timings(struct dispc_device *dispc,
>  				  enum omap_channel channel,
>  				  const struct videomode *vm)
>  {
> @@ -3732,17 +3730,17 @@ int dispc_mgr_get_clock_div(struct dispc_device *dispc,
>  	return 0;
>  }
>  
> -static u32 dispc_read_irqstatus(struct dispc_device *dispc)
> +u32 dispc_read_irqstatus(struct dispc_device *dispc)
>  {
>  	return dispc_read_reg(dispc, DISPC_IRQSTATUS);
>  }
>  
> -static void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask)
> +void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask)
>  {
>  	dispc_write_reg(dispc, DISPC_IRQSTATUS, mask);
>  }
>  
> -static void dispc_write_irqenable(struct dispc_device *dispc, u32 mask)
> +void dispc_write_irqenable(struct dispc_device *dispc, u32 mask)
>  {
>  	u32 old_mask = dispc_read_reg(dispc, DISPC_IRQENABLE);
>  
> @@ -3766,7 +3764,7 @@ void dispc_disable_sidle(struct dispc_device *dispc)
>  	REG_FLD_MOD(dispc, DISPC_SYSCONFIG, 1, 4, 3);	/* SIDLEMODE: no idle */
>  }
>  
> -static u32 dispc_mgr_gamma_size(struct dispc_device *dispc,
> +u32 dispc_mgr_gamma_size(struct dispc_device *dispc,
>  				enum omap_channel channel)
>  {
>  	const struct dispc_gamma_desc *gdesc = &mgr_desc[channel].gamma;
> @@ -3821,7 +3819,7 @@ static const struct drm_color_lut dispc_mgr_gamma_default_lut[] = {
>  	{ .red = U16_MAX, .green = U16_MAX, .blue = U16_MAX, },
>  };
>  
> -static void dispc_mgr_set_gamma(struct dispc_device *dispc,
> +void dispc_mgr_set_gamma(struct dispc_device *dispc,
>  				enum omap_channel channel,
>  				const struct drm_color_lut *lut,
>  				unsigned int length)
> @@ -4479,7 +4477,7 @@ static irqreturn_t dispc_irq_handler(int irq, void *arg)
>  	return dispc->user_handler(irq, dispc->user_data);
>  }
>  
> -static int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
> +int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
>  			     void *dev_id)
>  {
>  	int r;
> @@ -4503,7 +4501,7 @@ static int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
>  	return r;
>  }
>  
> -static void dispc_free_irq(struct dispc_device *dispc, void *dev_id)
> +void dispc_free_irq(struct dispc_device *dispc, void *dev_id)
>  {
>  	devm_free_irq(&dispc->pdev->dev, dispc->irq, dispc);
>  
> @@ -4511,7 +4509,7 @@ static void dispc_free_irq(struct dispc_device *dispc, void *dev_id)
>  	dispc->user_data = NULL;
>  }
>  
> -static u32 dispc_get_memory_bandwidth_limit(struct dispc_device *dispc)
> +u32 dispc_get_memory_bandwidth_limit(struct dispc_device *dispc)
>  {
>  	u32 limit = 0;
>  
> @@ -4681,47 +4679,6 @@ static void dispc_errata_i734_wa(struct dispc_device *dispc)
>  	REG_FLD_MOD(dispc, DISPC_CONFIG, gatestate, 8, 4);
>  }
>  
> -static const struct dispc_ops dispc_ops = {
> -	.read_irqstatus = dispc_read_irqstatus,
> -	.clear_irqstatus = dispc_clear_irqstatus,
> -	.write_irqenable = dispc_write_irqenable,
> -
> -	.request_irq = dispc_request_irq,
> -	.free_irq = dispc_free_irq,
> -
> -	.runtime_get = dispc_runtime_get,
> -	.runtime_put = dispc_runtime_put,
> -
> -	.get_num_ovls = dispc_get_num_ovls,
> -	.get_num_mgrs = dispc_get_num_mgrs,
> -
> -	.get_memory_bandwidth_limit = dispc_get_memory_bandwidth_limit,
> -
> -	.mgr_enable = dispc_mgr_enable,
> -	.mgr_is_enabled = dispc_mgr_is_enabled,
> -	.mgr_get_vsync_irq = dispc_mgr_get_vsync_irq,
> -	.mgr_get_framedone_irq = dispc_mgr_get_framedone_irq,
> -	.mgr_get_sync_lost_irq = dispc_mgr_get_sync_lost_irq,
> -	.mgr_go_busy = dispc_mgr_go_busy,
> -	.mgr_go = dispc_mgr_go,
> -	.mgr_set_lcd_config = dispc_mgr_set_lcd_config,
> -	.mgr_check_timings = dispc_mgr_check_timings,
> -	.mgr_set_timings = dispc_mgr_set_timings,
> -	.mgr_setup = dispc_mgr_setup,
> -	.mgr_gamma_size = dispc_mgr_gamma_size,
> -	.mgr_set_gamma = dispc_mgr_set_gamma,
> -
> -	.ovl_enable = dispc_ovl_enable,
> -	.ovl_setup = dispc_ovl_setup,
> -	.ovl_get_color_modes = dispc_ovl_get_color_modes,
> -
> -	.wb_get_framedone_irq = dispc_wb_get_framedone_irq,
> -	.wb_setup = dispc_wb_setup,
> -	.has_writeback = dispc_has_writeback,
> -	.wb_go_busy = dispc_wb_go_busy,
> -	.wb_go = dispc_wb_go,
> -};
> -
>  /* DISPC HW IP initialisation */
>  static const struct of_device_id dispc_of_match[] = {
>  	{ .compatible = "ti,omap2-dispc", .data = &omap24xx_dispc_feats },
> @@ -4823,7 +4780,6 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
>  	dispc_runtime_put(dispc);
>  
>  	dss->dispc = dispc;
> -	dss->dispc_ops = &dispc_ops;
>  
>  	dispc->debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs,
>  						 dispc);
> @@ -4845,7 +4801,6 @@ static void dispc_unbind(struct device *dev, struct device *master, void *data)
>  	dss_debugfs_remove_file(dispc->debugfs);
>  
>  	dss->dispc = NULL;
> -	dss->dispc_ops = NULL;
>  
>  	pm_runtime_disable(dev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
> index 2b404bcb41dd..96f702314c8c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -257,7 +257,6 @@ struct dss_device {
>  	struct dss_pll	*video2_pll;
>  
>  	struct dispc_device *dispc;
> -	const struct dispc_ops *dispc_ops;
>  	const struct dss_mgr_ops *mgr_ops;
>  	struct omap_drm_private *mgr_ops_priv;
>  };
> @@ -393,6 +392,76 @@ void dispc_dump_clocks(struct dispc_device *dispc, struct seq_file *s);
>  int dispc_runtime_get(struct dispc_device *dispc);
>  void dispc_runtime_put(struct dispc_device *dispc);
>  
> +int dispc_get_num_ovls(struct dispc_device *dispc);
> +int dispc_get_num_mgrs(struct dispc_device *dispc);
> +
> +const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc,
> +					    enum omap_plane_id plane);
> +
> +u32 dispc_read_irqstatus(struct dispc_device *dispc);
> +void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask);
> +void dispc_write_irqenable(struct dispc_device *dispc, u32 mask);
> +
> +int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
> +			     void *dev_id);
> +void dispc_free_irq(struct dispc_device *dispc, void *dev_id);
> +
> +u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
> +				   enum omap_channel channel);
> +u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
> +				       enum omap_channel channel);
> +u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
> +				       enum omap_channel channel);
> +u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc);
> +
> +u32 dispc_get_memory_bandwidth_limit(struct dispc_device *dispc);
> +
> +void dispc_mgr_enable(struct dispc_device *dispc,
> +			     enum omap_channel channel, bool enable);
> +
> +bool dispc_mgr_go_busy(struct dispc_device *dispc,
> +			      enum omap_channel channel);
> +
> +void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel);
> +
> +void dispc_mgr_set_lcd_config(struct dispc_device *dispc,
> +				     enum omap_channel channel,
> +				     const struct dss_lcd_mgr_config *config);
> +void dispc_mgr_set_timings(struct dispc_device *dispc,
> +				  enum omap_channel channel,
> +				  const struct videomode *vm);
> +void dispc_mgr_setup(struct dispc_device *dispc,
> +			    enum omap_channel channel,
> +			    const struct omap_overlay_manager_info *info);
> +
> +int dispc_mgr_check_timings(struct dispc_device *dispc,
> +				   enum omap_channel channel,
> +				   const struct videomode *vm);
> +
> +u32 dispc_mgr_gamma_size(struct dispc_device *dispc,
> +				enum omap_channel channel);
> +void dispc_mgr_set_gamma(struct dispc_device *dispc,
> +				enum omap_channel channel,
> +				const struct drm_color_lut *lut,
> +				unsigned int length);
> +
> +int dispc_ovl_setup(struct dispc_device *dispc,
> +			   enum omap_plane_id plane,
> +			   const struct omap_overlay_info *oi,
> +			   const struct videomode *vm, bool mem_to_mem,
> +			   enum omap_channel channel);
> +
> +int dispc_ovl_enable(struct dispc_device *dispc,
> +			    enum omap_plane_id plane, bool enable);
> +
> +bool dispc_has_writeback(struct dispc_device *dispc);
> +int dispc_wb_setup(struct dispc_device *dispc,
> +		   const struct omap_dss_writeback_info *wi,
> +		   bool mem_to_mem, const struct videomode *vm,
> +		   enum dss_writeback_channel channel_in);
> +bool dispc_wb_go_busy(struct dispc_device *dispc);
> +void dispc_wb_go(struct dispc_device *dispc);
> +
>  void dispc_enable_sidle(struct dispc_device *dispc);
>  void dispc_disable_sidle(struct dispc_device *dispc);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 4442e49ffc5c..fba5f05e5e48 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -376,78 +376,7 @@ int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
>  void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
>  		void (*handler)(void *), void *data);
>  
> -/* dispc ops */
> -
> -struct dispc_ops {
> -	u32 (*read_irqstatus)(struct dispc_device *dispc);
> -	void (*clear_irqstatus)(struct dispc_device *dispc, u32 mask);
> -	void (*write_irqenable)(struct dispc_device *dispc, u32 mask);
> -
> -	int (*request_irq)(struct dispc_device *dispc, irq_handler_t handler,
> -			   void *dev_id);
> -	void (*free_irq)(struct dispc_device *dispc, void *dev_id);
> -
> -	int (*runtime_get)(struct dispc_device *dispc);
> -	void (*runtime_put)(struct dispc_device *dispc);
> -
> -	int (*get_num_ovls)(struct dispc_device *dispc);
> -	int (*get_num_mgrs)(struct dispc_device *dispc);
> -
> -	u32 (*get_memory_bandwidth_limit)(struct dispc_device *dispc);
> -
> -	void (*mgr_enable)(struct dispc_device *dispc,
> -			   enum omap_channel channel, bool enable);
> -	bool (*mgr_is_enabled)(struct dispc_device *dispc,
> -			       enum omap_channel channel);
> -	u32 (*mgr_get_vsync_irq)(struct dispc_device *dispc,
> -				 enum omap_channel channel);
> -	u32 (*mgr_get_framedone_irq)(struct dispc_device *dispc,
> -				     enum omap_channel channel);
> -	u32 (*mgr_get_sync_lost_irq)(struct dispc_device *dispc,
> -				     enum omap_channel channel);
> -	bool (*mgr_go_busy)(struct dispc_device *dispc,
> -			    enum omap_channel channel);
> -	void (*mgr_go)(struct dispc_device *dispc, enum omap_channel channel);
> -	void (*mgr_set_lcd_config)(struct dispc_device *dispc,
> -				   enum omap_channel channel,
> -				   const struct dss_lcd_mgr_config *config);
> -	int (*mgr_check_timings)(struct dispc_device *dispc,
> -				 enum omap_channel channel,
> -				 const struct videomode *vm);
> -	void (*mgr_set_timings)(struct dispc_device *dispc,
> -				enum omap_channel channel,
> -				const struct videomode *vm);
> -	void (*mgr_setup)(struct dispc_device *dispc, enum omap_channel channel,
> -			  const struct omap_overlay_manager_info *info);
> -	u32 (*mgr_gamma_size)(struct dispc_device *dispc,
> -			      enum omap_channel channel);
> -	void (*mgr_set_gamma)(struct dispc_device *dispc,
> -			      enum omap_channel channel,
> -			      const struct drm_color_lut *lut,
> -			      unsigned int length);
> -
> -	int (*ovl_enable)(struct dispc_device *dispc, enum omap_plane_id plane,
> -			  bool enable);
> -	int (*ovl_setup)(struct dispc_device *dispc, enum omap_plane_id plane,
> -			 const struct omap_overlay_info *oi,
> -			 const struct videomode *vm, bool mem_to_mem,
> -			 enum omap_channel channel);
> -
> -	const u32 *(*ovl_get_color_modes)(struct dispc_device *dispc,
> -					  enum omap_plane_id plane);
> -
> -	u32 (*wb_get_framedone_irq)(struct dispc_device *dispc);
> -	int (*wb_setup)(struct dispc_device *dispc,
> -		const struct omap_dss_writeback_info *wi,
> -		bool mem_to_mem, const struct videomode *vm,
> -		enum dss_writeback_channel channel_in);
> -	bool (*has_writeback)(struct dispc_device *dispc);
> -	bool (*wb_go_busy)(struct dispc_device *dispc);
> -	void (*wb_go)(struct dispc_device *dispc);
> -};
> -
>  struct dispc_device *dispc_get_dispc(struct dss_device *dss);
> -const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
>  
>  bool omapdss_stack_is_ready(void);
>  void omapdss_gather_components(struct device *dev);
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 5ab557c477ef..0bf5cef579b5 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -103,7 +103,7 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc)
>  static void omap_crtc_dss_start_update(struct omap_drm_private *priv,
>  				       enum omap_channel channel)
>  {
> -	priv->dispc_ops->mgr_enable(priv->dispc, channel, true);
> +	dispc_mgr_enable(priv->dispc, channel, true);
>  }
>  
>  /* Called only from the encoder enable/disable and suspend/resume handlers. */
> @@ -128,7 +128,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
>  	}
>  
>  	if (omap_crtc->pipe->output->type == OMAP_DISPLAY_TYPE_HDMI) {
> -		priv->dispc_ops->mgr_enable(priv->dispc, channel, enable);
> +		dispc_mgr_enable(priv->dispc, channel, enable);
>  		omap_crtc->enabled = enable;
>  		return;
>  	}
> @@ -141,9 +141,9 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
>  		omap_crtc->ignore_digit_sync_lost = true;
>  	}
>  
> -	framedone_irq = priv->dispc_ops->mgr_get_framedone_irq(priv->dispc,
> +	framedone_irq = dispc_mgr_get_framedone_irq(priv->dispc,
>  							       channel);
> -	vsync_irq = priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel);
> +	vsync_irq = dispc_mgr_get_vsync_irq(priv->dispc, channel);
>  
>  	if (enable) {
>  		wait = omap_irq_wait_init(dev, vsync_irq, 1);
> @@ -163,7 +163,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
>  			wait = omap_irq_wait_init(dev, vsync_irq, 2);
>  	}
>  
> -	priv->dispc_ops->mgr_enable(priv->dispc, channel, enable);
> +	dispc_mgr_enable(priv->dispc, channel, enable);
>  	omap_crtc->enabled = enable;
>  
>  	ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100));
> @@ -186,7 +186,7 @@ static int omap_crtc_dss_enable(struct omap_drm_private *priv,
>  	struct drm_crtc *crtc = priv->channels[channel]->crtc;
>  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
>  
> -	priv->dispc_ops->mgr_set_timings(priv->dispc, omap_crtc->channel,
> +	dispc_mgr_set_timings(priv->dispc, omap_crtc->channel,
>  					 &omap_crtc->vm);
>  	omap_crtc_set_enabled(&omap_crtc->base, true);
>  
> @@ -221,7 +221,7 @@ static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
>  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
>  
>  	DBG("%s", omap_crtc->name);
> -	priv->dispc_ops->mgr_set_lcd_config(priv->dispc, omap_crtc->channel,
> +	dispc_mgr_set_lcd_config(priv->dispc, omap_crtc->channel,
>  					    config);
>  }
>  
> @@ -300,7 +300,7 @@ void omap_crtc_vblank_irq(struct drm_crtc *crtc)
>  	 * If the dispc is busy we're racing the flush operation. Try again on
>  	 * the next vblank interrupt.
>  	 */
> -	if (priv->dispc_ops->mgr_go_busy(priv->dispc, omap_crtc->channel)) {
> +	if (dispc_mgr_go_busy(priv->dispc, omap_crtc->channel)) {
>  		spin_unlock(&crtc->dev->event_lock);
>  		return;
>  	}
> @@ -391,7 +391,7 @@ static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc)
>  	info.partial_alpha_enabled = false;
>  	info.cpr_enable = false;
>  
> -	priv->dispc_ops->mgr_setup(priv->dispc, omap_crtc->channel, &info);
> +	dispc_mgr_setup(priv->dispc, omap_crtc->channel, &info);
>  }
>  
>  /* -----------------------------------------------------------------------------
> @@ -432,7 +432,7 @@ static void omap_crtc_atomic_enable(struct drm_crtc *crtc,
>  
>  	DBG("%s", omap_crtc->name);
>  
> -	priv->dispc_ops->runtime_get(priv->dispc);
> +	dispc_runtime_get(priv->dispc);
>  
>  	/* manual updated display will not trigger vsync irq */
>  	if (omap_state->manually_updated)
> @@ -471,7 +471,7 @@ static void omap_crtc_atomic_disable(struct drm_crtc *crtc,
>  
>  	drm_crtc_vblank_off(crtc);
>  
> -	priv->dispc_ops->runtime_put(priv->dispc);
> +	dispc_runtime_put(priv->dispc);
>  }
>  
>  static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
> @@ -490,7 +490,7 @@ static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
>  	 * proper DISPC mode later.
>  	 */
>  	if (omap_crtc->pipe->output->type != OMAP_DISPLAY_TYPE_DSI) {
> -		r = priv->dispc_ops->mgr_check_timings(priv->dispc,
> +		r = dispc_mgr_check_timings(priv->dispc,
>  						       omap_crtc->channel,
>  						       &vm);
>  		if (r)
> @@ -605,7 +605,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
>  			length = crtc->state->gamma_lut->length /
>  				sizeof(*lut);
>  		}
> -		priv->dispc_ops->mgr_set_gamma(priv->dispc, omap_crtc->channel,
> +		dispc_mgr_set_gamma(priv->dispc, omap_crtc->channel,
>  					       lut, length);
>  	}
>  
> @@ -630,7 +630,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
>  	WARN_ON(ret != 0);
>  
>  	spin_lock_irq(&crtc->dev->event_lock);
> -	priv->dispc_ops->mgr_go(priv->dispc, omap_crtc->channel);
> +	dispc_mgr_go(priv->dispc, omap_crtc->channel);
>  	omap_crtc_arm_event(crtc);
>  	spin_unlock_irq(&crtc->dev->event_lock);
>  }
> @@ -821,7 +821,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
>  	 * extracted with dispc_mgr_gamma_size(). If it returns 0
>  	 * gamma table is not supported.
>  	 */
> -	if (priv->dispc_ops->mgr_gamma_size(priv->dispc, channel)) {
> +	if (dispc_mgr_gamma_size(priv->dispc, channel)) {
>  		unsigned int gamma_lut_size = 256;
>  
>  		drm_crtc_enable_color_mgmt(crtc, 0, false, gamma_lut_size);
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 9d5f53e774ef..eb419387ed05 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -69,7 +69,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)
>  	struct drm_device *dev = old_state->dev;
>  	struct omap_drm_private *priv = dev->dev_private;
>  
> -	priv->dispc_ops->runtime_get(priv->dispc);
> +	dispc_runtime_get(priv->dispc);
>  
>  	/* Apply the atomic update. */
>  	drm_atomic_helper_commit_modeset_disables(dev, old_state);
> @@ -113,7 +113,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)
>  
>  	drm_atomic_helper_cleanup_planes(dev, old_state);
>  
> -	priv->dispc_ops->runtime_put(priv->dispc);
> +	dispc_runtime_put(priv->dispc);
>  }
>  
>  static const struct drm_mode_config_helper_funcs omap_mode_config_helper_funcs = {
> @@ -192,7 +192,7 @@ static int omap_compare_pipelines(const void *a, const void *b)
>  static int omap_modeset_init_properties(struct drm_device *dev)
>  {
>  	struct omap_drm_private *priv = dev->dev_private;
> -	unsigned int num_planes = priv->dispc_ops->get_num_ovls(priv->dispc);
> +	unsigned int num_planes = dispc_get_num_ovls(priv->dispc);
>  
>  	priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0,
>  						      num_planes - 1);
> @@ -221,8 +221,8 @@ static int omap_display_id(struct omap_dss_device *output)
>  static int omap_modeset_init(struct drm_device *dev)
>  {
>  	struct omap_drm_private *priv = dev->dev_private;
> -	int num_ovls = priv->dispc_ops->get_num_ovls(priv->dispc);
> -	int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc);
> +	int num_ovls = dispc_get_num_ovls(priv->dispc);
> +	int num_mgrs = dispc_get_num_mgrs(priv->dispc);
>  	unsigned int i;
>  	int ret;
>  	u32 plane_crtc_mask;
> @@ -580,7 +580,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  	priv->dev = dev;
>  	priv->dss = pdata->dss;
>  	priv->dispc = dispc_get_dispc(priv->dss);
> -	priv->dispc_ops = dispc_get_ops(priv->dss);
>  
>  	omap_crtc_pre_init(priv);
>  
> @@ -592,9 +591,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  	INIT_LIST_HEAD(&priv->obj_list);
>  
>  	/* Get memory bandwidth limits */
> -	if (priv->dispc_ops->get_memory_bandwidth_limit)
> -		priv->max_bandwidth =
> -			priv->dispc_ops->get_memory_bandwidth_limit(priv->dispc);
> +	priv->max_bandwidth = dispc_get_memory_bandwidth_limit(priv->dispc);
>  
>  	omap_gem_init(ddev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
> index 93d171ffd26d..6e69358f624c 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.h
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.h
> @@ -12,6 +12,7 @@
>  #include <linux/workqueue.h>
>  
>  #include "dss/omapdss.h"
> +#include "dss/dss.h"
>  
>  #include <drm/drm_gem.h>
>  #include <drm/omap_drm.h>
> @@ -46,7 +47,6 @@ struct omap_drm_private {
>  
>  	struct dss_device *dss;
>  	struct dispc_device *dispc;
> -	const struct dispc_ops *dispc_ops;
>  
>  	unsigned int num_pipes;
>  	struct omap_drm_pipeline pipes[8];
> diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c
> index 382bcdc72ac0..981387220765 100644
> --- a/drivers/gpu/drm/omapdrm/omap_irq.c
> +++ b/drivers/gpu/drm/omapdrm/omap_irq.c
> @@ -29,7 +29,7 @@ static void omap_irq_update(struct drm_device *dev)
>  
>  	DBG("irqmask=%08x", irqmask);
>  
> -	priv->dispc_ops->write_irqenable(priv->dispc, irqmask);
> +	dispc_write_irqenable(priv->dispc, irqmask);
>  }
>  
>  static void omap_irq_wait_handler(struct omap_irq_wait *wait)
> @@ -83,7 +83,7 @@ int omap_irq_enable_framedone(struct drm_crtc *crtc, bool enable)
>  	unsigned long flags;
>  	enum omap_channel channel = omap_crtc_channel(crtc);
>  	int framedone_irq =
> -		priv->dispc_ops->mgr_get_framedone_irq(priv->dispc, channel);
> +		dispc_mgr_get_framedone_irq(priv->dispc, channel);
>  
>  	DBG("dev=%p, crtc=%u, enable=%d", dev, channel, enable);
>  
> @@ -121,7 +121,7 @@ int omap_irq_enable_vblank(struct drm_crtc *crtc)
>  	DBG("dev=%p, crtc=%u", dev, channel);
>  
>  	spin_lock_irqsave(&priv->wait_lock, flags);
> -	priv->irq_mask |= priv->dispc_ops->mgr_get_vsync_irq(priv->dispc,
> +	priv->irq_mask |= dispc_mgr_get_vsync_irq(priv->dispc,
>  							     channel);
>  	omap_irq_update(dev);
>  	spin_unlock_irqrestore(&priv->wait_lock, flags);
> @@ -148,7 +148,7 @@ void omap_irq_disable_vblank(struct drm_crtc *crtc)
>  	DBG("dev=%p, crtc=%u", dev, channel);
>  
>  	spin_lock_irqsave(&priv->wait_lock, flags);
> -	priv->irq_mask &= ~priv->dispc_ops->mgr_get_vsync_irq(priv->dispc,
> +	priv->irq_mask &= ~dispc_mgr_get_vsync_irq(priv->dispc,
>  							      channel);
>  	omap_irq_update(dev);
>  	spin_unlock_irqrestore(&priv->wait_lock, flags);
> @@ -213,9 +213,9 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
>  	unsigned int id;
>  	u32 irqstatus;
>  
> -	irqstatus = priv->dispc_ops->read_irqstatus(priv->dispc);
> -	priv->dispc_ops->clear_irqstatus(priv->dispc, irqstatus);
> -	priv->dispc_ops->read_irqstatus(priv->dispc);	/* flush posted write */
> +	irqstatus = dispc_read_irqstatus(priv->dispc);
> +	dispc_clear_irqstatus(priv->dispc, irqstatus);
> +	dispc_read_irqstatus(priv->dispc);	/* flush posted write */
>  
>  	VERB("irqs: %08x", irqstatus);
>  
> @@ -223,15 +223,15 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
>  		struct drm_crtc *crtc = priv->pipes[id].crtc;
>  		enum omap_channel channel = omap_crtc_channel(crtc);
>  
> -		if (irqstatus & priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel)) {
> +		if (irqstatus & dispc_mgr_get_vsync_irq(priv->dispc, channel)) {
>  			drm_handle_vblank(dev, id);
>  			omap_crtc_vblank_irq(crtc);
>  		}
>  
> -		if (irqstatus & priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, channel))
> +		if (irqstatus & dispc_mgr_get_sync_lost_irq(priv->dispc, channel))
>  			omap_crtc_error_irq(crtc, irqstatus);
>  
> -		if (irqstatus & priv->dispc_ops->mgr_get_framedone_irq(priv->dispc, channel))
> +		if (irqstatus & dispc_mgr_get_framedone_irq(priv->dispc, channel))
>  			omap_crtc_framedone_irq(crtc, irqstatus);
>  	}
>  
> @@ -265,7 +265,7 @@ static const u32 omap_underflow_irqs[] = {
>  int omap_drm_irq_install(struct drm_device *dev)
>  {
>  	struct omap_drm_private *priv = dev->dev_private;
> -	unsigned int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc);
> +	unsigned int num_mgrs = dispc_get_num_mgrs(priv->dispc);
>  	unsigned int max_planes;
>  	unsigned int i;
>  	int ret;
> @@ -283,13 +283,13 @@ int omap_drm_irq_install(struct drm_device *dev)
>  	}
>  
>  	for (i = 0; i < num_mgrs; ++i)
> -		priv->irq_mask |= priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, i);
> +		priv->irq_mask |= dispc_mgr_get_sync_lost_irq(priv->dispc, i);
>  
> -	priv->dispc_ops->runtime_get(priv->dispc);
> -	priv->dispc_ops->clear_irqstatus(priv->dispc, 0xffffffff);
> -	priv->dispc_ops->runtime_put(priv->dispc);
> +	dispc_runtime_get(priv->dispc);
> +	dispc_clear_irqstatus(priv->dispc, 0xffffffff);
> +	dispc_runtime_put(priv->dispc);
>  
> -	ret = priv->dispc_ops->request_irq(priv->dispc, omap_irq_handler, dev);
> +	ret = dispc_request_irq(priv->dispc, omap_irq_handler, dev);
>  	if (ret < 0)
>  		return ret;
>  
> @@ -307,5 +307,5 @@ void omap_drm_irq_uninstall(struct drm_device *dev)
>  
>  	dev->irq_enabled = false;
>  
> -	priv->dispc_ops->free_irq(priv->dispc, dev);
> +	dispc_free_irq(priv->dispc, dev);
>  }
> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
> index 73ec99819a3d..88d2a986d880 100644
> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
> @@ -70,17 +70,17 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
>  			&info.paddr, &info.p_uv_addr);
>  
>  	/* and finally, update omapdss: */
> -	ret = priv->dispc_ops->ovl_setup(priv->dispc, omap_plane->id, &info,
> +	ret = dispc_ovl_setup(priv->dispc, omap_plane->id, &info,
>  			      omap_crtc_timings(state->crtc), false,
>  			      omap_crtc_channel(state->crtc));
>  	if (ret) {
>  		dev_err(plane->dev->dev, "Failed to setup plane %s\n",
>  			omap_plane->name);
> -		priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, false);
> +		dispc_ovl_enable(priv->dispc, omap_plane->id, false);
>  		return;
>  	}
>  
> -	priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, true);
> +	dispc_ovl_enable(priv->dispc, omap_plane->id, true);
>  }
>  
>  static void omap_plane_atomic_disable(struct drm_plane *plane,
> @@ -93,7 +93,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
>  	plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY
>  			   ? 0 : omap_plane->id;
>  
> -	priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, false);
> +	dispc_ovl_enable(priv->dispc, omap_plane->id, false);
>  }
>  
>  static int omap_plane_atomic_check(struct drm_plane *plane,
> @@ -252,7 +252,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
>  		u32 possible_crtcs)
>  {
>  	struct omap_drm_private *priv = dev->dev_private;
> -	unsigned int num_planes = priv->dispc_ops->get_num_ovls(priv->dispc);
> +	unsigned int num_planes = dispc_get_num_ovls(priv->dispc);
>  	struct drm_plane *plane;
>  	struct omap_plane *omap_plane;
>  	enum omap_plane_id id;
> @@ -271,7 +271,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
>  	if (!omap_plane)
>  		return ERR_PTR(-ENOMEM);
>  
> -	formats = priv->dispc_ops->ovl_get_color_modes(priv->dispc, id);
> +	formats = dispc_ovl_get_color_modes(priv->dispc, id);
>  	for (nformats = 0; formats[nformats]; ++nformats)
>  		;
>  	omap_plane->id = id;

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 55/56] drm/omap: remove dispc_ops
@ 2020-11-09 11:17     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:17 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, linux-omap, Nikhil Devshatwar

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:32PM +0200, Tomi Valkeinen wrote:
> dispc_ops was created to help with the multi-module architecture and
> giving us the possibility of multiple dispc implementations. Neither of
> these is valid anymore, and we can remove dispc_ops and use direct
> calls to dispc.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/base.c    |   6 --
>  drivers/gpu/drm/omapdrm/dss/dispc.c   | 101 +++++++-------------------
>  drivers/gpu/drm/omapdrm/dss/dss.h     |  71 +++++++++++++++++-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  71 ------------------
>  drivers/gpu/drm/omapdrm/omap_crtc.c   |  30 ++++----
>  drivers/gpu/drm/omapdrm/omap_drv.c    |  15 ++--
>  drivers/gpu/drm/omapdrm/omap_drv.h    |   2 +-
>  drivers/gpu/drm/omapdrm/omap_irq.c    |  34 ++++-----
>  drivers/gpu/drm/omapdrm/omap_plane.c  |  12 +--
>  9 files changed, 143 insertions(+), 199 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index 08c7c5024896..0aff16bf6edb 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -21,12 +21,6 @@ struct dispc_device *dispc_get_dispc(struct dss_device *dss)
>  	return dss->dispc;
>  }
>  
> -const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
> -{
> -	return dss->dispc_ops;
> -}
> -
> -
>  /* -----------------------------------------------------------------------------
>   * OMAP DSS Devices Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
> index 48593932bddf..509bac99cb57 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -351,8 +351,6 @@ static unsigned long dispc_plane_pclk_rate(struct dispc_device *dispc,
>  static unsigned long dispc_plane_lclk_rate(struct dispc_device *dispc,
>  					   enum omap_plane_id plane);
>  
> -static void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask);
> -
>  static inline void dispc_write_reg(struct dispc_device *dispc, u16 idx, u32 val)
>  {
>  	__raw_writel(val, dispc->base + idx);
> @@ -379,12 +377,12 @@ static void mgr_fld_write(struct dispc_device *dispc, enum omap_channel channel,
>  	REG_FLD_MOD(dispc, rfld->reg, val, rfld->high, rfld->low);
>  }
>  
> -static int dispc_get_num_ovls(struct dispc_device *dispc)
> +int dispc_get_num_ovls(struct dispc_device *dispc)
>  {
>  	return dispc->feat->num_ovls;
>  }
>  
> -static int dispc_get_num_mgrs(struct dispc_device *dispc)
> +int dispc_get_num_mgrs(struct dispc_device *dispc)
>  {
>  	return dispc->feat->num_mgrs;
>  }
> @@ -667,13 +665,13 @@ void dispc_runtime_put(struct dispc_device *dispc)
>  	WARN_ON(r < 0 && r != -ENOSYS);
>  }
>  
> -static u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
> +u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
>  				   enum omap_channel channel)
>  {
>  	return mgr_desc[channel].vsync_irq;
>  }
>  
> -static u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
> +u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
>  				       enum omap_channel channel)
>  {
>  	if (channel == OMAP_DSS_CHANNEL_DIGIT && dispc->feat->no_framedone_tv)
> @@ -682,18 +680,18 @@ static u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
>  	return mgr_desc[channel].framedone_irq;
>  }
>  
> -static u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
> +u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
>  				       enum omap_channel channel)
>  {
>  	return mgr_desc[channel].sync_lost_irq;
>  }
>  
> -static u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
> +u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
>  {
>  	return DISPC_IRQ_FRAMEDONEWB;
>  }
>  
> -static void dispc_mgr_enable(struct dispc_device *dispc,
> +void dispc_mgr_enable(struct dispc_device *dispc,
>  			     enum omap_channel channel, bool enable)
>  {
>  	mgr_fld_write(dispc, channel, DISPC_MGR_FLD_ENABLE, enable);
> @@ -707,13 +705,13 @@ static bool dispc_mgr_is_enabled(struct dispc_device *dispc,
>  	return !!mgr_fld_read(dispc, channel, DISPC_MGR_FLD_ENABLE);
>  }
>  
> -static bool dispc_mgr_go_busy(struct dispc_device *dispc,
> +bool dispc_mgr_go_busy(struct dispc_device *dispc,
>  			      enum omap_channel channel)
>  {
>  	return mgr_fld_read(dispc, channel, DISPC_MGR_FLD_GO) == 1;
>  }
>  
> -static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
> +void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
>  {
>  	WARN_ON(!dispc_mgr_is_enabled(dispc, channel));
>  	WARN_ON(dispc_mgr_go_busy(dispc, channel));
> @@ -723,12 +721,12 @@ static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
>  	mgr_fld_write(dispc, channel, DISPC_MGR_FLD_GO, 1);
>  }
>  
> -static bool dispc_wb_go_busy(struct dispc_device *dispc)
> +bool dispc_wb_go_busy(struct dispc_device *dispc)
>  {
>  	return REG_GET(dispc, DISPC_CONTROL2, 6, 6) == 1;
>  }
>  
> -static void dispc_wb_go(struct dispc_device *dispc)
> +void dispc_wb_go(struct dispc_device *dispc)
>  {
>  	enum omap_plane_id plane = OMAP_DSS_WB;
>  	bool enable, go;
> @@ -1282,7 +1280,7 @@ static bool dispc_ovl_color_mode_supported(struct dispc_device *dispc,
>  	return false;
>  }
>  
> -static const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc,
> +const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc,
>  					    enum omap_plane_id plane)
>  {
>  	return dispc->feat->supported_color_modes[plane];
> @@ -2761,7 +2759,7 @@ static int dispc_ovl_setup_common(struct dispc_device *dispc,
>  	return 0;
>  }
>  
> -static int dispc_ovl_setup(struct dispc_device *dispc,
> +int dispc_ovl_setup(struct dispc_device *dispc,
>  			   enum omap_plane_id plane,
>  			   const struct omap_overlay_info *oi,
>  			   const struct videomode *vm, bool mem_to_mem,
> @@ -2788,7 +2786,7 @@ static int dispc_ovl_setup(struct dispc_device *dispc,
>  	return r;
>  }
>  
> -static int dispc_wb_setup(struct dispc_device *dispc,
> +int dispc_wb_setup(struct dispc_device *dispc,
>  		   const struct omap_dss_writeback_info *wi,
>  		   bool mem_to_mem, const struct videomode *vm,
>  		   enum dss_writeback_channel channel_in)
> @@ -2871,12 +2869,12 @@ static int dispc_wb_setup(struct dispc_device *dispc,
>  	return 0;
>  }
>  
> -static bool dispc_has_writeback(struct dispc_device *dispc)
> +bool dispc_has_writeback(struct dispc_device *dispc)
>  {
>  	return dispc->feat->has_writeback;
>  }
>  
> -static int dispc_ovl_enable(struct dispc_device *dispc,
> +int dispc_ovl_enable(struct dispc_device *dispc,
>  			    enum omap_plane_id plane, bool enable)
>  {
>  	DSSDBG("dispc_enable_plane %d, %d\n", plane, enable);
> @@ -2967,7 +2965,7 @@ static void dispc_mgr_enable_alpha_fixed_zorder(struct dispc_device *dispc,
>  		REG_FLD_MOD(dispc, DISPC_CONFIG, enable, 19, 19);
>  }
>  
> -static void dispc_mgr_setup(struct dispc_device *dispc,
> +void dispc_mgr_setup(struct dispc_device *dispc,
>  			    enum omap_channel channel,
>  			    const struct omap_overlay_manager_info *info)
>  {
> @@ -3046,7 +3044,7 @@ static void dispc_mgr_enable_stallmode(struct dispc_device *dispc,
>  	mgr_fld_write(dispc, channel, DISPC_MGR_FLD_STALLMODE, enable);
>  }
>  
> -static void dispc_mgr_set_lcd_config(struct dispc_device *dispc,
> +void dispc_mgr_set_lcd_config(struct dispc_device *dispc,
>  				     enum omap_channel channel,
>  				     const struct dss_lcd_mgr_config *config)
>  {
> @@ -3095,7 +3093,7 @@ static bool _dispc_mgr_pclk_ok(struct dispc_device *dispc,
>  		return pclk <= dispc->feat->max_tv_pclk;
>  }
>  
> -static int dispc_mgr_check_timings(struct dispc_device *dispc,
> +int dispc_mgr_check_timings(struct dispc_device *dispc,
>  				   enum omap_channel channel,
>  				   const struct videomode *vm)
>  {
> @@ -3188,7 +3186,7 @@ static int vm_flag_to_int(enum display_flags flags, enum display_flags high,
>  }
>  
>  /* change name to mode? */
> -static void dispc_mgr_set_timings(struct dispc_device *dispc,
> +void dispc_mgr_set_timings(struct dispc_device *dispc,
>  				  enum omap_channel channel,
>  				  const struct videomode *vm)
>  {
> @@ -3732,17 +3730,17 @@ int dispc_mgr_get_clock_div(struct dispc_device *dispc,
>  	return 0;
>  }
>  
> -static u32 dispc_read_irqstatus(struct dispc_device *dispc)
> +u32 dispc_read_irqstatus(struct dispc_device *dispc)
>  {
>  	return dispc_read_reg(dispc, DISPC_IRQSTATUS);
>  }
>  
> -static void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask)
> +void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask)
>  {
>  	dispc_write_reg(dispc, DISPC_IRQSTATUS, mask);
>  }
>  
> -static void dispc_write_irqenable(struct dispc_device *dispc, u32 mask)
> +void dispc_write_irqenable(struct dispc_device *dispc, u32 mask)
>  {
>  	u32 old_mask = dispc_read_reg(dispc, DISPC_IRQENABLE);
>  
> @@ -3766,7 +3764,7 @@ void dispc_disable_sidle(struct dispc_device *dispc)
>  	REG_FLD_MOD(dispc, DISPC_SYSCONFIG, 1, 4, 3);	/* SIDLEMODE: no idle */
>  }
>  
> -static u32 dispc_mgr_gamma_size(struct dispc_device *dispc,
> +u32 dispc_mgr_gamma_size(struct dispc_device *dispc,
>  				enum omap_channel channel)
>  {
>  	const struct dispc_gamma_desc *gdesc = &mgr_desc[channel].gamma;
> @@ -3821,7 +3819,7 @@ static const struct drm_color_lut dispc_mgr_gamma_default_lut[] = {
>  	{ .red = U16_MAX, .green = U16_MAX, .blue = U16_MAX, },
>  };
>  
> -static void dispc_mgr_set_gamma(struct dispc_device *dispc,
> +void dispc_mgr_set_gamma(struct dispc_device *dispc,
>  				enum omap_channel channel,
>  				const struct drm_color_lut *lut,
>  				unsigned int length)
> @@ -4479,7 +4477,7 @@ static irqreturn_t dispc_irq_handler(int irq, void *arg)
>  	return dispc->user_handler(irq, dispc->user_data);
>  }
>  
> -static int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
> +int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
>  			     void *dev_id)
>  {
>  	int r;
> @@ -4503,7 +4501,7 @@ static int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
>  	return r;
>  }
>  
> -static void dispc_free_irq(struct dispc_device *dispc, void *dev_id)
> +void dispc_free_irq(struct dispc_device *dispc, void *dev_id)
>  {
>  	devm_free_irq(&dispc->pdev->dev, dispc->irq, dispc);
>  
> @@ -4511,7 +4509,7 @@ static void dispc_free_irq(struct dispc_device *dispc, void *dev_id)
>  	dispc->user_data = NULL;
>  }
>  
> -static u32 dispc_get_memory_bandwidth_limit(struct dispc_device *dispc)
> +u32 dispc_get_memory_bandwidth_limit(struct dispc_device *dispc)
>  {
>  	u32 limit = 0;
>  
> @@ -4681,47 +4679,6 @@ static void dispc_errata_i734_wa(struct dispc_device *dispc)
>  	REG_FLD_MOD(dispc, DISPC_CONFIG, gatestate, 8, 4);
>  }
>  
> -static const struct dispc_ops dispc_ops = {
> -	.read_irqstatus = dispc_read_irqstatus,
> -	.clear_irqstatus = dispc_clear_irqstatus,
> -	.write_irqenable = dispc_write_irqenable,
> -
> -	.request_irq = dispc_request_irq,
> -	.free_irq = dispc_free_irq,
> -
> -	.runtime_get = dispc_runtime_get,
> -	.runtime_put = dispc_runtime_put,
> -
> -	.get_num_ovls = dispc_get_num_ovls,
> -	.get_num_mgrs = dispc_get_num_mgrs,
> -
> -	.get_memory_bandwidth_limit = dispc_get_memory_bandwidth_limit,
> -
> -	.mgr_enable = dispc_mgr_enable,
> -	.mgr_is_enabled = dispc_mgr_is_enabled,
> -	.mgr_get_vsync_irq = dispc_mgr_get_vsync_irq,
> -	.mgr_get_framedone_irq = dispc_mgr_get_framedone_irq,
> -	.mgr_get_sync_lost_irq = dispc_mgr_get_sync_lost_irq,
> -	.mgr_go_busy = dispc_mgr_go_busy,
> -	.mgr_go = dispc_mgr_go,
> -	.mgr_set_lcd_config = dispc_mgr_set_lcd_config,
> -	.mgr_check_timings = dispc_mgr_check_timings,
> -	.mgr_set_timings = dispc_mgr_set_timings,
> -	.mgr_setup = dispc_mgr_setup,
> -	.mgr_gamma_size = dispc_mgr_gamma_size,
> -	.mgr_set_gamma = dispc_mgr_set_gamma,
> -
> -	.ovl_enable = dispc_ovl_enable,
> -	.ovl_setup = dispc_ovl_setup,
> -	.ovl_get_color_modes = dispc_ovl_get_color_modes,
> -
> -	.wb_get_framedone_irq = dispc_wb_get_framedone_irq,
> -	.wb_setup = dispc_wb_setup,
> -	.has_writeback = dispc_has_writeback,
> -	.wb_go_busy = dispc_wb_go_busy,
> -	.wb_go = dispc_wb_go,
> -};
> -
>  /* DISPC HW IP initialisation */
>  static const struct of_device_id dispc_of_match[] = {
>  	{ .compatible = "ti,omap2-dispc", .data = &omap24xx_dispc_feats },
> @@ -4823,7 +4780,6 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
>  	dispc_runtime_put(dispc);
>  
>  	dss->dispc = dispc;
> -	dss->dispc_ops = &dispc_ops;
>  
>  	dispc->debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs,
>  						 dispc);
> @@ -4845,7 +4801,6 @@ static void dispc_unbind(struct device *dev, struct device *master, void *data)
>  	dss_debugfs_remove_file(dispc->debugfs);
>  
>  	dss->dispc = NULL;
> -	dss->dispc_ops = NULL;
>  
>  	pm_runtime_disable(dev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
> index 2b404bcb41dd..96f702314c8c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -257,7 +257,6 @@ struct dss_device {
>  	struct dss_pll	*video2_pll;
>  
>  	struct dispc_device *dispc;
> -	const struct dispc_ops *dispc_ops;
>  	const struct dss_mgr_ops *mgr_ops;
>  	struct omap_drm_private *mgr_ops_priv;
>  };
> @@ -393,6 +392,76 @@ void dispc_dump_clocks(struct dispc_device *dispc, struct seq_file *s);
>  int dispc_runtime_get(struct dispc_device *dispc);
>  void dispc_runtime_put(struct dispc_device *dispc);
>  
> +int dispc_get_num_ovls(struct dispc_device *dispc);
> +int dispc_get_num_mgrs(struct dispc_device *dispc);
> +
> +const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc,
> +					    enum omap_plane_id plane);
> +
> +u32 dispc_read_irqstatus(struct dispc_device *dispc);
> +void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask);
> +void dispc_write_irqenable(struct dispc_device *dispc, u32 mask);
> +
> +int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
> +			     void *dev_id);
> +void dispc_free_irq(struct dispc_device *dispc, void *dev_id);
> +
> +u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
> +				   enum omap_channel channel);
> +u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
> +				       enum omap_channel channel);
> +u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
> +				       enum omap_channel channel);
> +u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc);
> +
> +u32 dispc_get_memory_bandwidth_limit(struct dispc_device *dispc);
> +
> +void dispc_mgr_enable(struct dispc_device *dispc,
> +			     enum omap_channel channel, bool enable);
> +
> +bool dispc_mgr_go_busy(struct dispc_device *dispc,
> +			      enum omap_channel channel);
> +
> +void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel);
> +
> +void dispc_mgr_set_lcd_config(struct dispc_device *dispc,
> +				     enum omap_channel channel,
> +				     const struct dss_lcd_mgr_config *config);
> +void dispc_mgr_set_timings(struct dispc_device *dispc,
> +				  enum omap_channel channel,
> +				  const struct videomode *vm);
> +void dispc_mgr_setup(struct dispc_device *dispc,
> +			    enum omap_channel channel,
> +			    const struct omap_overlay_manager_info *info);
> +
> +int dispc_mgr_check_timings(struct dispc_device *dispc,
> +				   enum omap_channel channel,
> +				   const struct videomode *vm);
> +
> +u32 dispc_mgr_gamma_size(struct dispc_device *dispc,
> +				enum omap_channel channel);
> +void dispc_mgr_set_gamma(struct dispc_device *dispc,
> +				enum omap_channel channel,
> +				const struct drm_color_lut *lut,
> +				unsigned int length);
> +
> +int dispc_ovl_setup(struct dispc_device *dispc,
> +			   enum omap_plane_id plane,
> +			   const struct omap_overlay_info *oi,
> +			   const struct videomode *vm, bool mem_to_mem,
> +			   enum omap_channel channel);
> +
> +int dispc_ovl_enable(struct dispc_device *dispc,
> +			    enum omap_plane_id plane, bool enable);
> +
> +bool dispc_has_writeback(struct dispc_device *dispc);
> +int dispc_wb_setup(struct dispc_device *dispc,
> +		   const struct omap_dss_writeback_info *wi,
> +		   bool mem_to_mem, const struct videomode *vm,
> +		   enum dss_writeback_channel channel_in);
> +bool dispc_wb_go_busy(struct dispc_device *dispc);
> +void dispc_wb_go(struct dispc_device *dispc);
> +
>  void dispc_enable_sidle(struct dispc_device *dispc);
>  void dispc_disable_sidle(struct dispc_device *dispc);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 4442e49ffc5c..fba5f05e5e48 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -376,78 +376,7 @@ int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
>  void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
>  		void (*handler)(void *), void *data);
>  
> -/* dispc ops */
> -
> -struct dispc_ops {
> -	u32 (*read_irqstatus)(struct dispc_device *dispc);
> -	void (*clear_irqstatus)(struct dispc_device *dispc, u32 mask);
> -	void (*write_irqenable)(struct dispc_device *dispc, u32 mask);
> -
> -	int (*request_irq)(struct dispc_device *dispc, irq_handler_t handler,
> -			   void *dev_id);
> -	void (*free_irq)(struct dispc_device *dispc, void *dev_id);
> -
> -	int (*runtime_get)(struct dispc_device *dispc);
> -	void (*runtime_put)(struct dispc_device *dispc);
> -
> -	int (*get_num_ovls)(struct dispc_device *dispc);
> -	int (*get_num_mgrs)(struct dispc_device *dispc);
> -
> -	u32 (*get_memory_bandwidth_limit)(struct dispc_device *dispc);
> -
> -	void (*mgr_enable)(struct dispc_device *dispc,
> -			   enum omap_channel channel, bool enable);
> -	bool (*mgr_is_enabled)(struct dispc_device *dispc,
> -			       enum omap_channel channel);
> -	u32 (*mgr_get_vsync_irq)(struct dispc_device *dispc,
> -				 enum omap_channel channel);
> -	u32 (*mgr_get_framedone_irq)(struct dispc_device *dispc,
> -				     enum omap_channel channel);
> -	u32 (*mgr_get_sync_lost_irq)(struct dispc_device *dispc,
> -				     enum omap_channel channel);
> -	bool (*mgr_go_busy)(struct dispc_device *dispc,
> -			    enum omap_channel channel);
> -	void (*mgr_go)(struct dispc_device *dispc, enum omap_channel channel);
> -	void (*mgr_set_lcd_config)(struct dispc_device *dispc,
> -				   enum omap_channel channel,
> -				   const struct dss_lcd_mgr_config *config);
> -	int (*mgr_check_timings)(struct dispc_device *dispc,
> -				 enum omap_channel channel,
> -				 const struct videomode *vm);
> -	void (*mgr_set_timings)(struct dispc_device *dispc,
> -				enum omap_channel channel,
> -				const struct videomode *vm);
> -	void (*mgr_setup)(struct dispc_device *dispc, enum omap_channel channel,
> -			  const struct omap_overlay_manager_info *info);
> -	u32 (*mgr_gamma_size)(struct dispc_device *dispc,
> -			      enum omap_channel channel);
> -	void (*mgr_set_gamma)(struct dispc_device *dispc,
> -			      enum omap_channel channel,
> -			      const struct drm_color_lut *lut,
> -			      unsigned int length);
> -
> -	int (*ovl_enable)(struct dispc_device *dispc, enum omap_plane_id plane,
> -			  bool enable);
> -	int (*ovl_setup)(struct dispc_device *dispc, enum omap_plane_id plane,
> -			 const struct omap_overlay_info *oi,
> -			 const struct videomode *vm, bool mem_to_mem,
> -			 enum omap_channel channel);
> -
> -	const u32 *(*ovl_get_color_modes)(struct dispc_device *dispc,
> -					  enum omap_plane_id plane);
> -
> -	u32 (*wb_get_framedone_irq)(struct dispc_device *dispc);
> -	int (*wb_setup)(struct dispc_device *dispc,
> -		const struct omap_dss_writeback_info *wi,
> -		bool mem_to_mem, const struct videomode *vm,
> -		enum dss_writeback_channel channel_in);
> -	bool (*has_writeback)(struct dispc_device *dispc);
> -	bool (*wb_go_busy)(struct dispc_device *dispc);
> -	void (*wb_go)(struct dispc_device *dispc);
> -};
> -
>  struct dispc_device *dispc_get_dispc(struct dss_device *dss);
> -const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
>  
>  bool omapdss_stack_is_ready(void);
>  void omapdss_gather_components(struct device *dev);
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 5ab557c477ef..0bf5cef579b5 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -103,7 +103,7 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc)
>  static void omap_crtc_dss_start_update(struct omap_drm_private *priv,
>  				       enum omap_channel channel)
>  {
> -	priv->dispc_ops->mgr_enable(priv->dispc, channel, true);
> +	dispc_mgr_enable(priv->dispc, channel, true);
>  }
>  
>  /* Called only from the encoder enable/disable and suspend/resume handlers. */
> @@ -128,7 +128,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
>  	}
>  
>  	if (omap_crtc->pipe->output->type == OMAP_DISPLAY_TYPE_HDMI) {
> -		priv->dispc_ops->mgr_enable(priv->dispc, channel, enable);
> +		dispc_mgr_enable(priv->dispc, channel, enable);
>  		omap_crtc->enabled = enable;
>  		return;
>  	}
> @@ -141,9 +141,9 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
>  		omap_crtc->ignore_digit_sync_lost = true;
>  	}
>  
> -	framedone_irq = priv->dispc_ops->mgr_get_framedone_irq(priv->dispc,
> +	framedone_irq = dispc_mgr_get_framedone_irq(priv->dispc,
>  							       channel);
> -	vsync_irq = priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel);
> +	vsync_irq = dispc_mgr_get_vsync_irq(priv->dispc, channel);
>  
>  	if (enable) {
>  		wait = omap_irq_wait_init(dev, vsync_irq, 1);
> @@ -163,7 +163,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
>  			wait = omap_irq_wait_init(dev, vsync_irq, 2);
>  	}
>  
> -	priv->dispc_ops->mgr_enable(priv->dispc, channel, enable);
> +	dispc_mgr_enable(priv->dispc, channel, enable);
>  	omap_crtc->enabled = enable;
>  
>  	ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100));
> @@ -186,7 +186,7 @@ static int omap_crtc_dss_enable(struct omap_drm_private *priv,
>  	struct drm_crtc *crtc = priv->channels[channel]->crtc;
>  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
>  
> -	priv->dispc_ops->mgr_set_timings(priv->dispc, omap_crtc->channel,
> +	dispc_mgr_set_timings(priv->dispc, omap_crtc->channel,
>  					 &omap_crtc->vm);
>  	omap_crtc_set_enabled(&omap_crtc->base, true);
>  
> @@ -221,7 +221,7 @@ static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
>  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
>  
>  	DBG("%s", omap_crtc->name);
> -	priv->dispc_ops->mgr_set_lcd_config(priv->dispc, omap_crtc->channel,
> +	dispc_mgr_set_lcd_config(priv->dispc, omap_crtc->channel,
>  					    config);
>  }
>  
> @@ -300,7 +300,7 @@ void omap_crtc_vblank_irq(struct drm_crtc *crtc)
>  	 * If the dispc is busy we're racing the flush operation. Try again on
>  	 * the next vblank interrupt.
>  	 */
> -	if (priv->dispc_ops->mgr_go_busy(priv->dispc, omap_crtc->channel)) {
> +	if (dispc_mgr_go_busy(priv->dispc, omap_crtc->channel)) {
>  		spin_unlock(&crtc->dev->event_lock);
>  		return;
>  	}
> @@ -391,7 +391,7 @@ static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc)
>  	info.partial_alpha_enabled = false;
>  	info.cpr_enable = false;
>  
> -	priv->dispc_ops->mgr_setup(priv->dispc, omap_crtc->channel, &info);
> +	dispc_mgr_setup(priv->dispc, omap_crtc->channel, &info);
>  }
>  
>  /* -----------------------------------------------------------------------------
> @@ -432,7 +432,7 @@ static void omap_crtc_atomic_enable(struct drm_crtc *crtc,
>  
>  	DBG("%s", omap_crtc->name);
>  
> -	priv->dispc_ops->runtime_get(priv->dispc);
> +	dispc_runtime_get(priv->dispc);
>  
>  	/* manual updated display will not trigger vsync irq */
>  	if (omap_state->manually_updated)
> @@ -471,7 +471,7 @@ static void omap_crtc_atomic_disable(struct drm_crtc *crtc,
>  
>  	drm_crtc_vblank_off(crtc);
>  
> -	priv->dispc_ops->runtime_put(priv->dispc);
> +	dispc_runtime_put(priv->dispc);
>  }
>  
>  static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
> @@ -490,7 +490,7 @@ static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
>  	 * proper DISPC mode later.
>  	 */
>  	if (omap_crtc->pipe->output->type != OMAP_DISPLAY_TYPE_DSI) {
> -		r = priv->dispc_ops->mgr_check_timings(priv->dispc,
> +		r = dispc_mgr_check_timings(priv->dispc,
>  						       omap_crtc->channel,
>  						       &vm);
>  		if (r)
> @@ -605,7 +605,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
>  			length = crtc->state->gamma_lut->length /
>  				sizeof(*lut);
>  		}
> -		priv->dispc_ops->mgr_set_gamma(priv->dispc, omap_crtc->channel,
> +		dispc_mgr_set_gamma(priv->dispc, omap_crtc->channel,
>  					       lut, length);
>  	}
>  
> @@ -630,7 +630,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
>  	WARN_ON(ret != 0);
>  
>  	spin_lock_irq(&crtc->dev->event_lock);
> -	priv->dispc_ops->mgr_go(priv->dispc, omap_crtc->channel);
> +	dispc_mgr_go(priv->dispc, omap_crtc->channel);
>  	omap_crtc_arm_event(crtc);
>  	spin_unlock_irq(&crtc->dev->event_lock);
>  }
> @@ -821,7 +821,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
>  	 * extracted with dispc_mgr_gamma_size(). If it returns 0
>  	 * gamma table is not supported.
>  	 */
> -	if (priv->dispc_ops->mgr_gamma_size(priv->dispc, channel)) {
> +	if (dispc_mgr_gamma_size(priv->dispc, channel)) {
>  		unsigned int gamma_lut_size = 256;
>  
>  		drm_crtc_enable_color_mgmt(crtc, 0, false, gamma_lut_size);
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 9d5f53e774ef..eb419387ed05 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -69,7 +69,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)
>  	struct drm_device *dev = old_state->dev;
>  	struct omap_drm_private *priv = dev->dev_private;
>  
> -	priv->dispc_ops->runtime_get(priv->dispc);
> +	dispc_runtime_get(priv->dispc);
>  
>  	/* Apply the atomic update. */
>  	drm_atomic_helper_commit_modeset_disables(dev, old_state);
> @@ -113,7 +113,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)
>  
>  	drm_atomic_helper_cleanup_planes(dev, old_state);
>  
> -	priv->dispc_ops->runtime_put(priv->dispc);
> +	dispc_runtime_put(priv->dispc);
>  }
>  
>  static const struct drm_mode_config_helper_funcs omap_mode_config_helper_funcs = {
> @@ -192,7 +192,7 @@ static int omap_compare_pipelines(const void *a, const void *b)
>  static int omap_modeset_init_properties(struct drm_device *dev)
>  {
>  	struct omap_drm_private *priv = dev->dev_private;
> -	unsigned int num_planes = priv->dispc_ops->get_num_ovls(priv->dispc);
> +	unsigned int num_planes = dispc_get_num_ovls(priv->dispc);
>  
>  	priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0,
>  						      num_planes - 1);
> @@ -221,8 +221,8 @@ static int omap_display_id(struct omap_dss_device *output)
>  static int omap_modeset_init(struct drm_device *dev)
>  {
>  	struct omap_drm_private *priv = dev->dev_private;
> -	int num_ovls = priv->dispc_ops->get_num_ovls(priv->dispc);
> -	int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc);
> +	int num_ovls = dispc_get_num_ovls(priv->dispc);
> +	int num_mgrs = dispc_get_num_mgrs(priv->dispc);
>  	unsigned int i;
>  	int ret;
>  	u32 plane_crtc_mask;
> @@ -580,7 +580,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  	priv->dev = dev;
>  	priv->dss = pdata->dss;
>  	priv->dispc = dispc_get_dispc(priv->dss);
> -	priv->dispc_ops = dispc_get_ops(priv->dss);
>  
>  	omap_crtc_pre_init(priv);
>  
> @@ -592,9 +591,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  	INIT_LIST_HEAD(&priv->obj_list);
>  
>  	/* Get memory bandwidth limits */
> -	if (priv->dispc_ops->get_memory_bandwidth_limit)
> -		priv->max_bandwidth =
> -			priv->dispc_ops->get_memory_bandwidth_limit(priv->dispc);
> +	priv->max_bandwidth = dispc_get_memory_bandwidth_limit(priv->dispc);
>  
>  	omap_gem_init(ddev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
> index 93d171ffd26d..6e69358f624c 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.h
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.h
> @@ -12,6 +12,7 @@
>  #include <linux/workqueue.h>
>  
>  #include "dss/omapdss.h"
> +#include "dss/dss.h"
>  
>  #include <drm/drm_gem.h>
>  #include <drm/omap_drm.h>
> @@ -46,7 +47,6 @@ struct omap_drm_private {
>  
>  	struct dss_device *dss;
>  	struct dispc_device *dispc;
> -	const struct dispc_ops *dispc_ops;
>  
>  	unsigned int num_pipes;
>  	struct omap_drm_pipeline pipes[8];
> diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c
> index 382bcdc72ac0..981387220765 100644
> --- a/drivers/gpu/drm/omapdrm/omap_irq.c
> +++ b/drivers/gpu/drm/omapdrm/omap_irq.c
> @@ -29,7 +29,7 @@ static void omap_irq_update(struct drm_device *dev)
>  
>  	DBG("irqmask=%08x", irqmask);
>  
> -	priv->dispc_ops->write_irqenable(priv->dispc, irqmask);
> +	dispc_write_irqenable(priv->dispc, irqmask);
>  }
>  
>  static void omap_irq_wait_handler(struct omap_irq_wait *wait)
> @@ -83,7 +83,7 @@ int omap_irq_enable_framedone(struct drm_crtc *crtc, bool enable)
>  	unsigned long flags;
>  	enum omap_channel channel = omap_crtc_channel(crtc);
>  	int framedone_irq =
> -		priv->dispc_ops->mgr_get_framedone_irq(priv->dispc, channel);
> +		dispc_mgr_get_framedone_irq(priv->dispc, channel);
>  
>  	DBG("dev=%p, crtc=%u, enable=%d", dev, channel, enable);
>  
> @@ -121,7 +121,7 @@ int omap_irq_enable_vblank(struct drm_crtc *crtc)
>  	DBG("dev=%p, crtc=%u", dev, channel);
>  
>  	spin_lock_irqsave(&priv->wait_lock, flags);
> -	priv->irq_mask |= priv->dispc_ops->mgr_get_vsync_irq(priv->dispc,
> +	priv->irq_mask |= dispc_mgr_get_vsync_irq(priv->dispc,
>  							     channel);
>  	omap_irq_update(dev);
>  	spin_unlock_irqrestore(&priv->wait_lock, flags);
> @@ -148,7 +148,7 @@ void omap_irq_disable_vblank(struct drm_crtc *crtc)
>  	DBG("dev=%p, crtc=%u", dev, channel);
>  
>  	spin_lock_irqsave(&priv->wait_lock, flags);
> -	priv->irq_mask &= ~priv->dispc_ops->mgr_get_vsync_irq(priv->dispc,
> +	priv->irq_mask &= ~dispc_mgr_get_vsync_irq(priv->dispc,
>  							      channel);
>  	omap_irq_update(dev);
>  	spin_unlock_irqrestore(&priv->wait_lock, flags);
> @@ -213,9 +213,9 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
>  	unsigned int id;
>  	u32 irqstatus;
>  
> -	irqstatus = priv->dispc_ops->read_irqstatus(priv->dispc);
> -	priv->dispc_ops->clear_irqstatus(priv->dispc, irqstatus);
> -	priv->dispc_ops->read_irqstatus(priv->dispc);	/* flush posted write */
> +	irqstatus = dispc_read_irqstatus(priv->dispc);
> +	dispc_clear_irqstatus(priv->dispc, irqstatus);
> +	dispc_read_irqstatus(priv->dispc);	/* flush posted write */
>  
>  	VERB("irqs: %08x", irqstatus);
>  
> @@ -223,15 +223,15 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
>  		struct drm_crtc *crtc = priv->pipes[id].crtc;
>  		enum omap_channel channel = omap_crtc_channel(crtc);
>  
> -		if (irqstatus & priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel)) {
> +		if (irqstatus & dispc_mgr_get_vsync_irq(priv->dispc, channel)) {
>  			drm_handle_vblank(dev, id);
>  			omap_crtc_vblank_irq(crtc);
>  		}
>  
> -		if (irqstatus & priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, channel))
> +		if (irqstatus & dispc_mgr_get_sync_lost_irq(priv->dispc, channel))
>  			omap_crtc_error_irq(crtc, irqstatus);
>  
> -		if (irqstatus & priv->dispc_ops->mgr_get_framedone_irq(priv->dispc, channel))
> +		if (irqstatus & dispc_mgr_get_framedone_irq(priv->dispc, channel))
>  			omap_crtc_framedone_irq(crtc, irqstatus);
>  	}
>  
> @@ -265,7 +265,7 @@ static const u32 omap_underflow_irqs[] = {
>  int omap_drm_irq_install(struct drm_device *dev)
>  {
>  	struct omap_drm_private *priv = dev->dev_private;
> -	unsigned int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc);
> +	unsigned int num_mgrs = dispc_get_num_mgrs(priv->dispc);
>  	unsigned int max_planes;
>  	unsigned int i;
>  	int ret;
> @@ -283,13 +283,13 @@ int omap_drm_irq_install(struct drm_device *dev)
>  	}
>  
>  	for (i = 0; i < num_mgrs; ++i)
> -		priv->irq_mask |= priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, i);
> +		priv->irq_mask |= dispc_mgr_get_sync_lost_irq(priv->dispc, i);
>  
> -	priv->dispc_ops->runtime_get(priv->dispc);
> -	priv->dispc_ops->clear_irqstatus(priv->dispc, 0xffffffff);
> -	priv->dispc_ops->runtime_put(priv->dispc);
> +	dispc_runtime_get(priv->dispc);
> +	dispc_clear_irqstatus(priv->dispc, 0xffffffff);
> +	dispc_runtime_put(priv->dispc);
>  
> -	ret = priv->dispc_ops->request_irq(priv->dispc, omap_irq_handler, dev);
> +	ret = dispc_request_irq(priv->dispc, omap_irq_handler, dev);
>  	if (ret < 0)
>  		return ret;
>  
> @@ -307,5 +307,5 @@ void omap_drm_irq_uninstall(struct drm_device *dev)
>  
>  	dev->irq_enabled = false;
>  
> -	priv->dispc_ops->free_irq(priv->dispc, dev);
> +	dispc_free_irq(priv->dispc, dev);
>  }
> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
> index 73ec99819a3d..88d2a986d880 100644
> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
> @@ -70,17 +70,17 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
>  			&info.paddr, &info.p_uv_addr);
>  
>  	/* and finally, update omapdss: */
> -	ret = priv->dispc_ops->ovl_setup(priv->dispc, omap_plane->id, &info,
> +	ret = dispc_ovl_setup(priv->dispc, omap_plane->id, &info,
>  			      omap_crtc_timings(state->crtc), false,
>  			      omap_crtc_channel(state->crtc));
>  	if (ret) {
>  		dev_err(plane->dev->dev, "Failed to setup plane %s\n",
>  			omap_plane->name);
> -		priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, false);
> +		dispc_ovl_enable(priv->dispc, omap_plane->id, false);
>  		return;
>  	}
>  
> -	priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, true);
> +	dispc_ovl_enable(priv->dispc, omap_plane->id, true);
>  }
>  
>  static void omap_plane_atomic_disable(struct drm_plane *plane,
> @@ -93,7 +93,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
>  	plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY
>  			   ? 0 : omap_plane->id;
>  
> -	priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, false);
> +	dispc_ovl_enable(priv->dispc, omap_plane->id, false);
>  }
>  
>  static int omap_plane_atomic_check(struct drm_plane *plane,
> @@ -252,7 +252,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
>  		u32 possible_crtcs)
>  {
>  	struct omap_drm_private *priv = dev->dev_private;
> -	unsigned int num_planes = priv->dispc_ops->get_num_ovls(priv->dispc);
> +	unsigned int num_planes = dispc_get_num_ovls(priv->dispc);
>  	struct drm_plane *plane;
>  	struct omap_plane *omap_plane;
>  	enum omap_plane_id id;
> @@ -271,7 +271,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
>  	if (!omap_plane)
>  		return ERR_PTR(-ENOMEM);
>  
> -	formats = priv->dispc_ops->ovl_get_color_modes(priv->dispc, id);
> +	formats = dispc_ovl_get_color_modes(priv->dispc, id);
>  	for (nformats = 0; formats[nformats]; ++nformats)
>  		;
>  	omap_plane->id = id;

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 56/56] drm/omap: remove dss_mgr_ops
  2020-11-05 12:03   ` Tomi Valkeinen
@ 2020-11-09 11:18     ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:18 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:33PM +0200, Tomi Valkeinen wrote:
> dss_mgr_ops was needed with the multi-module architecture, but is no
> longer needed. We can thus remove it and use direct calls.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dss.h     |  1 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 42 +++++++++++----------------
>  drivers/gpu/drm/omapdrm/dss/output.c  | 33 +++++----------------
>  drivers/gpu/drm/omapdrm/omap_crtc.c   | 38 +++++-------------------
>  drivers/gpu/drm/omapdrm/omap_crtc.h   |  2 --
>  drivers/gpu/drm/omapdrm/omap_drv.c    |  4 +--
>  6 files changed, 33 insertions(+), 87 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
> index 96f702314c8c..a547527bb2f3 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -257,7 +257,6 @@ struct dss_device {
>  	struct dss_pll	*video2_pll;
>  
>  	struct dispc_device *dispc;
> -	const struct dss_mgr_ops *mgr_ops;
>  	struct omap_drm_private *mgr_ops_priv;
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index fba5f05e5e48..9df322ca467d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -338,31 +338,23 @@ enum dss_writeback_channel {
>  	DSS_WB_LCD3_MGR =	7,
>  };
>  
> -struct dss_mgr_ops {
> -	void (*start_update)(struct omap_drm_private *priv,
> -			     enum omap_channel channel);
> -	int (*enable)(struct omap_drm_private *priv,
> -		      enum omap_channel channel);
> -	void (*disable)(struct omap_drm_private *priv,
> -			enum omap_channel channel);
> -	void (*set_timings)(struct omap_drm_private *priv,
> -			    enum omap_channel channel,
> -			    const struct videomode *vm);
> -	void (*set_lcd_config)(struct omap_drm_private *priv,
> -			       enum omap_channel channel,
> -			       const struct dss_lcd_mgr_config *config);
> -	int (*register_framedone_handler)(struct omap_drm_private *priv,
> -			enum omap_channel channel,
> -			void (*handler)(void *), void *data);
> -	void (*unregister_framedone_handler)(struct omap_drm_private *priv,
> -			enum omap_channel channel,
> -			void (*handler)(void *), void *data);
> -};
> -
> -int dss_install_mgr_ops(struct dss_device *dss,
> -			const struct dss_mgr_ops *mgr_ops,
> -			struct omap_drm_private *priv);
> -void dss_uninstall_mgr_ops(struct dss_device *dss);
> +void omap_crtc_dss_start_update(struct omap_drm_private *priv,
> +				       enum omap_channel channel);
> +void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable);
> +int omap_crtc_dss_enable(struct omap_drm_private *priv, enum omap_channel channel);
> +void omap_crtc_dss_disable(struct omap_drm_private *priv, enum omap_channel channel);
> +void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
> +		enum omap_channel channel,
> +		const struct videomode *vm);
> +void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
> +		enum omap_channel channel,
> +		const struct dss_lcd_mgr_config *config);
> +int omap_crtc_dss_register_framedone(
> +		struct omap_drm_private *priv, enum omap_channel channel,
> +		void (*handler)(void *), void *data);
> +void omap_crtc_dss_unregister_framedone(
> +		struct omap_drm_private *priv, enum omap_channel channel,
> +		void (*handler)(void *), void *data);
>  
>  void dss_mgr_set_timings(struct omap_dss_device *dssdev,
>  		const struct videomode *vm);
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
> index 7a14d2b5b2f7..2121c947947b 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -81,54 +81,35 @@ void omapdss_device_cleanup_output(struct omap_dss_device *out)
>  					out->next_bridge : out->bridge);
>  }
>  
> -int dss_install_mgr_ops(struct dss_device *dss,
> -			const struct dss_mgr_ops *mgr_ops,
> -			struct omap_drm_private *priv)
> -{
> -	if (dss->mgr_ops)
> -		return -EBUSY;
> -
> -	dss->mgr_ops = mgr_ops;
> -	dss->mgr_ops_priv = priv;
> -
> -	return 0;
> -}
> -
> -void dss_uninstall_mgr_ops(struct dss_device *dss)
> -{
> -	dss->mgr_ops = NULL;
> -	dss->mgr_ops_priv = NULL;
> -}
> -
>  void dss_mgr_set_timings(struct omap_dss_device *dssdev,
>  			 const struct videomode *vm)
>  {
> -	dssdev->dss->mgr_ops->set_timings(dssdev->dss->mgr_ops_priv,
> +	omap_crtc_dss_set_timings(dssdev->dss->mgr_ops_priv,
>  					  dssdev->dispc_channel, vm);
>  }
>  
>  void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
>  		const struct dss_lcd_mgr_config *config)
>  {
> -	dssdev->dss->mgr_ops->set_lcd_config(dssdev->dss->mgr_ops_priv,
> +	omap_crtc_dss_set_lcd_config(dssdev->dss->mgr_ops_priv,
>  					     dssdev->dispc_channel, config);
>  }
>  
>  int dss_mgr_enable(struct omap_dss_device *dssdev)
>  {
> -	return dssdev->dss->mgr_ops->enable(dssdev->dss->mgr_ops_priv,
> +	return omap_crtc_dss_enable(dssdev->dss->mgr_ops_priv,
>  					    dssdev->dispc_channel);
>  }
>  
>  void dss_mgr_disable(struct omap_dss_device *dssdev)
>  {
> -	dssdev->dss->mgr_ops->disable(dssdev->dss->mgr_ops_priv,
> +	omap_crtc_dss_disable(dssdev->dss->mgr_ops_priv,
>  				      dssdev->dispc_channel);
>  }
>  
>  void dss_mgr_start_update(struct omap_dss_device *dssdev)
>  {
> -	dssdev->dss->mgr_ops->start_update(dssdev->dss->mgr_ops_priv,
> +	omap_crtc_dss_start_update(dssdev->dss->mgr_ops_priv,
>  					   dssdev->dispc_channel);
>  }
>  
> @@ -137,7 +118,7 @@ int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
>  {
>  	struct dss_device *dss = dssdev->dss;
>  
> -	return dss->mgr_ops->register_framedone_handler(dss->mgr_ops_priv,
> +	return omap_crtc_dss_register_framedone(dss->mgr_ops_priv,
>  							dssdev->dispc_channel,
>  							handler, data);
>  }
> @@ -147,7 +128,7 @@ void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
>  {
>  	struct dss_device *dss = dssdev->dss;
>  
> -	dss->mgr_ops->unregister_framedone_handler(dss->mgr_ops_priv,
> +	omap_crtc_dss_unregister_framedone(dss->mgr_ops_priv,
>  						   dssdev->dispc_channel,
>  						   handler, data);
>  }
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 0bf5cef579b5..e3259338afb9 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -100,14 +100,14 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc)
>   * the upstream part of the video pipe.
>   */
>  
> -static void omap_crtc_dss_start_update(struct omap_drm_private *priv,
> +void omap_crtc_dss_start_update(struct omap_drm_private *priv,
>  				       enum omap_channel channel)
>  {
>  	dispc_mgr_enable(priv->dispc, channel, true);
>  }
>  
>  /* Called only from the encoder enable/disable and suspend/resume handlers. */
> -static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
> +void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
>  {
>  	struct omap_crtc_state *omap_state = to_omap_crtc_state(crtc->state);
>  	struct drm_device *dev = crtc->dev;
> @@ -180,8 +180,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
>  }
>  
>  
> -static int omap_crtc_dss_enable(struct omap_drm_private *priv,
> -				enum omap_channel channel)
> +int omap_crtc_dss_enable(struct omap_drm_private *priv, enum omap_channel channel)
>  {
>  	struct drm_crtc *crtc = priv->channels[channel]->crtc;
>  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> @@ -193,8 +192,7 @@ static int omap_crtc_dss_enable(struct omap_drm_private *priv,
>  	return 0;
>  }
>  
> -static void omap_crtc_dss_disable(struct omap_drm_private *priv,
> -				  enum omap_channel channel)
> +void omap_crtc_dss_disable(struct omap_drm_private *priv, enum omap_channel channel)
>  {
>  	struct drm_crtc *crtc = priv->channels[channel]->crtc;
>  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> @@ -202,7 +200,7 @@ static void omap_crtc_dss_disable(struct omap_drm_private *priv,
>  	omap_crtc_set_enabled(&omap_crtc->base, false);
>  }
>  
> -static void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
> +void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
>  		enum omap_channel channel,
>  		const struct videomode *vm)
>  {
> @@ -213,7 +211,7 @@ static void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
>  	omap_crtc->vm = *vm;
>  }
>  
> -static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
> +void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
>  		enum omap_channel channel,
>  		const struct dss_lcd_mgr_config *config)
>  {
> @@ -225,7 +223,7 @@ static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
>  					    config);
>  }
>  
> -static int omap_crtc_dss_register_framedone(
> +int omap_crtc_dss_register_framedone(
>  		struct omap_drm_private *priv, enum omap_channel channel,
>  		void (*handler)(void *), void *data)
>  {
> @@ -244,7 +242,7 @@ static int omap_crtc_dss_register_framedone(
>  	return 0;
>  }
>  
> -static void omap_crtc_dss_unregister_framedone(
> +void omap_crtc_dss_unregister_framedone(
>  		struct omap_drm_private *priv, enum omap_channel channel,
>  		void (*handler)(void *), void *data)
>  {
> @@ -261,16 +259,6 @@ static void omap_crtc_dss_unregister_framedone(
>  	omap_crtc->framedone_handler_data = NULL;
>  }
>  
> -static const struct dss_mgr_ops mgr_ops = {
> -	.start_update = omap_crtc_dss_start_update,
> -	.enable = omap_crtc_dss_enable,
> -	.disable = omap_crtc_dss_disable,
> -	.set_timings = omap_crtc_dss_set_timings,
> -	.set_lcd_config = omap_crtc_dss_set_lcd_config,
> -	.register_framedone_handler = omap_crtc_dss_register_framedone,
> -	.unregister_framedone_handler = omap_crtc_dss_unregister_framedone,
> -};
> -
>  /* -----------------------------------------------------------------------------
>   * Setup, Flush and Page Flip
>   */
> @@ -753,16 +741,6 @@ static const char *channel_names[] = {
>  	[OMAP_DSS_CHANNEL_LCD3] = "lcd3",
>  };
>  
> -void omap_crtc_pre_init(struct omap_drm_private *priv)
> -{
> -	dss_install_mgr_ops(priv->dss, &mgr_ops, priv);
> -}
> -
> -void omap_crtc_pre_uninit(struct omap_drm_private *priv)
> -{
> -	dss_uninstall_mgr_ops(priv->dss);
> -}
> -
>  /* initialize crtc */
>  struct drm_crtc *omap_crtc_init(struct drm_device *dev,
>  				struct omap_drm_pipeline *pipe,
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.h b/drivers/gpu/drm/omapdrm/omap_crtc.h
> index 2fd57751ae2b..a8b9cbee86e0 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.h
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.h
> @@ -22,8 +22,6 @@ struct videomode;
>  
>  struct videomode *omap_crtc_timings(struct drm_crtc *crtc);
>  enum omap_channel omap_crtc_channel(struct drm_crtc *crtc);
> -void omap_crtc_pre_init(struct omap_drm_private *priv);
> -void omap_crtc_pre_uninit(struct omap_drm_private *priv);
>  struct drm_crtc *omap_crtc_init(struct drm_device *dev,
>  				struct omap_drm_pipeline *pipe,
>  				struct drm_plane *plane);
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index eb419387ed05..c5b2f50439d6 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -581,7 +581,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  	priv->dss = pdata->dss;
>  	priv->dispc = dispc_get_dispc(priv->dss);
>  
> -	omap_crtc_pre_init(priv);
> +	priv->dss->mgr_ops_priv = priv;
>  
>  	soc = soc_device_match(omapdrm_soc_devices);
>  	priv->omaprev = soc ? (unsigned int)soc->data : 0;
> @@ -634,7 +634,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  	omap_gem_deinit(ddev);
>  	destroy_workqueue(priv->wq);
>  	omap_disconnect_pipelines(ddev);
> -	omap_crtc_pre_uninit(priv);
>  	drm_dev_put(ddev);
>  	return ret;
>  }
> @@ -660,7 +659,6 @@ static void omapdrm_cleanup(struct omap_drm_private *priv)
>  	destroy_workqueue(priv->wq);
>  
>  	omap_disconnect_pipelines(ddev);
> -	omap_crtc_pre_uninit(priv);
>  
>  	drm_dev_put(ddev);
>  }

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 56/56] drm/omap: remove dss_mgr_ops
@ 2020-11-09 11:18     ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-09 11:18 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, linux-omap, Nikhil Devshatwar

Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:33PM +0200, Tomi Valkeinen wrote:
> dss_mgr_ops was needed with the multi-module architecture, but is no
> longer needed. We can thus remove it and use direct calls.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

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

> ---
>  drivers/gpu/drm/omapdrm/dss/dss.h     |  1 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 42 +++++++++++----------------
>  drivers/gpu/drm/omapdrm/dss/output.c  | 33 +++++----------------
>  drivers/gpu/drm/omapdrm/omap_crtc.c   | 38 +++++-------------------
>  drivers/gpu/drm/omapdrm/omap_crtc.h   |  2 --
>  drivers/gpu/drm/omapdrm/omap_drv.c    |  4 +--
>  6 files changed, 33 insertions(+), 87 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
> index 96f702314c8c..a547527bb2f3 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -257,7 +257,6 @@ struct dss_device {
>  	struct dss_pll	*video2_pll;
>  
>  	struct dispc_device *dispc;
> -	const struct dss_mgr_ops *mgr_ops;
>  	struct omap_drm_private *mgr_ops_priv;
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index fba5f05e5e48..9df322ca467d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -338,31 +338,23 @@ enum dss_writeback_channel {
>  	DSS_WB_LCD3_MGR =	7,
>  };
>  
> -struct dss_mgr_ops {
> -	void (*start_update)(struct omap_drm_private *priv,
> -			     enum omap_channel channel);
> -	int (*enable)(struct omap_drm_private *priv,
> -		      enum omap_channel channel);
> -	void (*disable)(struct omap_drm_private *priv,
> -			enum omap_channel channel);
> -	void (*set_timings)(struct omap_drm_private *priv,
> -			    enum omap_channel channel,
> -			    const struct videomode *vm);
> -	void (*set_lcd_config)(struct omap_drm_private *priv,
> -			       enum omap_channel channel,
> -			       const struct dss_lcd_mgr_config *config);
> -	int (*register_framedone_handler)(struct omap_drm_private *priv,
> -			enum omap_channel channel,
> -			void (*handler)(void *), void *data);
> -	void (*unregister_framedone_handler)(struct omap_drm_private *priv,
> -			enum omap_channel channel,
> -			void (*handler)(void *), void *data);
> -};
> -
> -int dss_install_mgr_ops(struct dss_device *dss,
> -			const struct dss_mgr_ops *mgr_ops,
> -			struct omap_drm_private *priv);
> -void dss_uninstall_mgr_ops(struct dss_device *dss);
> +void omap_crtc_dss_start_update(struct omap_drm_private *priv,
> +				       enum omap_channel channel);
> +void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable);
> +int omap_crtc_dss_enable(struct omap_drm_private *priv, enum omap_channel channel);
> +void omap_crtc_dss_disable(struct omap_drm_private *priv, enum omap_channel channel);
> +void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
> +		enum omap_channel channel,
> +		const struct videomode *vm);
> +void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
> +		enum omap_channel channel,
> +		const struct dss_lcd_mgr_config *config);
> +int omap_crtc_dss_register_framedone(
> +		struct omap_drm_private *priv, enum omap_channel channel,
> +		void (*handler)(void *), void *data);
> +void omap_crtc_dss_unregister_framedone(
> +		struct omap_drm_private *priv, enum omap_channel channel,
> +		void (*handler)(void *), void *data);
>  
>  void dss_mgr_set_timings(struct omap_dss_device *dssdev,
>  		const struct videomode *vm);
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
> index 7a14d2b5b2f7..2121c947947b 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -81,54 +81,35 @@ void omapdss_device_cleanup_output(struct omap_dss_device *out)
>  					out->next_bridge : out->bridge);
>  }
>  
> -int dss_install_mgr_ops(struct dss_device *dss,
> -			const struct dss_mgr_ops *mgr_ops,
> -			struct omap_drm_private *priv)
> -{
> -	if (dss->mgr_ops)
> -		return -EBUSY;
> -
> -	dss->mgr_ops = mgr_ops;
> -	dss->mgr_ops_priv = priv;
> -
> -	return 0;
> -}
> -
> -void dss_uninstall_mgr_ops(struct dss_device *dss)
> -{
> -	dss->mgr_ops = NULL;
> -	dss->mgr_ops_priv = NULL;
> -}
> -
>  void dss_mgr_set_timings(struct omap_dss_device *dssdev,
>  			 const struct videomode *vm)
>  {
> -	dssdev->dss->mgr_ops->set_timings(dssdev->dss->mgr_ops_priv,
> +	omap_crtc_dss_set_timings(dssdev->dss->mgr_ops_priv,
>  					  dssdev->dispc_channel, vm);
>  }
>  
>  void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
>  		const struct dss_lcd_mgr_config *config)
>  {
> -	dssdev->dss->mgr_ops->set_lcd_config(dssdev->dss->mgr_ops_priv,
> +	omap_crtc_dss_set_lcd_config(dssdev->dss->mgr_ops_priv,
>  					     dssdev->dispc_channel, config);
>  }
>  
>  int dss_mgr_enable(struct omap_dss_device *dssdev)
>  {
> -	return dssdev->dss->mgr_ops->enable(dssdev->dss->mgr_ops_priv,
> +	return omap_crtc_dss_enable(dssdev->dss->mgr_ops_priv,
>  					    dssdev->dispc_channel);
>  }
>  
>  void dss_mgr_disable(struct omap_dss_device *dssdev)
>  {
> -	dssdev->dss->mgr_ops->disable(dssdev->dss->mgr_ops_priv,
> +	omap_crtc_dss_disable(dssdev->dss->mgr_ops_priv,
>  				      dssdev->dispc_channel);
>  }
>  
>  void dss_mgr_start_update(struct omap_dss_device *dssdev)
>  {
> -	dssdev->dss->mgr_ops->start_update(dssdev->dss->mgr_ops_priv,
> +	omap_crtc_dss_start_update(dssdev->dss->mgr_ops_priv,
>  					   dssdev->dispc_channel);
>  }
>  
> @@ -137,7 +118,7 @@ int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
>  {
>  	struct dss_device *dss = dssdev->dss;
>  
> -	return dss->mgr_ops->register_framedone_handler(dss->mgr_ops_priv,
> +	return omap_crtc_dss_register_framedone(dss->mgr_ops_priv,
>  							dssdev->dispc_channel,
>  							handler, data);
>  }
> @@ -147,7 +128,7 @@ void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
>  {
>  	struct dss_device *dss = dssdev->dss;
>  
> -	dss->mgr_ops->unregister_framedone_handler(dss->mgr_ops_priv,
> +	omap_crtc_dss_unregister_framedone(dss->mgr_ops_priv,
>  						   dssdev->dispc_channel,
>  						   handler, data);
>  }
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 0bf5cef579b5..e3259338afb9 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -100,14 +100,14 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc)
>   * the upstream part of the video pipe.
>   */
>  
> -static void omap_crtc_dss_start_update(struct omap_drm_private *priv,
> +void omap_crtc_dss_start_update(struct omap_drm_private *priv,
>  				       enum omap_channel channel)
>  {
>  	dispc_mgr_enable(priv->dispc, channel, true);
>  }
>  
>  /* Called only from the encoder enable/disable and suspend/resume handlers. */
> -static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
> +void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
>  {
>  	struct omap_crtc_state *omap_state = to_omap_crtc_state(crtc->state);
>  	struct drm_device *dev = crtc->dev;
> @@ -180,8 +180,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
>  }
>  
>  
> -static int omap_crtc_dss_enable(struct omap_drm_private *priv,
> -				enum omap_channel channel)
> +int omap_crtc_dss_enable(struct omap_drm_private *priv, enum omap_channel channel)
>  {
>  	struct drm_crtc *crtc = priv->channels[channel]->crtc;
>  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> @@ -193,8 +192,7 @@ static int omap_crtc_dss_enable(struct omap_drm_private *priv,
>  	return 0;
>  }
>  
> -static void omap_crtc_dss_disable(struct omap_drm_private *priv,
> -				  enum omap_channel channel)
> +void omap_crtc_dss_disable(struct omap_drm_private *priv, enum omap_channel channel)
>  {
>  	struct drm_crtc *crtc = priv->channels[channel]->crtc;
>  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> @@ -202,7 +200,7 @@ static void omap_crtc_dss_disable(struct omap_drm_private *priv,
>  	omap_crtc_set_enabled(&omap_crtc->base, false);
>  }
>  
> -static void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
> +void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
>  		enum omap_channel channel,
>  		const struct videomode *vm)
>  {
> @@ -213,7 +211,7 @@ static void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
>  	omap_crtc->vm = *vm;
>  }
>  
> -static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
> +void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
>  		enum omap_channel channel,
>  		const struct dss_lcd_mgr_config *config)
>  {
> @@ -225,7 +223,7 @@ static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
>  					    config);
>  }
>  
> -static int omap_crtc_dss_register_framedone(
> +int omap_crtc_dss_register_framedone(
>  		struct omap_drm_private *priv, enum omap_channel channel,
>  		void (*handler)(void *), void *data)
>  {
> @@ -244,7 +242,7 @@ static int omap_crtc_dss_register_framedone(
>  	return 0;
>  }
>  
> -static void omap_crtc_dss_unregister_framedone(
> +void omap_crtc_dss_unregister_framedone(
>  		struct omap_drm_private *priv, enum omap_channel channel,
>  		void (*handler)(void *), void *data)
>  {
> @@ -261,16 +259,6 @@ static void omap_crtc_dss_unregister_framedone(
>  	omap_crtc->framedone_handler_data = NULL;
>  }
>  
> -static const struct dss_mgr_ops mgr_ops = {
> -	.start_update = omap_crtc_dss_start_update,
> -	.enable = omap_crtc_dss_enable,
> -	.disable = omap_crtc_dss_disable,
> -	.set_timings = omap_crtc_dss_set_timings,
> -	.set_lcd_config = omap_crtc_dss_set_lcd_config,
> -	.register_framedone_handler = omap_crtc_dss_register_framedone,
> -	.unregister_framedone_handler = omap_crtc_dss_unregister_framedone,
> -};
> -
>  /* -----------------------------------------------------------------------------
>   * Setup, Flush and Page Flip
>   */
> @@ -753,16 +741,6 @@ static const char *channel_names[] = {
>  	[OMAP_DSS_CHANNEL_LCD3] = "lcd3",
>  };
>  
> -void omap_crtc_pre_init(struct omap_drm_private *priv)
> -{
> -	dss_install_mgr_ops(priv->dss, &mgr_ops, priv);
> -}
> -
> -void omap_crtc_pre_uninit(struct omap_drm_private *priv)
> -{
> -	dss_uninstall_mgr_ops(priv->dss);
> -}
> -
>  /* initialize crtc */
>  struct drm_crtc *omap_crtc_init(struct drm_device *dev,
>  				struct omap_drm_pipeline *pipe,
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.h b/drivers/gpu/drm/omapdrm/omap_crtc.h
> index 2fd57751ae2b..a8b9cbee86e0 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.h
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.h
> @@ -22,8 +22,6 @@ struct videomode;
>  
>  struct videomode *omap_crtc_timings(struct drm_crtc *crtc);
>  enum omap_channel omap_crtc_channel(struct drm_crtc *crtc);
> -void omap_crtc_pre_init(struct omap_drm_private *priv);
> -void omap_crtc_pre_uninit(struct omap_drm_private *priv);
>  struct drm_crtc *omap_crtc_init(struct drm_device *dev,
>  				struct omap_drm_pipeline *pipe,
>  				struct drm_plane *plane);
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index eb419387ed05..c5b2f50439d6 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -581,7 +581,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  	priv->dss = pdata->dss;
>  	priv->dispc = dispc_get_dispc(priv->dss);
>  
> -	omap_crtc_pre_init(priv);
> +	priv->dss->mgr_ops_priv = priv;
>  
>  	soc = soc_device_match(omapdrm_soc_devices);
>  	priv->omaprev = soc ? (unsigned int)soc->data : 0;
> @@ -634,7 +634,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  	omap_gem_deinit(ddev);
>  	destroy_workqueue(priv->wq);
>  	omap_disconnect_pipelines(ddev);
> -	omap_crtc_pre_uninit(priv);
>  	drm_dev_put(ddev);
>  	return ret;
>  }
> @@ -660,7 +659,6 @@ static void omapdrm_cleanup(struct omap_drm_private *priv)
>  	destroy_workqueue(priv->wq);
>  
>  	omap_disconnect_pipelines(ddev);
> -	omap_crtc_pre_uninit(priv);
>  
>  	drm_dev_put(ddev);
>  }

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-09 11:09                             ` H. Nikolaus Schaller
@ 2020-11-09 11:33                               ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09 11:33 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren

On 09/11/2020 13:09, H. Nikolaus Schaller wrote:

>>> I see.
>>> Anyways there is missing some simple thing which makes the driver not prepared/enabled.
>>> Or is this related to VC?
>>
>> No, that's not related to the VC.
> 
> Ok, then it is worth searching for that independently. Any idea/hint what could be missing?

Well, if I had to guess, I would go for either 1) some registration or such is missing from the
panel driver, or 2) some config value is invalid, which makes the DRM framework or the DSI driver
fail before calling prepare or enable.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-09 11:33                               ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09 11:33 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Tony Lindgren, Sekhar Nori, Sebastian Reichel, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

On 09/11/2020 13:09, H. Nikolaus Schaller wrote:

>>> I see.
>>> Anyways there is missing some simple thing which makes the driver not prepared/enabled.
>>> Or is this related to VC?
>>
>> No, that's not related to the VC.
> 
> Ok, then it is worth searching for that independently. Any idea/hint what could be missing?

Well, if I had to guess, I would go for either 1) some registration or such is missing from the
panel driver, or 2) some config value is invalid, which makes the DRM framework or the DSI driver
fail before calling prepare or enable.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver
  2020-11-09 10:08       ` Tomi Valkeinen
@ 2020-11-09 13:27         ` Sebastian Reichel
  -1 siblings, 0 replies; 328+ messages in thread
From: Sebastian Reichel @ 2020-11-09 13:27 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Laurent Pinchart, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller

[-- Attachment #1: Type: text/plain, Size: 4261 bytes --]

Hi,

On Mon, Nov 09, 2020 at 12:08:33PM +0200, Tomi Valkeinen wrote:
> On 09/11/2020 11:52, Laurent Pinchart wrote:
> > Hi Tomi,
> > 
> > Thank you for the patch.
> > 
> > On Thu, Nov 05, 2020 at 02:03:04PM +0200, Tomi Valkeinen wrote:
> >> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> >>
> >> This moves the bus locking into the host driver and unexports
> >> the custom API in preparation for drm_panel support.
> >>
> >> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> >> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> 
> <snip>
> 
> >>  static int dsicm_update(struct omap_dss_device *dssdev,
> >> @@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
> >>  	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
> >>  
> >>  	mutex_lock(&ddata->lock);
> >> -	src->ops->dsi.bus_lock(src);
> >>  
> >>  	r = dsicm_wake_up(ddata);
> >>  	if (r)
> >> @@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device *dssdev,
> >>  	if (r)
> >>  		goto err;
> >>  
> >> -	/* note: no bus_unlock here. unlock is src framedone_cb */
> >> -	mutex_unlock(&ddata->lock);
> >> +	/* note: no unlock here. unlock is src framedone_cb */
> > 
> > This change isn't described in the commit message. Could you explain why
> > it's needed ? Locking a mutex in a function and unlocking it elsewhere
> > always scares me.
> 
> Good catch. I don't know why it is needed. I don't think it is, as
> the dsi driver handles the bus lock.
> 
> Sebastian, what was the reason for this lock?
> 
> Note that this goes away in the series, and there's no such lock
> in the end.

It's not really a change. What this patch basically does is to fold
src->ops->dsi.bus_lock(src) into mutex_lock(&ddata->lock), so that
there is only a single locking mechanism. This function previously
had a matching pair of mutex_lock/unlock for ddata->lock, but the
bus was not locked paired. So after conversion the lock must not be
free'd here.

My understanding is, that this is because the bus must not be used
until the update has been done.

-- Sebastian

> >>  	return 0;
> >>  err:
> >> -	src->ops->dsi.bus_unlock(src);
> >>  	mutex_unlock(&ddata->lock);
> >>  	return r;
> >>  }
> >> @@ -791,7 +753,6 @@ static void dsicm_ulps_work(struct work_struct *work)
> >>  	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> >>  			ulps_work.work);
> >>  	struct omap_dss_device *dssdev = &ddata->dssdev;
> >> -	struct omap_dss_device *src = ddata->src;
> >>  
> >>  	mutex_lock(&ddata->lock);
> >>  
> >> @@ -800,11 +761,8 @@ static void dsicm_ulps_work(struct work_struct *work)
> >>  		return;
> >>  	}
> >>  
> >> -	src->ops->dsi.bus_lock(src);
> >> -
> >>  	dsicm_enter_ulps(ddata);
> >>  
> >> -	src->ops->dsi.bus_unlock(src);
> >>  	mutex_unlock(&ddata->lock);
> >>  }
> >>  
> >> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> index 41431ca34568..d54b743c2b48 100644
> >> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> @@ -476,17 +476,13 @@ static inline u32 dsi_read_reg(struct dsi_data *dsi, const struct dsi_reg idx)
> >>  	return __raw_readl(base + idx.idx);
> >>  }
> >>  
> >> -static void dsi_bus_lock(struct omap_dss_device *dssdev)
> >> +static void dsi_bus_lock(struct dsi_data *dsi)
> >>  {
> >> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> >> -
> >>  	down(&dsi->bus_lock);
> > 
> > Nothing to be addressed in this patch, but is there a reason to use a
> > semaphore instead of a mutex ?
> 
> It's been a long time, but I think the reason was that mutex gave a warning after being locked for a
> bit longer time, and semaphore didn't. The resource is reserved while a DSI transfer is active, so
> it could be almost 2 frames (wait for vsync and then transfer frame). Or reading the frame buffer
> back from the panel, which could take a long time (seconds).
> 
> There are better ways to implement it (after this series =).
> 
>  Tomi
> 
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

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

* Re: [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver
@ 2020-11-09 13:27         ` Sebastian Reichel
  0 siblings, 0 replies; 328+ messages in thread
From: Sebastian Reichel @ 2020-11-09 13:27 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar


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

Hi,

On Mon, Nov 09, 2020 at 12:08:33PM +0200, Tomi Valkeinen wrote:
> On 09/11/2020 11:52, Laurent Pinchart wrote:
> > Hi Tomi,
> > 
> > Thank you for the patch.
> > 
> > On Thu, Nov 05, 2020 at 02:03:04PM +0200, Tomi Valkeinen wrote:
> >> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> >>
> >> This moves the bus locking into the host driver and unexports
> >> the custom API in preparation for drm_panel support.
> >>
> >> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> >> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> 
> <snip>
> 
> >>  static int dsicm_update(struct omap_dss_device *dssdev,
> >> @@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
> >>  	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
> >>  
> >>  	mutex_lock(&ddata->lock);
> >> -	src->ops->dsi.bus_lock(src);
> >>  
> >>  	r = dsicm_wake_up(ddata);
> >>  	if (r)
> >> @@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device *dssdev,
> >>  	if (r)
> >>  		goto err;
> >>  
> >> -	/* note: no bus_unlock here. unlock is src framedone_cb */
> >> -	mutex_unlock(&ddata->lock);
> >> +	/* note: no unlock here. unlock is src framedone_cb */
> > 
> > This change isn't described in the commit message. Could you explain why
> > it's needed ? Locking a mutex in a function and unlocking it elsewhere
> > always scares me.
> 
> Good catch. I don't know why it is needed. I don't think it is, as
> the dsi driver handles the bus lock.
> 
> Sebastian, what was the reason for this lock?
> 
> Note that this goes away in the series, and there's no such lock
> in the end.

It's not really a change. What this patch basically does is to fold
src->ops->dsi.bus_lock(src) into mutex_lock(&ddata->lock), so that
there is only a single locking mechanism. This function previously
had a matching pair of mutex_lock/unlock for ddata->lock, but the
bus was not locked paired. So after conversion the lock must not be
free'd here.

My understanding is, that this is because the bus must not be used
until the update has been done.

-- Sebastian

> >>  	return 0;
> >>  err:
> >> -	src->ops->dsi.bus_unlock(src);
> >>  	mutex_unlock(&ddata->lock);
> >>  	return r;
> >>  }
> >> @@ -791,7 +753,6 @@ static void dsicm_ulps_work(struct work_struct *work)
> >>  	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> >>  			ulps_work.work);
> >>  	struct omap_dss_device *dssdev = &ddata->dssdev;
> >> -	struct omap_dss_device *src = ddata->src;
> >>  
> >>  	mutex_lock(&ddata->lock);
> >>  
> >> @@ -800,11 +761,8 @@ static void dsicm_ulps_work(struct work_struct *work)
> >>  		return;
> >>  	}
> >>  
> >> -	src->ops->dsi.bus_lock(src);
> >> -
> >>  	dsicm_enter_ulps(ddata);
> >>  
> >> -	src->ops->dsi.bus_unlock(src);
> >>  	mutex_unlock(&ddata->lock);
> >>  }
> >>  
> >> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> index 41431ca34568..d54b743c2b48 100644
> >> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> @@ -476,17 +476,13 @@ static inline u32 dsi_read_reg(struct dsi_data *dsi, const struct dsi_reg idx)
> >>  	return __raw_readl(base + idx.idx);
> >>  }
> >>  
> >> -static void dsi_bus_lock(struct omap_dss_device *dssdev)
> >> +static void dsi_bus_lock(struct dsi_data *dsi)
> >>  {
> >> -	struct dsi_data *dsi = to_dsi_data(dssdev);
> >> -
> >>  	down(&dsi->bus_lock);
> > 
> > Nothing to be addressed in this patch, but is there a reason to use a
> > semaphore instead of a mutex ?
> 
> It's been a long time, but I think the reason was that mutex gave a warning after being locked for a
> bit longer time, and semaphore didn't. The resource is reserved while a DSI transfer is active, so
> it could be almost 2 frames (wait for vsync and then transfer frame). Or reading the frame buffer
> back from the panel, which could take a long time (seconds).
> 
> There are better ways to implement it (after this series =).
> 
>  Tomi
> 
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver
  2020-11-09 13:27         ` Sebastian Reichel
@ 2020-11-09 14:25           ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09 14:25 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Laurent Pinchart, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller

On 09/11/2020 15:27, Sebastian Reichel wrote:
> Hi,
> 
> On Mon, Nov 09, 2020 at 12:08:33PM +0200, Tomi Valkeinen wrote:
>> On 09/11/2020 11:52, Laurent Pinchart wrote:
>>> Hi Tomi,
>>>
>>> Thank you for the patch.
>>>
>>> On Thu, Nov 05, 2020 at 02:03:04PM +0200, Tomi Valkeinen wrote:
>>>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>>>
>>>> This moves the bus locking into the host driver and unexports
>>>> the custom API in preparation for drm_panel support.
>>>>
>>>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>>>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>>
>> <snip>
>>
>>>>  static int dsicm_update(struct omap_dss_device *dssdev,
>>>> @@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>>>  	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>>>>  
>>>>  	mutex_lock(&ddata->lock);
>>>> -	src->ops->dsi.bus_lock(src);
>>>>  
>>>>  	r = dsicm_wake_up(ddata);
>>>>  	if (r)
>>>> @@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>>>  	if (r)
>>>>  		goto err;
>>>>  
>>>> -	/* note: no bus_unlock here. unlock is src framedone_cb */
>>>> -	mutex_unlock(&ddata->lock);
>>>> +	/* note: no unlock here. unlock is src framedone_cb */
>>>
>>> This change isn't described in the commit message. Could you explain why
>>> it's needed ? Locking a mutex in a function and unlocking it elsewhere
>>> always scares me.
>>
>> Good catch. I don't know why it is needed. I don't think it is, as
>> the dsi driver handles the bus lock.
>>
>> Sebastian, what was the reason for this lock?
>>
>> Note that this goes away in the series, and there's no such lock
>> in the end.
> 
> It's not really a change. What this patch basically does is to fold
> src->ops->dsi.bus_lock(src) into mutex_lock(&ddata->lock), so that
> there is only a single locking mechanism. This function previously
> had a matching pair of mutex_lock/unlock for ddata->lock, but the
> bus was not locked paired. So after conversion the lock must not be
> free'd here.

Hmm, but taking the bus_lock is moved into dsi.c (dsi_bus_lock/unlock). Previously the panel called
that directly via the dsi_ops->bus_lock(), but afaics bus_lock is now taken in dsi_update(), which
is called from the panel.

But in addition to that, this patch makes the panel driver keep the ddata->lock during the update,
which is meant to only protect the ddata.

> My understanding is, that this is because the bus must not be used
> until the update has been done.

Yes, and not only about the update, but e.g. prevent sending backlight commands while reading the
framebuffer memory.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver
@ 2020-11-09 14:25           ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-09 14:25 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

On 09/11/2020 15:27, Sebastian Reichel wrote:
> Hi,
> 
> On Mon, Nov 09, 2020 at 12:08:33PM +0200, Tomi Valkeinen wrote:
>> On 09/11/2020 11:52, Laurent Pinchart wrote:
>>> Hi Tomi,
>>>
>>> Thank you for the patch.
>>>
>>> On Thu, Nov 05, 2020 at 02:03:04PM +0200, Tomi Valkeinen wrote:
>>>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>>>
>>>> This moves the bus locking into the host driver and unexports
>>>> the custom API in preparation for drm_panel support.
>>>>
>>>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>>>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>>
>> <snip>
>>
>>>>  static int dsicm_update(struct omap_dss_device *dssdev,
>>>> @@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>>>  	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>>>>  
>>>>  	mutex_lock(&ddata->lock);
>>>> -	src->ops->dsi.bus_lock(src);
>>>>  
>>>>  	r = dsicm_wake_up(ddata);
>>>>  	if (r)
>>>> @@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>>>  	if (r)
>>>>  		goto err;
>>>>  
>>>> -	/* note: no bus_unlock here. unlock is src framedone_cb */
>>>> -	mutex_unlock(&ddata->lock);
>>>> +	/* note: no unlock here. unlock is src framedone_cb */
>>>
>>> This change isn't described in the commit message. Could you explain why
>>> it's needed ? Locking a mutex in a function and unlocking it elsewhere
>>> always scares me.
>>
>> Good catch. I don't know why it is needed. I don't think it is, as
>> the dsi driver handles the bus lock.
>>
>> Sebastian, what was the reason for this lock?
>>
>> Note that this goes away in the series, and there's no such lock
>> in the end.
> 
> It's not really a change. What this patch basically does is to fold
> src->ops->dsi.bus_lock(src) into mutex_lock(&ddata->lock), so that
> there is only a single locking mechanism. This function previously
> had a matching pair of mutex_lock/unlock for ddata->lock, but the
> bus was not locked paired. So after conversion the lock must not be
> free'd here.

Hmm, but taking the bus_lock is moved into dsi.c (dsi_bus_lock/unlock). Previously the panel called
that directly via the dsi_ops->bus_lock(), but afaics bus_lock is now taken in dsi_update(), which
is called from the panel.

But in addition to that, this patch makes the panel driver keep the ddata->lock during the update,
which is meant to only protect the ddata.

> My understanding is, that this is because the bus must not be used
> until the update has been done.

Yes, and not only about the update, but e.g. prevent sending backlight commands while reading the
framebuffer memory.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-09 11:33                               ` Tomi Valkeinen
@ 2020-11-10 13:49                                 ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-10 13:49 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren,
	Discussions about the Letux Kernel

Hi Tomi,

> Am 09.11.2020 um 12:33 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 09/11/2020 13:09, H. Nikolaus Schaller wrote:
> 
>>>> I see.
>>>> Anyways there is missing some simple thing which makes the driver not prepared/enabled.
>>>> Or is this related to VC?
>>> 
>>> No, that's not related to the VC.
>> 
>> Ok, then it is worth searching for that independently. Any idea/hint what could be missing?
> 
> Well, if I had to guess, I would go for either 1) some registration or such is missing from the
> panel driver, or 2) some config value is invalid, which makes the DRM framework or the DSI driver
> fail before calling prepare or enable.

I did now some tests based on v5.10-rc3 by adding mre and more printk() and dump_stack().
And I did blacklist the panel driver so that I could boot and after modprobing it manually
I could trigger a re-probe by inserting some USB memory stick.

With this procedure I could trace the problem down to this call sequence:

	dsi_probe()
          ...
	  w677l_probe()
            drm_panel_add()   -- after this, of_drm_find_panel() is successful
          ...
	  component_add()
	    try_to_bring_up_master()
 	      master->ops->bind(master->dev)

This call to bind() does not return and likely the probing thread is then blocked and
holds some locks which manifests itself in that the system isn't running stable any
more (e.g. heartbeat LEDs are sometimes stuck although console still works).

dbg_info() in try_to_bring_up_master() prints:

[  102.199362] omapdss_dss 58000000.dss: trying to bring up master

So I am not sure if this is a panel driver issue at all or the DSI patch set is not
running stable on OMAP5.

Is a good next step to trace dss_bind() in drivers/gpu/drm/omapdrm//dss/dss.c?

BR,
Nikolaus


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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-10 13:49                                 ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-10 13:49 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Discussions about the Letux Kernel, Tony Lindgren, Sekhar Nori,
	Sebastian Reichel, dri-devel, Laurent Pinchart, linux-omap,
	Nikhil Devshatwar

Hi Tomi,

> Am 09.11.2020 um 12:33 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 09/11/2020 13:09, H. Nikolaus Schaller wrote:
> 
>>>> I see.
>>>> Anyways there is missing some simple thing which makes the driver not prepared/enabled.
>>>> Or is this related to VC?
>>> 
>>> No, that's not related to the VC.
>> 
>> Ok, then it is worth searching for that independently. Any idea/hint what could be missing?
> 
> Well, if I had to guess, I would go for either 1) some registration or such is missing from the
> panel driver, or 2) some config value is invalid, which makes the DRM framework or the DSI driver
> fail before calling prepare or enable.

I did now some tests based on v5.10-rc3 by adding mre and more printk() and dump_stack().
And I did blacklist the panel driver so that I could boot and after modprobing it manually
I could trigger a re-probe by inserting some USB memory stick.

With this procedure I could trace the problem down to this call sequence:

	dsi_probe()
          ...
	  w677l_probe()
            drm_panel_add()   -- after this, of_drm_find_panel() is successful
          ...
	  component_add()
	    try_to_bring_up_master()
 	      master->ops->bind(master->dev)

This call to bind() does not return and likely the probing thread is then blocked and
holds some locks which manifests itself in that the system isn't running stable any
more (e.g. heartbeat LEDs are sometimes stuck although console still works).

dbg_info() in try_to_bring_up_master() prints:

[  102.199362] omapdss_dss 58000000.dss: trying to bring up master

So I am not sure if this is a panel driver issue at all or the DSI patch set is not
running stable on OMAP5.

Is a good next step to trace dss_bind() in drivers/gpu/drm/omapdrm//dss/dss.c?

BR,
Nikolaus

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-10 13:49                                 ` H. Nikolaus Schaller
@ 2020-11-10 15:25                                   ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-10 15:25 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren,
	Discussions about the Letux Kernel

On 10/11/2020 15:49, H. Nikolaus Schaller wrote:

> I did now some tests based on v5.10-rc3 by adding mre and more printk() and dump_stack().
> And I did blacklist the panel driver so that I could boot and after modprobing it manually
> I could trigger a re-probe by inserting some USB memory stick.
> 
> With this procedure I could trace the problem down to this call sequence:
> 
> 	dsi_probe()
>           ...
> 	  w677l_probe()
>             drm_panel_add()   -- after this, of_drm_find_panel() is successful
>           ...
> 	  component_add()
> 	    try_to_bring_up_master()
>  	      master->ops->bind(master->dev)
> 
> This call to bind() does not return and likely the probing thread is then blocked and
> holds some locks which manifests itself in that the system isn't running stable any
> more (e.g. heartbeat LEDs are sometimes stuck although console still works).
> 
> dbg_info() in try_to_bring_up_master() prints:
> 
> [  102.199362] omapdss_dss 58000000.dss: trying to bring up master
> 
> So I am not sure if this is a panel driver issue at all or the DSI patch set is not
> running stable on OMAP5.
> 
> Is a good next step to trace dss_bind() in drivers/gpu/drm/omapdrm//dss/dss.c?

For me, on omap5 uevm, the dss bind goes fine. But it gets stuck in videomode clock calculations.
Something related to pixel clock, I think, as the pclk dsi receives is 3708754968 kHz (so, garbage).
I'll try to debug more tomorrow.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-10 15:25                                   ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-10 15:25 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Discussions about the Letux Kernel, Tony Lindgren, Sekhar Nori,
	Sebastian Reichel, dri-devel, Laurent Pinchart, linux-omap,
	Nikhil Devshatwar

On 10/11/2020 15:49, H. Nikolaus Schaller wrote:

> I did now some tests based on v5.10-rc3 by adding mre and more printk() and dump_stack().
> And I did blacklist the panel driver so that I could boot and after modprobing it manually
> I could trigger a re-probe by inserting some USB memory stick.
> 
> With this procedure I could trace the problem down to this call sequence:
> 
> 	dsi_probe()
>           ...
> 	  w677l_probe()
>             drm_panel_add()   -- after this, of_drm_find_panel() is successful
>           ...
> 	  component_add()
> 	    try_to_bring_up_master()
>  	      master->ops->bind(master->dev)
> 
> This call to bind() does not return and likely the probing thread is then blocked and
> holds some locks which manifests itself in that the system isn't running stable any
> more (e.g. heartbeat LEDs are sometimes stuck although console still works).
> 
> dbg_info() in try_to_bring_up_master() prints:
> 
> [  102.199362] omapdss_dss 58000000.dss: trying to bring up master
> 
> So I am not sure if this is a panel driver issue at all or the DSI patch set is not
> running stable on OMAP5.
> 
> Is a good next step to trace dss_bind() in drivers/gpu/drm/omapdrm//dss/dss.c?

For me, on omap5 uevm, the dss bind goes fine. But it gets stuck in videomode clock calculations.
Something related to pixel clock, I think, as the pclk dsi receives is 3708754968 kHz (so, garbage).
I'll try to debug more tomorrow.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-10 13:49                                 ` H. Nikolaus Schaller
@ 2020-11-10 16:49                                   ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-10 16:49 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren,
	Discussions about the Letux Kernel


> Am 10.11.2020 um 14:49 schrieb H. Nikolaus Schaller <hns@goldelico.com>:
> 
> Hi Tomi,
> 
>> Am 09.11.2020 um 12:33 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>> 
>> On 09/11/2020 13:09, H. Nikolaus Schaller wrote:
>> 
>>>>> I see.
>>>>> Anyways there is missing some simple thing which makes the driver not prepared/enabled.
>>>>> Or is this related to VC?
>>>> 
>>>> No, that's not related to the VC.
>>> 
>>> Ok, then it is worth searching for that independently. Any idea/hint what could be missing?
>> 
>> Well, if I had to guess, I would go for either 1) some registration or such is missing from the
>> panel driver, or 2) some config value is invalid, which makes the DRM framework or the DSI driver
>> fail before calling prepare or enable.
> 
> I did now some tests based on v5.10-rc3 by adding mre and more printk() and dump_stack().
> And I did blacklist the panel driver so that I could boot and after modprobing it manually
> I could trigger a re-probe by inserting some USB memory stick.
> 
> With this procedure I could trace the problem down to this call sequence:
> 
> 	dsi_probe()
>          ...
> 	  w677l_probe()
>            drm_panel_add()   -- after this, of_drm_find_panel() is successful
>          ...
> 	  component_add()
> 	    try_to_bring_up_master()
> 	      master->ops->bind(master->dev)
> 
> This call to bind() does not return and likely the probing thread is then blocked and
> holds some locks which manifests itself in that the system isn't running stable any
> more (e.g. heartbeat LEDs are sometimes stuck although console still works).
> 
> dbg_info() in try_to_bring_up_master() prints:
> 
> [  102.199362] omapdss_dss 58000000.dss: trying to bring up master
> 
> So I am not sure if this is a panel driver issue at all or the DSI patch set is not
> running stable on OMAP5.
> 
> Is a good next step to trace dss_bind() in drivers/gpu/drm/omapdrm//dss/dss.c?

There is indeed one kernel worker running at 100% CPU load.

top:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                   
 3196 root      20   0       0      0      0 R  100.0  0.0   2:58.76 kworker/0:8+events                                                        

More analysis shows that it hangs in drm_client_modeset_probe() in the loop

	for (i = 0; i < connector_count; i++)
		total_modes_count += connectors[i]->funcs->fill_modes(connectors[i], width, height);

Most likely not in the loop because that looks sane, but connectors[i]->funcs->fill_modes().

So I have to find out what function connectors[i]->funcs->fill_modes is...

BTW: connector_count = 2.

BR and thanks,
Nikolaus



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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-10 16:49                                   ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-10 16:49 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Discussions about the Letux Kernel, Tony Lindgren, Sekhar Nori,
	Sebastian Reichel, dri-devel, Laurent Pinchart, linux-omap,
	Nikhil Devshatwar


> Am 10.11.2020 um 14:49 schrieb H. Nikolaus Schaller <hns@goldelico.com>:
> 
> Hi Tomi,
> 
>> Am 09.11.2020 um 12:33 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>> 
>> On 09/11/2020 13:09, H. Nikolaus Schaller wrote:
>> 
>>>>> I see.
>>>>> Anyways there is missing some simple thing which makes the driver not prepared/enabled.
>>>>> Or is this related to VC?
>>>> 
>>>> No, that's not related to the VC.
>>> 
>>> Ok, then it is worth searching for that independently. Any idea/hint what could be missing?
>> 
>> Well, if I had to guess, I would go for either 1) some registration or such is missing from the
>> panel driver, or 2) some config value is invalid, which makes the DRM framework or the DSI driver
>> fail before calling prepare or enable.
> 
> I did now some tests based on v5.10-rc3 by adding mre and more printk() and dump_stack().
> And I did blacklist the panel driver so that I could boot and after modprobing it manually
> I could trigger a re-probe by inserting some USB memory stick.
> 
> With this procedure I could trace the problem down to this call sequence:
> 
> 	dsi_probe()
>          ...
> 	  w677l_probe()
>            drm_panel_add()   -- after this, of_drm_find_panel() is successful
>          ...
> 	  component_add()
> 	    try_to_bring_up_master()
> 	      master->ops->bind(master->dev)
> 
> This call to bind() does not return and likely the probing thread is then blocked and
> holds some locks which manifests itself in that the system isn't running stable any
> more (e.g. heartbeat LEDs are sometimes stuck although console still works).
> 
> dbg_info() in try_to_bring_up_master() prints:
> 
> [  102.199362] omapdss_dss 58000000.dss: trying to bring up master
> 
> So I am not sure if this is a panel driver issue at all or the DSI patch set is not
> running stable on OMAP5.
> 
> Is a good next step to trace dss_bind() in drivers/gpu/drm/omapdrm//dss/dss.c?

There is indeed one kernel worker running at 100% CPU load.

top:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                   
 3196 root      20   0       0      0      0 R  100.0  0.0   2:58.76 kworker/0:8+events                                                        

More analysis shows that it hangs in drm_client_modeset_probe() in the loop

	for (i = 0; i < connector_count; i++)
		total_modes_count += connectors[i]->funcs->fill_modes(connectors[i], width, height);

Most likely not in the loop because that looks sane, but connectors[i]->funcs->fill_modes().

So I have to find out what function connectors[i]->funcs->fill_modes is...

BTW: connector_count = 2.

BR and thanks,
Nikolaus


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-10 16:49                                   ` H. Nikolaus Schaller
@ 2020-11-10 16:52                                     ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-10 16:52 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	linux-omap, dri-devel, Sekhar Nori, Tony Lindgren,
	Discussions about the Letux Kernel

On 10/11/2020 18:49, H. Nikolaus Schaller wrote:
> 
>> Am 10.11.2020 um 14:49 schrieb H. Nikolaus Schaller <hns@goldelico.com>:
>>
>> Hi Tomi,
>>
>>> Am 09.11.2020 um 12:33 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>
>>> On 09/11/2020 13:09, H. Nikolaus Schaller wrote:
>>>
>>>>>> I see.
>>>>>> Anyways there is missing some simple thing which makes the driver not prepared/enabled.
>>>>>> Or is this related to VC?
>>>>>
>>>>> No, that's not related to the VC.
>>>>
>>>> Ok, then it is worth searching for that independently. Any idea/hint what could be missing?
>>>
>>> Well, if I had to guess, I would go for either 1) some registration or such is missing from the
>>> panel driver, or 2) some config value is invalid, which makes the DRM framework or the DSI driver
>>> fail before calling prepare or enable.
>>
>> I did now some tests based on v5.10-rc3 by adding mre and more printk() and dump_stack().
>> And I did blacklist the panel driver so that I could boot and after modprobing it manually
>> I could trigger a re-probe by inserting some USB memory stick.
>>
>> With this procedure I could trace the problem down to this call sequence:
>>
>> 	dsi_probe()
>>          ...
>> 	  w677l_probe()
>>            drm_panel_add()   -- after this, of_drm_find_panel() is successful
>>          ...
>> 	  component_add()
>> 	    try_to_bring_up_master()
>> 	      master->ops->bind(master->dev)
>>
>> This call to bind() does not return and likely the probing thread is then blocked and
>> holds some locks which manifests itself in that the system isn't running stable any
>> more (e.g. heartbeat LEDs are sometimes stuck although console still works).
>>
>> dbg_info() in try_to_bring_up_master() prints:
>>
>> [  102.199362] omapdss_dss 58000000.dss: trying to bring up master
>>
>> So I am not sure if this is a panel driver issue at all or the DSI patch set is not
>> running stable on OMAP5.
>>
>> Is a good next step to trace dss_bind() in drivers/gpu/drm/omapdrm//dss/dss.c?
> 
> There is indeed one kernel worker running at 100% CPU load.
> 
> top:
> 
>   PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                   
>  3196 root      20   0       0      0      0 R  100.0  0.0   2:58.76 kworker/0:8+events                                                        
> 
> More analysis shows that it hangs in drm_client_modeset_probe() in the loop
> 
> 	for (i = 0; i < connector_count; i++)
> 		total_modes_count += connectors[i]->funcs->fill_modes(connectors[i], width, height);
> 
> Most likely not in the loop because that looks sane, but connectors[i]->funcs->fill_modes().
> 
> So I have to find out what function connectors[i]->funcs->fill_modes is...
> 
> BTW: connector_count = 2.

I guess you have the same issue. It goes to dsi_bridge_mode_valid, then __dsi_calc_config, and stays
there finding good clocks.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-10 16:52                                     ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-10 16:52 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Discussions about the Letux Kernel, Tony Lindgren, Sekhar Nori,
	Sebastian Reichel, dri-devel, Laurent Pinchart, linux-omap,
	Nikhil Devshatwar

On 10/11/2020 18:49, H. Nikolaus Schaller wrote:
> 
>> Am 10.11.2020 um 14:49 schrieb H. Nikolaus Schaller <hns@goldelico.com>:
>>
>> Hi Tomi,
>>
>>> Am 09.11.2020 um 12:33 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>
>>> On 09/11/2020 13:09, H. Nikolaus Schaller wrote:
>>>
>>>>>> I see.
>>>>>> Anyways there is missing some simple thing which makes the driver not prepared/enabled.
>>>>>> Or is this related to VC?
>>>>>
>>>>> No, that's not related to the VC.
>>>>
>>>> Ok, then it is worth searching for that independently. Any idea/hint what could be missing?
>>>
>>> Well, if I had to guess, I would go for either 1) some registration or such is missing from the
>>> panel driver, or 2) some config value is invalid, which makes the DRM framework or the DSI driver
>>> fail before calling prepare or enable.
>>
>> I did now some tests based on v5.10-rc3 by adding mre and more printk() and dump_stack().
>> And I did blacklist the panel driver so that I could boot and after modprobing it manually
>> I could trigger a re-probe by inserting some USB memory stick.
>>
>> With this procedure I could trace the problem down to this call sequence:
>>
>> 	dsi_probe()
>>          ...
>> 	  w677l_probe()
>>            drm_panel_add()   -- after this, of_drm_find_panel() is successful
>>          ...
>> 	  component_add()
>> 	    try_to_bring_up_master()
>> 	      master->ops->bind(master->dev)
>>
>> This call to bind() does not return and likely the probing thread is then blocked and
>> holds some locks which manifests itself in that the system isn't running stable any
>> more (e.g. heartbeat LEDs are sometimes stuck although console still works).
>>
>> dbg_info() in try_to_bring_up_master() prints:
>>
>> [  102.199362] omapdss_dss 58000000.dss: trying to bring up master
>>
>> So I am not sure if this is a panel driver issue at all or the DSI patch set is not
>> running stable on OMAP5.
>>
>> Is a good next step to trace dss_bind() in drivers/gpu/drm/omapdrm//dss/dss.c?
> 
> There is indeed one kernel worker running at 100% CPU load.
> 
> top:
> 
>   PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                   
>  3196 root      20   0       0      0      0 R  100.0  0.0   2:58.76 kworker/0:8+events                                                        
> 
> More analysis shows that it hangs in drm_client_modeset_probe() in the loop
> 
> 	for (i = 0; i < connector_count; i++)
> 		total_modes_count += connectors[i]->funcs->fill_modes(connectors[i], width, height);
> 
> Most likely not in the loop because that looks sane, but connectors[i]->funcs->fill_modes().
> 
> So I have to find out what function connectors[i]->funcs->fill_modes is...
> 
> BTW: connector_count = 2.

I guess you have the same issue. It goes to dsi_bridge_mode_valid, then __dsi_calc_config, and stays
there finding good clocks.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-10 16:52                                     ` Tomi Valkeinen
@ 2020-11-10 21:04                                       ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-10 21:04 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	Linux-OMAP, dri-devel, Sekhar Nori, Tony Lindgren,
	Discussions about the Letux Kernel


> Am 10.11.2020 um 17:52 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 10/11/2020 18:49, H. Nikolaus Schaller wrote:
> 
> I guess you have the same issue. It goes to dsi_bridge_mode_valid, then __dsi_calc_config, and stays
> there finding good clocks.

Yes, I could trace it down to exactly this point.

So the culprit is somehow the panel driver. Because it asks for clocks that the PLL driver does not want to provide...
Or is it the victim?

Here is what dmesg reports with even more printk():

[  276.970635] drm_helper_probe_single_connector_modes 12 count=1
[  277.003509] drm_mode_validate_pipeline 2 ret=0 status=0
[  277.038678] drm_bridge_chain_mode_valid: func=dsi_bridge_mode_valid+0x0/0xa0 [omapdrm]
[  277.047199] dsi_bridge_mode_valid
[  277.050786] __dsi_calc_config
[  277.057270] dsi_vm_calc
[  277.073251] dss_pll_calc_a clkin=19200000 pll_min=1555386656 pll_max=1555410656 func=dsi_vm_calc_pll_cb+0x0/0x48 [omapdrm]
[  277.084975] dss_pll_calc_a pll_hw_max=1800000000 fint_hw_min=150000 fint_hw_max=52000000
[  277.093637] dss_pll_calc_a n_start=1 n_inc=1 n_stop=128 pll_max'=1555410656
[  277.101062] dss_pll_calc_a n=1 clkin=19200000 fint=19200000
[  277.107152] dss_pll_calc_a m_start=41 m_inc=1 m_stop=40

Ok, we have to wait quite a while until the for(m;;) loop ends, because m_stop < m_start and m_inc is positive.

So something in the formulae in dss_pll_calc_a() does not fit or has unintended rounding effects.
Or the values reported by w677l_get_modes() do not fit anything.

I think these findings and ideas should help to find a fix.

BR and thanks,
Nikolaus

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-10 21:04                                       ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-10 21:04 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Discussions about the Letux Kernel, Tony Lindgren, Sekhar Nori,
	Sebastian Reichel, dri-devel, Laurent Pinchart, Linux-OMAP,
	Nikhil Devshatwar


> Am 10.11.2020 um 17:52 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 10/11/2020 18:49, H. Nikolaus Schaller wrote:
> 
> I guess you have the same issue. It goes to dsi_bridge_mode_valid, then __dsi_calc_config, and stays
> there finding good clocks.

Yes, I could trace it down to exactly this point.

So the culprit is somehow the panel driver. Because it asks for clocks that the PLL driver does not want to provide...
Or is it the victim?

Here is what dmesg reports with even more printk():

[  276.970635] drm_helper_probe_single_connector_modes 12 count=1
[  277.003509] drm_mode_validate_pipeline 2 ret=0 status=0
[  277.038678] drm_bridge_chain_mode_valid: func=dsi_bridge_mode_valid+0x0/0xa0 [omapdrm]
[  277.047199] dsi_bridge_mode_valid
[  277.050786] __dsi_calc_config
[  277.057270] dsi_vm_calc
[  277.073251] dss_pll_calc_a clkin=19200000 pll_min=1555386656 pll_max=1555410656 func=dsi_vm_calc_pll_cb+0x0/0x48 [omapdrm]
[  277.084975] dss_pll_calc_a pll_hw_max=1800000000 fint_hw_min=150000 fint_hw_max=52000000
[  277.093637] dss_pll_calc_a n_start=1 n_inc=1 n_stop=128 pll_max'=1555410656
[  277.101062] dss_pll_calc_a n=1 clkin=19200000 fint=19200000
[  277.107152] dss_pll_calc_a m_start=41 m_inc=1 m_stop=40

Ok, we have to wait quite a while until the for(m;;) loop ends, because m_stop < m_start and m_inc is positive.

So something in the formulae in dss_pll_calc_a() does not fit or has unintended rounding effects.
Or the values reported by w677l_get_modes() do not fit anything.

I think these findings and ideas should help to find a fix.

BR and thanks,
Nikolaus
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-10 21:04                                       ` H. Nikolaus Schaller
@ 2020-11-11  6:40                                         ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11  6:40 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	Linux-OMAP, dri-devel, Sekhar Nori, Tony Lindgren,
	Discussions about the Letux Kernel

On 10/11/2020 23:04, H. Nikolaus Schaller wrote:
> 
>> Am 10.11.2020 um 17:52 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>
>> On 10/11/2020 18:49, H. Nikolaus Schaller wrote:
>>
>> I guess you have the same issue. It goes to dsi_bridge_mode_valid, then __dsi_calc_config, and stays
>> there finding good clocks.
> 
> Yes, I could trace it down to exactly this point.
> 
> So the culprit is somehow the panel driver. Because it asks for clocks that the PLL driver does not want to provide...
> Or is it the victim?
> 
> Here is what dmesg reports with even more printk():
> 
> [  276.970635] drm_helper_probe_single_connector_modes 12 count=1
> [  277.003509] drm_mode_validate_pipeline 2 ret=0 status=0
> [  277.038678] drm_bridge_chain_mode_valid: func=dsi_bridge_mode_valid+0x0/0xa0 [omapdrm]
> [  277.047199] dsi_bridge_mode_valid
> [  277.050786] __dsi_calc_config
> [  277.057270] dsi_vm_calc
> [  277.073251] dss_pll_calc_a clkin=19200000 pll_min=1555386656 pll_max=1555410656 func=dsi_vm_calc_pll_cb+0x0/0x48 [omapdrm]
> [  277.084975] dss_pll_calc_a pll_hw_max=1800000000 fint_hw_min=150000 fint_hw_max=52000000
> [  277.093637] dss_pll_calc_a n_start=1 n_inc=1 n_stop=128 pll_max'=1555410656
> [  277.101062] dss_pll_calc_a n=1 clkin=19200000 fint=19200000
> [  277.107152] dss_pll_calc_a m_start=41 m_inc=1 m_stop=40
> 
> Ok, we have to wait quite a while until the for(m;;) loop ends, because m_stop < m_start and m_inc is positive.
> 
> So something in the formulae in dss_pll_calc_a() does not fit or has unintended rounding effects.
> Or the values reported by w677l_get_modes() do not fit anything.
> 
> I think these findings and ideas should help to find a fix.

drm_display_mode.clock is in kHz, but the panel driver writes Hz (w677l_PIXELCLOCK) to it. But
there's more after fixing that. The DSI gets configured in bridge's modeset, which I think is before
w677l_prepare where the panel already sends DSI commands. Also, the dsi driver fails to lock the
PLL, so possibly the clock calcs are still wrong.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-11  6:40                                         ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11  6:40 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Discussions about the Letux Kernel, Tony Lindgren, Sekhar Nori,
	Sebastian Reichel, dri-devel, Laurent Pinchart, Linux-OMAP,
	Nikhil Devshatwar

On 10/11/2020 23:04, H. Nikolaus Schaller wrote:
> 
>> Am 10.11.2020 um 17:52 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>
>> On 10/11/2020 18:49, H. Nikolaus Schaller wrote:
>>
>> I guess you have the same issue. It goes to dsi_bridge_mode_valid, then __dsi_calc_config, and stays
>> there finding good clocks.
> 
> Yes, I could trace it down to exactly this point.
> 
> So the culprit is somehow the panel driver. Because it asks for clocks that the PLL driver does not want to provide...
> Or is it the victim?
> 
> Here is what dmesg reports with even more printk():
> 
> [  276.970635] drm_helper_probe_single_connector_modes 12 count=1
> [  277.003509] drm_mode_validate_pipeline 2 ret=0 status=0
> [  277.038678] drm_bridge_chain_mode_valid: func=dsi_bridge_mode_valid+0x0/0xa0 [omapdrm]
> [  277.047199] dsi_bridge_mode_valid
> [  277.050786] __dsi_calc_config
> [  277.057270] dsi_vm_calc
> [  277.073251] dss_pll_calc_a clkin=19200000 pll_min=1555386656 pll_max=1555410656 func=dsi_vm_calc_pll_cb+0x0/0x48 [omapdrm]
> [  277.084975] dss_pll_calc_a pll_hw_max=1800000000 fint_hw_min=150000 fint_hw_max=52000000
> [  277.093637] dss_pll_calc_a n_start=1 n_inc=1 n_stop=128 pll_max'=1555410656
> [  277.101062] dss_pll_calc_a n=1 clkin=19200000 fint=19200000
> [  277.107152] dss_pll_calc_a m_start=41 m_inc=1 m_stop=40
> 
> Ok, we have to wait quite a while until the for(m;;) loop ends, because m_stop < m_start and m_inc is positive.
> 
> So something in the formulae in dss_pll_calc_a() does not fit or has unintended rounding effects.
> Or the values reported by w677l_get_modes() do not fit anything.
> 
> I think these findings and ideas should help to find a fix.

drm_display_mode.clock is in kHz, but the panel driver writes Hz (w677l_PIXELCLOCK) to it. But
there's more after fixing that. The DSI gets configured in bridge's modeset, which I think is before
w677l_prepare where the panel already sends DSI commands. Also, the dsi driver fails to lock the
PLL, so possibly the clock calcs are still wrong.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-11  6:40                                         ` Tomi Valkeinen
@ 2020-11-11  7:48                                           ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-11  7:48 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	Linux-OMAP, dri-devel, Sekhar Nori, Tony Lindgren,
	Discussions about the Letux Kernel


> Am 11.11.2020 um 07:40 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 10/11/2020 23:04, H. Nikolaus Schaller wrote:
>> 
>>> Am 10.11.2020 um 17:52 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> 
>>> On 10/11/2020 18:49, H. Nikolaus Schaller wrote:
>>> 
>>> I guess you have the same issue. It goes to dsi_bridge_mode_valid, then __dsi_calc_config, and stays
>>> there finding good clocks.
>> 
> 
> drm_display_mode.clock is in kHz, but the panel driver writes Hz (w677l_PIXELCLOCK) to it.

Ok, fixing this removes the stuck thread issue. Thanks for pointing this out!

> But
> there's more after fixing that. The DSI gets configured in bridge's modeset, which I think is before
> w677l_prepare where the panel already sends DSI commands. Also, the dsi driver fails to lock the
> PLL, so possibly the clock calcs are still wrong.

What I now get is

[  131.035006] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:55:crtc-0] flip_done timed out
[  141.272174] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CONNECTOR:54:DSI-1] flip_done timed out

I think for further experiments we could hack the device tree to compatible = "orisetech,otm8009a";
and configure for panel-orisetech-otm8009a.ko. Since this panel driver is known to work elsewhere
we could exclude panel driver issues for the moment. To be safe we can modify otm8009a_dcs_write_buf()
to just print what it would be doing.

BR,
Nikolaus


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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-11  7:48                                           ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-11  7:48 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Discussions about the Letux Kernel, Tony Lindgren, Sekhar Nori,
	Sebastian Reichel, dri-devel, Laurent Pinchart, Linux-OMAP,
	Nikhil Devshatwar


> Am 11.11.2020 um 07:40 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 10/11/2020 23:04, H. Nikolaus Schaller wrote:
>> 
>>> Am 10.11.2020 um 17:52 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> 
>>> On 10/11/2020 18:49, H. Nikolaus Schaller wrote:
>>> 
>>> I guess you have the same issue. It goes to dsi_bridge_mode_valid, then __dsi_calc_config, and stays
>>> there finding good clocks.
>> 
> 
> drm_display_mode.clock is in kHz, but the panel driver writes Hz (w677l_PIXELCLOCK) to it.

Ok, fixing this removes the stuck thread issue. Thanks for pointing this out!

> But
> there's more after fixing that. The DSI gets configured in bridge's modeset, which I think is before
> w677l_prepare where the panel already sends DSI commands. Also, the dsi driver fails to lock the
> PLL, so possibly the clock calcs are still wrong.

What I now get is

[  131.035006] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:55:crtc-0] flip_done timed out
[  141.272174] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CONNECTOR:54:DSI-1] flip_done timed out

I think for further experiments we could hack the device tree to compatible = "orisetech,otm8009a";
and configure for panel-orisetech-otm8009a.ko. Since this panel driver is known to work elsewhere
we could exclude panel driver issues for the moment. To be safe we can modify otm8009a_dcs_write_buf()
to just print what it would be doing.

BR,
Nikolaus

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-11  7:48                                           ` H. Nikolaus Schaller
@ 2020-11-11 10:11                                             ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 10:11 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	Linux-OMAP, dri-devel, Sekhar Nori, Tony Lindgren,
	Discussions about the Letux Kernel

On 11/11/2020 09:48, H. Nikolaus Schaller wrote:
> 
>> Am 11.11.2020 um 07:40 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>
>> On 10/11/2020 23:04, H. Nikolaus Schaller wrote:
>>>
>>>> Am 10.11.2020 um 17:52 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>>
>>>> On 10/11/2020 18:49, H. Nikolaus Schaller wrote:
>>>>
>>>> I guess you have the same issue. It goes to dsi_bridge_mode_valid, then __dsi_calc_config, and stays
>>>> there finding good clocks.
>>>
>>
>> drm_display_mode.clock is in kHz, but the panel driver writes Hz (w677l_PIXELCLOCK) to it.
> 
> Ok, fixing this removes the stuck thread issue. Thanks for pointing this out!
> 
>> But
>> there's more after fixing that. The DSI gets configured in bridge's modeset, which I think is before
>> w677l_prepare where the panel already sends DSI commands. Also, the dsi driver fails to lock the
>> PLL, so possibly the clock calcs are still wrong.
> 
> What I now get is
> 
> [  131.035006] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:55:crtc-0] flip_done timed out
> [  141.272174] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CONNECTOR:54:DSI-1] flip_done timed out
> 
> I think for further experiments we could hack the device tree to compatible = "orisetech,otm8009a";
> and configure for panel-orisetech-otm8009a.ko. Since this panel driver is known to work elsewhere
> we could exclude panel driver issues for the moment. To be safe we can modify otm8009a_dcs_write_buf()
> to just print what it would be doing.

I pushed some quick fixes/hacks to:

git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git 5.11/dsi

At least I get the DSI PLL configured, and kmstest --flip works with 60 fps.
I'm pretty sure the panel won't work yet, though.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-11 10:11                                             ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 10:11 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Discussions about the Letux Kernel, Tony Lindgren, Sekhar Nori,
	Sebastian Reichel, dri-devel, Laurent Pinchart, Linux-OMAP,
	Nikhil Devshatwar

On 11/11/2020 09:48, H. Nikolaus Schaller wrote:
> 
>> Am 11.11.2020 um 07:40 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>
>> On 10/11/2020 23:04, H. Nikolaus Schaller wrote:
>>>
>>>> Am 10.11.2020 um 17:52 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>>
>>>> On 10/11/2020 18:49, H. Nikolaus Schaller wrote:
>>>>
>>>> I guess you have the same issue. It goes to dsi_bridge_mode_valid, then __dsi_calc_config, and stays
>>>> there finding good clocks.
>>>
>>
>> drm_display_mode.clock is in kHz, but the panel driver writes Hz (w677l_PIXELCLOCK) to it.
> 
> Ok, fixing this removes the stuck thread issue. Thanks for pointing this out!
> 
>> But
>> there's more after fixing that. The DSI gets configured in bridge's modeset, which I think is before
>> w677l_prepare where the panel already sends DSI commands. Also, the dsi driver fails to lock the
>> PLL, so possibly the clock calcs are still wrong.
> 
> What I now get is
> 
> [  131.035006] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:55:crtc-0] flip_done timed out
> [  141.272174] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CONNECTOR:54:DSI-1] flip_done timed out
> 
> I think for further experiments we could hack the device tree to compatible = "orisetech,otm8009a";
> and configure for panel-orisetech-otm8009a.ko. Since this panel driver is known to work elsewhere
> we could exclude panel driver issues for the moment. To be safe we can modify otm8009a_dcs_write_buf()
> to just print what it would be doing.

I pushed some quick fixes/hacks to:

git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git 5.11/dsi

At least I get the DSI PLL configured, and kmstest --flip works with 60 fps.
I'm pretty sure the panel won't work yet, though.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 37/56] drm/omap: panel-dsi-cm: support unbinding
  2020-11-09 10:49     ` Laurent Pinchart
@ 2020-11-11 12:03       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 12:03 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 09/11/2020 12:49, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> On Thu, Nov 05, 2020 at 02:03:14PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> Now, that the driver implements the common DRM panel API
>> the unbind no longer needs to be suppressed.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> 
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> I'd be curious to know what happens when you try to unbind through sysfs
> though...

I'm sure it crashes. The same happens if you unload the modules in wrong order (unload panel first,
then omapdrm). I haven't looked at this yet, it's low priority issue...

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 37/56] drm/omap: panel-dsi-cm: support unbinding
@ 2020-11-11 12:03       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 12:03 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 09/11/2020 12:49, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> On Thu, Nov 05, 2020 at 02:03:14PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> Now, that the driver implements the common DRM panel API
>> the unbind no longer needs to be suppressed.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> 
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> I'd be curious to know what happens when you try to unbind through sysfs
> though...

I'm sure it crashes. The same happens if you unload the modules in wrong order (unload panel first,
then omapdrm). I haven't looked at this yet, it's low priority issue...

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 50/56] drm/omap: dsi: simplify pin config
  2020-11-09 11:09     ` Laurent Pinchart
@ 2020-11-11 12:24       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 12:24 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 09/11/2020 13:09, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:27PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> Simplify DSI pin config, which always originates from DT
>> nowadays. With the code being fully contained in the DSI
>> encoder, we can drop the public structure.
>>
>> Since the function is no longer exposed, it now directly
>> takes the private DSI data pointer. This drop a pointless
> 
> s/drop/drops/
> 
>> conversion and means the pins can be configured earlier.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 33 +++++++++------------------
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 15 ------------
>>  2 files changed, 11 insertions(+), 37 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index f47d7e3bb631..76e4f607d8cf 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -3568,12 +3568,9 @@ static void dsi_proto_timings(struct dsi_data *dsi)
>>  	}
>>  }
>>  
>> -static int dsi_configure_pins(struct omap_dss_device *dssdev,
>> -		const struct omap_dsi_pin_config *pin_cfg)
>> +static int dsi_configure_pins(struct dsi_data *dsi,
>> +		int num_pins, const u32 *pins)
>>  {
>> -	struct dsi_data *dsi = to_dsi_data(dssdev);
>> -	int num_pins;
>> -	const int *pins;
>>  	struct dsi_lane_config lanes[DSI_MAX_NR_LANES];
>>  	int num_lanes;
>>  	int i;
>> @@ -3586,9 +3583,6 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>>  		DSI_LANE_DATA4,
>>  	};
>>  
>> -	num_pins = pin_cfg->num_pins;
>> -	pins = pin_cfg->pins;
>> -
>>  	if (num_pins < 4 || num_pins > dsi->num_lanes_supported * 2
>>  			|| num_pins % 2 != 0)
>>  		return -EINVAL;
>> @@ -3600,7 +3594,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>>  
>>  	for (i = 0; i < num_pins; i += 2) {
>>  		u8 lane, pol;
>> -		int dx, dy;
>> +		u32 dx, dy;
> 
> Is this change needed ?

The pins array is now u32, so the above is correct. However, a bit below we check if dx < 0, which
doesn't make sense anymore, so I'll drop that check.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 50/56] drm/omap: dsi: simplify pin config
@ 2020-11-11 12:24       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 12:24 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 09/11/2020 13:09, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:27PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> Simplify DSI pin config, which always originates from DT
>> nowadays. With the code being fully contained in the DSI
>> encoder, we can drop the public structure.
>>
>> Since the function is no longer exposed, it now directly
>> takes the private DSI data pointer. This drop a pointless
> 
> s/drop/drops/
> 
>> conversion and means the pins can be configured earlier.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  drivers/gpu/drm/omapdrm/dss/dsi.c     | 33 +++++++++------------------
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 15 ------------
>>  2 files changed, 11 insertions(+), 37 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index f47d7e3bb631..76e4f607d8cf 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -3568,12 +3568,9 @@ static void dsi_proto_timings(struct dsi_data *dsi)
>>  	}
>>  }
>>  
>> -static int dsi_configure_pins(struct omap_dss_device *dssdev,
>> -		const struct omap_dsi_pin_config *pin_cfg)
>> +static int dsi_configure_pins(struct dsi_data *dsi,
>> +		int num_pins, const u32 *pins)
>>  {
>> -	struct dsi_data *dsi = to_dsi_data(dssdev);
>> -	int num_pins;
>> -	const int *pins;
>>  	struct dsi_lane_config lanes[DSI_MAX_NR_LANES];
>>  	int num_lanes;
>>  	int i;
>> @@ -3586,9 +3583,6 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>>  		DSI_LANE_DATA4,
>>  	};
>>  
>> -	num_pins = pin_cfg->num_pins;
>> -	pins = pin_cfg->pins;
>> -
>>  	if (num_pins < 4 || num_pins > dsi->num_lanes_supported * 2
>>  			|| num_pins % 2 != 0)
>>  		return -EINVAL;
>> @@ -3600,7 +3594,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>>  
>>  	for (i = 0; i < num_pins; i += 2) {
>>  		u8 lane, pol;
>> -		int dx, dy;
>> +		u32 dx, dy;
> 
> Is this change needed ?

The pins array is now u32, so the above is correct. However, a bit below we check if dx < 0, which
doesn't make sense anymore, so I'll drop that check.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 35/56] drm/omap: dsi: implement check timings
  2020-11-09 10:47     ` Laurent Pinchart
@ 2020-11-11 12:36       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 12:36 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 09/11/2020 12:47, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:12PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> Implement check timings, which will check if its possible to
> 
> s/its/it's/
> 
>> configure the clocks for the provided mode using the same code
>> as the set_config() hook.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  drivers/gpu/drm/omapdrm/dss/dsi.c | 70 +++++++++++++++++++------------
>>  1 file changed, 44 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index a1a867a7d91d..f643321434e9 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -280,6 +280,11 @@ struct dsi_isr_tables {
>>  	struct dsi_isr_data isr_table_cio[DSI_MAX_NR_ISRS];
>>  };
>>  
>> +struct dsi_lp_clock_info {
>> +	unsigned long lp_clk;
>> +	u16 lp_clk_div;
>> +};
>> +
>>  struct dsi_clk_calc_ctx {
>>  	struct dsi_data *dsi;
>>  	struct dss_pll *pll;
>> @@ -294,16 +299,12 @@ struct dsi_clk_calc_ctx {
>>  
>>  	struct dss_pll_clock_info dsi_cinfo;
>>  	struct dispc_clock_info dispc_cinfo;
>> +	struct dsi_lp_clock_info user_lp_cinfo;
> 
> Any reason for the user_ prefix here ?

No, I'll drop it.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 35/56] drm/omap: dsi: implement check timings
@ 2020-11-11 12:36       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 12:36 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 09/11/2020 12:47, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:12PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> Implement check timings, which will check if its possible to
> 
> s/its/it's/
> 
>> configure the clocks for the provided mode using the same code
>> as the set_config() hook.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  drivers/gpu/drm/omapdrm/dss/dsi.c | 70 +++++++++++++++++++------------
>>  1 file changed, 44 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index a1a867a7d91d..f643321434e9 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -280,6 +280,11 @@ struct dsi_isr_tables {
>>  	struct dsi_isr_data isr_table_cio[DSI_MAX_NR_ISRS];
>>  };
>>  
>> +struct dsi_lp_clock_info {
>> +	unsigned long lp_clk;
>> +	u16 lp_clk_div;
>> +};
>> +
>>  struct dsi_clk_calc_ctx {
>>  	struct dsi_data *dsi;
>>  	struct dss_pll *pll;
>> @@ -294,16 +299,12 @@ struct dsi_clk_calc_ctx {
>>  
>>  	struct dss_pll_clock_info dsi_cinfo;
>>  	struct dispc_clock_info dispc_cinfo;
>> +	struct dsi_lp_clock_info user_lp_cinfo;
> 
> Any reason for the user_ prefix here ?

No, I'll drop it.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 25/56] drm/omap: dsi: move TE GPIO handling into core
  2020-11-09  9:19     ` Laurent Pinchart
@ 2020-11-11 13:26       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 13:26 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 09/11/2020 11:19, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:02PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> In preparation for removing custom DSS calls from the DSI
>> panel driver, this moves support for external tearing event
>> GPIOs into the DSI host driver. This way tearing events are
>> always handled in the core resulting in simplification of
>> the panel drivers.
>>
>> The TE GPIO acquisition follows works in the same way as the
>> exynos DSI implementation.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 101 +------------
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 138 ++++++++++++++++--
>>  2 files changed, 133 insertions(+), 106 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index 8890ee2ba830..43f63b5a120b 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -54,7 +54,6 @@ struct panel_drv_data {
>>  
>>  	/* panel HW configuration from DT or platform data */
>>  	struct gpio_desc *reset_gpio;
>> -	struct gpio_desc *ext_te_gpio;
>>  
>>  	struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
>>  
>> @@ -68,10 +67,6 @@ struct panel_drv_data {
>>  
>>  	bool te_enabled;
>>  
>> -	atomic_t do_update;
>> -
>> -	struct delayed_work te_timeout_work;
>> -
>>  	bool intro_printed;
>>  
>>  	struct workqueue_struct *workqueue;
>> @@ -83,8 +78,6 @@ struct panel_drv_data {
>>  
>>  #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
>>  
>> -static irqreturn_t dsicm_te_isr(int irq, void *data);
>> -static void dsicm_te_timeout_work_callback(struct work_struct *work);
>>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>>  
>>  static int dsicm_panel_reset(struct panel_drv_data *ddata);
>> @@ -240,9 +233,6 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>>  	if (r)
>>  		goto err;
>>  
>> -	if (ddata->ext_te_gpio)
>> -		disable_irq(gpiod_to_irq(ddata->ext_te_gpio));
>> -
>>  	src->ops->dsi.disable(src, false, true);
>>  
>>  	ddata->ulps_enabled = true;
>> @@ -271,15 +261,12 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>>  	src->ops->enable(src);
>>  	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>>  
>> -	r = _dsicm_enable_te(ddata, true);
>> +	r = _dsicm_enable_te(ddata, ddata->te_enabled);
>>  	if (r) {
>>  		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
>>  		goto err2;
>>  	}
>>  
>> -	if (ddata->ext_te_gpio)
>> -		enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
>> -
>>  	dsicm_queue_ulps_work(ddata);
>>  
>>  	ddata->ulps_enabled = false;
>> @@ -290,11 +277,8 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>>  	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
>>  
>>  	r = dsicm_panel_reset(ddata);
>> -	if (!r) {
>> -		if (ddata->ext_te_gpio)
>> -			enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
>> +	if (!r)
>>  		ddata->ulps_enabled = false;
>> -	}
>>  
>>  	dsicm_queue_ulps_work(ddata);
>>  
>> @@ -745,43 +729,6 @@ static void dsicm_framedone_cb(int err, void *data)
>>  	src->ops->dsi.bus_unlock(src);
>>  }
>>  
>> -static irqreturn_t dsicm_te_isr(int irq, void *data)
>> -{
>> -	struct panel_drv_data *ddata = data;
>> -	struct omap_dss_device *src = ddata->src;
>> -	int old;
>> -	int r;
>> -
>> -	old = atomic_cmpxchg(&ddata->do_update, 1, 0);
>> -
>> -	if (old) {
>> -		cancel_delayed_work(&ddata->te_timeout_work);
>> -
>> -		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
>> -				ddata);
>> -		if (r)
>> -			goto err;
>> -	}
>> -
>> -	return IRQ_HANDLED;
>> -err:
>> -	dev_err(&ddata->dsi->dev, "start update failed\n");
>> -	src->ops->dsi.bus_unlock(src);
>> -	return IRQ_HANDLED;
>> -}
>> -
>> -static void dsicm_te_timeout_work_callback(struct work_struct *work)
>> -{
>> -	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
>> -					te_timeout_work.work);
>> -	struct omap_dss_device *src = ddata->src;
>> -
>> -	dev_err(&ddata->dsi->dev, "TE not received for 250ms!\n");
>> -
>> -	atomic_set(&ddata->do_update, 0);
>> -	src->ops->dsi.bus_unlock(src);
>> -}
>> -
>>  static int dsicm_update(struct omap_dss_device *dssdev,
>>  				    u16 x, u16 y, u16 w, u16 h)
>>  {
>> @@ -809,16 +756,10 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>  	if (r)
>>  		goto err;
>>  
>> -	if (ddata->te_enabled && ddata->ext_te_gpio) {
>> -		schedule_delayed_work(&ddata->te_timeout_work,
>> -				msecs_to_jiffies(250));
>> -		atomic_set(&ddata->do_update, 1);
>> -	} else {
>> -		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
>> -				ddata);
>> -		if (r)
>> -			goto err;
>> -	}
>> +	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
>> +			ddata);
>> +	if (r)
>> +		goto err;
>>  
>>  	/* note: no bus_unlock here. unlock is src framedone_cb */
>>  	mutex_unlock(&ddata->lock);
>> @@ -840,8 +781,7 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>>  	else
>>  		r = mipi_dsi_dcs_set_tear_off(dsi);
>>  
>> -	if (!ddata->ext_te_gpio)
>> -		src->ops->dsi.enable_te(src, enable);
>> +	src->ops->dsi.enable_te(src, enable);
>>  
>>  	/* possible panel bug */
>>  	msleep(100);
>> @@ -934,14 +874,6 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>>  		return err;
>>  	}
>>  
>> -	ddata->ext_te_gpio = devm_gpiod_get_optional(&dsi->dev, "te",
>> -						     GPIOD_IN);
>> -	if (IS_ERR(ddata->ext_te_gpio)) {
>> -		err = PTR_ERR(ddata->ext_te_gpio);
>> -		dev_err(&dsi->dev, "TE gpio request failed: %d", err);
>> -		return err;
>> -	}
>> -
>>  	err = of_get_display_timing(node, "panel-timing", &timing);
>>  	if (!err) {
>>  		videomode_from_timing(&timing, &ddata->vm);
>> @@ -1024,25 +956,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  
>>  	mutex_init(&ddata->lock);
>>  
>> -	atomic_set(&ddata->do_update, 0);
>> -
>> -	if (ddata->ext_te_gpio) {
>> -		r = devm_request_irq(dev, gpiod_to_irq(ddata->ext_te_gpio),
>> -				dsicm_te_isr,
>> -				IRQF_TRIGGER_RISING,
>> -				"taal vsync", ddata);
>> -
>> -		if (r) {
>> -			dev_err(dev, "IRQ request failed\n");
>> -			goto err_reg;
>> -		}
>> -
>> -		INIT_DEFERRABLE_WORK(&ddata->te_timeout_work,
>> -					dsicm_te_timeout_work_callback);
>> -
>> -		dev_dbg(dev, "Using GPIO TE\n");
>> -	}
>> -
>>  	ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
>>  	if (!ddata->workqueue) {
>>  		r = -ENOMEM;
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index 003d26cead5a..921e7a1e1014 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -14,7 +14,9 @@
>>  #include <linux/device.h>
>>  #include <linux/err.h>
>>  #include <linux/interrupt.h>
>> +#include <linux/irq.h>
>>  #include <linux/delay.h>
>> +#include <linux/gpio/consumer.h>
> 
> You could sort the headers while at it :-)

I'll do that after the series.

>>  #include <linux/mutex.h>
>>  #include <linux/module.h>
>>  #include <linux/semaphore.h>
>> @@ -368,6 +370,11 @@ struct dsi_data {
>>  	unsigned int update_bytes;
>>  #endif
>>  
>> +	/* external TE GPIO */
>> +	struct gpio_desc *te_gpio;
>> +	struct delayed_work te_timeout_work;
>> +	atomic_t do_ext_te_update;
>> +
>>  	bool te_enabled;
>>  	bool ulps_enabled;
>>  
>> @@ -3827,19 +3834,12 @@ static void dsi_framedone_irq_callback(void *data)
>>  	dsi_handle_framedone(dsi, 0);
>>  }
>>  
>> -static int dsi_update(struct omap_dss_device *dssdev, int channel,
>> -		void (*callback)(int, void *), void *data)
>> +static int _dsi_update(struct dsi_data *dsi)
>>  {
>> -	struct dsi_data *dsi = to_dsi_data(dssdev);
>>  	u16 dw, dh;
>>  
>>  	dsi_perf_mark_setup(dsi);
>>  
>> -	dsi->update_channel = channel;
>> -
>> -	dsi->framedone_callback = callback;
>> -	dsi->framedone_data = data;
>> -
>>  	dw = dsi->vm.hactive;
>>  	dh = dsi->vm.vactive;
>>  
>> @@ -3852,6 +3852,26 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>>  	return 0;
>>  }
>>  
>> +static int dsi_update(struct omap_dss_device *dssdev, int channel,
>> +		void (*callback)(int, void *), void *data)
>> +{
>> +	struct dsi_data *dsi = to_dsi_data(dssdev);
>> +
>> +	dsi->update_channel = channel;
>> +	dsi->framedone_callback = callback;
>> +	dsi->framedone_data = data;
>> +
>> +	if (dsi->te_enabled && dsi->te_gpio) {
>> +		schedule_delayed_work(&dsi->te_timeout_work,
>> +				      msecs_to_jiffies(250));
>> +		atomic_set(&dsi->do_ext_te_update, 1);
>> +	} else {
>> +		_dsi_update(dsi);
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>>  /* Display funcs */
>>  
>>  static int dsi_configure_dispc_clocks(struct dsi_data *dsi)
>> @@ -4095,6 +4115,14 @@ static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
>>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>>  
>>  	dsi->te_enabled = enable;
>> +
>> +	if (dsi->te_gpio) {
>> +		if (enable)
>> +			enable_irq(gpiod_to_irq(dsi->te_gpio));
>> +		else
>> +			disable_irq(gpiod_to_irq(dsi->te_gpio));
>> +	}
>> +
>>  	return 0;
>>  }
>>  
>> @@ -4772,11 +4800,89 @@ static const struct omap_dss_device_ops dsi_ops = {
>>  	},
>>  };
>>  
>> +static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
>> +{
>> +	struct dsi_data *dsi = (struct dsi_data *)dev_id;
>> +	int old;
>> +
>> +	old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
>> +	if (old) {
>> +		cancel_delayed_work(&dsi->te_timeout_work);
>> +		_dsi_update(dsi);
>> +	}
>> +
>> +	return IRQ_HANDLED;
>> +}
>> +
>> +static void omap_dsi_te_timeout_work_callback(struct work_struct *work)
>> +{
>> +	struct dsi_data *dsi = container_of(work, struct dsi_data,
>> +					te_timeout_work.work);
> 
> Strange indentation.
> 
>> +	int old;
>> +
>> +	old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
>> +	if (old) {
>> +		dev_err(dsi->dev, "TE not received for 250ms!\n");
>> +		_dsi_update(dsi);
>> +	}
>> +}
>> +
>> +static int omap_dsi_register_te_irq(struct dsi_data *dsi,
>> +				    struct mipi_dsi_device *client)
>> +{
>> +	int err;
>> +	int te_irq;
>> +
>> +	dsi->te_gpio = gpiod_get_from_of_node(client->dev.of_node,
> 
> Could we call gpiod_get(&client->dev, "te", ...) instead ?

Yep.

>> +					      "te-gpios", 0, GPIOD_IN,
>> +					      "dsi-tearing-effect");
>> +	if (IS_ERR(dsi->te_gpio)) {
>> +		err = PTR_ERR(dsi->te_gpio);
>> +
>> +		if (err == -ENOENT) {
>> +			dsi->te_gpio = NULL;
>> +			return 0;
>> +		}
>> +
>> +		dev_err(dsi->dev, "Could not get TE gpio: %d\n", err);
>> +		return err;
>> +	}
>> +
>> +	te_irq = gpiod_to_irq(dsi->te_gpio);
> 
> Could this fail ?

Yes, I'll add error handling.

>> +	irq_set_status_flags(te_irq, IRQ_NOAUTOEN);
>> +
>> +	err = request_threaded_irq(te_irq, omap_dsi_te_irq_handler, NULL,
>> +				   IRQF_TRIGGER_RISING, "TE", dsi);
> 
> What's the reason to request a threaded IRQ instead of a regular IRQ if
> the threaded handler is NULL ?

Probably just a mistake. I'll change this to use the threaded handler.

>> +	if (err) {
>> +		dev_err(dsi->dev, "request irq failed with %d\n", err);
>> +		gpiod_put(dsi->te_gpio);
>> +		return err;
>> +	}
>> +
>> +	INIT_DEFERRABLE_WORK(&dsi->te_timeout_work,
>> +			     omap_dsi_te_timeout_work_callback);
>> +
>> +	dev_dbg(dsi->dev, "Using GPIO TE\n");
>> +
>> +	return 0;
>> +}
>> +
>> +static void omap_dsi_unregister_te_irq(struct dsi_data *dsi)
>> +{
>> +	if (dsi->te_gpio) {
>> +		free_irq(gpiod_to_irq(dsi->te_gpio), dsi);
> 
> You could store the IRQ number in dsi_data to avoid recomputing it.

Yep.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 25/56] drm/omap: dsi: move TE GPIO handling into core
@ 2020-11-11 13:26       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 13:26 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 09/11/2020 11:19, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:02PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> In preparation for removing custom DSS calls from the DSI
>> panel driver, this moves support for external tearing event
>> GPIOs into the DSI host driver. This way tearing events are
>> always handled in the core resulting in simplification of
>> the panel drivers.
>>
>> The TE GPIO acquisition follows works in the same way as the
>> exynos DSI implementation.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 101 +------------
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 138 ++++++++++++++++--
>>  2 files changed, 133 insertions(+), 106 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index 8890ee2ba830..43f63b5a120b 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -54,7 +54,6 @@ struct panel_drv_data {
>>  
>>  	/* panel HW configuration from DT or platform data */
>>  	struct gpio_desc *reset_gpio;
>> -	struct gpio_desc *ext_te_gpio;
>>  
>>  	struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
>>  
>> @@ -68,10 +67,6 @@ struct panel_drv_data {
>>  
>>  	bool te_enabled;
>>  
>> -	atomic_t do_update;
>> -
>> -	struct delayed_work te_timeout_work;
>> -
>>  	bool intro_printed;
>>  
>>  	struct workqueue_struct *workqueue;
>> @@ -83,8 +78,6 @@ struct panel_drv_data {
>>  
>>  #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
>>  
>> -static irqreturn_t dsicm_te_isr(int irq, void *data);
>> -static void dsicm_te_timeout_work_callback(struct work_struct *work);
>>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>>  
>>  static int dsicm_panel_reset(struct panel_drv_data *ddata);
>> @@ -240,9 +233,6 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>>  	if (r)
>>  		goto err;
>>  
>> -	if (ddata->ext_te_gpio)
>> -		disable_irq(gpiod_to_irq(ddata->ext_te_gpio));
>> -
>>  	src->ops->dsi.disable(src, false, true);
>>  
>>  	ddata->ulps_enabled = true;
>> @@ -271,15 +261,12 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>>  	src->ops->enable(src);
>>  	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>>  
>> -	r = _dsicm_enable_te(ddata, true);
>> +	r = _dsicm_enable_te(ddata, ddata->te_enabled);
>>  	if (r) {
>>  		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
>>  		goto err2;
>>  	}
>>  
>> -	if (ddata->ext_te_gpio)
>> -		enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
>> -
>>  	dsicm_queue_ulps_work(ddata);
>>  
>>  	ddata->ulps_enabled = false;
>> @@ -290,11 +277,8 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>>  	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
>>  
>>  	r = dsicm_panel_reset(ddata);
>> -	if (!r) {
>> -		if (ddata->ext_te_gpio)
>> -			enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
>> +	if (!r)
>>  		ddata->ulps_enabled = false;
>> -	}
>>  
>>  	dsicm_queue_ulps_work(ddata);
>>  
>> @@ -745,43 +729,6 @@ static void dsicm_framedone_cb(int err, void *data)
>>  	src->ops->dsi.bus_unlock(src);
>>  }
>>  
>> -static irqreturn_t dsicm_te_isr(int irq, void *data)
>> -{
>> -	struct panel_drv_data *ddata = data;
>> -	struct omap_dss_device *src = ddata->src;
>> -	int old;
>> -	int r;
>> -
>> -	old = atomic_cmpxchg(&ddata->do_update, 1, 0);
>> -
>> -	if (old) {
>> -		cancel_delayed_work(&ddata->te_timeout_work);
>> -
>> -		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
>> -				ddata);
>> -		if (r)
>> -			goto err;
>> -	}
>> -
>> -	return IRQ_HANDLED;
>> -err:
>> -	dev_err(&ddata->dsi->dev, "start update failed\n");
>> -	src->ops->dsi.bus_unlock(src);
>> -	return IRQ_HANDLED;
>> -}
>> -
>> -static void dsicm_te_timeout_work_callback(struct work_struct *work)
>> -{
>> -	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
>> -					te_timeout_work.work);
>> -	struct omap_dss_device *src = ddata->src;
>> -
>> -	dev_err(&ddata->dsi->dev, "TE not received for 250ms!\n");
>> -
>> -	atomic_set(&ddata->do_update, 0);
>> -	src->ops->dsi.bus_unlock(src);
>> -}
>> -
>>  static int dsicm_update(struct omap_dss_device *dssdev,
>>  				    u16 x, u16 y, u16 w, u16 h)
>>  {
>> @@ -809,16 +756,10 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>  	if (r)
>>  		goto err;
>>  
>> -	if (ddata->te_enabled && ddata->ext_te_gpio) {
>> -		schedule_delayed_work(&ddata->te_timeout_work,
>> -				msecs_to_jiffies(250));
>> -		atomic_set(&ddata->do_update, 1);
>> -	} else {
>> -		r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
>> -				ddata);
>> -		if (r)
>> -			goto err;
>> -	}
>> +	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
>> +			ddata);
>> +	if (r)
>> +		goto err;
>>  
>>  	/* note: no bus_unlock here. unlock is src framedone_cb */
>>  	mutex_unlock(&ddata->lock);
>> @@ -840,8 +781,7 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>>  	else
>>  		r = mipi_dsi_dcs_set_tear_off(dsi);
>>  
>> -	if (!ddata->ext_te_gpio)
>> -		src->ops->dsi.enable_te(src, enable);
>> +	src->ops->dsi.enable_te(src, enable);
>>  
>>  	/* possible panel bug */
>>  	msleep(100);
>> @@ -934,14 +874,6 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>>  		return err;
>>  	}
>>  
>> -	ddata->ext_te_gpio = devm_gpiod_get_optional(&dsi->dev, "te",
>> -						     GPIOD_IN);
>> -	if (IS_ERR(ddata->ext_te_gpio)) {
>> -		err = PTR_ERR(ddata->ext_te_gpio);
>> -		dev_err(&dsi->dev, "TE gpio request failed: %d", err);
>> -		return err;
>> -	}
>> -
>>  	err = of_get_display_timing(node, "panel-timing", &timing);
>>  	if (!err) {
>>  		videomode_from_timing(&timing, &ddata->vm);
>> @@ -1024,25 +956,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  
>>  	mutex_init(&ddata->lock);
>>  
>> -	atomic_set(&ddata->do_update, 0);
>> -
>> -	if (ddata->ext_te_gpio) {
>> -		r = devm_request_irq(dev, gpiod_to_irq(ddata->ext_te_gpio),
>> -				dsicm_te_isr,
>> -				IRQF_TRIGGER_RISING,
>> -				"taal vsync", ddata);
>> -
>> -		if (r) {
>> -			dev_err(dev, "IRQ request failed\n");
>> -			goto err_reg;
>> -		}
>> -
>> -		INIT_DEFERRABLE_WORK(&ddata->te_timeout_work,
>> -					dsicm_te_timeout_work_callback);
>> -
>> -		dev_dbg(dev, "Using GPIO TE\n");
>> -	}
>> -
>>  	ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
>>  	if (!ddata->workqueue) {
>>  		r = -ENOMEM;
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index 003d26cead5a..921e7a1e1014 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -14,7 +14,9 @@
>>  #include <linux/device.h>
>>  #include <linux/err.h>
>>  #include <linux/interrupt.h>
>> +#include <linux/irq.h>
>>  #include <linux/delay.h>
>> +#include <linux/gpio/consumer.h>
> 
> You could sort the headers while at it :-)

I'll do that after the series.

>>  #include <linux/mutex.h>
>>  #include <linux/module.h>
>>  #include <linux/semaphore.h>
>> @@ -368,6 +370,11 @@ struct dsi_data {
>>  	unsigned int update_bytes;
>>  #endif
>>  
>> +	/* external TE GPIO */
>> +	struct gpio_desc *te_gpio;
>> +	struct delayed_work te_timeout_work;
>> +	atomic_t do_ext_te_update;
>> +
>>  	bool te_enabled;
>>  	bool ulps_enabled;
>>  
>> @@ -3827,19 +3834,12 @@ static void dsi_framedone_irq_callback(void *data)
>>  	dsi_handle_framedone(dsi, 0);
>>  }
>>  
>> -static int dsi_update(struct omap_dss_device *dssdev, int channel,
>> -		void (*callback)(int, void *), void *data)
>> +static int _dsi_update(struct dsi_data *dsi)
>>  {
>> -	struct dsi_data *dsi = to_dsi_data(dssdev);
>>  	u16 dw, dh;
>>  
>>  	dsi_perf_mark_setup(dsi);
>>  
>> -	dsi->update_channel = channel;
>> -
>> -	dsi->framedone_callback = callback;
>> -	dsi->framedone_data = data;
>> -
>>  	dw = dsi->vm.hactive;
>>  	dh = dsi->vm.vactive;
>>  
>> @@ -3852,6 +3852,26 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>>  	return 0;
>>  }
>>  
>> +static int dsi_update(struct omap_dss_device *dssdev, int channel,
>> +		void (*callback)(int, void *), void *data)
>> +{
>> +	struct dsi_data *dsi = to_dsi_data(dssdev);
>> +
>> +	dsi->update_channel = channel;
>> +	dsi->framedone_callback = callback;
>> +	dsi->framedone_data = data;
>> +
>> +	if (dsi->te_enabled && dsi->te_gpio) {
>> +		schedule_delayed_work(&dsi->te_timeout_work,
>> +				      msecs_to_jiffies(250));
>> +		atomic_set(&dsi->do_ext_te_update, 1);
>> +	} else {
>> +		_dsi_update(dsi);
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>>  /* Display funcs */
>>  
>>  static int dsi_configure_dispc_clocks(struct dsi_data *dsi)
>> @@ -4095,6 +4115,14 @@ static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
>>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>>  
>>  	dsi->te_enabled = enable;
>> +
>> +	if (dsi->te_gpio) {
>> +		if (enable)
>> +			enable_irq(gpiod_to_irq(dsi->te_gpio));
>> +		else
>> +			disable_irq(gpiod_to_irq(dsi->te_gpio));
>> +	}
>> +
>>  	return 0;
>>  }
>>  
>> @@ -4772,11 +4800,89 @@ static const struct omap_dss_device_ops dsi_ops = {
>>  	},
>>  };
>>  
>> +static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
>> +{
>> +	struct dsi_data *dsi = (struct dsi_data *)dev_id;
>> +	int old;
>> +
>> +	old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
>> +	if (old) {
>> +		cancel_delayed_work(&dsi->te_timeout_work);
>> +		_dsi_update(dsi);
>> +	}
>> +
>> +	return IRQ_HANDLED;
>> +}
>> +
>> +static void omap_dsi_te_timeout_work_callback(struct work_struct *work)
>> +{
>> +	struct dsi_data *dsi = container_of(work, struct dsi_data,
>> +					te_timeout_work.work);
> 
> Strange indentation.
> 
>> +	int old;
>> +
>> +	old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
>> +	if (old) {
>> +		dev_err(dsi->dev, "TE not received for 250ms!\n");
>> +		_dsi_update(dsi);
>> +	}
>> +}
>> +
>> +static int omap_dsi_register_te_irq(struct dsi_data *dsi,
>> +				    struct mipi_dsi_device *client)
>> +{
>> +	int err;
>> +	int te_irq;
>> +
>> +	dsi->te_gpio = gpiod_get_from_of_node(client->dev.of_node,
> 
> Could we call gpiod_get(&client->dev, "te", ...) instead ?

Yep.

>> +					      "te-gpios", 0, GPIOD_IN,
>> +					      "dsi-tearing-effect");
>> +	if (IS_ERR(dsi->te_gpio)) {
>> +		err = PTR_ERR(dsi->te_gpio);
>> +
>> +		if (err == -ENOENT) {
>> +			dsi->te_gpio = NULL;
>> +			return 0;
>> +		}
>> +
>> +		dev_err(dsi->dev, "Could not get TE gpio: %d\n", err);
>> +		return err;
>> +	}
>> +
>> +	te_irq = gpiod_to_irq(dsi->te_gpio);
> 
> Could this fail ?

Yes, I'll add error handling.

>> +	irq_set_status_flags(te_irq, IRQ_NOAUTOEN);
>> +
>> +	err = request_threaded_irq(te_irq, omap_dsi_te_irq_handler, NULL,
>> +				   IRQF_TRIGGER_RISING, "TE", dsi);
> 
> What's the reason to request a threaded IRQ instead of a regular IRQ if
> the threaded handler is NULL ?

Probably just a mistake. I'll change this to use the threaded handler.

>> +	if (err) {
>> +		dev_err(dsi->dev, "request irq failed with %d\n", err);
>> +		gpiod_put(dsi->te_gpio);
>> +		return err;
>> +	}
>> +
>> +	INIT_DEFERRABLE_WORK(&dsi->te_timeout_work,
>> +			     omap_dsi_te_timeout_work_callback);
>> +
>> +	dev_dbg(dsi->dev, "Using GPIO TE\n");
>> +
>> +	return 0;
>> +}
>> +
>> +static void omap_dsi_unregister_te_irq(struct dsi_data *dsi)
>> +{
>> +	if (dsi->te_gpio) {
>> +		free_irq(gpiod_to_irq(dsi->te_gpio), dsi);
> 
> You could store the IRQ number in dsi_data to avoid recomputing it.

Yep.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver
  2020-11-09 13:27         ` Sebastian Reichel
@ 2020-11-11 13:35           ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 13:35 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Laurent Pinchart, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller

On 09/11/2020 15:27, Sebastian Reichel wrote:
> Hi,
> 
> On Mon, Nov 09, 2020 at 12:08:33PM +0200, Tomi Valkeinen wrote:
>> On 09/11/2020 11:52, Laurent Pinchart wrote:
>>> Hi Tomi,
>>>
>>> Thank you for the patch.
>>>
>>> On Thu, Nov 05, 2020 at 02:03:04PM +0200, Tomi Valkeinen wrote:
>>>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>>>
>>>> This moves the bus locking into the host driver and unexports
>>>> the custom API in preparation for drm_panel support.
>>>>
>>>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>>>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>>
>> <snip>
>>
>>>>  static int dsicm_update(struct omap_dss_device *dssdev,
>>>> @@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>>>  	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>>>>  
>>>>  	mutex_lock(&ddata->lock);
>>>> -	src->ops->dsi.bus_lock(src);
>>>>  
>>>>  	r = dsicm_wake_up(ddata);
>>>>  	if (r)
>>>> @@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>>>  	if (r)
>>>>  		goto err;
>>>>  
>>>> -	/* note: no bus_unlock here. unlock is src framedone_cb */
>>>> -	mutex_unlock(&ddata->lock);
>>>> +	/* note: no unlock here. unlock is src framedone_cb */
>>>
>>> This change isn't described in the commit message. Could you explain why
>>> it's needed ? Locking a mutex in a function and unlocking it elsewhere
>>> always scares me.
>>
>> Good catch. I don't know why it is needed. I don't think it is, as
>> the dsi driver handles the bus lock.
>>
>> Sebastian, what was the reason for this lock?
>>
>> Note that this goes away in the series, and there's no such lock
>> in the end.
> 
> It's not really a change. What this patch basically does is to fold
> src->ops->dsi.bus_lock(src) into mutex_lock(&ddata->lock), so that
> there is only a single locking mechanism. This function previously
> had a matching pair of mutex_lock/unlock for ddata->lock, but the
> bus was not locked paired. So after conversion the lock must not be
> free'd here.
> 
> My understanding is, that this is because the bus must not be used
> until the update has been done.

So as I said, I think keeping ddata->lock is not correct. This code also goes away some patches
later. So I'll drop the "keep ddata->lock" part.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver
@ 2020-11-11 13:35           ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 13:35 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori, dri-devel,
	Laurent Pinchart, linux-omap, Nikhil Devshatwar

On 09/11/2020 15:27, Sebastian Reichel wrote:
> Hi,
> 
> On Mon, Nov 09, 2020 at 12:08:33PM +0200, Tomi Valkeinen wrote:
>> On 09/11/2020 11:52, Laurent Pinchart wrote:
>>> Hi Tomi,
>>>
>>> Thank you for the patch.
>>>
>>> On Thu, Nov 05, 2020 at 02:03:04PM +0200, Tomi Valkeinen wrote:
>>>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>>>
>>>> This moves the bus locking into the host driver and unexports
>>>> the custom API in preparation for drm_panel support.
>>>>
>>>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>>>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>>
>> <snip>
>>
>>>>  static int dsicm_update(struct omap_dss_device *dssdev,
>>>> @@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>>>  	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>>>>  
>>>>  	mutex_lock(&ddata->lock);
>>>> -	src->ops->dsi.bus_lock(src);
>>>>  
>>>>  	r = dsicm_wake_up(ddata);
>>>>  	if (r)
>>>> @@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>>>  	if (r)
>>>>  		goto err;
>>>>  
>>>> -	/* note: no bus_unlock here. unlock is src framedone_cb */
>>>> -	mutex_unlock(&ddata->lock);
>>>> +	/* note: no unlock here. unlock is src framedone_cb */
>>>
>>> This change isn't described in the commit message. Could you explain why
>>> it's needed ? Locking a mutex in a function and unlocking it elsewhere
>>> always scares me.
>>
>> Good catch. I don't know why it is needed. I don't think it is, as
>> the dsi driver handles the bus lock.
>>
>> Sebastian, what was the reason for this lock?
>>
>> Note that this goes away in the series, and there's no such lock
>> in the end.
> 
> It's not really a change. What this patch basically does is to fold
> src->ops->dsi.bus_lock(src) into mutex_lock(&ddata->lock), so that
> there is only a single locking mechanism. This function previously
> had a matching pair of mutex_lock/unlock for ddata->lock, but the
> bus was not locked paired. So after conversion the lock must not be
> free'd here.
> 
> My understanding is, that this is because the bus must not be used
> until the update has been done.

So as I said, I think keeping ddata->lock is not correct. This code also goes away some patches
later. So I'll drop the "keep ddata->lock" part.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 28/56] drm/omap: dsi: untangle ulps ops from enable/disable
  2020-11-09  9:57     ` Laurent Pinchart
@ 2020-11-11 14:05       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 14:05 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 09/11/2020 11:57, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:05PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> Create a custom function pointer for ULPS and use it instead of
>> reusing disable/enable functions for ULPS mode switch. This allows
>> us to use the common disable/enable functions pointers for DSI.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  8 ++--
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 42 ++++++++++++++-----
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  5 +--
>>  3 files changed, 38 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index 4be0c9dbcc43..78247dcb1848 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -233,7 +233,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>>  	if (r)
>>  		goto err;
>>  
>> -	src->ops->dsi.disable(src, false, true);
>> +	src->ops->dsi.ulps(src, true);
>>  
>>  	ddata->ulps_enabled = true;
>>  
>> @@ -258,7 +258,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>>  	if (!ddata->ulps_enabled)
>>  		return 0;
>>  
>> -	src->ops->enable(src);
>> +	src->ops->dsi.ulps(src, false);
>>  	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>>  
>>  	r = _dsicm_enable_te(ddata, ddata->te_enabled);
>> @@ -586,7 +586,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>>  
>>  	dsicm_hw_reset(ddata);
>>  
>> -	src->ops->dsi.disable(src, true, false);
>> +	src->ops->disable(src);
>>  err_regulators:
>>  	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>>  	if (r)
>> @@ -612,7 +612,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>>  		dsicm_hw_reset(ddata);
>>  	}
>>  
>> -	src->ops->dsi.disable(src, true, false);
>> +	src->ops->disable(src);
>>  
>>  	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>>  	if (r)
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index d54b743c2b48..937362ade4b4 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -4055,13 +4055,10 @@ static void dsi_display_uninit_dsi(struct dsi_data *dsi, bool disconnect_lanes,
>>  	}
>>  }
>>  
>> -static void dsi_display_enable(struct omap_dss_device *dssdev)
>> +static void dsi_display_ulps_enable(struct dsi_data *dsi)
>>  {
>> -	struct dsi_data *dsi = to_dsi_data(dssdev);
>>  	int r;
>>  
>> -	DSSDBG("dsi_display_enable\n");
>> -
>>  	WARN_ON(!dsi_bus_is_locked(dsi));
>>  
>>  	mutex_lock(&dsi->lock);
>> @@ -4084,16 +4081,19 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
>>  	dsi_runtime_put(dsi);
>>  err_get_dsi:
>>  	mutex_unlock(&dsi->lock);
>> -	DSSDBG("dsi_display_enable FAILED\n");
>> +	DSSDBG("dsi_display_ulps_enable FAILED\n");
>>  }
>>  
>> -static void dsi_display_disable(struct omap_dss_device *dssdev,
>> -		bool disconnect_lanes, bool enter_ulps)
>> +static void dsi_display_enable(struct omap_dss_device *dssdev)
>>  {
>>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>> +	DSSDBG("dsi_display_enable\n");
>> +	dsi_display_ulps_enable(dsi);
>> +}
>>  
>> -	DSSDBG("dsi_display_disable\n");
>> -
>> +static void dsi_display_ulps_disable(struct dsi_data *dsi,
>> +		bool disconnect_lanes, bool enter_ulps)
>> +{
>>  	WARN_ON(!dsi_bus_is_locked(dsi));
>>  
>>  	mutex_lock(&dsi->lock);
>> @@ -4110,6 +4110,27 @@ static void dsi_display_disable(struct omap_dss_device *dssdev,
>>  	mutex_unlock(&dsi->lock);
>>  }
>>  
>> +static void dsi_display_disable(struct omap_dss_device *dssdev)
>> +{
>> +	struct dsi_data *dsi = to_dsi_data(dssdev);
>> +
>> +	DSSDBG("dsi_display_disable\n");
>> +
>> +	dsi_display_ulps_disable(dsi, true, false);
>> +}
>> +
>> +static void dsi_ulps(struct omap_dss_device *dssdev, bool enable)
>> +{
>> +	struct dsi_data *dsi = to_dsi_data(dssdev);
>> +
>> +	DSSDBG("dsi_ulps\n");
>> +
>> +	if (enable)
>> +		dsi_display_ulps_disable(dsi, false, true);
>> +	else
>> +		dsi_display_ulps_enable(dsi);
> 
> The names are fairly confusing. I would expect
> dsi_display_ulps_disable() to disable ULPS mode.

It is fairly confusing naming. It's actually something like dsi_display_displaye_featuring_ulps.
I'll rename those to

_dsi_display_disable and _dsi_display_enable. So they're just lower level enable/disable functions,
which also handle ulps.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 28/56] drm/omap: dsi: untangle ulps ops from enable/disable
@ 2020-11-11 14:05       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 14:05 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 09/11/2020 11:57, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:05PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> Create a custom function pointer for ULPS and use it instead of
>> reusing disable/enable functions for ULPS mode switch. This allows
>> us to use the common disable/enable functions pointers for DSI.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  8 ++--
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 42 ++++++++++++++-----
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  5 +--
>>  3 files changed, 38 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index 4be0c9dbcc43..78247dcb1848 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -233,7 +233,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>>  	if (r)
>>  		goto err;
>>  
>> -	src->ops->dsi.disable(src, false, true);
>> +	src->ops->dsi.ulps(src, true);
>>  
>>  	ddata->ulps_enabled = true;
>>  
>> @@ -258,7 +258,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>>  	if (!ddata->ulps_enabled)
>>  		return 0;
>>  
>> -	src->ops->enable(src);
>> +	src->ops->dsi.ulps(src, false);
>>  	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>>  
>>  	r = _dsicm_enable_te(ddata, ddata->te_enabled);
>> @@ -586,7 +586,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>>  
>>  	dsicm_hw_reset(ddata);
>>  
>> -	src->ops->dsi.disable(src, true, false);
>> +	src->ops->disable(src);
>>  err_regulators:
>>  	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>>  	if (r)
>> @@ -612,7 +612,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>>  		dsicm_hw_reset(ddata);
>>  	}
>>  
>> -	src->ops->dsi.disable(src, true, false);
>> +	src->ops->disable(src);
>>  
>>  	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>>  	if (r)
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index d54b743c2b48..937362ade4b4 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -4055,13 +4055,10 @@ static void dsi_display_uninit_dsi(struct dsi_data *dsi, bool disconnect_lanes,
>>  	}
>>  }
>>  
>> -static void dsi_display_enable(struct omap_dss_device *dssdev)
>> +static void dsi_display_ulps_enable(struct dsi_data *dsi)
>>  {
>> -	struct dsi_data *dsi = to_dsi_data(dssdev);
>>  	int r;
>>  
>> -	DSSDBG("dsi_display_enable\n");
>> -
>>  	WARN_ON(!dsi_bus_is_locked(dsi));
>>  
>>  	mutex_lock(&dsi->lock);
>> @@ -4084,16 +4081,19 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
>>  	dsi_runtime_put(dsi);
>>  err_get_dsi:
>>  	mutex_unlock(&dsi->lock);
>> -	DSSDBG("dsi_display_enable FAILED\n");
>> +	DSSDBG("dsi_display_ulps_enable FAILED\n");
>>  }
>>  
>> -static void dsi_display_disable(struct omap_dss_device *dssdev,
>> -		bool disconnect_lanes, bool enter_ulps)
>> +static void dsi_display_enable(struct omap_dss_device *dssdev)
>>  {
>>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>> +	DSSDBG("dsi_display_enable\n");
>> +	dsi_display_ulps_enable(dsi);
>> +}
>>  
>> -	DSSDBG("dsi_display_disable\n");
>> -
>> +static void dsi_display_ulps_disable(struct dsi_data *dsi,
>> +		bool disconnect_lanes, bool enter_ulps)
>> +{
>>  	WARN_ON(!dsi_bus_is_locked(dsi));
>>  
>>  	mutex_lock(&dsi->lock);
>> @@ -4110,6 +4110,27 @@ static void dsi_display_disable(struct omap_dss_device *dssdev,
>>  	mutex_unlock(&dsi->lock);
>>  }
>>  
>> +static void dsi_display_disable(struct omap_dss_device *dssdev)
>> +{
>> +	struct dsi_data *dsi = to_dsi_data(dssdev);
>> +
>> +	DSSDBG("dsi_display_disable\n");
>> +
>> +	dsi_display_ulps_disable(dsi, true, false);
>> +}
>> +
>> +static void dsi_ulps(struct omap_dss_device *dssdev, bool enable)
>> +{
>> +	struct dsi_data *dsi = to_dsi_data(dssdev);
>> +
>> +	DSSDBG("dsi_ulps\n");
>> +
>> +	if (enable)
>> +		dsi_display_ulps_disable(dsi, false, true);
>> +	else
>> +		dsi_display_ulps_enable(dsi);
> 
> The names are fairly confusing. I would expect
> dsi_display_ulps_disable() to disable ULPS mode.

It is fairly confusing naming. It's actually something like dsi_display_displaye_featuring_ulps.
I'll rename those to

_dsi_display_disable and _dsi_display_enable. So they're just lower level enable/disable functions,
which also handle ulps.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 29/56] drm/omap: dsi: do ULPS in host driver
  2020-11-09 10:03     ` Laurent Pinchart
@ 2020-11-11 15:29       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 15:29 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 09/11/2020 12:03, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:06PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> Move ULPS handling into the DSI host controller, so that we
>> no longer need a custom API for the DSI client.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 273 +-----------------
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             |  63 +++-
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |   2 -
>>  3 files changed, 62 insertions(+), 276 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index 78247dcb1848..030a8fa140db 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -16,7 +16,6 @@
>>  #include <linux/module.h>
>>  #include <linux/sched/signal.h>
>>  #include <linux/slab.h>
>> -#include <linux/workqueue.h>
>>  #include <linux/of_device.h>
>>  #include <linux/regulator/consumer.h>
>>  
>> @@ -69,21 +68,13 @@ struct panel_drv_data {
>>  
>>  	bool intro_printed;
>>  
>> -	struct workqueue_struct *workqueue;
>> -
>>  	bool ulps_enabled;
>> -	unsigned int ulps_timeout;
>> -	struct delayed_work ulps_work;
>>  };
>>  
>>  #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
>>  
>>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>>  
>> -static int dsicm_panel_reset(struct panel_drv_data *ddata);
>> -
>> -static void dsicm_ulps_work(struct work_struct *work);
>> -
>>  static void dsicm_bl_power(struct panel_drv_data *ddata, bool enable)
>>  {
>>  	struct backlight_device *backlight;
>> @@ -207,94 +198,6 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
>>  	return 0;
>>  }
>>  
>> -static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
>> -{
>> -	if (ddata->ulps_timeout > 0)
>> -		queue_delayed_work(ddata->workqueue, &ddata->ulps_work,
>> -				msecs_to_jiffies(ddata->ulps_timeout));
>> -}
>> -
>> -static void dsicm_cancel_ulps_work(struct panel_drv_data *ddata)
>> -{
>> -	cancel_delayed_work(&ddata->ulps_work);
>> -}
>> -
>> -static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>> -{
>> -	struct omap_dss_device *src = ddata->src;
>> -	int r;
>> -
>> -	if (ddata->ulps_enabled)
>> -		return 0;
>> -
>> -	dsicm_cancel_ulps_work(ddata);
>> -
>> -	r = _dsicm_enable_te(ddata, false);
>> -	if (r)
>> -		goto err;
>> -
>> -	src->ops->dsi.ulps(src, true);
>> -
>> -	ddata->ulps_enabled = true;
>> -
>> -	return 0;
>> -
>> -err:
>> -	dev_err(&ddata->dsi->dev, "enter ULPS failed");
>> -	dsicm_panel_reset(ddata);
>> -
>> -	ddata->ulps_enabled = false;
>> -
>> -	dsicm_queue_ulps_work(ddata);
>> -
>> -	return r;
>> -}
>> -
>> -static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>> -{
>> -	struct omap_dss_device *src = ddata->src;
>> -	int r;
>> -
>> -	if (!ddata->ulps_enabled)
>> -		return 0;
>> -
>> -	src->ops->dsi.ulps(src, false);
>> -	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>> -
>> -	r = _dsicm_enable_te(ddata, ddata->te_enabled);
>> -	if (r) {
>> -		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
>> -		goto err2;
>> -	}
>> -
>> -	dsicm_queue_ulps_work(ddata);
>> -
>> -	ddata->ulps_enabled = false;
>> -
>> -	return 0;
>> -
>> -err2:
>> -	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
>> -
>> -	r = dsicm_panel_reset(ddata);
>> -	if (!r)
>> -		ddata->ulps_enabled = false;
>> -
>> -	dsicm_queue_ulps_work(ddata);
>> -
>> -	return r;
>> -}
>> -
>> -static int dsicm_wake_up(struct panel_drv_data *ddata)
>> -{
>> -	if (ddata->ulps_enabled)
>> -		return dsicm_exit_ulps(ddata);
>> -
>> -	dsicm_cancel_ulps_work(ddata);
>> -	dsicm_queue_ulps_work(ddata);
>> -	return 0;
>> -}
>> -
>>  static int dsicm_bl_update_status(struct backlight_device *dev)
>>  {
>>  	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
>> @@ -312,11 +215,8 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
>>  	mutex_lock(&ddata->lock);
>>  
>>  	if (ddata->enabled) {
>> -		r = dsicm_wake_up(ddata);
>> -		if (!r) {
>> -			r = dsicm_dcs_write_1(ddata,
>> -				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
>> -		}
>> +		r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
>> +				      level);
>>  	}
>>  
>>  	mutex_unlock(&ddata->lock);
>> @@ -343,18 +243,12 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
>>  {
>>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>>  	u8 errors = 0;
>> -	int r;
>> +	int r = -ENODEV;
>>  
>>  	mutex_lock(&ddata->lock);
>>  
>> -	if (ddata->enabled) {
>> -		r = dsicm_wake_up(ddata);
>> -		if (!r)
>> -			r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
>> -					&errors);
>> -	} else {
>> -		r = -ENODEV;
>> -	}
>> +	if (ddata->enabled)
>> +		r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS, &errors);
>>  
>>  	mutex_unlock(&ddata->lock);
>>  
>> @@ -369,17 +263,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
>>  {
>>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>>  	u8 id1, id2, id3;
>> -	int r;
>> +	int r = -ENODEV;
>>  
>>  	mutex_lock(&ddata->lock);
>>  
>> -	if (ddata->enabled) {
>> -		r = dsicm_wake_up(ddata);
>> -		if (!r)
>> -			r = dsicm_get_id(ddata, &id1, &id2, &id3);
>> -	} else {
>> -		r = -ENODEV;
>> -	}
>> +	if (ddata->enabled)
>> +		r = dsicm_get_id(ddata, &id1, &id2, &id3);
>>  
>>  	mutex_unlock(&ddata->lock);
>>  
>> @@ -389,103 +278,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
>>  	return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
>>  }
>>  
>> -static ssize_t dsicm_store_ulps(struct device *dev,
>> -		struct device_attribute *attr,
>> -		const char *buf, size_t count)
>> -{
>> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>> -	unsigned long t;
>> -	int r;
>> -
>> -	r = kstrtoul(buf, 0, &t);
>> -	if (r)
>> -		return r;
>> -
>> -	mutex_lock(&ddata->lock);
>> -
>> -	if (ddata->enabled) {
>> -		if (t)
>> -			r = dsicm_enter_ulps(ddata);
>> -		else
>> -			r = dsicm_wake_up(ddata);
>> -	}
>> -
>> -	mutex_unlock(&ddata->lock);
>> -
>> -	if (r)
>> -		return r;
>> -
>> -	return count;
>> -}
>> -
>> -static ssize_t dsicm_show_ulps(struct device *dev,
>> -		struct device_attribute *attr,
>> -		char *buf)
>> -{
>> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>> -	unsigned int t;
>> -
>> -	mutex_lock(&ddata->lock);
>> -	t = ddata->ulps_enabled;
>> -	mutex_unlock(&ddata->lock);
>> -
>> -	return snprintf(buf, PAGE_SIZE, "%u\n", t);
>> -}
>> -
>> -static ssize_t dsicm_store_ulps_timeout(struct device *dev,
>> -		struct device_attribute *attr,
>> -		const char *buf, size_t count)
>> -{
>> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>> -	unsigned long t;
>> -	int r;
>> -
>> -	r = kstrtoul(buf, 0, &t);
>> -	if (r)
>> -		return r;
>> -
>> -	mutex_lock(&ddata->lock);
>> -	ddata->ulps_timeout = t;
>> -
>> -	if (ddata->enabled) {
>> -		/* dsicm_wake_up will restart the timer */
>> -		r = dsicm_wake_up(ddata);
>> -	}
>> -
>> -	mutex_unlock(&ddata->lock);
>> -
>> -	if (r)
>> -		return r;
>> -
>> -	return count;
>> -}
>> -
>> -static ssize_t dsicm_show_ulps_timeout(struct device *dev,
>> -		struct device_attribute *attr,
>> -		char *buf)
>> -{
>> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>> -	unsigned int t;
>> -
>> -	mutex_lock(&ddata->lock);
>> -	t = ddata->ulps_timeout;
>> -	mutex_unlock(&ddata->lock);
>> -
>> -	return snprintf(buf, PAGE_SIZE, "%u\n", t);
>> -}
>> -
>>  static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
>>  static DEVICE_ATTR(hw_revision, S_IRUGO, dsicm_hw_revision_show, NULL);
>> -static DEVICE_ATTR(ulps, S_IRUGO | S_IWUSR,
>> -		dsicm_show_ulps, dsicm_store_ulps);
>> -static DEVICE_ATTR(ulps_timeout, S_IRUGO | S_IWUSR,
>> -		dsicm_show_ulps_timeout, dsicm_store_ulps_timeout);
>>  
>>  static struct attribute *dsicm_attrs[] = {
>>  	&dev_attr_num_dsi_errors.attr,
>>  	&dev_attr_hw_revision.attr,
>> -	&dev_attr_ulps.attr,
>> -	&dev_attr_ulps_timeout.attr,
>>  	NULL,
>>  };
>>  
>> @@ -621,15 +419,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>>  	ddata->enabled = false;
>>  }
>>  
>> -static int dsicm_panel_reset(struct panel_drv_data *ddata)
>> -{
>> -	dev_err(&ddata->dsi->dev, "performing LCD reset\n");
>> -
>> -	dsicm_power_off(ddata);
>> -	dsicm_hw_reset(ddata);
>> -	return dsicm_power_on(ddata);
>> -}
>> -
>>  static int dsicm_connect(struct omap_dss_device *src,
>>  			 struct omap_dss_device *dst)
>>  {
>> @@ -671,17 +460,12 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>>  static void dsicm_disable(struct omap_dss_device *dssdev)
>>  {
>>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> -	int r;
>>  
>>  	dsicm_bl_power(ddata, false);
>>  
>>  	mutex_lock(&ddata->lock);
>>  
>> -	dsicm_cancel_ulps_work(ddata);
>> -
>> -	r = dsicm_wake_up(ddata);
>> -	if (!r)
>> -		dsicm_power_off(ddata);
>> +	dsicm_power_off(ddata);
>>  
>>  	mutex_unlock(&ddata->lock);
>>  }
>> @@ -705,10 +489,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>  
>>  	mutex_lock(&ddata->lock);
>>  
>> -	r = dsicm_wake_up(ddata);
>> -	if (r)
>> -		goto err;
>> -
>>  	if (!ddata->enabled) {
>>  		r = 0;
>>  		goto err;
>> @@ -748,24 +528,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>>  	return r;
>>  }
>>  
>> -static void dsicm_ulps_work(struct work_struct *work)
>> -{
>> -	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
>> -			ulps_work.work);
>> -	struct omap_dss_device *dssdev = &ddata->dssdev;
>> -
>> -	mutex_lock(&ddata->lock);
>> -
>> -	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || !ddata->enabled) {
>> -		mutex_unlock(&ddata->lock);
>> -		return;
>> -	}
>> -
>> -	dsicm_enter_ulps(ddata);
>> -
>> -	mutex_unlock(&ddata->lock);
>> -}
>> -
>>  static int dsicm_get_modes(struct omap_dss_device *dssdev,
>>  			   struct drm_connector *connector)
>>  {
>> @@ -863,7 +625,7 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>>  	else
>>  		ddata->use_dsi_backlight = true;
>>  
>> -	/* TODO: ulps */
>> +	/* TODO: ulps_enabled */
>>  
>>  	return 0;
>>  }
>> @@ -911,13 +673,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  
>>  	mutex_init(&ddata->lock);
>>  
>> -	ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
>> -	if (!ddata->workqueue) {
>> -		r = -ENOMEM;
>> -		goto err_reg;
>> -	}
>> -	INIT_DELAYED_WORK(&ddata->ulps_work, dsicm_ulps_work);
>> -
>>  	dsicm_hw_reset(ddata);
>>  
>>  	if (ddata->use_dsi_backlight) {
>> @@ -948,6 +703,9 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  	dsi->hs_rate = 300000000;
>>  	dsi->lp_rate = 10000000;
>>  
>> +	if (ddata->ulps_enabled)
>> +		dsi->mode_flags |= MIPI_DSI_MODE_ULPS_IDLE;
>> +
>>  	r = mipi_dsi_attach(dsi);
>>  	if (r < 0)
>>  		goto err_dsi_attach;
>> @@ -957,8 +715,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  err_dsi_attach:
>>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>>  err_bl:
>> -	destroy_workqueue(ddata->workqueue);
>> -err_reg:
>>  	if (ddata->extbldev)
>>  		put_device(&ddata->extbldev->dev);
>>  
>> @@ -985,9 +741,6 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>>  	if (ddata->extbldev)
>>  		put_device(&ddata->extbldev->dev);
>>  
>> -	dsicm_cancel_ulps_work(ddata);
>> -	destroy_workqueue(ddata->workqueue);
>> -
>>  	/* reset, to be sure that the panel is in a valid state */
>>  	dsicm_hw_reset(ddata);
>>  
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index 937362ade4b4..0f264654792d 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -207,6 +207,8 @@ struct dsi_reg { u16 module; u16 idx; };
>>  typedef void (*omap_dsi_isr_t) (void *arg, u32 mask);
>>  struct dsi_data;
>>  
>> +static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable);
>> +
> 
> Would it be possible to avoid forward declarations by reordering
> functions ?

Maybe, but doing it here leads to lots of conflicts...

> This patch removes the ability for userspace to configure the ULPS
> timeout (and thus, if I understand correctly, to disable the auto-ULPS
> feature). I understand the simplification is needed, but I can't tell if
> the feature removal could have an adverse effect.

Using ULPS may reduce power consumption in some cases, but to be honest, I'm not sure if it's worth
it or not, and I find it unlikely that anyone has used or dependend on it. I think it's something
that people can finetune afterwards if they really need it.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 29/56] drm/omap: dsi: do ULPS in host driver
@ 2020-11-11 15:29       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 15:29 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 09/11/2020 12:03, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:06PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> Move ULPS handling into the DSI host controller, so that we
>> no longer need a custom API for the DSI client.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 273 +-----------------
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             |  63 +++-
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |   2 -
>>  3 files changed, 62 insertions(+), 276 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index 78247dcb1848..030a8fa140db 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -16,7 +16,6 @@
>>  #include <linux/module.h>
>>  #include <linux/sched/signal.h>
>>  #include <linux/slab.h>
>> -#include <linux/workqueue.h>
>>  #include <linux/of_device.h>
>>  #include <linux/regulator/consumer.h>
>>  
>> @@ -69,21 +68,13 @@ struct panel_drv_data {
>>  
>>  	bool intro_printed;
>>  
>> -	struct workqueue_struct *workqueue;
>> -
>>  	bool ulps_enabled;
>> -	unsigned int ulps_timeout;
>> -	struct delayed_work ulps_work;
>>  };
>>  
>>  #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
>>  
>>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>>  
>> -static int dsicm_panel_reset(struct panel_drv_data *ddata);
>> -
>> -static void dsicm_ulps_work(struct work_struct *work);
>> -
>>  static void dsicm_bl_power(struct panel_drv_data *ddata, bool enable)
>>  {
>>  	struct backlight_device *backlight;
>> @@ -207,94 +198,6 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
>>  	return 0;
>>  }
>>  
>> -static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
>> -{
>> -	if (ddata->ulps_timeout > 0)
>> -		queue_delayed_work(ddata->workqueue, &ddata->ulps_work,
>> -				msecs_to_jiffies(ddata->ulps_timeout));
>> -}
>> -
>> -static void dsicm_cancel_ulps_work(struct panel_drv_data *ddata)
>> -{
>> -	cancel_delayed_work(&ddata->ulps_work);
>> -}
>> -
>> -static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>> -{
>> -	struct omap_dss_device *src = ddata->src;
>> -	int r;
>> -
>> -	if (ddata->ulps_enabled)
>> -		return 0;
>> -
>> -	dsicm_cancel_ulps_work(ddata);
>> -
>> -	r = _dsicm_enable_te(ddata, false);
>> -	if (r)
>> -		goto err;
>> -
>> -	src->ops->dsi.ulps(src, true);
>> -
>> -	ddata->ulps_enabled = true;
>> -
>> -	return 0;
>> -
>> -err:
>> -	dev_err(&ddata->dsi->dev, "enter ULPS failed");
>> -	dsicm_panel_reset(ddata);
>> -
>> -	ddata->ulps_enabled = false;
>> -
>> -	dsicm_queue_ulps_work(ddata);
>> -
>> -	return r;
>> -}
>> -
>> -static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>> -{
>> -	struct omap_dss_device *src = ddata->src;
>> -	int r;
>> -
>> -	if (!ddata->ulps_enabled)
>> -		return 0;
>> -
>> -	src->ops->dsi.ulps(src, false);
>> -	ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>> -
>> -	r = _dsicm_enable_te(ddata, ddata->te_enabled);
>> -	if (r) {
>> -		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
>> -		goto err2;
>> -	}
>> -
>> -	dsicm_queue_ulps_work(ddata);
>> -
>> -	ddata->ulps_enabled = false;
>> -
>> -	return 0;
>> -
>> -err2:
>> -	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
>> -
>> -	r = dsicm_panel_reset(ddata);
>> -	if (!r)
>> -		ddata->ulps_enabled = false;
>> -
>> -	dsicm_queue_ulps_work(ddata);
>> -
>> -	return r;
>> -}
>> -
>> -static int dsicm_wake_up(struct panel_drv_data *ddata)
>> -{
>> -	if (ddata->ulps_enabled)
>> -		return dsicm_exit_ulps(ddata);
>> -
>> -	dsicm_cancel_ulps_work(ddata);
>> -	dsicm_queue_ulps_work(ddata);
>> -	return 0;
>> -}
>> -
>>  static int dsicm_bl_update_status(struct backlight_device *dev)
>>  {
>>  	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
>> @@ -312,11 +215,8 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
>>  	mutex_lock(&ddata->lock);
>>  
>>  	if (ddata->enabled) {
>> -		r = dsicm_wake_up(ddata);
>> -		if (!r) {
>> -			r = dsicm_dcs_write_1(ddata,
>> -				MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
>> -		}
>> +		r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
>> +				      level);
>>  	}
>>  
>>  	mutex_unlock(&ddata->lock);
>> @@ -343,18 +243,12 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
>>  {
>>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>>  	u8 errors = 0;
>> -	int r;
>> +	int r = -ENODEV;
>>  
>>  	mutex_lock(&ddata->lock);
>>  
>> -	if (ddata->enabled) {
>> -		r = dsicm_wake_up(ddata);
>> -		if (!r)
>> -			r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
>> -					&errors);
>> -	} else {
>> -		r = -ENODEV;
>> -	}
>> +	if (ddata->enabled)
>> +		r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS, &errors);
>>  
>>  	mutex_unlock(&ddata->lock);
>>  
>> @@ -369,17 +263,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
>>  {
>>  	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>>  	u8 id1, id2, id3;
>> -	int r;
>> +	int r = -ENODEV;
>>  
>>  	mutex_lock(&ddata->lock);
>>  
>> -	if (ddata->enabled) {
>> -		r = dsicm_wake_up(ddata);
>> -		if (!r)
>> -			r = dsicm_get_id(ddata, &id1, &id2, &id3);
>> -	} else {
>> -		r = -ENODEV;
>> -	}
>> +	if (ddata->enabled)
>> +		r = dsicm_get_id(ddata, &id1, &id2, &id3);
>>  
>>  	mutex_unlock(&ddata->lock);
>>  
>> @@ -389,103 +278,12 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
>>  	return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
>>  }
>>  
>> -static ssize_t dsicm_store_ulps(struct device *dev,
>> -		struct device_attribute *attr,
>> -		const char *buf, size_t count)
>> -{
>> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>> -	unsigned long t;
>> -	int r;
>> -
>> -	r = kstrtoul(buf, 0, &t);
>> -	if (r)
>> -		return r;
>> -
>> -	mutex_lock(&ddata->lock);
>> -
>> -	if (ddata->enabled) {
>> -		if (t)
>> -			r = dsicm_enter_ulps(ddata);
>> -		else
>> -			r = dsicm_wake_up(ddata);
>> -	}
>> -
>> -	mutex_unlock(&ddata->lock);
>> -
>> -	if (r)
>> -		return r;
>> -
>> -	return count;
>> -}
>> -
>> -static ssize_t dsicm_show_ulps(struct device *dev,
>> -		struct device_attribute *attr,
>> -		char *buf)
>> -{
>> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>> -	unsigned int t;
>> -
>> -	mutex_lock(&ddata->lock);
>> -	t = ddata->ulps_enabled;
>> -	mutex_unlock(&ddata->lock);
>> -
>> -	return snprintf(buf, PAGE_SIZE, "%u\n", t);
>> -}
>> -
>> -static ssize_t dsicm_store_ulps_timeout(struct device *dev,
>> -		struct device_attribute *attr,
>> -		const char *buf, size_t count)
>> -{
>> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>> -	unsigned long t;
>> -	int r;
>> -
>> -	r = kstrtoul(buf, 0, &t);
>> -	if (r)
>> -		return r;
>> -
>> -	mutex_lock(&ddata->lock);
>> -	ddata->ulps_timeout = t;
>> -
>> -	if (ddata->enabled) {
>> -		/* dsicm_wake_up will restart the timer */
>> -		r = dsicm_wake_up(ddata);
>> -	}
>> -
>> -	mutex_unlock(&ddata->lock);
>> -
>> -	if (r)
>> -		return r;
>> -
>> -	return count;
>> -}
>> -
>> -static ssize_t dsicm_show_ulps_timeout(struct device *dev,
>> -		struct device_attribute *attr,
>> -		char *buf)
>> -{
>> -	struct panel_drv_data *ddata = dev_get_drvdata(dev);
>> -	unsigned int t;
>> -
>> -	mutex_lock(&ddata->lock);
>> -	t = ddata->ulps_timeout;
>> -	mutex_unlock(&ddata->lock);
>> -
>> -	return snprintf(buf, PAGE_SIZE, "%u\n", t);
>> -}
>> -
>>  static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
>>  static DEVICE_ATTR(hw_revision, S_IRUGO, dsicm_hw_revision_show, NULL);
>> -static DEVICE_ATTR(ulps, S_IRUGO | S_IWUSR,
>> -		dsicm_show_ulps, dsicm_store_ulps);
>> -static DEVICE_ATTR(ulps_timeout, S_IRUGO | S_IWUSR,
>> -		dsicm_show_ulps_timeout, dsicm_store_ulps_timeout);
>>  
>>  static struct attribute *dsicm_attrs[] = {
>>  	&dev_attr_num_dsi_errors.attr,
>>  	&dev_attr_hw_revision.attr,
>> -	&dev_attr_ulps.attr,
>> -	&dev_attr_ulps_timeout.attr,
>>  	NULL,
>>  };
>>  
>> @@ -621,15 +419,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>>  	ddata->enabled = false;
>>  }
>>  
>> -static int dsicm_panel_reset(struct panel_drv_data *ddata)
>> -{
>> -	dev_err(&ddata->dsi->dev, "performing LCD reset\n");
>> -
>> -	dsicm_power_off(ddata);
>> -	dsicm_hw_reset(ddata);
>> -	return dsicm_power_on(ddata);
>> -}
>> -
>>  static int dsicm_connect(struct omap_dss_device *src,
>>  			 struct omap_dss_device *dst)
>>  {
>> @@ -671,17 +460,12 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>>  static void dsicm_disable(struct omap_dss_device *dssdev)
>>  {
>>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> -	int r;
>>  
>>  	dsicm_bl_power(ddata, false);
>>  
>>  	mutex_lock(&ddata->lock);
>>  
>> -	dsicm_cancel_ulps_work(ddata);
>> -
>> -	r = dsicm_wake_up(ddata);
>> -	if (!r)
>> -		dsicm_power_off(ddata);
>> +	dsicm_power_off(ddata);
>>  
>>  	mutex_unlock(&ddata->lock);
>>  }
>> @@ -705,10 +489,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>  
>>  	mutex_lock(&ddata->lock);
>>  
>> -	r = dsicm_wake_up(ddata);
>> -	if (r)
>> -		goto err;
>> -
>>  	if (!ddata->enabled) {
>>  		r = 0;
>>  		goto err;
>> @@ -748,24 +528,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>>  	return r;
>>  }
>>  
>> -static void dsicm_ulps_work(struct work_struct *work)
>> -{
>> -	struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
>> -			ulps_work.work);
>> -	struct omap_dss_device *dssdev = &ddata->dssdev;
>> -
>> -	mutex_lock(&ddata->lock);
>> -
>> -	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || !ddata->enabled) {
>> -		mutex_unlock(&ddata->lock);
>> -		return;
>> -	}
>> -
>> -	dsicm_enter_ulps(ddata);
>> -
>> -	mutex_unlock(&ddata->lock);
>> -}
>> -
>>  static int dsicm_get_modes(struct omap_dss_device *dssdev,
>>  			   struct drm_connector *connector)
>>  {
>> @@ -863,7 +625,7 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>>  	else
>>  		ddata->use_dsi_backlight = true;
>>  
>> -	/* TODO: ulps */
>> +	/* TODO: ulps_enabled */
>>  
>>  	return 0;
>>  }
>> @@ -911,13 +673,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  
>>  	mutex_init(&ddata->lock);
>>  
>> -	ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
>> -	if (!ddata->workqueue) {
>> -		r = -ENOMEM;
>> -		goto err_reg;
>> -	}
>> -	INIT_DELAYED_WORK(&ddata->ulps_work, dsicm_ulps_work);
>> -
>>  	dsicm_hw_reset(ddata);
>>  
>>  	if (ddata->use_dsi_backlight) {
>> @@ -948,6 +703,9 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  	dsi->hs_rate = 300000000;
>>  	dsi->lp_rate = 10000000;
>>  
>> +	if (ddata->ulps_enabled)
>> +		dsi->mode_flags |= MIPI_DSI_MODE_ULPS_IDLE;
>> +
>>  	r = mipi_dsi_attach(dsi);
>>  	if (r < 0)
>>  		goto err_dsi_attach;
>> @@ -957,8 +715,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  err_dsi_attach:
>>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>>  err_bl:
>> -	destroy_workqueue(ddata->workqueue);
>> -err_reg:
>>  	if (ddata->extbldev)
>>  		put_device(&ddata->extbldev->dev);
>>  
>> @@ -985,9 +741,6 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>>  	if (ddata->extbldev)
>>  		put_device(&ddata->extbldev->dev);
>>  
>> -	dsicm_cancel_ulps_work(ddata);
>> -	destroy_workqueue(ddata->workqueue);
>> -
>>  	/* reset, to be sure that the panel is in a valid state */
>>  	dsicm_hw_reset(ddata);
>>  
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index 937362ade4b4..0f264654792d 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -207,6 +207,8 @@ struct dsi_reg { u16 module; u16 idx; };
>>  typedef void (*omap_dsi_isr_t) (void *arg, u32 mask);
>>  struct dsi_data;
>>  
>> +static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable);
>> +
> 
> Would it be possible to avoid forward declarations by reordering
> functions ?

Maybe, but doing it here leads to lots of conflicts...

> This patch removes the ability for userspace to configure the ULPS
> timeout (and thus, if I understand correctly, to disable the auto-ULPS
> feature). I understand the simplification is needed, but I can't tell if
> the feature removal could have an adverse effect.

Using ULPS may reduce power consumption in some cases, but to be honest, I'm not sure if it's worth
it or not, and I find it unlikely that anyone has used or dependend on it. I think it's something
that people can finetune afterwards if they really need it.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
  2020-11-09 10:10     ` Laurent Pinchart
@ 2020-11-11 15:34       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 15:34 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 09/11/2020 12:10, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:07PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> This moves the panel refresh/update function from the panel
>> driver into the DSI host driver to prepare for common drm_panel
>> support.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  68 ------------
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 101 ++++++++++++++++--
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  13 +--
>>  drivers/gpu/drm/omapdrm/omap_crtc.c           |  11 +-
>>  4 files changed, 97 insertions(+), 96 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index 030a8fa140db..1582960f9e90 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
>>  	return 0;
>>  }
>>  
>> -static int dsicm_set_update_window(struct panel_drv_data *ddata,
>> -		u16 x, u16 y, u16 w, u16 h)
>> -{
>> -	struct mipi_dsi_device *dsi = ddata->dsi;
>> -	int r;
>> -	u16 x1 = x;
>> -	u16 x2 = x + w - 1;
>> -	u16 y1 = y;
>> -	u16 y2 = y + h - 1;
>> -
>> -	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
>> -	if (r < 0)
>> -		return r;
>> -
>> -	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
>> -	if (r < 0)
>> -		return r;
>> -
>> -	return 0;
>> -}
>> -
> 
> I can't tell whether this is common to all command-mode panels, or if
> there could be a need for panel-specific update procedures, so I can't
> really ack this patch.

I can't say either, but all the command mode panels I know need and support this. And, afaik, we
have only the single cmd mode panel driver which we add in this series.

>>  static int dsicm_bl_update_status(struct backlight_device *dev)
>>  {
>>  	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
>> @@ -470,48 +449,6 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
>>  	mutex_unlock(&ddata->lock);
>>  }
>>  
>> -static void dsicm_framedone_cb(int err, void *data)
>> -{
>> -	struct panel_drv_data *ddata = data;
>> -
>> -	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
>> -	mutex_unlock(&ddata->lock);
>> -}
>> -
>> -static int dsicm_update(struct omap_dss_device *dssdev,
>> -				    u16 x, u16 y, u16 w, u16 h)
>> -{
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> -	struct omap_dss_device *src = ddata->src;
>> -	int r;
>> -
>> -	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>> -
>> -	mutex_lock(&ddata->lock);
>> -
>> -	if (!ddata->enabled) {
>> -		r = 0;
>> -		goto err;
>> -	}
>> -
>> -	/* XXX no need to send this every frame, but dsi break if not done */
>> -	r = dsicm_set_update_window(ddata, 0, 0, ddata->vm.hactive,
>> -				    ddata->vm.vactive);
>> -	if (r)
>> -		goto err;
>> -
>> -	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
>> -			ddata);
>> -	if (r)
>> -		goto err;
>> -
>> -	/* note: no unlock here. unlock is src framedone_cb */
>> -	return 0;
>> -err:
>> -	mutex_unlock(&ddata->lock);
>> -	return r;
>> -}
>> -
>>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>>  {
>>  	struct mipi_dsi_device *dsi = ddata->dsi;
>> @@ -572,10 +509,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
>>  	.check_timings	= dsicm_check_timings,
>>  };
>>  
>> -static const struct omap_dss_driver dsicm_dss_driver = {
>> -	.update		= dsicm_update,
>> -};
>> -
>>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>>  {
>>  	struct device_node *node = dsi->dev.of_node;
>> @@ -658,7 +591,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  	dssdev = &ddata->dssdev;
>>  	dssdev->dev = dev;
>>  	dssdev->ops = &dsicm_ops;
>> -	dssdev->driver = &dsicm_dss_driver;
>>  	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
>>  	dssdev->display = true;
>>  	dssdev->owner = THIS_MODULE;
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index 0f264654792d..0aa0d21cf896 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -214,6 +214,9 @@ static void dsi_display_uninit_dispc(struct dsi_data *dsi);
>>  
>>  static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
>>  
>> +static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
>> +				       const struct mipi_dsi_msg *msg);
>> +
>>  /* DSI PLL HSDIV indices */
>>  #define HSDIV_DISPC	0
>>  #define HSDIV_DSI	1
>> @@ -383,9 +386,6 @@ struct dsi_data {
>>  
>>  	struct delayed_work ulps_work;
>>  
>> -	void (*framedone_callback)(int, void *);
>> -	void *framedone_data;
>> -
>>  	struct delayed_work framedone_timeout_work;
>>  
>>  #ifdef DSI_CATCH_MISSING_TE
>> @@ -3802,8 +3802,6 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
>>  	dsi_set_ulps_auto(dsi, true);
>>  	dsi_bus_unlock(dsi);
>>  
>> -	dsi->framedone_callback(error, dsi->framedone_data);
>> -
>>  	if (!error)
>>  		dsi_perf_show(dsi, "DISPC");
>>  }
>> @@ -3835,6 +3833,8 @@ static void dsi_framedone_irq_callback(void *data)
>>  
>>  	cancel_delayed_work(&dsi->framedone_timeout_work);
>>  
>> +	DSSDBG("Framedone received!\n");
>> +
>>  	dsi_handle_framedone(dsi, 0);
>>  }
>>  
>> @@ -3856,17 +3856,69 @@ static int _dsi_update(struct dsi_data *dsi)
>>  	return 0;
>>  }
>>  
>> -static int dsi_update(struct omap_dss_device *dssdev, int channel,
>> -		void (*callback)(int, void *), void *data)
>> +static int _dsi_update_window(struct dsi_data *dsi, int channel,
>> +			      int x, int y, int w, int h)
>> +{
>> +	int x1 = x, x2 = (x + w - 1);
>> +	int y1 = y, y2 = (y + h - 1);
>> +	u8 payloadX[5] = { MIPI_DCS_SET_COLUMN_ADDRESS,
>> +			   x1 >> 8, x1 & 0xff, x2 >> 8, x2 & 0xff };
>> +	u8 payloadY[5] = { MIPI_DCS_SET_PAGE_ADDRESS,
>> +			   y1 >> 8, y1 & 0xff, y2 >> 8, y2 & 0xff };
>> +	struct mipi_dsi_msg msgX = { 0 }, msgY = { 0 };
>> +	int ret;
>> +
>> +	WARN_ON(!dsi_bus_is_locked(dsi));
>> +
>> +	msgX.type = MIPI_DSI_DCS_LONG_WRITE;
>> +	msgX.channel = channel;
>> +	msgX.tx_buf = payloadX;
>> +	msgX.tx_len = sizeof(payloadX);
>> +
>> +	msgY.type = MIPI_DSI_DCS_LONG_WRITE;
>> +	msgY.channel = channel;
>> +	msgY.tx_buf = payloadY;
>> +	msgY.tx_len = sizeof(payloadY);
>> +
>> +	ret = _omap_dsi_host_transfer(dsi, &msgX);
>> +	if (ret != 0)
>> +		return ret;
>> +
>> +	return _omap_dsi_host_transfer(dsi, &msgY);
>> +}
>> +
>> +static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
>>  {
>>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>> +	int r;
>> +
>> +	if (channel > 3)
>> +		return -EINVAL;
>>  
>>  	dsi_bus_lock(dsi);
>> +
>> +	if (!dsi->vc[channel].dest) {
>> +		r = -ENODEV;
>> +		goto err;
>> +	}
>> +
>> +	if (dsi->vm.hactive == 0 || dsi->vm.vactive == 0) {
>> +		r = -EINVAL;
>> +		goto err;
>> +	}
>> +
>> +	DSSDBG("dsi_update_channel: %d", channel);
>> +
>>  	dsi_set_ulps_auto(dsi, false);
>>  
>> +	r = _dsi_update_window(dsi, channel, 0, 0, dsi->vm.hactive,
>> +			       dsi->vm.vactive);
>> +	if (r < 0) {
>> +		DSSWARN("window update error: %d\n", r);
>> +		goto err;
>> +	}
>> +
>>  	dsi->update_channel = channel;
>> -	dsi->framedone_callback = callback;
>> -	dsi->framedone_data = data;
>>  
>>  	if (dsi->te_enabled && dsi->te_gpio) {
>>  		schedule_delayed_work(&dsi->te_timeout_work,
>> @@ -3877,6 +3929,24 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>>  	}
>>  
>>  	return 0;
>> +
>> +err:
>> +	dsi_set_ulps_auto(dsi, true);
>> +	dsi_bus_unlock(dsi);
>> +	return r;
>> +}
>> +
>> +static int dsi_update_all(struct omap_dss_device *dssdev)
>> +{
>> +	int i, r;
> 
> i should be unsigned as it's never negative.
> 
>> +
>> +	for (i = 0; i < 4; i++) {
>> +		r = dsi_update_channel(dssdev, i);
>> +		if (r != -ENODEV)
>> +			return r;
>> +	}
>> +
>> +	return r;
>>  }
>>  
>>  /* Display funcs */
>> @@ -4095,7 +4165,9 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
>>  {
>>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>>  	DSSDBG("dsi_display_enable\n");
>> +	dsi_bus_lock(dsi);
> 
> Why is the lock needed here now ? Should it be part of a previous patch
> ? Or, if I'm missing something, should the commit message explain this ?
> Same for the other locations below.

Yes, the locking should've been done in earlier patch. I moved them.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
@ 2020-11-11 15:34       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 15:34 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 09/11/2020 12:10, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:07PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> This moves the panel refresh/update function from the panel
>> driver into the DSI host driver to prepare for common drm_panel
>> support.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  68 ------------
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 101 ++++++++++++++++--
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  13 +--
>>  drivers/gpu/drm/omapdrm/omap_crtc.c           |  11 +-
>>  4 files changed, 97 insertions(+), 96 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index 030a8fa140db..1582960f9e90 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
>>  	return 0;
>>  }
>>  
>> -static int dsicm_set_update_window(struct panel_drv_data *ddata,
>> -		u16 x, u16 y, u16 w, u16 h)
>> -{
>> -	struct mipi_dsi_device *dsi = ddata->dsi;
>> -	int r;
>> -	u16 x1 = x;
>> -	u16 x2 = x + w - 1;
>> -	u16 y1 = y;
>> -	u16 y2 = y + h - 1;
>> -
>> -	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
>> -	if (r < 0)
>> -		return r;
>> -
>> -	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
>> -	if (r < 0)
>> -		return r;
>> -
>> -	return 0;
>> -}
>> -
> 
> I can't tell whether this is common to all command-mode panels, or if
> there could be a need for panel-specific update procedures, so I can't
> really ack this patch.

I can't say either, but all the command mode panels I know need and support this. And, afaik, we
have only the single cmd mode panel driver which we add in this series.

>>  static int dsicm_bl_update_status(struct backlight_device *dev)
>>  {
>>  	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
>> @@ -470,48 +449,6 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
>>  	mutex_unlock(&ddata->lock);
>>  }
>>  
>> -static void dsicm_framedone_cb(int err, void *data)
>> -{
>> -	struct panel_drv_data *ddata = data;
>> -
>> -	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
>> -	mutex_unlock(&ddata->lock);
>> -}
>> -
>> -static int dsicm_update(struct omap_dss_device *dssdev,
>> -				    u16 x, u16 y, u16 w, u16 h)
>> -{
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> -	struct omap_dss_device *src = ddata->src;
>> -	int r;
>> -
>> -	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>> -
>> -	mutex_lock(&ddata->lock);
>> -
>> -	if (!ddata->enabled) {
>> -		r = 0;
>> -		goto err;
>> -	}
>> -
>> -	/* XXX no need to send this every frame, but dsi break if not done */
>> -	r = dsicm_set_update_window(ddata, 0, 0, ddata->vm.hactive,
>> -				    ddata->vm.vactive);
>> -	if (r)
>> -		goto err;
>> -
>> -	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
>> -			ddata);
>> -	if (r)
>> -		goto err;
>> -
>> -	/* note: no unlock here. unlock is src framedone_cb */
>> -	return 0;
>> -err:
>> -	mutex_unlock(&ddata->lock);
>> -	return r;
>> -}
>> -
>>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>>  {
>>  	struct mipi_dsi_device *dsi = ddata->dsi;
>> @@ -572,10 +509,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
>>  	.check_timings	= dsicm_check_timings,
>>  };
>>  
>> -static const struct omap_dss_driver dsicm_dss_driver = {
>> -	.update		= dsicm_update,
>> -};
>> -
>>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>>  {
>>  	struct device_node *node = dsi->dev.of_node;
>> @@ -658,7 +591,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  	dssdev = &ddata->dssdev;
>>  	dssdev->dev = dev;
>>  	dssdev->ops = &dsicm_ops;
>> -	dssdev->driver = &dsicm_dss_driver;
>>  	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
>>  	dssdev->display = true;
>>  	dssdev->owner = THIS_MODULE;
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index 0f264654792d..0aa0d21cf896 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -214,6 +214,9 @@ static void dsi_display_uninit_dispc(struct dsi_data *dsi);
>>  
>>  static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
>>  
>> +static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
>> +				       const struct mipi_dsi_msg *msg);
>> +
>>  /* DSI PLL HSDIV indices */
>>  #define HSDIV_DISPC	0
>>  #define HSDIV_DSI	1
>> @@ -383,9 +386,6 @@ struct dsi_data {
>>  
>>  	struct delayed_work ulps_work;
>>  
>> -	void (*framedone_callback)(int, void *);
>> -	void *framedone_data;
>> -
>>  	struct delayed_work framedone_timeout_work;
>>  
>>  #ifdef DSI_CATCH_MISSING_TE
>> @@ -3802,8 +3802,6 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
>>  	dsi_set_ulps_auto(dsi, true);
>>  	dsi_bus_unlock(dsi);
>>  
>> -	dsi->framedone_callback(error, dsi->framedone_data);
>> -
>>  	if (!error)
>>  		dsi_perf_show(dsi, "DISPC");
>>  }
>> @@ -3835,6 +3833,8 @@ static void dsi_framedone_irq_callback(void *data)
>>  
>>  	cancel_delayed_work(&dsi->framedone_timeout_work);
>>  
>> +	DSSDBG("Framedone received!\n");
>> +
>>  	dsi_handle_framedone(dsi, 0);
>>  }
>>  
>> @@ -3856,17 +3856,69 @@ static int _dsi_update(struct dsi_data *dsi)
>>  	return 0;
>>  }
>>  
>> -static int dsi_update(struct omap_dss_device *dssdev, int channel,
>> -		void (*callback)(int, void *), void *data)
>> +static int _dsi_update_window(struct dsi_data *dsi, int channel,
>> +			      int x, int y, int w, int h)
>> +{
>> +	int x1 = x, x2 = (x + w - 1);
>> +	int y1 = y, y2 = (y + h - 1);
>> +	u8 payloadX[5] = { MIPI_DCS_SET_COLUMN_ADDRESS,
>> +			   x1 >> 8, x1 & 0xff, x2 >> 8, x2 & 0xff };
>> +	u8 payloadY[5] = { MIPI_DCS_SET_PAGE_ADDRESS,
>> +			   y1 >> 8, y1 & 0xff, y2 >> 8, y2 & 0xff };
>> +	struct mipi_dsi_msg msgX = { 0 }, msgY = { 0 };
>> +	int ret;
>> +
>> +	WARN_ON(!dsi_bus_is_locked(dsi));
>> +
>> +	msgX.type = MIPI_DSI_DCS_LONG_WRITE;
>> +	msgX.channel = channel;
>> +	msgX.tx_buf = payloadX;
>> +	msgX.tx_len = sizeof(payloadX);
>> +
>> +	msgY.type = MIPI_DSI_DCS_LONG_WRITE;
>> +	msgY.channel = channel;
>> +	msgY.tx_buf = payloadY;
>> +	msgY.tx_len = sizeof(payloadY);
>> +
>> +	ret = _omap_dsi_host_transfer(dsi, &msgX);
>> +	if (ret != 0)
>> +		return ret;
>> +
>> +	return _omap_dsi_host_transfer(dsi, &msgY);
>> +}
>> +
>> +static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
>>  {
>>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>> +	int r;
>> +
>> +	if (channel > 3)
>> +		return -EINVAL;
>>  
>>  	dsi_bus_lock(dsi);
>> +
>> +	if (!dsi->vc[channel].dest) {
>> +		r = -ENODEV;
>> +		goto err;
>> +	}
>> +
>> +	if (dsi->vm.hactive == 0 || dsi->vm.vactive == 0) {
>> +		r = -EINVAL;
>> +		goto err;
>> +	}
>> +
>> +	DSSDBG("dsi_update_channel: %d", channel);
>> +
>>  	dsi_set_ulps_auto(dsi, false);
>>  
>> +	r = _dsi_update_window(dsi, channel, 0, 0, dsi->vm.hactive,
>> +			       dsi->vm.vactive);
>> +	if (r < 0) {
>> +		DSSWARN("window update error: %d\n", r);
>> +		goto err;
>> +	}
>> +
>>  	dsi->update_channel = channel;
>> -	dsi->framedone_callback = callback;
>> -	dsi->framedone_data = data;
>>  
>>  	if (dsi->te_enabled && dsi->te_gpio) {
>>  		schedule_delayed_work(&dsi->te_timeout_work,
>> @@ -3877,6 +3929,24 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
>>  	}
>>  
>>  	return 0;
>> +
>> +err:
>> +	dsi_set_ulps_auto(dsi, true);
>> +	dsi_bus_unlock(dsi);
>> +	return r;
>> +}
>> +
>> +static int dsi_update_all(struct omap_dss_device *dssdev)
>> +{
>> +	int i, r;
> 
> i should be unsigned as it's never negative.
> 
>> +
>> +	for (i = 0; i < 4; i++) {
>> +		r = dsi_update_channel(dssdev, i);
>> +		if (r != -ENODEV)
>> +			return r;
>> +	}
>> +
>> +	return r;
>>  }
>>  
>>  /* Display funcs */
>> @@ -4095,7 +4165,9 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
>>  {
>>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>>  	DSSDBG("dsi_display_enable\n");
>> +	dsi_bus_lock(dsi);
> 
> Why is the lock needed here now ? Should it be part of a previous patch
> ? Or, if I'm missing something, should the commit message explain this ?
> Same for the other locations below.

Yes, the locking should've been done in earlier patch. I moved them.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 33/56] drm/omap: dsi: convert to drm_panel
  2020-11-09 10:39     ` Laurent Pinchart
@ 2020-11-11 15:54       ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 15:54 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 09/11/2020 12:39, Laurent Pinchart wrote:
> On Thu, Nov 05, 2020 at 02:03:10PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> This converts the DSI module to expect common drm_panel display
>> drivers instead of dssdev based ones.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 204 +++++++-----------
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 133 ++++++++++--
>>  .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |   1 -
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |   8 -
>>  4 files changed, 189 insertions(+), 157 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index d9b3444b4faf..3668b3f0aff2 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -6,8 +6,6 @@
>>   * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
>>   */
>>  
>> -/* #define DEBUG */
>> -
>>  #include <linux/backlight.h>
>>  #include <linux/delay.h>
>>  #include <linux/gpio/consumer.h>
>> @@ -20,11 +18,14 @@
>>  #include <linux/regulator/consumer.h>
>>  
>>  #include <drm/drm_connector.h>
>> +#include <drm/drm_mipi_dsi.h>
>> +#include <drm/drm_panel.h>
>> +#include <drm/drm_modes.h>
> 
> Alphabetically ordered please.
> 
>>  
>> +#include <video/display_timing.h>
>>  #include <video/mipi_display.h>
>>  #include <video/of_display_timing.h>
>> -
>> -#include "../dss/omapdss.h"
>> +#include <video/videomode.h>
>>  
>>  #define DCS_READ_NUM_ERRORS	0x05
>>  #define DCS_GET_ID1		0xda
>> @@ -35,11 +36,8 @@
>>  
>>  struct panel_drv_data {
>>  	struct mipi_dsi_device *dsi;
>> -
>> -	struct omap_dss_device dssdev;
>> -	struct omap_dss_device *src;
>> -
>> -	struct videomode vm;
>> +	struct drm_panel panel;
>> +	struct drm_display_mode mode;
>>  
>>  	struct mutex lock;
>>  
>> @@ -71,7 +69,11 @@ struct panel_drv_data {
>>  	bool ulps_enabled;
>>  };
>>  
>> -#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
>> +
> 
> A single blank line is enough.
> 
>> +static inline struct panel_drv_data *panel_to_ddata(struct drm_panel *panel)
>> +{
>> +	return container_of(panel, struct panel_drv_data, panel);
>> +}
>>  
>>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>>  
>> @@ -285,7 +287,6 @@ static void dsicm_hw_reset(struct panel_drv_data *ddata)
>>  
>>  static int dsicm_power_on(struct panel_drv_data *ddata)
>>  {
>> -	struct omap_dss_device *src = ddata->src;
>>  	u8 id1, id2, id3;
>>  	int r;
>>  
>> @@ -322,10 +323,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>>  	if (r)
>>  		goto err;
>>  
>> -	r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
>> -	if (r)
>> -		goto err;
>> -
>>  	ddata->enabled = true;
>>  
>>  	if (!ddata->intro_printed) {
>> @@ -345,15 +342,12 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>>  	return r;
>>  }
>>  
>> -static void dsicm_power_off(struct panel_drv_data *ddata)
>> +static int dsicm_power_off(struct panel_drv_data *ddata)
>>  {
>> -	struct omap_dss_device *src = ddata->src;
>>  	int r;
>>  
>>  	ddata->enabled = false;
>>  
>> -	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
>> -
>>  	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
>>  	if (!r)
>>  		r = dsicm_sleep_in(ddata);
>> @@ -363,51 +357,25 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>>  				"error disabling panel, issuing HW reset\n");
>>  		dsicm_hw_reset(ddata);
>>  	}
>> -}
>> -
>> -static int dsicm_connect(struct omap_dss_device *src,
>> -			 struct omap_dss_device *dst)
>> -{
>> -	struct panel_drv_data *ddata = to_panel_data(dst);
>> -
>> -	ddata->src = src;
>> -	return 0;
>> -}
>> -
>> -static void dsicm_disconnect(struct omap_dss_device *src,
>> -			     struct omap_dss_device *dst)
>> -{
>> -	struct panel_drv_data *ddata = to_panel_data(dst);
>>  
>> -	ddata->src = NULL;
>> +	return r;
>>  }
>>  
>> -static void dsicm_pre_enable(struct omap_dss_device *dssdev)
>> +static int dsicm_prepare(struct drm_panel *panel)
>>  {
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> -	struct omap_dss_device *src = ddata->src;
>> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>>  	int r;
>> -	struct omap_dss_dsi_config dsi_config = {
>> -		.vm = &ddata->vm,
>> -		.hs_clk_min = 150000000,
>> -		.hs_clk_max = 300000000,
>> -		.lp_clk_min = 7000000,
>> -		.lp_clk_max = 10000000,
>> -	};
>>  
>>  	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>>  	if (r)
>>  		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
>>  
>> -	r = src->ops->dsi.set_config(src, &dsi_config);
>> -	if (r) {
>> -		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
>> -	}
>> +	return r;
>>  }
>>  
>> -static void dsicm_enable(struct omap_dss_device *dssdev)
>> +static int dsicm_enable(struct drm_panel *panel)
>>  {
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>>  	int r;
>>  
>>  	mutex_lock(&ddata->lock);
>> @@ -420,33 +388,39 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>>  
>>  	dsicm_bl_power(ddata, true);
>>  
>> -	return;
>> +	return 0;
>>  err:
>> -	dev_dbg(&ddata->dsi->dev, "enable failed (%d)\n", r);
>> +	dev_err(&ddata->dsi->dev, "enable failed (%d)\n", r);
>>  	mutex_unlock(&ddata->lock);
>> +	return r;
>> +}
>> +
>> +static int dsicm_unprepare(struct drm_panel *panel)
>> +{
>> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>> +	int r;
>> +
>> +	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>> +	if (r)
>> +		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
>> +
>> +	return r;
>>  }
>>  
>> -static void dsicm_disable(struct omap_dss_device *dssdev)
>> +static int dsicm_disable(struct drm_panel *panel)
>>  {
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>> +	int r;
>>  
>>  	dsicm_bl_power(ddata, false);
>>  
>>  	mutex_lock(&ddata->lock);
>>  
>> -	dsicm_power_off(ddata);
>> +	r = dsicm_power_off(ddata);
>>  
>>  	mutex_unlock(&ddata->lock);
>> -}
>> -
>> -static void dsicm_post_disable(struct omap_dss_device *dssdev)
>> -{
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> -	int r;
>>  
>> -	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>> -	if (r)
>> -		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
>> +	return r;
>>  }
>>  
>>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>> @@ -465,50 +439,37 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>>  	return r;
>>  }
>>  
>> -static int dsicm_get_modes(struct omap_dss_device *dssdev,
>> +static int dsicm_get_modes(struct drm_panel *panel,
>>  			   struct drm_connector *connector)
>>  {
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>> +	struct drm_display_mode *mode;
>> +
>> +	mode = drm_mode_duplicate(connector->dev, &ddata->mode);
>> +	if (!mode) {
>> +		dev_err(&ddata->dsi->dev, "failed to add mode %ux%ux@%u kHz\n",
>> +			ddata->mode.hdisplay, ddata->mode.vdisplay,
>> +			ddata->mode.clock);
>> +		return -ENOMEM;
>> +	}
>> +
>> +	drm_mode_set_name(mode);
>> +	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>>  
>>  	connector->display_info.width_mm = ddata->width_mm;
>>  	connector->display_info.height_mm = ddata->height_mm;
>>  
>> -	return omapdss_display_get_modes(connector, &ddata->vm);
>> -}
>> -
>> -static int dsicm_check_timings(struct omap_dss_device *dssdev,
>> -			       struct drm_display_mode *mode)
>> -{
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> -	int ret = 0;
>> -
>> -	if (mode->hdisplay != ddata->vm.hactive)
>> -		ret = -EINVAL;
>> -
>> -	if (mode->vdisplay != ddata->vm.vactive)
>> -		ret = -EINVAL;
>> +	drm_mode_probed_add(connector, mode);
>>  
>> -	if (ret) {
>> -		dev_warn(dssdev->dev, "wrong resolution: %d x %d",
>> -			 mode->hdisplay, mode->vdisplay);
>> -		dev_warn(dssdev->dev, "panel resolution: %d x %d",
>> -			 ddata->vm.hactive, ddata->vm.vactive);
>> -	}
>> -
>> -	return ret;
>> +	return 1;
>>  }
>>  
>> -static const struct omap_dss_device_ops dsicm_ops = {
>> -	.connect	= dsicm_connect,
>> -	.disconnect	= dsicm_disconnect,
>> -
>> -	.pre_enable	= dsicm_pre_enable,
>> -	.enable		= dsicm_enable,
>> -	.disable	= dsicm_disable,
>> -	.post_disable	= dsicm_post_disable,
>> -
>> -	.get_modes	= dsicm_get_modes,
>> -	.check_timings	= dsicm_check_timings,
>> +static const struct drm_panel_funcs dsicm_panel_funcs = {
>> +	.unprepare = dsicm_unprepare,
>> +	.disable = dsicm_disable,
>> +	.prepare = dsicm_prepare,
>> +	.enable = dsicm_enable,
>> +	.get_modes = dsicm_get_modes,
>>  };
>>  
>>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>> @@ -517,8 +478,12 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>>  	struct backlight_device *backlight;
>>  	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>>  	struct display_timing timing;
>> +	struct videomode vm = { 0 };
> 
> How about
> 
> 	struct videomode vm = {
> 		.hactive = 864,
> 		.vactive = 480,
> 	};
> 
>>  	int err;
>>  
>> +	vm.hactive = 864;
>> +	vm.vactive = 480;
>> +
>>  	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
>>  	if (IS_ERR(ddata->reset_gpio)) {
>>  		err = PTR_ERR(ddata->reset_gpio);
>> @@ -528,15 +493,16 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>>  
>>  	err = of_get_display_timing(node, "panel-timing", &timing);
>>  	if (!err) {
>> -		videomode_from_timing(&timing, &ddata->vm);
>> -		if (!ddata->vm.pixelclock)
>> -			ddata->vm.pixelclock =
>> -				ddata->vm.hactive * ddata->vm.vactive * 60;
>> +		videomode_from_timing(&timing, &vm);
>>  	} else {
>>  		dev_warn(&dsi->dev,
>>  			 "failed to get video timing, using defaults\n");
>>  	}
>>  
>> +	if (!vm.pixelclock)
>> +		vm.pixelclock = vm.hactive * vm.vactive * 60;
>> +	drm_display_mode_from_videomode(&vm, &ddata->mode);
>> +
>>  	ddata->width_mm = 0;
>>  	of_property_read_u32(node, "width-mm", &ddata->width_mm);
>>  
>> @@ -570,7 +536,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  	struct panel_drv_data *ddata;
>>  	struct backlight_device *bldev = NULL;
>>  	struct device *dev = &dsi->dev;
>> -	struct omap_dss_device *dssdev;
>>  	int r;
>>  
>>  	dev_dbg(dev, "probe\n");
>> @@ -582,30 +547,17 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  	mipi_dsi_set_drvdata(dsi, ddata);
>>  	ddata->dsi = dsi;
>>  
>> -	ddata->vm.hactive = 864;
>> -	ddata->vm.vactive = 480;
>> -	ddata->vm.pixelclock = 864 * 480 * 60;
>> -
>>  	r = dsicm_probe_of(dsi);
>>  	if (r)
>>  		return r;
>>  
>> -	dssdev = &ddata->dssdev;
>> -	dssdev->dev = dev;
>> -	dssdev->ops = &dsicm_ops;
>> -	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
>> -	dssdev->display = true;
>> -	dssdev->owner = THIS_MODULE;
>> -	dssdev->of_port = 0;
>> -	dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
>> -
>> -	omapdss_display_init(dssdev);
>> -	omapdss_device_register(dssdev);
>> -
>>  	mutex_init(&ddata->lock);
>>  
>>  	dsicm_hw_reset(ddata);
>>  
>> +	drm_panel_init(&ddata->panel, dev, &dsicm_panel_funcs,
>> +		       DRM_MODE_CONNECTOR_DSI);
>> +
>>  	if (ddata->use_dsi_backlight) {
>>  		struct backlight_properties props = { 0 };
>>  		props.max_brightness = 255;
>> @@ -637,6 +589,8 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  	if (ddata->ulps_enabled)
>>  		dsi->mode_flags |= MIPI_DSI_MODE_ULPS_IDLE;
>>  
>> +	drm_panel_add(&ddata->panel);
>> +
>>  	r = mipi_dsi_attach(dsi);
>>  	if (r < 0)
>>  		goto err_dsi_attach;
>> @@ -644,6 +598,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  	return 0;
>>  
>>  err_dsi_attach:
>> +	drm_panel_remove(&ddata->panel);
>>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>>  err_bl:
>>  	if (ddata->extbldev)
>> @@ -655,15 +610,12 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>>  {
>>  	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>> -	struct omap_dss_device *dssdev = &ddata->dssdev;
>>  
>>  	dev_dbg(&dsi->dev, "remove\n");
>>  
>>  	mipi_dsi_detach(dsi);
>>  
>> -	omapdss_device_unregister(dssdev);
>> -
>> -	omapdss_device_disconnect(ddata->src, dssdev);
>> +	drm_panel_remove(&ddata->panel);
>>  
>>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>>  
>> @@ -677,7 +629,7 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>>  }
>>  
>>  static const struct of_device_id dsicm_of_match[] = {
>> -	{ .compatible = "omapdss,panel-dsi-cm", },
>> +	{ .compatible = "panel-dsi-cm", },
>>  	{},
>>  };
>>  
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index 620cef8bb1f2..a1a867a7d91d 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -36,6 +36,7 @@
>>  #include <linux/sys_soc.h>
>>  
>>  #include <drm/drm_mipi_dsi.h>
>> +#include <drm/drm_panel.h>
>>  #include <video/mipi_display.h>
>>  
>>  #include "omapdss.h"
>> @@ -217,6 +218,8 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
>>  static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
>>  				       const struct mipi_dsi_msg *msg);
>>  
>> +static void dsi_display_disable(struct omap_dss_device *dssdev);
>> +
> 
> Could you reorder functions to avoid forward-declarations ? This can be
> done on top if it generates annoying conflicts.
> 
>>  /* DSI PLL HSDIV indices */
>>  #define HSDIV_DISPC	0
>>  #define HSDIV_DSI	1
>> @@ -383,6 +386,7 @@ struct dsi_data {
>>  	bool te_enabled;
>>  	bool ulps_enabled;
>>  	bool ulps_auto_idle;
>> +	bool video_enabled;
>>  
>>  	struct delayed_work ulps_work;
>>  
>> @@ -423,6 +427,8 @@ struct dsi_data {
>>  
>>  	unsigned int scp_clk_refcount;
>>  
>> +	struct omap_dss_dsi_config config;
>> +
>>  	struct dss_lcd_mgr_config mgr_config;
>>  	struct videomode vm;
>>  	enum mipi_dsi_pixel_format pix_fmt;
>> @@ -3622,7 +3628,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>>  	return 0;
>>  }
>>  
>> -static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>> +static void dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>>  {
>>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>>  	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>> @@ -3631,8 +3637,10 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>>  	int r;
>>  
>>  	r = dsi_display_init_dispc(dsi);
>> -	if (r)
>> -		return r;
>> +	if (r) {
>> +		dev_err(dsi->dev, "failed to init dispc!\n");
>> +		return;
>> +	}
>>  
>>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
>>  		switch (dsi->pix_fmt) {
>> @@ -3672,7 +3680,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>>  	if (r)
>>  		goto err_mgr_enable;
>>  
>> -	return 0;
>> +	return;
>>  
>>  err_mgr_enable:
>>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
>> @@ -3681,7 +3689,8 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>>  	}
>>  err_pix_fmt:
>>  	dsi_display_uninit_dispc(dsi);
>> -	return r;
>> +	dev_err(dsi->dev, "failed to enable DSI encoder!\n");
>> +	return;
>>  }
>>  
>>  static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel)
>> @@ -3704,6 +3713,25 @@ static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel
>>  	dsi_display_uninit_dispc(dsi);
>>  }
>>  
>> +static void dsi_disable_video_outputs(struct omap_dss_device *dssdev)
>> +{
>> +	struct dsi_data *dsi = to_dsi_data(dssdev);
>> +	int i;
>> +
>> +	dsi_bus_lock(dsi);
>> +	dsi->video_enabled = false;
>> +
>> +	for (i = 0; i < 3; i++) {
>> +		if (!dsi->vc[i].dest)
>> +			continue;
>> +		dsi_disable_video_output(dssdev, i);
>> +	}
>> +
>> +	dsi_display_disable(dssdev);
>> +
>> +	dsi_bus_unlock(dsi);
>> +}
>> +
>>  static void dsi_update_screen_dispc(struct dsi_data *dsi)
>>  {
>>  	unsigned int bytespp;
>> @@ -3897,6 +3925,11 @@ static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
>>  
>>  	dsi_bus_lock(dsi);
>>  
>> +	if (!dsi->video_enabled) {
>> +		r = -EIO;
>> +		goto err;
>> +	}
>> +
>>  	if (!dsi->vc[channel].dest) {
>>  		r = -ENODEV;
>>  		goto err;
>> @@ -3942,7 +3975,7 @@ static int dsi_update_all(struct omap_dss_device *dssdev)
>>  
>>  	for (i = 0; i < 4; i++) {
>>  		r = dsi_update_channel(dssdev, i);
>> -		if (r != -ENODEV)
>> +		if (r && r != -ENODEV)
> 
> Does this belong to this patch ? I haven't flagged it when reviwing the
> patch that introduced this code, assuming that you meant to exit from
> the loop once a channel with a client is found, given that we don't
> support multiple clients. In any case this should be coordinated with
> dsi_enable_video_outputs() and dsi_disable_video_outputs(), all should
> stop on the first client, or loop over all clients.

Yes, it should be in an earlier patch.

I think this code needs more work, but in any case this change belongs to the patch that added
dsi_update_all.

>> @@ -5057,6 +5138,10 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>>  
>>  	dsi_bus_lock(dsi);
>>  
>> +	panel = of_drm_find_panel(client->dev.of_node);
>> +	if (IS_ERR(panel))
>> +		return PTR_ERR(panel);
> 
> Is it intended that the panel isn't used ?

I think it's left over code. I'll drop.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 33/56] drm/omap: dsi: convert to drm_panel
@ 2020-11-11 15:54       ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-11 15:54 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 09/11/2020 12:39, Laurent Pinchart wrote:
> On Thu, Nov 05, 2020 at 02:03:10PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel <sebastian.reichel@collabora.com>
>>
>> This converts the DSI module to expect common drm_panel display
>> drivers instead of dssdev based ones.
>>
>> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 204 +++++++-----------
>>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 133 ++++++++++--
>>  .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |   1 -
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |   8 -
>>  4 files changed, 189 insertions(+), 157 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index d9b3444b4faf..3668b3f0aff2 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -6,8 +6,6 @@
>>   * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
>>   */
>>  
>> -/* #define DEBUG */
>> -
>>  #include <linux/backlight.h>
>>  #include <linux/delay.h>
>>  #include <linux/gpio/consumer.h>
>> @@ -20,11 +18,14 @@
>>  #include <linux/regulator/consumer.h>
>>  
>>  #include <drm/drm_connector.h>
>> +#include <drm/drm_mipi_dsi.h>
>> +#include <drm/drm_panel.h>
>> +#include <drm/drm_modes.h>
> 
> Alphabetically ordered please.
> 
>>  
>> +#include <video/display_timing.h>
>>  #include <video/mipi_display.h>
>>  #include <video/of_display_timing.h>
>> -
>> -#include "../dss/omapdss.h"
>> +#include <video/videomode.h>
>>  
>>  #define DCS_READ_NUM_ERRORS	0x05
>>  #define DCS_GET_ID1		0xda
>> @@ -35,11 +36,8 @@
>>  
>>  struct panel_drv_data {
>>  	struct mipi_dsi_device *dsi;
>> -
>> -	struct omap_dss_device dssdev;
>> -	struct omap_dss_device *src;
>> -
>> -	struct videomode vm;
>> +	struct drm_panel panel;
>> +	struct drm_display_mode mode;
>>  
>>  	struct mutex lock;
>>  
>> @@ -71,7 +69,11 @@ struct panel_drv_data {
>>  	bool ulps_enabled;
>>  };
>>  
>> -#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
>> +
> 
> A single blank line is enough.
> 
>> +static inline struct panel_drv_data *panel_to_ddata(struct drm_panel *panel)
>> +{
>> +	return container_of(panel, struct panel_drv_data, panel);
>> +}
>>  
>>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>>  
>> @@ -285,7 +287,6 @@ static void dsicm_hw_reset(struct panel_drv_data *ddata)
>>  
>>  static int dsicm_power_on(struct panel_drv_data *ddata)
>>  {
>> -	struct omap_dss_device *src = ddata->src;
>>  	u8 id1, id2, id3;
>>  	int r;
>>  
>> @@ -322,10 +323,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>>  	if (r)
>>  		goto err;
>>  
>> -	r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
>> -	if (r)
>> -		goto err;
>> -
>>  	ddata->enabled = true;
>>  
>>  	if (!ddata->intro_printed) {
>> @@ -345,15 +342,12 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>>  	return r;
>>  }
>>  
>> -static void dsicm_power_off(struct panel_drv_data *ddata)
>> +static int dsicm_power_off(struct panel_drv_data *ddata)
>>  {
>> -	struct omap_dss_device *src = ddata->src;
>>  	int r;
>>  
>>  	ddata->enabled = false;
>>  
>> -	src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
>> -
>>  	r = mipi_dsi_dcs_set_display_off(ddata->dsi);
>>  	if (!r)
>>  		r = dsicm_sleep_in(ddata);
>> @@ -363,51 +357,25 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>>  				"error disabling panel, issuing HW reset\n");
>>  		dsicm_hw_reset(ddata);
>>  	}
>> -}
>> -
>> -static int dsicm_connect(struct omap_dss_device *src,
>> -			 struct omap_dss_device *dst)
>> -{
>> -	struct panel_drv_data *ddata = to_panel_data(dst);
>> -
>> -	ddata->src = src;
>> -	return 0;
>> -}
>> -
>> -static void dsicm_disconnect(struct omap_dss_device *src,
>> -			     struct omap_dss_device *dst)
>> -{
>> -	struct panel_drv_data *ddata = to_panel_data(dst);
>>  
>> -	ddata->src = NULL;
>> +	return r;
>>  }
>>  
>> -static void dsicm_pre_enable(struct omap_dss_device *dssdev)
>> +static int dsicm_prepare(struct drm_panel *panel)
>>  {
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> -	struct omap_dss_device *src = ddata->src;
>> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>>  	int r;
>> -	struct omap_dss_dsi_config dsi_config = {
>> -		.vm = &ddata->vm,
>> -		.hs_clk_min = 150000000,
>> -		.hs_clk_max = 300000000,
>> -		.lp_clk_min = 7000000,
>> -		.lp_clk_max = 10000000,
>> -	};
>>  
>>  	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>>  	if (r)
>>  		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
>>  
>> -	r = src->ops->dsi.set_config(src, &dsi_config);
>> -	if (r) {
>> -		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
>> -	}
>> +	return r;
>>  }
>>  
>> -static void dsicm_enable(struct omap_dss_device *dssdev)
>> +static int dsicm_enable(struct drm_panel *panel)
>>  {
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>>  	int r;
>>  
>>  	mutex_lock(&ddata->lock);
>> @@ -420,33 +388,39 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>>  
>>  	dsicm_bl_power(ddata, true);
>>  
>> -	return;
>> +	return 0;
>>  err:
>> -	dev_dbg(&ddata->dsi->dev, "enable failed (%d)\n", r);
>> +	dev_err(&ddata->dsi->dev, "enable failed (%d)\n", r);
>>  	mutex_unlock(&ddata->lock);
>> +	return r;
>> +}
>> +
>> +static int dsicm_unprepare(struct drm_panel *panel)
>> +{
>> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>> +	int r;
>> +
>> +	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>> +	if (r)
>> +		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
>> +
>> +	return r;
>>  }
>>  
>> -static void dsicm_disable(struct omap_dss_device *dssdev)
>> +static int dsicm_disable(struct drm_panel *panel)
>>  {
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>> +	int r;
>>  
>>  	dsicm_bl_power(ddata, false);
>>  
>>  	mutex_lock(&ddata->lock);
>>  
>> -	dsicm_power_off(ddata);
>> +	r = dsicm_power_off(ddata);
>>  
>>  	mutex_unlock(&ddata->lock);
>> -}
>> -
>> -static void dsicm_post_disable(struct omap_dss_device *dssdev)
>> -{
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> -	int r;
>>  
>> -	r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>> -	if (r)
>> -		dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r);
>> +	return r;
>>  }
>>  
>>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>> @@ -465,50 +439,37 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>>  	return r;
>>  }
>>  
>> -static int dsicm_get_modes(struct omap_dss_device *dssdev,
>> +static int dsicm_get_modes(struct drm_panel *panel,
>>  			   struct drm_connector *connector)
>>  {
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> +	struct panel_drv_data *ddata = panel_to_ddata(panel);
>> +	struct drm_display_mode *mode;
>> +
>> +	mode = drm_mode_duplicate(connector->dev, &ddata->mode);
>> +	if (!mode) {
>> +		dev_err(&ddata->dsi->dev, "failed to add mode %ux%ux@%u kHz\n",
>> +			ddata->mode.hdisplay, ddata->mode.vdisplay,
>> +			ddata->mode.clock);
>> +		return -ENOMEM;
>> +	}
>> +
>> +	drm_mode_set_name(mode);
>> +	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>>  
>>  	connector->display_info.width_mm = ddata->width_mm;
>>  	connector->display_info.height_mm = ddata->height_mm;
>>  
>> -	return omapdss_display_get_modes(connector, &ddata->vm);
>> -}
>> -
>> -static int dsicm_check_timings(struct omap_dss_device *dssdev,
>> -			       struct drm_display_mode *mode)
>> -{
>> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
>> -	int ret = 0;
>> -
>> -	if (mode->hdisplay != ddata->vm.hactive)
>> -		ret = -EINVAL;
>> -
>> -	if (mode->vdisplay != ddata->vm.vactive)
>> -		ret = -EINVAL;
>> +	drm_mode_probed_add(connector, mode);
>>  
>> -	if (ret) {
>> -		dev_warn(dssdev->dev, "wrong resolution: %d x %d",
>> -			 mode->hdisplay, mode->vdisplay);
>> -		dev_warn(dssdev->dev, "panel resolution: %d x %d",
>> -			 ddata->vm.hactive, ddata->vm.vactive);
>> -	}
>> -
>> -	return ret;
>> +	return 1;
>>  }
>>  
>> -static const struct omap_dss_device_ops dsicm_ops = {
>> -	.connect	= dsicm_connect,
>> -	.disconnect	= dsicm_disconnect,
>> -
>> -	.pre_enable	= dsicm_pre_enable,
>> -	.enable		= dsicm_enable,
>> -	.disable	= dsicm_disable,
>> -	.post_disable	= dsicm_post_disable,
>> -
>> -	.get_modes	= dsicm_get_modes,
>> -	.check_timings	= dsicm_check_timings,
>> +static const struct drm_panel_funcs dsicm_panel_funcs = {
>> +	.unprepare = dsicm_unprepare,
>> +	.disable = dsicm_disable,
>> +	.prepare = dsicm_prepare,
>> +	.enable = dsicm_enable,
>> +	.get_modes = dsicm_get_modes,
>>  };
>>  
>>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>> @@ -517,8 +478,12 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>>  	struct backlight_device *backlight;
>>  	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>>  	struct display_timing timing;
>> +	struct videomode vm = { 0 };
> 
> How about
> 
> 	struct videomode vm = {
> 		.hactive = 864,
> 		.vactive = 480,
> 	};
> 
>>  	int err;
>>  
>> +	vm.hactive = 864;
>> +	vm.vactive = 480;
>> +
>>  	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
>>  	if (IS_ERR(ddata->reset_gpio)) {
>>  		err = PTR_ERR(ddata->reset_gpio);
>> @@ -528,15 +493,16 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>>  
>>  	err = of_get_display_timing(node, "panel-timing", &timing);
>>  	if (!err) {
>> -		videomode_from_timing(&timing, &ddata->vm);
>> -		if (!ddata->vm.pixelclock)
>> -			ddata->vm.pixelclock =
>> -				ddata->vm.hactive * ddata->vm.vactive * 60;
>> +		videomode_from_timing(&timing, &vm);
>>  	} else {
>>  		dev_warn(&dsi->dev,
>>  			 "failed to get video timing, using defaults\n");
>>  	}
>>  
>> +	if (!vm.pixelclock)
>> +		vm.pixelclock = vm.hactive * vm.vactive * 60;
>> +	drm_display_mode_from_videomode(&vm, &ddata->mode);
>> +
>>  	ddata->width_mm = 0;
>>  	of_property_read_u32(node, "width-mm", &ddata->width_mm);
>>  
>> @@ -570,7 +536,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  	struct panel_drv_data *ddata;
>>  	struct backlight_device *bldev = NULL;
>>  	struct device *dev = &dsi->dev;
>> -	struct omap_dss_device *dssdev;
>>  	int r;
>>  
>>  	dev_dbg(dev, "probe\n");
>> @@ -582,30 +547,17 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  	mipi_dsi_set_drvdata(dsi, ddata);
>>  	ddata->dsi = dsi;
>>  
>> -	ddata->vm.hactive = 864;
>> -	ddata->vm.vactive = 480;
>> -	ddata->vm.pixelclock = 864 * 480 * 60;
>> -
>>  	r = dsicm_probe_of(dsi);
>>  	if (r)
>>  		return r;
>>  
>> -	dssdev = &ddata->dssdev;
>> -	dssdev->dev = dev;
>> -	dssdev->ops = &dsicm_ops;
>> -	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
>> -	dssdev->display = true;
>> -	dssdev->owner = THIS_MODULE;
>> -	dssdev->of_port = 0;
>> -	dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
>> -
>> -	omapdss_display_init(dssdev);
>> -	omapdss_device_register(dssdev);
>> -
>>  	mutex_init(&ddata->lock);
>>  
>>  	dsicm_hw_reset(ddata);
>>  
>> +	drm_panel_init(&ddata->panel, dev, &dsicm_panel_funcs,
>> +		       DRM_MODE_CONNECTOR_DSI);
>> +
>>  	if (ddata->use_dsi_backlight) {
>>  		struct backlight_properties props = { 0 };
>>  		props.max_brightness = 255;
>> @@ -637,6 +589,8 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  	if (ddata->ulps_enabled)
>>  		dsi->mode_flags |= MIPI_DSI_MODE_ULPS_IDLE;
>>  
>> +	drm_panel_add(&ddata->panel);
>> +
>>  	r = mipi_dsi_attach(dsi);
>>  	if (r < 0)
>>  		goto err_dsi_attach;
>> @@ -644,6 +598,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  	return 0;
>>  
>>  err_dsi_attach:
>> +	drm_panel_remove(&ddata->panel);
>>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>>  err_bl:
>>  	if (ddata->extbldev)
>> @@ -655,15 +610,12 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>>  {
>>  	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>> -	struct omap_dss_device *dssdev = &ddata->dssdev;
>>  
>>  	dev_dbg(&dsi->dev, "remove\n");
>>  
>>  	mipi_dsi_detach(dsi);
>>  
>> -	omapdss_device_unregister(dssdev);
>> -
>> -	omapdss_device_disconnect(ddata->src, dssdev);
>> +	drm_panel_remove(&ddata->panel);
>>  
>>  	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>>  
>> @@ -677,7 +629,7 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>>  }
>>  
>>  static const struct of_device_id dsicm_of_match[] = {
>> -	{ .compatible = "omapdss,panel-dsi-cm", },
>> +	{ .compatible = "panel-dsi-cm", },
>>  	{},
>>  };
>>  
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index 620cef8bb1f2..a1a867a7d91d 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -36,6 +36,7 @@
>>  #include <linux/sys_soc.h>
>>  
>>  #include <drm/drm_mipi_dsi.h>
>> +#include <drm/drm_panel.h>
>>  #include <video/mipi_display.h>
>>  
>>  #include "omapdss.h"
>> @@ -217,6 +218,8 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
>>  static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
>>  				       const struct mipi_dsi_msg *msg);
>>  
>> +static void dsi_display_disable(struct omap_dss_device *dssdev);
>> +
> 
> Could you reorder functions to avoid forward-declarations ? This can be
> done on top if it generates annoying conflicts.
> 
>>  /* DSI PLL HSDIV indices */
>>  #define HSDIV_DISPC	0
>>  #define HSDIV_DSI	1
>> @@ -383,6 +386,7 @@ struct dsi_data {
>>  	bool te_enabled;
>>  	bool ulps_enabled;
>>  	bool ulps_auto_idle;
>> +	bool video_enabled;
>>  
>>  	struct delayed_work ulps_work;
>>  
>> @@ -423,6 +427,8 @@ struct dsi_data {
>>  
>>  	unsigned int scp_clk_refcount;
>>  
>> +	struct omap_dss_dsi_config config;
>> +
>>  	struct dss_lcd_mgr_config mgr_config;
>>  	struct videomode vm;
>>  	enum mipi_dsi_pixel_format pix_fmt;
>> @@ -3622,7 +3628,7 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
>>  	return 0;
>>  }
>>  
>> -static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>> +static void dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>>  {
>>  	struct dsi_data *dsi = to_dsi_data(dssdev);
>>  	int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>> @@ -3631,8 +3637,10 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>>  	int r;
>>  
>>  	r = dsi_display_init_dispc(dsi);
>> -	if (r)
>> -		return r;
>> +	if (r) {
>> +		dev_err(dsi->dev, "failed to init dispc!\n");
>> +		return;
>> +	}
>>  
>>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
>>  		switch (dsi->pix_fmt) {
>> @@ -3672,7 +3680,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>>  	if (r)
>>  		goto err_mgr_enable;
>>  
>> -	return 0;
>> +	return;
>>  
>>  err_mgr_enable:
>>  	if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
>> @@ -3681,7 +3689,8 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
>>  	}
>>  err_pix_fmt:
>>  	dsi_display_uninit_dispc(dsi);
>> -	return r;
>> +	dev_err(dsi->dev, "failed to enable DSI encoder!\n");
>> +	return;
>>  }
>>  
>>  static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel)
>> @@ -3704,6 +3713,25 @@ static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel
>>  	dsi_display_uninit_dispc(dsi);
>>  }
>>  
>> +static void dsi_disable_video_outputs(struct omap_dss_device *dssdev)
>> +{
>> +	struct dsi_data *dsi = to_dsi_data(dssdev);
>> +	int i;
>> +
>> +	dsi_bus_lock(dsi);
>> +	dsi->video_enabled = false;
>> +
>> +	for (i = 0; i < 3; i++) {
>> +		if (!dsi->vc[i].dest)
>> +			continue;
>> +		dsi_disable_video_output(dssdev, i);
>> +	}
>> +
>> +	dsi_display_disable(dssdev);
>> +
>> +	dsi_bus_unlock(dsi);
>> +}
>> +
>>  static void dsi_update_screen_dispc(struct dsi_data *dsi)
>>  {
>>  	unsigned int bytespp;
>> @@ -3897,6 +3925,11 @@ static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
>>  
>>  	dsi_bus_lock(dsi);
>>  
>> +	if (!dsi->video_enabled) {
>> +		r = -EIO;
>> +		goto err;
>> +	}
>> +
>>  	if (!dsi->vc[channel].dest) {
>>  		r = -ENODEV;
>>  		goto err;
>> @@ -3942,7 +3975,7 @@ static int dsi_update_all(struct omap_dss_device *dssdev)
>>  
>>  	for (i = 0; i < 4; i++) {
>>  		r = dsi_update_channel(dssdev, i);
>> -		if (r != -ENODEV)
>> +		if (r && r != -ENODEV)
> 
> Does this belong to this patch ? I haven't flagged it when reviwing the
> patch that introduced this code, assuming that you meant to exit from
> the loop once a channel with a client is found, given that we don't
> support multiple clients. In any case this should be coordinated with
> dsi_enable_video_outputs() and dsi_disable_video_outputs(), all should
> stop on the first client, or loop over all clients.

Yes, it should be in an earlier patch.

I think this code needs more work, but in any case this change belongs to the patch that added
dsi_update_all.

>> @@ -5057,6 +5138,10 @@ static int omap_dsi_host_attach(struct mipi_dsi_host *host,
>>  
>>  	dsi_bus_lock(dsi);
>>  
>> +	panel = of_drm_find_panel(client->dev.of_node);
>> +	if (IS_ERR(panel))
>> +		return PTR_ERR(panel);
> 
> Is it intended that the panel isn't used ?

I think it's left over code. I'll drop.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
  2020-11-11 15:34       ` Tomi Valkeinen
@ 2020-11-11 15:58         ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-11 15:58 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi,

On Wed, Nov 11, 2020 at 05:34:52PM +0200, Tomi Valkeinen wrote:
> On 09/11/2020 12:10, Laurent Pinchart wrote:
> > On Thu, Nov 05, 2020 at 02:03:07PM +0200, Tomi Valkeinen wrote:
> >> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> >>
> >> This moves the panel refresh/update function from the panel
> >> driver into the DSI host driver to prepare for common drm_panel
> >> support.
> >>
> >> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> >> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> >> ---
> >>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  68 ------------
> >>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 101 ++++++++++++++++--
> >>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  13 +--
> >>  drivers/gpu/drm/omapdrm/omap_crtc.c           |  11 +-
> >>  4 files changed, 97 insertions(+), 96 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> >> index 030a8fa140db..1582960f9e90 100644
> >> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> >> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> >> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
> >>  	return 0;
> >>  }
> >>  
> >> -static int dsicm_set_update_window(struct panel_drv_data *ddata,
> >> -		u16 x, u16 y, u16 w, u16 h)
> >> -{
> >> -	struct mipi_dsi_device *dsi = ddata->dsi;
> >> -	int r;
> >> -	u16 x1 = x;
> >> -	u16 x2 = x + w - 1;
> >> -	u16 y1 = y;
> >> -	u16 y2 = y + h - 1;
> >> -
> >> -	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
> >> -	if (r < 0)
> >> -		return r;
> >> -
> >> -	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
> >> -	if (r < 0)
> >> -		return r;
> >> -
> >> -	return 0;
> >> -}
> >> -
> > 
> > I can't tell whether this is common to all command-mode panels, or if
> > there could be a need for panel-specific update procedures, so I can't
> > really ack this patch.
> 
> I can't say either, but all the command mode panels I know need and support this. And, afaik, we
> have only the single cmd mode panel driver which we add in this series.

Now that I think about it again, isn't it a layering violation ?
Shouldn't the DSI host handle DSI commands transfers, with the panel
driver taking care of specific DSI commands ?

If keeping this code in the panel driver causes lots of rebase conflicts
I'm fine fixing this on top, but it looks like it belongs to the panel
driver.

> >>  static int dsicm_bl_update_status(struct backlight_device *dev)
> >>  {
> >>  	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
> >> @@ -470,48 +449,6 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
> >>  	mutex_unlock(&ddata->lock);
> >>  }
> >>  
> >> -static void dsicm_framedone_cb(int err, void *data)
> >> -{
> >> -	struct panel_drv_data *ddata = data;
> >> -
> >> -	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
> >> -	mutex_unlock(&ddata->lock);
> >> -}
> >> -
> >> -static int dsicm_update(struct omap_dss_device *dssdev,
> >> -				    u16 x, u16 y, u16 w, u16 h)
> >> -{
> >> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> >> -	struct omap_dss_device *src = ddata->src;
> >> -	int r;
> >> -
> >> -	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
> >> -
> >> -	mutex_lock(&ddata->lock);
> >> -
> >> -	if (!ddata->enabled) {
> >> -		r = 0;
> >> -		goto err;
> >> -	}
> >> -
> >> -	/* XXX no need to send this every frame, but dsi break if not done */
> >> -	r = dsicm_set_update_window(ddata, 0, 0, ddata->vm.hactive,
> >> -				    ddata->vm.vactive);
> >> -	if (r)
> >> -		goto err;
> >> -
> >> -	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
> >> -			ddata);
> >> -	if (r)
> >> -		goto err;
> >> -
> >> -	/* note: no unlock here. unlock is src framedone_cb */
> >> -	return 0;
> >> -err:
> >> -	mutex_unlock(&ddata->lock);
> >> -	return r;
> >> -}
> >> -
> >>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
> >>  {
> >>  	struct mipi_dsi_device *dsi = ddata->dsi;
> >> @@ -572,10 +509,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
> >>  	.check_timings	= dsicm_check_timings,
> >>  };
> >>  
> >> -static const struct omap_dss_driver dsicm_dss_driver = {
> >> -	.update		= dsicm_update,
> >> -};
> >> -
> >>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> >>  {
> >>  	struct device_node *node = dsi->dev.of_node;
> >> @@ -658,7 +591,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
> >>  	dssdev = &ddata->dssdev;
> >>  	dssdev->dev = dev;
> >>  	dssdev->ops = &dsicm_ops;
> >> -	dssdev->driver = &dsicm_dss_driver;
> >>  	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
> >>  	dssdev->display = true;
> >>  	dssdev->owner = THIS_MODULE;
> >> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> index 0f264654792d..0aa0d21cf896 100644
> >> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> @@ -214,6 +214,9 @@ static void dsi_display_uninit_dispc(struct dsi_data *dsi);
> >>  
> >>  static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
> >>  
> >> +static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
> >> +				       const struct mipi_dsi_msg *msg);
> >> +
> >>  /* DSI PLL HSDIV indices */
> >>  #define HSDIV_DISPC	0
> >>  #define HSDIV_DSI	1
> >> @@ -383,9 +386,6 @@ struct dsi_data {
> >>  
> >>  	struct delayed_work ulps_work;
> >>  
> >> -	void (*framedone_callback)(int, void *);
> >> -	void *framedone_data;
> >> -
> >>  	struct delayed_work framedone_timeout_work;
> >>  
> >>  #ifdef DSI_CATCH_MISSING_TE
> >> @@ -3802,8 +3802,6 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
> >>  	dsi_set_ulps_auto(dsi, true);
> >>  	dsi_bus_unlock(dsi);
> >>  
> >> -	dsi->framedone_callback(error, dsi->framedone_data);
> >> -
> >>  	if (!error)
> >>  		dsi_perf_show(dsi, "DISPC");
> >>  }
> >> @@ -3835,6 +3833,8 @@ static void dsi_framedone_irq_callback(void *data)
> >>  
> >>  	cancel_delayed_work(&dsi->framedone_timeout_work);
> >>  
> >> +	DSSDBG("Framedone received!\n");
> >> +
> >>  	dsi_handle_framedone(dsi, 0);
> >>  }
> >>  
> >> @@ -3856,17 +3856,69 @@ static int _dsi_update(struct dsi_data *dsi)
> >>  	return 0;
> >>  }
> >>  
> >> -static int dsi_update(struct omap_dss_device *dssdev, int channel,
> >> -		void (*callback)(int, void *), void *data)
> >> +static int _dsi_update_window(struct dsi_data *dsi, int channel,
> >> +			      int x, int y, int w, int h)
> >> +{
> >> +	int x1 = x, x2 = (x + w - 1);
> >> +	int y1 = y, y2 = (y + h - 1);
> >> +	u8 payloadX[5] = { MIPI_DCS_SET_COLUMN_ADDRESS,
> >> +			   x1 >> 8, x1 & 0xff, x2 >> 8, x2 & 0xff };
> >> +	u8 payloadY[5] = { MIPI_DCS_SET_PAGE_ADDRESS,
> >> +			   y1 >> 8, y1 & 0xff, y2 >> 8, y2 & 0xff };
> >> +	struct mipi_dsi_msg msgX = { 0 }, msgY = { 0 };
> >> +	int ret;
> >> +
> >> +	WARN_ON(!dsi_bus_is_locked(dsi));
> >> +
> >> +	msgX.type = MIPI_DSI_DCS_LONG_WRITE;
> >> +	msgX.channel = channel;
> >> +	msgX.tx_buf = payloadX;
> >> +	msgX.tx_len = sizeof(payloadX);
> >> +
> >> +	msgY.type = MIPI_DSI_DCS_LONG_WRITE;
> >> +	msgY.channel = channel;
> >> +	msgY.tx_buf = payloadY;
> >> +	msgY.tx_len = sizeof(payloadY);
> >> +
> >> +	ret = _omap_dsi_host_transfer(dsi, &msgX);
> >> +	if (ret != 0)
> >> +		return ret;
> >> +
> >> +	return _omap_dsi_host_transfer(dsi, &msgY);
> >> +}
> >> +
> >> +static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
> >>  {
> >>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> >> +	int r;
> >> +
> >> +	if (channel > 3)
> >> +		return -EINVAL;
> >>  
> >>  	dsi_bus_lock(dsi);
> >> +
> >> +	if (!dsi->vc[channel].dest) {
> >> +		r = -ENODEV;
> >> +		goto err;
> >> +	}
> >> +
> >> +	if (dsi->vm.hactive == 0 || dsi->vm.vactive == 0) {
> >> +		r = -EINVAL;
> >> +		goto err;
> >> +	}
> >> +
> >> +	DSSDBG("dsi_update_channel: %d", channel);
> >> +
> >>  	dsi_set_ulps_auto(dsi, false);
> >>  
> >> +	r = _dsi_update_window(dsi, channel, 0, 0, dsi->vm.hactive,
> >> +			       dsi->vm.vactive);
> >> +	if (r < 0) {
> >> +		DSSWARN("window update error: %d\n", r);
> >> +		goto err;
> >> +	}
> >> +
> >>  	dsi->update_channel = channel;
> >> -	dsi->framedone_callback = callback;
> >> -	dsi->framedone_data = data;
> >>  
> >>  	if (dsi->te_enabled && dsi->te_gpio) {
> >>  		schedule_delayed_work(&dsi->te_timeout_work,
> >> @@ -3877,6 +3929,24 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
> >>  	}
> >>  
> >>  	return 0;
> >> +
> >> +err:
> >> +	dsi_set_ulps_auto(dsi, true);
> >> +	dsi_bus_unlock(dsi);
> >> +	return r;
> >> +}
> >> +
> >> +static int dsi_update_all(struct omap_dss_device *dssdev)
> >> +{
> >> +	int i, r;
> > 
> > i should be unsigned as it's never negative.
> > 
> >> +
> >> +	for (i = 0; i < 4; i++) {
> >> +		r = dsi_update_channel(dssdev, i);
> >> +		if (r != -ENODEV)
> >> +			return r;
> >> +	}
> >> +
> >> +	return r;
> >>  }
> >>  
> >>  /* Display funcs */
> >> @@ -4095,7 +4165,9 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
> >>  {
> >>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> >>  	DSSDBG("dsi_display_enable\n");
> >> +	dsi_bus_lock(dsi);
> > 
> > Why is the lock needed here now ? Should it be part of a previous patch
> > ? Or, if I'm missing something, should the commit message explain this ?
> > Same for the other locations below.
> 
> Yes, the locking should've been done in earlier patch. I moved them.

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
@ 2020-11-11 15:58         ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-11 15:58 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi,

On Wed, Nov 11, 2020 at 05:34:52PM +0200, Tomi Valkeinen wrote:
> On 09/11/2020 12:10, Laurent Pinchart wrote:
> > On Thu, Nov 05, 2020 at 02:03:07PM +0200, Tomi Valkeinen wrote:
> >> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> >>
> >> This moves the panel refresh/update function from the panel
> >> driver into the DSI host driver to prepare for common drm_panel
> >> support.
> >>
> >> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> >> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> >> ---
> >>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  68 ------------
> >>  drivers/gpu/drm/omapdrm/dss/dsi.c             | 101 ++++++++++++++++--
> >>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |  13 +--
> >>  drivers/gpu/drm/omapdrm/omap_crtc.c           |  11 +-
> >>  4 files changed, 97 insertions(+), 96 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> >> index 030a8fa140db..1582960f9e90 100644
> >> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> >> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> >> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
> >>  	return 0;
> >>  }
> >>  
> >> -static int dsicm_set_update_window(struct panel_drv_data *ddata,
> >> -		u16 x, u16 y, u16 w, u16 h)
> >> -{
> >> -	struct mipi_dsi_device *dsi = ddata->dsi;
> >> -	int r;
> >> -	u16 x1 = x;
> >> -	u16 x2 = x + w - 1;
> >> -	u16 y1 = y;
> >> -	u16 y2 = y + h - 1;
> >> -
> >> -	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
> >> -	if (r < 0)
> >> -		return r;
> >> -
> >> -	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
> >> -	if (r < 0)
> >> -		return r;
> >> -
> >> -	return 0;
> >> -}
> >> -
> > 
> > I can't tell whether this is common to all command-mode panels, or if
> > there could be a need for panel-specific update procedures, so I can't
> > really ack this patch.
> 
> I can't say either, but all the command mode panels I know need and support this. And, afaik, we
> have only the single cmd mode panel driver which we add in this series.

Now that I think about it again, isn't it a layering violation ?
Shouldn't the DSI host handle DSI commands transfers, with the panel
driver taking care of specific DSI commands ?

If keeping this code in the panel driver causes lots of rebase conflicts
I'm fine fixing this on top, but it looks like it belongs to the panel
driver.

> >>  static int dsicm_bl_update_status(struct backlight_device *dev)
> >>  {
> >>  	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
> >> @@ -470,48 +449,6 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
> >>  	mutex_unlock(&ddata->lock);
> >>  }
> >>  
> >> -static void dsicm_framedone_cb(int err, void *data)
> >> -{
> >> -	struct panel_drv_data *ddata = data;
> >> -
> >> -	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
> >> -	mutex_unlock(&ddata->lock);
> >> -}
> >> -
> >> -static int dsicm_update(struct omap_dss_device *dssdev,
> >> -				    u16 x, u16 y, u16 w, u16 h)
> >> -{
> >> -	struct panel_drv_data *ddata = to_panel_data(dssdev);
> >> -	struct omap_dss_device *src = ddata->src;
> >> -	int r;
> >> -
> >> -	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
> >> -
> >> -	mutex_lock(&ddata->lock);
> >> -
> >> -	if (!ddata->enabled) {
> >> -		r = 0;
> >> -		goto err;
> >> -	}
> >> -
> >> -	/* XXX no need to send this every frame, but dsi break if not done */
> >> -	r = dsicm_set_update_window(ddata, 0, 0, ddata->vm.hactive,
> >> -				    ddata->vm.vactive);
> >> -	if (r)
> >> -		goto err;
> >> -
> >> -	r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
> >> -			ddata);
> >> -	if (r)
> >> -		goto err;
> >> -
> >> -	/* note: no unlock here. unlock is src framedone_cb */
> >> -	return 0;
> >> -err:
> >> -	mutex_unlock(&ddata->lock);
> >> -	return r;
> >> -}
> >> -
> >>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
> >>  {
> >>  	struct mipi_dsi_device *dsi = ddata->dsi;
> >> @@ -572,10 +509,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
> >>  	.check_timings	= dsicm_check_timings,
> >>  };
> >>  
> >> -static const struct omap_dss_driver dsicm_dss_driver = {
> >> -	.update		= dsicm_update,
> >> -};
> >> -
> >>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> >>  {
> >>  	struct device_node *node = dsi->dev.of_node;
> >> @@ -658,7 +591,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
> >>  	dssdev = &ddata->dssdev;
> >>  	dssdev->dev = dev;
> >>  	dssdev->ops = &dsicm_ops;
> >> -	dssdev->driver = &dsicm_dss_driver;
> >>  	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
> >>  	dssdev->display = true;
> >>  	dssdev->owner = THIS_MODULE;
> >> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> index 0f264654792d..0aa0d21cf896 100644
> >> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> @@ -214,6 +214,9 @@ static void dsi_display_uninit_dispc(struct dsi_data *dsi);
> >>  
> >>  static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
> >>  
> >> +static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
> >> +				       const struct mipi_dsi_msg *msg);
> >> +
> >>  /* DSI PLL HSDIV indices */
> >>  #define HSDIV_DISPC	0
> >>  #define HSDIV_DSI	1
> >> @@ -383,9 +386,6 @@ struct dsi_data {
> >>  
> >>  	struct delayed_work ulps_work;
> >>  
> >> -	void (*framedone_callback)(int, void *);
> >> -	void *framedone_data;
> >> -
> >>  	struct delayed_work framedone_timeout_work;
> >>  
> >>  #ifdef DSI_CATCH_MISSING_TE
> >> @@ -3802,8 +3802,6 @@ static void dsi_handle_framedone(struct dsi_data *dsi, int error)
> >>  	dsi_set_ulps_auto(dsi, true);
> >>  	dsi_bus_unlock(dsi);
> >>  
> >> -	dsi->framedone_callback(error, dsi->framedone_data);
> >> -
> >>  	if (!error)
> >>  		dsi_perf_show(dsi, "DISPC");
> >>  }
> >> @@ -3835,6 +3833,8 @@ static void dsi_framedone_irq_callback(void *data)
> >>  
> >>  	cancel_delayed_work(&dsi->framedone_timeout_work);
> >>  
> >> +	DSSDBG("Framedone received!\n");
> >> +
> >>  	dsi_handle_framedone(dsi, 0);
> >>  }
> >>  
> >> @@ -3856,17 +3856,69 @@ static int _dsi_update(struct dsi_data *dsi)
> >>  	return 0;
> >>  }
> >>  
> >> -static int dsi_update(struct omap_dss_device *dssdev, int channel,
> >> -		void (*callback)(int, void *), void *data)
> >> +static int _dsi_update_window(struct dsi_data *dsi, int channel,
> >> +			      int x, int y, int w, int h)
> >> +{
> >> +	int x1 = x, x2 = (x + w - 1);
> >> +	int y1 = y, y2 = (y + h - 1);
> >> +	u8 payloadX[5] = { MIPI_DCS_SET_COLUMN_ADDRESS,
> >> +			   x1 >> 8, x1 & 0xff, x2 >> 8, x2 & 0xff };
> >> +	u8 payloadY[5] = { MIPI_DCS_SET_PAGE_ADDRESS,
> >> +			   y1 >> 8, y1 & 0xff, y2 >> 8, y2 & 0xff };
> >> +	struct mipi_dsi_msg msgX = { 0 }, msgY = { 0 };
> >> +	int ret;
> >> +
> >> +	WARN_ON(!dsi_bus_is_locked(dsi));
> >> +
> >> +	msgX.type = MIPI_DSI_DCS_LONG_WRITE;
> >> +	msgX.channel = channel;
> >> +	msgX.tx_buf = payloadX;
> >> +	msgX.tx_len = sizeof(payloadX);
> >> +
> >> +	msgY.type = MIPI_DSI_DCS_LONG_WRITE;
> >> +	msgY.channel = channel;
> >> +	msgY.tx_buf = payloadY;
> >> +	msgY.tx_len = sizeof(payloadY);
> >> +
> >> +	ret = _omap_dsi_host_transfer(dsi, &msgX);
> >> +	if (ret != 0)
> >> +		return ret;
> >> +
> >> +	return _omap_dsi_host_transfer(dsi, &msgY);
> >> +}
> >> +
> >> +static int dsi_update_channel(struct omap_dss_device *dssdev, int channel)
> >>  {
> >>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> >> +	int r;
> >> +
> >> +	if (channel > 3)
> >> +		return -EINVAL;
> >>  
> >>  	dsi_bus_lock(dsi);
> >> +
> >> +	if (!dsi->vc[channel].dest) {
> >> +		r = -ENODEV;
> >> +		goto err;
> >> +	}
> >> +
> >> +	if (dsi->vm.hactive == 0 || dsi->vm.vactive == 0) {
> >> +		r = -EINVAL;
> >> +		goto err;
> >> +	}
> >> +
> >> +	DSSDBG("dsi_update_channel: %d", channel);
> >> +
> >>  	dsi_set_ulps_auto(dsi, false);
> >>  
> >> +	r = _dsi_update_window(dsi, channel, 0, 0, dsi->vm.hactive,
> >> +			       dsi->vm.vactive);
> >> +	if (r < 0) {
> >> +		DSSWARN("window update error: %d\n", r);
> >> +		goto err;
> >> +	}
> >> +
> >>  	dsi->update_channel = channel;
> >> -	dsi->framedone_callback = callback;
> >> -	dsi->framedone_data = data;
> >>  
> >>  	if (dsi->te_enabled && dsi->te_gpio) {
> >>  		schedule_delayed_work(&dsi->te_timeout_work,
> >> @@ -3877,6 +3929,24 @@ static int dsi_update(struct omap_dss_device *dssdev, int channel,
> >>  	}
> >>  
> >>  	return 0;
> >> +
> >> +err:
> >> +	dsi_set_ulps_auto(dsi, true);
> >> +	dsi_bus_unlock(dsi);
> >> +	return r;
> >> +}
> >> +
> >> +static int dsi_update_all(struct omap_dss_device *dssdev)
> >> +{
> >> +	int i, r;
> > 
> > i should be unsigned as it's never negative.
> > 
> >> +
> >> +	for (i = 0; i < 4; i++) {
> >> +		r = dsi_update_channel(dssdev, i);
> >> +		if (r != -ENODEV)
> >> +			return r;
> >> +	}
> >> +
> >> +	return r;
> >>  }
> >>  
> >>  /* Display funcs */
> >> @@ -4095,7 +4165,9 @@ static void dsi_display_enable(struct omap_dss_device *dssdev)
> >>  {
> >>  	struct dsi_data *dsi = to_dsi_data(dssdev);
> >>  	DSSDBG("dsi_display_enable\n");
> >> +	dsi_bus_lock(dsi);
> > 
> > Why is the lock needed here now ? Should it be part of a previous patch
> > ? Or, if I'm missing something, should the commit message explain this ?
> > Same for the other locations below.
> 
> Yes, the locking should've been done in earlier patch. I moved them.

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
  2020-11-11 10:11                                             ` Tomi Valkeinen
@ 2020-11-11 19:27                                               ` H. Nikolaus Schaller
  -1 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-11 19:27 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	Linux-OMAP, dri-devel, Sekhar Nori, Tony Lindgren,
	Discussions about the Letux Kernel


> Am 11.11.2020 um 11:11 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 11/11/2020 09:48, H. Nikolaus Schaller wrote:
>> 
>>> Am 11.11.2020 um 07:40 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> 
>>> On 10/11/2020 23:04, H. Nikolaus Schaller wrote:
>>>> 
>>>>> Am 10.11.2020 um 17:52 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>>> 
>>>>> On 10/11/2020 18:49, H. Nikolaus Schaller wrote:
>>>>> 
>>>>> I guess you have the same issue. It goes to dsi_bridge_mode_valid, then __dsi_calc_config, and stays
>>>>> there finding good clocks.
>>>> 
>>> 
>>> drm_display_mode.clock is in kHz, but the panel driver writes Hz (w677l_PIXELCLOCK) to it.
>> 
>> Ok, fixing this removes the stuck thread issue. Thanks for pointing this out!
>> 
>>> But
>>> there's more after fixing that. The DSI gets configured in bridge's modeset, which I think is before
>>> w677l_prepare where the panel already sends DSI commands. Also, the dsi driver fails to lock the
>>> PLL, so possibly the clock calcs are still wrong.
>> 
>> What I now get is
>> 
>> [  131.035006] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:55:crtc-0] flip_done timed out
>> [  141.272174] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CONNECTOR:54:DSI-1] flip_done timed out
>> 
>> I think for further experiments we could hack the device tree to compatible = "orisetech,otm8009a";
>> and configure for panel-orisetech-otm8009a.ko. Since this panel driver is known to work elsewhere
>> we could exclude panel driver issues for the moment. To be safe we can modify otm8009a_dcs_write_buf()
>> to just print what it would be doing.
> 
> I pushed some quick fixes/hacks to:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git 5.11/dsi
> 
> At least I get the DSI PLL configured, and kmstest --flip works with 60 fps.
> I'm pretty sure the panel won't work yet, though.

Yes, as expected it still does not work. I see:

[  168.236405] dsi_bridge_mode_valid r=-22
[  168.411769] omapdrm omapdrm.0: [drm] Cannot find any crtc or sizes
[  168.418382] omapdrm omapdrm.0: [drm] crtc_count = 0 width=-1 height=-1

The -EINVAL seems to come from dss_pll_calc_a() returning false.
So clock calculation sill fails after fixing the pixel clock.
No successful combination.

BR,
Nikolaus

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-11 19:27                                               ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-11 19:27 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Discussions about the Letux Kernel, Tony Lindgren, Sekhar Nori,
	Sebastian Reichel, dri-devel, Laurent Pinchart, Linux-OMAP,
	Nikhil Devshatwar


> Am 11.11.2020 um 11:11 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 11/11/2020 09:48, H. Nikolaus Schaller wrote:
>> 
>>> Am 11.11.2020 um 07:40 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> 
>>> On 10/11/2020 23:04, H. Nikolaus Schaller wrote:
>>>> 
>>>>> Am 10.11.2020 um 17:52 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>>>> 
>>>>> On 10/11/2020 18:49, H. Nikolaus Schaller wrote:
>>>>> 
>>>>> I guess you have the same issue. It goes to dsi_bridge_mode_valid, then __dsi_calc_config, and stays
>>>>> there finding good clocks.
>>>> 
>>> 
>>> drm_display_mode.clock is in kHz, but the panel driver writes Hz (w677l_PIXELCLOCK) to it.
>> 
>> Ok, fixing this removes the stuck thread issue. Thanks for pointing this out!
>> 
>>> But
>>> there's more after fixing that. The DSI gets configured in bridge's modeset, which I think is before
>>> w677l_prepare where the panel already sends DSI commands. Also, the dsi driver fails to lock the
>>> PLL, so possibly the clock calcs are still wrong.
>> 
>> What I now get is
>> 
>> [  131.035006] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:55:crtc-0] flip_done timed out
>> [  141.272174] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CONNECTOR:54:DSI-1] flip_done timed out
>> 
>> I think for further experiments we could hack the device tree to compatible = "orisetech,otm8009a";
>> and configure for panel-orisetech-otm8009a.ko. Since this panel driver is known to work elsewhere
>> we could exclude panel driver issues for the moment. To be safe we can modify otm8009a_dcs_write_buf()
>> to just print what it would be doing.
> 
> I pushed some quick fixes/hacks to:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git 5.11/dsi
> 
> At least I get the DSI PLL configured, and kmstest --flip works with 60 fps.
> I'm pretty sure the panel won't work yet, though.

Yes, as expected it still does not work. I see:

[  168.236405] dsi_bridge_mode_valid r=-22
[  168.411769] omapdrm omapdrm.0: [drm] Cannot find any crtc or sizes
[  168.418382] omapdrm omapdrm.0: [drm] crtc_count = 0 width=-1 height=-1

The -EINVAL seems to come from dss_pll_calc_a() returning false.
So clock calculation sill fails after fixing the pixel clock.
No successful combination.

BR,
Nikolaus
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
  2020-11-11 15:58         ` Laurent Pinchart
@ 2020-11-12  8:08           ` Tomi Valkeinen
  -1 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-12  8:08 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

On 11/11/2020 17:58, Laurent Pinchart wrote:

>>>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>>>> index 030a8fa140db..1582960f9e90 100644
>>>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>>>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>>>> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
>>>>  	return 0;
>>>>  }
>>>>  
>>>> -static int dsicm_set_update_window(struct panel_drv_data *ddata,
>>>> -		u16 x, u16 y, u16 w, u16 h)
>>>> -{
>>>> -	struct mipi_dsi_device *dsi = ddata->dsi;
>>>> -	int r;
>>>> -	u16 x1 = x;
>>>> -	u16 x2 = x + w - 1;
>>>> -	u16 y1 = y;
>>>> -	u16 y2 = y + h - 1;
>>>> -
>>>> -	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
>>>> -	if (r < 0)
>>>> -		return r;
>>>> -
>>>> -	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
>>>> -	if (r < 0)
>>>> -		return r;
>>>> -
>>>> -	return 0;
>>>> -}
>>>> -
>>>
>>> I can't tell whether this is common to all command-mode panels, or if
>>> there could be a need for panel-specific update procedures, so I can't
>>> really ack this patch.
>>
>> I can't say either, but all the command mode panels I know need and support this. And, afaik, we
>> have only the single cmd mode panel driver which we add in this series.
> 
> Now that I think about it again, isn't it a layering violation ?
> Shouldn't the DSI host handle DSI commands transfers, with the panel
> driver taking care of specific DSI commands ?

Well, the DSI host (the HW) already handles specific DSI commands, as it does the update with DCS
Write Start/Continue commands. The update is initiated from omap_crtc, via dssdev->dsi_ops->update().

We could perhaps add a new function to drm_panel_funcs, say, prepare_update, which could then do the
above.

Although I think the above code is not strictly speaking required, as the panel should remember the
column and page address, and as such, they could be set just once at config time.

However, I remember debugging issues related to this. And with a quick test, I can see that things
break down if I just do the above once in the panel's setup. But things work if I send a DSI NOP
instead in the dsi host. So looks to me that either the OMAP DSI or the panel I have need some
command transmitted there. It probably has to happen between two frame transfers.

There are also other things related to update which I'm not so happy about: 1) the TE gpio irq is
handled in the dsi host driver now, even if it's a panel gpio, 2) the dsi host driver snoops the DSI
packets sent by the panel, and catches TEAR_ON/OFF packets, and then change internal state accordingly.

So... I could change the dsi host driver to only send a NOP, and do the page/column call from the
panel's setup. That simplifies the code.

Or I could add the new function to drm_panel_funcs, and send a NOP from there. But if this "needs a
NOP" is an OMAP DSI feature, the panel driver is not the right place for it. I also think that
managing the TE cleanly needs more thought, and probably requires some more interaction between the
dsi host and the panel. It might be better to look at both the update callback and the TE at the
same time.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
@ 2020-11-12  8:08           ` Tomi Valkeinen
  0 siblings, 0 replies; 328+ messages in thread
From: Tomi Valkeinen @ 2020-11-12  8:08 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

On 11/11/2020 17:58, Laurent Pinchart wrote:

>>>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>>>> index 030a8fa140db..1582960f9e90 100644
>>>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>>>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>>>> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
>>>>  	return 0;
>>>>  }
>>>>  
>>>> -static int dsicm_set_update_window(struct panel_drv_data *ddata,
>>>> -		u16 x, u16 y, u16 w, u16 h)
>>>> -{
>>>> -	struct mipi_dsi_device *dsi = ddata->dsi;
>>>> -	int r;
>>>> -	u16 x1 = x;
>>>> -	u16 x2 = x + w - 1;
>>>> -	u16 y1 = y;
>>>> -	u16 y2 = y + h - 1;
>>>> -
>>>> -	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
>>>> -	if (r < 0)
>>>> -		return r;
>>>> -
>>>> -	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
>>>> -	if (r < 0)
>>>> -		return r;
>>>> -
>>>> -	return 0;
>>>> -}
>>>> -
>>>
>>> I can't tell whether this is common to all command-mode panels, or if
>>> there could be a need for panel-specific update procedures, so I can't
>>> really ack this patch.
>>
>> I can't say either, but all the command mode panels I know need and support this. And, afaik, we
>> have only the single cmd mode panel driver which we add in this series.
> 
> Now that I think about it again, isn't it a layering violation ?
> Shouldn't the DSI host handle DSI commands transfers, with the panel
> driver taking care of specific DSI commands ?

Well, the DSI host (the HW) already handles specific DSI commands, as it does the update with DCS
Write Start/Continue commands. The update is initiated from omap_crtc, via dssdev->dsi_ops->update().

We could perhaps add a new function to drm_panel_funcs, say, prepare_update, which could then do the
above.

Although I think the above code is not strictly speaking required, as the panel should remember the
column and page address, and as such, they could be set just once at config time.

However, I remember debugging issues related to this. And with a quick test, I can see that things
break down if I just do the above once in the panel's setup. But things work if I send a DSI NOP
instead in the dsi host. So looks to me that either the OMAP DSI or the panel I have need some
command transmitted there. It probably has to happen between two frame transfers.

There are also other things related to update which I'm not so happy about: 1) the TE gpio irq is
handled in the dsi host driver now, even if it's a panel gpio, 2) the dsi host driver snoops the DSI
packets sent by the panel, and catches TEAR_ON/OFF packets, and then change internal state accordingly.

So... I could change the dsi host driver to only send a NOP, and do the page/column call from the
panel's setup. That simplifies the code.

Or I could add the new function to drm_panel_funcs, and send a NOP from there. But if this "needs a
NOP" is an OMAP DSI feature, the panel driver is not the right place for it. I also think that
managing the TE cleanly needs more thought, and probably requires some more interaction between the
dsi host and the panel. It might be better to look at both the update callback and the TE at the
same time.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
       [not found]                                       ` <27cfb13a-62e3-0a53-153f-92641c437cee@ti.com>
@ 2020-11-16  9:16                                           ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-16  9:16 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Laurent Pinchart, Nikhil Devshatwar,
	Linux-OMAP, dri-devel, Sekhar Nori, Tony Lindgren,
	Discussions about the Letux Kernel

[-- Attachment #1: Type: text/plain, Size: 2962 bytes --]

Hi Tomi,
I hope you had a good weekend.

And I have added back the CC: list because I think we have progress after our internal discussion and only one issue remaining.

> Am 13.11.2020 um 15:49 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 13/11/2020 16:41, H. Nikolaus Schaller wrote:
>> Hi Tomi,
>> 
>>> Am 13.11.2020 um 14:38 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> 
>>> On 13/11/2020 15:35, H. Nikolaus Schaller wrote:
>>> 
>>>> So I'd say dsi_vc_send_short() fails if dsi_vc_enable_hs(0, 0) and not dsi_vc_enable_hs(0, 1)
>>> 
>>> Oh, forgot to mention this: remove MIPI_DSI_MODE_LPM from the panel driver.
>> 
>> Yes! This makes sending the init sequence work.
>> 
>> I just have failures from w677l_read() but that may be the panel driver wrapper code.
> 
> Ok, great! It would be good to have reads working too.

I have fixed it. The call to mipi_dsi_dcs_read() was wrong.

> That way we can know for sure if the commands
> go back and forth correctly (e.g. verify the panel version ID).

I can now read registers. Panel version ID is nonsense but I know that it was before.
Maybe they did not flash it during production since I only read 0x40,0x00,0x00.
But we can read it.

> 
>> If I remove all read commands (they are not necessary for operation), there are no error
>> messages and everything succeeds. I have a /dev/fb0.
>> 
>> But I have no picture yet.
>> 
>> Initially I thought that it was just the missing code to handle an external PWM backlight.
>> But even with (and backlight working), I have just a framebuffer with black screen.
>> 
>> Anyways, I think we are very close. And this is a great step forwards so that I need a
>> break...
>> 
>> Maybe I manage to consolidate the panel driver code before v5.10-rc4 arrives. This
>> would give a freshly merged letux tree.
> 
> Usually backlight glow is visible even if there's no picture.

Well, it did not turn the PWM on at all. Now this works as well.

Still I have no picture. But the readout of the register 0x45 (scan line) shows varying
values. Therefore I think the vsync is running and incrementing the scan line counter.

> But a comparison between the old, working driver, with dsi debugs enabled, may give some hints. A
> DISPC & DSI reg dump for both cases may also give hints.

I have a script to mount debugfs and dump registers. Results are attached.

Significant difference seem to be in:

DISPC_TIMING_H(LCD)
DSI_CLK_CTRL
DSI_VM_TIMING1
DSI_VM_TIMING6
DSI_VC_CTRL(0)
DSI_VC_CTRL(1)
DSI_DSIPHY_CFG2

The consolidated panel driver code is here:

	https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/boe-w677-dsi-panel-v2

Well, not yet clean for upstreaming but functionally much better than before.

What I have hacked is to mask out MIPI_DSI_MODE_LPM in mipi_dsi_attach(). This
can/will be replaced if your series can handle it.

BR,
Nikolaus


[-- Attachment #2: dsi-new.txt --]
[-- Type: text/plain, Size: 22233 bytes --]

root@letux:~# ./debugdsi 
- DSS -
FCK = 192000000
- DISPC -
dispc fclk source = FCK
fck             192000000       
- DISPC-CORE-CLK -
lck             192000000       lck div 1
- LCD -
LCD clk source = PLL1:1
lck             153600000       lck div 1
pck             76800000        pck div 2
- LCD2 -
LCD2 clk source = FCK
lck             48000000        lck div 4
pck             48000000        pck div 1
- LCD3 -
LCD3 clk source = FCK
lck             48000000        lck div 4
pck             48000000        pck div 1
DISPC_REVISION                                     00000051
DISPC_SYSCONFIG                                    00002015
DISPC_SYSSTATUS                                    00000001
DISPC_IRQSTATUS                                    000000a2
DISPC_IRQENABLE                                    0812d640
DISPC_CONTROL                                      00018309
DISPC_CONFIG                                       0000020c
DISPC_CAPABLE                                      00000000
DISPC_LINE_STATUS                                  000003e3
DISPC_LINE_NUMBER                                  00000000
DISPC_GLOBAL_ALPHA                                 ffffffff
DISPC_CONTROL2                                     00000000
DISPC_CONFIG2                                      00000000
DISPC_CONTROL3                                     00000000
DISPC_CONFIG3                                      00000000
DISPC_GLOBAL_MFLAG_ATTRIBUTE                       00000001
DISPC_DEFAULT_COLOR(LCD)                           00000000
DISPC_TRANS_COLOR(LCD)                             00000000
DISPC_SIZE_MGR(LCD)                                04ff02cf
DISPC_TIMING_H(LCD)                                0040a100
DISPC_TIMING_V(LCD)                                0320323b
DISPC_POL_FREQ(LCD)                                00060000
DISPC_DIVISORo(LCD)                                00010002
DISPC_DATA_CYCLE1(LCD)                             00000000
DISPC_DATA_CYCLE2(LCD)                             00000000
DISPC_DATA_CYCLE3(LCD)                             00000000
DISPC_CPR_COEF_R(LCD)                              00000000
DISPC_CPR_COEF_G(LCD)                              00000000
DISPC_CPR_COEF_B(LCD)                              00000000
DISPC_DEFAULT_COLOR(TV)                            00000000
DISPC_TRANS_COLOR(TV)                              00000000
DISPC_SIZE_MGR(TV)                                 00000000
DISPC_DEFAULT_COLOR(LCD2)                          00000000
DISPC_TRANS_COLOR(LCD2)                            00000000
DISPC_SIZE_MGR(LCD2)                               00000000
DISPC_TIMING_H(LCD2)                               00000000
DISPC_TIMING_V(LCD2)                               00000000
DISPC_POL_FREQ(LCD2)                               00000000
DISPC_DIVISORo(LCD2)                               00040001
DISPC_DATA_CYCLE1(LCD2)                            00000000
DISPC_DATA_CYCLE2(LCD2)                            00000000
DISPC_DATA_CYCLE3(LCD2)                            00000000
DISPC_CPR_COEF_R(LCD2)                             00000000
DISPC_CPR_COEF_G(LCD2)                             00000000
DISPC_CPR_COEF_B(LCD2)                             00000000
DISPC_DEFAULT_COLOR(LCD3)                          00000000
DISPC_TRANS_COLOR(LCD3)                            00000000
DISPC_SIZE_MGR(LCD3)                               00000000
DISPC_TIMING_H(LCD3)                               00000000
DISPC_TIMING_V(LCD3)                               00000000
DISPC_POL_FREQ(LCD3)                               00000000
DISPC_DIVISORo(LCD3)                               00040001
DISPC_DATA_CYCLE1(LCD3)                            00000000
DISPC_DATA_CYCLE2(LCD3)                            00000000
DISPC_DATA_CYCLE3(LCD3)                            00000000
DISPC_CPR_COEF_R(LCD3)                             00000000
DISPC_CPR_COEF_G(LCD3)                             00000000
DISPC_CPR_COEF_B(LCD3)                             00000000
DISPC_OVL_BA0(GFX)                                 10100000
DISPC_OVL_BA1(GFX)                                 10100000
DISPC_OVL_POSITION(GFX)                            00000000
DISPC_OVL_SIZE(GFX)                                04ff02cf
DISPC_OVL_ATTRIBUTES(GFX)                          320040b1
DISPC_OVL_FIFO_THRESHOLD(GFX)                      07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(GFX)                    00000500
DISPC_OVL_ROW_INC(GFX)                             000074c1
DISPC_OVL_PIXEL_INC(GFX)                           00000001
DISPC_OVL_PRELOAD(GFX)                             000007ff
DISPC_OVL_MFLAG_THRESHOLD(GFX)                     05000400
DISPC_OVL_WINDOW_SKIP(GFX)                         00000000
DISPC_OVL_TABLE_BA(GFX)                            00000000
DISPC_OVL_BA0(VID1)                                00000000
DISPC_OVL_BA1(VID1)                                00000000
DISPC_OVL_POSITION(VID1)                           00000000
DISPC_OVL_SIZE(VID1)                               00000000
DISPC_OVL_ATTRIBUTES(VID1)                         02808400
DISPC_OVL_FIFO_THRESHOLD(VID1)                     07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(VID1)                   00000800
DISPC_OVL_ROW_INC(VID1)                            00000001
DISPC_OVL_PIXEL_INC(VID1)                          00000001
DISPC_OVL_PRELOAD(VID1)                            000007ff
DISPC_OVL_MFLAG_THRESHOLD(VID1)                    05000400
DISPC_OVL_FIR(VID1)                                04000400
DISPC_OVL_PICTURE_SIZE(VID1)                       00000000
DISPC_OVL_ACCU0(VID1)                              00000000
DISPC_OVL_ACCU1(VID1)                              00000000
DISPC_OVL_BA0_UV(VID1)                             00000000
DISPC_OVL_BA1_UV(VID1)                             00000000
DISPC_OVL_FIR2(VID1)                               04000400
DISPC_OVL_ACCU2_0(VID1)                            00000000
DISPC_OVL_ACCU2_1(VID1)                            00000000
DISPC_OVL_ATTRIBUTES2(VID1)                        00000000
DISPC_OVL_BA0(VID2)                                00000000
DISPC_OVL_BA1(VID2)                                00000000
DISPC_OVL_POSITION(VID2)                           00000000
DISPC_OVL_SIZE(VID2)                               00000000
DISPC_OVL_ATTRIBUTES(VID2)                         02808400
DISPC_OVL_FIFO_THRESHOLD(VID2)                     07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(VID2)                   00000800
DISPC_OVL_ROW_INC(VID2)                            00000001
DISPC_OVL_PIXEL_INC(VID2)                          00000001
DISPC_OVL_PRELOAD(VID2)                            000007ff
DISPC_OVL_MFLAG_THRESHOLD(VID2)                    05000400
DISPC_OVL_FIR(VID2)                                04000400
DISPC_OVL_PICTURE_SIZE(VID2)                       00000000
DISPC_OVL_ACCU0(VID2)                              00000000
DISPC_OVL_ACCU1(VID2)                              00000000
DISPC_OVL_BA0_UV(VID2)                             00000000
DISPC_OVL_BA1_UV(VID2)                             00000000
DISPC_OVL_FIR2(VID2)                               04000400
DISPC_OVL_ACCU2_0(VID2)                            00000000
DISPC_OVL_ACCU2_1(VID2)                            00000000
DISPC_OVL_ATTRIBUTES2(VID2)                        00000000
DISPC_OVL_BA0(VID3)                                00000000
DISPC_OVL_BA1(VID3)                                00000000
DISPC_OVL_POSITION(VID3)                           00000000
DISPC_OVL_SIZE(VID3)                               00000000
DISPC_OVL_ATTRIBUTES(VID3)                         02808400
DISPC_OVL_FIFO_THRESHOLD(VID3)                     07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(VID3)                   00000800
DISPC_OVL_ROW_INC(VID3)                            00000001
DISPC_OVL_PIXEL_INC(VID3)                          00000001
DISPC_OVL_PRELOAD(VID3)                            000007ff
DISPC_OVL_MFLAG_THRESHOLD(VID3)                    05000400
DISPC_OVL_FIR(VID3)                                04000400
DISPC_OVL_PICTURE_SIZE(VID3)                       00000000
DISPC_OVL_ACCU0(VID3)                              00000000
DISPC_OVL_ACCU1(VID3)                              00000000
DISPC_OVL_BA0_UV(VID3)                             00000000
DISPC_OVL_BA1_UV(VID3)                             00000000
DISPC_OVL_FIR2(VID3)                               04000400
DISPC_OVL_ACCU2_0(VID3)                            00000000
DISPC_OVL_ACCU2_1(VID3)                            00000000
DISPC_OVL_ATTRIBUTES2(VID3)                        00000000
DISPC_OVL_BA0(WB)                                  00000000
DISPC_OVL_BA1(WB)                                  00000000
DISPC_OVL_SIZE(WB)                                 00000000
DISPC_OVL_ATTRIBUTES(WB)                           00808000
DISPC_OVL_FIFO_THRESHOLD(WB)                       00080000
DISPC_OVL_FIFO_SIZE_STATUS(WB)                     00000800
DISPC_OVL_ROW_INC(WB)                              00000001
DISPC_OVL_PIXEL_INC(WB)                            00000001
DISPC_OVL_MFLAG_THRESHOLD(WB)                      03200280
DISPC_OVL_FIR(WB)                                  04000400
DISPC_OVL_PICTURE_SIZE(WB)                         00000000
DISPC_OVL_ACCU0(WB)                                00000000
DISPC_OVL_ACCU1(WB)                                00000000
DISPC_OVL_BA0_UV(WB)                               00000000
DISPC_OVL_BA1_UV(WB)                               00000000
DISPC_OVL_FIR2(WB)                                 04000400
DISPC_OVL_ACCU2_0(WB)                              00000000
DISPC_OVL_ACCU2_1(WB)                              00000000
DISPC_OVL_ATTRIBUTES2(WB)                          00000000
DISPC_OVL_FIR_COEF_H_0(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_1(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_2(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_3(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_4(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_5(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_6(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_7(VID1)                       00000000
DISPC_OVL_FIR_COEF_HV_0(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_1(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_2(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_3(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_4(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_5(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_6(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_7(VID1)                      00000000
DISPC_OVL_CONV_COEF_0(VID1)                        0199012a
DISPC_OVL_CONV_COEF_1(VID1)                        012a0000
DISPC_OVL_CONV_COEF_2(VID1)                        079c0730
DISPC_OVL_CONV_COEF_3(VID1)                        0000012a
DISPC_OVL_CONV_COEF_4(VID1)                        00000204
DISPC_OVL_FIR_COEF_V_0(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_1(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_2(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_3(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_4(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_5(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_6(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_7(VID1)                       00000000
DISPC_OVL_FIR_COEF_H2_0(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_1(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_2(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_3(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_4(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_5(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_6(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_7(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV2_0(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_1(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_2(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_3(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_4(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_5(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_6(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_7(VID1)                     00000000
DISPC_OVL_FIR_COEF_V2_0(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_1(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_2(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_3(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_4(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_5(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_6(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_7(VID1)                      00000000
DISPC_OVL_FIR_COEF_H_0(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_1(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_2(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_3(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_4(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_5(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_6(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_7(VID2)                       00000000
DISPC_OVL_FIR_COEF_HV_0(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_1(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_2(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_3(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_4(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_5(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_6(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_7(VID2)                      00000000
DISPC_OVL_CONV_COEF_0(VID2)                        0199012a
DISPC_OVL_CONV_COEF_1(VID2)                        012a0000
DISPC_OVL_CONV_COEF_2(VID2)                        079c0730
DISPC_OVL_CONV_COEF_3(VID2)                        0000012a
DISPC_OVL_CONV_COEF_4(VID2)                        00000204
DISPC_OVL_FIR_COEF_V_0(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_1(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_2(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_3(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_4(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_5(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_6(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_7(VID2)                       00000000
DISPC_OVL_FIR_COEF_H2_0(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_1(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_2(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_3(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_4(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_5(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_6(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_7(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV2_0(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_1(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_2(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_3(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_4(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_5(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_6(VID2)                     00000000
[  117.525871] DSI: dsi_runtime_get
[  117.532527] DSI: dsi_runtime_put
DISPC_OVL_FIR_COEF_HV2_7(VID2)                     00000000
DISPC_OVL_FIR_COEF_V2_0(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_1(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_2(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_3(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_4(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_5(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_6(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_7(VID2)                      00000000
DISPC_OVL_FIR_COEF_H_0(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_1(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_2(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_3(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_4(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_5(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_6(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_7(VID3)                       00000000
DISPC_OVL_FIR_COEF_HV_0(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_1(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_2(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_3(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_4(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_5(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_6(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_7(VID3)                      00000000
DISPC_OVL_CONV_COEF_0(VID3)                        0199012a
DISPC_OVL_CONV_COEF_1(VID3)                        012a0000
DISPC_OVL_CONV_COEF_2(VID3)                        079c0730
DISPC_OVL_CONV_COEF_3(VID3)                        0000012a
DISPC_OVL_CONV_COEF_4(VID3)                        00000204
DISPC_OVL_FIR_COEF_V_0(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_1(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_2(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_3(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_4(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_5(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_6(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_7(VID3)                       00000000
DISPC_OVL_FIR_COEF_H2_0(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_1(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_2(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_3(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_4(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_5(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_6(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_7(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV2_0(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_1(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_2(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_3(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_4(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_5(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_6(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_7(VID3)                     00000000
DISPC_OVL_FIR_COEF_V2_0(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_1(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_2(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_3(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_4(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_5(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_6(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_7(VID3)                      00000000
cat: /sys/kernel/debug/omapdss/dsi1_irqs: No such file or directory
DSI_REVISION                        00000040
DSI_SYSCONFIG                       00000015
DSI_SYSSTATUS                       00000001
DSI_IRQSTATUS                       00000000
DSI_IRQENABLE                       0015c000
DSI_CTRL                            00eaee9f
DSI_COMPLEXIO_CFG1                  2a0dcba9
DSI_COMPLEXIO_IRQ_STATUS            00000000
DSI_COMPLEXIO_IRQ_ENABLE            3ff07fff
DSI_CLK_CTRL                        a030400b
DSI_TIMING1                         ffff1000
DSI_TIMING2                         ffffffff
DSI_VM_TIMING1                      00078003
DSI_VM_TIMING2                      043c3232
DSI_VM_TIMING3                      029a0500
DSI_CLK_TIMING                      00001b10
DSI_TX_FIFO_VC_SIZE                 13121110
DSI_RX_FIFO_VC_SIZE                 13121110
DSI_COMPLEXIO_CFG2                  00030000
DSI_RX_FIFO_VC_FULLNESS             00000000
DSI_VM_TIMING4                      00000000
DSI_TX_FIFO_VC_EMPTINESS            1f1f1e1f
DSI_VM_TIMING5                      00000000
DSI_VM_TIMING6                      01000007
DSI_VM_TIMING7                      00100010
DSI_STOPCLK_TIMING                  00000080
DSI_VC_CTRL(0)                      20808f81
DSI_VC_TE(0)                        00000000
DSI_VC_LONG_PACKET_HEADER(0)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(0)       00000000
DSI_VC_SHORT_PACKET_HEADER(0)       00000000
DSI_VC_IRQSTATUS(0)                 00000000
DSI_VC_IRQENABLE(0)                 000000db
DSI_VC_CTRL(1)                      20808fb1
DSI_VC_TE(1)                        00000000
DSI_VC_LONG_PACKET_HEADER(1)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(1)       00000000
DSI_VC_SHORT_PACKET_HEADER(1)       00000000
DSI_VC_IRQSTATUS(1)                 00000000
DSI_VC_IRQENABLE(1)                 000000db
DSI_VC_CTRL(2)                      20808d81
DSI_VC_TE(2)                        00000000
DSI_VC_LONG_PACKET_HEADER(2)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(2)       00000000
DSI_VC_SHORT_PACKET_HEADER(2)       00000000
DSI_VC_IRQSTATUS(2)                 00000000
DSI_VC_IRQENABLE(2)                 000000db
DSI_VC_CTRL(3)                      20808d81
DSI_VC_TE(3)                        00000000
DSI_VC_LONG_PACKET_HEADER(3)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(3)       00000000
DSI_VC_SHORT_PACKET_HEADER(3)       00000000
DSI_VC_IRQSTATUS(3)                 00000000
DSI_VC_IRQENABLE(3)                 000000db
DSI_DSIPHY_CFG0                     132b1322
DSI_DSIPHY_CFG1                     42c6103c
DSI_DSIPHY_CFG2                     b83e000f
DSI_DSIPHY_CFG5                     ff000000
DSI_PLL_CONTROL                     00000018
DSI_PLL_STATUS                      00006383
DSI_PLL_GO                          00000000
DSI_PLL_CONFIGURATION1              10a03000
DSI_PLL_CONFIGURATION2              00656004
root@letux:~# 

[-- Attachment #3: dsi-oldi.txt --]
[-- Type: text/plain, Size: 22161 bytes --]

root@letux:~# ./debugdsi 
- DSS -
FCK = 192000000
- DISPC -
dispc fclk source = FCK
fck             192000000       
- DISPC-CORE-CLK -
lck             192000000       lck div 1
- LCD -
LCD clk source = PLL1:1
lck             153600000       lck div 1
pck             76800000        pck div 2
- LCD2 -
LCD2 clk source = FCK
lck             48000000        lck div 4
pck             48000000        pck div 1
- LCD3 -
LCD3 clk source = FCK
lck             48000000        lck div 4
pck             48000000        pck div 1
DISPC_REVISION                                     00000051
DISPC_SYSCONFIG                                    00002015
DISPC_SYSSTATUS                                    00000001
DISPC_IRQSTATUS                                    000000a2
DISPC_IRQENABLE                                    0812d640
DISPC_CONTROL                                      00018309
DISPC_CONFIG                                       0000020c
DISPC_CAPABLE                                      00000000
DISPC_LINE_STATUS                                  000001af
DISPC_LINE_NUMBER                                  00000000
DISPC_GLOBAL_ALPHA                                 ffffffff
DISPC_CONTROL2                                     00000000
DISPC_CONFIG2                                      00000000
DISPC_CONTROL3                                     00000000
DISPC_CONFIG3                                      00000000
DISPC_GLOBAL_MFLAG_ATTRIBUTE                       00000001
DISPC_DEFAULT_COLOR(LCD)                           00000000
DISPC_TRANS_COLOR(LCD)                             00000000
DISPC_SIZE_MGR(LCD)                                04ff02cf
DISPC_TIMING_H(LCD)                                09d00800
DISPC_TIMING_V(LCD)                                0320323b
DISPC_POL_FREQ(LCD)                                00060000
DISPC_DIVISORo(LCD)                                00010002
DISPC_DATA_CYCLE1(LCD)                             00000000
DISPC_DATA_CYCLE2(LCD)                             00000000
DISPC_DATA_CYCLE3(LCD)                             00000000
DISPC_CPR_COEF_R(LCD)                              00000000
DISPC_CPR_COEF_G(LCD)                              00000000
DISPC_CPR_COEF_B(LCD)                              00000000
DISPC_DEFAULT_COLOR(TV)                            00000000
DISPC_TRANS_COLOR(TV)                              00000000
DISPC_SIZE_MGR(TV)                                 00000000
DISPC_DEFAULT_COLOR(LCD2)                          00000000
DISPC_TRANS_COLOR(LCD2)                            00000000
DISPC_SIZE_MGR(LCD2)                               00000000
DISPC_TIMING_H(LCD2)                               00000000
DISPC_TIMING_V(LCD2)                               00000000
DISPC_POL_FREQ(LCD2)                               00000000
DISPC_DIVISORo(LCD2)                               00040001
DISPC_DATA_CYCLE1(LCD2)                            00000000
DISPC_DATA_CYCLE2(LCD2)                            00000000
DISPC_DATA_CYCLE3(LCD2)                            00000000
DISPC_CPR_COEF_R(LCD2)                             00000000
DISPC_CPR_COEF_G(LCD2)                             00000000
DISPC_CPR_COEF_B(LCD2)                             00000000
DISPC_DEFAULT_COLOR(LCD3)                          00000000
DISPC_TRANS_COLOR(LCD3)                            00000000
DISPC_SIZE_MGR(LCD3)                               00000000
DISPC_TIMING_H(LCD3)                               00000000
DISPC_TIMING_V(LCD3)                               00000000
DISPC_POL_FREQ(LCD3)                               00000000
DISPC_DIVISORo(LCD3)                               00040001
DISPC_DATA_CYCLE1(LCD3)                            00000000
DISPC_DATA_CYCLE2(LCD3)                            00000000
DISPC_DATA_CYCLE3(LCD3)                            00000000
DISPC_CPR_COEF_R(LCD3)                             00000000
DISPC_CPR_COEF_G(LCD3)                             00000000
DISPC_CPR_COEF_B(LCD3)                             00000000
DISPC_OVL_BA0(GFX)                                 d0003440
DISPC_OVL_BA1(GFX)                                 d0003440
DISPC_OVL_POSITION(GFX)                            00000000
DISPC_OVL_SIZE(GFX)                                04ff02cf
DISPC_OVL_ATTRIBUTES(GFX)                          320040b1
DISPC_OVL_FIFO_THRESHOLD(GFX)                      07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(GFX)                    00000500
DISPC_OVL_ROW_INC(GFX)                             000034c1
DISPC_OVL_PIXEL_INC(GFX)                           00000001
DISPC_OVL_PRELOAD(GFX)                             000007ff
DISPC_OVL_MFLAG_THRESHOLD(GFX)                     05000400
DISPC_OVL_WINDOW_SKIP(GFX)                         00000000
DISPC_OVL_TABLE_BA(GFX)                            00000000
DISPC_OVL_BA0(VID1)                                00000000
DISPC_OVL_BA1(VID1)                                00000000
DISPC_OVL_POSITION(VID1)                           00000000
DISPC_OVL_SIZE(VID1)                               00000000
DISPC_OVL_ATTRIBUTES(VID1)                         02808400
DISPC_OVL_FIFO_THRESHOLD(VID1)                     07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(VID1)                   00000800
DISPC_OVL_ROW_INC(VID1)                            00000001
DISPC_OVL_PIXEL_INC(VID1)                          00000001
DISPC_OVL_PRELOAD(VID1)                            000007ff
DISPC_OVL_MFLAG_THRESHOLD(VID1)                    05000400
DISPC_OVL_FIR(VID1)                                04000400
DISPC_OVL_PICTURE_SIZE(VID1)                       00000000
DISPC_OVL_ACCU0(VID1)                              00000000
DISPC_OVL_ACCU1(VID1)                              00000000
DISPC_OVL_BA0_UV(VID1)                             00000000
DISPC_OVL_BA1_UV(VID1)                             00000000
DISPC_OVL_FIR2(VID1)                               04000400
DISPC_OVL_ACCU2_0(VID1)                            00000000
DISPC_OVL_ACCU2_1(VID1)                            00000000
DISPC_OVL_ATTRIBUTES2(VID1)                        00000000
DISPC_OVL_BA0(VID2)                                00000000
DISPC_OVL_BA1(VID2)                                00000000
DISPC_OVL_POSITION(VID2)                           00000000
DISPC_OVL_SIZE(VID2)                               00000000
DISPC_OVL_ATTRIBUTES(VID2)                         02808400
DISPC_OVL_FIFO_THRESHOLD(VID2)                     07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(VID2)                   00000800
DISPC_OVL_ROW_INC(VID2)                            00000001
DISPC_OVL_PIXEL_INC(VID2)                          00000001
DISPC_OVL_PRELOAD(VID2)                            000007ff
DISPC_OVL_MFLAG_THRESHOLD(VID2)                    05000400
DISPC_OVL_FIR(VID2)                                04000400
DISPC_OVL_PICTURE_SIZE(VID2)                       00000000
DISPC_OVL_ACCU0(VID2)                              00000000
DISPC_OVL_ACCU1(VID2)                              00000000
DISPC_OVL_BA0_UV(VID2)                             00000000
DISPC_OVL_BA1_UV(VID2)                             00000000
DISPC_OVL_FIR2(VID2)                               04000400
DISPC_OVL_ACCU2_0(VID2)                            00000000
DISPC_OVL_ACCU2_1(VID2)                            00000000
DISPC_OVL_ATTRIBUTES2(VID2)                        00000000
DISPC_OVL_BA0(VID3)                                00000000
DISPC_OVL_BA1(VID3)                                00000000
DISPC_OVL_POSITION(VID3)                           00000000
DISPC_OVL_SIZE(VID3)                               00000000
DISPC_OVL_ATTRIBUTES(VID3)                         02808400
DISPC_OVL_FIFO_THRESHOLD(VID3)                     07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(VID3)                   00000800
DISPC_OVL_ROW_INC(VID3)                            00000001
DISPC_OVL_PIXEL_INC(VID3)                          00000001
DISPC_OVL_PRELOAD(VID3)                            000007ff
DISPC_OVL_MFLAG_THRESHOLD(VID3)                    05000400
DISPC_OVL_FIR(VID3)                                04000400
DISPC_OVL_PICTURE_SIZE(VID3)                       00000000
DISPC_OVL_ACCU0(VID3)                              00000000
DISPC_OVL_ACCU1(VID3)                              00000000
DISPC_OVL_BA0_UV(VID3)                             00000000
DISPC_OVL_BA1_UV(VID3)                             00000000
DISPC_OVL_FIR2(VID3)                               04000400
DISPC_OVL_ACCU2_0(VID3)                            00000000
DISPC_OVL_ACCU2_1(VID3)                            00000000
DISPC_OVL_ATTRIBUTES2(VID3)                        00000000
DISPC_OVL_BA0(WB)                                  00000000
DISPC_OVL_BA1(WB)                                  00000000
DISPC_OVL_SIZE(WB)                                 00000000
DISPC_OVL_ATTRIBUTES(WB)                           00808000
DISPC_OVL_FIFO_THRESHOLD(WB)                       00080000
DISPC_OVL_FIFO_SIZE_STATUS(WB)                     00000800
DISPC_OVL_ROW_INC(WB)                              00000001
DISPC_OVL_PIXEL_INC(WB)                            00000001
DISPC_OVL_MFLAG_THRESHOLD(WB)                      03200280
DISPC_OVL_FIR(WB)                                  04000400
DISPC_OVL_PICTURE_SIZE(WB)                         00000000
DISPC_OVL_ACCU0(WB)                                00000000
DISPC_OVL_ACCU1(WB)                                00000000
DISPC_OVL_BA0_UV(WB)                               00000000
DISPC_OVL_BA1_UV(WB)                               00000000
DISPC_OVL_FIR2(WB)                                 04000400
DISPC_OVL_ACCU2_0(WB)                              00000000
DISPC_OVL_ACCU2_1(WB)                              00000000
DISPC_OVL_ATTRIBUTES2(WB)                          00000000
DISPC_OVL_FIR_COEF_H_0(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_1(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_2(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_3(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_4(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_5(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_6(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_7(VID1)                       00000000
DISPC_OVL_FIR_COEF_HV_0(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_1(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_2(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_3(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_4(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_5(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_6(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_7(VID1)                      00000000
DISPC_OVL_CONV_COEF_0(VID1)                        0199012a
DISPC_OVL_CONV_COEF_1(VID1)                        012a0000
DISPC_OVL_CONV_COEF_2(VID1)                        079c0730
DISPC_OVL_CONV_COEF_3(VID1)                        0000012a
DISPC_OVL_CONV_COEF_4(VID1)                        00000204
DISPC_OVL_FIR_COEF_V_0(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_1(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_2(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_3(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_4(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_5(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_6(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_7(VID1)                       00000000
DISPC_OVL_FIR_COEF_H2_0(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_1(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_2(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_3(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_4(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_5(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_6(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_7(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV2_0(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_1(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_2(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_3(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_4(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_5(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_6(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_7(VID1)                     00000000
DISPC_OVL_FIR_COEF_V2_0(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_1(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_2(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_3(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_4(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_5(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_6(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_7(VID1)                      00000000
DISPC_OVL_FIR_COEF_H_0(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_1(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_2(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_3(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_4(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_5(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_6(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_7(VID2)                       00000000
DISPC_OVL_FIR_COEF_HV_0(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_1(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_2(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_3(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_4(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_5(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_6(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_7(VID2)                      00000000
DISPC_OVL_CONV_COEF_0(VID2)                        0199012a
DISPC_OVL_CONV_COEF_1(VID2)                        012a0000
DISPC_OVL_CONV_COEF_2(VID2)                        079c0730
DISPC_OVL_CONV_COEF_3(VID2)                        0000012a
DISPC_OVL_CONV_COEF_4(VID2)                        00000204
DISPC_OVL_FIR_COEF_V_0(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_1(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_2(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_3(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_4(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_5(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_6(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_7(VID2)                       00000000
DISPC_OVL_FIR_COEF_H2_0(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_1(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_2(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_3(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_4(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_5(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_6(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_7(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV2_0(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_1(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_2(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_3(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_4(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_5(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_6(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_7(VID2)                     00000000
DISPC_OVL_FIR_COEF_V2_0(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_1(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_2(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_3(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_4(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_5(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_6(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_7(VID2)                      00000000
DISPC_OVL_FIR_COEF_H_0(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_1(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_2(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_3(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_4(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_5(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_6(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_7(VID3)                       00000000
DISPC_OVL_FIR_COEF_HV_0(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_1(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_2(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_3(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_4(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_5(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_6(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_7(VID3)                      00000000
DISPC_OVL_CONV_COEF_0(VID3)                        0199012a
DISPC_OVL_CONV_COEF_1(VID3)                        012a0000
DISPC_OVL_CONV_COEF_2(VID3)                        079c0730
DISPC_OVL_CONV_COEF_3(VID3)                        0000012a
DISPC_OVL_CONV_COEF_4(VID3)                        00000204
DISPC_OVL_FIR_COEF_V_0(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_1(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_2(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_3(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_4(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_5(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_6(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_7(VID3)                       00000000
DISPC_OVL_FIR_COEF_H2_0(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_1(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_2(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_3(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_4(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_5(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_6(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_7(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV2_0(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_1(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_2(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_3(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_4(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_5(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_6(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_7(VID3)                     00000000
DISPC_OVL_FIR_COEF_V2_0(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_1(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_2(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_3(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_4(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_5(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_6(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_7(VID3)                      00000000
cat: /sys/kernel/debug/omapdss/dsi1_irqs: No such file or directory
DSI_REVISION                        00000040
DSI_SYSCONFIG                       00000015
DSI_SYSSTATUS                       00000001
DSI_IRQSTATUS                       00000000
DSI_IRQENABLE                       0015c000
DSI_CTRL                            00eaee9f
DSI_COMPLEXIO_CFG1                  2a0dcba9
DSI_COMPLEXIO_IRQ_STATUS            00000000
DSI_COMPLEXIO_IRQ_ENABLE            3ff07fff
DSI_CLK_CTRL                        a030600b
DSI_TIMING1                         ffff1000
DSI_TIMING2                         ffffffff
DSI_VM_TIMING1                      00005076
DSI_VM_TIMING2                      043c3232
DSI_VM_TIMING3                      029a0500
DSI_CLK_TIMING                      00001b10
DSI_TX_FIFO_VC_SIZE                 13121110
DSI_RX_FIFO_VC_SIZE                 13121110
DSI_COMPLEXIO_CFG2                  00030000
DSI_RX_FIFO_VC_FULLNESS             00000000
DSI_VM_TIMING4                      00000000
DSI_TX_FIFO_VC_EMPTINESS            1f1f1f1f
DSI_VM_TIMING5                      00000000
DSI_VM_TIMING6                      01340007
DSI_VM_TIMING7                      00100010
DSI_STOPCLK_TIMING                  00000080
DSI_VC_CTRL(0)                      20808f91
DSI_VC_TE(0)                        00000000
DSI_VC_LONG_PACKET_HEADER(0)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(0)       00000000
DSI_VC_SHORT_PACKET_HEADER(0)       00000000
DSI_VC_IRQSTATUS(0)                 00000004
DSI_VC_IRQENABLE(0)                 000000db
DSI_VC_CTRL(1)                      20808d81
DSI_VC_TE(1)                        00000000
DSI_VC_LONG_PACKET_HEADER(1)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(1)       00000000
DSI_VC_SHORT_PACKET_HEADER(1)       00000000
DSI_VC_IRQSTATUS(1)                 00000004
DSI_VC_IRQENABLE(1)                 000000db
DSI_VC_CTRL(2)                      20808d81
DSI_VC_TE(2)                        00000000
DSI_VC_LONG_PACKET_HEADER(2)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(2)       00000000
DSI_VC_SHORT_PACKET_HEADER(2)       00000000
DSI_VC_IRQSTATUS(2)                 00000000
DSI_VC_IRQENABLE(2)                 000000db
DSI_VC_CTRL(3)                      20808d81
DSI_VC_TE(3)                        00000000
DSI_VC_LONG_PACKET_HEADER(3)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(3)       00000000
DSI_VC_SHORT_PACKET_HEADER(3)       00000000
DSI_VC_IRQSTATUS(3)                 00000000
DSI_VC_IRQENABLE(3)                 000000db
DSI_DSIPHY_CFG0                     132b1322
DSI_DSIPHY_CFG1                     42c6103c
DSI_DSIPHY_CFG2                     b800000f
DSI_DSIPHY_CFG5                     ff000000
DSI_PLL_CONTROL                     00000018
DSI_PLL_STATUS                      00006383
DSI_PLL_GO                          00000000
DSI_PLL_CONFIGURATION1              10a03000
DSI_PLL_CONFIGURATION2              00656004
root@letux:~# 

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




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

* Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel
@ 2020-11-16  9:16                                           ` H. Nikolaus Schaller
  0 siblings, 0 replies; 328+ messages in thread
From: H. Nikolaus Schaller @ 2020-11-16  9:16 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Discussions about the Letux Kernel, Tony Lindgren, Sekhar Nori,
	Sebastian Reichel, dri-devel, Laurent Pinchart, Linux-OMAP,
	Nikhil Devshatwar

[-- Attachment #1: Type: text/plain, Size: 2962 bytes --]

Hi Tomi,
I hope you had a good weekend.

And I have added back the CC: list because I think we have progress after our internal discussion and only one issue remaining.

> Am 13.11.2020 um 15:49 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
> 
> On 13/11/2020 16:41, H. Nikolaus Schaller wrote:
>> Hi Tomi,
>> 
>>> Am 13.11.2020 um 14:38 schrieb Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> 
>>> On 13/11/2020 15:35, H. Nikolaus Schaller wrote:
>>> 
>>>> So I'd say dsi_vc_send_short() fails if dsi_vc_enable_hs(0, 0) and not dsi_vc_enable_hs(0, 1)
>>> 
>>> Oh, forgot to mention this: remove MIPI_DSI_MODE_LPM from the panel driver.
>> 
>> Yes! This makes sending the init sequence work.
>> 
>> I just have failures from w677l_read() but that may be the panel driver wrapper code.
> 
> Ok, great! It would be good to have reads working too.

I have fixed it. The call to mipi_dsi_dcs_read() was wrong.

> That way we can know for sure if the commands
> go back and forth correctly (e.g. verify the panel version ID).

I can now read registers. Panel version ID is nonsense but I know that it was before.
Maybe they did not flash it during production since I only read 0x40,0x00,0x00.
But we can read it.

> 
>> If I remove all read commands (they are not necessary for operation), there are no error
>> messages and everything succeeds. I have a /dev/fb0.
>> 
>> But I have no picture yet.
>> 
>> Initially I thought that it was just the missing code to handle an external PWM backlight.
>> But even with (and backlight working), I have just a framebuffer with black screen.
>> 
>> Anyways, I think we are very close. And this is a great step forwards so that I need a
>> break...
>> 
>> Maybe I manage to consolidate the panel driver code before v5.10-rc4 arrives. This
>> would give a freshly merged letux tree.
> 
> Usually backlight glow is visible even if there's no picture.

Well, it did not turn the PWM on at all. Now this works as well.

Still I have no picture. But the readout of the register 0x45 (scan line) shows varying
values. Therefore I think the vsync is running and incrementing the scan line counter.

> But a comparison between the old, working driver, with dsi debugs enabled, may give some hints. A
> DISPC & DSI reg dump for both cases may also give hints.

I have a script to mount debugfs and dump registers. Results are attached.

Significant difference seem to be in:

DISPC_TIMING_H(LCD)
DSI_CLK_CTRL
DSI_VM_TIMING1
DSI_VM_TIMING6
DSI_VC_CTRL(0)
DSI_VC_CTRL(1)
DSI_DSIPHY_CFG2

The consolidated panel driver code is here:

	https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/boe-w677-dsi-panel-v2

Well, not yet clean for upstreaming but functionally much better than before.

What I have hacked is to mask out MIPI_DSI_MODE_LPM in mipi_dsi_attach(). This
can/will be replaced if your series can handle it.

BR,
Nikolaus


[-- Attachment #2: dsi-new.txt --]
[-- Type: text/plain, Size: 22233 bytes --]

root@letux:~# ./debugdsi 
- DSS -
FCK = 192000000
- DISPC -
dispc fclk source = FCK
fck             192000000       
- DISPC-CORE-CLK -
lck             192000000       lck div 1
- LCD -
LCD clk source = PLL1:1
lck             153600000       lck div 1
pck             76800000        pck div 2
- LCD2 -
LCD2 clk source = FCK
lck             48000000        lck div 4
pck             48000000        pck div 1
- LCD3 -
LCD3 clk source = FCK
lck             48000000        lck div 4
pck             48000000        pck div 1
DISPC_REVISION                                     00000051
DISPC_SYSCONFIG                                    00002015
DISPC_SYSSTATUS                                    00000001
DISPC_IRQSTATUS                                    000000a2
DISPC_IRQENABLE                                    0812d640
DISPC_CONTROL                                      00018309
DISPC_CONFIG                                       0000020c
DISPC_CAPABLE                                      00000000
DISPC_LINE_STATUS                                  000003e3
DISPC_LINE_NUMBER                                  00000000
DISPC_GLOBAL_ALPHA                                 ffffffff
DISPC_CONTROL2                                     00000000
DISPC_CONFIG2                                      00000000
DISPC_CONTROL3                                     00000000
DISPC_CONFIG3                                      00000000
DISPC_GLOBAL_MFLAG_ATTRIBUTE                       00000001
DISPC_DEFAULT_COLOR(LCD)                           00000000
DISPC_TRANS_COLOR(LCD)                             00000000
DISPC_SIZE_MGR(LCD)                                04ff02cf
DISPC_TIMING_H(LCD)                                0040a100
DISPC_TIMING_V(LCD)                                0320323b
DISPC_POL_FREQ(LCD)                                00060000
DISPC_DIVISORo(LCD)                                00010002
DISPC_DATA_CYCLE1(LCD)                             00000000
DISPC_DATA_CYCLE2(LCD)                             00000000
DISPC_DATA_CYCLE3(LCD)                             00000000
DISPC_CPR_COEF_R(LCD)                              00000000
DISPC_CPR_COEF_G(LCD)                              00000000
DISPC_CPR_COEF_B(LCD)                              00000000
DISPC_DEFAULT_COLOR(TV)                            00000000
DISPC_TRANS_COLOR(TV)                              00000000
DISPC_SIZE_MGR(TV)                                 00000000
DISPC_DEFAULT_COLOR(LCD2)                          00000000
DISPC_TRANS_COLOR(LCD2)                            00000000
DISPC_SIZE_MGR(LCD2)                               00000000
DISPC_TIMING_H(LCD2)                               00000000
DISPC_TIMING_V(LCD2)                               00000000
DISPC_POL_FREQ(LCD2)                               00000000
DISPC_DIVISORo(LCD2)                               00040001
DISPC_DATA_CYCLE1(LCD2)                            00000000
DISPC_DATA_CYCLE2(LCD2)                            00000000
DISPC_DATA_CYCLE3(LCD2)                            00000000
DISPC_CPR_COEF_R(LCD2)                             00000000
DISPC_CPR_COEF_G(LCD2)                             00000000
DISPC_CPR_COEF_B(LCD2)                             00000000
DISPC_DEFAULT_COLOR(LCD3)                          00000000
DISPC_TRANS_COLOR(LCD3)                            00000000
DISPC_SIZE_MGR(LCD3)                               00000000
DISPC_TIMING_H(LCD3)                               00000000
DISPC_TIMING_V(LCD3)                               00000000
DISPC_POL_FREQ(LCD3)                               00000000
DISPC_DIVISORo(LCD3)                               00040001
DISPC_DATA_CYCLE1(LCD3)                            00000000
DISPC_DATA_CYCLE2(LCD3)                            00000000
DISPC_DATA_CYCLE3(LCD3)                            00000000
DISPC_CPR_COEF_R(LCD3)                             00000000
DISPC_CPR_COEF_G(LCD3)                             00000000
DISPC_CPR_COEF_B(LCD3)                             00000000
DISPC_OVL_BA0(GFX)                                 10100000
DISPC_OVL_BA1(GFX)                                 10100000
DISPC_OVL_POSITION(GFX)                            00000000
DISPC_OVL_SIZE(GFX)                                04ff02cf
DISPC_OVL_ATTRIBUTES(GFX)                          320040b1
DISPC_OVL_FIFO_THRESHOLD(GFX)                      07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(GFX)                    00000500
DISPC_OVL_ROW_INC(GFX)                             000074c1
DISPC_OVL_PIXEL_INC(GFX)                           00000001
DISPC_OVL_PRELOAD(GFX)                             000007ff
DISPC_OVL_MFLAG_THRESHOLD(GFX)                     05000400
DISPC_OVL_WINDOW_SKIP(GFX)                         00000000
DISPC_OVL_TABLE_BA(GFX)                            00000000
DISPC_OVL_BA0(VID1)                                00000000
DISPC_OVL_BA1(VID1)                                00000000
DISPC_OVL_POSITION(VID1)                           00000000
DISPC_OVL_SIZE(VID1)                               00000000
DISPC_OVL_ATTRIBUTES(VID1)                         02808400
DISPC_OVL_FIFO_THRESHOLD(VID1)                     07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(VID1)                   00000800
DISPC_OVL_ROW_INC(VID1)                            00000001
DISPC_OVL_PIXEL_INC(VID1)                          00000001
DISPC_OVL_PRELOAD(VID1)                            000007ff
DISPC_OVL_MFLAG_THRESHOLD(VID1)                    05000400
DISPC_OVL_FIR(VID1)                                04000400
DISPC_OVL_PICTURE_SIZE(VID1)                       00000000
DISPC_OVL_ACCU0(VID1)                              00000000
DISPC_OVL_ACCU1(VID1)                              00000000
DISPC_OVL_BA0_UV(VID1)                             00000000
DISPC_OVL_BA1_UV(VID1)                             00000000
DISPC_OVL_FIR2(VID1)                               04000400
DISPC_OVL_ACCU2_0(VID1)                            00000000
DISPC_OVL_ACCU2_1(VID1)                            00000000
DISPC_OVL_ATTRIBUTES2(VID1)                        00000000
DISPC_OVL_BA0(VID2)                                00000000
DISPC_OVL_BA1(VID2)                                00000000
DISPC_OVL_POSITION(VID2)                           00000000
DISPC_OVL_SIZE(VID2)                               00000000
DISPC_OVL_ATTRIBUTES(VID2)                         02808400
DISPC_OVL_FIFO_THRESHOLD(VID2)                     07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(VID2)                   00000800
DISPC_OVL_ROW_INC(VID2)                            00000001
DISPC_OVL_PIXEL_INC(VID2)                          00000001
DISPC_OVL_PRELOAD(VID2)                            000007ff
DISPC_OVL_MFLAG_THRESHOLD(VID2)                    05000400
DISPC_OVL_FIR(VID2)                                04000400
DISPC_OVL_PICTURE_SIZE(VID2)                       00000000
DISPC_OVL_ACCU0(VID2)                              00000000
DISPC_OVL_ACCU1(VID2)                              00000000
DISPC_OVL_BA0_UV(VID2)                             00000000
DISPC_OVL_BA1_UV(VID2)                             00000000
DISPC_OVL_FIR2(VID2)                               04000400
DISPC_OVL_ACCU2_0(VID2)                            00000000
DISPC_OVL_ACCU2_1(VID2)                            00000000
DISPC_OVL_ATTRIBUTES2(VID2)                        00000000
DISPC_OVL_BA0(VID3)                                00000000
DISPC_OVL_BA1(VID3)                                00000000
DISPC_OVL_POSITION(VID3)                           00000000
DISPC_OVL_SIZE(VID3)                               00000000
DISPC_OVL_ATTRIBUTES(VID3)                         02808400
DISPC_OVL_FIFO_THRESHOLD(VID3)                     07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(VID3)                   00000800
DISPC_OVL_ROW_INC(VID3)                            00000001
DISPC_OVL_PIXEL_INC(VID3)                          00000001
DISPC_OVL_PRELOAD(VID3)                            000007ff
DISPC_OVL_MFLAG_THRESHOLD(VID3)                    05000400
DISPC_OVL_FIR(VID3)                                04000400
DISPC_OVL_PICTURE_SIZE(VID3)                       00000000
DISPC_OVL_ACCU0(VID3)                              00000000
DISPC_OVL_ACCU1(VID3)                              00000000
DISPC_OVL_BA0_UV(VID3)                             00000000
DISPC_OVL_BA1_UV(VID3)                             00000000
DISPC_OVL_FIR2(VID3)                               04000400
DISPC_OVL_ACCU2_0(VID3)                            00000000
DISPC_OVL_ACCU2_1(VID3)                            00000000
DISPC_OVL_ATTRIBUTES2(VID3)                        00000000
DISPC_OVL_BA0(WB)                                  00000000
DISPC_OVL_BA1(WB)                                  00000000
DISPC_OVL_SIZE(WB)                                 00000000
DISPC_OVL_ATTRIBUTES(WB)                           00808000
DISPC_OVL_FIFO_THRESHOLD(WB)                       00080000
DISPC_OVL_FIFO_SIZE_STATUS(WB)                     00000800
DISPC_OVL_ROW_INC(WB)                              00000001
DISPC_OVL_PIXEL_INC(WB)                            00000001
DISPC_OVL_MFLAG_THRESHOLD(WB)                      03200280
DISPC_OVL_FIR(WB)                                  04000400
DISPC_OVL_PICTURE_SIZE(WB)                         00000000
DISPC_OVL_ACCU0(WB)                                00000000
DISPC_OVL_ACCU1(WB)                                00000000
DISPC_OVL_BA0_UV(WB)                               00000000
DISPC_OVL_BA1_UV(WB)                               00000000
DISPC_OVL_FIR2(WB)                                 04000400
DISPC_OVL_ACCU2_0(WB)                              00000000
DISPC_OVL_ACCU2_1(WB)                              00000000
DISPC_OVL_ATTRIBUTES2(WB)                          00000000
DISPC_OVL_FIR_COEF_H_0(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_1(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_2(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_3(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_4(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_5(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_6(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_7(VID1)                       00000000
DISPC_OVL_FIR_COEF_HV_0(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_1(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_2(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_3(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_4(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_5(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_6(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_7(VID1)                      00000000
DISPC_OVL_CONV_COEF_0(VID1)                        0199012a
DISPC_OVL_CONV_COEF_1(VID1)                        012a0000
DISPC_OVL_CONV_COEF_2(VID1)                        079c0730
DISPC_OVL_CONV_COEF_3(VID1)                        0000012a
DISPC_OVL_CONV_COEF_4(VID1)                        00000204
DISPC_OVL_FIR_COEF_V_0(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_1(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_2(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_3(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_4(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_5(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_6(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_7(VID1)                       00000000
DISPC_OVL_FIR_COEF_H2_0(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_1(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_2(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_3(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_4(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_5(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_6(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_7(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV2_0(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_1(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_2(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_3(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_4(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_5(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_6(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_7(VID1)                     00000000
DISPC_OVL_FIR_COEF_V2_0(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_1(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_2(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_3(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_4(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_5(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_6(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_7(VID1)                      00000000
DISPC_OVL_FIR_COEF_H_0(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_1(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_2(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_3(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_4(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_5(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_6(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_7(VID2)                       00000000
DISPC_OVL_FIR_COEF_HV_0(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_1(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_2(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_3(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_4(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_5(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_6(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_7(VID2)                      00000000
DISPC_OVL_CONV_COEF_0(VID2)                        0199012a
DISPC_OVL_CONV_COEF_1(VID2)                        012a0000
DISPC_OVL_CONV_COEF_2(VID2)                        079c0730
DISPC_OVL_CONV_COEF_3(VID2)                        0000012a
DISPC_OVL_CONV_COEF_4(VID2)                        00000204
DISPC_OVL_FIR_COEF_V_0(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_1(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_2(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_3(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_4(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_5(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_6(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_7(VID2)                       00000000
DISPC_OVL_FIR_COEF_H2_0(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_1(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_2(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_3(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_4(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_5(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_6(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_7(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV2_0(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_1(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_2(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_3(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_4(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_5(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_6(VID2)                     00000000
[  117.525871] DSI: dsi_runtime_get
[  117.532527] DSI: dsi_runtime_put
DISPC_OVL_FIR_COEF_HV2_7(VID2)                     00000000
DISPC_OVL_FIR_COEF_V2_0(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_1(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_2(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_3(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_4(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_5(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_6(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_7(VID2)                      00000000
DISPC_OVL_FIR_COEF_H_0(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_1(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_2(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_3(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_4(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_5(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_6(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_7(VID3)                       00000000
DISPC_OVL_FIR_COEF_HV_0(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_1(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_2(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_3(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_4(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_5(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_6(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_7(VID3)                      00000000
DISPC_OVL_CONV_COEF_0(VID3)                        0199012a
DISPC_OVL_CONV_COEF_1(VID3)                        012a0000
DISPC_OVL_CONV_COEF_2(VID3)                        079c0730
DISPC_OVL_CONV_COEF_3(VID3)                        0000012a
DISPC_OVL_CONV_COEF_4(VID3)                        00000204
DISPC_OVL_FIR_COEF_V_0(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_1(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_2(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_3(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_4(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_5(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_6(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_7(VID3)                       00000000
DISPC_OVL_FIR_COEF_H2_0(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_1(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_2(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_3(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_4(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_5(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_6(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_7(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV2_0(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_1(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_2(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_3(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_4(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_5(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_6(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_7(VID3)                     00000000
DISPC_OVL_FIR_COEF_V2_0(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_1(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_2(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_3(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_4(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_5(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_6(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_7(VID3)                      00000000
cat: /sys/kernel/debug/omapdss/dsi1_irqs: No such file or directory
DSI_REVISION                        00000040
DSI_SYSCONFIG                       00000015
DSI_SYSSTATUS                       00000001
DSI_IRQSTATUS                       00000000
DSI_IRQENABLE                       0015c000
DSI_CTRL                            00eaee9f
DSI_COMPLEXIO_CFG1                  2a0dcba9
DSI_COMPLEXIO_IRQ_STATUS            00000000
DSI_COMPLEXIO_IRQ_ENABLE            3ff07fff
DSI_CLK_CTRL                        a030400b
DSI_TIMING1                         ffff1000
DSI_TIMING2                         ffffffff
DSI_VM_TIMING1                      00078003
DSI_VM_TIMING2                      043c3232
DSI_VM_TIMING3                      029a0500
DSI_CLK_TIMING                      00001b10
DSI_TX_FIFO_VC_SIZE                 13121110
DSI_RX_FIFO_VC_SIZE                 13121110
DSI_COMPLEXIO_CFG2                  00030000
DSI_RX_FIFO_VC_FULLNESS             00000000
DSI_VM_TIMING4                      00000000
DSI_TX_FIFO_VC_EMPTINESS            1f1f1e1f
DSI_VM_TIMING5                      00000000
DSI_VM_TIMING6                      01000007
DSI_VM_TIMING7                      00100010
DSI_STOPCLK_TIMING                  00000080
DSI_VC_CTRL(0)                      20808f81
DSI_VC_TE(0)                        00000000
DSI_VC_LONG_PACKET_HEADER(0)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(0)       00000000
DSI_VC_SHORT_PACKET_HEADER(0)       00000000
DSI_VC_IRQSTATUS(0)                 00000000
DSI_VC_IRQENABLE(0)                 000000db
DSI_VC_CTRL(1)                      20808fb1
DSI_VC_TE(1)                        00000000
DSI_VC_LONG_PACKET_HEADER(1)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(1)       00000000
DSI_VC_SHORT_PACKET_HEADER(1)       00000000
DSI_VC_IRQSTATUS(1)                 00000000
DSI_VC_IRQENABLE(1)                 000000db
DSI_VC_CTRL(2)                      20808d81
DSI_VC_TE(2)                        00000000
DSI_VC_LONG_PACKET_HEADER(2)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(2)       00000000
DSI_VC_SHORT_PACKET_HEADER(2)       00000000
DSI_VC_IRQSTATUS(2)                 00000000
DSI_VC_IRQENABLE(2)                 000000db
DSI_VC_CTRL(3)                      20808d81
DSI_VC_TE(3)                        00000000
DSI_VC_LONG_PACKET_HEADER(3)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(3)       00000000
DSI_VC_SHORT_PACKET_HEADER(3)       00000000
DSI_VC_IRQSTATUS(3)                 00000000
DSI_VC_IRQENABLE(3)                 000000db
DSI_DSIPHY_CFG0                     132b1322
DSI_DSIPHY_CFG1                     42c6103c
DSI_DSIPHY_CFG2                     b83e000f
DSI_DSIPHY_CFG5                     ff000000
DSI_PLL_CONTROL                     00000018
DSI_PLL_STATUS                      00006383
DSI_PLL_GO                          00000000
DSI_PLL_CONFIGURATION1              10a03000
DSI_PLL_CONFIGURATION2              00656004
root@letux:~# 

[-- Attachment #3: dsi-oldi.txt --]
[-- Type: text/plain, Size: 22161 bytes --]

root@letux:~# ./debugdsi 
- DSS -
FCK = 192000000
- DISPC -
dispc fclk source = FCK
fck             192000000       
- DISPC-CORE-CLK -
lck             192000000       lck div 1
- LCD -
LCD clk source = PLL1:1
lck             153600000       lck div 1
pck             76800000        pck div 2
- LCD2 -
LCD2 clk source = FCK
lck             48000000        lck div 4
pck             48000000        pck div 1
- LCD3 -
LCD3 clk source = FCK
lck             48000000        lck div 4
pck             48000000        pck div 1
DISPC_REVISION                                     00000051
DISPC_SYSCONFIG                                    00002015
DISPC_SYSSTATUS                                    00000001
DISPC_IRQSTATUS                                    000000a2
DISPC_IRQENABLE                                    0812d640
DISPC_CONTROL                                      00018309
DISPC_CONFIG                                       0000020c
DISPC_CAPABLE                                      00000000
DISPC_LINE_STATUS                                  000001af
DISPC_LINE_NUMBER                                  00000000
DISPC_GLOBAL_ALPHA                                 ffffffff
DISPC_CONTROL2                                     00000000
DISPC_CONFIG2                                      00000000
DISPC_CONTROL3                                     00000000
DISPC_CONFIG3                                      00000000
DISPC_GLOBAL_MFLAG_ATTRIBUTE                       00000001
DISPC_DEFAULT_COLOR(LCD)                           00000000
DISPC_TRANS_COLOR(LCD)                             00000000
DISPC_SIZE_MGR(LCD)                                04ff02cf
DISPC_TIMING_H(LCD)                                09d00800
DISPC_TIMING_V(LCD)                                0320323b
DISPC_POL_FREQ(LCD)                                00060000
DISPC_DIVISORo(LCD)                                00010002
DISPC_DATA_CYCLE1(LCD)                             00000000
DISPC_DATA_CYCLE2(LCD)                             00000000
DISPC_DATA_CYCLE3(LCD)                             00000000
DISPC_CPR_COEF_R(LCD)                              00000000
DISPC_CPR_COEF_G(LCD)                              00000000
DISPC_CPR_COEF_B(LCD)                              00000000
DISPC_DEFAULT_COLOR(TV)                            00000000
DISPC_TRANS_COLOR(TV)                              00000000
DISPC_SIZE_MGR(TV)                                 00000000
DISPC_DEFAULT_COLOR(LCD2)                          00000000
DISPC_TRANS_COLOR(LCD2)                            00000000
DISPC_SIZE_MGR(LCD2)                               00000000
DISPC_TIMING_H(LCD2)                               00000000
DISPC_TIMING_V(LCD2)                               00000000
DISPC_POL_FREQ(LCD2)                               00000000
DISPC_DIVISORo(LCD2)                               00040001
DISPC_DATA_CYCLE1(LCD2)                            00000000
DISPC_DATA_CYCLE2(LCD2)                            00000000
DISPC_DATA_CYCLE3(LCD2)                            00000000
DISPC_CPR_COEF_R(LCD2)                             00000000
DISPC_CPR_COEF_G(LCD2)                             00000000
DISPC_CPR_COEF_B(LCD2)                             00000000
DISPC_DEFAULT_COLOR(LCD3)                          00000000
DISPC_TRANS_COLOR(LCD3)                            00000000
DISPC_SIZE_MGR(LCD3)                               00000000
DISPC_TIMING_H(LCD3)                               00000000
DISPC_TIMING_V(LCD3)                               00000000
DISPC_POL_FREQ(LCD3)                               00000000
DISPC_DIVISORo(LCD3)                               00040001
DISPC_DATA_CYCLE1(LCD3)                            00000000
DISPC_DATA_CYCLE2(LCD3)                            00000000
DISPC_DATA_CYCLE3(LCD3)                            00000000
DISPC_CPR_COEF_R(LCD3)                             00000000
DISPC_CPR_COEF_G(LCD3)                             00000000
DISPC_CPR_COEF_B(LCD3)                             00000000
DISPC_OVL_BA0(GFX)                                 d0003440
DISPC_OVL_BA1(GFX)                                 d0003440
DISPC_OVL_POSITION(GFX)                            00000000
DISPC_OVL_SIZE(GFX)                                04ff02cf
DISPC_OVL_ATTRIBUTES(GFX)                          320040b1
DISPC_OVL_FIFO_THRESHOLD(GFX)                      07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(GFX)                    00000500
DISPC_OVL_ROW_INC(GFX)                             000034c1
DISPC_OVL_PIXEL_INC(GFX)                           00000001
DISPC_OVL_PRELOAD(GFX)                             000007ff
DISPC_OVL_MFLAG_THRESHOLD(GFX)                     05000400
DISPC_OVL_WINDOW_SKIP(GFX)                         00000000
DISPC_OVL_TABLE_BA(GFX)                            00000000
DISPC_OVL_BA0(VID1)                                00000000
DISPC_OVL_BA1(VID1)                                00000000
DISPC_OVL_POSITION(VID1)                           00000000
DISPC_OVL_SIZE(VID1)                               00000000
DISPC_OVL_ATTRIBUTES(VID1)                         02808400
DISPC_OVL_FIFO_THRESHOLD(VID1)                     07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(VID1)                   00000800
DISPC_OVL_ROW_INC(VID1)                            00000001
DISPC_OVL_PIXEL_INC(VID1)                          00000001
DISPC_OVL_PRELOAD(VID1)                            000007ff
DISPC_OVL_MFLAG_THRESHOLD(VID1)                    05000400
DISPC_OVL_FIR(VID1)                                04000400
DISPC_OVL_PICTURE_SIZE(VID1)                       00000000
DISPC_OVL_ACCU0(VID1)                              00000000
DISPC_OVL_ACCU1(VID1)                              00000000
DISPC_OVL_BA0_UV(VID1)                             00000000
DISPC_OVL_BA1_UV(VID1)                             00000000
DISPC_OVL_FIR2(VID1)                               04000400
DISPC_OVL_ACCU2_0(VID1)                            00000000
DISPC_OVL_ACCU2_1(VID1)                            00000000
DISPC_OVL_ATTRIBUTES2(VID1)                        00000000
DISPC_OVL_BA0(VID2)                                00000000
DISPC_OVL_BA1(VID2)                                00000000
DISPC_OVL_POSITION(VID2)                           00000000
DISPC_OVL_SIZE(VID2)                               00000000
DISPC_OVL_ATTRIBUTES(VID2)                         02808400
DISPC_OVL_FIFO_THRESHOLD(VID2)                     07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(VID2)                   00000800
DISPC_OVL_ROW_INC(VID2)                            00000001
DISPC_OVL_PIXEL_INC(VID2)                          00000001
DISPC_OVL_PRELOAD(VID2)                            000007ff
DISPC_OVL_MFLAG_THRESHOLD(VID2)                    05000400
DISPC_OVL_FIR(VID2)                                04000400
DISPC_OVL_PICTURE_SIZE(VID2)                       00000000
DISPC_OVL_ACCU0(VID2)                              00000000
DISPC_OVL_ACCU1(VID2)                              00000000
DISPC_OVL_BA0_UV(VID2)                             00000000
DISPC_OVL_BA1_UV(VID2)                             00000000
DISPC_OVL_FIR2(VID2)                               04000400
DISPC_OVL_ACCU2_0(VID2)                            00000000
DISPC_OVL_ACCU2_1(VID2)                            00000000
DISPC_OVL_ATTRIBUTES2(VID2)                        00000000
DISPC_OVL_BA0(VID3)                                00000000
DISPC_OVL_BA1(VID3)                                00000000
DISPC_OVL_POSITION(VID3)                           00000000
DISPC_OVL_SIZE(VID3)                               00000000
DISPC_OVL_ATTRIBUTES(VID3)                         02808400
DISPC_OVL_FIFO_THRESHOLD(VID3)                     07ff07f8
DISPC_OVL_FIFO_SIZE_STATUS(VID3)                   00000800
DISPC_OVL_ROW_INC(VID3)                            00000001
DISPC_OVL_PIXEL_INC(VID3)                          00000001
DISPC_OVL_PRELOAD(VID3)                            000007ff
DISPC_OVL_MFLAG_THRESHOLD(VID3)                    05000400
DISPC_OVL_FIR(VID3)                                04000400
DISPC_OVL_PICTURE_SIZE(VID3)                       00000000
DISPC_OVL_ACCU0(VID3)                              00000000
DISPC_OVL_ACCU1(VID3)                              00000000
DISPC_OVL_BA0_UV(VID3)                             00000000
DISPC_OVL_BA1_UV(VID3)                             00000000
DISPC_OVL_FIR2(VID3)                               04000400
DISPC_OVL_ACCU2_0(VID3)                            00000000
DISPC_OVL_ACCU2_1(VID3)                            00000000
DISPC_OVL_ATTRIBUTES2(VID3)                        00000000
DISPC_OVL_BA0(WB)                                  00000000
DISPC_OVL_BA1(WB)                                  00000000
DISPC_OVL_SIZE(WB)                                 00000000
DISPC_OVL_ATTRIBUTES(WB)                           00808000
DISPC_OVL_FIFO_THRESHOLD(WB)                       00080000
DISPC_OVL_FIFO_SIZE_STATUS(WB)                     00000800
DISPC_OVL_ROW_INC(WB)                              00000001
DISPC_OVL_PIXEL_INC(WB)                            00000001
DISPC_OVL_MFLAG_THRESHOLD(WB)                      03200280
DISPC_OVL_FIR(WB)                                  04000400
DISPC_OVL_PICTURE_SIZE(WB)                         00000000
DISPC_OVL_ACCU0(WB)                                00000000
DISPC_OVL_ACCU1(WB)                                00000000
DISPC_OVL_BA0_UV(WB)                               00000000
DISPC_OVL_BA1_UV(WB)                               00000000
DISPC_OVL_FIR2(WB)                                 04000400
DISPC_OVL_ACCU2_0(WB)                              00000000
DISPC_OVL_ACCU2_1(WB)                              00000000
DISPC_OVL_ATTRIBUTES2(WB)                          00000000
DISPC_OVL_FIR_COEF_H_0(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_1(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_2(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_3(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_4(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_5(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_6(VID1)                       00000000
DISPC_OVL_FIR_COEF_H_7(VID1)                       00000000
DISPC_OVL_FIR_COEF_HV_0(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_1(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_2(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_3(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_4(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_5(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_6(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV_7(VID1)                      00000000
DISPC_OVL_CONV_COEF_0(VID1)                        0199012a
DISPC_OVL_CONV_COEF_1(VID1)                        012a0000
DISPC_OVL_CONV_COEF_2(VID1)                        079c0730
DISPC_OVL_CONV_COEF_3(VID1)                        0000012a
DISPC_OVL_CONV_COEF_4(VID1)                        00000204
DISPC_OVL_FIR_COEF_V_0(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_1(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_2(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_3(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_4(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_5(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_6(VID1)                       00000000
DISPC_OVL_FIR_COEF_V_7(VID1)                       00000000
DISPC_OVL_FIR_COEF_H2_0(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_1(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_2(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_3(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_4(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_5(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_6(VID1)                      00000000
DISPC_OVL_FIR_COEF_H2_7(VID1)                      00000000
DISPC_OVL_FIR_COEF_HV2_0(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_1(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_2(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_3(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_4(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_5(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_6(VID1)                     00000000
DISPC_OVL_FIR_COEF_HV2_7(VID1)                     00000000
DISPC_OVL_FIR_COEF_V2_0(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_1(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_2(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_3(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_4(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_5(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_6(VID1)                      00000000
DISPC_OVL_FIR_COEF_V2_7(VID1)                      00000000
DISPC_OVL_FIR_COEF_H_0(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_1(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_2(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_3(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_4(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_5(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_6(VID2)                       00000000
DISPC_OVL_FIR_COEF_H_7(VID2)                       00000000
DISPC_OVL_FIR_COEF_HV_0(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_1(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_2(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_3(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_4(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_5(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_6(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV_7(VID2)                      00000000
DISPC_OVL_CONV_COEF_0(VID2)                        0199012a
DISPC_OVL_CONV_COEF_1(VID2)                        012a0000
DISPC_OVL_CONV_COEF_2(VID2)                        079c0730
DISPC_OVL_CONV_COEF_3(VID2)                        0000012a
DISPC_OVL_CONV_COEF_4(VID2)                        00000204
DISPC_OVL_FIR_COEF_V_0(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_1(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_2(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_3(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_4(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_5(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_6(VID2)                       00000000
DISPC_OVL_FIR_COEF_V_7(VID2)                       00000000
DISPC_OVL_FIR_COEF_H2_0(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_1(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_2(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_3(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_4(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_5(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_6(VID2)                      00000000
DISPC_OVL_FIR_COEF_H2_7(VID2)                      00000000
DISPC_OVL_FIR_COEF_HV2_0(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_1(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_2(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_3(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_4(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_5(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_6(VID2)                     00000000
DISPC_OVL_FIR_COEF_HV2_7(VID2)                     00000000
DISPC_OVL_FIR_COEF_V2_0(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_1(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_2(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_3(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_4(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_5(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_6(VID2)                      00000000
DISPC_OVL_FIR_COEF_V2_7(VID2)                      00000000
DISPC_OVL_FIR_COEF_H_0(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_1(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_2(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_3(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_4(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_5(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_6(VID3)                       00000000
DISPC_OVL_FIR_COEF_H_7(VID3)                       00000000
DISPC_OVL_FIR_COEF_HV_0(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_1(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_2(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_3(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_4(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_5(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_6(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV_7(VID3)                      00000000
DISPC_OVL_CONV_COEF_0(VID3)                        0199012a
DISPC_OVL_CONV_COEF_1(VID3)                        012a0000
DISPC_OVL_CONV_COEF_2(VID3)                        079c0730
DISPC_OVL_CONV_COEF_3(VID3)                        0000012a
DISPC_OVL_CONV_COEF_4(VID3)                        00000204
DISPC_OVL_FIR_COEF_V_0(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_1(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_2(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_3(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_4(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_5(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_6(VID3)                       00000000
DISPC_OVL_FIR_COEF_V_7(VID3)                       00000000
DISPC_OVL_FIR_COEF_H2_0(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_1(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_2(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_3(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_4(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_5(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_6(VID3)                      00000000
DISPC_OVL_FIR_COEF_H2_7(VID3)                      00000000
DISPC_OVL_FIR_COEF_HV2_0(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_1(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_2(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_3(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_4(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_5(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_6(VID3)                     00000000
DISPC_OVL_FIR_COEF_HV2_7(VID3)                     00000000
DISPC_OVL_FIR_COEF_V2_0(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_1(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_2(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_3(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_4(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_5(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_6(VID3)                      00000000
DISPC_OVL_FIR_COEF_V2_7(VID3)                      00000000
cat: /sys/kernel/debug/omapdss/dsi1_irqs: No such file or directory
DSI_REVISION                        00000040
DSI_SYSCONFIG                       00000015
DSI_SYSSTATUS                       00000001
DSI_IRQSTATUS                       00000000
DSI_IRQENABLE                       0015c000
DSI_CTRL                            00eaee9f
DSI_COMPLEXIO_CFG1                  2a0dcba9
DSI_COMPLEXIO_IRQ_STATUS            00000000
DSI_COMPLEXIO_IRQ_ENABLE            3ff07fff
DSI_CLK_CTRL                        a030600b
DSI_TIMING1                         ffff1000
DSI_TIMING2                         ffffffff
DSI_VM_TIMING1                      00005076
DSI_VM_TIMING2                      043c3232
DSI_VM_TIMING3                      029a0500
DSI_CLK_TIMING                      00001b10
DSI_TX_FIFO_VC_SIZE                 13121110
DSI_RX_FIFO_VC_SIZE                 13121110
DSI_COMPLEXIO_CFG2                  00030000
DSI_RX_FIFO_VC_FULLNESS             00000000
DSI_VM_TIMING4                      00000000
DSI_TX_FIFO_VC_EMPTINESS            1f1f1f1f
DSI_VM_TIMING5                      00000000
DSI_VM_TIMING6                      01340007
DSI_VM_TIMING7                      00100010
DSI_STOPCLK_TIMING                  00000080
DSI_VC_CTRL(0)                      20808f91
DSI_VC_TE(0)                        00000000
DSI_VC_LONG_PACKET_HEADER(0)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(0)       00000000
DSI_VC_SHORT_PACKET_HEADER(0)       00000000
DSI_VC_IRQSTATUS(0)                 00000004
DSI_VC_IRQENABLE(0)                 000000db
DSI_VC_CTRL(1)                      20808d81
DSI_VC_TE(1)                        00000000
DSI_VC_LONG_PACKET_HEADER(1)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(1)       00000000
DSI_VC_SHORT_PACKET_HEADER(1)       00000000
DSI_VC_IRQSTATUS(1)                 00000004
DSI_VC_IRQENABLE(1)                 000000db
DSI_VC_CTRL(2)                      20808d81
DSI_VC_TE(2)                        00000000
DSI_VC_LONG_PACKET_HEADER(2)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(2)       00000000
DSI_VC_SHORT_PACKET_HEADER(2)       00000000
DSI_VC_IRQSTATUS(2)                 00000000
DSI_VC_IRQENABLE(2)                 000000db
DSI_VC_CTRL(3)                      20808d81
DSI_VC_TE(3)                        00000000
DSI_VC_LONG_PACKET_HEADER(3)        00000000
DSI_VC_LONG_PACKET_PAYLOAD(3)       00000000
DSI_VC_SHORT_PACKET_HEADER(3)       00000000
DSI_VC_IRQSTATUS(3)                 00000000
DSI_VC_IRQENABLE(3)                 000000db
DSI_DSIPHY_CFG0                     132b1322
DSI_DSIPHY_CFG1                     42c6103c
DSI_DSIPHY_CFG2                     b800000f
DSI_DSIPHY_CFG5                     ff000000
DSI_PLL_CONTROL                     00000018
DSI_PLL_STATUS                      00006383
DSI_PLL_GO                          00000000
DSI_PLL_CONFIGURATION1              10a03000
DSI_PLL_CONFIGURATION2              00656004
root@letux:~# 

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




[-- Attachment #5: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
  2020-11-12  8:08           ` Tomi Valkeinen
@ 2020-11-16  9:22             ` Laurent Pinchart
  -1 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-16  9:22 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Sebastian Reichel, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller,
	Sebastian Reichel

Hi Tomi,

On Thu, Nov 12, 2020 at 10:08:21AM +0200, Tomi Valkeinen wrote:
> On 11/11/2020 17:58, Laurent Pinchart wrote:
> 
> >>>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> >>>> index 030a8fa140db..1582960f9e90 100644
> >>>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> >>>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> >>>> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
> >>>>  	return 0;
> >>>>  }
> >>>>  
> >>>> -static int dsicm_set_update_window(struct panel_drv_data *ddata,
> >>>> -		u16 x, u16 y, u16 w, u16 h)
> >>>> -{
> >>>> -	struct mipi_dsi_device *dsi = ddata->dsi;
> >>>> -	int r;
> >>>> -	u16 x1 = x;
> >>>> -	u16 x2 = x + w - 1;
> >>>> -	u16 y1 = y;
> >>>> -	u16 y2 = y + h - 1;
> >>>> -
> >>>> -	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
> >>>> -	if (r < 0)
> >>>> -		return r;
> >>>> -
> >>>> -	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
> >>>> -	if (r < 0)
> >>>> -		return r;
> >>>> -
> >>>> -	return 0;
> >>>> -}
> >>>> -
> >>>
> >>> I can't tell whether this is common to all command-mode panels, or if
> >>> there could be a need for panel-specific update procedures, so I can't
> >>> really ack this patch.
> >>
> >> I can't say either, but all the command mode panels I know need and support this. And, afaik, we
> >> have only the single cmd mode panel driver which we add in this series.
> > 
> > Now that I think about it again, isn't it a layering violation ?
> > Shouldn't the DSI host handle DSI commands transfers, with the panel
> > driver taking care of specific DSI commands ?
> 
> Well, the DSI host (the HW) already handles specific DSI commands, as it does the update with DCS
> Write Start/Continue commands. The update is initiated from omap_crtc, via dssdev->dsi_ops->update().
> 
> We could perhaps add a new function to drm_panel_funcs, say, prepare_update, which could then do the
> above.
> 
> Although I think the above code is not strictly speaking required, as the panel should remember the
> column and page address, and as such, they could be set just once at config time.
> 
> However, I remember debugging issues related to this. And with a quick test, I can see that things
> break down if I just do the above once in the panel's setup. But things work if I send a DSI NOP
> instead in the dsi host. So looks to me that either the OMAP DSI or the panel I have need some
> command transmitted there. It probably has to happen between two frame transfers.
> 
> There are also other things related to update which I'm not so happy about: 1) the TE gpio irq is
> handled in the dsi host driver now, even if it's a panel gpio, 2) the dsi host driver snoops the DSI
> packets sent by the panel, and catches TEAR_ON/OFF packets, and then change internal state accordingly.
> 
> So... I could change the dsi host driver to only send a NOP, and do the page/column call from the
> panel's setup. That simplifies the code.
> 
> Or I could add the new function to drm_panel_funcs, and send a NOP from there. But if this "needs a
> NOP" is an OMAP DSI feature, the panel driver is not the right place for it. I also think that
> managing the TE cleanly needs more thought, and probably requires some more interaction between the
> dsi host and the panel. It might be better to look at both the update callback and the TE at the
> same time.

I'm fine addressing both issues on top of this series. My concern is
that an incorrect split of responsibilities between the panel driver and
the DSI host driver will result in panel drivers being compatible only
with specific DSI hosts. It's a difficult issue, but I think we need to
extend the DSI API to handle this cleanly.

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
@ 2020-11-16  9:22             ` Laurent Pinchart
  0 siblings, 0 replies; 328+ messages in thread
From: Laurent Pinchart @ 2020-11-16  9:22 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori,
	Sebastian Reichel, dri-devel, Sebastian Reichel, linux-omap,
	Nikhil Devshatwar

Hi Tomi,

On Thu, Nov 12, 2020 at 10:08:21AM +0200, Tomi Valkeinen wrote:
> On 11/11/2020 17:58, Laurent Pinchart wrote:
> 
> >>>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> >>>> index 030a8fa140db..1582960f9e90 100644
> >>>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> >>>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> >>>> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
> >>>>  	return 0;
> >>>>  }
> >>>>  
> >>>> -static int dsicm_set_update_window(struct panel_drv_data *ddata,
> >>>> -		u16 x, u16 y, u16 w, u16 h)
> >>>> -{
> >>>> -	struct mipi_dsi_device *dsi = ddata->dsi;
> >>>> -	int r;
> >>>> -	u16 x1 = x;
> >>>> -	u16 x2 = x + w - 1;
> >>>> -	u16 y1 = y;
> >>>> -	u16 y2 = y + h - 1;
> >>>> -
> >>>> -	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
> >>>> -	if (r < 0)
> >>>> -		return r;
> >>>> -
> >>>> -	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
> >>>> -	if (r < 0)
> >>>> -		return r;
> >>>> -
> >>>> -	return 0;
> >>>> -}
> >>>> -
> >>>
> >>> I can't tell whether this is common to all command-mode panels, or if
> >>> there could be a need for panel-specific update procedures, so I can't
> >>> really ack this patch.
> >>
> >> I can't say either, but all the command mode panels I know need and support this. And, afaik, we
> >> have only the single cmd mode panel driver which we add in this series.
> > 
> > Now that I think about it again, isn't it a layering violation ?
> > Shouldn't the DSI host handle DSI commands transfers, with the panel
> > driver taking care of specific DSI commands ?
> 
> Well, the DSI host (the HW) already handles specific DSI commands, as it does the update with DCS
> Write Start/Continue commands. The update is initiated from omap_crtc, via dssdev->dsi_ops->update().
> 
> We could perhaps add a new function to drm_panel_funcs, say, prepare_update, which could then do the
> above.
> 
> Although I think the above code is not strictly speaking required, as the panel should remember the
> column and page address, and as such, they could be set just once at config time.
> 
> However, I remember debugging issues related to this. And with a quick test, I can see that things
> break down if I just do the above once in the panel's setup. But things work if I send a DSI NOP
> instead in the dsi host. So looks to me that either the OMAP DSI or the panel I have need some
> command transmitted there. It probably has to happen between two frame transfers.
> 
> There are also other things related to update which I'm not so happy about: 1) the TE gpio irq is
> handled in the dsi host driver now, even if it's a panel gpio, 2) the dsi host driver snoops the DSI
> packets sent by the panel, and catches TEAR_ON/OFF packets, and then change internal state accordingly.
> 
> So... I could change the dsi host driver to only send a NOP, and do the page/column call from the
> panel's setup. That simplifies the code.
> 
> Or I could add the new function to drm_panel_funcs, and send a NOP from there. But if this "needs a
> NOP" is an OMAP DSI feature, the panel driver is not the right place for it. I also think that
> managing the TE cleanly needs more thought, and probably requires some more interaction between the
> dsi host and the panel. It might be better to look at both the update callback and the TE at the
> same time.

I'm fine addressing both issues on top of this series. My concern is
that an incorrect split of responsibilities between the panel driver and
the DSI host driver will result in panel drivers being compatible only
with specific DSI hosts. It's a difficult issue, but I think we need to
extend the DSI API to handle this cleanly.

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
  2020-11-16  9:22             ` Laurent Pinchart
@ 2020-11-17 10:04               ` Sebastian Reichel
  -1 siblings, 0 replies; 328+ messages in thread
From: Sebastian Reichel @ 2020-11-17 10:04 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tomi Valkeinen, Nikhil Devshatwar, linux-omap, dri-devel,
	Sekhar Nori, Tony Lindgren, H . Nikolaus Schaller

[-- Attachment #1: Type: text/plain, Size: 5048 bytes --]

Hi,

On Mon, Nov 16, 2020 at 11:22:53AM +0200, Laurent Pinchart wrote:
> On Thu, Nov 12, 2020 at 10:08:21AM +0200, Tomi Valkeinen wrote:
> > On 11/11/2020 17:58, Laurent Pinchart wrote:
> > 
> > >>>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > >>>> index 030a8fa140db..1582960f9e90 100644
> > >>>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > >>>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > >>>> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
> > >>>>  	return 0;
> > >>>>  }
> > >>>>  
> > >>>> -static int dsicm_set_update_window(struct panel_drv_data *ddata,
> > >>>> -		u16 x, u16 y, u16 w, u16 h)
> > >>>> -{
> > >>>> -	struct mipi_dsi_device *dsi = ddata->dsi;
> > >>>> -	int r;
> > >>>> -	u16 x1 = x;
> > >>>> -	u16 x2 = x + w - 1;
> > >>>> -	u16 y1 = y;
> > >>>> -	u16 y2 = y + h - 1;
> > >>>> -
> > >>>> -	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
> > >>>> -	if (r < 0)
> > >>>> -		return r;
> > >>>> -
> > >>>> -	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
> > >>>> -	if (r < 0)
> > >>>> -		return r;
> > >>>> -
> > >>>> -	return 0;
> > >>>> -}
> > >>>> -
> > >>>
> > >>> I can't tell whether this is common to all command-mode panels, or if
> > >>> there could be a need for panel-specific update procedures, so I can't
> > >>> really ack this patch.
> > >>
> > >> I can't say either, but all the command mode panels I know need and support this. And, afaik, we
> > >> have only the single cmd mode panel driver which we add in this series.
> > > 
> > > Now that I think about it again, isn't it a layering violation ?
> > > Shouldn't the DSI host handle DSI commands transfers, with the panel
> > > driver taking care of specific DSI commands ?
> > 
> > Well, the DSI host (the HW) already handles specific DSI commands, as it does the update with DCS
> > Write Start/Continue commands. The update is initiated from omap_crtc, via dssdev->dsi_ops->update().
> > 
> > We could perhaps add a new function to drm_panel_funcs, say, prepare_update, which could then do the
> > above.
> > 
> > Although I think the above code is not strictly speaking required, as the panel should remember the
> > column and page address, and as such, they could be set just once at config time.
> > 
> > However, I remember debugging issues related to this. And with a quick test, I can see that things
> > break down if I just do the above once in the panel's setup. But things work if I send a DSI NOP
> > instead in the dsi host. So looks to me that either the OMAP DSI or the panel I have need some
> > command transmitted there. It probably has to happen between two frame transfers.
> > 
> > There are also other things related to update which I'm not so happy about: 1) the TE gpio irq is
> > handled in the dsi host driver now, even if it's a panel gpio, 2) the dsi host driver snoops the DSI
> > packets sent by the panel, and catches TEAR_ON/OFF packets, and then change internal state accordingly.
> > 
> > So... I could change the dsi host driver to only send a NOP, and do the page/column call from the
> > panel's setup. That simplifies the code.
> > 
> > Or I could add the new function to drm_panel_funcs, and send a NOP from there. But if this "needs a
> > NOP" is an OMAP DSI feature, the panel driver is not the right place for it. I also think that
> > managing the TE cleanly needs more thought, and probably requires some more interaction between the
> > dsi host and the panel. It might be better to look at both the update callback and the TE at the
> > same time.
> 
> I'm fine addressing both issues on top of this series. My concern is
> that an incorrect split of responsibilities between the panel driver and
> the DSI host driver will result in panel drivers being compatible only
> with specific DSI hosts. It's a difficult issue, but I think we need to
> extend the DSI API to handle this cleanly.

Just some background info, since I looked into this while moving
the driver to the common drm/dsi infrastructure (I used existing
DSI drivers as reference):

IIRC most DSI host drivers do not seem support command mode at all.
Some seemed to support it from within the host driver, though. I
remember Exynos getting the TE gpio in the host driver and using
the IRQ routine to self-refresh (which would effectively always
refresh wasting lots of power compared to only refreshing on page
flip).

Also there are some command mode panel drivers (can be found by
looking for drivers _not_ setting the MIPI_DSI_MODE_VIDEO flag):

 * panel-novatek-nt35510.c
 * panel-samsung-s6d16d0.c
 * panel-samsung-s6e63j0x03.c
 * panel-samsung-s6e3ha2.c
 * panel-sharp-lq101r1sx01.c
 * panel-sony-acx424akp.c

So extending the DSI API will involve more drivers than omapdrm and
its DSI command mode panel driver and should probably be done in its
own series.

-- Sebastian

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

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

* Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host
@ 2020-11-17 10:04               ` Sebastian Reichel
  0 siblings, 0 replies; 328+ messages in thread
From: Sebastian Reichel @ 2020-11-17 10:04 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Tony Lindgren, H . Nikolaus Schaller, Sekhar Nori, dri-devel,
	Tomi Valkeinen, linux-omap, Nikhil Devshatwar


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

Hi,

On Mon, Nov 16, 2020 at 11:22:53AM +0200, Laurent Pinchart wrote:
> On Thu, Nov 12, 2020 at 10:08:21AM +0200, Tomi Valkeinen wrote:
> > On 11/11/2020 17:58, Laurent Pinchart wrote:
> > 
> > >>>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > >>>> index 030a8fa140db..1582960f9e90 100644
> > >>>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > >>>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> > >>>> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
> > >>>>  	return 0;
> > >>>>  }
> > >>>>  
> > >>>> -static int dsicm_set_update_window(struct panel_drv_data *ddata,
> > >>>> -		u16 x, u16 y, u16 w, u16 h)
> > >>>> -{
> > >>>> -	struct mipi_dsi_device *dsi = ddata->dsi;
> > >>>> -	int r;
> > >>>> -	u16 x1 = x;
> > >>>> -	u16 x2 = x + w - 1;
> > >>>> -	u16 y1 = y;
> > >>>> -	u16 y2 = y + h - 1;
> > >>>> -
> > >>>> -	r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
> > >>>> -	if (r < 0)
> > >>>> -		return r;
> > >>>> -
> > >>>> -	r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
> > >>>> -	if (r < 0)
> > >>>> -		return r;
> > >>>> -
> > >>>> -	return 0;
> > >>>> -}
> > >>>> -
> > >>>
> > >>> I can't tell whether this is common to all command-mode panels, or if
> > >>> there could be a need for panel-specific update procedures, so I can't
> > >>> really ack this patch.
> > >>
> > >> I can't say either, but all the command mode panels I know need and support this. And, afaik, we
> > >> have only the single cmd mode panel driver which we add in this series.
> > > 
> > > Now that I think about it again, isn't it a layering violation ?
> > > Shouldn't the DSI host handle DSI commands transfers, with the panel
> > > driver taking care of specific DSI commands ?
> > 
> > Well, the DSI host (the HW) already handles specific DSI commands, as it does the update with DCS
> > Write Start/Continue commands. The update is initiated from omap_crtc, via dssdev->dsi_ops->update().
> > 
> > We could perhaps add a new function to drm_panel_funcs, say, prepare_update, which could then do the
> > above.
> > 
> > Although I think the above code is not strictly speaking required, as the panel should remember the
> > column and page address, and as such, they could be set just once at config time.
> > 
> > However, I remember debugging issues related to this. And with a quick test, I can see that things
> > break down if I just do the above once in the panel's setup. But things work if I send a DSI NOP
> > instead in the dsi host. So looks to me that either the OMAP DSI or the panel I have need some
> > command transmitted there. It probably has to happen between two frame transfers.
> > 
> > There are also other things related to update which I'm not so happy about: 1) the TE gpio irq is
> > handled in the dsi host driver now, even if it's a panel gpio, 2) the dsi host driver snoops the DSI
> > packets sent by the panel, and catches TEAR_ON/OFF packets, and then change internal state accordingly.
> > 
> > So... I could change the dsi host driver to only send a NOP, and do the page/column call from the
> > panel's setup. That simplifies the code.
> > 
> > Or I could add the new function to drm_panel_funcs, and send a NOP from there. But if this "needs a
> > NOP" is an OMAP DSI feature, the panel driver is not the right place for it. I also think that
> > managing the TE cleanly needs more thought, and probably requires some more interaction between the
> > dsi host and the panel. It might be better to look at both the update callback and the TE at the
> > same time.
> 
> I'm fine addressing both issues on top of this series. My concern is
> that an incorrect split of responsibilities between the panel driver and
> the DSI host driver will result in panel drivers being compatible only
> with specific DSI hosts. It's a difficult issue, but I think we need to
> extend the DSI API to handle this cleanly.

Just some background info, since I looked into this while moving
the driver to the common drm/dsi infrastructure (I used existing
DSI drivers as reference):

IIRC most DSI host drivers do not seem support command mode at all.
Some seemed to support it from within the host driver, though. I
remember Exynos getting the TE gpio in the host driver and using
the IRQ routine to self-refresh (which would effectively always
refresh wasting lots of power compared to only refreshing on page
flip).

Also there are some command mode panel drivers (can be found by
looking for drivers _not_ setting the MIPI_DSI_MODE_VIDEO flag):

 * panel-novatek-nt35510.c
 * panel-samsung-s6d16d0.c
 * panel-samsung-s6e63j0x03.c
 * panel-samsung-s6e3ha2.c
 * panel-sharp-lq101r1sx01.c
 * panel-sony-acx424akp.c

So extending the DSI API will involve more drivers than omapdrm and
its DSI command mode panel driver and should probably be done in its
own series.

-- Sebastian

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

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-11-17 10:04 UTC | newest]

Thread overview: 328+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 12:02 [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel Tomi Valkeinen
2020-11-05 12:02 ` Tomi Valkeinen
2020-11-05 12:02 ` [PATCH v3 01/56] drm/dsi: add MIPI_DSI_MODE_ULPS_IDLE Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-06  4:41   ` Laurent Pinchart
2020-11-06  4:41     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 02/56] Revert "drm/omap: dss: Remove unused omap_dss_device operations" Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-05 21:27   ` Sam Ravnborg
2020-11-05 21:27     ` Sam Ravnborg
2020-11-06  4:50   ` Laurent Pinchart
2020-11-06  4:50     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 03/56] drm/omap: drop unused dsi.configure_pins Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-06  4:50   ` Laurent Pinchart
2020-11-06  4:50     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 04/56] drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_* Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-06  4:56   ` Laurent Pinchart
2020-11-06  4:56     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 05/56] drm/omap: constify write buffers Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-06  4:57   ` Laurent Pinchart
2020-11-06  4:57     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 06/56] drm/omap: dsi: add generic transfer function Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-06  5:05   ` Laurent Pinchart
2020-11-06  5:05     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 07/56] drm/omap: panel-dsi-cm: convert to transfer API Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-06  5:08   ` Laurent Pinchart
2020-11-06  5:08     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 08/56] drm/omap: dsi: unexport specific data transfer functions Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:10   ` Laurent Pinchart
2020-11-09  8:10     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 09/56] drm/omap: dsi: drop virtual channel logic Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:14   ` Laurent Pinchart
2020-11-09  8:14     ` Laurent Pinchart
2020-11-09  8:20     ` Tomi Valkeinen
2020-11-09  8:20       ` Tomi Valkeinen
2020-11-09  8:18   ` Tomi Valkeinen
2020-11-09  8:18     ` Tomi Valkeinen
2020-11-05 12:02 ` [PATCH v3 10/56] drm/omap: dsi: simplify write function Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:21   ` Laurent Pinchart
2020-11-09  8:21     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 11/56] drm/omap: dsi: simplify read functions Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:28   ` Laurent Pinchart
2020-11-09  8:28     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 12/56] drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:33   ` Laurent Pinchart
2020-11-09  8:33     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 13/56] drm/omap: dsi: introduce mipi_dsi_host Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:38   ` Laurent Pinchart
2020-11-09  8:38     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 14/56] drm/omap: panel-dsi-cm: use DSI helpers Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:40   ` Laurent Pinchart
2020-11-09  8:40     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 15/56] drm/omap: dsi: request VC via mipi_dsi_attach Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:42   ` Laurent Pinchart
2020-11-09  8:42     ` Laurent Pinchart
2020-11-09 11:16     ` Tomi Valkeinen
2020-11-09 11:16       ` Tomi Valkeinen
2020-11-05 12:02 ` [PATCH v3 16/56] drm/omap: panel-dsi-cm: drop hardcoded VC Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:43   ` Laurent Pinchart
2020-11-09  8:43     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 17/56] drm/omap: panel-dsi-cm: use common MIPI DCS 1.3 defines Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:44   ` Laurent Pinchart
2020-11-09  8:44     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 18/56] drm/omap: dsi: drop unused memory_read() Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:45   ` Laurent Pinchart
2020-11-09  8:45     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 19/56] drm/omap: dsi: drop unused get_te() Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:45   ` Laurent Pinchart
2020-11-09  8:45     ` Laurent Pinchart
2020-11-09  9:49     ` Tomi Valkeinen
2020-11-09  9:49       ` Tomi Valkeinen
2020-11-05 12:02 ` [PATCH v3 20/56] drm/omap: dsi: drop unused enable_te() Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:46   ` Laurent Pinchart
2020-11-09  8:46     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 21/56] drm/omap: dsi: drop useless sync() Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:46   ` Laurent Pinchart
2020-11-09  8:46     ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 22/56] drm/omap: dsi: use pixel-format and mode from attach Tomi Valkeinen
2020-11-05 12:02   ` Tomi Valkeinen
2020-11-09  8:49   ` Laurent Pinchart
2020-11-09  8:49     ` Laurent Pinchart
2020-11-09  9:45     ` Tomi Valkeinen
2020-11-09  9:45       ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 23/56] drm/omap: panel-dsi-cm: use bulk regulator API Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09  8:51   ` Laurent Pinchart
2020-11-09  8:51     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 24/56] drm/omap: dsi: lp/hs switching support for transfer() Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09  8:53   ` Laurent Pinchart
2020-11-09  8:53     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 25/56] drm/omap: dsi: move TE GPIO handling into core Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09  9:19   ` Laurent Pinchart
2020-11-09  9:19     ` Laurent Pinchart
2020-11-11 13:26     ` Tomi Valkeinen
2020-11-11 13:26       ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 26/56] drm/omap: dsi: drop custom enable_te() API Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09  9:32   ` Laurent Pinchart
2020-11-09  9:32     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09  9:52   ` Laurent Pinchart
2020-11-09  9:52     ` Laurent Pinchart
2020-11-09 10:08     ` Tomi Valkeinen
2020-11-09 10:08       ` Tomi Valkeinen
2020-11-09 13:27       ` Sebastian Reichel
2020-11-09 13:27         ` Sebastian Reichel
2020-11-09 14:25         ` Tomi Valkeinen
2020-11-09 14:25           ` Tomi Valkeinen
2020-11-11 13:35         ` Tomi Valkeinen
2020-11-11 13:35           ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 28/56] drm/omap: dsi: untangle ulps ops from enable/disable Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09  9:57   ` Laurent Pinchart
2020-11-09  9:57     ` Laurent Pinchart
2020-11-11 14:05     ` Tomi Valkeinen
2020-11-11 14:05       ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 29/56] drm/omap: dsi: do ULPS in host driver Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 10:03   ` Laurent Pinchart
2020-11-09 10:03     ` Laurent Pinchart
2020-11-11 15:29     ` Tomi Valkeinen
2020-11-11 15:29       ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 10:10   ` Laurent Pinchart
2020-11-09 10:10     ` Laurent Pinchart
2020-11-11 15:34     ` Tomi Valkeinen
2020-11-11 15:34       ` Tomi Valkeinen
2020-11-11 15:58       ` Laurent Pinchart
2020-11-11 15:58         ` Laurent Pinchart
2020-11-12  8:08         ` Tomi Valkeinen
2020-11-12  8:08           ` Tomi Valkeinen
2020-11-16  9:22           ` Laurent Pinchart
2020-11-16  9:22             ` Laurent Pinchart
2020-11-17 10:04             ` Sebastian Reichel
2020-11-17 10:04               ` Sebastian Reichel
2020-11-05 12:03 ` [PATCH v3 31/56] drm/omap: dsi: Reverse direction of the DSS device enable/disable operations Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 10:17   ` Laurent Pinchart
2020-11-09 10:17     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 32/56] drm/omap: dsi: drop custom panel capability support Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 10:20   ` Laurent Pinchart
2020-11-09 10:20     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 33/56] drm/omap: dsi: convert to drm_panel Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 10:39   ` Laurent Pinchart
2020-11-09 10:39     ` Laurent Pinchart
2020-11-11 15:54     ` Tomi Valkeinen
2020-11-11 15:54       ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 34/56] drm/omap: drop omapdss-boot-init Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 10:40   ` Laurent Pinchart
2020-11-09 10:40     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 35/56] drm/omap: dsi: implement check timings Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 10:47   ` Laurent Pinchart
2020-11-09 10:47     ` Laurent Pinchart
2020-11-11 12:36     ` Tomi Valkeinen
2020-11-11 12:36       ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 36/56] drm/omap: panel-dsi-cm: use DEVICE_ATTR_RO Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 10:48   ` Laurent Pinchart
2020-11-09 10:48     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 37/56] drm/omap: panel-dsi-cm: support unbinding Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 10:49   ` Laurent Pinchart
2020-11-09 10:49     ` Laurent Pinchart
2020-11-11 12:03     ` Tomi Valkeinen
2020-11-11 12:03       ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 38/56] drm/omap: panel-dsi-cm: fix remove() Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 10:50   ` Laurent Pinchart
2020-11-09 10:50     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 39/56] drm/omap: remove global dss_device variable Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 10:51   ` Laurent Pinchart
2020-11-09 10:51     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 40/56] drm/panel: Move OMAP's DSI command mode panel driver Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-05 15:16   ` Sam Ravnborg
2020-11-05 15:16     ` Sam Ravnborg
2020-11-05 15:27   ` Tomi Valkeinen
2020-11-05 15:27     ` Tomi Valkeinen
2020-11-09 10:53   ` Laurent Pinchart
2020-11-09 10:53     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 41/56] drm/omap: dsi: Register a drm_bridge Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 10:54   ` Laurent Pinchart
2020-11-09 10:54     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 42/56] drm/omap: remove legacy DSS device operations Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:01   ` Laurent Pinchart
2020-11-09 11:01     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 43/56] drm/omap: remove unused omap_connector Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:02   ` Laurent Pinchart
2020-11-09 11:02     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 44/56] drm/omap: simplify omap_display_id Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:03   ` Laurent Pinchart
2020-11-09 11:03     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 45/56] drm/omap: drop unused DSS next pointer Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:04   ` Laurent Pinchart
2020-11-09 11:04     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 46/56] drm/omap: drop empty omap_encoder helper functions Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:05   ` Laurent Pinchart
2020-11-09 11:05     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 47/56] drm/omap: drop DSS ops_flags Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:05   ` Laurent Pinchart
2020-11-09 11:05     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 48/56] drm/omap: drop dssdev display field Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:06   ` Laurent Pinchart
2020-11-09 11:06     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 49/56] drm/omap: simplify DSI manual update code Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:07   ` Laurent Pinchart
2020-11-09 11:07     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 50/56] drm/omap: dsi: simplify pin config Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:09   ` Laurent Pinchart
2020-11-09 11:09     ` Laurent Pinchart
2020-11-11 12:24     ` Tomi Valkeinen
2020-11-11 12:24       ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 51/56] ARM: omap2plus_defconfig: Update for moved DSI command mode panel Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:10   ` Laurent Pinchart
2020-11-09 11:10     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 52/56] drm/omap: squash omapdrm sub-modules into one Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:15   ` Laurent Pinchart
2020-11-09 11:15     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 53/56] drm/omap: remove unused display.c Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:16   ` Laurent Pinchart
2020-11-09 11:16     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 54/56] drm/omap: drop unused owner field Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:16   ` Laurent Pinchart
2020-11-09 11:16     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 55/56] drm/omap: remove dispc_ops Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:17   ` Laurent Pinchart
2020-11-09 11:17     ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 56/56] drm/omap: remove dss_mgr_ops Tomi Valkeinen
2020-11-05 12:03   ` Tomi Valkeinen
2020-11-09 11:18   ` Laurent Pinchart
2020-11-09 11:18     ` Laurent Pinchart
2020-11-05 17:15 ` [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel H. Nikolaus Schaller
2020-11-05 17:15   ` H. Nikolaus Schaller
2020-11-05 17:36   ` Tomi Valkeinen
2020-11-05 17:36     ` Tomi Valkeinen
2020-11-05 18:14     ` H. Nikolaus Schaller
2020-11-05 18:14       ` H. Nikolaus Schaller
2020-11-05 18:28       ` Tomi Valkeinen
2020-11-05 18:28         ` Tomi Valkeinen
2020-11-05 18:56         ` H. Nikolaus Schaller
2020-11-05 18:56           ` H. Nikolaus Schaller
2020-11-06 14:37           ` Tomi Valkeinen
2020-11-06 14:37             ` Tomi Valkeinen
2020-11-06 15:04             ` Tomi Valkeinen
2020-11-06 15:04               ` Tomi Valkeinen
2020-11-07 12:19               ` H. Nikolaus Schaller
2020-11-07 12:19                 ` H. Nikolaus Schaller
2020-11-09  8:04                 ` Tomi Valkeinen
2020-11-09  8:04                   ` Tomi Valkeinen
2020-11-09  9:30                   ` H. Nikolaus Schaller
2020-11-09  9:30                     ` H. Nikolaus Schaller
2020-11-09 10:22                     ` Tomi Valkeinen
2020-11-09 10:22                       ` Tomi Valkeinen
2020-11-09 10:31                       ` H. Nikolaus Schaller
2020-11-09 10:31                         ` H. Nikolaus Schaller
2020-11-09 10:34                         ` Tomi Valkeinen
2020-11-09 10:34                           ` Tomi Valkeinen
2020-11-09 11:09                           ` H. Nikolaus Schaller
2020-11-09 11:09                             ` H. Nikolaus Schaller
2020-11-09 11:33                             ` Tomi Valkeinen
2020-11-09 11:33                               ` Tomi Valkeinen
2020-11-10 13:49                               ` H. Nikolaus Schaller
2020-11-10 13:49                                 ` H. Nikolaus Schaller
2020-11-10 15:25                                 ` Tomi Valkeinen
2020-11-10 15:25                                   ` Tomi Valkeinen
2020-11-10 16:49                                 ` H. Nikolaus Schaller
2020-11-10 16:49                                   ` H. Nikolaus Schaller
2020-11-10 16:52                                   ` Tomi Valkeinen
2020-11-10 16:52                                     ` Tomi Valkeinen
2020-11-10 21:04                                     ` H. Nikolaus Schaller
2020-11-10 21:04                                       ` H. Nikolaus Schaller
2020-11-11  6:40                                       ` Tomi Valkeinen
2020-11-11  6:40                                         ` Tomi Valkeinen
2020-11-11  7:48                                         ` H. Nikolaus Schaller
2020-11-11  7:48                                           ` H. Nikolaus Schaller
2020-11-11 10:11                                           ` Tomi Valkeinen
2020-11-11 10:11                                             ` Tomi Valkeinen
2020-11-11 19:27                                             ` H. Nikolaus Schaller
2020-11-11 19:27                                               ` H. Nikolaus Schaller
2020-11-05 21:31 ` Sam Ravnborg
2020-11-05 21:31   ` Sam Ravnborg
2020-11-08 16:33 ` Nikhil Devshatwar
2020-11-08 16:33   ` Nikhil Devshatwar
     [not found] ` <BAFBC885-9BBE-46D1-B4C4-79910705864A@goldelico.com>
     [not found]   ` <74abbdc4-cc1e-9caf-d4ee-0a5cdb557643@ti.com>
     [not found]     ` <b0677958-02ad-1d2f-d755-! 25a9d384eddc@ti.com>
     [not found]       ` <1A09B4DA-F726-4F37-8CF4-BC192C659950@goldelico.com>
     [not found]         ` <9a4e373e-9092-6d82-937a-bc663d2376b4@ti.com>
     [not found]           ` <09ebc3e3-72c7-41fb-fb21-bf28c! f883d3f@ti.com>
     [not found]             ` <E738362A-8ECE-4ED5-8057-2ABB6F5C3056@goldelico.com>
     [not found]               ` <9a21b475-eff0-9882-8d65-d1f! dd2139dc4@ti.com>
     [not found]                 ` <A1DEB54D-FEC0-493A-858C-E5C0DB24B35E@goldelico.com>
     [not found]                   ` <1150ba22-1ae2-39f3-0924-7! a1f1b468597@ti.com>
     [not found]                     ` <2999ED77-B9F7-4197-81B8-F1AFF329A1E9@goldelico.com>
     [not found]                       ` <cbc147d2-af41-2bed-5670-530d45cfb24e@ti.com>
     [not found]                         ` <106bfbee-c472-c04c-0f7b-db108a090a63@ti.com>
     [not found]                           ` <420b81bd-fc95-e294-fcbe-f34db1ef! f9e7@ti.c om>
     [not found]                             ` <B2FBCAE4-FAD9-4C0D-9C75-63A701215886@goldelico.com>
     [not found]                               ` <826B2E97-8B77-412A-8093-753BF7A65EE1@goldelico.com>
     [not found]                                 ` <acad2006-53a2-6587-b8e6-787e358! 8932a@ti.com>
     [not found]                                   ` <AF87C7B4-DCD2-4207-A300-567DB65B08ED@goldelico.com>
     [not found]                                     ` <27cfb13a-62e3-0a53-153f-92641c437cee@ti. com>
     [not found]                                       ` <27cfb13a-62e3-0a53-153f-92641c437cee@ti.com>
2020-11-16  9:16                                         ` H. Nikolaus Schaller
2020-11-16  9:16                                           ` H. Nikolaus Schaller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.