All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sumit Semwal <sumit.semwal@ti.com>
To: tomi.valkeinen@nokia.com, paul@pwsan.com, khilman@ti.com,
	hvaibhav@ti.com, linux-omap@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	Senthilvadivu Guruswamy <svadivu@ti.com>,
	Sumit Semwal <sumit.semwal@ti.com>
Subject: [PATCH v10 10/18] OMAP2,3: DSS2: DSS: create platform_driver, move init,exit to driver
Date: Mon, 24 Jan 2011 11:51:57 +0530	[thread overview]
Message-ID: <1295850125-21405-11-git-send-email-sumit.semwal@ti.com> (raw)
In-Reply-To: <1295850125-21405-1-git-send-email-sumit.semwal@ti.com>

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Hwmod adaptation design requires each of the DSS HW IP to be a platform driver.
So a platform_driver of DSS is created and init exit methods are moved from core.c
to its driver probe,remove. pdev member has to be maintained by its own drivers.

DSS platform driver is registered from inside omap_dss_probe, in the order desired.

Reviewed-by: Kevin Hilman <khilman@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
Signed-off-by: Sumit Semwal <sumit.semwal@ti.com>
---
 drivers/video/omap2/dss/core.c |   19 ++++++-------
 drivers/video/omap2/dss/dss.c  |   55 ++++++++++++++++++++++++++++++++++++++-
 drivers/video/omap2/dss/dss.h  |    4 +-
 3 files changed, 64 insertions(+), 14 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 1bbc004..1aace9e 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -517,15 +517,9 @@ static int omap_dss_probe(struct platform_device *pdev)
 	core.ctx_id = dss_get_ctx_id();
 	DSSDBG("initial ctx id %u\n", core.ctx_id);
 
-#ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT
-	/* DISPC_CONTROL */
-	if (omap_readl(0x48050440) & 1)	/* LCD enabled? */
-		skip_init = 1;
-#endif
-
-	r = dss_init(skip_init);
+	r = dss_init_platform_driver();
 	if (r) {
-		DSSERR("Failed to initialize DSS\n");
+		DSSERR("Failed to initialize DSS platform driver\n");
 		goto err_dss;
 	}
 
@@ -553,6 +547,11 @@ static int omap_dss_probe(struct platform_device *pdev)
 		goto err_venc;
 	}
 
+#ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT
+	/* DISPC_CONTROL */
+	if (omap_readl(0x48050440) & 1)	/* LCD enabled? */
+		skip_init = 1;
+#endif
 	if (cpu_is_omap34xx()) {
 		r = sdi_init(skip_init);
 		if (r) {
@@ -610,7 +609,7 @@ err_dispc:
 err_dpi:
 	rfbi_exit();
 err_rfbi:
-	dss_exit();
+	dss_uninit_platform_driver();
 err_dss:
 	dss_clk_disable_all_no_ctx();
 	dss_put_clocks();
@@ -635,7 +634,7 @@ static int omap_dss_remove(struct platform_device *pdev)
 		sdi_exit();
 	}
 
-	dss_exit();
+	dss_uninit_platform_driver();
 
 	/*
 	 * As part of hwmod changes, DSS is not the only controller of dss
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 77c3621..d130f04 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -59,6 +59,7 @@ struct dss_reg {
 	dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end))
 
 static struct {
+	struct platform_device *pdev;
 	void __iomem    *base;
 
 	struct clk	*dpll4_m4_ck;
@@ -549,7 +550,7 @@ void dss_set_dac_pwrdn_bgz(bool enable)
 	REG_FLD_MOD(DSS_CONTROL, enable, 5, 5);	/* DAC Power-Down Control */
 }
 
-int dss_init(bool skip_init)
+static int dss_init(bool skip_init)
 {
 	int r;
 	u32 rev;
@@ -629,7 +630,7 @@ fail0:
 	return r;
 }
 
-void dss_exit(void)
+static void dss_exit(void)
 {
 	if (cpu_is_omap34xx())
 		clk_put(dss.dpll4_m4_ck);
@@ -639,3 +640,53 @@ void dss_exit(void)
 	iounmap(dss.base);
 }
 
