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: Senthilvadivu Guruswamy <svadivu@ti.com>,
	Sumit Semwal <sumit.semwal@ti.com>
Subject: [PATCH v8 13/18] OMAP2,3: DSS2: DISPC: create platform_driver, move init,exit to driver
Date: Fri, 21 Jan 2011 20:20:36 +0530	[thread overview]
Message-ID: <1295621441-16678-14-git-send-email-sumit.semwal@ti.com> (raw)
In-Reply-To: <1295621441-16678-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 for DISPC 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.

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

Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
Signed-off-by: Sumit Semwal <sumit.semwal@ti.com>
---
 drivers/video/omap2/dss/core.c  |    8 ++--
 drivers/video/omap2/dss/dispc.c |  105 ++++++++++++++++++++++++---------------
 drivers/video/omap2/dss/dss.h   |    4 +-
 3 files changed, 70 insertions(+), 47 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index d4b3da3..5acb5e6 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -213,9 +213,9 @@ static int omap_dss_probe(struct platform_device *pdev)
 		goto err_dpi;
 	}
 
-	r = dispc_init();
+	r = dispc_init_platform_driver();
 	if (r) {
-		DSSERR("Failed to initialize dispc\n");
+		DSSERR("Failed to initialize dispc platform driver\n");
 		goto err_dispc;
 	}
 
@@ -281,7 +281,7 @@ err_dsi:
 err_sdi:
 	venc_exit();
 err_venc:
-	dispc_exit();
+	dispc_uninit_platform_driver();
 err_dispc:
 	dpi_exit();
 err_dpi:
@@ -301,7 +301,7 @@ static int omap_dss_remove(struct platform_device *pdev)
 	dss_uninitialize_debugfs();
 
 	venc_exit();
-	dispc_exit();
+	dispc_uninit_platform_driver();
 	dpi_exit();
 	rfbi_uninit_platform_driver();
 	if (cpu_is_omap34xx()) {
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 9f8c69f..abfed47 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -178,6 +178,7 @@ struct dispc_irq_stats {
 };
 
 static struct {
+	struct platform_device *pdev;
 	void __iomem    *base;
 
 	u32	fifo_size[3];
@@ -3269,47 +3270,6 @@ static void _omap_dispc_initial_config(void)
 	dispc_read_plane_fifo_sizes();
 }
 
-int dispc_init(void)
-{
-	u32 rev;
-
-	spin_lock_init(&dispc.irq_lock);
-
-#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
-	spin_lock_init(&dispc.irq_stats_lock);
-	dispc.irq_stats.last_reset = jiffies;
-#endif
-
-	INIT_WORK(&dispc.error_work, dispc_error_worker);
-
-	dispc.base = ioremap(DISPC_BASE, DISPC_SZ_REGS);
-	if (!dispc.base) {
-		DSSERR("can't ioremap DISPC\n");
-		return -ENOMEM;
-	}
-
-	enable_clocks(1);
-
-	_omap_dispc_initial_config();
-
-	_omap_dispc_initialize_irq();
-
-	dispc_save_context();
-
-	rev = dispc_read_reg(DISPC_REVISION);
-	printk(KERN_INFO "OMAP DISPC rev %d.%d\n",
-	       FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0));
-
-	enable_clocks(0);
-
-	return 0;
-}
-
-void dispc_exit(void)
-{
-	iounmap(dispc.base);
-}
-
 int dispc_enable_plane(enum omap_plane plane, bool enable)
 {
 	DSSDBG("dispc_enable_plane %d, %d\n", plane, enable);
@@ -3359,3 +3319,66 @@ int dispc_setup_plane(enum omap_plane plane,
 
 	return r;
 }
+
+/* DISPC HW IP initialisation */
+static int omap_dispchw_probe(struct platform_device *pdev)
+{
+	u32 rev;
+	dispc.pdev = pdev;
+
+	spin_lock_init(&dispc.irq_lock);
+
+#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
+	spin_lock_init(&dispc.irq_stats_lock);
+	dispc.irq_stats.last_reset = jiffies;
+#endif
+
+	INIT_WORK(&dispc.error_work, dispc_error_worker);
+
+	dispc.base = ioremap(DISPC_BASE, DISPC_SZ_REGS);
+	if (!dispc.base) {
+		DSSERR("can't ioremap DISPC\n");
+		return -ENOMEM;
+	}
+
+	enable_clocks(1);
+
+	_omap_dispc_initial_config();
+
+	_omap_dispc_initialize_irq();
+
+	dispc_save_context();
+
+	rev = dispc_read_reg(DISPC_REVISION);
+	printk(KERN_INFO "OMAP DISPC rev %d.%d\n",
+	       FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0));
+
+	enable_clocks(0);
+
+	return 0;
+}
+
+static int omap_dispchw_remove(struct platform_device *pdev)
+{
+	iounmap(dispc.base);
+	return 0;
+}
+
+static struct platform_driver omap_dispchw_driver = {
+	.probe          = omap_dispchw_probe,
+	.remove         = omap_dispchw_remove,
+	.driver         = {
+		.name   = "omap_dispc",
+		.owner  = THIS_MODULE,
+	},
+};
+
+int dispc_init_platform_driver(void)
+{
+	return platform_driver_register(&omap_dispchw_driver);
+}
+
+void dispc_uninit_platform_driver(void)
+{
+	return platform_driver_unregister(&omap_dispchw_driver);
+}
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 0ba4bdb..f4835c8 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -319,8 +319,8 @@ static inline void dpi_exit(void)
 #endif
 
 /* DISPC */
