linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/26] DSS device model change
@ 2013-03-26 13:33 Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 01/26] OMAPDSS: only probe pdata if there's one Tomi Valkeinen
                   ` (26 more replies)
  0 siblings, 27 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen, Tony Lindgren

Hi,

To make it possible to add DT support to DSS, and later use the Common Display
Framework, we need to change the DSS device model. We currently have a custom
dss bus, and omap_dss_devices on that bus, and the aim is to get rid of that
bus.

The panel devices will be converted occording to the control bus of the panel.
For many panels this means that the panel device will become a platform_device.
For some, it means the panel devices become i2c or spi devices.

This series takes the first step toward that goal. This series:

* Converts DPI, HDMI and DSI outputs to work with new style panels
* Converts TFP410, Taal and generic-dpi panels to new model
* Converts Panda, 4430SDP and Overo boards to use the new panels

The non-converted outputs and panels still work, so they can be converted in
stages.

Note about board files: I only convert a few board files here for example. I
have a branch with board file changes for all the affected board files. I did
not include them as they are more or less identical. If this series looks good,
I will create an independent branch for the arch/arm stuff, so it can be pulled
separately.

This series can also be found from:

git://gitorious.org/linux-omap-dss2/linux.git work/dss-dev-model-review

 Tomi

Tomi Valkeinen (26):
  OMAPDSS: only probe pdata if there's one
  OMAPDSS: add omap_dss_find_output()
  OMAPDSS: add omap_dss_find_output_by_node()
  OMAPDSS: fix dss_get_ctx_loss_count for DT
  OMAPDSS: DPI: fix regulators
  OMAPDSS: SDI: fix regulators
  OMAPDSS: add panel list
  OMAPDSS: use the panel list in omap_dss_get_next_device
  OMAPDSS: don't use dss bus in suspend/resume
  OMAPDSS: implement display sysfs without dss bus
  OMAPDSS: Add panel_dev pointer to dssdev
  OMAPDSS: DPI: new panel registration
  OMAPDSS: DSI: new panel registration
  OMAPDSS: HDMI: new panel registration
  OMAPDSS: TFP410 platform_data changes
  OMAPDSS: TFP410: convert to platform device
  OMAPDSS: generic-dpi-panel platform_data changes
  OMAPDSS: panel-generic-dpi: convert to platform device
  OMAPDSS: HDMI: convert to platform device
  OMAPDSS: Taal platform_data changes
  OMAPDSS: Taal: convert to platform device
  ARM: OMAP: Panda: use new TFP410 platform driver
  ARM: OMAP: Panda & SDP: use new HDMI driver
  ARM: OMAP: 4430SDP: use new Taal driver
  ARM: OMAP: Overo: use new TFP410 platform driver
  ARM: OMAP: Overo: use new generic-dpi-panel platform driver

 arch/arm/mach-omap2/board-overo.c                |   95 +++----
 arch/arm/mach-omap2/dss-common.c                 |   96 +++----
 drivers/video/omap2/displays/panel-generic-dpi.c |  141 +++++++----
 drivers/video/omap2/displays/panel-taal.c        |  294 +++++++++++++---------
 drivers/video/omap2/displays/panel-tfp410.c      |  205 +++++++++------
 drivers/video/omap2/dss/apply.c                  |   15 +-
 drivers/video/omap2/dss/core.c                   |   32 +--
 drivers/video/omap2/dss/display-sysfs.c          |  126 ++++++----
 drivers/video/omap2/dss/display.c                |  166 +++++++-----
 drivers/video/omap2/dss/dpi.c                    |   59 ++++-
 drivers/video/omap2/dss/dsi.c                    |   58 ++++-
 drivers/video/omap2/dss/dss.c                    |    3 +-
 drivers/video/omap2/dss/dss.h                    |   11 +-
 drivers/video/omap2/dss/hdmi.c                   |   44 +++-
 drivers/video/omap2/dss/hdmi_panel.c             |   48 +++-
 drivers/video/omap2/dss/output.c                 |   26 ++
 drivers/video/omap2/dss/rfbi.c                   |    3 +-
 drivers/video/omap2/dss/sdi.c                    |   23 +-
 drivers/video/omap2/dss/venc.c                   |    3 +-
 include/video/omap-panel-generic-dpi.h           |    3 +
 include/video/omap-panel-nokia-dsi.h             |    1 +
 include/video/omap-panel-tfp410.h                |    5 +
 include/video/omapdss.h                          |   16 ++
 23 files changed, 940 insertions(+), 533 deletions(-)

-- 
1.7.10.4


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

* [PATCH 01/26] OMAPDSS: only probe pdata if there's one
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 02/26] OMAPDSS: add omap_dss_find_output() Tomi Valkeinen
                   ` (25 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

omapdss output drivers always read the platform data. This crashes when
there's no platform data when using DT.

Add a check to read the platform data only if it exists.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dpi.c  |    3 ++-
 drivers/video/omap2/dss/dsi.c  |    3 ++-
 drivers/video/omap2/dss/hdmi.c |    3 ++-
 drivers/video/omap2/dss/rfbi.c |    3 ++-
 drivers/video/omap2/dss/sdi.c  |    3 ++-
 drivers/video/omap2/dss/venc.c |    3 ++-
 6 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index abe1a4e2..ad67a9c 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -702,7 +702,8 @@ static int __init omap_dpi_probe(struct platform_device *pdev)
 
 	dpi_init_output(pdev);
 
-	dpi_probe_pdata(pdev);
+	if (pdev->dev.platform_data)
+		dpi_probe_pdata(pdev);
 
 	return 0;
 }
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 8db29bf..ddb8bf6 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -5573,7 +5573,8 @@ static int __init omap_dsihw_probe(struct platform_device *dsidev)
 
 	dsi_init_output(dsidev);
 
-	dsi_probe_pdata(dsidev);
+	if (dsidev->dev.platform_data)
+		dsi_probe_pdata(dsidev);
 
 	dsi_runtime_put(dsidev);
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index a6f9538..4b32dd3 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -1102,7 +1102,8 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
 
 	dss_debugfs_create_file("hdmi", hdmi_dump_regs);
 
-	hdmi_probe_pdata(pdev);
+	if (pdev->dev.platform_data)
+		hdmi_probe_pdata(pdev);
 
 	return 0;
 
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 1a691bb..946c415 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -1091,7 +1091,8 @@ static int __init omap_rfbihw_probe(struct platform_device *pdev)
 
 	rfbi_init_output(pdev);
 
-	rfbi_probe_pdata(pdev);
+	if (pdev->dev.platform_data)
+		rfbi_probe_pdata(pdev);
 
 	return 0;
 
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index e6baee2..0155c7e 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -361,7 +361,8 @@ static int __init omap_sdi_probe(struct platform_device *pdev)
 {
 	sdi_init_output(pdev);
 
-	sdi_probe_pdata(pdev);
+	if (pdev->dev.platform_data)
+		sdi_probe_pdata(pdev);
 
 	return 0;
 }
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 5cb983e..f5e8a5b 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -879,7 +879,8 @@ static int __init omap_venchw_probe(struct platform_device *pdev)
 
 	venc_init_output(pdev);
 
-	venc_probe_pdata(pdev);
+	if (pdev->dev.platform_data)
+		venc_probe_pdata(pdev);
 
 	return 0;
 
-- 
1.7.10.4


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

* [PATCH 02/26] OMAPDSS: add omap_dss_find_output()
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 01/26] OMAPDSS: only probe pdata if there's one Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 03/26] OMAPDSS: add omap_dss_find_output_by_node() Tomi Valkeinen
                   ` (24 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

Add a support function to find a DSS output by given name. This is used
in later patches to link the panels to DSS outputs.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/output.c |   13 +++++++++++++
 include/video/omapdss.h          |    1 +
 2 files changed, 14 insertions(+)

diff --git a/drivers/video/omap2/dss/output.c b/drivers/video/omap2/dss/output.c
index 5214df6..3274628 100644
--- a/drivers/video/omap2/dss/output.c
+++ b/drivers/video/omap2/dss/output.c
@@ -115,6 +115,19 @@ struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id)
 }
 EXPORT_SYMBOL(omap_dss_get_output);
 
+struct omap_dss_output *omap_dss_find_output(const char *name)
+{
+	struct omap_dss_output *out;
+
+	list_for_each_entry(out, &output_list, list) {
+		if (strcmp(out->name, name) = 0)
+			return out;
+	}
+
+	return NULL;
+}
+EXPORT_SYMBOL(omap_dss_find_output);
+
 static const struct dss_mgr_ops *dss_mgr_ops;
 
 int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops)
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index d5f1fff..aad47a2 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -779,6 +779,7 @@ int omap_dss_get_num_overlays(void);
 struct omap_overlay *omap_dss_get_overlay(int num);
 
 struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id);
+struct omap_dss_output *omap_dss_find_output(const char *name);
 int omapdss_output_set_device(struct omap_dss_output *out,
 		struct omap_dss_device *dssdev);
 int omapdss_output_unset_device(struct omap_dss_output *out);
-- 
1.7.10.4


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

* [PATCH 03/26] OMAPDSS: add omap_dss_find_output_by_node()
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 01/26] OMAPDSS: only probe pdata if there's one Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 02/26] OMAPDSS: add omap_dss_find_output() Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 04/26] OMAPDSS: fix dss_get_ctx_loss_count for DT Tomi Valkeinen
                   ` (23 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

Add a support function to find a DSS output by given DT node. This is
used in later patches to link the panels to DSS outputs.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/output.c |   13 +++++++++++++
 include/video/omapdss.h          |    1 +
 2 files changed, 14 insertions(+)

diff --git a/drivers/video/omap2/dss/output.c b/drivers/video/omap2/dss/output.c
index 3274628..4d01001 100644
--- a/drivers/video/omap2/dss/output.c
+++ b/drivers/video/omap2/dss/output.c
@@ -128,6 +128,19 @@ struct omap_dss_output *omap_dss_find_output(const char *name)
 }
 EXPORT_SYMBOL(omap_dss_find_output);
 
+struct omap_dss_output *omap_dss_find_output_by_node(struct device_node *node)
+{
+	struct omap_dss_output *out;
+
+	list_for_each_entry(out, &output_list, list) {
+		if (out->pdev->dev.of_node = node)
+			return out;
+	}
+
+	return NULL;
+}
+EXPORT_SYMBOL(omap_dss_find_output_by_node);
+
 static const struct dss_mgr_ops *dss_mgr_ops;
 
 int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops)
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index aad47a2..7fe6144 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -780,6 +780,7 @@ struct omap_overlay *omap_dss_get_overlay(int num);
 
 struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id);
 struct omap_dss_output *omap_dss_find_output(const char *name);
+struct omap_dss_output *omap_dss_find_output_by_node(struct device_node *node);
 int omapdss_output_set_device(struct omap_dss_output *out,
 		struct omap_dss_device *dssdev);
 int omapdss_output_unset_device(struct omap_dss_output *out);
-- 
1.7.10.4


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

* [PATCH 04/26] OMAPDSS: fix dss_get_ctx_loss_count for DT
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (2 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 03/26] OMAPDSS: add omap_dss_find_output_by_node() Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 05/26] OMAPDSS: DPI: fix regulators Tomi Valkeinen
                   ` (22 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

When using DT, dss device does not have platform data. However,
dss_get_ctx_loss_count() uses dss device's platform data to find the
get_ctx_loss_count function pointer.

To fix this, change dss_get_ctx_loss_count() needs to be changed to get
the platform data from the omapdss device, which is a "virtual" device
and always has platform data.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dss.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index fdd32e8..62db201 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -157,7 +157,8 @@ static void dss_restore_context(void)
 
 int dss_get_ctx_loss_count(void)
 {
-	struct omap_dss_board_info *board_data = dss.pdev->dev.platform_data;
+	struct platform_device *core_pdev = dss_get_core_pdev();
+	struct omap_dss_board_info *board_data = core_pdev->dev.platform_data;
 	int cnt;
 
 	if (!board_data->get_context_loss_count)
-- 
1.7.10.4


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

* [PATCH 05/26] OMAPDSS: DPI: fix regulators
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (3 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 04/26] OMAPDSS: fix dss_get_ctx_loss_count for DT Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-27  9:57   ` Archit Taneja
  2013-03-26 13:33 ` [PATCH 06/26] OMAPDSS: SDI: " Tomi Valkeinen
                   ` (21 subsequent siblings)
  26 siblings, 1 reply; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

On some platforms DPI requires a regulator to be enabled to power up the
output pins. This regulator is, for some reason, currently attached to
the virtual omapdss device, instead of the DPI device. This does not
work for DT, as the regulator mappings need to be described in the DT
data, and the virtual omapdss device is not present there.

Fix the issue by acquiring the regulator in the DPI device. To retain
compatibility with the current board files, the old method of getting
the regulator is kept. The old method can be removed when the board
files have been changed to pass the regulator to DPI.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dpi.c |   21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index ad67a9c..08342d1 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -37,7 +37,10 @@
 #include "dss_features.h"
 
 static struct {
+	struct platform_device *pdev;
+
 	struct regulator *vdds_dsi_reg;
+	bool vdds_dsi_from_core;
 	struct platform_device *dsidev;
 
 	struct mutex lock;
@@ -583,10 +586,15 @@ static int __init dpi_init_display(struct omap_dss_device *dssdev)
 		struct regulator *vdds_dsi;
 
 		vdds_dsi = dss_get_vdds_dsi();
-
 		if (IS_ERR(vdds_dsi)) {
-			DSSERR("can't get VDDS_DSI regulator\n");
-			return PTR_ERR(vdds_dsi);
+			vdds_dsi = regulator_get(&dpi.pdev->dev, "vdds_dsi");
+			if (IS_ERR(vdds_dsi)) {
+				DSSERR("can't get VDDS_DSI regulator\n");
+				return PTR_ERR(vdds_dsi);
+			}
+			dpi.vdds_dsi_from_core = false;
+		} else {
+			dpi.vdds_dsi_from_core = true;
 		}
 
 		dpi.vdds_dsi_reg = vdds_dsi;
@@ -698,6 +706,8 @@ static void __exit dpi_uninit_output(struct platform_device *pdev)
 
 static int __init omap_dpi_probe(struct platform_device *pdev)
 {
+	dpi.pdev = pdev;
+
 	mutex_init(&dpi.lock);
 
 	dpi_init_output(pdev);
@@ -714,6 +724,11 @@ static int __exit omap_dpi_remove(struct platform_device *pdev)
 
 	dpi_uninit_output(pdev);
 
+	if (dpi.vdds_dsi_reg != NULL && dpi.vdds_dsi_from_core = false) {
+		regulator_put(dpi.vdds_dsi_reg);
+		dpi.vdds_dsi_reg = NULL;
+	}
+
 	return 0;
 }
 
-- 
1.7.10.4


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

* [PATCH 06/26] OMAPDSS: SDI: fix regulators
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (4 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 05/26] OMAPDSS: DPI: fix regulators Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 07/26] OMAPDSS: add panel list Tomi Valkeinen
                   ` (20 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

SDI requires a regulator to operate. This regulator is, for some reason,
currently attached to the virtual omapdss device, instead of the SDI
device. This does not work for DT, as the regulator mappings need to be
described in the DT data, and the virtual omapdss device is not present
there.

Fix the issue by acquiring the regulator in the SDI device. To retain
compatibility with the current board files, the old method of getting
the regulator is kept. The old method can be removed when the board
files have been changed to pass the regulator to SDI.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/sdi.c |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 0155c7e..607244a 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -31,8 +31,11 @@
 #include "dss.h"
 
 static struct {
+	struct platform_device *pdev;
+
 	bool update_enabled;
 	struct regulator *vdds_sdi_reg;
+	bool vdds_sdi_from_core;
 
 	struct dss_lcd_mgr_config mgr_config;
 	struct omap_video_timings timings;
@@ -258,8 +261,14 @@ static int __init sdi_init_display(struct omap_dss_device *dssdev)
 		vdds_sdi = dss_get_vdds_sdi();
 
 		if (IS_ERR(vdds_sdi)) {
-			DSSERR("can't get VDDS_SDI regulator\n");
-			return PTR_ERR(vdds_sdi);
+			vdds_sdi = regulator_get(&sdi.pdev->dev, "vdds_sdi");
+			if (IS_ERR(vdds_sdi)) {
+				DSSERR("can't get VDDS_SDI regulator\n");
+				return PTR_ERR(vdds_sdi);
+			}
+			sdi.vdds_sdi_from_core = false;
+		} else {
+			sdi.vdds_sdi_from_core = true;
 		}
 
 		sdi.vdds_sdi_reg = vdds_sdi;
@@ -359,6 +368,8 @@ static void __exit sdi_uninit_output(struct platform_device *pdev)
 
 static int __init omap_sdi_probe(struct platform_device *pdev)
 {
+	sdi.pdev = pdev;
+
 	sdi_init_output(pdev);
 
 	if (pdev->dev.platform_data)
@@ -373,6 +384,11 @@ static int __exit omap_sdi_remove(struct platform_device *pdev)
 
 	sdi_uninit_output(pdev);
 
+	if (sdi.vdds_sdi_reg != NULL && sdi.vdds_sdi_from_core = false) {
+		regulator_put(sdi.vdds_sdi_reg);
+		sdi.vdds_sdi_reg = NULL;
+	}
+
 	return 0;
 }
 
-- 
1.7.10.4


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

* [PATCH 07/26] OMAPDSS: add panel list
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (5 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 06/26] OMAPDSS: SDI: " Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 08/26] OMAPDSS: use the panel list in omap_dss_get_next_device Tomi Valkeinen
                   ` (19 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

We currently use the omapdss bus (which contains all the available
displays) to iterate the displays. As the omapdss bus is on its way out,
this needs to be changed.

Instead of using the dss bus to iterate displays, this patch adds our
own list of displays which we manage. The panels on the dss bus are
automatically added to this new list.

An "alias" field is also added to omap_dss_device. This field is
set to "display%d", the same way as omap_dss_device's dev name is set.
This alias is later used to keep backward compatibility, when the
embedded dev is no longer used.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/core.c    |    2 ++
 drivers/video/omap2/dss/display.c |   30 ++++++++++++++++++++++++++++++
 drivers/video/omap2/dss/dss.h     |    3 +++
 include/video/omapdss.h           |    5 +++++
 4 files changed, 40 insertions(+)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index a9bab9f..5bdd442 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -428,6 +428,7 @@ struct omap_dss_device *dss_alloc_and_init_device(struct device *parent)
 
 int dss_add_device(struct omap_dss_device *dssdev)
 {
+	dss_add_panel(dssdev);
 	return device_add(&dssdev->dev);
 }
 
@@ -439,6 +440,7 @@ void dss_put_device(struct omap_dss_device *dssdev)
 void dss_unregister_device(struct omap_dss_device *dssdev)
 {
 	device_unregister(&dssdev->dev);
+	dss_remove_panel(dssdev);
 }
 
 static int dss_unregister_dss_dev(struct device *dev, void *data)
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c
index 0aa8ad8..e785694 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -146,6 +146,36 @@ void dss_disable_all_devices(void)
 	bus_for_each_dev(bus, NULL, NULL, dss_disable_device);
 }
 
+static LIST_HEAD(panel_list);
+static DEFINE_MUTEX(panel_list_mutex);
+static int disp_num_counter;
+
+int dss_add_panel(struct omap_dss_device *dssdev)
+{
+	struct omap_dss_driver *drv = dssdev->driver;
+
+	snprintf(dssdev->alias, sizeof(dssdev->alias),
+			"display%d", disp_num_counter++);
+
+	if (drv && drv->get_resolution = NULL)
+		drv->get_resolution = omapdss_default_get_resolution;
+	if (drv && drv->get_recommended_bpp = NULL)
+		drv->get_recommended_bpp = omapdss_default_get_recommended_bpp;
+	if (drv && drv->get_timings = NULL)
+		drv->get_timings = omapdss_default_get_timings;
+
+	mutex_lock(&panel_list_mutex);
+	list_add_tail(&dssdev->panel_list, &panel_list);
+	mutex_unlock(&panel_list_mutex);
+	return 0;
+}
+
+void dss_remove_panel(struct omap_dss_device *dssdev)
+{
+	mutex_lock(&panel_list_mutex);
+	list_del(&dssdev->panel_list);
+	mutex_unlock(&panel_list_mutex);
+}
 
 void omap_dss_get_device(struct omap_dss_device *dssdev)
 {
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index faaf358..5252423 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -489,4 +489,7 @@ static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr)
 }
 #endif
 