+/* DSS HW IP initialisation */
+static int omap_dsshw_probe(struct platform_device *pdev)
+{
+	int r;
+	int skip_init = 0;
+
+	dss.pdev = pdev;
+
+#ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT
+	/* DISPC_CONTROL */
+	if (omap_readl(0x48050440) & 1)	/* LCD enabled? */
+		skip_init = 1;
+#endif
+
+	r = dss_init(skip_init);
+	if (r) {
+		DSSERR("Failed to initialize DSS\n");
+		goto err_dss;
+	}
+
+err_dss:
+
+	return r;
+}
+
+static int omap_dsshw_remove(struct platform_device *pdev)
+{
+	dss_exit();
+
+	return 0;
+}
+
+static struct platform_driver omap_dsshw_driver = {
+	.probe          = omap_dsshw_probe,
+	.remove         = omap_dsshw_remove,
+	.driver         = {
+		.name   = "omap_dss",
+		.owner  = THIS_MODULE,
+	},
+};
+
+int dss_init_platform_driver(void)
+{
+	return platform_driver_register(&omap_dsshw_driver);
+}
+
+void dss_uninit_platform_driver(void)
+{
+	return platform_driver_unregister(&omap_dsshw_driver);
+}
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index b394951..37c4544 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -214,8 +214,8 @@ void dss_overlay_setup_l4_manager(struct omap_overlay_manager *mgr);
 void dss_recheck_connections(struct omap_dss_device *dssdev, bool force);
 
 /* DSS */
-int dss_init(bool skip_init);
-void dss_exit(void);
+int dss_init_platform_driver(void);
+void dss_uninit_platform_driver(void);
 
 void dss_save_context(void);
 void dss_restore_context(void);
-- 
1.7.1


WARNING: multiple messages have this Message-ID (diff)
From: sumit.semwal@ti.com (Sumit Semwal)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v10 10/18] OMAP2, 3: DSS2: DSS: create platform_driver, move init, exit to driver
Date: Mon, 24 Jan 2011 11:51:57 +0530	[thread overview]
Message-ID: <1295850125-21405-11-git-send-email-sumit.semwal@ti.com> (raw)
In-Reply-To: <1295850125-21405-1-git-send-email-sumit.semwal@ti.com>

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Hwmod adaptation design requires each of the DSS HW IP to be a platform driver.
So a platform_driver of DSS is created and init exit methods are moved from core.c
to its driver probe,remove. pdev member has to be maintained by its own drivers.

DSS platform driver is registered from inside omap_dss_probe, in the order desired.

Reviewed-by: Kevin Hilman <khilman@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
Signed-off-by: Sumit Semwal <sumit.semwal@ti.com>
---
 drivers/video/omap2/dss/core.c |   19 ++++++-------
 drivers/video/omap2/dss/dss.c  |   55 ++++++++++++++++++++++++++++++++++++++-
 drivers/video/omap2/dss/dss.h  |    4 +-
 3 files changed, 64 insertions(+), 14 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 1bbc004..1aace9e 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -517,15 +517,9 @@ static int omap_dss_probe(struct platform_device *pdev)
 	core.ctx_id = dss_get_ctx_id();
 	DSSDBG("initial ctx id %u\n", core.ctx_id);
 
-#ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT
-	/* DISPC_CONTROL */
-	if (omap_readl(0x48050440) & 1)	/* LCD enabled? */
-		skip_init = 1;
-#endif
-
-	r = dss_init(skip_init);
+	r = dss_init_platform_driver();
 	if (r) {
-		DSSERR("Failed to initialize DSS\n");
+		DSSERR("Failed to initialize DSS platform driver\n");
 		goto err_dss;
 	}
 
@@ -553,6 +547,11 @@ static int omap_dss_probe(struct platform_device *pdev)
 		goto err_venc;
 	}
 