-int dispc_init(void);
-void dispc_exit(void);
+int dispc_init_platform_driver(void);
+void dispc_uninit_platform_driver(void);
 void dispc_dump_clocks(struct seq_file *s);
 void dispc_dump_irqs(struct seq_file *s);
 void dispc_dump_regs(struct seq_file *s);
-- 
1.7.1


  parent reply	other threads:[~2011-01-21 14:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-21 14:50 [PATCH v8 00/18] OMAP2,3: hwmod DSS Adaptation Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 01/18] OMAP2,3: DSS2: remove forced clk-disable from omap_dss_remove Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 02/18] OMAP2420: hwmod data: add DSS DISPC RFBI VENC Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 03/18] OMAP2430: " Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 04/18] OMAP3: hwmod data: add DSS DISPC RFBI DSI VENC Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 05/18] OMAP2,3 DSS2 Change driver name to omap_display Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 06/18] OMAP2,3 DSS2 Use Regulator init with driver name Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 07/18] OMAP2,3: DSS2: Create new file display.c for central dss driver registration Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 08/18] OMAP2,3: DSS2: board files: replace platform_device_register with omap_display_init() Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 09/18] OMAP2,3: DSS2: Build omap_device for each DSS HWIP Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 10/18] OMAP2,3: DSS2: DSS: create platform_driver, move init,exit to driver Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 11/18] OMAP2,3: DSS2: Move clocks from core driver to dss driver Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 12/18] OMAP2,3: DSS2: RFBI: create platform_driver, move init,exit to driver Sumit Semwal
2011-01-21 14:50 ` Sumit Semwal [this message]
2011-01-21 14:50 ` [PATCH v8 14/18] OMAP2,3: DSS2: VENC: " Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 15/18] OMAP2,3: DSS2: DSI: " Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 16/18] OMAP2,3: DSS2: replace printk with dev_dbg in init Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 17/18] OMAP2,3: DSS2: Use platform device to get baseaddr Sumit Semwal
2011-01-21 14:50 ` [PATCH v8 18/18] OMAP2,3: DSS2: Get DSS IRQ from platform device Sumit Semwal
2011-01-21 16:35 ` [PATCH v8 00/18] OMAP2,3: hwmod DSS Adaptation Kevin Hilman
2011-01-22  5:32   ` Semwal, Sumit

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=1295621441-16678-14-git-send-email-sumit.semwal@ti.com \
    --to=sumit.semwal@ti.com \
    --cc=hvaibhav@ti.com \
    --cc=khilman@ti.com \
    --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.