+int dss_add_panel(struct omap_dss_device *dssdev);
+void dss_remove_panel(struct omap_dss_device *dssdev);
+
 #endif
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 7fe6144..ab4ea37 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -596,6 +596,11 @@ struct omap_dss_output {
 struct omap_dss_device {
 	struct device dev;
 
+	struct list_head panel_list;
+
+	/* alias in the form of "display%d" */
+	char alias[16];
+
 	enum omap_display_type type;
 
 	/* obsolete, to be removed */
-- 
1.7.10.4


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

* [PATCH 08/26] OMAPDSS: use the panel list in omap_dss_get_next_device
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (6 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 07/26] OMAPDSS: add panel list Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 09/26] OMAPDSS: don't use dss bus in suspend/resume Tomi Valkeinen
                   ` (18 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

omap_dss_get_next_device() uses the dss bus to iterate over the
displays. This patch changes omap_dss_get_next_device() to use the new
panel list instead.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/display.c |   63 +++++++++++++++++++++++++++----------
 1 file changed, 46 insertions(+), 17 deletions(-)

diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c
index e785694..50792bf 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -189,27 +189,51 @@ void omap_dss_put_device(struct omap_dss_device *dssdev)
 }
 EXPORT_SYMBOL(omap_dss_put_device);
 
-/* ref count of the found device is incremented. ref count
- * of from-device is decremented. */
+/*
+ * ref count of the found device is incremented.
+ * ref count of from-device is decremented.
+ */
 struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from)
 {
-	struct device *dev;
-	struct device *dev_start = NULL;
-	struct omap_dss_device *dssdev = NULL;
+	struct list_head *l;
+	struct omap_dss_device *dssdev;
+
+	mutex_lock(&panel_list_mutex);
+
+	if (list_empty(&panel_list)) {
+		dssdev = NULL;
+		goto out;
+	}
 
-	int match(struct device *dev, void *data)
-	{
-		return 1;
+	if (from = NULL) {
+		dssdev = list_first_entry(&panel_list, struct omap_dss_device,
+				panel_list);
+		omap_dss_get_device(dssdev);
+		goto out;
 	}
 
-	if (from)
-		dev_start = &from->dev;
-	dev = bus_find_device(dss_get_bus(), dev_start, NULL, match);
-	if (dev)
-		dssdev = to_dss_device(dev);
-	if (from)
-		put_device(&from->dev);
+	omap_dss_put_device(from);
+
+	list_for_each(l, &panel_list) {
+		dssdev = list_entry(l, struct omap_dss_device, panel_list);
+		if (dssdev = from) {
+			if (list_is_last(l, &panel_list)) {
+				dssdev = NULL;
+				goto out;
+			}
+
+			dssdev = list_entry(l->next, struct omap_dss_device,
+					panel_list);
+			omap_dss_get_device(dssdev);
+			goto out;
+		}
+	}
+
+	WARN(1, "'from' dssdev not found\n");
 
+	dssdev = NULL;
+out:
+	mutex_unlock(&panel_list_mutex);
 	return dssdev;
 }
 EXPORT_SYMBOL(omap_dss_get_next_device);
@@ -219,12 +243,17 @@ struct omap_dss_device *omap_dss_find_device(void *data,
 {
 	struct omap_dss_device *dssdev = NULL;
 
+	mutex_lock(&panel_list_mutex);
+
 	while ((dssdev = omap_dss_get_next_device(dssdev)) != NULL) {
 		if (match(dssdev, data))
-			return dssdev;
+			goto out;
 	}
 
-	return NULL;
+	dssdev = NULL;
+out:
+	mutex_unlock(&panel_list_mutex);
+	return dssdev;
 }
 EXPORT_SYMBOL(omap_dss_find_device);
 
-- 
1.7.10.4


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

* [PATCH 09/26] OMAPDSS: don't use dss bus in suspend/resume
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (7 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 08/26] OMAPDSS: use the panel list in omap_dss_get_next_device Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 10/26] OMAPDSS: implement display sysfs without dss bus Tomi Valkeinen
                   ` (17 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

We have support functions to suspend and resume all the displays that
are used with system suspend. These functions use the dss bus to iterate
the display devices.

As we aim to remove the custom dss bus totally, this patch removes the
explicit use of dss bus from these functions. Instead the
for_each_dss_dev() macro is used to go through the devices.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/display.c |   77 ++++++++++++++-----------------------
 1 file changed, 28 insertions(+), 49 deletions(-)

diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c
index 50792bf..85e1cd3 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -76,74 +76,53 @@ void omapdss_default_get_timings(struct omap_dss_device *dssdev,
 }
 EXPORT_SYMBOL(omapdss_default_get_timings);
 
-static int dss_suspend_device(struct device *dev, void *data)
-{
-	struct omap_dss_device *dssdev = to_dss_device(dev);
-
-	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) {
-		dssdev->activate_after_resume = false;
-		return 0;
-	}
-
-	dssdev->driver->disable(dssdev);
-
-	dssdev->activate_after_resume = true;
-
-	return 0;
-}
-
 int dss_suspend_all_devices(void)
 {
-	int r;
-	struct bus_type *bus = dss_get_bus();
-
-	r = bus_for_each_dev(bus, NULL, NULL, dss_suspend_device);
-	if (r) {
-		/* resume all displays that were suspended */
-		dss_resume_all_devices();
-		return r;
-	}
-
-	return 0;
-}
+	struct omap_dss_device *dssdev = NULL;
 
-static int dss_resume_device(struct device *dev, void *data)
-{
-	int r;
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	for_each_dss_dev(dssdev) {
+		if (!dssdev->driver)
+			continue;
 
-	if (dssdev->activate_after_resume) {
-		r = dssdev->driver->enable(dssdev);
-		if (r)
-			return r;
+		if (dssdev->state = OMAP_DSS_DISPLAY_ACTIVE) {
+			dssdev->driver->disable(dssdev);
+			dssdev->activate_after_resume = true;
+		} else {
+			dssdev->activate_after_resume = false;
+		}
 	}
 
-	dssdev->activate_after_resume = false;
-
 	return 0;
 }
 
 int dss_resume_all_devices(void)
 {
-	struct bus_type *bus = dss_get_bus();
-
-	return bus_for_each_dev(bus, NULL, NULL, dss_resume_device);
-}
+	struct omap_dss_device *dssdev = NULL;
 
-static int dss_disable_device(struct device *dev, void *data)
-{
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	for_each_dss_dev(dssdev) {
+		if (!dssdev->driver)
+			continue;
 
-	if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)
-		dssdev->driver->disable(dssdev);
+		if (dssdev->activate_after_resume) {
+			dssdev->driver->enable(dssdev);
+			dssdev->activate_after_resume = false;
+		}
+	}
 
 	return 0;
 }
 
 void dss_disable_all_devices(void)
 {
-	struct bus_type *bus = dss_get_bus();
-	bus_for_each_dev(bus, NULL, NULL, dss_disable_device);
+	struct omap_dss_device *dssdev = NULL;
+
+	for_each_dss_dev(dssdev) {
+		if (!dssdev->driver)
+			continue;
+
+		if (dssdev->state = OMAP_DSS_DISPLAY_ACTIVE)
+			dssdev->driver->disable(dssdev);
+	}
 }
 
 static LIST_HEAD(panel_list);
-- 
1.7.10.4


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

* [PATCH 10/26] OMAPDSS: implement display sysfs without dss bus
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (8 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 09/26] OMAPDSS: don't use dss bus in suspend/resume Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 11/26] OMAPDSS: Add panel_dev pointer to dssdev Tomi Valkeinen
                   ` (16 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

We aim to remove the custom omapdss bus totally, as it's quite a strange
construct and won't be compatible with common display framework. One
problem on the road is that we have sysfs files for each display, and
they depend on the omapdss bus.

This patch creates the display sysfs files independent of the omapdss
bus. This gives us backwards compatibility without using the omapdss bus
for the sysfs files.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/apply.c         |   15 ++--
 drivers/video/omap2/dss/core.c          |   28 -------
 drivers/video/omap2/dss/display-sysfs.c |  125 ++++++++++++++++++-------------
 drivers/video/omap2/dss/dss.h           |    6 +-
 4 files changed, 79 insertions(+), 95 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index a4b356a..44f94b8 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -1569,7 +1569,6 @@ static DEFINE_MUTEX(compat_init_lock);
 int omapdss_compat_init(void)
 {
 	struct platform_device *pdev = dss_get_core_pdev();
-	struct omap_dss_device *dssdev = NULL;
 	int i, r;
 
 	mutex_lock(&compat_init_lock);
@@ -1615,12 +1614,9 @@ int omapdss_compat_init(void)
 	if (r)
 		goto err_mgr_ops;
 
-	for_each_dss_dev(dssdev) {
-		r = display_init_sysfs(pdev, dssdev);
-		/* XXX uninit sysfs files on error */
-		if (r)
-			goto err_disp_sysfs;
-	}
+	r = display_init_sysfs(pdev);
+	if (r)
+		goto err_disp_sysfs;
 
 	dispc_runtime_get();
 
@@ -1637,6 +1633,7 @@ out:
 
 err_init_irq:
 	dispc_runtime_put();
+	display_uninit_sysfs(pdev);
 
 err_disp_sysfs:
 	dss_uninstall_mgr_ops();
@@ -1656,7 +1653,6 @@ EXPORT_SYMBOL(omapdss_compat_init);
 void omapdss_compat_uninit(void)
 {
 	struct platform_device *pdev = dss_get_core_pdev();
-	struct omap_dss_device *dssdev = NULL;
 
 	mutex_lock(&compat_init_lock);
 
@@ -1665,8 +1661,7 @@ void omapdss_compat_uninit(void)
 
 	dss_dispc_uninitialize_irq();
 
-	for_each_dss_dev(dssdev)
-		display_uninit_sysfs(pdev, dssdev);
+	display_uninit_sysfs(pdev);
 
 	dss_uninstall_mgr_ops();
 
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 5bdd442..054e980 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -287,37 +287,9 @@ static int dss_bus_match(struct device *dev, struct device_driver *driver)
 	return strcmp(dssdev->driver_name, driver->name) = 0;
 }
 
-static ssize_t device_name_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
-{
-	struct omap_dss_device *dssdev = to_dss_device(dev);
-	return snprintf(buf, PAGE_SIZE, "%s\n",
-			dssdev->name ?
-			dssdev->name : "");
-}
-
-static struct device_attribute default_dev_attrs[] = {
-	__ATTR(name, S_IRUGO, device_name_show, NULL),
-	__ATTR_NULL,
-};
-
-static ssize_t driver_name_show(struct device_driver *drv, char *buf)
-{
-	struct omap_dss_driver *dssdrv = to_dss_driver(drv);
-	return snprintf(buf, PAGE_SIZE, "%s\n",
-			dssdrv->driver.name ?
-			dssdrv->driver.name : "");
-}
-static struct driver_attribute default_drv_attrs[] = {
-	__ATTR(name, S_IRUGO, driver_name_show, NULL),
-	__ATTR_NULL,
-};
-
 static struct bus_type dss_bus_type = {
 	.name = "omapdss",
 	.match = dss_bus_match,
-	.dev_attrs = default_dev_attrs,
-	.drv_attrs = default_drv_attrs,
 };
 
 static void dss_bus_release(struct device *dev)
diff --git a/drivers/video/omap2/dss/display-sysfs.c b/drivers/video/omap2/dss/display-sysfs.c
index 18211a9..537921b 100644
--- a/drivers/video/omap2/dss/display-sysfs.c
+++ b/drivers/video/omap2/dss/display-sysfs.c
@@ -22,17 +22,40 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/jiffies.h>
 #include <linux/platform_device.h>
+#include <linux/sysfs.h>
 
 #include <video/omapdss.h>
 #include "dss.h"
-#include "dss_features.h"
+
+static struct omap_dss_device *to_dss_device_sysfs(struct device *dev)
+{
+	struct omap_dss_device *dssdev = NULL;
+
+	for_each_dss_dev(dssdev) {
+		if (&dssdev->dev = dev) {
+			omap_dss_put_device(dssdev);
+			return dssdev;
+		}
+	}
+
+	return NULL;
+}
+
+static ssize_t display_name_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct omap_dss_device *dssdev = to_dss_device_sysfs(dev);
+
+	return snprintf(buf, PAGE_SIZE, "%s\n",
+			dssdev->name ?
+			dssdev->name : "");
+}
 
 static ssize_t display_enabled_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_device *dssdev = to_dss_device_sysfs(dev);
 	bool enabled = dssdev->state != OMAP_DSS_DISPLAY_DISABLED;
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", enabled);
@@ -42,7 +65,7 @@ static ssize_t display_enabled_store(struct device *dev,
 		struct device_attribute *attr,
 		const char *buf, size_t size)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_device *dssdev = to_dss_device_sysfs(dev);
 	int r;
 	bool enabled;
 
@@ -66,7 +89,7 @@ static ssize_t display_enabled_store(struct device *dev,
 static ssize_t display_tear_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_device *dssdev = to_dss_device_sysfs(dev);
 	return snprintf(buf, PAGE_SIZE, "%d\n",
 			dssdev->driver->get_te ?
 			dssdev->driver->get_te(dssdev) : 0);
@@ -75,7 +98,7 @@ static ssize_t display_tear_show(struct device *dev,
 static ssize_t display_tear_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t size)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_device *dssdev = to_dss_device_sysfs(dev);
 	int r;
 	bool te;
 
@@ -96,7 +119,7 @@ static ssize_t display_tear_store(struct device *dev,
 static ssize_t display_timings_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_device *dssdev = to_dss_device_sysfs(dev);
 	struct omap_video_timings t;
 
 	if (!dssdev->driver->get_timings)
@@ -113,7 +136,7 @@ static ssize_t display_timings_show(struct device *dev,
 static ssize_t display_timings_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t size)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_device *dssdev = to_dss_device_sysfs(dev);
 	struct omap_video_timings t = dssdev->panel.timings;
 	int r, found;
 
@@ -152,7 +175,7 @@ static ssize_t display_timings_store(struct device *dev,
 static ssize_t display_rotate_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_device *dssdev = to_dss_device_sysfs(dev);
 	int rotate;
 	if (!dssdev->driver->get_rotate)
 		return -ENOENT;
@@ -163,7 +186,7 @@ static ssize_t display_rotate_show(struct device *dev,
 static ssize_t display_rotate_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t size)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_device *dssdev = to_dss_device_sysfs(dev);
 	int rot, r;
 
 	if (!dssdev->driver->set_rotate || !dssdev->driver->get_rotate)
@@ -183,7 +206,7 @@ static ssize_t display_rotate_store(struct device *dev,
 static ssize_t display_mirror_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_device *dssdev = to_dss_device_sysfs(dev);
 	int mirror;
 	if (!dssdev->driver->get_mirror)
 		return -ENOENT;
@@ -194,7 +217,7 @@ static ssize_t display_mirror_show(struct device *dev,
 static ssize_t display_mirror_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t size)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_device *dssdev = to_dss_device_sysfs(dev);
 	int r;
 	bool mirror;
 
@@ -215,7 +238,7 @@ static ssize_t display_mirror_store(struct device *dev,
 static ssize_t display_wss_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_device *dssdev = to_dss_device_sysfs(dev);
 	unsigned int wss;
 
 	if (!dssdev->driver->get_wss)
@@ -229,7 +252,7 @@ static ssize_t display_wss_show(struct device *dev,
 static ssize_t display_wss_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t size)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_device *dssdev = to_dss_device_sysfs(dev);
 	u32 wss;
 	int r;
 
@@ -250,6 +273,7 @@ static ssize_t display_wss_store(struct device *dev,
 	return size;
 }
 
+static DEVICE_ATTR(name, S_IRUGO, display_name_show, NULL);
 static DEVICE_ATTR(enabled, S_IRUGO|S_IWUSR,
 		display_enabled_show, display_enabled_store);
 static DEVICE_ATTR(tear_elim, S_IRUGO|S_IWUSR,
@@ -263,59 +287,54 @@ static DEVICE_ATTR(mirror, S_IRUGO|S_IWUSR,
 static DEVICE_ATTR(wss, S_IRUGO|S_IWUSR,
 		display_wss_show, display_wss_store);
 
-static struct device_attribute *display_sysfs_attrs[] = {
-	&dev_attr_enabled,
-	&dev_attr_tear_elim,
-	&dev_attr_timings,
-	&dev_attr_rotate,
-	&dev_attr_mirror,
-	&dev_attr_wss,
+static const struct attribute *display_sysfs_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_enabled.attr,
+	&dev_attr_tear_elim.attr,
+	&dev_attr_timings.attr,
+	&dev_attr_rotate.attr,
+	&dev_attr_mirror.attr,
+	&dev_attr_wss.attr,
 	NULL
 };
 
-int display_init_sysfs(struct platform_device *pdev,
-		struct omap_dss_device *dssdev)
+int display_init_sysfs(struct platform_device *pdev)
 {
-	struct device_attribute *attr;
-	int i, r;
+	struct omap_dss_device *dssdev = NULL;
+	int r;
 
-	/* create device sysfs files */
-	i = 0;
-	while ((attr = display_sysfs_attrs[i++]) != NULL) {
-		r = device_create_file(&dssdev->dev, attr);
-		if (r) {
-			for (i = i - 2; i >= 0; i--) {
-				attr = display_sysfs_attrs[i];
-				device_remove_file(&dssdev->dev, attr);
-			}
+	for_each_dss_dev(dssdev) {
+		struct kobject *kobj = &dssdev->dev.kobj;
 
-			DSSERR("failed to create sysfs file\n");
-			return r;
+		r = sysfs_create_files(kobj, display_sysfs_attrs);
+		if (r) {
+			DSSERR("failed to create sysfs files\n");
+			goto err;
 		}
-	}
 
-	/* create display? sysfs links */
-	r = sysfs_create_link(&pdev->dev.kobj, &dssdev->dev.kobj,
-			dev_name(&dssdev->dev));
-	if (r) {
-		while ((attr = display_sysfs_attrs[i++]) != NULL)
-			device_remove_file(&dssdev->dev, attr);
+		r = sysfs_create_link(&pdev->dev.kobj, kobj, dssdev->alias);
+		if (r) {
+			sysfs_remove_files(kobj, display_sysfs_attrs);
 
-		DSSERR("failed to create sysfs display link\n");
-		return r;
+			DSSERR("failed to create sysfs display link\n");
+			goto err;
+		}
 	}
 
 	return 0;
+
+err:
+	display_uninit_sysfs(pdev);
+
+	return r;
 }
 
-void display_uninit_sysfs(struct platform_device *pdev,
-		struct omap_dss_device *dssdev)
+void display_uninit_sysfs(struct platform_device *pdev)
 {
-	struct device_attribute *attr;
-	int i = 0;
+	struct omap_dss_device *dssdev = NULL;
 
-	sysfs_remove_link(&pdev->dev.kobj, dev_name(&dssdev->dev));
-
-	while ((attr = display_sysfs_attrs[i++]) != NULL)
-		device_remove_file(&dssdev->dev, attr);
+	for_each_dss_dev(dssdev) {
+		sysfs_remove_link(&pdev->dev.kobj, dssdev->alias);
+		sysfs_remove_files(&dssdev->dev.kobj, display_sysfs_attrs);
+	}
 }
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 5252423..d603a40 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -188,10 +188,8 @@ int dss_suspend_all_devices(void);
 int dss_resume_all_devices(void);
 void dss_disable_all_devices(void);
 
-int display_init_sysfs(struct platform_device *pdev,
-		struct omap_dss_device *dssdev);
-void display_uninit_sysfs(struct platform_device *pdev,
-		struct omap_dss_device *dssdev);
+int display_init_sysfs(struct platform_device *pdev);
+void display_uninit_sysfs(struct platform_device *pdev);
 
 /* manager */
 int dss_init_overlay_managers(struct platform_device *pdev);
-- 
1.7.10.4


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

* [PATCH 11/26] OMAPDSS: Add panel_dev pointer to dssdev
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (9 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 10/26] OMAPDSS: implement display sysfs without dss bus Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 12/26] OMAPDSS: DPI: new panel registration Tomi Valkeinen
                   ` (15 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

We are about to remove the dss bus support, which also means that the
omap_dss_device won't be a real device anymore. This means that the
embedded "dev" struct needs to be removed from omap_dss_device.

After we've finished the removal of the dss bus, we see the following
changes:

- struct omap_dss_device won't be a real Linux device anymore, but more
  like a "display entity".
- struct omap_dss_driver won't be a Linux device driver, but "display
  entity ops".
- The panel devices/drivers won't be omapdss devices/drivers, but
  platform/i2c/spi/etc devices/drivers, whichever fits the control
  mechanism of the panel.
- The panel drivers will create omap_dss_device and omap_dss_driver,
  fill the required fields, and register the omap_dss_device to
  omapdss.
- omap_dss_device won't have an embedded dev struct anymore, but a
  dev pointer to the actual device that manages the omap_dss_device.

The model described above resembles the model that has been discussed
with CDF (common display framework).

For the duration of the conversion, we temporarily have two devs in the
dssdev, the old "dev", which is a full embedded device struct, and the
new "panel_dev", which is a pointer to the device. "dev" will be removed
in the future, and "panel_dev" will be renamed "dev".

For devices belonging to dss bus the panel_dev is initialized to point
to dev. This way all the code can just use the panel_dev, for both old
and new style panels.

Both the new and old style panel drivers work during the conversion, and
only after the dss bus support is removed will the old style panels stop
to compile.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/core.c          |    2 ++
 drivers/video/omap2/dss/display-sysfs.c |    7 ++++---
 drivers/video/omap2/dss/display.c       |    8 ++++----
 include/video/omapdss.h                 |    4 ++++
 4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 054e980..5a6ac3b 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -400,6 +400,8 @@ struct omap_dss_device *dss_alloc_and_init_device(struct device *parent)
 
 int dss_add_device(struct omap_dss_device *dssdev)
 {
+	dssdev->panel_dev = &dssdev->dev;
+
 	dss_add_panel(dssdev);
 	return device_add(&dssdev->dev);
 }
diff --git a/drivers/video/omap2/dss/display-sysfs.c b/drivers/video/omap2/dss/display-sysfs.c
index 537921b..af90bff 100644
--- a/drivers/video/omap2/dss/display-sysfs.c
+++ b/drivers/video/omap2/dss/display-sysfs.c
@@ -33,7 +33,7 @@ static struct omap_dss_device *to_dss_device_sysfs(struct device *dev)
 	struct omap_dss_device *dssdev = NULL;
 
 	for_each_dss_dev(dssdev) {
-		if (&dssdev->dev = dev) {
+		if (dssdev->panel_dev = dev) {
 			omap_dss_put_device(dssdev);
 			return dssdev;
 		}
@@ -304,7 +304,7 @@ int display_init_sysfs(struct platform_device *pdev)
 	int r;
 
 	for_each_dss_dev(dssdev) {
-		struct kobject *kobj = &dssdev->dev.kobj;
+		struct kobject *kobj = &dssdev->panel_dev->kobj;
 
 		r = sysfs_create_files(kobj, display_sysfs_attrs);
 		if (r) {
@@ -335,6 +335,7 @@ void display_uninit_sysfs(struct platform_device *pdev)
 
 	for_each_dss_dev(dssdev) {
 		sysfs_remove_link(&pdev->dev.kobj, dssdev->alias);
-		sysfs_remove_files(&dssdev->dev.kobj, display_sysfs_attrs);
+		sysfs_remove_files(&dssdev->panel_dev->kobj,
+				display_sysfs_attrs);
 	}
 }
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c
index 85e1cd3..fbadefe 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -158,13 +158,13 @@ void dss_remove_panel(struct omap_dss_device *dssdev)
 
 void omap_dss_get_device(struct omap_dss_device *dssdev)
 {
-	get_device(&dssdev->dev);
+	get_device(dssdev->panel_dev);
 }
 EXPORT_SYMBOL(omap_dss_get_device);
 
 void omap_dss_put_device(struct omap_dss_device *dssdev)
 {
-	put_device(&dssdev->dev);
+	put_device(dssdev->panel_dev);
 }
 EXPORT_SYMBOL(omap_dss_put_device);
 
@@ -243,7 +243,7 @@ int omap_dss_start_device(struct omap_dss_device *dssdev)
 		return -ENODEV;
 	}
 
-	if (!try_module_get(dssdev->dev.driver->owner)) {
+	if (!try_module_get(dssdev->panel_dev->driver->owner)) {
 		return -ENODEV;
 	}
 
@@ -253,7 +253,7 @@ EXPORT_SYMBOL(omap_dss_start_device);
 
 void omap_dss_stop_device(struct omap_dss_device *dssdev)
 {
-	module_put(dssdev->dev.driver->owner);
+	module_put(dssdev->panel_dev->driver->owner);
 }
 EXPORT_SYMBOL(omap_dss_stop_device);
 
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index ab4ea37..ab36ee3 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -594,8 +594,12 @@ struct omap_dss_output {
 };
 
 struct omap_dss_device {
+	/* old device, to be removed */
 	struct device dev;
 
+	/* new device, pointer to panel device */
+	struct device *panel_dev;
+
 	struct list_head panel_list;
 
 	/* alias in the form of "display%d" */
-- 
1.7.10.4


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

* [PATCH 12/26] OMAPDSS: DPI: new panel registration
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (10 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 11/26] OMAPDSS: Add panel_dev pointer to dssdev Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 13/26] OMAPDSS: DSI: " Tomi Valkeinen
                   ` (14 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

This patch adds new way to register DPI panels. This new method will be
used by the panel drivers that are converted away from the current dss
bus based model.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dpi.c |   35 ++++++++++++++++++++++++++++++++++-
 include/video/omapdss.h       |    2 ++
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 08342d1..e7beea2 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -575,7 +575,7 @@ static enum omap_channel dpi_get_channel(void)
 	}
 }
 
-static int __init dpi_init_display(struct omap_dss_device *dssdev)
+static int dpi_init_display(struct omap_dss_device *dssdev)
 {
 	struct platform_device *dsidev;
 
@@ -615,6 +615,39 @@ static int __init dpi_init_display(struct omap_dss_device *dssdev)
 	return 0;
 }
 
+int omap_dpi_register_panel(struct omap_dss_device *dssdev)
+{
+	int r;
+
+	dssdev->type = OMAP_DISPLAY_TYPE_DPI;
+
+	r = dpi_init_display(dssdev);
+	if (r) {
+		DSSERR("device %s init failed: %d\n", dssdev->name, r);
+		return r;
+	}
+
+	r = omapdss_output_set_device(&dpi.output, dssdev);
+	if (r) {
+		DSSERR("failed to connect output to new device: %s\n",
+				dssdev->name);
+		return r;
+	}
+
+	dss_add_panel(dssdev);
+
+	return 0;
+}
+EXPORT_SYMBOL(omap_dpi_register_panel);
+
+void omap_dpi_free_panel(struct omap_dss_device *dssdev)
+{
+	dss_remove_panel(dssdev);
+
+	omapdss_output_unset_device(&dpi.output);
+}
+EXPORT_SYMBOL(omap_dpi_free_panel);
+
 static struct omap_dss_device * __init dpi_find_dssdev(struct platform_device *pdev)
 {
 	struct omap_dss_board_info *pdata = pdev->dev.platform_data;
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index ab36ee3..78c4e51 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -863,6 +863,8 @@ int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
 void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
 		bool disconnect_lanes, bool enter_ulps);
 
+int omap_dpi_register_panel(struct omap_dss_device *dssdev);
+void omap_dpi_free_panel(struct omap_dss_device *dssdev);
 int omapdss_dpi_display_enable(struct omap_dss_device *dssdev);
 void omapdss_dpi_display_disable(struct omap_dss_device *dssdev);
 void omapdss_dpi_set_timings(struct omap_dss_device *dssdev,
-- 
1.7.10.4


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

* [PATCH 13/26] OMAPDSS: DSI: new panel registration
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (11 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 12/26] OMAPDSS: DPI: new panel registration Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 14/26] OMAPDSS: HDMI: " Tomi Valkeinen
                   ` (13 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

This patch adds new way to register DSI panels. This new method will be
used by the panel drivers that are converted away from the current dss
bus based model.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dsi.c |   55 ++++++++++++++++++++++++++++++++++++++++-
 include/video/omapdss.h       |    3 +++
 2 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index ddb8bf6..fb77aa8 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -5225,7 +5225,7 @@ static enum omap_channel dsi_get_channel(int module_id)
 	}
 }
 
-static int __init dsi_init_display(struct omap_dss_device *dssdev)
+static int dsi_init_display(struct omap_dss_device *dssdev)
 {
 	struct platform_device *dsidev  			dsi_get_dsidev_from_id(dssdev->phy.dsi.module);
@@ -5253,6 +5253,59 @@ static int __init dsi_init_display(struct omap_dss_device *dssdev)
 	return 0;
 }
 
+int omap_dsi_register_panel(struct omap_dss_device *dssdev,
+		struct omap_dss_output *out)
+{
+	int r;
+	struct platform_device *dsidev;
+	struct dsi_data *dsi;
+
+	dssdev->type = OMAP_DISPLAY_TYPE_DSI;
+
+	switch (out->id) {
+	case OMAP_DSS_OUTPUT_DSI1:
+		dssdev->phy.dsi.module = 0;
+		break;
+	case OMAP_DSS_OUTPUT_DSI2:
+		dssdev->phy.dsi.module = 1;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	dsidev = dsi_get_dsidev_from_id(dssdev->phy.dsi.module);
+	dsi = dsi_get_dsidrv_data(dsidev);
+
+	r = dsi_init_display(dssdev);
+	if (r) {
+		DSSERR("device %s init failed: %d\n", dssdev->name, r);
+		return r;
+	}
+
+	r = omapdss_output_set_device(&dsi->output, dssdev);
+	if (r) {
+		DSSERR("failed to connect output to new device: %s\n",
+				dssdev->name);
+		return r;
+	}
+
+	dss_add_panel(dssdev);
+
+	return 0;
+}
+EXPORT_SYMBOL(omap_dsi_register_panel);
+
+void omap_dsi_free_panel(struct omap_dss_device *dssdev)
+{
+	struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
+	struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
+
+	dss_remove_panel(dssdev);
+
+	omapdss_output_unset_device(&dsi->output);
+}
+EXPORT_SYMBOL(omap_dsi_free_panel);
+
 int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel)
 {
 	struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 78c4e51..2bf90fd 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -862,6 +862,9 @@ int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
 int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
 void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
 		bool disconnect_lanes, bool enter_ulps);
+int omap_dsi_register_panel(struct omap_dss_device *dssdev,
+		struct omap_dss_output *out);
+void omap_dsi_free_panel(struct omap_dss_device *dssdev);
 
 int omap_dpi_register_panel(struct omap_dss_device *dssdev);
 void omap_dpi_free_panel(struct omap_dss_device *dssdev);
-- 
1.7.10.4


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

* [PATCH 14/26] OMAPDSS: HDMI: new panel registration
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (12 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 13/26] OMAPDSS: DSI: " Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 15/26] OMAPDSS: TFP410 platform_data changes Tomi Valkeinen
                   ` (12 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

This patch adds new way to register HDMI panels. This new method will be
used by the panel drivers that are converted away from the current dss
bus based model.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dss.h  |    2 ++
 drivers/video/omap2/dss/hdmi.c |   41 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index d603a40..eb1e325 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -450,6 +450,8 @@ static inline unsigned long hdmi_get_pixel_clock(void)
 	return 0;
 }
 #endif
+int omap_hdmi_register_panel(struct omap_dss_device *dssdev);
+void omap_hdmi_free_panel(struct omap_dss_device *dssdev);
 int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev);
 void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev);
 int omapdss_hdmi_core_enable(struct omap_dss_device *dssdev);
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 4b32dd3..f9e38c4 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -328,7 +328,7 @@ static void hdmi_runtime_put(void)
 	WARN_ON(r < 0 && r != -ENOSYS);
 }
 
-static int __init hdmi_init_display(struct omap_dss_device *dssdev)
+static int hdmi_init_display(struct omap_dss_device *dssdev)
 {
 	int r;
 
@@ -960,6 +960,45 @@ int hdmi_audio_config(struct omap_dss_audio *audio)
 
 #endif
 
+int omap_hdmi_register_panel(struct omap_dss_device *dssdev)
+{
+	struct omap_dss_hdmi_data *priv = dssdev->data;
+	int r;
+
+	dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
+
+	hdmi.ct_cp_hpd_gpio = priv->ct_cp_hpd_gpio;
+	hdmi.ls_oe_gpio = priv->ls_oe_gpio;
+	hdmi.hpd_gpio = priv->hpd_gpio;
+
+	r = hdmi_init_display(dssdev);
+	if (r) {
+		DSSERR("device %s init failed: %d\n", dssdev->name, r);
+		return r;
+	}
+
+	r = omapdss_output_set_device(&hdmi.output, dssdev);
+	if (r) {
+		DSSERR("failed to connect output to new device: %s\n",
+				dssdev->name);
+		hdmi_uninit_display(dssdev);
+		return r;
+	}
+
+	dss_add_panel(dssdev);
+
+	return 0;
+}
+EXPORT_SYMBOL(omap_hdmi_register_panel);
+
+void omap_hdmi_free_panel(struct omap_dss_device *dssdev)
+{
+	hdmi_uninit_display(dssdev);
+	omapdss_output_unset_device(&hdmi.output);
+	dss_remove_panel(dssdev);
+}
+EXPORT_SYMBOL(omap_hdmi_free_panel);
+
 static struct omap_dss_device * __init hdmi_find_dssdev(struct platform_device *pdev)
 {
 	struct omap_dss_board_info *pdata = pdev->dev.platform_data;
-- 
1.7.10.4


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

* [PATCH 15/26] OMAPDSS: TFP410 platform_data changes
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (13 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 14/26] OMAPDSS: HDMI: " Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 16/26] OMAPDSS: TFP410: convert to platform device Tomi Valkeinen
                   ` (11 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

The forthcoming omap_dss_device to platform_device conversion requires a
few new fields to the TFP410 platform data. Add the platform data fields
here so that we can make the board file changes independently of the
panel driver changes.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 include/video/omap-panel-tfp410.h |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/video/omap-panel-tfp410.h b/include/video/omap-panel-tfp410.h
index aef35e4..cb37c87 100644
--- a/include/video/omap-panel-tfp410.h
+++ b/include/video/omap-panel-tfp410.h
@@ -24,12 +24,17 @@ struct omap_dss_device;
 
 /**
  * struct tfp410_platform_data - panel driver configuration data
+ * @name: name for this output
+ * @source: name for the video source
  * @i2c_bus_num: i2c bus id for the panel
  * @power_down_gpio: gpio number for PD pin (or -1 if not available)
  */
 struct tfp410_platform_data {
+	const char *name;
+	const char *source;
 	int i2c_bus_num;
 	int power_down_gpio;
+	int data_lines;
 };
 
 #endif /* __OMAP_PANEL_TFP410_H */
-- 
1.7.10.4


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

* [PATCH 16/26] OMAPDSS: TFP410: convert to platform device
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (14 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 15/26] OMAPDSS: TFP410 platform_data changes Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-27 11:23   ` Archit Taneja
  2013-03-26 13:33 ` [PATCH 17/26] OMAPDSS: generic-dpi-panel platform_data changes Tomi Valkeinen
                   ` (10 subsequent siblings)
  26 siblings, 1 reply; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

Convert TFP410 driver from omap_dss_driver to a platform driver. The
driver uses the new panel support from omapdss.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/displays/panel-tfp410.c |  205 +++++++++++++++++----------
 1 file changed, 128 insertions(+), 77 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-tfp410.c b/drivers/video/omap2/displays/panel-tfp410.c
index 8281baa..a225ea1 100644
--- a/drivers/video/omap2/displays/panel-tfp410.c
+++ b/drivers/video/omap2/displays/panel-tfp410.c
@@ -22,10 +22,13 @@
 #include <video/omapdss.h>
 #include <linux/i2c.h>
 #include <linux/gpio.h>
+#include <linux/platform_device.h>
 #include <drm/drm_edid.h>
 
 #include <video/omap-panel-tfp410.h>
 
+static struct omap_dss_driver tfp410_driver;
+
 static const struct omap_video_timings tfp410_default_timings = {
 	.x_res		= 640,
 	.y_res		= 480,
@@ -48,121 +51,152 @@ static const struct omap_video_timings tfp410_default_timings = {
 };
 
 struct panel_drv_data {
-	struct omap_dss_device *dssdev;
+	struct omap_dss_device dssdev;
 
 	struct mutex lock;
 
+	const char *name;
+
 	int pd_gpio;
+	int data_lines;
+
+	struct omap_video_timings timings;
 
 	struct i2c_adapter *i2c_adapter;
 };
 
-static int tfp410_power_on(struct omap_dss_device *dssdev)
+#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
+
+static int tfp410_probe_pdata(struct platform_device *pdev)
 {
-	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
-	int r;
+	struct tfp410_platform_data *pdata = dev_get_platdata(&pdev->dev);
+	struct panel_drv_data *ddata = dev_get_drvdata(&pdev->dev);
+	int r, gpio, i2c_bus_num;
 
-	if (dssdev->state = OMAP_DSS_DISPLAY_ACTIVE)
-		return 0;
+	ddata->name = pdata->name;
 
-	omapdss_dpi_set_timings(dssdev, &dssdev->panel.timings);
-	omapdss_dpi_set_data_lines(dssdev, dssdev->phy.dpi.data_lines);
+	gpio = pdata->power_down_gpio;
 
-	r = omapdss_dpi_display_enable(dssdev);
-	if (r)
-		goto err0;
+	if (gpio_is_valid(gpio)) {
+		r = devm_gpio_request_one(&pdev->dev, gpio,
+				GPIOF_OUT_INIT_LOW, "tfp410 pd");
+		if (r) {
+			dev_err(&pdev->dev, "Failed to request PD GPIO %d\n",
+					gpio);
+			return r;
+		}
 
-	if (gpio_is_valid(ddata->pd_gpio))
-		gpio_set_value_cansleep(ddata->pd_gpio, 1);
+		ddata->pd_gpio = gpio;
+	} else {
+		ddata->pd_gpio = -1;
+	}
 
-	return 0;
-err0:
-	return r;
-}
+	ddata->data_lines = pdata->data_lines;
 
-static void tfp410_power_off(struct omap_dss_device *dssdev)
-{
-	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
+	i2c_bus_num = pdata->i2c_bus_num;
 
-	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
-		return;
+	if (i2c_bus_num != -1) {
+		struct i2c_adapter *adapter;
 
-	if (gpio_is_valid(ddata->pd_gpio))
-		gpio_set_value_cansleep(ddata->pd_gpio, 0);
+		adapter = i2c_get_adapter(i2c_bus_num);
+		if (!adapter) {
+			dev_err(&pdev->dev,
+					"Failed to get I2C adapter, bus %d\n",
+					i2c_bus_num);
+			return -EINVAL;
+		}
 
-	omapdss_dpi_display_disable(dssdev);
+		ddata->i2c_adapter = adapter;
+	}
+
+	return 0;
 }
 
-static int tfp410_probe(struct omap_dss_device *dssdev)
+static int tfp410_probe(struct platform_device *pdev)
 {
+	struct tfp410_platform_data *pdata = dev_get_platdata(&pdev->dev);
+	struct omap_dss_device *dssdev;
 	struct panel_drv_data *ddata;
 	int r;
-	int i2c_bus_num;
 
-	ddata = devm_kzalloc(&dssdev->dev, sizeof(*ddata), GFP_KERNEL);
+	ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
 	if (!ddata)
 		return -ENOMEM;
 
-	dssdev->panel.timings = tfp410_default_timings;
+	dev_set_drvdata(&pdev->dev, ddata);
 
-	ddata->dssdev = dssdev;
 	mutex_init(&ddata->lock);
 
-	if (dssdev->data) {
-		struct tfp410_platform_data *pdata = dssdev->data;
-
-		ddata->pd_gpio = pdata->power_down_gpio;
-		i2c_bus_num = pdata->i2c_bus_num;
-	} else {
-		ddata->pd_gpio = -1;
-		i2c_bus_num = -1;
-	}
-
-	if (gpio_is_valid(ddata->pd_gpio)) {
-		r = devm_gpio_request_one(&dssdev->dev, ddata->pd_gpio,
-				GPIOF_OUT_INIT_LOW, "tfp410 pd");
-		if (r) {
-			dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n",
-					ddata->pd_gpio);
+	if (pdata) {
+		r = tfp410_probe_pdata(pdev);
+		if (r)
 			return r;
-		}
+	} else {
+		return -ENODEV;
 	}
 
-	if (i2c_bus_num != -1) {
-		struct i2c_adapter *adapter;
+	ddata->timings = tfp410_default_timings;
 
-		adapter = i2c_get_adapter(i2c_bus_num);
-		if (!adapter) {
-			dev_err(&dssdev->dev, "Failed to get I2C adapter, bus %d\n",
-					i2c_bus_num);
-			return -EINVAL;
-		}
-
-		ddata->i2c_adapter = adapter;
+	dssdev = &ddata->dssdev;
+	dssdev->driver = &tfp410_driver;
+	dssdev->panel.timings = tfp410_default_timings;
+	dssdev->name = ddata->name;
+	dssdev->phy.dpi.data_lines = ddata->data_lines;
+	dssdev->panel_dev = &pdev->dev;
+
+	r = omap_dpi_register_panel(dssdev);
+	if (r) {
+		dev_err(&pdev->dev, "Failed to register panel\n");
+		return r;
 	}
 
-	dev_set_drvdata(&dssdev->dev, ddata);
-
 	return 0;
 }
 
-static void __exit tfp410_remove(struct omap_dss_device *dssdev)
+static int __exit tfp410_remove(struct platform_device *pdev)
 {
-	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *ddata = dev_get_drvdata(&pdev->dev);
 
 	mutex_lock(&ddata->lock);
 
+	omap_dpi_free_panel(&ddata->dssdev);
+
 	if (ddata->i2c_adapter)
 		i2c_put_adapter(ddata->i2c_adapter);
 
-	dev_set_drvdata(&dssdev->dev, NULL);
+	dev_set_drvdata(&pdev->dev, NULL);
 
 	mutex_unlock(&ddata->lock);
+
+	return 0;
+}
+
+static int tfp410_power_on(struct omap_dss_device *dssdev)
+{
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	int r;
+
+	if (dssdev->state = OMAP_DSS_DISPLAY_ACTIVE)
+		return 0;
+
+	omapdss_dpi_set_timings(dssdev, &ddata->timings);
+	omapdss_dpi_set_data_lines(dssdev, ddata->data_lines);
+
+	r = omapdss_dpi_display_enable(dssdev);
+	if (r)
+		goto err0;
+
+	if (gpio_is_valid(ddata->pd_gpio))
+		gpio_set_value_cansleep(ddata->pd_gpio, 1);
+
+	return 0;
+err0:
+	return r;
 }
 
 static int tfp410_enable(struct omap_dss_device *dssdev)
 {
-	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
 	int r;
 
 	mutex_lock(&ddata->lock);
@@ -176,9 +210,22 @@ static int tfp410_enable(struct omap_dss_device *dssdev)
 	return r;
 }
 
+static void tfp410_power_off(struct omap_dss_device *dssdev)
+{
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
+
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return;
+
+	if (gpio_is_valid(ddata->pd_gpio))
+		gpio_set_value_cansleep(ddata->pd_gpio, 0);
+
+	omapdss_dpi_display_disable(dssdev);
+}
+
 static void tfp410_disable(struct omap_dss_device *dssdev)
 {
-	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
 
 	mutex_lock(&ddata->lock);
 
@@ -192,18 +239,19 @@ static void tfp410_disable(struct omap_dss_device *dssdev)
 static void tfp410_set_timings(struct omap_dss_device *dssdev,
 		struct omap_video_timings *timings)
 {
-	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
 
 	mutex_lock(&ddata->lock);
 	omapdss_dpi_set_timings(dssdev, timings);
 	dssdev->panel.timings = *timings;
+	ddata->timings = *timings;
 	mutex_unlock(&ddata->lock);
 }
 
 static void tfp410_get_timings(struct omap_dss_device *dssdev,
 		struct omap_video_timings *timings)
 {
-	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
 
 	mutex_lock(&ddata->lock);
 	*timings = dssdev->panel.timings;
@@ -213,7 +261,7 @@ static void tfp410_get_timings(struct omap_dss_device *dssdev,
 static int tfp410_check_timings(struct omap_dss_device *dssdev,
 		struct omap_video_timings *timings)
 {
-	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
 	int r;
 
 	mutex_lock(&ddata->lock);
@@ -258,7 +306,7 @@ static int tfp410_ddc_read(struct i2c_adapter *adapter,
 static int tfp410_read_edid(struct omap_dss_device *dssdev,
 		u8 *edid, int len)
 {
-	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
 	int r, l, bytes_read;
 
 	mutex_lock(&ddata->lock);
@@ -298,7 +346,7 @@ err:
 
 static bool tfp410_detect(struct omap_dss_device *dssdev)
 {
-	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
 	unsigned char out;
 	int r;
 
@@ -319,9 +367,6 @@ out:
 }
 
 static struct omap_dss_driver tfp410_driver = {
-	.probe		= tfp410_probe,
-	.remove		= __exit_p(tfp410_remove),
-
 	.enable		= tfp410_enable,
 	.disable	= tfp410_disable,
 
@@ -329,23 +374,29 @@ static struct omap_dss_driver tfp410_driver = {
 	.get_timings	= tfp410_get_timings,
 	.check_timings	= tfp410_check_timings,
 
+	.get_resolution	= omapdss_default_get_resolution,
+
 	.read_edid	= tfp410_read_edid,
 	.detect		= tfp410_detect,
+};
 
-	.driver         = {
-		.name   = "tfp410",
-		.owner  = THIS_MODULE,
+static struct platform_driver tfp410_platform_driver = {
+	.probe	= tfp410_probe,
+	.remove	= __exit_p(tfp410_remove),
+	.driver	= {
+		.name	= "tfp410",
+		.owner	= THIS_MODULE,
 	},
 };
 
 static int __init tfp410_init(void)
 {
-	return omap_dss_register_driver(&tfp410_driver);
+	return platform_driver_register(&tfp410_platform_driver);
 }
 
 static void __exit tfp410_exit(void)
 {
-	omap_dss_unregister_driver(&tfp410_driver);
+	platform_driver_unregister(&tfp410_platform_driver);
 }
 
 module_init(tfp410_init);
-- 
1.7.10.4


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

* [PATCH 17/26] OMAPDSS: generic-dpi-panel platform_data changes
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (15 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 16/26] OMAPDSS: TFP410: convert to platform device Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 18/26] OMAPDSS: panel-generic-dpi: convert to platform device Tomi Valkeinen
                   ` (9 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

The forthcoming omap_dss_device to platform_device conversion requires a
few new fields to the generic-dpi-panel platform data. Add the platform
data fields here so that we can make the board file changes
independently of the panel driver changes.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 include/video/omap-panel-generic-dpi.h |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/video/omap-panel-generic-dpi.h b/include/video/omap-panel-generic-dpi.h
index 127e3f2..4ef4419 100644
--- a/include/video/omap-panel-generic-dpi.h
+++ b/include/video/omap-panel-generic-dpi.h
@@ -29,9 +29,12 @@ struct omap_dss_device;
  * @platform_disable: platform specific panel disable function
  */
 struct panel_generic_dpi_data {
+	const char *display_name;
+	const char *source;
 	const char *name;
 	int (*platform_enable)(struct omap_dss_device *dssdev);
 	void (*platform_disable)(struct omap_dss_device *dssdev);
+	int data_lines;
 };
 
 #endif /* __OMAP_PANEL_GENERIC_DPI_H */
-- 
1.7.10.4


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

* [PATCH 18/26] OMAPDSS: panel-generic-dpi: convert to platform device
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (16 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 17/26] OMAPDSS: generic-dpi-panel platform_data changes Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 19/26] OMAPDSS: HDMI: " Tomi Valkeinen
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

Convert panel-generic-dpi driver from omap_dss_driver to a platform
driver. The driver uses the new panel support from omapdss.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/displays/panel-generic-dpi.c |  141 ++++++++++++++--------
 1 file changed, 91 insertions(+), 50 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c
index c904f42..cc49c48 100644
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ b/drivers/video/omap2/displays/panel-generic-dpi.c
@@ -33,10 +33,14 @@
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
+#include <linux/platform_device.h>
 #include <video/omapdss.h>
 
 #include <video/omap-panel-generic-dpi.h>
 
+static struct omap_dss_driver generic_dpi_panel_driver;
+#define to_drv_data(x) container_of(x, struct panel_drv_data, dssdev)
+
 struct panel_config {
 	struct omap_video_timings timings;
 
@@ -517,12 +521,16 @@ static struct panel_config generic_dpi_panels[] = {
 };
 
 struct panel_drv_data {
+	struct omap_dss_device dssdev;
 
-	struct omap_dss_device *dssdev;
-
-	struct panel_config *panel_config;
+	const struct panel_config *panel_config;
 
 	struct mutex lock;
+
+	const struct panel_generic_dpi_data *pdata;
+
+	const char *name;
+	int data_lines;
 };
 
 static inline struct panel_generic_dpi_data
@@ -534,9 +542,9 @@ static inline struct panel_generic_dpi_data
 static int generic_dpi_panel_power_on(struct omap_dss_device *dssdev)
 {
 	int r;
-	struct panel_generic_dpi_data *panel_data = get_panel_data(dssdev);
-	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
-	struct panel_config *panel_config = drv_data->panel_config;
+	struct panel_drv_data *drv_data = to_drv_data(dssdev);
+	const struct panel_config *panel_config = drv_data->panel_config;
+	const struct panel_generic_dpi_data *pdata = drv_data->pdata;
 
 	if (dssdev->state = OMAP_DSS_DISPLAY_ACTIVE)
 		return 0;
@@ -552,8 +560,8 @@ static int generic_dpi_panel_power_on(struct omap_dss_device *dssdev)
 	if (panel_config->power_on_delay)
 		msleep(panel_config->power_on_delay);
 
-	if (panel_data->platform_enable) {
-		r = panel_data->platform_enable(dssdev);
+	if (pdata && pdata->platform_enable) {
+		r = pdata->platform_enable(dssdev);
 		if (r)
 			goto err1;
 	}
@@ -567,15 +575,15 @@ err0:
 
 static void generic_dpi_panel_power_off(struct omap_dss_device *dssdev)
 {
-	struct panel_generic_dpi_data *panel_data = get_panel_data(dssdev);
-	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
-	struct panel_config *panel_config = drv_data->panel_config;
+	struct panel_drv_data *drv_data = to_drv_data(dssdev);
+	const struct panel_config *panel_config = drv_data->panel_config;
+	const struct panel_generic_dpi_data *pdata = drv_data->pdata;
 
 	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
 		return;
 
-	if (panel_data->platform_disable)
-		panel_data->platform_disable(dssdev);
+	if (pdata && pdata->platform_disable)
+		pdata->platform_disable(dssdev);
 
 	/* wait couple of vsyncs after disabling the LCD */
 	if (panel_config->power_off_delay)
@@ -584,20 +592,16 @@ static void generic_dpi_panel_power_off(struct omap_dss_device *dssdev)
 	omapdss_dpi_display_disable(dssdev);
 }
 
-static int generic_dpi_panel_probe(struct omap_dss_device *dssdev)
+static int generic_dpi_panel_probe_pdata(struct platform_device *pdev)
 {
-	struct panel_generic_dpi_data *panel_data = get_panel_data(dssdev);
+	const struct panel_generic_dpi_data *pdata +		dev_get_platdata(&pdev->dev);
+	struct panel_drv_data *drv_data = dev_get_drvdata(&pdev->dev);
 	struct panel_config *panel_config = NULL;
-	struct panel_drv_data *drv_data = NULL;
 	int i;
 
-	dev_dbg(&dssdev->dev, "probe\n");
-
-	if (!panel_data || !panel_data->name)
-		return -EINVAL;
-
 	for (i = 0; i < ARRAY_SIZE(generic_dpi_panels); i++) {
-		if (strcmp(panel_data->name, generic_dpi_panels[i].name) = 0) {
+		if (strcmp(pdata->name, generic_dpi_panels[i].name) = 0) {
 			panel_config = &generic_dpi_panels[i];
 			break;
 		}
@@ -606,36 +610,70 @@ static int generic_dpi_panel_probe(struct omap_dss_device *dssdev)
 	if (!panel_config)
 		return -EINVAL;
 
-	dssdev->panel.timings = panel_config->timings;
+	drv_data->panel_config = panel_config;
+	drv_data->pdata = pdata;
+	drv_data->name = pdata->display_name;
+	drv_data->data_lines = pdata->data_lines;
 
-	drv_data = kzalloc(sizeof(*drv_data), GFP_KERNEL);
+	return 0;
+}
+
+static int generic_dpi_panel_probe(struct platform_device *pdev)
+{
+	struct panel_drv_data *drv_data;
+	struct omap_dss_device *dssdev;
+	int r;
+
+	dev_dbg(&pdev->dev, "probe\n");
+
+	drv_data = devm_kzalloc(&pdev->dev, sizeof(*drv_data), GFP_KERNEL);
 	if (!drv_data)
 		return -ENOMEM;
 
-	drv_data->dssdev = dssdev;
-	drv_data->panel_config = panel_config;
+	dev_set_drvdata(&pdev->dev, drv_data);
+
+	if (dev_get_platdata(&pdev->dev)) {
+		r = generic_dpi_panel_probe_pdata(pdev);
+		if (r)
+			return r;
+	} else {
+		return -EINVAL;
+	}
 
 	mutex_init(&drv_data->lock);
 
-	dev_set_drvdata(&dssdev->dev, drv_data);
+	dssdev = &drv_data->dssdev;
+	dssdev->driver = &generic_dpi_panel_driver;
+	dssdev->name = drv_data->name;
+	dssdev->phy.dpi.data_lines = drv_data->data_lines;
+	dssdev->panel.timings = drv_data->panel_config->timings;
+	dssdev->panel_dev = &pdev->dev;
+
+	r = omap_dpi_register_panel(dssdev);
+	if (r) {
+		dev_err(&pdev->dev, "Failed to register panel\n");
+		return r;
+	}
 
 	return 0;
 }
 
-static void __exit generic_dpi_panel_remove(struct omap_dss_device *dssdev)
+static int __exit generic_dpi_panel_remove(struct platform_device *pdev)
 {
-	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *drv_data = dev_get_drvdata(&pdev->dev);
 
-	dev_dbg(&dssdev->dev, "remove\n");
+	dev_dbg(&pdev->dev, "remove\n");
 
-	kfree(drv_data);
+	omap_dpi_free_panel(&drv_data->dssdev);
 
-	dev_set_drvdata(&dssdev->dev, NULL);
+	dev_set_drvdata(&pdev->dev, NULL);
+
+	return 0;
 }
 
 static int generic_dpi_panel_enable(struct omap_dss_device *dssdev)
 {
-	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *drv_data = to_drv_data(dssdev);
 	int r;
 
 	mutex_lock(&drv_data->lock);
@@ -653,7 +691,7 @@ err:
 
 static void generic_dpi_panel_disable(struct omap_dss_device *dssdev)
 {
-	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *drv_data = to_drv_data(dssdev);
 
 	mutex_lock(&drv_data->lock);
 
@@ -667,7 +705,7 @@ static void generic_dpi_panel_disable(struct omap_dss_device *dssdev)
 static void generic_dpi_panel_set_timings(struct omap_dss_device *dssdev,
 		struct omap_video_timings *timings)
 {
-	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *drv_data = to_drv_data(dssdev);
 
 	mutex_lock(&drv_data->lock);
 
@@ -681,7 +719,7 @@ static void generic_dpi_panel_set_timings(struct omap_dss_device *dssdev,
 static void generic_dpi_panel_get_timings(struct omap_dss_device *dssdev,
 		struct omap_video_timings *timings)
 {
-	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *drv_data = to_drv_data(dssdev);
 
 	mutex_lock(&drv_data->lock);
 
@@ -693,7 +731,7 @@ static void generic_dpi_panel_get_timings(struct omap_dss_device *dssdev,
 static int generic_dpi_panel_check_timings(struct omap_dss_device *dssdev,
 		struct omap_video_timings *timings)
 {
-	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
+	struct panel_drv_data *drv_data = to_drv_data(dssdev);
 	int r;
 
 	mutex_lock(&drv_data->lock);
@@ -705,10 +743,7 @@ static int generic_dpi_panel_check_timings(struct omap_dss_device *dssdev,
 	return r;
 }
 
-static struct omap_dss_driver dpi_driver = {
-	.probe		= generic_dpi_panel_probe,
-	.remove		= __exit_p(generic_dpi_panel_remove),
-
+static struct omap_dss_driver generic_dpi_panel_driver = {
 	.enable		= generic_dpi_panel_enable,
 	.disable	= generic_dpi_panel_disable,
 
@@ -716,22 +751,28 @@ static struct omap_dss_driver dpi_driver = {
 	.get_timings	= generic_dpi_panel_get_timings,
 	.check_timings	= generic_dpi_panel_check_timings,
 
-	.driver         = {
-		.name   = "generic_dpi_panel",
-		.owner  = THIS_MODULE,
+	.get_resolution	= omapdss_default_get_resolution,
+};
+
+static struct platform_driver generic_dpi_panel_platform_driver = {
+	.probe	= generic_dpi_panel_probe,
+	.remove	= __exit_p(generic_dpi_panel_remove),
+	.driver	= {
+		.name	= "generic_dpi_panel",
+		.owner	= THIS_MODULE,
 	},
 };
 
-static int __init generic_dpi_panel_drv_init(void)
+static int __init generic_dpi_panel_init(void)
 {
-	return omap_dss_register_driver(&dpi_driver);
+	return platform_driver_register(&generic_dpi_panel_platform_driver);
 }
 
-static void __exit generic_dpi_panel_drv_exit(void)
+static void __exit generic_dpi_panel_exit(void)
 {
-	omap_dss_unregister_driver(&dpi_driver);
+	platform_driver_unregister(&generic_dpi_panel_platform_driver);
 }
 
-module_init(generic_dpi_panel_drv_init);
-module_exit(generic_dpi_panel_drv_exit);
+module_init(generic_dpi_panel_init);
+module_exit(generic_dpi_panel_exit);
 MODULE_LICENSE("GPL");
-- 
1.7.10.4


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

* [PATCH 19/26] OMAPDSS: HDMI: convert to platform device
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (17 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 18/26] OMAPDSS: panel-generic-dpi: convert to platform device Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 20/26] OMAPDSS: Taal platform_data changes Tomi Valkeinen
                   ` (7 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

Convert HDMI driver from omap_dss_driver to a platform driver. The
driver uses the new panel support from omapdss.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/hdmi_panel.c |   48 +++++++++++++++++++++++++++-------
 1 file changed, 38 insertions(+), 10 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi_panel.c b/drivers/video/omap2/dss/hdmi_panel.c
index dfb8eda..bc4dea3 100644
--- a/drivers/video/omap2/dss/hdmi_panel.c
+++ b/drivers/video/omap2/dss/hdmi_panel.c
@@ -26,10 +26,13 @@
 #include <linux/module.h>
 #include <video/omapdss.h>
 #include <linux/slab.h>
+#include <linux/platform_device.h>
 
 #include "dss.h"
 
 static struct {
+	struct omap_dss_device dssdev;
+
 	/* This protects the panel ops, mainly when accessing the HDMI IP. */
 	struct mutex lock;
 #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
@@ -38,8 +41,9 @@ static struct {
 #endif
 } hdmi;
 
+static struct omap_dss_driver hdmi_driver;
 
-static int hdmi_panel_probe(struct omap_dss_device *dssdev)
+static int hdmi_panel_probe(struct platform_device *pdev)
 {
 	/* Initialize default timings to VGA in DVI mode */
 	const struct omap_video_timings default_timings = {
@@ -59,9 +63,22 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 		.interlace	= false,
 	};
 
+	struct omap_dss_hdmi_data *pdata = dev_get_platdata(&pdev->dev);
+	struct omap_dss_device *dssdev = &hdmi.dssdev;
+	int r;
+
 	DSSDBG("ENTER hdmi_panel_probe\n");
 
 	dssdev->panel.timings = default_timings;
+	dssdev->driver = &hdmi_driver;
+	dssdev->name = "hdmi";
+	dssdev->panel_dev = &pdev->dev;
+
+	/*
+	 * XXX for now, the hdmi panel's platform data contains the gpios for
+	 * the tpd level shifter chip, so we pass this data to the hdmi driver.
+	 */
+	dssdev->data = pdata;
 
 	DSSDBG("hdmi_panel_probe x_res= %d y_res = %d\n",
 		dssdev->panel.timings.x_res,
@@ -69,12 +86,19 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 
 	omapdss_hdmi_display_set_timing(dssdev, &dssdev->panel.timings);
 
+	r = omap_hdmi_register_panel(dssdev);
+	if (r) {
+		DSSERR("Failed to register panel\n");
+		return r;
+	}
+
 	return 0;
 }
 
-static void hdmi_panel_remove(struct omap_dss_device *dssdev)
+static int hdmi_panel_remove(struct platform_device *pdev)
 {
-
+	omap_hdmi_free_panel(&hdmi.dssdev);
+	return 0;
 }
 
 #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
@@ -375,8 +399,6 @@ err:
 }
 
 static struct omap_dss_driver hdmi_driver = {
-	.probe		= hdmi_panel_probe,
-	.remove		= hdmi_panel_remove,
 	.enable		= hdmi_panel_enable,
 	.disable	= hdmi_panel_disable,
 	.get_timings	= hdmi_get_timings,
@@ -384,15 +406,21 @@ static struct omap_dss_driver hdmi_driver = {
 	.check_timings	= hdmi_check_timings,
 	.read_edid	= hdmi_read_edid,
 	.detect		= hdmi_detect,
+	.get_resolution	= omapdss_default_get_resolution,
 	.audio_enable	= hdmi_panel_audio_enable,
 	.audio_disable	= hdmi_panel_audio_disable,
 	.audio_start	= hdmi_panel_audio_start,
 	.audio_stop	= hdmi_panel_audio_stop,
 	.audio_supported	= hdmi_panel_audio_supported,
 	.audio_config	= hdmi_panel_audio_config,
-	.driver			= {
-		.name   = "hdmi_panel",
-		.owner  = THIS_MODULE,
+};
+
+static struct platform_driver hdmi_panel_platform_driver = {
+	.probe	= hdmi_panel_probe,
+	.remove	= hdmi_panel_remove,
+	.driver	= {
+		.name	= "hdmi_panel",
+		.owner	= THIS_MODULE,
 	},
 };
 
@@ -404,11 +432,11 @@ int hdmi_panel_init(void)
 	spin_lock_init(&hdmi.audio_lock);
 #endif
 
-	return omap_dss_register_driver(&hdmi_driver);
+	return platform_driver_register(&hdmi_panel_platform_driver);
 }
 
 void hdmi_panel_exit(void)
 {
-	omap_dss_unregister_driver(&hdmi_driver);
+	platform_driver_unregister(&hdmi_panel_platform_driver);
 
 }
-- 
1.7.10.4


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

* [PATCH 20/26] OMAPDSS: Taal platform_data changes
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (18 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 19/26] OMAPDSS: HDMI: " Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 21/26] OMAPDSS: Taal: convert to platform device Tomi Valkeinen
                   ` (6 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

The forthcoming omap_dss_device to platform_device conversion requires a
few new fields to the Taal platform data. Add the platform data fields
here so that we can make the board file changes independently of the
panel driver changes.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 include/video/omap-panel-nokia-dsi.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/include/video/omap-panel-nokia-dsi.h b/include/video/omap-panel-nokia-dsi.h
index 04219a2..8892da7 100644
--- a/include/video/omap-panel-nokia-dsi.h
+++ b/include/video/omap-panel-nokia-dsi.h
@@ -15,6 +15,7 @@ struct omap_dss_device;
  */
 struct nokia_dsi_panel_data {
 	const char *name;
+	const char *source;
 
 	int reset_gpio;
 
-- 
1.7.10.4


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

* [PATCH 21/26] OMAPDSS: Taal: convert to platform device
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (19 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 20/26] OMAPDSS: Taal platform_data changes Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 22/26] ARM: OMAP: Panda: use new TFP410 platform driver Tomi Valkeinen
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

Convert Taal  driver from omap_dss_driver to a platform driver. The
driver uses the new panel support from omapdss.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/displays/panel-taal.c |  294 +++++++++++++++++------------
 1 file changed, 173 insertions(+), 121 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 2fc923d..01de2a9 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -31,6 +31,7 @@
 #include <linux/workqueue.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
+#include <linux/platform_device.h>
 
 #include <video/omapdss.h>
 #include <video/omap-panel-nokia-dsi.h>
@@ -55,6 +56,9 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable);
 static int taal_panel_reset(struct omap_dss_device *dssdev);
 
 struct taal_data {
+	struct omap_dss_device dssdev;
+	struct platform_device *pdev;
+
 	struct mutex lock;
 
 	struct backlight_device *bldev;
@@ -64,7 +68,7 @@ struct taal_data {
 					 */
 	unsigned long	hw_guard_wait;	/* max guard time in jiffies */
 
-	struct omap_dss_device *dssdev;
+	struct omap_dss_output *src;
 
 	/* panel HW configuration from DT or platform data */
 	int reset_gpio;
@@ -99,6 +103,10 @@ struct taal_data {
 	struct delayed_work ulps_work;
 };
 
+static struct omap_dss_driver taal_driver;
+
+#define to_panel_data(x) container_of(x, struct taal_data, dssdev)
+
 static void taal_esd_work(struct work_struct *work);
 static void taal_ulps_work(struct work_struct *work);
 
@@ -123,7 +131,7 @@ static int taal_dcs_read_1(struct taal_data *td, u8 dcs_cmd, u8 *data)
 	int r;
 	u8 buf[1];
 
-	r = dsi_vc_dcs_read(td->dssdev, td->channel, dcs_cmd, buf, 1);
+	r = dsi_vc_dcs_read(&td->dssdev, td->channel, dcs_cmd, buf, 1);
 
 	if (r < 0)
 		return r;
@@ -135,7 +143,7 @@ static int taal_dcs_read_1(struct taal_data *td, u8 dcs_cmd, u8 *data)
 
 static int taal_dcs_write_0(struct taal_data *td, u8 dcs_cmd)
 {
-	return dsi_vc_dcs_write(td->dssdev, td->channel, &dcs_cmd, 1);
+	return dsi_vc_dcs_write(&td->dssdev, td->channel, &dcs_cmd, 1);
 }
 
 static int taal_dcs_write_1(struct taal_data *td, u8 dcs_cmd, u8 param)
@@ -143,7 +151,7 @@ static int taal_dcs_write_1(struct taal_data *td, u8 dcs_cmd, u8 param)
 	u8 buf[2];
 	buf[0] = dcs_cmd;
 	buf[1] = param;
-	return dsi_vc_dcs_write(td->dssdev, td->channel, buf, 2);
+	return dsi_vc_dcs_write(&td->dssdev, td->channel, buf, 2);
 }
 
 static int taal_sleep_in(struct taal_data *td)
@@ -155,7 +163,7 @@ static int taal_sleep_in(struct taal_data *td)
 	hw_guard_wait(td);
 
 	cmd = MIPI_DCS_ENTER_SLEEP_MODE;
-	r = dsi_vc_dcs_write_nosync(td->dssdev, td->channel, &cmd, 1);
+	r = dsi_vc_dcs_write_nosync(&td->dssdev, td->channel, &cmd, 1);
 	if (r)
 		return r;
 
@@ -216,7 +224,7 @@ static int taal_set_update_window(struct taal_data *td,
 	buf[3] = (x2 >> 8) & 0xff;
 	buf[4] = (x2 >> 0) & 0xff;
 
-	r = dsi_vc_dcs_write_nosync(td->dssdev, td->channel, buf, sizeof(buf));
+	r = dsi_vc_dcs_write_nosync(&td->dssdev, td->channel, buf, sizeof(buf));
 	if (r)
 		return r;
 
@@ -226,18 +234,18 @@ static int taal_set_update_window(struct taal_data *td,
 	buf[3] = (y2 >> 8) & 0xff;
 	buf[4] = (y2 >> 0) & 0xff;
 
-	r = dsi_vc_dcs_write_nosync(td->dssdev, td->channel, buf, sizeof(buf));
+	r = dsi_vc_dcs_write_nosync(&td->dssdev, td->channel, buf, sizeof(buf));
 	if (r)
 		return r;
 
-	dsi_vc_send_bta_sync(td->dssdev, td->channel);
+	dsi_vc_send_bta_sync(&td->dssdev, td->channel);
 
 	return r;
 }
 
 static void taal_queue_esd_work(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 
 	if (td->esd_interval > 0)
 		queue_delayed_work(td->workqueue, &td->esd_work,
@@ -246,14 +254,14 @@ static void taal_queue_esd_work(struct omap_dss_device *dssdev)
 
 static void taal_cancel_esd_work(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 
 	cancel_delayed_work(&td->esd_work);
 }
 
 static void taal_queue_ulps_work(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 
 	if (td->ulps_timeout > 0)
 		queue_delayed_work(td->workqueue, &td->ulps_work,
@@ -262,14 +270,14 @@ static void taal_queue_ulps_work(struct omap_dss_device *dssdev)
 
 static void taal_cancel_ulps_work(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 
 	cancel_delayed_work(&td->ulps_work);
 }
 
 static int taal_enter_ulps(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 	int r;
 
 	if (td->ulps_enabled)
@@ -291,7 +299,7 @@ static int taal_enter_ulps(struct omap_dss_device *dssdev)
 	return 0;
 
 err:
-	dev_err(&dssdev->dev, "enter ULPS failed");
+	dev_err(&td->pdev->dev, "enter ULPS failed");
 	taal_panel_reset(dssdev);
 
 	td->ulps_enabled = false;
@@ -303,7 +311,7 @@ err:
 
 static int taal_exit_ulps(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 	int r;
 
 	if (!td->ulps_enabled)
@@ -311,7 +319,7 @@ static int taal_exit_ulps(struct omap_dss_device *dssdev)
 
 	r = omapdss_dsi_display_enable(dssdev);
 	if (r) {
-		dev_err(&dssdev->dev, "failed to enable DSI\n");
+		dev_err(&td->pdev->dev, "failed to enable DSI\n");
 		goto err1;
 	}
 
@@ -319,7 +327,7 @@ static int taal_exit_ulps(struct omap_dss_device *dssdev)
 
 	r = _taal_enable_te(dssdev, true);
 	if (r) {
-		dev_err(&dssdev->dev, "failed to re-enable TE");
+		dev_err(&td->pdev->dev, "failed to re-enable TE");
 		goto err2;
 	}
 
@@ -333,7 +341,7 @@ static int taal_exit_ulps(struct omap_dss_device *dssdev)
 	return 0;
 
 err2:
-	dev_err(&dssdev->dev, "failed to exit ULPS");
+	dev_err(&td->pdev->dev, "failed to exit ULPS");
 
 	r = taal_panel_reset(dssdev);
 	if (!r) {
@@ -349,7 +357,7 @@ err1:
 
 static int taal_wake_up(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 
 	if (td->ulps_enabled)
 		return taal_exit_ulps(dssdev);
@@ -362,7 +370,7 @@ static int taal_wake_up(struct omap_dss_device *dssdev)
 static int taal_bl_update_status(struct backlight_device *dev)
 {
 	struct omap_dss_device *dssdev = dev_get_drvdata(&dev->dev);
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 	int r;
 	int level;
 
@@ -372,7 +380,7 @@ static int taal_bl_update_status(struct backlight_device *dev)
 	else
 		level = 0;
 
-	dev_dbg(&dssdev->dev, "update brightness to %d\n", level);
+	dev_dbg(&td->pdev->dev, "update brightness to %d\n", level);
 
 	mutex_lock(&td->lock);
 
@@ -417,8 +425,10 @@ static void taal_get_resolution(struct omap_dss_device *dssdev,
 static ssize_t taal_num_errors_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+
+	struct platform_device *pdev = to_platform_device(dev);
+	struct taal_data *td = dev_get_drvdata(&pdev->dev);
+	struct omap_dss_device *dssdev = &td->dssdev;
 	u8 errors = 0;
 	int r;
 
@@ -447,8 +457,9 @@ static ssize_t taal_num_errors_show(struct device *dev,
 static ssize_t taal_hw_revision_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct taal_data *td = dev_get_drvdata(&pdev->dev);
+	struct omap_dss_device *dssdev = &td->dssdev;
 	u8 id1, id2, id3;
 	int r;
 
@@ -485,8 +496,8 @@ static ssize_t show_cabc_mode(struct device *dev,
 		struct device_attribute *attr,
 		char *buf)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct taal_data *td = dev_get_drvdata(&pdev->dev);
 	const char *mode_str;
 	int mode;
 	int len;
@@ -505,8 +516,9 @@ static ssize_t store_cabc_mode(struct device *dev,
 		struct device_attribute *attr,
 		const char *buf, size_t count)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct taal_data *td = dev_get_drvdata(&pdev->dev);
+	struct omap_dss_device *dssdev = &td->dssdev;
 	int i;
 	int r;
 
@@ -567,8 +579,9 @@ static ssize_t taal_store_esd_interval(struct device *dev,
 		struct device_attribute *attr,
 		const char *buf, size_t count)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct taal_data *td = dev_get_drvdata(&pdev->dev);
+	struct omap_dss_device *dssdev = &td->dssdev;
 
 	unsigned long t;
 	int r;
@@ -591,8 +604,8 @@ static ssize_t taal_show_esd_interval(struct device *dev,
 		struct device_attribute *attr,
 		char *buf)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct taal_data *td = dev_get_drvdata(&pdev->dev);
 	unsigned t;
 
 	mutex_lock(&td->lock);
@@ -606,8 +619,9 @@ static ssize_t taal_store_ulps(struct device *dev,
 		struct device_attribute *attr,
 		const char *buf, size_t count)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct taal_data *td = dev_get_drvdata(&pdev->dev);
+	struct omap_dss_device *dssdev = &td->dssdev;
 	unsigned long t;
 	int r;
 
@@ -640,8 +654,8 @@ static ssize_t taal_show_ulps(struct device *dev,
 		struct device_attribute *attr,
 		char *buf)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct taal_data *td = dev_get_drvdata(&pdev->dev);
 	unsigned t;
 
 	mutex_lock(&td->lock);
@@ -655,8 +669,9 @@ static ssize_t taal_store_ulps_timeout(struct device *dev,
 		struct device_attribute *attr,
 		const char *buf, size_t count)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct taal_data *td = dev_get_drvdata(&pdev->dev);
+	struct omap_dss_device *dssdev = &td->dssdev;
 	unsigned long t;
 	int r;
 
@@ -686,8 +701,8 @@ static ssize_t taal_show_ulps_timeout(struct device *dev,
 		struct device_attribute *attr,
 		char *buf)
 {
-	struct omap_dss_device *dssdev = to_dss_device(dev);
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct taal_data *td = dev_get_drvdata(&pdev->dev);
 	unsigned t;
 
 	mutex_lock(&td->lock);
@@ -727,7 +742,7 @@ static struct attribute_group taal_attr_group = {
 
 static void taal_hw_reset(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 
 	if (!gpio_is_valid(td->reset_gpio))
 		return;
@@ -743,9 +758,17 @@ static void taal_hw_reset(struct omap_dss_device *dssdev)
 	msleep(5);
 }
 
-static void taal_probe_pdata(struct taal_data *td,
-		const struct nokia_dsi_panel_data *pdata)
+static int taal_probe_pdata(struct platform_device *pdev)
 {
+	const struct nokia_dsi_panel_data *pdata = dev_get_platdata(&pdev->dev);
+	struct taal_data *td = dev_get_drvdata(&pdev->dev);
+
+	td->src = omap_dss_find_output(pdata->source);
+	if (!td->src) {
+		dev_err(&pdev->dev, "Failed to find video source\n");
+		return -ENODEV;
+	}
+
 	td->reset_gpio = pdata->reset_gpio;
 
 	if (pdata->use_ext_te)
@@ -759,32 +782,44 @@ static void taal_probe_pdata(struct taal_data *td,
 	td->use_dsi_backlight = pdata->use_dsi_backlight;
 
 	td->pin_config = pdata->pin_config;
+
+	td->dssdev.name = pdata->name;
+
+	return 0;
 }
 
-static int taal_probe(struct omap_dss_device *dssdev)
+static int taal_probe(struct platform_device *pdev)
 {
+	const struct nokia_dsi_panel_data *pdata = dev_get_platdata(&pdev->dev);
+	struct omap_dss_device *dssdev;
 	struct backlight_properties props;
 	struct taal_data *td;
 	struct backlight_device *bldev = NULL;
 	int r;
 
-	dev_dbg(&dssdev->dev, "probe\n");
+	dev_dbg(&pdev->dev, "probe\n");
 
-	td = devm_kzalloc(&dssdev->dev, sizeof(*td), GFP_KERNEL);
+	td = devm_kzalloc(&pdev->dev, sizeof(*td), GFP_KERNEL);
 	if (!td)
 		return -ENOMEM;
 
-	dev_set_drvdata(&dssdev->dev, td);
-	td->dssdev = dssdev;
+	td->pdev = pdev;
 
-	if (dssdev->data) {
-		const struct nokia_dsi_panel_data *pdata = dssdev->data;
+	dev_set_drvdata(&pdev->dev, td);
 
-		taal_probe_pdata(td, pdata);
+	if (pdata) {
+		r = taal_probe_pdata(pdev);
+		if (r) {
+			dev_err(&pdev->dev, "failed to read platform data\n");
+			return r;
+		}
 	} else {
 		return -ENODEV;
 	}
 
+	dssdev = &td->dssdev;
+	dssdev->driver = &taal_driver;
+	dssdev->panel_dev = &pdev->dev;
 	dssdev->panel.timings.x_res = 864;
 	dssdev->panel.timings.y_res = 480;
 	dssdev->panel.timings.pixel_clock = DIV_ROUND_UP(864 * 480 * 60, 1000);
@@ -792,46 +827,55 @@ static int taal_probe(struct omap_dss_device *dssdev)
 	dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
 		OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;
 
+	dev_set_drvdata(&pdev->dev, td);
+
+
+	r = omap_dsi_register_panel(dssdev, td->src);
+	if (r) {
+		dev_err(&pdev->dev, "Failed to register panel\n");
+		return r;
+	}
+
 	mutex_init(&td->lock);
 
 	atomic_set(&td->do_update, 0);
 
 	if (gpio_is_valid(td->reset_gpio)) {
-		r = devm_gpio_request_one(&dssdev->dev, td->reset_gpio,
+		r = devm_gpio_request_one(&pdev->dev, td->reset_gpio,
 				GPIOF_OUT_INIT_LOW, "taal rst");
 		if (r) {
-			dev_err(&dssdev->dev, "failed to request reset gpio\n");
+			dev_err(&pdev->dev, "failed to request reset gpio\n");
 			return r;
 		}
 	}
 
 	if (gpio_is_valid(td->ext_te_gpio)) {
-		r = devm_gpio_request_one(&dssdev->dev, td->ext_te_gpio,
+		r = devm_gpio_request_one(&pdev->dev, td->ext_te_gpio,
 				GPIOF_IN, "taal irq");
 		if (r) {
-			dev_err(&dssdev->dev, "GPIO request failed\n");
+			dev_err(&pdev->dev, "GPIO request failed\n");
 			return r;
 		}
 
-		r = devm_request_irq(&dssdev->dev, gpio_to_irq(td->ext_te_gpio),
+		r = devm_request_irq(&pdev->dev, gpio_to_irq(td->ext_te_gpio),
 				taal_te_isr,
 				IRQF_TRIGGER_RISING,
 				"taal vsync", dssdev);
 
 		if (r) {
-			dev_err(&dssdev->dev, "IRQ request failed\n");
+			dev_err(&pdev->dev, "IRQ request failed\n");
 			return r;
 		}
 
 		INIT_DEFERRABLE_WORK(&td->te_timeout_work,
 					taal_te_timeout_work_callback);
 
-		dev_dbg(&dssdev->dev, "Using GPIO TE\n");
+		dev_dbg(&pdev->dev, "Using GPIO TE\n");
 	}
 
 	td->workqueue = create_singlethread_workqueue("taal_esd");
 	if (td->workqueue = NULL) {
-		dev_err(&dssdev->dev, "can't create ESD workqueue\n");
+		dev_err(&pdev->dev, "can't create ESD workqueue\n");
 		return -ENOMEM;
 	}
 	INIT_DEFERRABLE_WORK(&td->esd_work, taal_esd_work);
@@ -844,8 +888,8 @@ static int taal_probe(struct omap_dss_device *dssdev)
 		props.max_brightness = 255;
 
 		props.type = BACKLIGHT_RAW;
-		bldev = backlight_device_register(dev_name(&dssdev->dev),
-				&dssdev->dev, dssdev, &taal_bl_ops, &props);
+		bldev = backlight_device_register(dev_name(&pdev->dev),
+				&pdev->dev, dssdev, &taal_bl_ops, &props);
 		if (IS_ERR(bldev)) {
 			r = PTR_ERR(bldev);
 			goto err_bl;
@@ -862,19 +906,19 @@ static int taal_probe(struct omap_dss_device *dssdev)
 
 	r = omap_dsi_request_vc(dssdev, &td->channel);
 	if (r) {
-		dev_err(&dssdev->dev, "failed to get virtual channel\n");
+		dev_err(&pdev->dev, "failed to get virtual channel\n");
 		goto err_req_vc;
 	}
 
 	r = omap_dsi_set_vc_id(dssdev, td->channel, TCH);
 	if (r) {
-		dev_err(&dssdev->dev, "failed to set VC_ID\n");
+		dev_err(&pdev->dev, "failed to set VC_ID\n");
 		goto err_vc_id;
 	}
 
-	r = sysfs_create_group(&dssdev->dev.kobj, &taal_attr_group);
+	r = sysfs_create_group(&pdev->dev.kobj, &taal_attr_group);
 	if (r) {
-		dev_err(&dssdev->dev, "failed to create sysfs files\n");
+		dev_err(&pdev->dev, "failed to create sysfs files\n");
 		goto err_vc_id;
 	}
 
@@ -890,14 +934,15 @@ err_bl:
 	return r;
 }
 
-static void __exit taal_remove(struct omap_dss_device *dssdev)
+static int __exit taal_remove(struct platform_device *pdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = dev_get_drvdata(&pdev->dev);
+	struct omap_dss_device *dssdev = &td->dssdev;
 	struct backlight_device *bldev;
 
-	dev_dbg(&dssdev->dev, "remove\n");
+	dev_dbg(&pdev->dev, "remove\n");
 
-	sysfs_remove_group(&dssdev->dev.kobj, &taal_attr_group);
+	sysfs_remove_group(&pdev->dev.kobj, &taal_attr_group);
 	omap_dsi_release_vc(dssdev, td->channel);
 
 	bldev = td->bldev;
@@ -913,11 +958,15 @@ static void __exit taal_remove(struct omap_dss_device *dssdev)
 
 	/* reset, to be sure that the panel is in a valid state */
 	taal_hw_reset(dssdev);
+
+	omap_dsi_free_panel(&td->dssdev);
+
+	return 0;
 }
 
 static int taal_power_on(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 	u8 id1, id2, id3;
 	int r;
 	struct omap_dss_dsi_config dsi_config = {
@@ -932,19 +981,19 @@ static int taal_power_on(struct omap_dss_device *dssdev)
 
 	r = omapdss_dsi_configure_pins(dssdev, &td->pin_config);
 	if (r) {
-		dev_err(&dssdev->dev, "failed to configure DSI pins\n");
+		dev_err(&td->pdev->dev, "failed to configure DSI pins\n");
 		goto err0;
 	};
 
 	r = omapdss_dsi_set_config(dssdev, &dsi_config);
 	if (r) {
-		dev_err(&dssdev->dev, "failed to configure DSI\n");
+		dev_err(&td->pdev->dev, "failed to configure DSI\n");
 		goto err0;
 	}
 
 	r = omapdss_dsi_display_enable(dssdev);
 	if (r) {
-		dev_err(&dssdev->dev, "failed to enable DSI\n");
+		dev_err(&td->pdev->dev, "failed to enable DSI\n");
 		goto err0;
 	}
 
@@ -999,10 +1048,10 @@ static int taal_power_on(struct omap_dss_device *dssdev)
 	td->enabled = 1;
 
 	if (!td->intro_printed) {
-		dev_info(&dssdev->dev, "panel revision %02x.%02x.%02x\n",
+		dev_info(&td->pdev->dev, "panel revision %02x.%02x.%02x\n",
 			id1, id2, id3);
 		if (td->cabc_broken)
-			dev_info(&dssdev->dev,
+			dev_info(&td->pdev->dev,
 					"old Taal version, CABC disabled\n");
 		td->intro_printed = true;
 	}
@@ -1011,7 +1060,7 @@ static int taal_power_on(struct omap_dss_device *dssdev)
 
 	return 0;
 err:
-	dev_err(&dssdev->dev, "error while enabling panel, issuing HW reset\n");
+	dev_err(&td->pdev->dev, "error while enabling panel, issuing HW reset\n");
 
 	taal_hw_reset(dssdev);
 
@@ -1022,7 +1071,7 @@ err0:
 
 static void taal_power_off(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 	int r;
 
 	dsi_disable_video_output(dssdev, td->channel);
@@ -1032,7 +1081,7 @@ static void taal_power_off(struct omap_dss_device *dssdev)
 		r = taal_sleep_in(td);
 
 	if (r) {
-		dev_err(&dssdev->dev,
+		dev_err(&td->pdev->dev,
 				"error disabling panel, issuing HW reset\n");
 		taal_hw_reset(dssdev);
 	}
@@ -1044,7 +1093,9 @@ static void taal_power_off(struct omap_dss_device *dssdev)
 
 static int taal_panel_reset(struct omap_dss_device *dssdev)
 {
-	dev_err(&dssdev->dev, "performing LCD reset\n");
+	struct taal_data *td = to_panel_data(dssdev);
+
+	dev_err(&td->pdev->dev, "performing LCD reset\n");
 
 	taal_power_off(dssdev);
 	taal_hw_reset(dssdev);
@@ -1053,10 +1104,10 @@ static int taal_panel_reset(struct omap_dss_device *dssdev)
 
 static int taal_enable(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 	int r;
 
-	dev_dbg(&dssdev->dev, "enable\n");
+	dev_dbg(&td->pdev->dev, "enable\n");
 
 	mutex_lock(&td->lock);
 
@@ -1082,16 +1133,16 @@ static int taal_enable(struct omap_dss_device *dssdev)
 
 	return 0;
 err:
-	dev_dbg(&dssdev->dev, "enable failed\n");
+	dev_dbg(&td->pdev->dev, "enable failed\n");
 	mutex_unlock(&td->lock);
 	return r;
 }
 
 static void taal_disable(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 
-	dev_dbg(&dssdev->dev, "disable\n");
+	dev_dbg(&td->pdev->dev, "disable\n");
 
 	mutex_lock(&td->lock);
 
@@ -1118,14 +1169,16 @@ static void taal_disable(struct omap_dss_device *dssdev)
 static void taal_framedone_cb(int err, void *data)
 {
 	struct omap_dss_device *dssdev = data;
-	dev_dbg(&dssdev->dev, "framedone, err %d\n", err);
+	struct taal_data *td = to_panel_data(dssdev);
+
+	dev_dbg(&td->pdev->dev, "framedone, err %d\n", err);
 	dsi_bus_unlock(dssdev);
 }
 
 static irqreturn_t taal_te_isr(int irq, void *data)
 {
 	struct omap_dss_device *dssdev = data;
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 	int old;
 	int r;
 
@@ -1142,7 +1195,7 @@ static irqreturn_t taal_te_isr(int irq, void *data)
 
 	return IRQ_HANDLED;
 err:
-	dev_err(&dssdev->dev, "start update failed\n");
+	dev_err(&td->pdev->dev, "start update failed\n");
 	dsi_bus_unlock(dssdev);
 	return IRQ_HANDLED;
 }
@@ -1151,9 +1204,9 @@ static void taal_te_timeout_work_callback(struct work_struct *work)
 {
 	struct taal_data *td = container_of(work, struct taal_data,
 					te_timeout_work.work);
-	struct omap_dss_device *dssdev = td->dssdev;
+	struct omap_dss_device *dssdev = &td->dssdev;
 
-	dev_err(&dssdev->dev, "TE not received for 250ms!\n");
+	dev_err(&td->pdev->dev, "TE not received for 250ms!\n");
 
 	atomic_set(&td->do_update, 0);
 	dsi_bus_unlock(dssdev);
@@ -1162,10 +1215,10 @@ static void taal_te_timeout_work_callback(struct work_struct *work)
 static int taal_update(struct omap_dss_device *dssdev,
 				    u16 x, u16 y, u16 w, u16 h)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 	int r;
 
-	dev_dbg(&dssdev->dev, "update %d, %d, %d x %d\n", x, y, w, h);
+	dev_dbg(&td->pdev->dev, "update %d, %d, %d x %d\n", x, y, w, h);
 
 	mutex_lock(&td->lock);
 	dsi_bus_lock(dssdev);
@@ -1208,23 +1261,23 @@ err:
 
 static int taal_sync(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 
-	dev_dbg(&dssdev->dev, "sync\n");
+	dev_dbg(&td->pdev->dev, "sync\n");
 
 	mutex_lock(&td->lock);
 	dsi_bus_lock(dssdev);
 	dsi_bus_unlock(dssdev);
 	mutex_unlock(&td->lock);
 
-	dev_dbg(&dssdev->dev, "sync done\n");
+	dev_dbg(&td->pdev->dev, "sync done\n");
 
 	return 0;
 }
 
 static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 	int r;
 
 	if (enable)
@@ -1243,7 +1296,7 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable)
 
 static int taal_enable_te(struct omap_dss_device *dssdev, bool enable)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 	int r;
 
 	mutex_lock(&td->lock);
@@ -1279,7 +1332,7 @@ err:
 
 static int taal_get_te(struct omap_dss_device *dssdev)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 	int r;
 
 	mutex_lock(&td->lock);
@@ -1291,7 +1344,7 @@ static int taal_get_te(struct omap_dss_device *dssdev)
 
 static int taal_run_test(struct omap_dss_device *dssdev, int test_num)
 {
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 	u8 id1, id2, id3;
 	int r;
 
@@ -1336,7 +1389,7 @@ static int taal_memory_read(struct omap_dss_device *dssdev,
 	int first = 1;
 	int plen;
 	unsigned buf_used = 0;
-	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
+	struct taal_data *td = to_panel_data(dssdev);
 
 	if (size < w * h * 3)
 		return -ENOMEM;
@@ -1380,19 +1433,19 @@ static int taal_memory_read(struct omap_dss_device *dssdev,
 				buf + buf_used, size - buf_used);
 
 		if (r < 0) {
-			dev_err(&dssdev->dev, "read error\n");
+			dev_err(&td->pdev->dev, "read error\n");
 			goto err3;
 		}
 
 		buf_used += r;
 
 		if (r < plen) {
-			dev_err(&dssdev->dev, "short read\n");
+			dev_err(&td->pdev->dev, "short read\n");
 			break;
 		}
 
 		if (signal_pending(current)) {
-			dev_err(&dssdev->dev, "signal pending, "
+			dev_err(&td->pdev->dev, "signal pending, "
 					"aborting memory read\n");
 			r = -ERESTARTSYS;
 			goto err3;
@@ -1414,7 +1467,7 @@ static void taal_ulps_work(struct work_struct *work)
 {
 	struct taal_data *td = container_of(work, struct taal_data,
 			ulps_work.work);
-	struct omap_dss_device *dssdev = td->dssdev;
+	struct omap_dss_device *dssdev = &td->dssdev;
 
 	mutex_lock(&td->lock);
 
@@ -1435,7 +1488,7 @@ static void taal_esd_work(struct work_struct *work)
 {
 	struct taal_data *td = container_of(work, struct taal_data,
 			esd_work.work);
-	struct omap_dss_device *dssdev = td->dssdev;
+	struct omap_dss_device *dssdev = &td->dssdev;
 	u8 state1, state2;
 	int r;
 
@@ -1450,26 +1503,26 @@ static void taal_esd_work(struct work_struct *work)
 
 	r = taal_wake_up(dssdev);
 	if (r) {
-		dev_err(&dssdev->dev, "failed to exit ULPS\n");
+		dev_err(&td->pdev->dev, "failed to exit ULPS\n");
 		goto err;
 	}
 
 	r = taal_dcs_read_1(td, MIPI_DCS_GET_DIAGNOSTIC_RESULT, &state1);
 	if (r) {
-		dev_err(&dssdev->dev, "failed to read Taal status\n");
+		dev_err(&td->pdev->dev, "failed to read Taal status\n");
 		goto err;
 	}
 
 	/* Run self diagnostics */
 	r = taal_sleep_out(td);
 	if (r) {
-		dev_err(&dssdev->dev, "failed to run Taal self-diagnostics\n");
+		dev_err(&td->pdev->dev, "failed to run Taal self-diagnostics\n");
 		goto err;
 	}
 
 	r = taal_dcs_read_1(td, MIPI_DCS_GET_DIAGNOSTIC_RESULT, &state2);
 	if (r) {
-		dev_err(&dssdev->dev, "failed to read Taal status\n");
+		dev_err(&td->pdev->dev, "failed to read Taal status\n");
 		goto err;
 	}
 
@@ -1477,7 +1530,7 @@ static void taal_esd_work(struct work_struct *work)
 	 * Bit6 if the test passes.
 	 */
 	if (!((state1 ^ state2) & (1 << 6))) {
-		dev_err(&dssdev->dev, "LCD self diagnostics failed\n");
+		dev_err(&td->pdev->dev, "LCD self diagnostics failed\n");
 		goto err;
 	}
 	/* Self-diagnostics result is also shown on TE GPIO line. We need
@@ -1495,7 +1548,7 @@ static void taal_esd_work(struct work_struct *work)
 	mutex_unlock(&td->lock);
 	return;
 err:
-	dev_err(&dssdev->dev, "performing LCD reset\n");
+	dev_err(&td->pdev->dev, "performing LCD reset\n");
 
 	taal_panel_reset(dssdev);
 
@@ -1507,9 +1560,6 @@ err:
 }
 
 static struct omap_dss_driver taal_driver = {
-	.probe		= taal_probe,
-	.remove		= __exit_p(taal_remove),
-
 	.enable		= taal_enable,
 	.disable	= taal_disable,
 
@@ -1524,23 +1574,25 @@ static struct omap_dss_driver taal_driver = {
 
 	.run_test	= taal_run_test,
 	.memory_read	= taal_memory_read,
+};
 
-	.driver         = {
-		.name   = "taal",
-		.owner  = THIS_MODULE,
+static struct platform_driver taal_platform_driver = {
+	.probe	= taal_probe,
+	.remove	= __exit_p(taal_remove),
+	.driver	= {
+		.name	= "taal",
+		.owner	= THIS_MODULE,
 	},
 };
 
 static int __init taal_init(void)
 {
-	omap_dss_register_driver(&taal_driver);
-
-	return 0;
+	return platform_driver_register(&taal_platform_driver);
 }
 
 static void __exit taal_exit(void)
 {
-	omap_dss_unregister_driver(&taal_driver);
+	platform_driver_unregister(&taal_platform_driver);
 }
 
 module_init(taal_init);
-- 
1.7.10.4


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

* [PATCH 22/26] ARM: OMAP: Panda: use new TFP410 platform driver
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (20 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 21/26] OMAPDSS: Taal: convert to platform device Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 23/26] ARM: OMAP: Panda & SDP: use new HDMI driver Tomi Valkeinen
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

Use the new TFP410 platform driver instead of the old omap_dss_driver.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/mach-omap2/dss-common.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c
index 4be5cfc..0e94df8 100644
--- a/arch/arm/mach-omap2/dss-common.c
+++ b/arch/arm/mach-omap2/dss-common.c
@@ -25,6 +25,7 @@
 
 #include <linux/kernel.h>
 #include <linux/gpio.h>
+#include <linux/platform_device.h>
 
 #include <video/omapdss.h>
 #include <video/omap-panel-tfp410.h>
@@ -42,20 +43,18 @@
 /* Display DVI */
 #define PANDA_DVI_TFP410_POWER_DOWN_GPIO	0
 
-/* Using generic display panel */
-static struct tfp410_platform_data omap4_dvi_panel = {
+static struct tfp410_platform_data omap4_tfp410_pdata = {
+	.name			= "dvi",
+	.source			= "dpi.0",
 	.i2c_bus_num		= 3,
+	.data_lines		= 24,
 	.power_down_gpio	= PANDA_DVI_TFP410_POWER_DOWN_GPIO,
 };
 
-static struct omap_dss_device omap4_panda_dvi_device = {
-	.type			= OMAP_DISPLAY_TYPE_DPI,
-	.name			= "dvi",
-	.driver_name		= "tfp410",
-	.data			= &omap4_dvi_panel,
-	.phy.dpi.data_lines	= 24,
-	.reset_gpio		= PANDA_DVI_TFP410_POWER_DOWN_GPIO,
-	.channel		= OMAP_DSS_CHANNEL_LCD2,
+static struct platform_device omap4_panda_tfp410_device = {
+	.name			= "tfp410",
+	.id			= 0,
+	.dev.platform_data	= &omap4_tfp410_pdata,
 };
 
 static struct omap_dss_hdmi_data omap4_panda_hdmi_data = {
@@ -73,19 +72,19 @@ static struct omap_dss_device  omap4_panda_hdmi_device = {
 };
 
 static struct omap_dss_device *omap4_panda_dss_devices[] = {
-	&omap4_panda_dvi_device,
 	&omap4_panda_hdmi_device,
 };
 
 static struct omap_dss_board_info omap4_panda_dss_data = {
 	.num_devices	= ARRAY_SIZE(omap4_panda_dss_devices),
 	.devices	= omap4_panda_dss_devices,
-	.default_device	= &omap4_panda_dvi_device,
+	.default_display_name = "dvi",
 };
 
 void __init omap4_panda_display_init(void)
 {
 	omap_display_init(&omap4_panda_dss_data);
+	platform_device_register(&omap4_panda_tfp410_device);
 
 	/*
 	 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
@@ -104,6 +103,7 @@ void __init omap4_panda_display_init(void)
 void __init omap4_panda_display_init_of(void)
 {
 	omap_display_init(&omap4_panda_dss_data);
+	platform_device_register(&omap4_panda_tfp410_device);
 }
 
 
-- 
1.7.10.4


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

* [PATCH 23/26] ARM: OMAP: Panda & SDP: use new HDMI driver
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (21 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 22/26] ARM: OMAP: Panda: use new TFP410 platform driver Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 24/26] ARM: OMAP: 4430SDP: use new Taal driver Tomi Valkeinen
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

Change Pandaboard and 4430SDP to use the new HDMI platform driver
instead of the old omap_dss_driver.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/mach-omap2/dss-common.c |   31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c
index 0e94df8..64ca888 100644
--- a/arch/arm/mach-omap2/dss-common.c
+++ b/arch/arm/mach-omap2/dss-common.c
@@ -63,21 +63,13 @@ static struct omap_dss_hdmi_data omap4_panda_hdmi_data = {
 	.hpd_gpio = HDMI_GPIO_HPD,
 };
 
-static struct omap_dss_device  omap4_panda_hdmi_device = {
-	.name = "hdmi",
-	.driver_name = "hdmi_panel",
-	.type = OMAP_DISPLAY_TYPE_HDMI,
-	.channel = OMAP_DSS_CHANNEL_DIGIT,
-	.data = &omap4_panda_hdmi_data,
-};
-
-static struct omap_dss_device *omap4_panda_dss_devices[] = {
-	&omap4_panda_hdmi_device,
+static struct platform_device omap4_panda_hdmi_device = {
+	.name			= "hdmi_panel",
+	.id			= 0,
+	.dev.platform_data	= &omap4_panda_hdmi_data,
 };
 
 static struct omap_dss_board_info omap4_panda_dss_data = {
-	.num_devices	= ARRAY_SIZE(omap4_panda_dss_devices),
-	.devices	= omap4_panda_dss_devices,
 	.default_display_name = "dvi",
 };
 
@@ -85,6 +77,7 @@ void __init omap4_panda_display_init(void)
 {
 	omap_display_init(&omap4_panda_dss_data);
 	platform_device_register(&omap4_panda_tfp410_device);
+	platform_device_register(&omap4_panda_hdmi_device);
 
 	/*
 	 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
@@ -104,6 +97,7 @@ void __init omap4_panda_display_init_of(void)
 {
 	omap_display_init(&omap4_panda_dss_data);
 	platform_device_register(&omap4_panda_tfp410_device);
+	platform_device_register(&omap4_panda_hdmi_device);
 }
 
 
@@ -165,12 +159,10 @@ static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
 	.hpd_gpio = HDMI_GPIO_HPD,
 };
 
-static struct omap_dss_device sdp4430_hdmi_device = {
-	.name = "hdmi",
-	.driver_name = "hdmi_panel",
-	.type = OMAP_DISPLAY_TYPE_HDMI,
-	.channel = OMAP_DSS_CHANNEL_DIGIT,
-	.data = &sdp4430_hdmi_data,
+static struct platform_device sdp4430_hdmi_device = {
+	.name			= "hdmi_panel",
+	.id			= 0,
+	.dev.platform_data	= &sdp4430_hdmi_data,
 };
 
 static struct picodlp_panel_data sdp4430_picodlp_pdata = {
@@ -224,7 +216,6 @@ static struct omap_dss_device sdp4430_picodlp_device = {
 static struct omap_dss_device *sdp4430_dss_devices[] = {
 	&sdp4430_lcd_device,
 	&sdp4430_lcd2_device,
-	&sdp4430_hdmi_device,
 	&sdp4430_picodlp_device,
 };
 
@@ -246,6 +237,7 @@ void __init omap_4430sdp_display_init(void)
 
 	sdp4430_picodlp_init();
 	omap_display_init(&sdp4430_dss_data);
+	platform_device_register(&sdp4430_hdmi_device);
 	/*
 	 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
 	 * later have external pull up on the HDMI I2C lines
@@ -272,4 +264,5 @@ void __init omap_4430sdp_display_init_of(void)
 
 	sdp4430_picodlp_init();
 	omap_display_init(&sdp4430_dss_data);
+	platform_device_register(&sdp4430_hdmi_device);
 }
-- 
1.7.10.4


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

* [PATCH 24/26] ARM: OMAP: 4430SDP: use new Taal driver
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (22 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 23/26] ARM: OMAP: Panda & SDP: use new HDMI driver Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 25/26] ARM: OMAP: Overo: use new TFP410 platform driver Tomi Valkeinen
                   ` (2 subsequent siblings)
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

Change 4430SDP to use the new Taal platform driver instead of the old
omap_dss_driver.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/mach-omap2/dss-common.c |   41 ++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c
index 64ca888..a10c56b 100644
--- a/arch/arm/mach-omap2/dss-common.c
+++ b/arch/arm/mach-omap2/dss-common.c
@@ -107,7 +107,8 @@ void __init omap4_panda_display_init_of(void)
 #define DLP_POWER_ON_GPIO	40
 
 static struct nokia_dsi_panel_data dsi1_panel = {
-		.name		= "taal",
+		.name		= "lcd",
+		.source		= "dsi.0",
 		.reset_gpio	= 102,
 		.use_ext_te	= false,
 		.ext_te_gpio	= 101,
@@ -118,19 +119,15 @@ static struct nokia_dsi_panel_data dsi1_panel = {
 		},
 };
 
-static struct omap_dss_device sdp4430_lcd_device = {
-	.name			= "lcd",
-	.driver_name		= "taal",
-	.type			= OMAP_DISPLAY_TYPE_DSI,
-	.data			= &dsi1_panel,
-	.phy.dsi		= {
-		.module		= 0,
-	},
-	.channel		= OMAP_DSS_CHANNEL_LCD,
+static struct platform_device sdp4430_lcd1_device = {
+	.name			= "taal",
+	.id			= 0,
+	.dev.platform_data	= &dsi1_panel,
 };
 
 static struct nokia_dsi_panel_data dsi2_panel = {
-		.name		= "taal",
+		.name		= "lcd2",
+		.source		= "dsi.1",
 		.reset_gpio	= 104,
 		.use_ext_te	= false,
 		.ext_te_gpio	= 103,
@@ -141,16 +138,10 @@ static struct nokia_dsi_panel_data dsi2_panel = {
 		},
 };
 
-static struct omap_dss_device sdp4430_lcd2_device = {
-	.name			= "lcd2",
-	.driver_name		= "taal",
-	.type			= OMAP_DISPLAY_TYPE_DSI,
-	.data			= &dsi2_panel,
-	.phy.dsi		= {
-
-		.module		= 1,
-	},
-	.channel		= OMAP_DSS_CHANNEL_LCD2,
+static struct platform_device sdp4430_lcd2_device = {
+	.name			= "taal",
+	.id			= 1,
+	.dev.platform_data	= &dsi2_panel,
 };
 
 static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
@@ -214,15 +205,13 @@ static struct omap_dss_device sdp4430_picodlp_device = {
 };
 
 static struct omap_dss_device *sdp4430_dss_devices[] = {
-	&sdp4430_lcd_device,
-	&sdp4430_lcd2_device,
 	&sdp4430_picodlp_device,
 };
 
 static struct omap_dss_board_info sdp4430_dss_data = {
 	.num_devices	= ARRAY_SIZE(sdp4430_dss_devices),
 	.devices	= sdp4430_dss_devices,
-	.default_device	= &sdp4430_lcd_device,
+	.default_display_name = "lcd",
 };
 
 void __init omap_4430sdp_display_init(void)
@@ -238,6 +227,8 @@ void __init omap_4430sdp_display_init(void)
 	sdp4430_picodlp_init();
 	omap_display_init(&sdp4430_dss_data);
 	platform_device_register(&sdp4430_hdmi_device);
+	platform_device_register(&sdp4430_lcd1_device);
+	platform_device_register(&sdp4430_lcd2_device);
 	/*
 	 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
 	 * later have external pull up on the HDMI I2C lines
@@ -265,4 +256,6 @@ void __init omap_4430sdp_display_init_of(void)
 	sdp4430_picodlp_init();
 	omap_display_init(&sdp4430_dss_data);
 	platform_device_register(&sdp4430_hdmi_device);
+	platform_device_register(&sdp4430_lcd1_device);
+	platform_device_register(&sdp4430_lcd2_device);
 }
-- 
1.7.10.4


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

* [PATCH 25/26] ARM: OMAP: Overo: use new TFP410 platform driver
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (23 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 24/26] ARM: OMAP: 4430SDP: use new Taal driver Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 13:33 ` [PATCH 26/26] ARM: OMAP: Overo: use new generic-dpi-panel " Tomi Valkeinen
  2013-03-26 17:10 ` [PATCH 00/26] DSS device model change Tony Lindgren
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

Use the new TFP410 platform driver instead of the old omap_dss_driver.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/mach-omap2/board-overo.c |   32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 86bab51..e3cd2bd 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -157,6 +157,20 @@ static struct gpio overo_dss_gpios[] __initdata = {
 	{ OVERO_GPIO_LCD_BL, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_BL" },
 };
 
+static struct tfp410_platform_data dvi_panel = {
+	.name			= "dvi",
+	.source			= "dpi.0",
+	.data_lines		= 24,
+	.i2c_bus_num		= 3,
+	.power_down_gpio	= -1,
+};
+
+static struct platform_device overo_dvi_device = {
+	.name			= "tfp410",
+	.id			= 0,
+	.dev.platform_data	= &dvi_panel,
+};
+
 static void __init overo_display_init(void)
 {
 	if (gpio_request_array(overo_dss_gpios, ARRAY_SIZE(overo_dss_gpios))) {
@@ -166,20 +180,9 @@ static void __init overo_display_init(void)
 
 	gpio_export(OVERO_GPIO_LCD_EN, 0);
 	gpio_export(OVERO_GPIO_LCD_BL, 0);
-}
 
-static struct tfp410_platform_data dvi_panel = {
-	.i2c_bus_num		= 3,
-	.power_down_gpio	= -1,
-};
-
-static struct omap_dss_device overo_dvi_device = {
-	.name			= "dvi",
-	.type			= OMAP_DISPLAY_TYPE_DPI,
-	.driver_name		= "tfp410",
-	.data			= &dvi_panel,
-	.phy.dpi.data_lines	= 24,
-};
+	platform_device_register(&overo_dvi_device);
+}
 
 static struct omap_dss_device overo_tv_device = {
 	.name = "tv",
@@ -235,7 +238,6 @@ static struct omap_dss_device overo_lcd35_device = {
 #endif
 
 static struct omap_dss_device *overo_dss_devices[] = {
-	&overo_dvi_device,
 	&overo_tv_device,
 #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
 	defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
@@ -247,7 +249,7 @@ static struct omap_dss_device *overo_dss_devices[] = {
 static struct omap_dss_board_info overo_dss_data = {
 	.num_devices	= ARRAY_SIZE(overo_dss_devices),
 	.devices	= overo_dss_devices,
-	.default_device	= &overo_dvi_device,
+	.default_display_name = "dvi",
 };
 
 static struct mtd_partition overo_nand_partitions[] = {
-- 
1.7.10.4


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

* [PATCH 26/26] ARM: OMAP: Overo: use new generic-dpi-panel platform driver
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (24 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 25/26] ARM: OMAP: Overo: use new TFP410 platform driver Tomi Valkeinen
@ 2013-03-26 13:33 ` Tomi Valkeinen
  2013-03-26 17:10 ` [PATCH 00/26] DSS device model change Tony Lindgren
  26 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-26 13:33 UTC (permalink / raw)
  To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen

Use the new generic-dpi-panel platform driver instead of the old
omap_dss_driver.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/mach-omap2/board-overo.c |   71 +++++++++++++++++++------------------
 1 file changed, 36 insertions(+), 35 deletions(-)

diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index e3cd2bd..21579f8 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -152,6 +152,41 @@ static int dvi_enabled;
 #define OVERO_GPIO_LCD_EN 144
 #define OVERO_GPIO_LCD_BL 145
 
+static int overo_panel_enable_lcd(struct omap_dss_device *dssdev)
+{
+	if (dvi_enabled) {
+		printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
+		return -EINVAL;
+	}
+
+	gpio_set_value(OVERO_GPIO_LCD_EN, 1);
+	gpio_set_value(OVERO_GPIO_LCD_BL, 1);
+	lcd_enabled = 1;
+	return 0;
+}
+
+static void overo_panel_disable_lcd(struct omap_dss_device *dssdev)
+{
+	gpio_set_value(OVERO_GPIO_LCD_EN, 0);
+	gpio_set_value(OVERO_GPIO_LCD_BL, 0);
+	lcd_enabled = 0;
+}
+
+static struct panel_generic_dpi_data overo_lcd43_data = {
+	.display_name		= "lcd43",
+	.source			= "dpi.0",
+	.name			= "samsung_lte430wq_f0c",
+	.platform_enable	= overo_panel_enable_lcd,
+	.platform_disable	= overo_panel_disable_lcd,
+	.data_lines		= 24,
+};
+
+static struct platform_device overo_lcd43_device = {
+	.name			= "generic_dpi_panel",
+	.id			= 0,
+	.dev.platform_data	= &overo_lcd43_data,
+};
+
 static struct gpio overo_dss_gpios[] __initdata = {
 	{ OVERO_GPIO_LCD_EN, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_EN" },
 	{ OVERO_GPIO_LCD_BL, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_BL" },
@@ -182,6 +217,7 @@ static void __init overo_display_init(void)
 	gpio_export(OVERO_GPIO_LCD_BL, 0);
 
 	platform_device_register(&overo_dvi_device);
+	platform_device_register(&overo_lcd43_device);
 }
 
 static struct omap_dss_device overo_tv_device = {
@@ -191,40 +227,6 @@ static struct omap_dss_device overo_tv_device = {
 	.phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
 };
 
-static int overo_panel_enable_lcd(struct omap_dss_device *dssdev)
-{
-	if (dvi_enabled) {
-		printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
-		return -EINVAL;
-	}
-
-	gpio_set_value(OVERO_GPIO_LCD_EN, 1);
-	gpio_set_value(OVERO_GPIO_LCD_BL, 1);
-	lcd_enabled = 1;
-	return 0;
-}
-
-static void overo_panel_disable_lcd(struct omap_dss_device *dssdev)
-{
-	gpio_set_value(OVERO_GPIO_LCD_EN, 0);
-	gpio_set_value(OVERO_GPIO_LCD_BL, 0);
-	lcd_enabled = 0;
-}
-
-static struct panel_generic_dpi_data lcd43_panel = {
-	.name			= "samsung_lte430wq_f0c",
-	.platform_enable	= overo_panel_enable_lcd,
-	.platform_disable	= overo_panel_disable_lcd,
-};
-
-static struct omap_dss_device overo_lcd43_device = {
-	.name			= "lcd43",
-	.type			= OMAP_DISPLAY_TYPE_DPI,
-	.driver_name		= "generic_dpi_panel",
-	.data			= &lcd43_panel,
-	.phy.dpi.data_lines	= 24,
-};
-
 #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
 	defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
 static struct omap_dss_device overo_lcd35_device = {
@@ -243,7 +245,6 @@ static struct omap_dss_device *overo_dss_devices[] = {
 	defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
 	&overo_lcd35_device,
 #endif
-	&overo_lcd43_device,
 };
 
 static struct omap_dss_board_info overo_dss_data = {
-- 
1.7.10.4


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

* Re: [PATCH 00/26] DSS device model change
  2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
                   ` (25 preceding siblings ...)
  2013-03-26 13:33 ` [PATCH 26/26] ARM: OMAP: Overo: use new generic-dpi-panel " Tomi Valkeinen
@ 2013-03-26 17:10 ` Tony Lindgren
  2013-03-27  6:13   ` Tomi Valkeinen
  26 siblings, 1 reply; 34+ messages in thread
From: Tony Lindgren @ 2013-03-26 17:10 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev, Archit Taneja

* Tomi Valkeinen <tomi.valkeinen@ti.com> [130326 06:38]:
> Hi,
> 
> To make it possible to add DT support to DSS, and later use the Common Display
> Framework, we need to change the DSS device model. We currently have a custom
> dss bus, and omap_dss_devices on that bus, and the aim is to get rid of that
> bus.
> 
> The panel devices will be converted occording to the control bus of the panel.
> For many panels this means that the panel device will become a platform_device.
> For some, it means the panel devices become i2c or spi devices.
> 
> This series takes the first step toward that goal. This series:
> 
> * Converts DPI, HDMI and DSI outputs to work with new style panels
> * Converts TFP410, Taal and generic-dpi panels to new model
> * Converts Panda, 4430SDP and Overo boards to use the new panels
> 
> The non-converted outputs and panels still work, so they can be converted in
> stages.

This is nice, it removes a merge dependency between ARM code and the driver :)
 
> Note about board files: I only convert a few board files here for example. I
> have a branch with board file changes for all the affected board files. I did
> not include them as they are more or less identical. If this series looks good,
> I will create an independent branch for the arch/arm stuff, so it can be pulled
> separately.

Great looks good to me thanks.

Tony

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

* Re: [PATCH 00/26] DSS device model change
  2013-03-26 17:10 ` [PATCH 00/26] DSS device model change Tony Lindgren
@ 2013-03-27  6:13   ` Tomi Valkeinen
  2013-03-27 20:25     ` Tony Lindgren
  0 siblings, 1 reply; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-27  6:13 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, linux-fbdev, Archit Taneja

[-- Attachment #1: Type: text/plain, Size: 2088 bytes --]

On 2013-03-26 19:10, Tony Lindgren wrote:
> * Tomi Valkeinen <tomi.valkeinen@ti.com> [130326 06:38]:
>> Hi,
>>
>> To make it possible to add DT support to DSS, and later use the Common Display
>> Framework, we need to change the DSS device model. We currently have a custom
>> dss bus, and omap_dss_devices on that bus, and the aim is to get rid of that
>> bus.
>>
>> The panel devices will be converted occording to the control bus of the panel.
>> For many panels this means that the panel device will become a platform_device.
>> For some, it means the panel devices become i2c or spi devices.
>>
>> This series takes the first step toward that goal. This series:
>>
>> * Converts DPI, HDMI and DSI outputs to work with new style panels
>> * Converts TFP410, Taal and generic-dpi panels to new model
>> * Converts Panda, 4430SDP and Overo boards to use the new panels
>>
>> The non-converted outputs and panels still work, so they can be converted in
>> stages.
> 
> This is nice, it removes a merge dependency between ARM code and the driver :)

Yes. It does give me a few more gray hairs, though =). It'd be so much
easier to have all related changes in one clean patch series.

>> Note about board files: I only convert a few board files here for example. I
>> have a branch with board file changes for all the affected board files. I did
>> not include them as they are more or less identical. If this series looks good,
>> I will create an independent branch for the arch/arm stuff, so it can be pulled
>> separately.
> 
> Great looks good to me thanks.

To make the DSS work properly after this device model change, we also
need to solve the problem related to multiple display devices on the
same video bus.

Did the approach I suggested in

http://permalink.gmane.org/gmane.linux.ports.arm.omap/96039

look ok? Overo is the most complex one, I think the rest of the boards
that require changes have just LCD and DVI that conflict. But it still
means we'll have that kind of choice Kconfig option for all those boards.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 899 bytes --]

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

* Re: [PATCH 05/26] OMAPDSS: DPI: fix regulators
  2013-03-26 13:33 ` [PATCH 05/26] OMAPDSS: DPI: fix regulators Tomi Valkeinen
@ 2013-03-27  9:57   ` Archit Taneja
  0 siblings, 0 replies; 34+ messages in thread
From: Archit Taneja @ 2013-03-27  9:57 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev

On Tuesday 26 March 2013 07:03 PM, Tomi Valkeinen wrote:
> On some platforms DPI requires a regulator to be enabled to power up the
> output pins. This regulator is, for some reason, currently attached to
> the virtual omapdss device, instead of the DPI device. This does not
> work for DT, as the regulator mappings need to be described in the DT
> data, and the virtual omapdss device is not present there.
>
> Fix the issue by acquiring the regulator in the DPI device. To retain
> compatibility with the current board files, the old method of getting
> the regulator is kept. The old method can be removed when the board
> files have been changed to pass the regulator to DPI.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>   drivers/video/omap2/dss/dpi.c |   21 ++++++++++++++++++---
>   1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
> index ad67a9c..08342d1 100644
> --- a/drivers/video/omap2/dss/dpi.c
> +++ b/drivers/video/omap2/dss/dpi.c
> @@ -37,7 +37,10 @@
>   #include "dss_features.h"
>
>   static struct {
> +	struct platform_device *pdev;

We can use dpi.output.pdev, we don't really need to have another pdev 
pointer. Same for SDI in the next patch.

Archit

> +
>   	struct regulator *vdds_dsi_reg;
> +	bool vdds_dsi_from_core;
>   	struct platform_device *dsidev;
>
>   	struct mutex lock;
> @@ -583,10 +586,15 @@ static int __init dpi_init_display(struct omap_dss_device *dssdev)
>   		struct regulator *vdds_dsi;
>
>   		vdds_dsi = dss_get_vdds_dsi();
> -
>   		if (IS_ERR(vdds_dsi)) {
> -			DSSERR("can't get VDDS_DSI regulator\n");
> -			return PTR_ERR(vdds_dsi);
> +			vdds_dsi = regulator_get(&dpi.pdev->dev, "vdds_dsi");
> +			if (IS_ERR(vdds_dsi)) {
> +				DSSERR("can't get VDDS_DSI regulator\n");
> +				return PTR_ERR(vdds_dsi);
> +			}
> +			dpi.vdds_dsi_from_core = false;
> +		} else {
> +			dpi.vdds_dsi_from_core = true;
>   		}
>
>   		dpi.vdds_dsi_reg = vdds_dsi;
> @@ -698,6 +706,8 @@ static void __exit dpi_uninit_output(struct platform_device *pdev)
>
>   static int __init omap_dpi_probe(struct platform_device *pdev)
>   {
> +	dpi.pdev = pdev;
> +
>   	mutex_init(&dpi.lock);
>
>   	dpi_init_output(pdev);
> @@ -714,6 +724,11 @@ static int __exit omap_dpi_remove(struct platform_device *pdev)
>
>   	dpi_uninit_output(pdev);
>
> +	if (dpi.vdds_dsi_reg != NULL && dpi.vdds_dsi_from_core = false) {
> +		regulator_put(dpi.vdds_dsi_reg);
> +		dpi.vdds_dsi_reg = NULL;
> +	}
> +
>   	return 0;
>   }
>
>


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

* Re: [PATCH 16/26] OMAPDSS: TFP410: convert to platform device
  2013-03-27 11:23   ` Archit Taneja
@ 2013-03-27 11:14     ` Tomi Valkeinen
  2013-03-27 11:29       ` Archit Taneja
  0 siblings, 1 reply; 34+ messages in thread
From: Tomi Valkeinen @ 2013-03-27 11:14 UTC (permalink / raw)
  To: Archit Taneja; +Cc: linux-omap, linux-fbdev

[-- Attachment #1: Type: text/plain, Size: 1231 bytes --]

On 2013-03-27 13:11, Archit Taneja wrote:
> On Tuesday 26 March 2013 07:03 PM, Tomi Valkeinen wrote:
>> Convert TFP410 driver from omap_dss_driver to a platform driver. The
>> driver uses the new panel support from omapdss.
>>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>   drivers/video/omap2/displays/panel-tfp410.c |  205
>> +++++++++++++++++----------
>>   1 file changed, 128 insertions(+), 77 deletions(-)
>>

>> -        ddata->i2c_adapter = adapter;
>> +    dssdev = &ddata->dssdev;
>> +    dssdev->driver = &tfp410_driver;
>> +    dssdev->panel.timings = tfp410_default_timings;
>> +    dssdev->name = ddata->name;
>> +    dssdev->phy.dpi.data_lines = ddata->data_lines;
>> +    dssdev->panel_dev = &pdev->dev;
> 
> Some of the omap_dss_device fields populated here(like data_lines) are
> not going to be used anywhere. Are you populating all of them just for
> the sake of clarity, so that they can be removed in another series later
> on? Or is there some other reason?

Unfortunately the datalines are used in
omapdss_default_get_recommended_bpp(). So there are some fields
populated just to keep things working, and I expect that they are
removed later.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 899 bytes --]

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

* Re: [PATCH 16/26] OMAPDSS: TFP410: convert to platform device
  2013-03-26 13:33 ` [PATCH 16/26] OMAPDSS: TFP410: convert to platform device Tomi Valkeinen
@ 2013-03-27 11:23   ` Archit Taneja
  2013-03-27 11:14     ` Tomi Valkeinen
  0 siblings, 1 reply; 34+ messages in thread
From: Archit Taneja @ 2013-03-27 11:23 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev

On Tuesday 26 March 2013 07:03 PM, Tomi Valkeinen wrote:
> Convert TFP410 driver from omap_dss_driver to a platform driver. The
> driver uses the new panel support from omapdss.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>   drivers/video/omap2/displays/panel-tfp410.c |  205 +++++++++++++++++----------
>   1 file changed, 128 insertions(+), 77 deletions(-)
>
> diff --git a/drivers/video/omap2/displays/panel-tfp410.c b/drivers/video/omap2/displays/panel-tfp410.c
> index 8281baa..a225ea1 100644
> --- a/drivers/video/omap2/displays/panel-tfp410.c
> +++ b/drivers/video/omap2/displays/panel-tfp410.c
> @@ -22,10 +22,13 @@
>   #include <video/omapdss.h>
>   #include <linux/i2c.h>
>   #include <linux/gpio.h>
> +#include <linux/platform_device.h>
>   #include <drm/drm_edid.h>
>
>   #include <video/omap-panel-tfp410.h>
>
> +static struct omap_dss_driver tfp410_driver;
> +
>   static const struct omap_video_timings tfp410_default_timings = {
>   	.x_res		= 640,
>   	.y_res		= 480,
> @@ -48,121 +51,152 @@ static const struct omap_video_timings tfp410_default_timings = {
>   };
>
>   struct panel_drv_data {
> -	struct omap_dss_device *dssdev;
> +	struct omap_dss_device dssdev;
>
>   	struct mutex lock;
>
> +	const char *name;
> +
>   	int pd_gpio;
> +	int data_lines;
> +
> +	struct omap_video_timings timings;
>
>   	struct i2c_adapter *i2c_adapter;
>   };
>
> -static int tfp410_power_on(struct omap_dss_device *dssdev)
> +#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
> +
> +static int tfp410_probe_pdata(struct platform_device *pdev)
>   {
> -	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> -	int r;
> +	struct tfp410_platform_data *pdata = dev_get_platdata(&pdev->dev);
> +	struct panel_drv_data *ddata = dev_get_drvdata(&pdev->dev);
> +	int r, gpio, i2c_bus_num;
>
> -	if (dssdev->state = OMAP_DSS_DISPLAY_ACTIVE)
> -		return 0;
> +	ddata->name = pdata->name;
>
> -	omapdss_dpi_set_timings(dssdev, &dssdev->panel.timings);
> -	omapdss_dpi_set_data_lines(dssdev, dssdev->phy.dpi.data_lines);
> +	gpio = pdata->power_down_gpio;
>
> -	r = omapdss_dpi_display_enable(dssdev);
> -	if (r)
> -		goto err0;
> +	if (gpio_is_valid(gpio)) {
> +		r = devm_gpio_request_one(&pdev->dev, gpio,
> +				GPIOF_OUT_INIT_LOW, "tfp410 pd");
> +		if (r) {
> +			dev_err(&pdev->dev, "Failed to request PD GPIO %d\n",
> +					gpio);
> +			return r;
> +		}
>
> -	if (gpio_is_valid(ddata->pd_gpio))
> -		gpio_set_value_cansleep(ddata->pd_gpio, 1);
> +		ddata->pd_gpio = gpio;
> +	} else {
> +		ddata->pd_gpio = -1;
> +	}
>
> -	return 0;
> -err0:
> -	return r;
> -}
> +	ddata->data_lines = pdata->data_lines;
>
> -static void tfp410_power_off(struct omap_dss_device *dssdev)
> -{
> -	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> +	i2c_bus_num = pdata->i2c_bus_num;
>
> -	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
> -		return;
> +	if (i2c_bus_num != -1) {
> +		struct i2c_adapter *adapter;
>
> -	if (gpio_is_valid(ddata->pd_gpio))
> -		gpio_set_value_cansleep(ddata->pd_gpio, 0);
> +		adapter = i2c_get_adapter(i2c_bus_num);
> +		if (!adapter) {
> +			dev_err(&pdev->dev,
> +					"Failed to get I2C adapter, bus %d\n",
> +					i2c_bus_num);
> +			return -EINVAL;
> +		}
>
> -	omapdss_dpi_display_disable(dssdev);
> +		ddata->i2c_adapter = adapter;
> +	}
> +
> +	return 0;
>   }
>
> -static int tfp410_probe(struct omap_dss_device *dssdev)
> +static int tfp410_probe(struct platform_device *pdev)
>   {
> +	struct tfp410_platform_data *pdata = dev_get_platdata(&pdev->dev);
> +	struct omap_dss_device *dssdev;
>   	struct panel_drv_data *ddata;
>   	int r;
> -	int i2c_bus_num;
>
> -	ddata = devm_kzalloc(&dssdev->dev, sizeof(*ddata), GFP_KERNEL);
> +	ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
>   	if (!ddata)
>   		return -ENOMEM;
>
> -	dssdev->panel.timings = tfp410_default_timings;
> +	dev_set_drvdata(&pdev->dev, ddata);
>
> -	ddata->dssdev = dssdev;
>   	mutex_init(&ddata->lock);
>
> -	if (dssdev->data) {
> -		struct tfp410_platform_data *pdata = dssdev->data;
> -
> -		ddata->pd_gpio = pdata->power_down_gpio;
> -		i2c_bus_num = pdata->i2c_bus_num;
> -	} else {
> -		ddata->pd_gpio = -1;
> -		i2c_bus_num = -1;
> -	}
> -
> -	if (gpio_is_valid(ddata->pd_gpio)) {
> -		r = devm_gpio_request_one(&dssdev->dev, ddata->pd_gpio,
> -				GPIOF_OUT_INIT_LOW, "tfp410 pd");
> -		if (r) {
> -			dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n",
> -					ddata->pd_gpio);
> +	if (pdata) {
> +		r = tfp410_probe_pdata(pdev);
> +		if (r)
>   			return r;
> -		}
> +	} else {
> +		return -ENODEV;
>   	}
>
> -	if (i2c_bus_num != -1) {
> -		struct i2c_adapter *adapter;
> +	ddata->timings = tfp410_default_timings;
>
> -		adapter = i2c_get_adapter(i2c_bus_num);
> -		if (!adapter) {
> -			dev_err(&dssdev->dev, "Failed to get I2C adapter, bus %d\n",
> -					i2c_bus_num);
> -			return -EINVAL;
> -		}
> -
> -		ddata->i2c_adapter = adapter;
> +	dssdev = &ddata->dssdev;
> +	dssdev->driver = &tfp410_driver;
> +	dssdev->panel.timings = tfp410_default_timings;
> +	dssdev->name = ddata->name;
> +	dssdev->phy.dpi.data_lines = ddata->data_lines;
> +	dssdev->panel_dev = &pdev->dev;

Some of the omap_dss_device fields populated here(like data_lines) are 
not going to be used anywhere. Are you populating all of them just for 
the sake of clarity, so that they can be removed in another series later 
on? Or is there some other reason?

Archit

> +
> +	r = omap_dpi_register_panel(dssdev);
> +	if (r) {
> +		dev_err(&pdev->dev, "Failed to register panel\n");
> +		return r;
>   	}
>
> -	dev_set_drvdata(&dssdev->dev, ddata);
> -
>   	return 0;
>   }
>
> -static void __exit tfp410_remove(struct omap_dss_device *dssdev)
> +static int __exit tfp410_remove(struct platform_device *pdev)
>   {
> -	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> +	struct panel_drv_data *ddata = dev_get_drvdata(&pdev->dev);
>
>   	mutex_lock(&ddata->lock);
>
> +	omap_dpi_free_panel(&ddata->dssdev);
> +
>   	if (ddata->i2c_adapter)
>   		i2c_put_adapter(ddata->i2c_adapter);
>
> -	dev_set_drvdata(&dssdev->dev, NULL);
> +	dev_set_drvdata(&pdev->dev, NULL);
>
>   	mutex_unlock(&ddata->lock);
> +
> +	return 0;
> +}
> +
> +static int tfp410_power_on(struct omap_dss_device *dssdev)
> +{
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	int r;
> +
> +	if (dssdev->state = OMAP_DSS_DISPLAY_ACTIVE)
> +		return 0;
> +
> +	omapdss_dpi_set_timings(dssdev, &ddata->timings);
> +	omapdss_dpi_set_data_lines(dssdev, ddata->data_lines);
> +
> +	r = omapdss_dpi_display_enable(dssdev);
> +	if (r)
> +		goto err0;
> +
> +	if (gpio_is_valid(ddata->pd_gpio))
> +		gpio_set_value_cansleep(ddata->pd_gpio, 1);
> +
> +	return 0;
> +err0:
> +	return r;
>   }
>
>   static int tfp410_enable(struct omap_dss_device *dssdev)
>   {
> -	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
>   	int r;
>
>   	mutex_lock(&ddata->lock);
> @@ -176,9 +210,22 @@ static int tfp410_enable(struct omap_dss_device *dssdev)
>   	return r;
>   }
>
> +static void tfp410_power_off(struct omap_dss_device *dssdev)
> +{
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +
> +	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
> +		return;
> +
> +	if (gpio_is_valid(ddata->pd_gpio))
> +		gpio_set_value_cansleep(ddata->pd_gpio, 0);
> +
> +	omapdss_dpi_display_disable(dssdev);
> +}
> +
>   static void tfp410_disable(struct omap_dss_device *dssdev)
>   {
> -	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
>
>   	mutex_lock(&ddata->lock);
>
> @@ -192,18 +239,19 @@ static void tfp410_disable(struct omap_dss_device *dssdev)
>   static void tfp410_set_timings(struct omap_dss_device *dssdev,
>   		struct omap_video_timings *timings)
>   {
> -	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
>
>   	mutex_lock(&ddata->lock);
>   	omapdss_dpi_set_timings(dssdev, timings);
>   	dssdev->panel.timings = *timings;
> +	ddata->timings = *timings;
>   	mutex_unlock(&ddata->lock);
>   }
>
>   static void tfp410_get_timings(struct omap_dss_device *dssdev,
>   		struct omap_video_timings *timings)
>   {
> -	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
>
>   	mutex_lock(&ddata->lock);
>   	*timings = dssdev->panel.timings;
> @@ -213,7 +261,7 @@ static void tfp410_get_timings(struct omap_dss_device *dssdev,
>   static int tfp410_check_timings(struct omap_dss_device *dssdev,
>   		struct omap_video_timings *timings)
>   {
> -	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
>   	int r;
>
>   	mutex_lock(&ddata->lock);
> @@ -258,7 +306,7 @@ static int tfp410_ddc_read(struct i2c_adapter *adapter,
>   static int tfp410_read_edid(struct omap_dss_device *dssdev,
>   		u8 *edid, int len)
>   {
> -	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
>   	int r, l, bytes_read;
>
>   	mutex_lock(&ddata->lock);
> @@ -298,7 +346,7 @@ err:
>
>   static bool tfp410_detect(struct omap_dss_device *dssdev)
>   {
> -	struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> +	struct panel_drv_data *ddata = to_panel_data(dssdev);
>   	unsigned char out;
>   	int r;
>
> @@ -319,9 +367,6 @@ out:
>   }
>
>   static struct omap_dss_driver tfp410_driver = {
> -	.probe		= tfp410_probe,
> -	.remove		= __exit_p(tfp410_remove),
> -
>   	.enable		= tfp410_enable,
>   	.disable	= tfp410_disable,
>
> @@ -329,23 +374,29 @@ static struct omap_dss_driver tfp410_driver = {
>   	.get_timings	= tfp410_get_timings,
>   	.check_timings	= tfp410_check_timings,
>
> +	.get_resolution	= omapdss_default_get_resolution,
> +
>   	.read_edid	= tfp410_read_edid,
>   	.detect		= tfp410_detect,
> +};
>
> -	.driver         = {
> -		.name   = "tfp410",
> -		.owner  = THIS_MODULE,
> +static struct platform_driver tfp410_platform_driver = {
> +	.probe	= tfp410_probe,
> +	.remove	= __exit_p(tfp410_remove),
> +	.driver	= {
> +		.name	= "tfp410",
> +		.owner	= THIS_MODULE,
>   	},
>   };
>
>   static int __init tfp410_init(void)
>   {
> -	return omap_dss_register_driver(&tfp410_driver);
> +	return platform_driver_register(&tfp410_platform_driver);
>   }
>
>   static void __exit tfp410_exit(void)
>   {
> -	omap_dss_unregister_driver(&tfp410_driver);
> +	platform_driver_unregister(&tfp410_platform_driver);
>   }
>
>   module_init(tfp410_init);
>


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

* Re: [PATCH 16/26] OMAPDSS: TFP410: convert to platform device
  2013-03-27 11:14     ` Tomi Valkeinen
@ 2013-03-27 11:29       ` Archit Taneja
  0 siblings, 0 replies; 34+ messages in thread
From: Archit Taneja @ 2013-03-27 11:29 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev

On Wednesday 27 March 2013 04:44 PM, Tomi Valkeinen wrote:
> On 2013-03-27 13:11, Archit Taneja wrote:
>> On Tuesday 26 March 2013 07:03 PM, Tomi Valkeinen wrote:
>>> Convert TFP410 driver from omap_dss_driver to a platform driver. The
>>> driver uses the new panel support from omapdss.
>>>
>>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>>> ---
>>>    drivers/video/omap2/displays/panel-tfp410.c |  205
>>> +++++++++++++++++----------
>>>    1 file changed, 128 insertions(+), 77 deletions(-)
>>>
>
>>> -        ddata->i2c_adapter = adapter;
>>> +    dssdev = &ddata->dssdev;
>>> +    dssdev->driver = &tfp410_driver;
>>> +    dssdev->panel.timings = tfp410_default_timings;
>>> +    dssdev->name = ddata->name;
>>> +    dssdev->phy.dpi.data_lines = ddata->data_lines;
>>> +    dssdev->panel_dev = &pdev->dev;
>>
>> Some of the omap_dss_device fields populated here(like data_lines) are
>> not going to be used anywhere. Are you populating all of them just for
>> the sake of clarity, so that they can be removed in another series later
>> on? Or is there some other reason?
>
> Unfortunately the datalines are used in
> omapdss_default_get_recommended_bpp(). So there are some fields
> populated just to keep things working, and I expect that they are
> removed later.

Ah okay, missed that. I guess it will be easier to remove these later on 
anyway.

Archit


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

* Re: [PATCH 00/26] DSS device model change
  2013-03-27  6:13   ` Tomi Valkeinen
@ 2013-03-27 20:25     ` Tony Lindgren
  0 siblings, 0 replies; 34+ messages in thread
From: Tony Lindgren @ 2013-03-27 20:25 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev, Archit Taneja

* Tomi Valkeinen <tomi.valkeinen@ti.com> [130326 23:18]:
> On 2013-03-26 19:10, Tony Lindgren wrote:
> > * Tomi Valkeinen <tomi.valkeinen@ti.com> [130326 06:38]:
> >> Note about board files: I only convert a few board files here for example. I
> >> have a branch with board file changes for all the affected board files. I did
> >> not include them as they are more or less identical. If this series looks good,
> >> I will create an independent branch for the arch/arm stuff, so it can be pulled
> >> separately.
> > 
> > Great looks good to me thanks.
> 
> To make the DSS work properly after this device model change, we also
> need to solve the problem related to multiple display devices on the
> same video bus.
> 
> Did the approach I suggested in
> 
> http://permalink.gmane.org/gmane.linux.ports.arm.omap/96039
> 
> look ok? Overo is the most complex one, I think the rest of the boards
> that require changes have just LCD and DVI that conflict. But it still
> means we'll have that kind of choice Kconfig option for all those boards.

Yes I think that's the best way to go until we just drop the board-*.c
files in favor of device tree.

Regards,

Tony

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

end of thread, other threads:[~2013-03-27 20:25 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-26 13:33 [PATCH 00/26] DSS device model change Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 01/26] OMAPDSS: only probe pdata if there's one Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 02/26] OMAPDSS: add omap_dss_find_output() Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 03/26] OMAPDSS: add omap_dss_find_output_by_node() Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 04/26] OMAPDSS: fix dss_get_ctx_loss_count for DT Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 05/26] OMAPDSS: DPI: fix regulators Tomi Valkeinen
2013-03-27  9:57   ` Archit Taneja
2013-03-26 13:33 ` [PATCH 06/26] OMAPDSS: SDI: " Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 07/26] OMAPDSS: add panel list Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 08/26] OMAPDSS: use the panel list in omap_dss_get_next_device Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 09/26] OMAPDSS: don't use dss bus in suspend/resume Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 10/26] OMAPDSS: implement display sysfs without dss bus Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 11/26] OMAPDSS: Add panel_dev pointer to dssdev Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 12/26] OMAPDSS: DPI: new panel registration Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 13/26] OMAPDSS: DSI: " Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 14/26] OMAPDSS: HDMI: " Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 15/26] OMAPDSS: TFP410 platform_data changes Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 16/26] OMAPDSS: TFP410: convert to platform device Tomi Valkeinen
2013-03-27 11:23   ` Archit Taneja
2013-03-27 11:14     ` Tomi Valkeinen
2013-03-27 11:29       ` Archit Taneja
2013-03-26 13:33 ` [PATCH 17/26] OMAPDSS: generic-dpi-panel platform_data changes Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 18/26] OMAPDSS: panel-generic-dpi: convert to platform device Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 19/26] OMAPDSS: HDMI: " Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 20/26] OMAPDSS: Taal platform_data changes Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 21/26] OMAPDSS: Taal: convert to platform device Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 22/26] ARM: OMAP: Panda: use new TFP410 platform driver Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 23/26] ARM: OMAP: Panda & SDP: use new HDMI driver Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 24/26] ARM: OMAP: 4430SDP: use new Taal driver Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 25/26] ARM: OMAP: Overo: use new TFP410 platform driver Tomi Valkeinen
2013-03-26 13:33 ` [PATCH 26/26] ARM: OMAP: Overo: use new generic-dpi-panel " Tomi Valkeinen
2013-03-26 17:10 ` [PATCH 00/26] DSS device model change Tony Lindgren
2013-03-27  6:13   ` Tomi Valkeinen
2013-03-27 20:25     ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).