+#ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT
+	/* DISPC_CONTROL */
+	if (omap_readl(0x48050440) & 1)	/* LCD enabled? */
+		skip_init = 1;
+#endif
 	if (cpu_is_omap34xx()) {
 		r = sdi_init(skip_init);
 		if (r) {
@@ -610,7 +609,7 @@ err_dispc:
 err_dpi:
 	rfbi_exit();
 err_rfbi:
-	dss_exit();
+	dss_uninit_platform_driver();
 err_dss:
 	dss_clk_disable_all_no_ctx();
 	dss_put_clocks();
@@ -635,7 +634,7 @@ static int omap_dss_remove(struct platform_device *pdev)
 		sdi_exit();
 	}
 
-	dss_exit();
+	dss_uninit_platform_driver();
 
 	/*
 	 * As part of hwmod changes, DSS is not the only controller of dss
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 77c3621..d130f04 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -59,6 +59,7 @@ struct dss_reg {
 	dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end))
 
 static struct {
+	struct platform_device *pdev;
 	void __iomem    *base;
 
 	struct clk	*dpll4_m4_ck;
@@ -549,7 +550,7 @@ void dss_set_dac_pwrdn_bgz(bool enable)
 	REG_FLD_MOD(DSS_CONTROL, enable, 5, 5);	/* DAC Power-Down Control */
 }
 
-int dss_init(bool skip_init)
+static int dss_init(bool skip_init)
 {
 	int r;
 	u32 rev;
@@ -629,7 +630,7 @@ fail0:
 	return r;
 }
 
-void dss_exit(void)
+static void dss_exit(void)
 {
 	if (cpu_is_omap34xx())
 		clk_put(dss.dpll4_m4_ck);
@@ -639,3 +640,53 @@ void dss_exit(void)
 	iounmap(dss.base);
 }
 
+/* DSS HW IP initialisation */
+static int omap_dsshw_probe(struct platform_device *pdev)
+{
+	int r;
+	int skip_init = 0;
+
+	dss.pdev = pdev;
+
+#ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT
+	/* DISPC_CONTROL */
+	if (omap_readl(0x48050440) & 1)	/* LCD enabled? */
+		skip_init = 1;
+#endif
+
+	r = dss_init(skip_init);
+	if (r) {
+		DSSERR("Failed to initialize DSS\n");
+		goto err_dss;
+	}
+
+err_dss:
+
+	return r;
+}
+
+static int omap_dsshw_remove(struct platform_device *pdev)
+{
+	dss_exit();
+
+	return 0;
+}
+
+static struct platform_driver omap_dsshw_driver = {
+	.probe          = omap_dsshw_probe,
+	.remove         = omap_dsshw_remove,
+	.driver         = {
+		.name   = "omap_dss",
+		.owner  = THIS_MODULE,
+	},
+};
+
+int dss_init_platform_driver(void)
+{
+	return platform_driver_register(&omap_dsshw_driver);
+}
+
+void dss_uninit_platform_driver(void)
+{
+	return platform_driver_unregister(&omap_dsshw_driver);
+}
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index b394951..37c4544 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -214,8 +214,8 @@ void dss_overlay_setup_l4_manager(struct omap_overlay_manager *mgr);
 void dss_recheck_connections(struct omap_dss_device *dssdev, bool force);
 
 /* DSS */
-int dss_init(bool skip_init);
-void dss_exit(void);
+int dss_init_platform_driver(void);
+void dss_uninit_platform_driver(void);
 
 void dss_save_context(void);
 void dss_restore_context(void);
-- 
1.7.1

  parent reply	other threads:[~2011-01-24  6:23 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24  6:21 [PATCH v10 00/18] OMAP2,3: hwmod DSS Adaptation Sumit Semwal
2011-01-24  6:21 ` Sumit Semwal
2011-01-24  6:21 ` [PATCH v10 01/18] OMAP2,3: DSS2: remove forced clk-disable from omap_dss_remove Sumit Semwal
2011-01-24  6:21   ` [PATCH v10 01/18] OMAP2, 3: " Sumit Semwal
2011-01-24  6:21 ` [PATCH v10 02/18] OMAP2420: hwmod data: add DSS DISPC RFBI VENC Sumit Semwal
2011-01-24  6:21   ` Sumit Semwal
2011-01-24  6:21 ` [PATCH v10 03/18] OMAP2430: " Sumit Semwal
2011-01-24  6:21   ` Sumit Semwal
2011-01-24  6:21 ` [PATCH v10 04/18] OMAP3: hwmod data: add DSS DISPC RFBI DSI VENC Sumit Semwal
2011-01-24  6:21   ` Sumit Semwal
2011-01-24  6:21 ` [PATCH v10 05/18] OMAP2,3 DSS2 Change driver name to omap_display Sumit Semwal
2011-01-24  6:21   ` Sumit Semwal
2011-02-24  9:27   ` Tomi Valkeinen
2011-02-24  9:27     ` Tomi Valkeinen
2011-02-28  6:53     ` Tomi Valkeinen
2011-02-28  6:53       ` Tomi Valkeinen
2011-02-28  7:09       ` archit taneja
2011-02-28  7:09         ` [PATCH v10 05/18] OMAP2, 3 " archit taneja
2011-02-28  7:19         ` [PATCH v10 05/18] OMAP2,3 " Tomi Valkeinen
2011-02-28  7:19           ` Tomi Valkeinen
2011-02-28  7:27           ` archit taneja
2011-02-28  7:27             ` [PATCH v10 05/18] OMAP2, 3 " archit taneja
2011-02-28  8:16             ` [PATCH v10 05/18] OMAP2,3 " Semwal, Sumit
2011-02-28  8:16               ` [PATCH v10 05/18] OMAP2, 3 " Semwal, Sumit
2011-02-28  8:29               ` [PATCH v10 05/18] OMAP2,3 " Tomi Valkeinen
2011-02-28  8:29                 ` Tomi Valkeinen
2011-02-28 11:36           ` Cousson, Benoit
2011-02-28 11:36             ` [PATCH v10 05/18] OMAP2, 3 " Cousson, Benoit
2011-02-28 12:10             ` [PATCH v10 05/18] OMAP2,3 " Tomi Valkeinen
2011-02-28 12:10               ` Tomi Valkeinen
2011-02-28 12:13               ` Russell King - ARM Linux
2011-02-28 12:13                 ` Russell King - ARM Linux
2011-02-28 13:38                 ` Cousson, Benoit
2011-02-28 13:38                   ` [PATCH v10 05/18] OMAP2, 3 " Cousson, Benoit
2011-02-28 14:06                   ` [PATCH v10 05/18] OMAP2,3 " Russell King - ARM Linux
2011-02-28 14:06                     ` Russell King - ARM Linux
2011-02-28 14:55                     ` Cousson, Benoit
2011-02-28 14:55                       ` [PATCH v10 05/18] OMAP2, 3 " Cousson, Benoit
2011-02-28 14:00               ` [PATCH v10 05/18] OMAP2,3 " Cousson, Benoit
2011-02-28 14:00                 ` [PATCH v10 05/18] OMAP2, 3 " Cousson, Benoit
2011-02-28 14:57                 ` [PATCH v10 05/18] OMAP2,3 " Tomi Valkeinen
2011-02-28 14:57                   ` Tomi Valkeinen
2011-03-01 10:18                   ` Cousson, Benoit
2011-03-01 10:18                     ` [PATCH v10 05/18] OMAP2, 3 " Cousson, Benoit
2011-01-24  6:21 ` [PATCH v10 06/18] OMAP2,3 DSS2 Use Regulator init with driver name Sumit Semwal
2011-01-24  6:21   ` Sumit Semwal
2011-01-24  6:21 ` [PATCH v10 07/18] OMAP2,3: DSS2: Create new file display.c for central dss driver registration Sumit Semwal
2011-01-24  6:21   ` [PATCH v10 07/18] OMAP2, 3: " Sumit Semwal
2011-01-24  6:21 ` [PATCH v10 08/18] OMAP2,3: DSS2: board files: replace platform_device_register with omap_display_init() Sumit Semwal
2011-01-24  6:21   ` [PATCH v10 08/18] OMAP2, 3: " Sumit Semwal
2011-01-24  6:21 ` [PATCH v10 09/18] OMAP2,3: DSS2: Build omap_device for each DSS HWIP Sumit Semwal
2011-01-24  6:21   ` Sumit Semwal
2011-01-24  6:21 ` Sumit Semwal [this message]
2011-01-24  6:21   ` [PATCH v10 10/18] OMAP2, 3: DSS2: DSS: create platform_driver, move init, exit to driver Sumit Semwal
2011-01-24  6:21 ` [PATCH v10 11/18] OMAP2,3: DSS2: Move clocks from core driver to dss driver Sumit Semwal
2011-01-24  6:21   ` [PATCH v10 11/18] OMAP2, 3: " Sumit Semwal
2011-01-24  6:21 ` [PATCH v10 12/18] OMAP2,3: DSS2: RFBI: create platform_driver, move init,exit to driver Sumit Semwal
2011-01-24  6:21   ` [PATCH v10 12/18] OMAP2, 3: DSS2: RFBI: create platform_driver, move init, exit " Sumit Semwal
2011-01-24  6:22 ` [PATCH v10 13/18] OMAP2,3: DSS2: DISPC: create platform_driver, move init,exit " Sumit Semwal
2011-01-24  6:22   ` [PATCH v10 13/18] OMAP2, 3: DSS2: DISPC: create platform_driver, move init, exit " Sumit Semwal
2011-01-24  6:22 ` [PATCH v10 14/18] OMAP2,3: DSS2: VENC: create platform_driver, move init,exit " Sumit Semwal
2011-01-24  6:22   ` [PATCH v10 14/18] OMAP2, 3: DSS2: VENC: create platform_driver, move init, exit " Sumit Semwal
2011-01-24  6:22 ` [PATCH v10 15/18] OMAP2,3: DSS2: DSI: create platform_driver, move init,exit " Sumit Semwal
2011-01-24  6:22   ` [PATCH v10 15/18] OMAP2, 3: DSS2: DSI: create platform_driver, move init, exit " Sumit Semwal
2011-01-24  6:22 ` [PATCH v10 16/18] OMAP2,3: DSS2: replace printk with dev_dbg in init Sumit Semwal
2011-01-24  6:22   ` Sumit Semwal
2011-01-24  6:22 ` [PATCH v10 17/18] OMAP2,3: DSS2: Use platform device to get baseaddr Sumit Semwal
2011-01-24  6:22   ` Sumit Semwal
2011-01-24  6:22 ` [PATCH v10 18/18] OMAP2,3: DSS2: Get DSS IRQ from platform device Sumit Semwal
2011-01-24  6:22   ` Sumit Semwal
2011-01-27 12:49   ` Raghuveer Murthy
2011-01-27 12:49     ` [PATCH v10 18/18] OMAP2, 3: " Raghuveer Murthy
2011-01-27 12:59     ` Russell King - ARM Linux
2011-01-27 12:59       ` Russell King - ARM Linux
2011-01-27 13:04       ` Raghuveer Murthy
2011-01-27 13:04         ` Raghuveer Murthy
2011-01-27 15:23         ` Semwal, Sumit
2011-01-27 15:23           ` Semwal, Sumit
2011-02-14 14:09   ` [PATCH v10 18/18] OMAP2,3: " Tomi Valkeinen
2011-02-14 14:09     ` Tomi Valkeinen
2011-02-14 18:35     ` Semwal, Sumit
2011-02-14 18:35       ` [PATCH v10 18/18] OMAP2, 3: " Semwal, Sumit
2011-01-24 21:57 ` [PATCH v10 00/18] OMAP2,3: hwmod DSS Adaptation Kevin Hilman
2011-01-24 21:57   ` Kevin Hilman
2011-01-25 17:03   ` Tony Lindgren
2011-01-25 17:03     ` Tony Lindgren
2011-01-28 12:01     ` Tomi Valkeinen
2011-01-28 12:01       ` Tomi Valkeinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1295850125-21405-11-git-send-email-sumit.semwal@ti.com \
    --to=sumit.semwal@ti.com \
    --cc=hvaibhav@ti.com \
    --cc=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.com \
    --cc=svadivu@ti.com \
    --cc=tomi.valkeinen@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.