All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 00/16] OMAP3: hwmod DSS Adaptation
@ 2010-10-06 11:14 Guruswamy Senthilvadivu
  2010-10-06 11:14 ` [PATCH v1 01/16] OMAP2420: hwmod data: add DSS DISPC RFBI VENC Guruswamy Senthilvadivu
  0 siblings, 1 reply; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Patch Base:
===========
url = git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git
branch "pm-core"
Commit id: 1dce15672f62296d059c44e70684600a2c80d3d0 
Description:  Merge branch 'pm-suspend' into pm-reset
----------------------------------------------------------------------------

v1 of the DSS HWMOD patch series focus on fixing the review comments and incorporating
TODO listed in the RFC patch of HWMOD adaptation to the current DSS
driver.

This patch series decouples the "Clocks for DSS in HWMOD adaptation" changes from
this series.  Another series would be posted which could be discussed w.r.t clocks
in DSS across omap2,3,4.

v1 patch series got delayed as we could not get a conclusion on the clock adaptation
across OMAP2,3,4, along with HWMOD hence decided to take up as a discussion in 
seperate series.

Summary of the HWMOD DSS design:
================================
DSS, DISPC, DSI, RFBI, VENC are made as platform drivers each 
corresponding to the HWMOD class in the HWMOD database. 

No Hardcoding of silicon data:
HWMOD database abstracts the SOC data like base addr, irq numbers and are
implemented in this patch series.

Continue to have custom bus for display panels:
"omapdss" driver continues to be a platform driver that registers the custom
bus.  It also continues to register the display panels(omap_dss_device) on the
board to the panel drivers (omap_dss_driver)
For Eg:  primary lcd device would be registered with lcd panel driver.
lcd panel driver if it is on a parallel interface would use library functions 
exported from dpi.o.  if it is on a dsi interface would use library functions
exported from dsi platform driver(dsi.o).

Clocks:
Handling of clocks in DSS only is one of the design approach, that does not
change the existing implementation.  If each of the DSS HW IPs had to handle
their own clocks, then corresponding clock changes are requested in the HWMOD
database as well which is not the present scenario.  As stated, this would be
handled in another series seperately.
For Eg: VENC would need 54MCLK which is termed as dss_opt clocks as of now apart
for the dss main clocks.  Currently VENC driver needs to be aware of this and has to
use clk_get/put, clk_enable/disable, since VENC HWMOD is not aware of 54MCLK.


Current dss driver:
-------------------
1.  Omapdss platform driver
        - initialises necessary Ips dss, dispc.
        - also initialises Ips like sdi, dsi, venc, rfbi
        - creates a custom bus and registers the display devices/drivers
        connected on the board to the custom bus.

2.  Suspend/resume of omapdss
        - in turn sends suspend/resume calls for each of the display devices
        registered to it.

Modified change:
---------------
Platform driver for each DSS HW IP in addition to the software "omapdss"
driver.

Omapdss platform driver
        - initialises necessary software libraries like dpi, sdi.
        - continues to have a custom bus and registers the display devices 
        and drivers connected on the board to the custom bus.
        - continues to handle suspend/resume of the display devices registered
        to the custom bus.

DSS platform driver
        - initialises DSS IP alone
	- Handles the clocks related to the DSS and other DSSHW IPs like RFBI,
	DSI, VENC, DISPC.  Previously this was a part of "omapdss" driver in core.c
	- Continues to handle the DSS IRQs.
	- No suspend/resume hooks.

DISPC platform driver
        - initialises DSS IP alone
	- Gets the required clock from DSS platform driver.
	- No suspend/resume hooks.
	- Continues to provide DISPC library functions.

DSI platform driver
        - initialises DSI IP alone
	- Gets the required clock from DSS platform driver.
	- No suspend/resume hooks.
	- Continues to provide DISPC library functions.

RFBI, VENC platform drivers
        - initialises DSI,VENC IPs
	- Gets the required clock from DSS platform driver.
	- No suspend/resume hooks.
	- Continues to provide DISPC library functions.

The patches are tested on OMAP3430 and 3630.

Changes since RFC:
------------------
1) All the platform driver registration except DSS, were within the file core.c.
Registeration of these driver got seperated to its own file.
2) Usage of regulators by different drivers are implemented.
For Eg: Regulator used by VENC is moved to venc driver.  But vdda_dac would be 
needed by DPI and DSI as well.
4) OMAP2420 and OMAP2430 HWMOD database are generated in this v1.
5) Module support for omapdss driver can continue as the DSS HW IP specific platform
drivers are decoupled from omapdss driver.
6) Following review comments incorporated:
	Changed the HWMOD device name from "dss" to "dss_dss"
	Changed name of core driver from "omapdss" to "omapdisplay" as it deals with panels.
	Fixed comments on return values from platform_get_resource/irq functions.

TODO:
1.) SYSCONFIG of each of the dss HW IP has to be removed from the driver.
HWMOD framework is supposed to take care of it.  This change would be done in 
the next version of the patch series.
2.) Dynamically register for OMAP2,3,4 specific DSS HW IPs in devices.c

Senthilvadivu Guruswamy (16):
  OMAP2420: hwmod data: add DSS DISPC RFBI VENC
  OMAP2430: hwmod data: add DSS DISPC RFBI VENC
  OMAP3: hwmod data: add DSS DISPC RFBI DSI VENC
  OMAP3: hwmod data: change dss_hwmod to dss_dss_hwmod
  OMAP3 DSS Driver register moved to mach_omap2
  OMAP3: hwmod DSS: Build omap_device for each DSS HWIP
  OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP
  OMAP3: clock data: change dss driver name
  OMAP3: hwmod DSS: Move clocks from core driver to dss driver
  OMAP3: hwmod DSS: DSS Move init,exit to driver
  OMAP3: hwmod DSS: RFBI Move init,exit to driver
  OMAP3: hwmod DSS: DISPC Move init,exit to driver
  OMAP3: hwmod DSS: VENC Move init,exit to driver
  OMAP3: hwmod DSS: DSI Move init, exit to driver
  OMAP3: hwmod DSS: Use platform device to get baseaddr
  OMAP3: hwmod DSS: Get DSS IRQ from platform device

 arch/arm/mach-omap2/board-3430sdp.c        |   26 +--
 arch/arm/mach-omap2/clock3xxx_data.c       |   14 +-
 arch/arm/mach-omap2/devices.c              |   78 +++++
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |  278 +++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  278 +++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  333 +++++++++++++++++++++
 arch/arm/plat-omap/include/plat/display.h  |   14 +
 drivers/video/omap2/dss/core.c             |  447 +---------------------------
 drivers/video/omap2/dss/dispc.c            |   50 +++-
 drivers/video/omap2/dss/dsi.c              |   66 ++++-
 drivers/video/omap2/dss/dss.c              |  448 +++++++++++++++++++++++++++-
 drivers/video/omap2/dss/dss.h              |   14 +-
 drivers/video/omap2/dss/rfbi.c             |   51 +++-
 drivers/video/omap2/dss/venc.c             |   67 ++++-
 14 files changed, 1668 insertions(+), 496 deletions(-)


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

* [PATCH v1 01/16] OMAP2420: hwmod data: add DSS DISPC RFBI VENC
  2010-10-06 11:14 [PATCH v1 00/16] OMAP3: hwmod DSS Adaptation Guruswamy Senthilvadivu
@ 2010-10-06 11:14 ` Guruswamy Senthilvadivu
  2010-10-06 11:14   ` [PATCH v1 02/16] OMAP2430: " Guruswamy Senthilvadivu
  0 siblings, 1 reply; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Database generated for OMAP2420 Display Sub System.
---
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |  278 ++++++++++++++++++++++++++++
 1 files changed, 278 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 3cc768e..d3b4fd4 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -19,6 +19,7 @@
 #include "omap_hwmod_common_data.h"
 
 #include "prm-regbits-24xx.h"
+#include "cm-regbits-24xx.h"
 
 /*
  * OMAP2420 hardware module integration data
@@ -29,6 +30,10 @@
  * elsewhere.
  */
 
+static struct omap_hwmod omap2420_dss_hwmod;
+static struct omap_hwmod omap2420_dss_dispc_hwmod;
+static struct omap_hwmod omap2420_dss_rfbi_hwmod;
+static struct omap_hwmod omap2420_dss_venc_hwmod;
 static struct omap_hwmod omap2420_mpu_hwmod;
 static struct omap_hwmod omap2420_iva_hwmod;
 static struct omap_hwmod omap2420_l3_main_hwmod;
@@ -48,6 +53,13 @@ static struct omap_hwmod_ocp_if omap2420_mpu__l3_main = {
 	.user	= OCP_USER_MPU,
 };
 
+/* DSS -> l3 */
+static struct omap_hwmod_ocp_if omap2420_dss__l3 = {
+	.master		= &omap2420_dss_hwmod,
+	.slave		= &omap2420_l3_main_hwmod,
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* Slave interfaces on the L3 interconnect */
 static struct omap_hwmod_ocp_if *omap2420_l3_main_slaves[] = {
 	&omap2420_mpu__l3_main,
@@ -165,12 +177,278 @@ static struct omap_hwmod omap2420_iva_hwmod = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
 };
 
+/*
+ * 'dss' class
+ * display sub-system
+ */
+
+static struct omap_hwmod_class_sysconfig omap2420_dss_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+	.sysc_fields	= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap2420_dss_hwmod_class = {
+	.name = "dss",
+	.sysc = &omap2420_dss_sysc,
+};
+
+/* dss */
+static struct omap_hwmod_irq_info omap2420_dss_irqs[] = {
+	{ .irq = 25 },
+};
+
+static struct omap_hwmod_dma_info omap2420_dss_sdma_chs[] = {
+	{ .name = "dispc", .dma_req = 5 },
+};
+
+/* dss */
+/* dss master ports */
+static struct omap_hwmod_ocp_if *omap2420_dss_masters[] = {
+	&omap2420_dss__l3,
+};
+
+static struct omap_hwmod_addr_space omap2420_dss_addrs[] = {
+	{
+		.pa_start	= 0x48050000,
+		.pa_end		= 0x480503FF,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_core -> dss */
+static struct omap_hwmod_ocp_if omap2420_l4_core__dss = {
+	.master		= &omap2420_l4_core_hwmod,
+	.slave		= &omap2420_dss_hwmod,
+	.clk		= "dss_ick",
+	.addr		= omap2420_dss_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap2420_dss_addrs),
+	.user		= OCP_USER_MPU,
+};
+
+/* dss slave ports */
+static struct omap_hwmod_ocp_if *omap2420_dss_slaves[] = {
+	&omap2420_l4_core__dss,
+};
+
+static struct omap_hwmod_opt_clk dss_opt_clks[] = {
+	{ .role = "tv_clk", .clk = "dss_54m_fck" },
+	{ .role = "sys_clk", .clk = "dss2_fck" },
+};
+
+static struct omap_hwmod omap2420_dss_hwmod = {
+	.name		= "dss",
+	.class		= &omap2420_dss_hwmod_class,
+	.main_clk	= "dss1_fck", /* instead of dss_fck */
+	.mpu_irqs	= omap2420_dss_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap2420_dss_irqs),
+	.sdma_reqs	= omap2420_dss_sdma_chs,
+	.sdma_reqs_cnt	= ARRAY_SIZE(omap2420_dss_sdma_chs),
+
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_DSS1_SHIFT,
+			.module_offs = CORE_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_ST_DSS_SHIFT,
+		},
+	},
+	.opt_clks	= dss_opt_clks,
+	.opt_clks_cnt = ARRAY_SIZE(dss_opt_clks),
+	.slaves		= omap2420_dss_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_dss_slaves),
+	.masters	= omap2420_dss_masters,
+	.masters_cnt	= ARRAY_SIZE(omap2420_dss_masters),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
+/*
+ * 'dispc' class
+ * display controller
+ */
+
+static struct omap_hwmod_class_sysconfig omap2420_dispc_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE |
+			   SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+			   MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
+	.sysc_fields	= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap2420_dispc_hwmod_class = {
+	.name = "dispc",
+	.sysc = &omap2420_dispc_sysc,
+};
+
+static struct omap_hwmod_addr_space omap2420_dss_dispc_addrs[] = {
+	{
+		.pa_start	= 0x48050400,
+		.pa_end		= 0x480507FF,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_core -> dss_dispc */
+static struct omap_hwmod_ocp_if omap2420_l4_core__dss_dispc = {
+	.master		= &omap2420_l4_core_hwmod,
+	.slave		= &omap2420_dss_dispc_hwmod,
+	.clk		= "dss_ick",
+	.addr		= omap2420_dss_dispc_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap2420_dss_dispc_addrs),
+	.user		= OCP_USER_MPU,
+};
+
+/* dss_dispc slave ports */
+static struct omap_hwmod_ocp_if *omap2420_dss_dispc_slaves[] = {
+	&omap2420_l4_core__dss_dispc,
+};
+
+static struct omap_hwmod omap2420_dss_dispc_hwmod = {
+	.name		= "dss_dispc",
+	.class		= &omap2420_dispc_hwmod_class,
+	.main_clk	= "dss1_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_DSS1_SHIFT,
+			.module_offs = CORE_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_ST_DSS_SHIFT,
+		},
+	},
+	.slaves		= omap2420_dss_dispc_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_dss_dispc_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
+/*
+ * 'rfbi' class
+ * remote frame buffer interface
+ */
+
+static struct omap_hwmod_class_sysconfig omap2420_rfbi_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields	= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap2420_rfbi_hwmod_class = {
+	.name = "rfbi",
+	.sysc = &omap2420_rfbi_sysc,
+};
+
+static struct omap_hwmod_addr_space omap2420_dss_rfbi_addrs[] = {
+	{
+		.pa_start	= 0x48050800,
+		.pa_end		= 0x48050BFF,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_core -> dss_rfbi */
+static struct omap_hwmod_ocp_if omap2420_l4_core__dss_rfbi = {
+	.master		= &omap2420_l4_core_hwmod,
+	.slave		= &omap2420_dss_rfbi_hwmod,
+	.clk		= "dss_ick",
+	.addr		= omap2420_dss_rfbi_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap2420_dss_rfbi_addrs),
+	.user		= OCP_USER_MPU,
+};
+
+/* dss_rfbi slave ports */
+static struct omap_hwmod_ocp_if *omap2420_dss_rfbi_slaves[] = {
+	&omap2420_l4_core__dss_rfbi,
+};
+
+static struct omap_hwmod omap2420_dss_rfbi_hwmod = {
+	.name		= "dss_rfbi",
+	.class		= &omap2420_rfbi_hwmod_class,
+	.main_clk	= "dss1_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_DSS1_SHIFT,
+			.module_offs = CORE_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_ST_DSS_SHIFT,
+		},
+	},
+	.slaves		= omap2420_dss_rfbi_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_dss_rfbi_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
+/*
+ * 'venc' class
+ * video encoder
+ */
+
+static struct omap_hwmod_class omap2420_venc_hwmod_class = {
+	.name = "venc",
+};
+
+/* dss_venc */
+static struct omap_hwmod_addr_space omap2420_dss_venc_addrs[] = {
+	{
+		.pa_start	= 0x48050C00,
+		.pa_end		= 0x48050FFF,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_core -> dss_venc */
+static struct omap_hwmod_ocp_if omap2420_l4_core__dss_venc = {
+	.master		= &omap2420_l4_core_hwmod,
+	.slave		= &omap2420_dss_venc_hwmod,
+	.clk		= "dss_54m_fck",
+	.addr		= omap2420_dss_venc_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap2420_dss_venc_addrs),
+	.user		= OCP_USER_MPU,
+};
+
+/* dss_venc slave ports */
+static struct omap_hwmod_ocp_if *omap2420_dss_venc_slaves[] = {
+	&omap2420_l4_core__dss_venc,
+};
+
+static struct omap_hwmod omap2420_dss_venc_hwmod = {
+	.name		= "dss_venc",
+	.class		= &omap2420_venc_hwmod_class,
+	.main_clk	= "dss1_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_DSS1_SHIFT,
+			.module_offs = CORE_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_ST_DSS_SHIFT,
+		},
+	},
+	.slaves		= omap2420_dss_venc_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_dss_venc_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
 static __initdata struct omap_hwmod *omap2420_hwmods[] = {
 	&omap2420_l3_main_hwmod,
 	&omap2420_l4_core_hwmod,
 	&omap2420_l4_wkup_hwmod,
 	&omap2420_mpu_hwmod,
 	&omap2420_iva_hwmod,
+	&omap2420_dss_hwmod,
+	&omap2420_dss_dispc_hwmod,
+	&omap2420_dss_rfbi_hwmod,
+	&omap2420_dss_venc_hwmod,
 	NULL,
 };
 
-- 
1.6.3.3


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

* [PATCH v1 02/16] OMAP2430: hwmod data: add DSS DISPC RFBI VENC
  2010-10-06 11:14 ` [PATCH v1 01/16] OMAP2420: hwmod data: add DSS DISPC RFBI VENC Guruswamy Senthilvadivu
@ 2010-10-06 11:14   ` Guruswamy Senthilvadivu
  2010-10-06 11:14     ` [PATCH v1 03/16] OMAP3: hwmod data: add DSS DISPC RFBI DSI VENC Guruswamy Senthilvadivu
  0 siblings, 1 reply; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Database generated for OMAP2430 Display Sub System.
---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  278 ++++++++++++++++++++++++++++
 1 files changed, 278 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 4526628..c610d10 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -19,6 +19,7 @@
 #include "omap_hwmod_common_data.h"
 
 #include "prm-regbits-24xx.h"
+#include "cm-regbits-24xx.h"
 
 /*
  * OMAP2430 hardware module integration data
@@ -29,6 +30,10 @@
  * elsewhere.
  */
 
+static struct omap_hwmod omap2430_dss_hwmod;
+static struct omap_hwmod omap2430_dss_dispc_hwmod;
+static struct omap_hwmod omap2430_dss_rfbi_hwmod;
+static struct omap_hwmod omap2430_dss_venc_hwmod;
 static struct omap_hwmod omap2430_mpu_hwmod;
 static struct omap_hwmod omap2430_iva_hwmod;
 static struct omap_hwmod omap2430_l3_main_hwmod;
@@ -48,6 +53,13 @@ static struct omap_hwmod_ocp_if omap2430_mpu__l3_main = {
 	.user	= OCP_USER_MPU,
 };
 
+/* DSS -> l3 */
+static struct omap_hwmod_ocp_if omap2430_dss__l3 = {
+	.master		= &omap2430_dss_hwmod,
+	.slave		= &omap2430_l3_main_hwmod,
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* Slave interfaces on the L3 interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l3_main_slaves[] = {
 	&omap2430_mpu__l3_main,
@@ -165,12 +177,278 @@ static struct omap_hwmod omap2430_iva_hwmod = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
 };
 
+/*
+ * 'dss' class
+ * display sub-system
+ */
+
+static struct omap_hwmod_class_sysconfig omap2430_dss_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+	.sysc_fields	= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap2430_dss_hwmod_class = {
+	.name = "dss",
+	.sysc = &omap2430_dss_sysc,
+};
+
+/* dss */
+static struct omap_hwmod_irq_info omap2430_dss_irqs[] = {
+	{ .irq = 25 },
+};
+
+static struct omap_hwmod_dma_info omap2430_dss_sdma_chs[] = {
+	{ .name = "dispc", .dma_req = 5 },
+};
+
+/* dss */
+/* dss master ports */
+static struct omap_hwmod_ocp_if *omap2430_dss_masters[] = {
+	&omap2430_dss__l3,
+};
+
+static struct omap_hwmod_addr_space omap2430_dss_addrs[] = {
+	{
+		.pa_start	= 0x48050000,
+		.pa_end		= 0x480503FF,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_core -> dss */
+static struct omap_hwmod_ocp_if omap2430_l4_core__dss = {
+	.master		= &omap2430_l4_core_hwmod,
+	.slave		= &omap2430_dss_hwmod,
+	.clk		= "dss_ick",
+	.addr		= omap2430_dss_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap2430_dss_addrs),
+	.user		= OCP_USER_MPU,
+};
+
+/* dss slave ports */
+static struct omap_hwmod_ocp_if *omap2430_dss_slaves[] = {
+	&omap2430_l4_core__dss,
+};
+
+static struct omap_hwmod_opt_clk dss_opt_clks[] = {
+	{ .role = "tv_clk", .clk = "dss_54m_fck" },
+	{ .role = "sys_clk", .clk = "dss2_fck" },
+};
+
+static struct omap_hwmod omap2430_dss_hwmod = {
+	.name		= "dss",
+	.class		= &omap2430_dss_hwmod_class,
+	.main_clk	= "dss1_fck", /* instead of dss_fck */
+	.mpu_irqs	= omap2430_dss_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap2430_dss_irqs),
+	.sdma_reqs	= omap2430_dss_sdma_chs,
+	.sdma_reqs_cnt	= ARRAY_SIZE(omap2430_dss_sdma_chs),
+
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_DSS1_SHIFT,
+			.module_offs = CORE_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_ST_DSS_SHIFT,
+		},
+	},
+	.opt_clks	= dss_opt_clks,
+	.opt_clks_cnt = ARRAY_SIZE(dss_opt_clks),
+	.slaves		= omap2430_dss_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_dss_slaves),
+	.masters	= omap2430_dss_masters,
+	.masters_cnt	= ARRAY_SIZE(omap2430_dss_masters),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/*
+ * 'dispc' class
+ * display controller
+ */
+
+static struct omap_hwmod_class_sysconfig omap2430_dispc_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE |
+			   SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+			   MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
+	.sysc_fields	= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap2430_dispc_hwmod_class = {
+	.name = "dispc",
+	.sysc = &omap2430_dispc_sysc,
+};
+
+static struct omap_hwmod_addr_space omap2430_dss_dispc_addrs[] = {
+	{
+		.pa_start	= 0x48050400,
+		.pa_end		= 0x480507FF,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_core -> dss_dispc */
+static struct omap_hwmod_ocp_if omap2430_l4_core__dss_dispc = {
+	.master		= &omap2430_l4_core_hwmod,
+	.slave		= &omap2430_dss_dispc_hwmod,
+	.clk		= "dss_ick",
+	.addr		= omap2430_dss_dispc_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap2430_dss_dispc_addrs),
+	.user		= OCP_USER_MPU,
+};
+
+/* dss_dispc slave ports */
+static struct omap_hwmod_ocp_if *omap2430_dss_dispc_slaves[] = {
+	&omap2430_l4_core__dss_dispc,
+};
+
+static struct omap_hwmod omap2430_dss_dispc_hwmod = {
+	.name		= "dss_dispc",
+	.class		= &omap2430_dispc_hwmod_class,
+	.main_clk	= "dss1_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_DSS1_SHIFT,
+			.module_offs = CORE_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_ST_DSS_SHIFT,
+		},
+	},
+	.slaves		= omap2430_dss_dispc_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_dss_dispc_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/*
+ * 'rfbi' class
+ * remote frame buffer interface
+ */
+
+static struct omap_hwmod_class_sysconfig omap2430_rfbi_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields	= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap2430_rfbi_hwmod_class = {
+	.name = "rfbi",
+	.sysc = &omap2430_rfbi_sysc,
+};
+
+static struct omap_hwmod_addr_space omap2430_dss_rfbi_addrs[] = {
+	{
+		.pa_start	= 0x48050800,
+		.pa_end		= 0x48050BFF,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_core -> dss_rfbi */
+static struct omap_hwmod_ocp_if omap2430_l4_core__dss_rfbi = {
+	.master		= &omap2430_l4_core_hwmod,
+	.slave		= &omap2430_dss_rfbi_hwmod,
+	.clk		= "dss_ick",
+	.addr		= omap2430_dss_rfbi_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap2430_dss_rfbi_addrs),
+	.user		= OCP_USER_MPU,
+};
+
+/* dss_rfbi slave ports */
+static struct omap_hwmod_ocp_if *omap2430_dss_rfbi_slaves[] = {
+	&omap2430_l4_core__dss_rfbi,
+};
+
+static struct omap_hwmod omap2430_dss_rfbi_hwmod = {
+	.name		= "dss_rfbi",
+	.class		= &omap2430_rfbi_hwmod_class,
+	.main_clk	= "dss1_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_DSS1_SHIFT,
+			.module_offs = CORE_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_ST_DSS_SHIFT,
+		},
+	},
+	.slaves		= omap2430_dss_rfbi_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_dss_rfbi_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/*
+ * 'venc' class
+ * video encoder
+ */
+
+static struct omap_hwmod_class omap2430_venc_hwmod_class = {
+	.name = "venc",
+};
+
+/* dss_venc */
+static struct omap_hwmod_addr_space omap2430_dss_venc_addrs[] = {
+	{
+		.pa_start	= 0x48050C00,
+		.pa_end		= 0x48050FFF,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_core -> dss_venc */
+static struct omap_hwmod_ocp_if omap2430_l4_core__dss_venc = {
+	.master		= &omap2430_l4_core_hwmod,
+	.slave		= &omap2430_dss_venc_hwmod,
+	.clk		= "dss_54m_fck",
+	.addr		= omap2430_dss_venc_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap2430_dss_venc_addrs),
+	.user		= OCP_USER_MPU,
+};
+
+/* dss_venc slave ports */
+static struct omap_hwmod_ocp_if *omap2430_dss_venc_slaves[] = {
+	&omap2430_l4_core__dss_venc,
+};
+
+static struct omap_hwmod omap2430_dss_venc_hwmod = {
+	.name		= "dss_venc",
+	.class		= &omap2430_venc_hwmod_class,
+	.main_clk	= "dss1_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_DSS1_SHIFT,
+			.module_offs = CORE_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_ST_DSS_SHIFT,
+		},
+	},
+	.slaves		= omap2430_dss_venc_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_dss_venc_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
 static __initdata struct omap_hwmod *omap2430_hwmods[] = {
 	&omap2430_l3_main_hwmod,
 	&omap2430_l4_core_hwmod,
 	&omap2430_l4_wkup_hwmod,
 	&omap2430_mpu_hwmod,
 	&omap2430_iva_hwmod,
+	&omap2430_dss_hwmod,
+	&omap2430_dss_dispc_hwmod,
+	&omap2430_dss_rfbi_hwmod,
+	&omap2430_dss_venc_hwmod,
 	NULL,
 };
 
-- 
1.6.3.3


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

* [PATCH v1 03/16] OMAP3: hwmod data: add DSS DISPC RFBI DSI VENC
  2010-10-06 11:14   ` [PATCH v1 02/16] OMAP2430: " Guruswamy Senthilvadivu
@ 2010-10-06 11:14     ` Guruswamy Senthilvadivu
  2010-10-06 11:14       ` [PATCH v1 04/16] OMAP3: hwmod data: change dss_hwmod to dss_dss_hwmod Guruswamy Senthilvadivu
  0 siblings, 1 reply; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Database generated for Display Sub System applicable for
OMAP34xx and OMAP36xx
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  333 ++++++++++++++++++++++++++++
 1 files changed, 333 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 5d8eb58..7df341f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -21,6 +21,7 @@
 #include "omap_hwmod_common_data.h"
 
 #include "prm-regbits-34xx.h"
+#include "cm-regbits-34xx.h"
 
 /*
  * OMAP3xxx hardware module integration data
@@ -31,6 +32,11 @@
  * elsewhere.
  */
 
+static struct omap_hwmod omap3xxx_dss_hwmod;
+static struct omap_hwmod omap3xxx_dss_dispc_hwmod;
+static struct omap_hwmod omap3xxx_dss_dsi1_hwmod;
+static struct omap_hwmod omap3xxx_dss_rfbi_hwmod;
+static struct omap_hwmod omap3xxx_dss_venc_hwmod;
 static struct omap_hwmod omap3xxx_mpu_hwmod;
 static struct omap_hwmod omap3xxx_iva_hwmod;
 static struct omap_hwmod omap3xxx_l3_main_hwmod;
@@ -58,6 +64,13 @@ static struct omap_hwmod_ocp_if omap3xxx_mpu__l3_main = {
 	.user	= OCP_USER_MPU,
 };
 
+/* DSS -> l3 */
+static struct omap_hwmod_ocp_if omap3xxx_dss__l3 = {
+	.master		= &omap3xxx_dss_hwmod,
+	.slave		= &omap3xxx_l3_main_hwmod,
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* Slave interfaces on the L3 interconnect */
 static struct omap_hwmod_ocp_if *omap3xxx_l3_main_slaves[] = {
 	&omap3xxx_mpu__l3_main,
@@ -197,6 +210,321 @@ static struct omap_hwmod omap3xxx_iva_hwmod = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
 };
 
+/*
+ * 'dss' class
+ * display sub-system
+ */
+
+static struct omap_hwmod_class_sysconfig omap3xxx_dss_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+	.sysc_fields	= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap3xxx_dss_hwmod_class = {
+	.name = "dss",
+	.sysc = &omap3xxx_dss_sysc,
+};
+
+/* dss */
+static struct omap_hwmod_irq_info omap3xxx_dss_irqs[] = {
+	{ .irq = 25 },
+};
+
+static struct omap_hwmod_dma_info omap3xxx_dss_sdma_chs[] = {
+	{ .name = "dispc", .dma_req = 5 },
+	{ .name = "dsi1", .dma_req = 74 },
+};
+
+/* dss */
+/* dss master ports */
+static struct omap_hwmod_ocp_if *omap3xxx_dss_masters[] = {
+	&omap3xxx_dss__l3,
+};
+
+static struct omap_hwmod_addr_space omap3xxx_dss_addrs[] = {
+	{
+		.pa_start	= 0x48050000,
+		.pa_end		= 0x480503FF,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_core -> dss */
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss = {
+	.master		= &omap3xxx_l4_core_hwmod,
+	.slave		= &omap3xxx_dss_hwmod,
+	.clk		= "dss_ick",
+	.addr		= omap3xxx_dss_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_dss_addrs),
+	.user		= OCP_USER_MPU,
+};
+
+/* dss slave ports */
+static struct omap_hwmod_ocp_if *omap3xxx_dss_slaves[] = {
+	&omap3xxx_l4_core__dss,
+};
+
+static struct omap_hwmod_opt_clk dss_opt_clks[] = {
+	{ .role = "tv_clk", .clk = "dss_tv_fck" },
+	{ .role = "dssclk", .clk = "dss_96m_fck" },
+	{ .role = "sys_clk", .clk = "dss2_alwon_fck" },
+};
+
+static struct omap_hwmod omap3xxx_dss_hwmod = {
+	.name		= "dss",
+	.class		= &omap3xxx_dss_hwmod_class,
+	.main_clk	= "dss1_alwon_fck", /* instead of dss_fck */
+	.mpu_irqs	= omap3xxx_dss_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_dss_irqs),
+	.sdma_reqs	= omap3xxx_dss_sdma_chs,
+	.sdma_reqs_cnt	= ARRAY_SIZE(omap3xxx_dss_sdma_chs),
+
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_DSS1_SHIFT,
+			.module_offs = OMAP3430_DSS_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT,
+		},
+	},
+	.opt_clks	= dss_opt_clks,
+	.opt_clks_cnt = ARRAY_SIZE(dss_opt_clks),
+	.slaves		= omap3xxx_dss_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_dss_slaves),
+	.masters	= omap3xxx_dss_masters,
+	.masters_cnt	= ARRAY_SIZE(omap3xxx_dss_masters),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/*
+ * 'dispc' class
+ * display controller
+ */
+
+static struct omap_hwmod_class_sysconfig omap3xxx_dispc_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SIDLEMODE | SYSC_HAS_CLOCKACTIVITY |
+			   SYSC_HAS_MIDLEMODE | SYSC_HAS_ENAWAKEUP |
+			   SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+			   MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
+	.sysc_fields	= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap3xxx_dispc_hwmod_class = {
+	.name = "dispc",
+	.sysc = &omap3xxx_dispc_sysc,
+};
+
+static struct omap_hwmod_addr_space omap3xxx_dss_dispc_addrs[] = {
+	{
+		.pa_start	= 0x48050400,
+		.pa_end		= 0x480507FF,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_core -> dss_dispc */
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_dispc = {
+	.master		= &omap3xxx_l4_core_hwmod,
+	.slave		= &omap3xxx_dss_dispc_hwmod,
+	.clk		= "dss_ick",
+	.addr		= omap3xxx_dss_dispc_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_dss_dispc_addrs),
+	.user		= OCP_USER_MPU,
+};
+
+/* dss_dispc slave ports */
+static struct omap_hwmod_ocp_if *omap3xxx_dss_dispc_slaves[] = {
+	&omap3xxx_l4_core__dss_dispc,
+};
+
+static struct omap_hwmod omap3xxx_dss_dispc_hwmod = {
+	.name		= "dss_dispc",
+	.class		= &omap3xxx_dispc_hwmod_class,
+	.main_clk	= "dss1_alwon_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_DSS1_SHIFT,
+			.module_offs = OMAP3430_DSS_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT,
+		},
+	},
+	.slaves		= omap3xxx_dss_dispc_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_dss_dispc_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/*
+ * 'dsi' class
+ * display serial interface controller
+ */
+
+static struct omap_hwmod_class omap3xxx_dsi_hwmod_class = {
+	.name = "dsi",
+};
+
+/* dss_dsi1 */
+static struct omap_hwmod_addr_space omap3xxx_dss_dsi1_addrs[] = {
+	{
+		.pa_start	= 0x4804FC00,
+		.pa_end		= 0x4804FFFF,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_core -> dss_dsi1 */
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_dsi1 = {
+	.master		= &omap3xxx_l4_core_hwmod,
+	.slave		= &omap3xxx_dss_dsi1_hwmod,
+	.addr		= omap3xxx_dss_dsi1_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_dss_dsi1_addrs),
+	.user		= OCP_USER_MPU,
+};
+
+
+/* dss_dsi1 slave ports */
+static struct omap_hwmod_ocp_if *omap3xxx_dss_dsi1_slaves[] = {
+	&omap3xxx_l4_core__dss_dsi1,
+};
+
+static struct omap_hwmod omap3xxx_dss_dsi1_hwmod = {
+	.name		= "dss_dsi1",
+	.class		= &omap3xxx_dsi_hwmod_class,
+	.main_clk	= "dss1_alwon_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_DSS1_SHIFT,
+			.module_offs = OMAP3430_DSS_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT,
+		},
+	},
+	.slaves		= omap3xxx_dss_dsi1_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_dss_dsi1_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+/*
+ * 'rfbi' class
+ * remote frame buffer interface
+ */
+
+static struct omap_hwmod_class_sysconfig omap3xxx_rfbi_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields	= &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap3xxx_rfbi_hwmod_class = {
+	.name = "rfbi",
+	.sysc = &omap3xxx_rfbi_sysc,
+};
+
+static struct omap_hwmod_addr_space omap3xxx_dss_rfbi_addrs[] = {
+	{
+		.pa_start	= 0x48050800,
+		.pa_end		= 0x48050BFF,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_core -> dss_rfbi */
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_rfbi = {
+	.master		= &omap3xxx_l4_core_hwmod,
+	.slave		= &omap3xxx_dss_rfbi_hwmod,
+	.clk		= "dss_ick",
+	.addr		= omap3xxx_dss_rfbi_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_dss_rfbi_addrs),
+	.user		= OCP_USER_MPU,
+};
+
+/* dss_rfbi slave ports */
+static struct omap_hwmod_ocp_if *omap3xxx_dss_rfbi_slaves[] = {
+	&omap3xxx_l4_core__dss_rfbi,
+};
+
+static struct omap_hwmod omap3xxx_dss_rfbi_hwmod = {
+	.name		= "dss_rfbi",
+	.class		= &omap3xxx_rfbi_hwmod_class,
+	.main_clk	= "dss1_alwon_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_DSS1_SHIFT,
+			.module_offs = OMAP3430_DSS_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT,
+		},
+	},
+	.slaves		= omap3xxx_dss_rfbi_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_dss_rfbi_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/*
+ * 'venc' class
+ * video encoder
+ */
+
+static struct omap_hwmod_class omap3xxx_venc_hwmod_class = {
+	.name = "venc",
+};
+
+/* dss_venc */
+static struct omap_hwmod_addr_space omap3xxx_dss_venc_addrs[] = {
+	{
+		.pa_start	= 0x48050C00,
+		.pa_end		= 0x48050FFF,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+/* l4_core -> dss_venc */
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_venc = {
+	.master		= &omap3xxx_l4_core_hwmod,
+	.slave		= &omap3xxx_dss_venc_hwmod,
+	.clk		= "dss_tv_fck",
+	.addr		= omap3xxx_dss_venc_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_dss_venc_addrs),
+	.user		= OCP_USER_MPU,
+};
+
+/* dss_venc slave ports */
+static struct omap_hwmod_ocp_if *omap3xxx_dss_venc_slaves[] = {
+	&omap3xxx_l4_core__dss_venc,
+};
+
+static struct omap_hwmod omap3xxx_dss_venc_hwmod = {
+	.name		= "dss_venc",
+	.class		= &omap3xxx_venc_hwmod_class,
+	.main_clk	= "dss1_alwon_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_DSS1_SHIFT,
+			.module_offs = OMAP3430_DSS_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT,
+		},
+	},
+	.slaves		= omap3xxx_dss_venc_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_dss_venc_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
 static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
 	&omap3xxx_l3_main_hwmod,
 	&omap3xxx_l4_core_hwmod,
@@ -204,6 +532,11 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
 	&omap3xxx_l4_wkup_hwmod,
 	&omap3xxx_mpu_hwmod,
 	&omap3xxx_iva_hwmod,
+	&omap3xxx_dss_hwmod,
+	&omap3xxx_dss_dispc_hwmod,
+	&omap3xxx_dss_dsi1_hwmod,
+	&omap3xxx_dss_rfbi_hwmod,
+	&omap3xxx_dss_venc_hwmod,
 	NULL,
 };
 
-- 
1.6.3.3


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

* [PATCH v1 04/16] OMAP3: hwmod data: change dss_hwmod to dss_dss_hwmod
  2010-10-06 11:14     ` [PATCH v1 03/16] OMAP3: hwmod data: add DSS DISPC RFBI DSI VENC Guruswamy Senthilvadivu
@ 2010-10-06 11:14       ` Guruswamy Senthilvadivu
  2010-10-06 11:14         ` [PATCH v1 05/16] OMAP3 DSS Driver register moved to mach_omap2 Guruswamy Senthilvadivu
  0 siblings, 1 reply; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

dss is also considered as a HW IP inside DSS.
---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 7df341f..21fb9eb 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -32,7 +32,7 @@
  * elsewhere.
  */
 
-static struct omap_hwmod omap3xxx_dss_hwmod;
+static struct omap_hwmod omap3xxx_dss_dss_hwmod;
 static struct omap_hwmod omap3xxx_dss_dispc_hwmod;
 static struct omap_hwmod omap3xxx_dss_dsi1_hwmod;
 static struct omap_hwmod omap3xxx_dss_rfbi_hwmod;
@@ -66,7 +66,7 @@ static struct omap_hwmod_ocp_if omap3xxx_mpu__l3_main = {
 
 /* DSS -> l3 */
 static struct omap_hwmod_ocp_if omap3xxx_dss__l3 = {
-	.master		= &omap3xxx_dss_hwmod,
+	.master		= &omap3xxx_dss_dss_hwmod,
 	.slave		= &omap3xxx_l3_main_hwmod,
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
 };
@@ -255,7 +255,7 @@ static struct omap_hwmod_addr_space omap3xxx_dss_addrs[] = {
 /* l4_core -> dss */
 static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss = {
 	.master		= &omap3xxx_l4_core_hwmod,
-	.slave		= &omap3xxx_dss_hwmod,
+	.slave		= &omap3xxx_dss_dss_hwmod,
 	.clk		= "dss_ick",
 	.addr		= omap3xxx_dss_addrs,
 	.addr_cnt	= ARRAY_SIZE(omap3xxx_dss_addrs),
@@ -273,8 +273,8 @@ static struct omap_hwmod_opt_clk dss_opt_clks[] = {
 	{ .role = "sys_clk", .clk = "dss2_alwon_fck" },
 };
 
-static struct omap_hwmod omap3xxx_dss_hwmod = {
-	.name		= "dss",
+static struct omap_hwmod omap3xxx_dss_dss_hwmod = {
+	.name		= "dss_dss",
 	.class		= &omap3xxx_dss_hwmod_class,
 	.main_clk	= "dss1_alwon_fck", /* instead of dss_fck */
 	.mpu_irqs	= omap3xxx_dss_irqs,
@@ -532,7 +532,7 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
 	&omap3xxx_l4_wkup_hwmod,
 	&omap3xxx_mpu_hwmod,
 	&omap3xxx_iva_hwmod,
-	&omap3xxx_dss_hwmod,
+	&omap3xxx_dss_dss_hwmod,
 	&omap3xxx_dss_dispc_hwmod,
 	&omap3xxx_dss_dsi1_hwmod,
 	&omap3xxx_dss_rfbi_hwmod,
-- 
1.6.3.3


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

* [PATCH v1 05/16] OMAP3 DSS Driver register moved to mach_omap2
  2010-10-06 11:14       ` [PATCH v1 04/16] OMAP3: hwmod data: change dss_hwmod to dss_dss_hwmod Guruswamy Senthilvadivu
@ 2010-10-06 11:14         ` Guruswamy Senthilvadivu
  2010-10-06 11:14           ` [PATCH v1 06/16] OMAP3: hwmod DSS: Build omap_device for each DSS HWIP Guruswamy Senthilvadivu
  2010-10-07 19:06           ` [PATCH v1 05/16] OMAP3 DSS Driver register moved to mach_omap2 Thomas Petazzoni
  0 siblings, 2 replies; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Move DSS driver register from board file to devices.c
Regulator initialisation done with driver name instead
of device name.
Changed device name from omapdss to omapdisplay as the
driver takes care of panel information.

Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
---
 arch/arm/mach-omap2/board-3430sdp.c       |   25 +++-------------------
 arch/arm/mach-omap2/devices.c             |   32 +++++++++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/display.h |    4 +++
 drivers/video/omap2/dss/core.c            |    2 +-
 4 files changed, 41 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 3eb9839..62b6523 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -302,22 +302,8 @@ static struct omap_dss_board_info sdp3430_dss_data = {
 	.default_device	= &sdp3430_lcd_device,
 };
 
-static struct platform_device sdp3430_dss_device = {
-	.name		= "omapdss",
-	.id		= -1,
-	.dev		= {
-		.platform_data = &sdp3430_dss_data,
-	},
-};
-
-static struct regulator_consumer_supply sdp3430_vdda_dac_supply = {
-	.supply		= "vdda_dac",
-	.dev		= &sdp3430_dss_device.dev,
-};
-
-static struct platform_device *sdp3430_devices[] __initdata = {
-	&sdp3430_dss_device,
-};
+static struct regulator_consumer_supply sdp3430_vdda_dac_supply =
+	REGULATOR_SUPPLY("vdda_dac", "omapdisplay");
 
 static struct omap_board_config_kernel sdp3430_config[] __initdata = {
 };
@@ -541,10 +527,7 @@ static struct regulator_init_data sdp3430_vdac = {
 
 /* VPLL2 for digital video outputs */
 static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = {
-	{
-		.supply		= "vdds_dsi",
-		.dev		= &sdp3430_dss_device.dev,
-	}
+	REGULATOR_SUPPLY("vdds_dsi", "omapdisplay"),
 };
 
 static struct regulator_init_data sdp3430_vpll2 = {
@@ -798,7 +781,7 @@ static void __init omap_3430sdp_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	omap3430_i2c_init();
-	platform_add_devices(sdp3430_devices, ARRAY_SIZE(sdp3430_devices));
+	omap_display_init(&sdp3430_dss_data);
 	if (omap_rev() > OMAP3430_REV_ES1_0)
 		ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV2;
 	else
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 9e5d51b..0702b87 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -28,6 +28,7 @@
 #include <mach/gpio.h>
 #include <plat/mmc.h>
 #include <plat/dma.h>
+#include <plat/display.h>
 
 #include "mux.h"
 
@@ -885,6 +886,37 @@ static inline void omap_hdq_init(void) {}
 #endif
 
 /*---------------------------------------------------------------------------*/
+#ifdef CONFIG_OMAP2_DSS
+
+static struct platform_device omap_display_device = {
+	.name          = "omapdisplay",
+	.id            = -1,
+	.dev            = {
+		.platform_data = NULL,
+	},
+};
+
+void __init omap_display_init(struct omap_dss_board_info
+					*board_data)
+{
+
+	omap_display_device.dev.platform_data = board_data;
+
+	if (platform_device_register(&omap_display_device) < 0)
+		printk(KERN_ERR "Unable to register OMAP-Display device\n");
+
+
+	return ;
+}
+
+#else
+void __init omap_display_init(struct omap_dss_board_info *board_data)
+{
+}
+#endif
+
+
+/*---------------------------------------------------------------------------*/
 
 #if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
 	defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h
index 8bd15bd..4b71be3 100644
--- a/arch/arm/plat-omap/include/plat/display.h
+++ b/arch/arm/plat-omap/include/plat/display.h
@@ -23,6 +23,7 @@
 #include <linux/list.h>
 #include <linux/kobject.h>
 #include <linux/device.h>
+#include <linux/platform_device.h>
 #include <asm/atomic.h>
 
 #define DISPC_IRQ_FRAMEDONE		(1 << 0)
@@ -251,6 +252,9 @@ struct omap_dss_board_info {
 	struct omap_dss_device *default_device;
 };
 
+/* Init with the board info */
+extern void omap_display_init(struct omap_dss_board_info *board_data);
+
 struct omap_video_timings {
 	/* Unit: pixels */
 	u16 x_res;
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index b3a498f..0f267e6 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -712,7 +712,7 @@ static struct platform_driver omap_dss_driver = {
 	.suspend	= omap_dss_suspend,
 	.resume		= omap_dss_resume,
 	.driver         = {
-		.name   = "omapdss",
+		.name   = "omapdisplay",
 		.owner  = THIS_MODULE,
 	},
 };
-- 
1.6.3.3


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

* [PATCH v1 06/16] OMAP3: hwmod DSS: Build omap_device for each DSS HWIP
  2010-10-06 11:14         ` [PATCH v1 05/16] OMAP3 DSS Driver register moved to mach_omap2 Guruswamy Senthilvadivu
@ 2010-10-06 11:14           ` Guruswamy Senthilvadivu
  2010-10-06 11:14             ` [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP Guruswamy Senthilvadivu
  2010-10-07 19:30             ` [PATCH v1 06/16] OMAP3: hwmod DSS: Build omap_device for each DSS HWIP Thomas Petazzoni
  2010-10-07 19:06           ` [PATCH v1 05/16] OMAP3 DSS Driver register moved to mach_omap2 Thomas Petazzoni
  1 sibling, 2 replies; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Looks up the HWMOD database for each of the given DSS HW IP
and builds omap_device which inturn does the platform device
register for each of DSS HW IP

Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
---
 arch/arm/mach-omap2/devices.c             |   46 +++++++++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/display.h |   10 ++++++
 2 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 0702b87..7a75310 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -29,6 +29,8 @@
 #include <plat/mmc.h>
 #include <plat/dma.h>
 #include <plat/display.h>
+#include <plat/omap_device.h>
+#include <plat/omap_hwmod.h>
 
 #include "mux.h"
 
@@ -896,9 +898,53 @@ static struct platform_device omap_display_device = {
 	},
 };
 
+static struct omap_device_pm_latency omap_dss_latency[] = {
+	[0] = {
+		.deactivate_func        = omap_device_idle_hwmods,
+		.activate_func          = omap_device_enable_hwmods,
+	},
+};
+
 void __init omap_display_init(struct omap_dss_board_info
 					*board_data)
 {
+	struct omap_hwmod *oh;
+	struct omap_device *od;
+	int l, i;
+	struct omap_display_platform_data pdata;
+	char *oh_name[] = {
+			"dss_dss",
+			"dss_dispc",
+			"dss_dsi1",
+			"dss_rfbi",
+			"dss_venc"
+			};
+
+	for (i = 0; i < ARRAY_SIZE(oh_name); i++) {
+		l = snprintf(oh_name[i], MAX_OMAP_DSS_HWMOD_NAME_LEN,
+				 oh_name[i]);
+		WARN(l >= MAX_OMAP_DSS_HWMOD_NAME_LEN,
+			"String buffer overflow in DSS device setup\n");
+
+		oh = omap_hwmod_lookup(oh_name[i]);
+		if (!oh) {
+			pr_err("Could not look up %s\n", oh_name[i]);
+			return ;
+		}
+		strncpy(pdata.name, oh_name[i], sizeof(oh_name[i]));
+		pdata.board_data		=       board_data;
+		pdata.board_data->get_last_off_on_transaction_id = NULL;
+		pdata.device_enable    =       omap_device_enable;
+		pdata.device_idle      =       omap_device_idle;
+		pdata.device_shutdown  =       omap_device_shutdown;
+		od = omap_device_build(oh_name[i], -1, oh, &pdata,
+				sizeof(struct omap_display_platform_data),
+				omap_dss_latency,
+				ARRAY_SIZE(omap_dss_latency), 0);
+
+		WARN((IS_ERR(od)), "Could not build omap_device for %s\n",
+				oh_name[i]);
+	}
 
 	omap_display_device.dev.platform_data = board_data;
 
diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h
index 4b71be3..84a63de 100644
--- a/arch/arm/plat-omap/include/plat/display.h
+++ b/arch/arm/plat-omap/include/plat/display.h
@@ -26,6 +26,8 @@
 #include <linux/platform_device.h>
 #include <asm/atomic.h>
 
+#define MAX_OMAP_DSS_HWMOD_NAME_LEN 16
+
 #define DISPC_IRQ_FRAMEDONE		(1 << 0)
 #define DISPC_IRQ_VSYNC			(1 << 1)
 #define DISPC_IRQ_EVSYNC_EVEN		(1 << 2)
@@ -255,6 +257,14 @@ struct omap_dss_board_info {
 /* Init with the board info */
 extern void omap_display_init(struct omap_dss_board_info *board_data);
 
+struct omap_display_platform_data {
+	char name[MAX_OMAP_DSS_HWMOD_NAME_LEN];
+	struct omap_dss_board_info *board_data;
+	int (*device_enable)(struct platform_device *pdev);
+	int (*device_shutdown)(struct platform_device *pdev);
+	int (*device_idle)(struct platform_device *pdev);
+};
+
 struct omap_video_timings {
 	/* Unit: pixels */
 	u16 x_res;
-- 
1.6.3.3


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

* [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP
  2010-10-06 11:14           ` [PATCH v1 06/16] OMAP3: hwmod DSS: Build omap_device for each DSS HWIP Guruswamy Senthilvadivu
@ 2010-10-06 11:14             ` Guruswamy Senthilvadivu
  2010-10-06 11:14               ` [PATCH v1 08/16] OMAP3: clock data: change dss driver name Guruswamy Senthilvadivu
                                 ` (2 more replies)
  2010-10-07 19:30             ` [PATCH v1 06/16] OMAP3: hwmod DSS: Build omap_device for each DSS HWIP Thomas Petazzoni
  1 sibling, 3 replies; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Platform driver of dsshw has to be registered before of dispc,
rfbi, dsi1, venc and omapdisplay driver should be after all
the hw IPs. Sequence it with arch_initcall and device_initcall_sync.
---
 drivers/video/omap2/dss/core.c  |    2 +-
 drivers/video/omap2/dss/dispc.c |   28 ++++++++++++++++++++++++++++
 drivers/video/omap2/dss/dsi.c   |   28 ++++++++++++++++++++++++++++
 drivers/video/omap2/dss/dss.c   |   30 ++++++++++++++++++++++++++++++
 drivers/video/omap2/dss/rfbi.c  |   29 +++++++++++++++++++++++++++++
 drivers/video/omap2/dss/venc.c  |   28 ++++++++++++++++++++++++++++
 6 files changed, 144 insertions(+), 1 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 0f267e6..7810a40 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -986,7 +986,7 @@ static int __init omap_dss_init2(void)
 }
 
 core_initcall(omap_dss_init);
-device_initcall(omap_dss_init2);
+device_initcall_sync(omap_dss_init2);
 #endif
 
 MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@nokia.com>");
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 5ecdc00..e48c6fa 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -186,6 +186,26 @@ static inline u32 dispc_read_reg(const struct dispc_reg idx)
 	return __raw_readl(dispc.base + idx.idx);
 }
 
+/* DISPC HW IP initialisation */
+static int omap_dispchw_probe(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static int omap_dispchw_remove(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static struct platform_driver omap_dispchw_driver = {
+	.probe          = omap_dispchw_probe,
+	.remove         = omap_dispchw_remove,
+	.driver         = {
+		.name   = "dss_dispc",
+		.owner  = THIS_MODULE,
+	},
+};
+
 #define SR(reg) \
 	dispc.ctx[(DISPC_##reg).idx / sizeof(u32)] = dispc_read_reg(DISPC_##reg)
 #define RR(reg) \
@@ -3187,3 +3207,11 @@ int dispc_setup_plane(enum omap_plane plane,
 
 	return r;
 }
+
+static int __init omap_dispc_init(void)
+{
+	return platform_driver_register(&omap_dispchw_driver);
+}
+
+device_initcall(omap_dispc_init);
+
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index b3fa3a7..fd49663 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -292,6 +292,26 @@ static inline u32 dsi_read_reg(const struct dsi_reg idx)
 	return __raw_readl(dsi.base + idx.idx);
 }
 
+/* DSI1 HW IP initialisation */
+static int omap_dsi1hw_probe(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static int omap_dsi1hw_remove(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static struct platform_driver omap_dsi1hw_driver = {
+	.probe          = omap_dsi1hw_probe,
+	.remove         = omap_dsi1hw_remove,
+	.driver         = {
+		.name   = "dss_dsi1",
+		.owner  = THIS_MODULE,
+	},
+};
+
 
 void dsi_save_context(void)
 {
@@ -3305,3 +3325,11 @@ void dsi_exit(void)
 	DSSDBG("omap_dsi_exit\n");
 }
 
+static int __init omap_dsi1_init(void)
+{
+	return platform_driver_register(&omap_dsi1hw_driver);
+}
+
+device_initcall(omap_dsi1_init);
+
+
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 77c3621..66ef804 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -86,6 +86,29 @@ static inline u32 dss_read_reg(const struct dss_reg idx)
 	return __raw_readl(dss.base + idx.idx);
 }
 
+/* DSS HW IP initialisation */
+static int omap_dsshw_probe(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static int omap_dsshw_remove(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static struct platform_driver omap_dsshw_driver = {
+	.probe          = omap_dsshw_probe,
+	.remove         = omap_dsshw_remove,
+	.shutdown	= NULL,
+	.suspend	= NULL,
+	.resume		= NULL,
+	.driver         = {
+		.name   = "dss",
+		.owner  = THIS_MODULE,
+	},
+};
+
 #define SR(reg) \
 	dss.ctx[(DSS_##reg).idx / sizeof(u32)] = dss_read_reg(DSS_##reg)
 #define RR(reg) \
@@ -639,3 +662,10 @@ void dss_exit(void)
 	iounmap(dss.base);
 }
 
+static int __init omap_dss_init1(void)
+{
+	return platform_driver_register(&omap_dsshw_driver);
+}
+
+arch_initcall(omap_dss_init1);
+
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index bbe6246..23598ea 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -139,6 +139,27 @@ static inline u32 rfbi_read_reg(const struct rfbi_reg idx)
 	return __raw_readl(rfbi.base + idx.idx);
 }
 
+/* RFBI HW IP initialisation */
+static int omap_rfbihw_probe(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static int omap_rfbihw_remove(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static struct platform_driver omap_rfbihw_driver = {
+	.probe          = omap_rfbihw_probe,
+	.remove         = omap_rfbihw_remove,
+	.driver         = {
+		.name   = "dss_rfbi",
+		.owner  = THIS_MODULE,
+	},
+};
+
+
 static void rfbi_enable_clocks(bool enable)
 {
 	if (enable)
@@ -1054,3 +1075,11 @@ int rfbi_init_display(struct omap_dss_device *dssdev)
 	dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
 	return 0;
 }
+
+static int __init omap_rfbi_init(void)
+{
+	return platform_driver_register(&omap_rfbihw_driver);
+}
+
+device_initcall(omap_rfbi_init);
+
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index eff3505..ec17b28 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -87,6 +87,26 @@
 #define VENC_OUTPUT_TEST			0xC8
 #define VENC_DAC_B__DAC_C			0xC8
 
+/* VENC HW IP initialisation */
+static int omap_venchw_probe(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static int omap_venchw_remove(struct platform_device *pdev)
+{
+	return 0;
+}
+
+static struct platform_driver omap_venchw_driver = {
+	.probe          = omap_venchw_probe,
+	.remove         = omap_venchw_remove,
+	.driver         = {
+		.name   = "dss_venc",
+		.owner  = THIS_MODULE,
+	},
+};
+
 struct venc_config {
 	u32 f_control;
 	u32 vidout_ctrl;
@@ -740,3 +760,11 @@ void venc_dump_regs(struct seq_file *s)
 
 #undef DUMPREG
 }
+
+static int __init omap_venc_init(void)
+{
+	return platform_driver_register(&omap_venchw_driver);
+}
+
+device_initcall(omap_venc_init);
+
-- 
1.6.3.3


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

* [PATCH v1 08/16] OMAP3: clock data: change dss driver name
  2010-10-06 11:14             ` [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP Guruswamy Senthilvadivu
@ 2010-10-06 11:14               ` Guruswamy Senthilvadivu
  2010-10-06 11:14                 ` [PATCH v1 09/16] OMAP3: hwmod DSS: Move clocks from core driver to dss driver Guruswamy Senthilvadivu
  2010-10-07 19:47               ` [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP Thomas Petazzoni
  2010-10-07 19:49               ` Thomas Petazzoni
  2 siblings, 1 reply; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Change the dss driver name from omapdss to dss_dss
in the clock database.

Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
---
 arch/arm/mach-omap2/clock3xxx_data.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index c73906d..4e85d03 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3320,13 +3320,13 @@ static struct omap_clk omap3xxx_clks[] = {
 	CLK("omap_rng",	"ick",		&rng_ick,	CK_343X),
 	CLK(NULL,	"sha11_ick",	&sha11_ick,	CK_343X),
 	CLK(NULL,	"des1_ick",	&des1_ick,	CK_343X),
-	CLK("omapdss",	"dss1_fck",	&dss1_alwon_fck_3430es1, CK_3430ES1),
-	CLK("omapdss",	"dss1_fck",	&dss1_alwon_fck_3430es2, CK_3430ES2 | CK_AM35XX),
-	CLK("omapdss",	"tv_fck",	&dss_tv_fck,	CK_3XXX),
-	CLK("omapdss",	"video_fck",	&dss_96m_fck,	CK_3XXX),
-	CLK("omapdss",	"dss2_fck",	&dss2_alwon_fck, CK_3XXX),
-	CLK("omapdss",	"ick",		&dss_ick_3430es1,	CK_3430ES1),
-	CLK("omapdss",	"ick",		&dss_ick_3430es2,	CK_3430ES2 | CK_AM35XX),
+	CLK("dss_dss",	"dss1_fck",	&dss1_alwon_fck_3430es1, CK_3430ES1),
+	CLK("dss_dss",	"dss1_fck",	&dss1_alwon_fck_3430es2, CK_3430ES2 | CK_AM35XX),
+	CLK("dss_dss",	"tv_fck",	&dss_tv_fck,	CK_3XXX),
+	CLK("dss_dss",	"video_fck",	&dss_96m_fck,	CK_3XXX),
+	CLK("dss_dss",	"dss2_fck",	&dss2_alwon_fck, CK_3XXX),
+	CLK("dss_dss",	"ick",		&dss_ick_3430es1,	CK_3430ES1),
+	CLK("dss_dss",	"ick",		&dss_ick_3430es2,	CK_3430ES2 | CK_AM35XX),
 	CLK(NULL,	"cam_mclk",	&cam_mclk,	CK_343X),
 	CLK(NULL,	"cam_ick",	&cam_ick,	CK_343X),
 	CLK(NULL,	"csi2_96m_fck",	&csi2_96m_fck,	CK_343X),
-- 
1.6.3.3


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

* [PATCH v1 09/16] OMAP3: hwmod DSS: Move clocks from core driver to dss driver
  2010-10-06 11:14               ` [PATCH v1 08/16] OMAP3: clock data: change dss driver name Guruswamy Senthilvadivu
@ 2010-10-06 11:14                 ` Guruswamy Senthilvadivu
  2010-10-06 11:14                   ` [PATCH v1 10/16] OMAP3: hwmod DSS: DSS Move init,exit to driver Guruswamy Senthilvadivu
  0 siblings, 1 reply; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

cks are moved to dss platform driver.  clk_get/put
APIs use dss device instead of core platform device.
It leaves the core driver "omapdisplay" to take care of
panel registration with the custom bus.  dss driver would
take care of the clocks needed by DISPC,RFBI,DSI,VENC.

Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
---
 drivers/video/omap2/dss/core.c |  372 +--------------------------------------
 drivers/video/omap2/dss/dss.c  |  382 +++++++++++++++++++++++++++++++++++++++-
 drivers/video/omap2/dss/dss.h  |   14 +-
 3 files changed, 392 insertions(+), 376 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 7810a40..ce5240f 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -34,30 +34,18 @@
 #include <linux/regulator/consumer.h>
 
 #include <plat/display.h>
-#include <plat/clock.h>
+
 
 #include "dss.h"
 
 static struct {
 	struct platform_device *pdev;
-	int		ctx_id;
-
-	struct clk      *dss_ick;
-	struct clk	*dss1_fck;
-	struct clk	*dss2_fck;
-	struct clk      *dss_54m_fck;
-	struct clk	*dss_96m_fck;
-	unsigned	num_clks_enabled;
 
 	struct regulator *vdds_dsi_reg;
 	struct regulator *vdds_sdi_reg;
 	struct regulator *vdda_dac_reg;
 } core;
 
-static void dss_clk_enable_all_no_ctx(void);
-static void dss_clk_disable_all_no_ctx(void);
-static void dss_clk_enable_no_ctx(enum dss_clock clks);
-static void dss_clk_disable_no_ctx(enum dss_clock clks);
 
 static char *def_disp_name;
 module_param_named(def_disp, def_disp_name, charp, 0);
@@ -68,297 +56,6 @@ unsigned int dss_debug;
 module_param_named(debug, dss_debug, bool, 0644);
 #endif
 
-/* CONTEXT */
-static int dss_get_ctx_id(void)
-{
-	struct omap_dss_board_info *pdata = core.pdev->dev.platform_data;
-	int r;
-
-	if (!pdata->get_last_off_on_transaction_id)
-		return 0;
-	r = pdata->get_last_off_on_transaction_id(&core.pdev->dev);
-	if (r < 0) {
-		dev_err(&core.pdev->dev, "getting transaction ID failed, "
-				"will force context restore\n");
-		r = -1;
-	}
-	return r;
-}
-
-int dss_need_ctx_restore(void)
-{
-	int id = dss_get_ctx_id();
-
-	if (id < 0 || id != core.ctx_id) {
-		DSSDBG("ctx id %d -> id %d\n",
-				core.ctx_id, id);
-		core.ctx_id = id;
-		return 1;
-	} else {
-		return 0;
-	}
-}
-
-static void save_all_ctx(void)
-{
-	DSSDBG("save context\n");
-
-	dss_clk_enable_no_ctx(DSS_CLK_ICK | DSS_CLK_FCK1);
-
-	dss_save_context();
-	dispc_save_context();
-#ifdef CONFIG_OMAP2_DSS_DSI
-	dsi_save_context();
-#endif
-
-	dss_clk_disable_no_ctx(DSS_CLK_ICK | DSS_CLK_FCK1);
-}
-
-static void restore_all_ctx(void)
-{
-	DSSDBG("restore context\n");
-
-	dss_clk_enable_all_no_ctx();
-
-	dss_restore_context();
-	dispc_restore_context();
-#ifdef CONFIG_OMAP2_DSS_DSI
-	dsi_restore_context();
-#endif
-
-	dss_clk_disable_all_no_ctx();
-}
-
-#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
-/* CLOCKS */
-static void core_dump_clocks(struct seq_file *s)
-{
-	int i;
-	struct clk *clocks[5] = {
-		core.dss_ick,
-		core.dss1_fck,
-		core.dss2_fck,
-		core.dss_54m_fck,
-		core.dss_96m_fck
-	};
-
-	seq_printf(s, "- CORE -\n");
-
-	seq_printf(s, "internal clk count\t\t%u\n", core.num_clks_enabled);
-
-	for (i = 0; i < 5; i++) {
-		if (!clocks[i])
-			continue;
-		seq_printf(s, "%-15s\t%lu\t%d\n",
-				clocks[i]->name,
-				clk_get_rate(clocks[i]),
-				clocks[i]->usecount);
-	}
-}
-#endif /* defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT) */
-
-static int dss_get_clock(struct clk **clock, const char *clk_name)
-{
-	struct clk *clk;
-
-	clk = clk_get(&core.pdev->dev, clk_name);
-
-	if (IS_ERR(clk)) {
-		DSSERR("can't get clock %s", clk_name);
-		return PTR_ERR(clk);
-	}
-
-	*clock = clk;
-
-	DSSDBG("clk %s, rate %ld\n", clk_name, clk_get_rate(clk));
-
-	return 0;
-}
-
-static int dss_get_clocks(void)
-{
-	int r;
-
-	core.dss_ick = NULL;
-	core.dss1_fck = NULL;
-	core.dss2_fck = NULL;
-	core.dss_54m_fck = NULL;
-	core.dss_96m_fck = NULL;
-
-	r = dss_get_clock(&core.dss_ick, "ick");
-	if (r)
-		goto err;
-
-	r = dss_get_clock(&core.dss1_fck, "dss1_fck");
-	if (r)
-		goto err;
-
-	r = dss_get_clock(&core.dss2_fck, "dss2_fck");
-	if (r)
-		goto err;
-
-	r = dss_get_clock(&core.dss_54m_fck, "tv_fck");
-	if (r)
-		goto err;
-
-	r = dss_get_clock(&core.dss_96m_fck, "video_fck");
-	if (r)
-		goto err;
-
-	return 0;
-
-err:
-	if (core.dss_ick)
-		clk_put(core.dss_ick);
-	if (core.dss1_fck)
-		clk_put(core.dss1_fck);
-	if (core.dss2_fck)
-		clk_put(core.dss2_fck);
-	if (core.dss_54m_fck)
-		clk_put(core.dss_54m_fck);
-	if (core.dss_96m_fck)
-		clk_put(core.dss_96m_fck);
-
-	return r;
-}
-
-static void dss_put_clocks(void)
-{
-	if (core.dss_96m_fck)
-		clk_put(core.dss_96m_fck);
-	clk_put(core.dss_54m_fck);
-	clk_put(core.dss1_fck);
-	clk_put(core.dss2_fck);
-	clk_put(core.dss_ick);
-}
-
-unsigned long dss_clk_get_rate(enum dss_clock clk)
-{
-	switch (clk) {
-	case DSS_CLK_ICK:
-		return clk_get_rate(core.dss_ick);
-	case DSS_CLK_FCK1:
-		return clk_get_rate(core.dss1_fck);
-	case DSS_CLK_FCK2:
-		return clk_get_rate(core.dss2_fck);
-	case DSS_CLK_54M:
-		return clk_get_rate(core.dss_54m_fck);
-	case DSS_CLK_96M:
-		return clk_get_rate(core.dss_96m_fck);
-	}
-
-	BUG();
-	return 0;
-}
-
-static unsigned count_clk_bits(enum dss_clock clks)
-{
-	unsigned num_clks = 0;
-
-	if (clks & DSS_CLK_ICK)
-		++num_clks;
-	if (clks & DSS_CLK_FCK1)
-		++num_clks;
-	if (clks & DSS_CLK_FCK2)
-		++num_clks;
-	if (clks & DSS_CLK_54M)
-		++num_clks;
-	if (clks & DSS_CLK_96M)
-		++num_clks;
-
-	return num_clks;
-}
-
-static void dss_clk_enable_no_ctx(enum dss_clock clks)
-{
-	unsigned num_clks = count_clk_bits(clks);
-
-	if (clks & DSS_CLK_ICK)
-		clk_enable(core.dss_ick);
-	if (clks & DSS_CLK_FCK1)
-		clk_enable(core.dss1_fck);
-	if (clks & DSS_CLK_FCK2)
-		clk_enable(core.dss2_fck);
-	if (clks & DSS_CLK_54M)
-		clk_enable(core.dss_54m_fck);
-	if (clks & DSS_CLK_96M)
-		clk_enable(core.dss_96m_fck);
-
-	core.num_clks_enabled += num_clks;
-}
-
-void dss_clk_enable(enum dss_clock clks)
-{
-	bool check_ctx = core.num_clks_enabled == 0;
-
-	dss_clk_enable_no_ctx(clks);
-
-	if (check_ctx && cpu_is_omap34xx() && dss_need_ctx_restore())
-		restore_all_ctx();
-}
-
-static void dss_clk_disable_no_ctx(enum dss_clock clks)
-{
-	unsigned num_clks = count_clk_bits(clks);
-
-	if (clks & DSS_CLK_ICK)
-		clk_disable(core.dss_ick);
-	if (clks & DSS_CLK_FCK1)
-		clk_disable(core.dss1_fck);
-	if (clks & DSS_CLK_FCK2)
-		clk_disable(core.dss2_fck);
-	if (clks & DSS_CLK_54M)
-		clk_disable(core.dss_54m_fck);
-	if (clks & DSS_CLK_96M)
-		clk_disable(core.dss_96m_fck);
-
-	core.num_clks_enabled -= num_clks;
-}
-
-void dss_clk_disable(enum dss_clock clks)
-{
-	if (cpu_is_omap34xx()) {
-		unsigned num_clks = count_clk_bits(clks);
-
-		BUG_ON(core.num_clks_enabled < num_clks);
-
-		if (core.num_clks_enabled == num_clks)
-			save_all_ctx();
-	}
-
-	dss_clk_disable_no_ctx(clks);
-}
-
-static void dss_clk_enable_all_no_ctx(void)
-{
-	enum dss_clock clks;
-
-	clks = DSS_CLK_ICK | DSS_CLK_FCK1 | DSS_CLK_FCK2 | DSS_CLK_54M;
-	if (cpu_is_omap34xx())
-		clks |= DSS_CLK_96M;
-	dss_clk_enable_no_ctx(clks);
-}
-
-static void dss_clk_disable_all_no_ctx(void)
-{
-	enum dss_clock clks;
-
-	clks = DSS_CLK_ICK | DSS_CLK_FCK1 | DSS_CLK_FCK2 | DSS_CLK_54M;
-	if (cpu_is_omap34xx())
-		clks |= DSS_CLK_96M;
-	dss_clk_disable_no_ctx(clks);
-}
-
-static void dss_clk_disable_all(void)
-{
-	enum dss_clock clks;
-
-	clks = DSS_CLK_ICK | DSS_CLK_FCK1 | DSS_CLK_FCK2 | DSS_CLK_54M;
-	if (cpu_is_omap34xx())
-		clks |= DSS_CLK_96M;
-	dss_clk_disable(clks);
-}
-
 /* REGULATORS */
 
 struct regulator *dss_get_vdds_dsi(void)
@@ -403,18 +100,7 @@ struct regulator *dss_get_vdda_dac(void)
 	return reg;
 }
 
-/* DEBUGFS */
 #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
-static void dss_debug_dump_clocks(struct seq_file *s)
-{
-	core_dump_clocks(s);
-	dss_dump_clocks(s);
-	dispc_dump_clocks(s);
-#ifdef CONFIG_OMAP2_DSS_DSI
-	dsi_dump_clocks(s);
-#endif
-}
-
 static int dss_debug_show(struct seq_file *s, void *unused)
 {
 	void (*func)(struct seq_file *) = s->private;
@@ -505,14 +191,7 @@ static int omap_dss_probe(struct platform_device *pdev)
 	dss_init_overlay_managers(pdev);
 	dss_init_overlays(pdev);
 
-	r = dss_get_clocks();
-	if (r)
-		goto err_clocks;
-
-	dss_clk_enable_all_no_ctx();
-
-	core.ctx_id = dss_get_ctx_id();
-	DSSDBG("initial ctx id %u\n", core.ctx_id);
+	dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1 | DSS_CLK_54M);
 
 #ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT
 	/* DISPC_CONTROL */
@@ -586,7 +265,7 @@ static int omap_dss_probe(struct platform_device *pdev)
 			pdata->default_device = dssdev;
 	}
 
-	dss_clk_disable_all();
+	dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1 | DSS_CLK_54M);
 
 	return 0;
 
@@ -609,9 +288,6 @@ err_dpi:
 err_rfbi:
 	dss_exit();
 err_dss:
-	dss_clk_disable_all_no_ctx();
-	dss_put_clocks();
-err_clocks:
 
 	return r;
 }
@@ -620,7 +296,6 @@ static int omap_dss_remove(struct platform_device *pdev)
 {
 	struct omap_dss_board_info *pdata = pdev->dev.platform_data;
 	int i;
-	int c;
 
 	dss_uninitialize_debugfs();
 
@@ -635,47 +310,6 @@ static int omap_dss_remove(struct platform_device *pdev)
 
 	dss_exit();
 
-	/* these should be removed at some point */
-	c = core.dss_ick->usecount;
-	if (c > 0) {
-		DSSERR("warning: dss_ick usecount %d, disabling\n", c);
-		while (c-- > 0)
-			clk_disable(core.dss_ick);
-	}
-
-	c = core.dss1_fck->usecount;
-	if (c > 0) {
-		DSSERR("warning: dss1_fck usecount %d, disabling\n", c);
-		while (c-- > 0)
-			clk_disable(core.dss1_fck);
-	}
-
-	c = core.dss2_fck->usecount;
-	if (c > 0) {
-		DSSERR("warning: dss2_fck usecount %d, disabling\n", c);
-		while (c-- > 0)
-			clk_disable(core.dss2_fck);
-	}
-
-	c = core.dss_54m_fck->usecount;
-	if (c > 0) {
-		DSSERR("warning: dss_54m_fck usecount %d, disabling\n", c);
-		while (c-- > 0)
-			clk_disable(core.dss_54m_fck);
-	}
-
-	if (core.dss_96m_fck) {
-		c = core.dss_96m_fck->usecount;
-		if (c > 0) {
-			DSSERR("warning: dss_96m_fck usecount %d, disabling\n",
-					c);
-			while (c-- > 0)
-				clk_disable(core.dss_96m_fck);
-		}
-	}
-
-	dss_put_clocks();
-
 	dss_uninit_overlays(pdev);
 	dss_uninit_overlay_managers(pdev);
 
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 66ef804..fba8bcd 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -31,6 +31,7 @@
 #include <linux/clk.h>
 
 #include <plat/display.h>
+#include <plat/clock.h>
 #include "dss.h"
 
 #define DSS_BASE			0x48050000
@@ -59,10 +60,19 @@ 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;
+	int		ctx_id;
 
 	struct clk	*dpll4_m4_ck;
 
+	struct clk      *dss_ick;
+	struct clk	*dss1_fck;
+	struct clk	*dss2_fck;
+	struct clk      *dss_54m_fck;
+	struct clk	*dss_96m_fck;
+	unsigned	num_clks_enabled;
+
 	unsigned long	cache_req_pck;
 	unsigned long	cache_prate;
 	struct dss_clock_info cache_dss_cinfo;
@@ -74,6 +84,11 @@ static struct {
 	u32		ctx[DSS_SZ_REGS / sizeof(u32)];
 } dss;
 
+static void dss_clk_enable_all_no_ctx(void);
+static void dss_clk_disable_all_no_ctx(void);
+static void dss_clk_enable_no_ctx(enum dss_clock clks);
+static void dss_clk_disable_no_ctx(enum dss_clock clks);
+
 static int _omap_dss_wait_reset(void);
 
 static inline void dss_write_reg(const struct dss_reg idx, u32 val)
@@ -86,14 +101,377 @@ static inline u32 dss_read_reg(const struct dss_reg idx)
 	return __raw_readl(dss.base + idx.idx);
 }
 
+/* CONTEXT */
+static int dss_get_ctx_id(void)
+{
+	struct omap_display_platform_data *pdata = dss.pdev->dev.platform_data;
+	int r;
+
+	if (!pdata->board_data->get_last_off_on_transaction_id)
+		return 0;
+	r = pdata->board_data->get_last_off_on_transaction_id(&dss.pdev->dev);
+	if (r < 0) {
+		dev_err(&dss.pdev->dev, "getting transaction ID failed, "
+				"will force context restore\n");
+		r = -1;
+	}
+	return r;
+}
+
+int dss_need_ctx_restore(void)
+{
+	int id = dss_get_ctx_id();
+
+	if (id < 0 || id != dss.ctx_id) {
+		DSSDBG("ctx id %d -> id %d\n",
+				dss.ctx_id, id);
+		dss.ctx_id = id;
+		return 1;
+	} else {
+		return 0;
+	}
+}
+
+static void save_all_ctx(void)
+{
+	DSSDBG("save context\n");
+
+	dss_clk_enable_no_ctx(DSS_CLK_ICK | DSS_CLK_FCK1);
+
+	dss_save_context();
+	dispc_save_context();
+#ifdef CONFIG_OMAP2_DSS_DSI
+	dsi_save_context();
+#endif
+
+	dss_clk_disable_no_ctx(DSS_CLK_ICK | DSS_CLK_FCK1);
+}
+
+static void restore_all_ctx(void)
+{
+	DSSDBG("restore context\n");
+
+	dss_clk_enable_all_no_ctx();
+
+	dss_restore_context();
+	dispc_restore_context();
+#ifdef CONFIG_OMAP2_DSS_DSI
+	dsi_restore_context();
+#endif
+
+	dss_clk_disable_all_no_ctx();
+}
+
+static int dss_get_clock(struct clk **clock, const char *clk_name)
+{
+	struct clk *clk;
+
+	clk = clk_get(&dss.pdev->dev, clk_name);
+
+	if (IS_ERR(clk)) {
+		DSSERR("can't get clock %s", clk_name);
+		return PTR_ERR(clk);
+	}
+
+	*clock = clk;
+
+	DSSDBG("clk %s, rate %ld\n", clk_name, clk_get_rate(clk));
+
+	return 0;
+}
+
+static int dss_get_clocks(void)
+{
+	int r;
+
+	dss.dss_ick = NULL;
+	dss.dss1_fck = NULL;
+	dss.dss2_fck = NULL;
+	dss.dss_54m_fck = NULL;
+	dss.dss_96m_fck = NULL;
+
+	r = dss_get_clock(&dss.dss_ick, "ick");
+	if (r)
+		goto err;
+
+	r = dss_get_clock(&dss.dss1_fck, "dss1_fck");
+	if (r)
+		goto err;
+
+	r = dss_get_clock(&dss.dss2_fck, "dss2_fck");
+	if (r)
+		goto err;
+
+	r = dss_get_clock(&dss.dss_54m_fck, "tv_fck");
+	if (r)
+		goto err;
+
+	r = dss_get_clock(&dss.dss_96m_fck, "video_fck");
+	if (r)
+		goto err;
+
+	return 0;
+
+err:
+	if (dss.dss_ick)
+		clk_put(dss.dss_ick);
+	if (dss.dss1_fck)
+		clk_put(dss.dss1_fck);
+	if (dss.dss2_fck)
+		clk_put(dss.dss2_fck);
+	if (dss.dss_54m_fck)
+		clk_put(dss.dss_54m_fck);
+	if (dss.dss_96m_fck)
+		clk_put(dss.dss_96m_fck);
+
+	return r;
+}
+
+static void dss_put_clocks(void)
+{
+	if (dss.dss_96m_fck)
+		clk_put(dss.dss_96m_fck);
+	clk_put(dss.dss_54m_fck);
+	clk_put(dss.dss1_fck);
+	clk_put(dss.dss2_fck);
+	clk_put(dss.dss_ick);
+}
+
+unsigned long dss_clk_get_rate(enum dss_clock clk)
+{
+	switch (clk) {
+	case DSS_CLK_ICK:
+		return clk_get_rate(dss.dss_ick);
+	case DSS_CLK_FCK1:
+		return clk_get_rate(dss.dss1_fck);
+	case DSS_CLK_FCK2:
+		return clk_get_rate(dss.dss2_fck);
+	case DSS_CLK_54M:
+		return clk_get_rate(dss.dss_54m_fck);
+	case DSS_CLK_96M:
+		return clk_get_rate(dss.dss_96m_fck);
+	}
+
+	BUG();
+	return 0;
+}
+
+static unsigned count_clk_bits(enum dss_clock clks)
+{
+	unsigned num_clks = 0;
+
+	if (clks & DSS_CLK_ICK)
+		++num_clks;
+	if (clks & DSS_CLK_FCK1)
+		++num_clks;
+	if (clks & DSS_CLK_FCK2)
+		++num_clks;
+	if (clks & DSS_CLK_54M)
+		++num_clks;
+	if (clks & DSS_CLK_96M)
+		++num_clks;
+
+	return num_clks;
+}
+
+static void dss_clk_enable_no_ctx(enum dss_clock clks)
+{
+	unsigned num_clks = count_clk_bits(clks);
+
+	if (clks & DSS_CLK_ICK)
+		clk_enable(dss.dss_ick);
+	if (clks & DSS_CLK_FCK1)
+		clk_enable(dss.dss1_fck);
+	if (clks & DSS_CLK_FCK2)
+		clk_enable(dss.dss2_fck);
+	if (clks & DSS_CLK_54M)
+		clk_enable(dss.dss_54m_fck);
+	if (clks & DSS_CLK_96M)
+		clk_enable(dss.dss_96m_fck);
+
+	dss.num_clks_enabled += num_clks;
+}
+
+void dss_clk_enable(enum dss_clock clks)
+{
+	bool check_ctx = dss.num_clks_enabled == 0;
+
+	dss_clk_enable_no_ctx(clks);
+
+	if (check_ctx && cpu_is_omap34xx() && dss_need_ctx_restore())
+		restore_all_ctx();
+}
+
+static void dss_clk_disable_no_ctx(enum dss_clock clks)
+{
+	unsigned num_clks = count_clk_bits(clks);
+
+	if (clks & DSS_CLK_ICK)
+		clk_disable(dss.dss_ick);
+	if (clks & DSS_CLK_FCK1)
+		clk_disable(dss.dss1_fck);
+	if (clks & DSS_CLK_FCK2)
+		clk_disable(dss.dss2_fck);
+	if (clks & DSS_CLK_54M)
+		clk_disable(dss.dss_54m_fck);
+	if (clks & DSS_CLK_96M)
+		clk_disable(dss.dss_96m_fck);
+
+	dss.num_clks_enabled -= num_clks;
+}
+
+void dss_clk_disable(enum dss_clock clks)
+{
+	if (cpu_is_omap34xx()) {
+		unsigned num_clks = count_clk_bits(clks);
+
+		BUG_ON(dss.num_clks_enabled < num_clks);
+
+		if (dss.num_clks_enabled == num_clks)
+			save_all_ctx();
+	}
+
+	dss_clk_disable_no_ctx(clks);
+}
+
+static void dss_clk_enable_all_no_ctx(void)
+{
+	enum dss_clock clks;
+
+	clks = DSS_CLK_ICK | DSS_CLK_FCK1 | DSS_CLK_FCK2 | DSS_CLK_54M;
+	if (cpu_is_omap34xx())
+		clks |= DSS_CLK_96M;
+	dss_clk_enable_no_ctx(clks);
+}
+
+static void dss_clk_disable_all_no_ctx(void)
+{
+	enum dss_clock clks;
+
+	clks = DSS_CLK_ICK | DSS_CLK_FCK1 | DSS_CLK_FCK2 | DSS_CLK_54M;
+	if (cpu_is_omap34xx())
+		clks |= DSS_CLK_96M;
+	dss_clk_disable_no_ctx(clks);
+}
+
+static void dss_clk_disable_all(void)
+{
+	enum dss_clock clks;
+
+	clks = DSS_CLK_ICK | DSS_CLK_FCK1 | DSS_CLK_FCK2 | DSS_CLK_54M;
+	if (cpu_is_omap34xx())
+		clks |= DSS_CLK_96M;
+	dss_clk_disable(clks);
+}
+
+#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
+/* CLOCKS */
+static void core_dump_clocks(struct seq_file *s)
+{
+	int i;
+	struct clk *clocks[5] = {
+		dss.dss_ick,
+		dss.dss1_fck,
+		dss.dss2_fck,
+		dss.dss_54m_fck,
+		dss.dss_96m_fck
+	};
+
+	seq_printf(s, "- CORE -\n");
+
+	seq_printf(s, "internal clk count\t\t%u\n", dss.num_clks_enabled);
+
+	for (i = 0; i < 5; i++) {
+		if (!clocks[i])
+			continue;
+		seq_printf(s, "%-15s\t%lu\t%d\n",
+				clocks[i]->name,
+				clk_get_rate(clocks[i]),
+				clocks[i]->usecount);
+	}
+}
+#endif /* defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT) */
+
+/* DEBUGFS */
+#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
+void dss_debug_dump_clocks(struct seq_file *s)
+{
+	core_dump_clocks(s);
+	dss_dump_clocks(s);
+	dispc_dump_clocks(s);
+#ifdef CONFIG_OMAP2_DSS_DSI
+	dsi_dump_clocks(s);
+#endif
+}
+#endif
+
+
 /* DSS HW IP initialisation */
 static int omap_dsshw_probe(struct platform_device *pdev)
 {
-	return 0;
+	int r;
+
+	dss.pdev = pdev;
+
+	r = dss_get_clocks();
+	if (r)
+		goto err_clocks;
+
+	dss_clk_enable_all_no_ctx();
+
+	dss.ctx_id = dss_get_ctx_id();
+	DSSDBG("initial ctx id %u\n", dss.ctx_id);
+
+	dss_clk_disable_all_no_ctx();
+err_clocks:
+
+	return r;
 }
 
 static int omap_dsshw_remove(struct platform_device *pdev)
 {
+	int c;
+
+	/* these should be removed at some point */
+	c = dss.dss_ick->usecount;
+	if (c > 0) {
+		DSSERR("warning: dss_ick usecount %d, disabling\n", c);
+		while (c-- > 0)
+			clk_disable(dss.dss_ick);
+	}
+
+	c = dss.dss1_fck->usecount;
+	if (c > 0) {
+		DSSERR("warning: dss1_fck usecount %d, disabling\n", c);
+		while (c-- > 0)
+			clk_disable(dss.dss1_fck);
+	}
+
+	c = dss.dss2_fck->usecount;
+	if (c > 0) {
+		DSSERR("warning: dss2_fck usecount %d, disabling\n", c);
+		while (c-- > 0)
+			clk_disable(dss.dss2_fck);
+	}
+
+	c = dss.dss_54m_fck->usecount;
+	if (c > 0) {
+		DSSERR("warning: dss_54m_fck usecount %d, disabling\n", c);
+		while (c-- > 0)
+			clk_disable(dss.dss_54m_fck);
+	}
+
+	if (dss.dss_96m_fck) {
+		c = dss.dss_96m_fck->usecount;
+		if (c > 0) {
+			DSSERR("warning: dss_96m_fck usecount %d, disabling\n",
+					c);
+			while (c-- > 0)
+				clk_disable(dss.dss_96m_fck);
+		}
+	}
+
+	dss_put_clocks();
 	return 0;
 }
 
@@ -104,7 +482,7 @@ static struct platform_driver omap_dsshw_driver = {
 	.suspend	= NULL,
 	.resume		= NULL,
 	.driver         = {
-		.name   = "dss",
+		.name   = "dss_dss",
 		.owner  = THIS_MODULE,
 	},
 };
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 5c7940d..0029aff 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -169,11 +169,6 @@ struct seq_file;
 struct platform_device;
 
 /* core */
-void dss_clk_enable(enum dss_clock clks);
-void dss_clk_disable(enum dss_clock clks);
-unsigned long dss_clk_get_rate(enum dss_clock clk);
-int dss_need_ctx_restore(void);
-void dss_dump_clocks(struct seq_file *s);
 struct bus_type *dss_get_bus(void);
 struct regulator *dss_get_vdds_dsi(void);
 struct regulator *dss_get_vdds_sdi(void);
@@ -219,8 +214,17 @@ void dss_exit(void);
 
 void dss_save_context(void);
 void dss_restore_context(void);
+void dss_clk_enable(enum dss_clock clks);
+void dss_clk_disable(enum dss_clock clks);
+unsigned long dss_clk_get_rate(enum dss_clock clk);
+int dss_need_ctx_restore(void);
+void dss_dump_clocks(struct seq_file *s);
+
 
 void dss_dump_regs(struct seq_file *s);
+#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
+void dss_debug_dump_clocks(struct seq_file *s);
+#endif
 
 void dss_sdi_init(u8 datapairs);
 int dss_sdi_enable(void);
-- 
1.6.3.3


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

* [PATCH v1 10/16] OMAP3: hwmod DSS: DSS Move init,exit to driver
  2010-10-06 11:14                 ` [PATCH v1 09/16] OMAP3: hwmod DSS: Move clocks from core driver to dss driver Guruswamy Senthilvadivu
@ 2010-10-06 11:14                   ` Guruswamy Senthilvadivu
  2010-10-06 11:14                     ` [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI " Guruswamy Senthilvadivu
  0 siblings, 1 reply; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Move init exit methods to its driver probe remove.
pdev member has to be maintained by its own drivers.

Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
---
 drivers/video/omap2/dss/core.c |   16 ----------------
 drivers/video/omap2/dss/dss.c  |   16 ++++++++++++++++
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index ce5240f..54fe333 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -193,18 +193,6 @@ static int omap_dss_probe(struct platform_device *pdev)
 
 	dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1 | DSS_CLK_54M);
 
-#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;
-	}
-
 	r = rfbi_init();
 	if (r) {
 		DSSERR("Failed to initialize rfbi\n");
@@ -286,8 +274,6 @@ err_dispc:
 err_dpi:
 	rfbi_exit();
 err_rfbi:
-	dss_exit();
-err_dss:
 
 	return r;
 }
@@ -308,8 +294,6 @@ static int omap_dss_remove(struct platform_device *pdev)
 		sdi_exit();
 	}
 
-	dss_exit();
-
 	dss_uninit_overlays(pdev);
 	dss_uninit_overlay_managers(pdev);
 
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index fba8bcd..b93b118 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -410,6 +410,7 @@ void dss_debug_dump_clocks(struct seq_file *s)
 static int omap_dsshw_probe(struct platform_device *pdev)
 {
 	int r;
+	int skip_init = 0;
 
 	dss.pdev = pdev;
 
@@ -422,6 +423,19 @@ static int omap_dsshw_probe(struct platform_device *pdev)
 	dss.ctx_id = dss_get_ctx_id();
 	DSSDBG("initial ctx id %u\n", dss.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);
+	if (r) {
+		DSSERR("Failed to initialize DSS\n");
+		goto err_dss;
+	}
+
+err_dss:
 	dss_clk_disable_all_no_ctx();
 err_clocks:
 
@@ -432,6 +446,8 @@ static int omap_dsshw_remove(struct platform_device *pdev)
 {
 	int c;
 
+	dss_exit();
+
 	/* these should be removed at some point */
 	c = dss.dss_ick->usecount;
 	if (c > 0) {
-- 
1.6.3.3


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

* [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI Move init,exit to driver
  2010-10-06 11:14                   ` [PATCH v1 10/16] OMAP3: hwmod DSS: DSS Move init,exit to driver Guruswamy Senthilvadivu
@ 2010-10-06 11:14                     ` Guruswamy Senthilvadivu
  2010-10-06 11:14                       ` [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC " Guruswamy Senthilvadivu
  2010-10-07 19:47                       ` [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI " Thomas Petazzoni
  0 siblings, 2 replies; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Move init exit methods to its driver probe,remove.
pdev member has to be maintained by its own drivers.

Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
---
 drivers/video/omap2/dss/core.c |    9 ---------
 drivers/video/omap2/dss/rfbi.c |   14 +++++++++++++-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 54fe333..cc7a5f1 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -193,12 +193,6 @@ static int omap_dss_probe(struct platform_device *pdev)
 
 	dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1 | DSS_CLK_54M);
 
-	r = rfbi_init();
-	if (r) {
-		DSSERR("Failed to initialize rfbi\n");
-		goto err_rfbi;
-	}
-
 	r = dpi_init(pdev);
 	if (r) {
 		DSSERR("Failed to initialize dpi\n");
@@ -272,8 +266,6 @@ err_venc:
 err_dispc:
 	dpi_exit();
 err_dpi:
-	rfbi_exit();
-err_rfbi:
 
 	return r;
 }
@@ -288,7 +280,6 @@ static int omap_dss_remove(struct platform_device *pdev)
 	venc_exit();
 	dispc_exit();
 	dpi_exit();
-	rfbi_exit();
 	if (cpu_is_omap34xx()) {
 		dsi_exit();
 		sdi_exit();
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 23598ea..9bee39d 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -100,6 +100,7 @@ static int rfbi_convert_timings(struct rfbi_timings *t);
 static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div);
 
 static struct {
+	struct platform_device *pdev;
 	void __iomem	*base;
 
 	unsigned long	l4_khz;
@@ -142,11 +143,22 @@ static inline u32 rfbi_read_reg(const struct rfbi_reg idx)
 /* RFBI HW IP initialisation */
 static int omap_rfbihw_probe(struct platform_device *pdev)
 {
-	return 0;
+	int r;
+	rfbi.pdev = pdev;
+
+	r = rfbi_init();
+	if (r) {
+		DSSERR("Failed to initialize rfbi\n");
+		goto err_rfbi;
+	}
+
+err_rfbi:
+	return r;
 }
 
 static int omap_rfbihw_remove(struct platform_device *pdev)
 {
+	rfbi_exit();
 	return 0;
 }
 
-- 
1.6.3.3


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

* [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC Move init,exit to driver
  2010-10-06 11:14                     ` [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI " Guruswamy Senthilvadivu
@ 2010-10-06 11:14                       ` Guruswamy Senthilvadivu
  2010-10-06 11:14                         ` [PATCH v1 13/16] OMAP3: hwmod DSS: VENC " Guruswamy Senthilvadivu
                                           ` (2 more replies)
  2010-10-07 19:47                       ` [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI " Thomas Petazzoni
  1 sibling, 3 replies; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Move init exit methods to its driver probe,remove.
pdev member has to be maintained by its own drivers.

Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
---
 drivers/video/omap2/dss/core.c  |    9 ---------
 drivers/video/omap2/dss/dispc.c |   14 +++++++++++++-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index cc7a5f1..9652ed7 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -199,12 +199,6 @@ static int omap_dss_probe(struct platform_device *pdev)
 		goto err_dpi;
 	}
 
-	r = dispc_init();
-	if (r) {
-		DSSERR("Failed to initialize dispc\n");
-		goto err_dispc;
-	}
-
 	r = venc_init(pdev);
 	if (r) {
 		DSSERR("Failed to initialize venc\n");
@@ -262,8 +256,6 @@ err_dsi:
 err_sdi:
 	venc_exit();
 err_venc:
-	dispc_exit();
-err_dispc:
 	dpi_exit();
 err_dpi:
 
@@ -278,7 +270,6 @@ static int omap_dss_remove(struct platform_device *pdev)
 	dss_uninitialize_debugfs();
 
 	venc_exit();
-	dispc_exit();
 	dpi_exit();
 	if (cpu_is_omap34xx()) {
 		dsi_exit();
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index e48c6fa..e35cc87 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -156,6 +156,7 @@ struct dispc_irq_stats {
 };
 
 static struct {
+	struct platform_device *pdev;
 	void __iomem    *base;
 
 	u32	fifo_size[3];
@@ -189,11 +190,22 @@ static inline u32 dispc_read_reg(const struct dispc_reg idx)
 /* DISPC HW IP initialisation */
 static int omap_dispchw_probe(struct platform_device *pdev)
 {
-	return 0;
+	int r;
+	dispc.pdev = pdev;
+
+	r = dispc_init();
+	if (r) {
+		DSSERR("Failed to initialize dispc\n");
+		goto err_dispc;
+	}
+
+err_dispc:
+	return r;
 }
 
 static int omap_dispchw_remove(struct platform_device *pdev)
 {
+	dispc_exit();
 	return 0;
 }
 
-- 
1.6.3.3


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

* [PATCH v1 13/16] OMAP3: hwmod DSS: VENC Move init,exit to driver
  2010-10-06 11:14                       ` [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC " Guruswamy Senthilvadivu
@ 2010-10-06 11:14                         ` Guruswamy Senthilvadivu
  2010-10-06 11:14                           ` [PATCH v1 14/16] OMAP3: hwmod DSS: DSI Move init, exit " Guruswamy Senthilvadivu
  2010-10-07 19:57                           ` [PATCH v1 13/16] OMAP3: hwmod DSS: VENC Move init,exit " Thomas Petazzoni
  2010-10-06 14:19                         ` [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC " Premi, Sanjeev
  2010-10-07 19:48                         ` Thomas Petazzoni
  2 siblings, 2 replies; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Move init exit methods to its driver probe, remove.
pdev member has to be maintained by its own drivers.
regulator has to be privately handled in each driver.

Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
---
 arch/arm/mach-omap2/board-3430sdp.c |    2 +-
 drivers/video/omap2/dss/core.c      |   29 ---------------
 drivers/video/omap2/dss/venc.c      |   69 +++++++++++++++++++++++++----------
 3 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 62b6523..edcfaff 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -303,7 +303,7 @@ static struct omap_dss_board_info sdp3430_dss_data = {
 };
 
 static struct regulator_consumer_supply sdp3430_vdda_dac_supply =
-	REGULATOR_SUPPLY("vdda_dac", "omapdisplay");
+	REGULATOR_SUPPLY("vdda_dac", "dss_venc");
 
 static struct omap_board_config_kernel sdp3430_config[] __initdata = {
 };
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 9652ed7..df74116 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -43,7 +43,6 @@ static struct {
 
 	struct regulator *vdds_dsi_reg;
 	struct regulator *vdds_sdi_reg;
-	struct regulator *vdda_dac_reg;
 } core;
 
 
@@ -86,20 +85,6 @@ struct regulator *dss_get_vdds_sdi(void)
 	return reg;
 }
 
-struct regulator *dss_get_vdda_dac(void)
-{
-	struct regulator *reg;
-
-	if (core.vdda_dac_reg != NULL)
-		return core.vdda_dac_reg;
-
-	reg = regulator_get(&core.pdev->dev, "vdda_dac");
-	if (!IS_ERR(reg))
-		core.vdda_dac_reg = reg;
-
-	return reg;
-}
-
 #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
 static int dss_debug_show(struct seq_file *s, void *unused)
 {
@@ -199,12 +184,6 @@ static int omap_dss_probe(struct platform_device *pdev)
 		goto err_dpi;
 	}
 
-	r = venc_init(pdev);
-	if (r) {
-		DSSERR("Failed to initialize venc\n");
-		goto err_venc;
-	}
-
 	if (cpu_is_omap34xx()) {
 		r = sdi_init(skip_init);
 		if (r) {
@@ -254,8 +233,6 @@ err_dsi:
 	if (cpu_is_omap34xx())
 		sdi_exit();
 err_sdi:
-	venc_exit();
-err_venc:
 	dpi_exit();
 err_dpi:
 
@@ -269,7 +246,6 @@ static int omap_dss_remove(struct platform_device *pdev)
 
 	dss_uninitialize_debugfs();
 
-	venc_exit();
 	dpi_exit();
 	if (cpu_is_omap34xx()) {
 		dsi_exit();
@@ -562,11 +538,6 @@ static void __exit omap_dss_exit(void)
 		core.vdds_sdi_reg = NULL;
 	}
 
-	if (core.vdda_dac_reg != NULL) {
-		regulator_put(core.vdda_dac_reg);
-		core.vdda_dac_reg = NULL;
-	}
-
 	platform_driver_unregister(&omap_dss_driver);
 
 	omap_dss_bus_unregister();
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index ec17b28..3a121cb 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -87,26 +87,6 @@
 #define VENC_OUTPUT_TEST			0xC8
 #define VENC_DAC_B__DAC_C			0xC8
 
-/* VENC HW IP initialisation */
-static int omap_venchw_probe(struct platform_device *pdev)
-{
-	return 0;
-}
-
-static int omap_venchw_remove(struct platform_device *pdev)
-{
-	return 0;
-}
-
-static struct platform_driver omap_venchw_driver = {
-	.probe          = omap_venchw_probe,
-	.remove         = omap_venchw_remove,
-	.driver         = {
-		.name   = "dss_venc",
-		.owner  = THIS_MODULE,
-	},
-};
-
 struct venc_config {
 	u32 f_control;
 	u32 vidout_ctrl;
@@ -309,6 +289,7 @@ const struct omap_video_timings omap_dss_ntsc_timings = {
 EXPORT_SYMBOL(omap_dss_ntsc_timings);
 
 static struct {
+	struct platform_device *pdev;
 	void __iomem *base;
 	struct mutex venc_lock;
 	u32 wss_data;
@@ -326,6 +307,37 @@ static inline u32 venc_read_reg(int idx)
 	return l;
 }
 
+/* VENC HW IP initialisation */
+static int omap_venchw_probe(struct platform_device *pdev)
+{
+	int r;
+	venc.pdev = pdev;
+
+	r = venc_init(pdev);
+	if (r) {
+		DSSERR("Failed to initialize venc\n");
+		goto err_venc;
+	}
+
+err_venc:
+	return r;
+}
+
+static int omap_venchw_remove(struct platform_device *pdev)
+{
+	venc_exit();
+	return 0;
+}
+
+static struct platform_driver omap_venchw_driver = {
+	.probe          = omap_venchw_probe,
+	.remove         = omap_venchw_remove,
+	.driver         = {
+		.name   = "dss_venc",
+		.owner  = THIS_MODULE,
+	},
+};
+
 static void venc_write_config(const struct venc_config *config)
 {
 	DSSDBG("write venc conf\n");
@@ -661,7 +673,19 @@ static struct omap_dss_driver venc_driver = {
 };
 /* driver end */
 
+struct regulator *dss_get_vdda_dac(void)
+{
+	struct regulator *reg;
+
+	if (venc.vdda_dac_reg != NULL)
+		return venc.vdda_dac_reg;
+
+	reg = regulator_get(&venc.pdev->dev, "vdda_dac");
+	if (!IS_ERR(reg))
+		venc.vdda_dac_reg = reg;
 
+	return reg;
+}
 
 int venc_init(struct platform_device *pdev)
 {
@@ -696,6 +720,11 @@ int venc_init(struct platform_device *pdev)
 
 void venc_exit(void)
 {
+	if (venc.vdda_dac_reg != NULL) {
+		regulator_put(venc.vdda_dac_reg);
+		venc.vdda_dac_reg = NULL;
+	}
+
 	omap_dss_unregister_driver(&venc_driver);
 
 	iounmap(venc.base);
-- 
1.6.3.3


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

* [PATCH v1 14/16] OMAP3: hwmod DSS: DSI Move init, exit to driver
  2010-10-06 11:14                         ` [PATCH v1 13/16] OMAP3: hwmod DSS: VENC " Guruswamy Senthilvadivu
@ 2010-10-06 11:14                           ` Guruswamy Senthilvadivu
  2010-10-06 11:14                             ` [PATCH v1 15/16] OMAP3: hwmod DSS: Use platform device to get baseaddr Guruswamy Senthilvadivu
  2010-10-07 20:00                             ` [PATCH v1 14/16] OMAP3: hwmod DSS: DSI Move init, exit to driver Thomas Petazzoni
  2010-10-07 19:57                           ` [PATCH v1 13/16] OMAP3: hwmod DSS: VENC Move init,exit " Thomas Petazzoni
  1 sibling, 2 replies; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

Move init exit methods to its driver probe, remove.
pdev member has to be maintained by its own drivers.
regulator has to be privately handled in each driver.

Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
---
 arch/arm/mach-omap2/board-3430sdp.c |    1 +
 drivers/video/omap2/dss/core.c      |    8 --------
 drivers/video/omap2/dss/dsi.c       |   28 ++++++++++++++++++++++++++--
 3 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index edcfaff..fc27cd5 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -528,6 +528,7 @@ static struct regulator_init_data sdp3430_vdac = {
 /* VPLL2 for digital video outputs */
 static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = {
 	REGULATOR_SUPPLY("vdds_dsi", "omapdisplay"),
+	REGULATOR_SUPPLY("vdds_dsi", "dss_dsi1"),
 };
 
 static struct regulator_init_data sdp3430_vpll2 = {
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index df74116..d44ed6c 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -191,11 +191,6 @@ static int omap_dss_probe(struct platform_device *pdev)
 			goto err_sdi;
 		}
 
-		r = dsi_init(pdev);
-		if (r) {
-			DSSERR("Failed to initialize DSI\n");
-			goto err_dsi;
-		}
 	}
 
 	r = dss_initialize_debugfs();
@@ -228,9 +223,6 @@ err_register:
 	dss_uninitialize_debugfs();
 err_debugfs:
 	if (cpu_is_omap34xx())
-		dsi_exit();
-err_dsi:
-	if (cpu_is_omap34xx())
 		sdi_exit();
 err_sdi:
 	dpi_exit();
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index fd49663..092d7fe 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -222,6 +222,7 @@ struct dsi_irq_stats {
 
 static struct
 {
+	struct platform_device *pdev;
 	void __iomem	*base;
 
 	struct dsi_clock_info current_cinfo;
@@ -295,11 +296,20 @@ static inline u32 dsi_read_reg(const struct dsi_reg idx)
 /* DSI1 HW IP initialisation */
 static int omap_dsi1hw_probe(struct platform_device *pdev)
 {
-	return 0;
+	int r;
+	dsi.pdev = pdev;
+	r = dsi_init(pdev);
+	if (r) {
+		DSSERR("Failed to initialize DSI\n");
+		goto err_dsi;
+	}
+err_dsi:
+	return r;
 }
 
 static int omap_dsi1hw_remove(struct platform_device *pdev)
 {
+	dsi_exit();
 	return 0;
 }
 
@@ -312,6 +322,20 @@ static struct platform_driver omap_dsi1hw_driver = {
 	},
 };
 
+static struct regulator *dsi_get_vdds_dsi(void)
+{
+	struct regulator *reg;
+
+	if (dsi.vdds_dsi_reg != NULL)
+		return dsi.vdds_dsi_reg;
+
+	reg = regulator_get(&dsi.pdev->dev, "vdds_dsi");
+	if (!IS_ERR(reg))
+		dsi.vdds_dsi_reg = reg;
+
+	return reg;
+}
+
 
 void dsi_save_context(void)
 {
@@ -3292,7 +3316,7 @@ int dsi_init(struct platform_device *pdev)
 		goto err1;
 	}
 
-	dsi.vdds_dsi_reg = dss_get_vdds_dsi();
+	dsi.vdds_dsi_reg = dsi_get_vdds_dsi();
 	if (IS_ERR(dsi.vdds_dsi_reg)) {
 		iounmap(dsi.base);
 		DSSERR("can't get VDDS_DSI regulator\n");
-- 
1.6.3.3


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

* [PATCH v1 15/16] OMAP3: hwmod DSS: Use platform device to get baseaddr
  2010-10-06 11:14                           ` [PATCH v1 14/16] OMAP3: hwmod DSS: DSI Move init, exit " Guruswamy Senthilvadivu
@ 2010-10-06 11:14                             ` Guruswamy Senthilvadivu
  2010-10-06 11:14                               ` [PATCH v1 16/16] OMAP3: hwmod DSS: Get DSS IRQ from platform device Guruswamy Senthilvadivu
  2010-10-07 20:00                             ` [PATCH v1 14/16] OMAP3: hwmod DSS: DSI Move init, exit to driver Thomas Petazzoni
  1 sibling, 1 reply; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

DSS, DISPC, DSI, RFBI, VENC baseaddr got from platform_device.
Hardcoding of base addr could be removed.

Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
---
 drivers/video/omap2/dss/dispc.c |   10 +++++++---
 drivers/video/omap2/dss/dsi.c   |   12 +++++++++---
 drivers/video/omap2/dss/dss.c   |   11 ++++++++---
 drivers/video/omap2/dss/rfbi.c  |   10 +++++++---
 drivers/video/omap2/dss/venc.c  |   10 +++++++---
 5 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index e35cc87..4642bf1 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -41,8 +41,6 @@
 #include "dss.h"
 
 /* DISPC */
-#define DISPC_BASE			0x48050400
-
 #define DISPC_SZ_REGS			SZ_1K
 
 struct dispc_reg { u16 idx; };
@@ -3134,6 +3132,7 @@ static void _omap_dispc_initial_config(void)
 int dispc_init(void)
 {
 	u32 rev;
+	struct resource *dispc_mem;
 
 	spin_lock_init(&dispc.irq_lock);
 
@@ -3144,7 +3143,12 @@ int dispc_init(void)
 
 	INIT_WORK(&dispc.error_work, dispc_error_worker);
 
-	dispc.base = ioremap(DISPC_BASE, DISPC_SZ_REGS);
+	dispc_mem = platform_get_resource(dispc.pdev, IORESOURCE_MEM, 0);
+	if (!dispc_mem) {
+		DSSERR("can't get IORESOURCE_MEM DISPC\n");
+		return -EINVAL;
+	}
+	dispc.base = ioremap(dispc_mem->start, resource_size(dispc_mem));
 	if (!dispc.base) {
 		DSSERR("can't ioremap DISPC\n");
 		return -ENOMEM;
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 092d7fe..f54f967 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -42,8 +42,6 @@
 /*#define VERBOSE_IRQ*/
 #define DSI_CATCH_MISSING_TE
 
-#define DSI_BASE		0x4804FC00
-
 struct dsi_reg { u16 idx; };
 
 #define DSI_REG(idx)		((const struct dsi_reg) { idx })
@@ -3283,6 +3281,7 @@ int dsi_init(struct platform_device *pdev)
 {
 	u32 rev;
 	int r;
+	struct resource *dsi_mem;
 
 	spin_lock_init(&dsi.errors_lock);
 	dsi.errors = 0;
@@ -3309,7 +3308,13 @@ int dsi_init(struct platform_device *pdev)
 	dsi.te_timer.function = dsi_te_timeout;
 	dsi.te_timer.data = 0;
 #endif
-	dsi.base = ioremap(DSI_BASE, DSI_SZ_REGS);
+	dsi_mem = platform_get_resource(dsi.pdev, IORESOURCE_MEM, 0);
+	if (!dsi_mem) {
+		DSSERR("can't get IORESOURCE_MEM DSI\n");
+		r = -EINVAL;
+		goto err0;
+	}
+	dsi.base = ioremap(dsi_mem->start, resource_size(dsi_mem));
 	if (!dsi.base) {
 		DSSERR("can't ioremap DSI\n");
 		r = -ENOMEM;
@@ -3337,6 +3342,7 @@ err2:
 	iounmap(dsi.base);
 err1:
 	destroy_workqueue(dsi.workqueue);
+err0:
 	return r;
 }
 
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index b93b118..9a95ab8 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -34,8 +34,6 @@
 #include <plat/clock.h>
 #include "dss.h"
 
-#define DSS_BASE			0x48050000
-
 #define DSS_SZ_REGS			SZ_512
 
 struct dss_reg {
@@ -970,8 +968,15 @@ int dss_init(bool skip_init)
 {
 	int r;
 	u32 rev;
+	struct resource *dss_mem;
 
-	dss.base = ioremap(DSS_BASE, DSS_SZ_REGS);
+	dss_mem = platform_get_resource(dss.pdev, IORESOURCE_MEM, 0);
+	if (!dss_mem) {
+		DSSERR("can't get IORESOURCE_MEM DSS\n");
+		r = -EINVAL;
+		goto fail0;
+	}
+	dss.base = ioremap(dss_mem->start, resource_size(dss_mem));
 	if (!dss.base) {
 		DSSERR("can't ioremap DSS\n");
 		r = -ENOMEM;
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 9bee39d..0566eec 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -36,8 +36,6 @@
 #include <plat/display.h>
 #include "dss.h"
 
-#define RFBI_BASE               0x48050800
-
 struct rfbi_reg { u16 idx; };
 
 #define RFBI_REG(idx)		((const struct rfbi_reg) { idx })
@@ -994,6 +992,7 @@ int rfbi_init(void)
 {
 	u32 rev;
 	u32 l;
+	struct resource *rfbi_mem;
 
 	spin_lock_init(&rfbi.cmd_lock);
 
@@ -1001,7 +1000,12 @@ int rfbi_init(void)
 	atomic_set(&rfbi.cmd_fifo_full, 0);
 	atomic_set(&rfbi.cmd_pending, 0);
 
-	rfbi.base = ioremap(RFBI_BASE, SZ_256);
+	rfbi_mem = platform_get_resource(rfbi.pdev, IORESOURCE_MEM, 0);
+	if (!rfbi_mem) {
+		DSSERR("can't get IORESOURCE_MEM RFBI\n");
+		return -EINVAL;
+	}
+	rfbi.base = ioremap(rfbi_mem->start, resource_size(rfbi_mem));
 	if (!rfbi.base) {
 		DSSERR("can't ioremap RFBI\n");
 		return -ENOMEM;
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 3a121cb..eccb3c7 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -39,8 +39,6 @@
 
 #include "dss.h"
 
-#define VENC_BASE	0x48050C00
-
 /* Venc registers */
 #define VENC_REV_ID				0x00
 #define VENC_STATUS				0x04
@@ -690,12 +688,18 @@ struct regulator *dss_get_vdda_dac(void)
 int venc_init(struct platform_device *pdev)
 {
 	u8 rev_id;
+	struct resource *venc_mem;
 
 	mutex_init(&venc.venc_lock);
 
 	venc.wss_data = 0;
 
-	venc.base = ioremap(VENC_BASE, SZ_1K);
+	venc_mem = platform_get_resource(venc.pdev, IORESOURCE_MEM, 0);
+	if (!venc_mem) {
+		DSSERR("can't get IORESOURCE_MEM VENC\n");
+		return -EINVAL;
+	}
+	venc.base = ioremap(venc_mem->start, resource_size(venc_mem));
 	if (!venc.base) {
 		DSSERR("can't ioremap VENC\n");
 		return -ENOMEM;
-- 
1.6.3.3


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

* [PATCH v1 16/16] OMAP3: hwmod DSS: Get DSS IRQ from platform device
  2010-10-06 11:14                             ` [PATCH v1 15/16] OMAP3: hwmod DSS: Use platform device to get baseaddr Guruswamy Senthilvadivu
@ 2010-10-06 11:14                               ` Guruswamy Senthilvadivu
  0 siblings, 0 replies; 35+ messages in thread
From: Guruswamy Senthilvadivu @ 2010-10-06 11:14 UTC (permalink / raw)
  To: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
  Cc: Senthilvadivu Guruswamy

From: Senthilvadivu Guruswamy <svadivu@ti.com>

DSS IRQ got from platform device.

Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
---
 drivers/video/omap2/dss/dss.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 9a95ab8..f56d1b8 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -966,7 +966,7 @@ void dss_set_dac_pwrdn_bgz(bool enable)
 
 int dss_init(bool skip_init)
 {
-	int r;
+	int r, dss_irq;
 	u32 rev;
 	struct resource *dss_mem;
 
@@ -1012,15 +1012,18 @@ int dss_init(bool skip_init)
 	REG_FLD_MOD(DSS_CONTROL, 0, 2, 2);	/* venc clock mode = normal */
 #endif
 
-	r = request_irq(INT_24XX_DSS_IRQ,
+	dss_irq = platform_get_irq(dss.pdev, 0);
+	if (dss_irq != -ENXIO) {
+		r = request_irq(dss_irq,
 			cpu_is_omap24xx()
 			? dss_irq_handler_omap2
 			: dss_irq_handler_omap3,
 			0, "OMAP DSS", NULL);
 
-	if (r < 0) {
-		DSSERR("omap2 dss: request_irq failed\n");
-		goto fail1;
+		if (r < 0) {
+			DSSERR("omap2 dss: request_irq failed\n");
+			goto fail1;
+		}
 	}
 
 	if (cpu_is_omap34xx()) {
-- 
1.6.3.3


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

* RE: [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC Move init,exit to driver
  2010-10-06 11:14                       ` [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC " Guruswamy Senthilvadivu
  2010-10-06 11:14                         ` [PATCH v1 13/16] OMAP3: hwmod DSS: VENC " Guruswamy Senthilvadivu
@ 2010-10-06 14:19                         ` Premi, Sanjeev
  2010-10-07  6:16                           ` Guruswamy, Senthilvadivu
  2010-10-07 19:48                         ` Thomas Petazzoni
  2 siblings, 1 reply; 35+ messages in thread
From: Premi, Sanjeev @ 2010-10-06 14:19 UTC (permalink / raw)
  To: Guruswamy, Senthilvadivu, khilman, tomi.valkeinen, paul@pwsan.com

> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org 
> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of 
> Guruswamy, Senthilvadivu
> Sent: Wednesday, October 06, 2010 4:45 PM
> To: khilman@deeprootsystems.com; tomi.valkeinen@nokia.com; 
> paul@pwsan.com; Hiremath, Vaibhav; linux-omap@vger.kernel.org
> Cc: Guruswamy, Senthilvadivu
> Subject: [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC Move 
> init,exit to driver
> 
> From: Senthilvadivu Guruswamy <svadivu@ti.com>
> 
> Move init exit methods to its driver probe,remove.
> pdev member has to be maintained by its own drivers.

[sp] How is this change related to hwmod mentioned in the
     subject line?

~sanjeev

[snip]...[snip]

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

* RE: [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC Move init,exit to driver
  2010-10-06 14:19                         ` [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC " Premi, Sanjeev
@ 2010-10-07  6:16                           ` Guruswamy, Senthilvadivu
  2010-10-07  7:17                             ` Cousson, Benoit
  0 siblings, 1 reply; 35+ messages in thread
From: Guruswamy, Senthilvadivu @ 2010-10-07  6:16 UTC (permalink / raw)
  To: Premi, Sanjeev, khilman, tomi.valkeinen, paul



> -----Original Message-----
> From: Premi, Sanjeev
> Sent: Wednesday, October 06, 2010 7:49 PM
> To: Guruswamy, Senthilvadivu; khilman@deeprootsystems.com;
> tomi.valkeinen@nokia.com; paul@pwsan.com; Hiremath, Vaibhav; linux-
> omap@vger.kernel.org
> Subject: RE: [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC Move init,exit to
> driver
> 
> > -----Original Message-----
> > From: linux-omap-owner@vger.kernel.org
> > [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of
> > Guruswamy, Senthilvadivu
> > Sent: Wednesday, October 06, 2010 4:45 PM
> > To: khilman@deeprootsystems.com; tomi.valkeinen@nokia.com;
> > paul@pwsan.com; Hiremath, Vaibhav; linux-omap@vger.kernel.org
> > Cc: Guruswamy, Senthilvadivu
> > Subject: [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC Move
> > init,exit to driver
> >
> > From: Senthilvadivu Guruswamy <svadivu@ti.com>
> >
> > Move init exit methods to its driver probe,remove.
> > pdev member has to be maintained by its own drivers.
> 
> [sp] How is this change related to hwmod mentioned in the
>      subject line?
[Senthil] As part of the hwmod design, dispc is made as platform driver.
Hence the dispc_init and dispc_exit has to be moved from core "omapdisplay" 
Driver to "dss_dispc" platform driver.  Pdev is the platform device structure maintained in dss_dispc driver containing silicon specific info like baseaddr, irqs of DISPC HW.
> ~sanjeev
> 
> [snip]...[snip]

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

* Re: [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC Move init,exit to driver
  2010-10-07  6:16                           ` Guruswamy, Senthilvadivu
@ 2010-10-07  7:17                             ` Cousson, Benoit
  2010-10-07  8:44                               ` Guruswamy, Senthilvadivu
  0 siblings, 1 reply; 35+ messages in thread
From: Cousson, Benoit @ 2010-10-07  7:17 UTC (permalink / raw)
  To: Guruswamy, Senthilvadivu
  Cc: Premi, Sanjeev, khilman, tomi.valkeinen, paul, Hiremath, Vaibhav,
	linux-omap

Hi Senthil,

On 10/7/2010 8:16 AM, Guruswamy, Senthilvadivu wrote:
>
>> From: Premi, Sanjeev
>> Sent: Wednesday, October 06, 2010 7:49 PM
>> To: Guruswamy, Senthilvadivu; khilman@deeprootsystems.com;
>> tomi.valkeinen@nokia.com; paul@pwsan.com; Hiremath, Vaibhav; linux-
>> omap@vger.kernel.org
>> Subject: RE: [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC Move init,exit to
>> driver
>>
>>> From: linux-omap-owner@vger.kernel.org
>>> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of
>>> Guruswamy, Senthilvadivu
>>> Sent: Wednesday, October 06, 2010 4:45 PM
>>> To: khilman@deeprootsystems.com; tomi.valkeinen@nokia.com;
>>> paul@pwsan.com; Hiremath, Vaibhav; linux-omap@vger.kernel.org
>>> Cc: Guruswamy, Senthilvadivu
>>> Subject: [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC Move
>>> init,exit to driver
>>>
>>> From: Senthilvadivu Guruswamy<svadivu@ti.com>
>>>
>>> Move init exit methods to its driver probe,remove.
>>> pdev member has to be maintained by its own drivers.
>>
>> [sp] How is this change related to hwmod mentioned in the
>>       subject line?
> [Senthil] As part of the hwmod design, dispc is made as platform driver.
> Hence the dispc_init and dispc_exit has to be moved from core "omapdisplay"
> Driver to "dss_dispc" platform driver.  Pdev is the platform device structure maintained in dss_dispc driver containing silicon specific info like baseaddr, irqs of DISPC HW.

It is still not a reason to put hwmod in the subject. That is valid for 
most patches of this series.
You have to put the plaform name then the subsystem if this is related 
to the OMAP arch directory, which is DSS, not hwmod DSS.

In the case of DSS driver changes, then you should start with video: 
DSS:, or maybe DSS is enough if there is no possible confusion.

The goal of that is just to highlight in the subject what part of the 
kernel you are changing, since the maintainers are not necessarily the same.

Benoit

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

* RE: [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC Move init,exit to driver
  2010-10-07  7:17                             ` Cousson, Benoit
@ 2010-10-07  8:44                               ` Guruswamy, Senthilvadivu
  2010-10-07  9:04                                 ` Cousson, Benoit
  0 siblings, 1 reply; 35+ messages in thread
From: Guruswamy, Senthilvadivu @ 2010-10-07  8:44 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: Premi, Sanjeev, khilman, tomi.valkeinen, paul, Hiremath, Vaibhav,
	linux-omap



> -----Original Message-----
> From: Cousson, Benoit
> Sent: Thursday, October 07, 2010 12:47 PM
> 
> Hi Senthil,
> 
> On 10/7/2010 8:16 AM, Guruswamy, Senthilvadivu wrote:
> >
> >> From: Premi, Sanjeev
> >>
> >>> From: linux-omap-owner@vger.kernel.org
> >>>
> >>> From: Senthilvadivu Guruswamy<svadivu@ti.com>
> >>>
> >>> Move init exit methods to its driver probe,remove.
> >>> pdev member has to be maintained by its own drivers.
> >>
> >> [sp] How is this change related to hwmod mentioned in the
> >>       subject line?
> > [Senthil] As part of the hwmod design, dispc is made as platform driver.
> > Hence the dispc_init and dispc_exit has to be moved from core
> "omapdisplay"
> > Driver to "dss_dispc" platform driver.  Pdev is the platform device
> structure maintained in dss_dispc driver containing silicon specific info
> like baseaddr, irqs of DISPC HW.
> 
> It is still not a reason to put hwmod in the subject. That is valid for
> most patches of this series.
> You have to put the plaform name then the subsystem if this is related
> to the OMAP arch directory, which is DSS, not hwmod DSS.
> 
> In the case of DSS driver changes, then you should start with video:
> DSS:, or maybe DSS is enough if there is no possible confusion.
> 
> The goal of that is just to highlight in the subject what part of the
> kernel you are changing, since the maintainers are not necessarily the
> same.
[Senthil] If "hwmod" is creating confusion, it could be removed.
Is it an ack for this patch series considering that "change in the header" is the only comment to be incorporated?

 
> Benoit

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

* Re: [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC Move init,exit to driver
  2010-10-07  8:44                               ` Guruswamy, Senthilvadivu
@ 2010-10-07  9:04                                 ` Cousson, Benoit
  0 siblings, 0 replies; 35+ messages in thread
From: Cousson, Benoit @ 2010-10-07  9:04 UTC (permalink / raw)
  To: Guruswamy, Senthilvadivu
  Cc: Premi, Sanjeev, khilman, tomi.valkeinen, paul, Hiremath, Vaibhav,
	linux-omap

On 10/7/2010 10:44 AM, Guruswamy, Senthilvadivu wrote:
>
>> From: Cousson, Benoit
>> Sent: Thursday, October 07, 2010 12:47 PM
>>
>> Hi Senthil,
>>
>> On 10/7/2010 8:16 AM, Guruswamy, Senthilvadivu wrote:
>>>
>>>> From: Premi, Sanjeev
>>>>
>>>>> From: linux-omap-owner@vger.kernel.org
>>>>>
>>>>> From: Senthilvadivu Guruswamy<svadivu@ti.com>
>>>>>
>>>>> Move init exit methods to its driver probe,remove.
>>>>> pdev member has to be maintained by its own drivers.
>>>>
>>>> [sp] How is this change related to hwmod mentioned in the
>>>>        subject line?
>>> [Senthil] As part of the hwmod design, dispc is made as platform driver.
>>> Hence the dispc_init and dispc_exit has to be moved from core
>> "omapdisplay"
>>> Driver to "dss_dispc" platform driver.  Pdev is the platform device
>> structure maintained in dss_dispc driver containing silicon specific info
>> like baseaddr, irqs of DISPC HW.
>>
>> It is still not a reason to put hwmod in the subject. That is valid for
>> most patches of this series.
>> You have to put the plaform name then the subsystem if this is related
>> to the OMAP arch directory, which is DSS, not hwmod DSS.
>>
>> In the case of DSS driver changes, then you should start with video:
>> DSS:, or maybe DSS is enough if there is no possible confusion.
>>
>> The goal of that is just to highlight in the subject what part of the
>> kernel you are changing, since the maintainers are not necessarily the
>> same.
> [Senthil] If "hwmod" is creating confusion, it could be removed.
> Is it an ack for this patch series considering that "change in the header" is the only comment to be incorporated?

Mmm, not really, but since it is the subject, this is the very first 
things you see. That why it is important to provide good subject :-)

I'll have a look at this series before the end of the week.

Benoit


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

* Re: [PATCH v1 05/16] OMAP3 DSS Driver register moved to mach_omap2
  2010-10-06 11:14         ` [PATCH v1 05/16] OMAP3 DSS Driver register moved to mach_omap2 Guruswamy Senthilvadivu
  2010-10-06 11:14           ` [PATCH v1 06/16] OMAP3: hwmod DSS: Build omap_device for each DSS HWIP Guruswamy Senthilvadivu
@ 2010-10-07 19:06           ` Thomas Petazzoni
  2010-10-08  6:54             ` Guruswamy, Senthilvadivu
  1 sibling, 1 reply; 35+ messages in thread
From: Thomas Petazzoni @ 2010-10-07 19:06 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap

Hello,

The patch title is a bit misleading, maybe it should rather be
something like "Move OMAP3 DSS driver registration to
mach-omap2/devices.c"/

On Wed,  6 Oct 2010 16:44:48 +0530
Guruswamy Senthilvadivu <svadivu@ti.com> wrote:

>  /*---------------------------------------------------------------------------*/
> +#ifdef CONFIG_OMAP2_DSS
> +
> +static struct platform_device omap_display_device = {
> +	.name          = "omapdisplay",
> +	.id            = -1,
> +	.dev            = {
> +		.platform_data = NULL,
> +	},

This .dev = {} part is useless. The compiler will automatically
initialize unset fields to zero.

> +};
> +
> +void __init omap_display_init(struct omap_dss_board_info
> +					*board_data)

*board_data should probably be on the same line as the argument type.

> +{
> +

The general kernel coding style seems to be that there shouldn't be
such empty newlines at the beginning of functions.

> +	omap_display_device.dev.platform_data = board_data;
> +
> +	if (platform_device_register(&omap_display_device) < 0)
> +		printk(KERN_ERR "Unable to register OMAP-Display device\n");
> +
> +

Unneeded newlines.

> +	return ;

This return is not needed, we are at the end of a void function.

> @@ -712,7 +712,7 @@ static struct platform_driver omap_dss_driver = {
>  	.suspend	= omap_dss_suspend,
>  	.resume		= omap_dss_resume,
>  	.driver         = {
> -		.name   = "omapdss",
> +		.name   = "omapdisplay",
>  		.owner  = THIS_MODULE,
>  	},
>  };

There are other boards instantiating a platform_device with the omapdss
name, so I think this change is going to break those boards. In my
not-so-old linux-omap tree :

$ grep "\.name.*omapdss" *
board-3430sdp.c:	.name		= "omapdss",
board-am3517evm.c:	.name		= "omapdss",
board-cm-t35.c:	.name		= "omapdss",
board-devkit8000.c:	.name		= "omapdss",
board-igep0020.c:	.name	= "omapdss",
board-omap3beagle.c:	.name          = "omapdss",
board-omap3evm.c:	.name		= "omapdss",
board-omap3pandora.c:	.name		= "omapdss",
board-omap3stalker.c:	.name	= "omapdss",
board-rx51-video.c:	.name	= "omapdss",

Shouldn't these board files also be updated to use the new
omap_display_init() function ?

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* Re: [PATCH v1 06/16] OMAP3: hwmod DSS: Build omap_device for each DSS HWIP
  2010-10-06 11:14           ` [PATCH v1 06/16] OMAP3: hwmod DSS: Build omap_device for each DSS HWIP Guruswamy Senthilvadivu
  2010-10-06 11:14             ` [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP Guruswamy Senthilvadivu
@ 2010-10-07 19:30             ` Thomas Petazzoni
  1 sibling, 0 replies; 35+ messages in thread
From: Thomas Petazzoni @ 2010-10-07 19:30 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap

Hello Senthil,

On Wed,  6 Oct 2010 16:44:49 +0530
Guruswamy Senthilvadivu <svadivu@ti.com> wrote:

>  void __init omap_display_init(struct omap_dss_board_info
>  					*board_data)
>  {
> +	struct omap_hwmod *oh;
> +	struct omap_device *od;
> +	int l, i;
> +	struct omap_display_platform_data pdata;
> +	char *oh_name[] = {
> +			"dss_dss",
> +			"dss_dispc",
> +			"dss_dsi1",
> +			"dss_rfbi",
> +			"dss_venc"
> +			};

I think it's more common to write it this way:


        char *oh_name[] = { "dss_dss", "dss_dispc", "dss_dsi1",
                            "dss_rfbi", "dss_venc" };

but I understand that this is just a matter of taste.

> +
> +	for (i = 0; i < ARRAY_SIZE(oh_name); i++) {
> +		l = snprintf(oh_name[i], MAX_OMAP_DSS_HWMOD_NAME_LEN,
> +				 oh_name[i]);
> +		WARN(l >= MAX_OMAP_DSS_HWMOD_NAME_LEN,
> +			"String buffer overflow in DSS device setup\n");

Using snprintf() just to get the length of a string is a bit overkill.
strlen() is part of the kernel API :-)

However, about the name, see below.

> +
> +		oh = omap_hwmod_lookup(oh_name[i]);
> +		if (!oh) {
> +			pr_err("Could not look up %s\n", oh_name[i]);
> +			return ;

No space needed between return and the semi-colon.

> +		}
> +		strncpy(pdata.name, oh_name[i], sizeof(oh_name[i]));

Why do you need this name into the platform_data ? omap_device_build()
will already fill the omap_device->platform_device->name field with
exactly oh_name[i]. So your drivers can just do platform_device->name
to get the name if they need it.

> +		pdata.board_data		=       board_data;
> +		pdata.board_data->get_last_off_on_transaction_id = NULL;
> +		pdata.device_enable    =       omap_device_enable;
> +		pdata.device_idle      =       omap_device_idle;
> +		pdata.device_shutdown  =       omap_device_shutdown;

pdata is defined outside of the loop, so you're passing the same pdata
address to each omap_device_build() call. Therefore, there's no need to
initialize pdata at each iteration of the loop.

> +struct omap_display_platform_data {
> +	char name[MAX_OMAP_DSS_HWMOD_NAME_LEN];
> +	struct omap_dss_board_info *board_data;
> +	int (*device_enable)(struct platform_device *pdev);
> +	int (*device_shutdown)(struct platform_device *pdev);
> +	int (*device_idle)(struct platform_device *pdev);
> +};

I'm probably missing something, but I don't see those new
device_enable, device_shutdown, device_idle fields being used in the
following patches in your series. Did I look at the wrong place ?

Thanks!

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* Re: [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI Move init,exit to driver
  2010-10-06 11:14                     ` [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI " Guruswamy Senthilvadivu
  2010-10-06 11:14                       ` [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC " Guruswamy Senthilvadivu
@ 2010-10-07 19:47                       ` Thomas Petazzoni
  2010-10-08  7:13                         ` Guruswamy, Senthilvadivu
  1 sibling, 1 reply; 35+ messages in thread
From: Thomas Petazzoni @ 2010-10-07 19:47 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap

Hello Senthil,

On Wed,  6 Oct 2010 16:44:54 +0530
Guruswamy Senthilvadivu <svadivu@ti.com> wrote:

> diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
> index 23598ea..9bee39d 100644
> --- a/drivers/video/omap2/dss/rfbi.c
> +++ b/drivers/video/omap2/dss/rfbi.c
> @@ -100,6 +100,7 @@ static int rfbi_convert_timings(struct rfbi_timings *t);
>  static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div);
>  
>  static struct {
> +	struct platform_device *pdev;
>  	void __iomem	*base;
>  
>  	unsigned long	l4_khz;
> @@ -142,11 +143,22 @@ static inline u32 rfbi_read_reg(const struct rfbi_reg idx)
>  /* RFBI HW IP initialisation */
>  static int omap_rfbihw_probe(struct platform_device *pdev)
>  {
> -	return 0;
> +	int r;
> +	rfbi.pdev = pdev;
> +
> +	r = rfbi_init();
> +	if (r) {
> +		DSSERR("Failed to initialize rfbi\n");
> +		goto err_rfbi;
> +	}
> +
> +err_rfbi:
> +	return r;
>  }
>  
>  static int omap_rfbihw_remove(struct platform_device *pdev)
>  {
> +	rfbi_exit();
>  	return 0;
>  }
>  

Instead of having probe() and remove() functions that call the existing
init() and exit(), why not making your driver look like most Linux
drivers here, and directly do the initialization in probe() and the
cleanup in remove() ?

Concerning the added pdev field to the rfbi structure, do you really it
at this point ?

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* Re: [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP
  2010-10-06 11:14             ` [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP Guruswamy Senthilvadivu
  2010-10-06 11:14               ` [PATCH v1 08/16] OMAP3: clock data: change dss driver name Guruswamy Senthilvadivu
@ 2010-10-07 19:47               ` Thomas Petazzoni
  2010-10-07 19:49               ` Thomas Petazzoni
  2 siblings, 0 replies; 35+ messages in thread
From: Thomas Petazzoni @ 2010-10-07 19:47 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap

Hello Senthil,

On Wed,  6 Oct 2010 16:44:50 +0530
Guruswamy Senthilvadivu <svadivu@ti.com> wrote:

> +static struct platform_driver omap_dsshw_driver = {
> +	.probe          = omap_dsshw_probe,
> +	.remove         = omap_dsshw_remove,
> +	.shutdown	= NULL,
> +	.suspend	= NULL,
> +	.resume		= NULL,

Those are unneeded, the compiler will initialize those fields to zero
automatically if you don't specify any value.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* Re: [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC Move init,exit to driver
  2010-10-06 11:14                       ` [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC " Guruswamy Senthilvadivu
  2010-10-06 11:14                         ` [PATCH v1 13/16] OMAP3: hwmod DSS: VENC " Guruswamy Senthilvadivu
  2010-10-06 14:19                         ` [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC " Premi, Sanjeev
@ 2010-10-07 19:48                         ` Thomas Petazzoni
  2 siblings, 0 replies; 35+ messages in thread
From: Thomas Petazzoni @ 2010-10-07 19:48 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap

Hello Senthil,

On Wed,  6 Oct 2010 16:44:55 +0530
Guruswamy Senthilvadivu <svadivu@ti.com> wrote:

>  static struct {
> +	struct platform_device *pdev;
>  	void __iomem    *base;
>  
>  	u32	fifo_size[3];
> @@ -189,11 +190,22 @@ static inline u32 dispc_read_reg(const struct dispc_reg idx)
>  /* DISPC HW IP initialisation */
>  static int omap_dispchw_probe(struct platform_device *pdev)
>  {
> -	return 0;
> +	int r;
> +	dispc.pdev = pdev;
> +
> +	r = dispc_init();
> +	if (r) {
> +		DSSERR("Failed to initialize dispc\n");
> +		goto err_dispc;
> +	}
> +
> +err_dispc:
> +	return r;
>  }
>  
>  static int omap_dispchw_remove(struct platform_device *pdev)
>  {
> +	dispc_exit();
>  	return 0;
>  }

Same comments than the one for the patch on the RFBI driver.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* Re: [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP
  2010-10-06 11:14             ` [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP Guruswamy Senthilvadivu
  2010-10-06 11:14               ` [PATCH v1 08/16] OMAP3: clock data: change dss driver name Guruswamy Senthilvadivu
  2010-10-07 19:47               ` [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP Thomas Petazzoni
@ 2010-10-07 19:49               ` Thomas Petazzoni
  2010-10-08  7:11                 ` Guruswamy, Senthilvadivu
  2 siblings, 1 reply; 35+ messages in thread
From: Thomas Petazzoni @ 2010-10-07 19:49 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap

Hello Senthil,

I forgot one comment: in most Linux drivers, it is customary to put the
platform_driver definition just above the driver initialization
function, both of them at the end of the file. Of course, it's nothing
mandatory, but most of the drivers are organized this way, making it
easy for developers to find their way in all drivers.

So, in other words, this:

> +/* DISPC HW IP initialisation */
> +static int omap_dispchw_probe(struct platform_device *pdev)
> +{
> +	return 0;
> +}
> +
> +static int omap_dispchw_remove(struct platform_device *pdev)
> +{
> +	return 0;
> +}
> +
> +static struct platform_driver omap_dispchw_driver = {
> +	.probe          = omap_dispchw_probe,
> +	.remove         = omap_dispchw_remove,
> +	.driver         = {
> +		.name   = "dss_dispc",
> +		.owner  = THIS_MODULE,
> +	},
> +};

Should be just above this:

> +static int __init omap_dispc_init(void)
> +{
> +	return platform_driver_register(&omap_dispchw_driver);
> +}
> +
> +device_initcall(omap_dispc_init);

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* Re: [PATCH v1 13/16] OMAP3: hwmod DSS: VENC Move init,exit to driver
  2010-10-06 11:14                         ` [PATCH v1 13/16] OMAP3: hwmod DSS: VENC " Guruswamy Senthilvadivu
  2010-10-06 11:14                           ` [PATCH v1 14/16] OMAP3: hwmod DSS: DSI Move init, exit " Guruswamy Senthilvadivu
@ 2010-10-07 19:57                           ` Thomas Petazzoni
  2010-10-08  7:09                             ` Guruswamy, Senthilvadivu
  1 sibling, 1 reply; 35+ messages in thread
From: Thomas Petazzoni @ 2010-10-07 19:57 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap

Hello Senthil,

On Wed,  6 Oct 2010 16:44:56 +0530
Guruswamy Senthilvadivu <svadivu@ti.com> wrote:

> diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
> index ec17b28..3a121cb 100644
> --- a/drivers/video/omap2/dss/venc.c
> +++ b/drivers/video/omap2/dss/venc.c
> @@ -87,26 +87,6 @@
>  #define VENC_OUTPUT_TEST			0xC8
>  #define VENC_DAC_B__DAC_C			0xC8
>  
> -/* VENC HW IP initialisation */
> -static int omap_venchw_probe(struct platform_device *pdev)
> -{
> -	return 0;
> -}
> -
> -static int omap_venchw_remove(struct platform_device *pdev)
> -{
> -	return 0;
> -}
> -
> -static struct platform_driver omap_venchw_driver = {
> -	.probe          = omap_venchw_probe,
> -	.remove         = omap_venchw_remove,
> -	.driver         = {
> -		.name   = "dss_venc",
> -		.owner  = THIS_MODULE,
> -	},
> -};

Would be better in patch 7/16 to put this stuff at the correct place
(bottom of the file) so it does not need to be moved here.

> +/* VENC HW IP initialisation */
> +static int omap_venchw_probe(struct platform_device *pdev)
> +{
> +	int r;
> +	venc.pdev = pdev;
> +
> +	r = venc_init(pdev);
> +	if (r) {
> +		DSSERR("Failed to initialize venc\n");
> +		goto err_venc;
> +	}
> +
> +err_venc:
> +	return r;
> +}
> +
> +static int omap_venchw_remove(struct platform_device *pdev)
> +{
> +	venc_exit();
> +	return 0;
> +}

Same comment as before: include the code of venc_init() and venc_exit()
directly in the ->probe() and ->remove() hooks respectively.

> +struct regulator *dss_get_vdda_dac(void)
> +{
> +	struct regulator *reg;
> +
> +	if (venc.vdda_dac_reg != NULL)
> +		return venc.vdda_dac_reg;
> +
> +	reg = regulator_get(&venc.pdev->dev, "vdda_dac");
> +	if (!IS_ERR(reg))
> +		venc.vdda_dac_reg = reg;
>  
> +	return reg;
> +}

As far as I can see, this function is now only used in venc_init(),
which is in the same file, so the function should be static, and the
prototype removed from drivers/video/omap2/dss/core.h.

I'm also a bit skeptical about what this function does. It is called
this way in venc_init():

  venc.vdda_dac_reg = dss_get_vdda_dac();

so it is dss_get_vdda_dac() responsability to set venc.vdda_dac_reg, or
is it the caller responsability ?

Moreover, the logic in dss_get_vdda_dac() that tests whether
venc.vdda_dac_reg is already initialized seems to indicate that this
function could be called several times. However, I only see it called
from venc_init(), which as far as I understand is called only once.

Isn't it possible to simplify this by removing the dss_get_vdda_dac()
function and just doing:

  venc.vdda_dac_reg = regulator_get(&venc.pdev->dev, "vdda_dac");

in the venc_init() function (which should become the ->probe() method).

Thanks!

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* Re: [PATCH v1 14/16] OMAP3: hwmod DSS: DSI Move init, exit to driver
  2010-10-06 11:14                           ` [PATCH v1 14/16] OMAP3: hwmod DSS: DSI Move init, exit " Guruswamy Senthilvadivu
  2010-10-06 11:14                             ` [PATCH v1 15/16] OMAP3: hwmod DSS: Use platform device to get baseaddr Guruswamy Senthilvadivu
@ 2010-10-07 20:00                             ` Thomas Petazzoni
  1 sibling, 0 replies; 35+ messages in thread
From: Thomas Petazzoni @ 2010-10-07 20:00 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap

Hello Senthil,

On Wed,  6 Oct 2010 16:44:57 +0530
Guruswamy Senthilvadivu <svadivu@ti.com> wrote:

> Move init exit methods to its driver probe, remove.
> pdev member has to be maintained by its own drivers.
> regulator has to be privately handled in each driver.

Same comments than the one for patch 13/16 about the contents of
->probe() and ->remove() methods, and the auxilliary dsi_get_vdds_dsi()
function.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* RE: [PATCH v1 05/16] OMAP3 DSS Driver register moved to mach_omap2
  2010-10-07 19:06           ` [PATCH v1 05/16] OMAP3 DSS Driver register moved to mach_omap2 Thomas Petazzoni
@ 2010-10-08  6:54             ` Guruswamy, Senthilvadivu
  0 siblings, 0 replies; 35+ messages in thread
From: Guruswamy, Senthilvadivu @ 2010-10-08  6:54 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: khilman, tomi.valkeinen, paul, Hiremath, Vaibhav, linux-omap



> -----Original Message-----
> From: Thomas Petazzoni [mailto:thomas.petazzoni@free-electrons.com]
> Sent: Friday, October 08, 2010 12:36 AM
> To: Guruswamy, Senthilvadivu
> Cc: khilman@deeprootsystems.com; tomi.valkeinen@nokia.com; paul@pwsan.com;
> Hiremath, Vaibhav; linux-omap@vger.kernel.org
> Subject: Re: [PATCH v1 05/16] OMAP3 DSS Driver register moved to
> mach_omap2
> 
> Hello,
> 
> The patch title is a bit misleading, maybe it should rather be
> something like "Move OMAP3 DSS driver registration to
> mach-omap2/devices.c"/
> 
> On Wed,  6 Oct 2010 16:44:48 +0530
> Guruswamy Senthilvadivu <svadivu@ti.com> wrote:
> 
> >  /*---------------------------------------------------------------------
> ------*/
> > +#ifdef CONFIG_OMAP2_DSS
> > +
> > +static struct platform_device omap_display_device = {
> > +	.name          = "omapdisplay",
> > +	.id            = -1,
> > +	.dev            = {
> > +		.platform_data = NULL,
> > +	},
> 
> This .dev = {} part is useless. The compiler will automatically
> initialize unset fields to zero.
> 
[Senthil]  Thanks.  When I do code movement I don't change it.
I can submit additional patches to improvise the code.

> > +};
> > +
> > +void __init omap_display_init(struct omap_dss_board_info
> > +					*board_data)
> 
> *board_data should probably be on the same line as the argument type.
> 
[Senthil] Taken.
> > +{
> > +
> 
> The general kernel coding style seems to be that there shouldn't be
> such empty newlines at the beginning of functions.
> 
> > +	omap_display_device.dev.platform_data = board_data;
> > +
> > +	if (platform_device_register(&omap_display_device) < 0)
> > +		printk(KERN_ERR "Unable to register OMAP-Display device\n");
> > +
> > +
> 
> Unneeded newlines.
> 
[Senthil] Taken.
> > +	return ;
> 
> This return is not needed, we are at the end of a void function.
> 
> > @@ -712,7 +712,7 @@ static struct platform_driver omap_dss_driver = {
> >  	.suspend	= omap_dss_suspend,
> >  	.resume		= omap_dss_resume,
> >  	.driver         = {
> > -		.name   = "omapdss",
> > +		.name   = "omapdisplay",
> >  		.owner  = THIS_MODULE,
> >  	},
> >  };
> 
> There are other boards instantiating a platform_device with the omapdss
> name, so I think this change is going to break those boards. In my
> not-so-old linux-omap tree :
> 
> $ grep "\.name.*omapdss" *
> board-3430sdp.c:	.name		= "omapdss",
> board-am3517evm.c:	.name		= "omapdss",
> board-cm-t35.c:	.name		= "omapdss",
> board-devkit8000.c:	.name		= "omapdss",
> board-igep0020.c:	.name	= "omapdss",
> board-omap3beagle.c:	.name          = "omapdss",
> board-omap3evm.c:	.name		= "omapdss",
> board-omap3pandora.c:	.name		= "omapdss",
> board-omap3stalker.c:	.name	= "omapdss",
> board-rx51-video.c:	.name	= "omapdss",
> 
> Shouldn't these board files also be updated to use the new
> omap_display_init() function ?
> 
[Senthil] Yes, Taken. I would request for testing these additional changes.
> Regards,
> 
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com

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

* RE: [PATCH v1 13/16] OMAP3: hwmod DSS: VENC Move init,exit to driver
  2010-10-07 19:57                           ` [PATCH v1 13/16] OMAP3: hwmod DSS: VENC Move init,exit " Thomas Petazzoni
@ 2010-10-08  7:09                             ` Guruswamy, Senthilvadivu
  0 siblings, 0 replies; 35+ messages in thread
From: Guruswamy, Senthilvadivu @ 2010-10-08  7:09 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: khilman, tomi.valkeinen, paul, Hiremath, Vaibhav, linux-omap



> -----Original Message-----
> From: Thomas Petazzoni [mailto:thomas.petazzoni@free-electrons.com]
> Sent: Friday, October 08, 2010 1:28 AM
> To: Guruswamy, Senthilvadivu
> Cc: khilman@deeprootsystems.com; tomi.valkeinen@nokia.com; paul@pwsan.com;
> Hiremath, Vaibhav; linux-omap@vger.kernel.org
> Subject: Re: [PATCH v1 13/16] OMAP3: hwmod DSS: VENC Move init,exit to
> driver
> 
> Hello Senthil,
> 
> On Wed,  6 Oct 2010 16:44:56 +0530
> Guruswamy Senthilvadivu <svadivu@ti.com> wrote:
> 
> > diff --git a/drivers/video/omap2/dss/venc.c
> b/drivers/video/omap2/dss/venc.c
> > index ec17b28..3a121cb 100644
> > --- a/drivers/video/omap2/dss/venc.c
> > +++ b/drivers/video/omap2/dss/venc.c
> > @@ -87,26 +87,6 @@
> >  #define VENC_OUTPUT_TEST			0xC8
> >  #define VENC_DAC_B__DAC_C			0xC8
> >
> > -/* VENC HW IP initialisation */
> > -static int omap_venchw_probe(struct platform_device *pdev)
> > -{
> > -	return 0;
> > -}
> > -
> > -static int omap_venchw_remove(struct platform_device *pdev)
> > -{
> > -	return 0;
> > -}
> > -
> > -static struct platform_driver omap_venchw_driver = {
> > -	.probe          = omap_venchw_probe,
> > -	.remove         = omap_venchw_remove,
> > -	.driver         = {
> > -		.name   = "dss_venc",
> > -		.owner  = THIS_MODULE,
> > -	},
> > -};
> 
> Would be better in patch 7/16 to put this stuff at the correct place
> (bottom of the file) so it does not need to be moved here.
> 
[Senthil]  Taken.  Will do the movement in the first patch itself.
> > +/* VENC HW IP initialisation */
> > +static int omap_venchw_probe(struct platform_device *pdev)
> > +{
> > +	int r;
> > +	venc.pdev = pdev;
> > +
> > +	r = venc_init(pdev);
> > +	if (r) {
> > +		DSSERR("Failed to initialize venc\n");
> > +		goto err_venc;
> > +	}
> > +
> > +err_venc:
> > +	return r;
> > +}
> > +
> > +static int omap_venchw_remove(struct platform_device *pdev)
> > +{
> > +	venc_exit();
> > +	return 0;
> > +}
> 
> Same comment as before: include the code of venc_init() and venc_exit()
> directly in the ->probe() and ->remove() hooks respectively.
> 
> > +struct regulator *dss_get_vdda_dac(void)
> > +{
> > +	struct regulator *reg;
> > +
> > +	if (venc.vdda_dac_reg != NULL)
> > +		return venc.vdda_dac_reg;
> > +
> > +	reg = regulator_get(&venc.pdev->dev, "vdda_dac");
> > +	if (!IS_ERR(reg))
> > +		venc.vdda_dac_reg = reg;
> >
> > +	return reg;
> > +}
> 
> As far as I can see, this function is now only used in venc_init(),
> which is in the same file, so the function should be static, and the
> prototype removed from drivers/video/omap2/dss/core.h.
> 
> I'm also a bit skeptical about what this function does. It is called
> this way in venc_init():
> 
>   venc.vdda_dac_reg = dss_get_vdda_dac();
> 
> so it is dss_get_vdda_dac() responsability to set venc.vdda_dac_reg, or
> is it the caller responsability ?
> 
> Moreover, the logic in dss_get_vdda_dac() that tests whether
> venc.vdda_dac_reg is already initialized seems to indicate that this
> function could be called several times. However, I only see it called
> from venc_init(), which as far as I understand is called only once.
> 
[Senthil] when code was in core.c there were chances of it getting called more than once.  Now it is called only once as you see, so it could be made static.
> Isn't it possible to simplify this by removing the dss_get_vdda_dac()
> function and just doing:
> 
>   venc.vdda_dac_reg = regulator_get(&venc.pdev->dev, "vdda_dac");
> 
> in the venc_init() function (which should become the ->probe() method).
> 
> Thanks!
> 
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com

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

* RE: [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP
  2010-10-07 19:49               ` Thomas Petazzoni
@ 2010-10-08  7:11                 ` Guruswamy, Senthilvadivu
  2010-10-08  7:43                   ` Thomas Petazzoni
  0 siblings, 1 reply; 35+ messages in thread
From: Guruswamy, Senthilvadivu @ 2010-10-08  7:11 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: khilman, tomi.valkeinen, paul, Hiremath, Vaibhav, linux-omap



> -----Original Message-----
> From: Thomas Petazzoni [mailto:thomas.petazzoni@free-electrons.com]
> Sent: Friday, October 08, 2010 1:20 AM
> To: Guruswamy, Senthilvadivu
> Cc: khilman@deeprootsystems.com; tomi.valkeinen@nokia.com; paul@pwsan.com;
> Hiremath, Vaibhav; linux-omap@vger.kernel.org
> Subject: Re: [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for
> each DSS HW IP
> 
> Hello Senthil,
> 
> I forgot one comment: in most Linux drivers, it is customary to put the
> platform_driver definition just above the driver initialization
> function, both of them at the end of the file. Of course, it's nothing
> mandatory, but most of the drivers are organized this way, making it
> easy for developers to find their way in all drivers.
> 
> So, in other words, this:
> 
[Senthil] I put it above as part of all the static methods and structures.
Will look at the other omap drivers before I change.
> > +/* DISPC HW IP initialisation */
> > +static int omap_dispchw_probe(struct platform_device *pdev)
> > +{
> > +	return 0;
> > +}
> > +
> > +static int omap_dispchw_remove(struct platform_device *pdev)
> > +{
> > +	return 0;
> > +}
> > +
> > +static struct platform_driver omap_dispchw_driver = {
> > +	.probe          = omap_dispchw_probe,
> > +	.remove         = omap_dispchw_remove,
> > +	.driver         = {
> > +		.name   = "dss_dispc",
> > +		.owner  = THIS_MODULE,
> > +	},
> > +};
> 
> Should be just above this:
> 
> > +static int __init omap_dispc_init(void)
> > +{
> > +	return platform_driver_register(&omap_dispchw_driver);
> > +}
> > +
> > +device_initcall(omap_dispc_init);
> 
> Regards,
> 
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com

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

* RE: [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI Move init,exit to driver
  2010-10-07 19:47                       ` [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI " Thomas Petazzoni
@ 2010-10-08  7:13                         ` Guruswamy, Senthilvadivu
  0 siblings, 0 replies; 35+ messages in thread
From: Guruswamy, Senthilvadivu @ 2010-10-08  7:13 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: khilman, tomi.valkeinen, paul, Hiremath, Vaibhav, linux-omap



> -----Original Message-----
> From: Thomas Petazzoni [mailto:thomas.petazzoni@free-electrons.com]
> Sent: Friday, October 08, 2010 1:17 AM
> To: Guruswamy, Senthilvadivu
> Cc: khilman@deeprootsystems.com; tomi.valkeinen@nokia.com; paul@pwsan.com;
> Hiremath, Vaibhav; linux-omap@vger.kernel.org
> Subject: Re: [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI Move init,exit to
> driver
> 
> Hello Senthil,
> 
> On Wed,  6 Oct 2010 16:44:54 +0530
> Guruswamy Senthilvadivu <svadivu@ti.com> wrote:
> 
> > diff --git a/drivers/video/omap2/dss/rfbi.c
> b/drivers/video/omap2/dss/rfbi.c
> > index 23598ea..9bee39d 100644
> > --- a/drivers/video/omap2/dss/rfbi.c
> > +++ b/drivers/video/omap2/dss/rfbi.c
> > @@ -100,6 +100,7 @@ static int rfbi_convert_timings(struct rfbi_timings
> *t);
> >  static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div);
> >
> >  static struct {
> > +	struct platform_device *pdev;
> >  	void __iomem	*base;
> >
> >  	unsigned long	l4_khz;
> > @@ -142,11 +143,22 @@ static inline u32 rfbi_read_reg(const struct
> rfbi_reg idx)
> >  /* RFBI HW IP initialisation */
> >  static int omap_rfbihw_probe(struct platform_device *pdev)
> >  {
> > -	return 0;
> > +	int r;
> > +	rfbi.pdev = pdev;
> > +
> > +	r = rfbi_init();
> > +	if (r) {
> > +		DSSERR("Failed to initialize rfbi\n");
> > +		goto err_rfbi;
> > +	}
> > +
> > +err_rfbi:
> > +	return r;
> >  }
> >
> >  static int omap_rfbihw_remove(struct platform_device *pdev)
> >  {
> > +	rfbi_exit();
> >  	return 0;
> >  }
> >
> 
> Instead of having probe() and remove() functions that call the existing
> init() and exit(), why not making your driver look like most Linux
> drivers here, and directly do the initialization in probe() and the
> cleanup in remove() ?
> 
[Senthil] When I do existing code movement I don't change it one single patch just to make the review concentrate on the place of movement.  
I could submit additional patches to remove the extra function calls wherever required.
> Concerning the added pdev field to the rfbi structure, do you really it
> at this point ?
> 
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com

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

* Re: [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP
  2010-10-08  7:11                 ` Guruswamy, Senthilvadivu
@ 2010-10-08  7:43                   ` Thomas Petazzoni
  0 siblings, 0 replies; 35+ messages in thread
From: Thomas Petazzoni @ 2010-10-08  7:43 UTC (permalink / raw)
  To: Guruswamy, Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, Hiremath, Vaibhav, linux-omap

Hello,

On Fri, 8 Oct 2010 12:41:35 +0530
"Guruswamy, Senthilvadivu" <svadivu@ti.com> wrote:

> [Senthil] I put it above as part of all the static methods and
> structures. Will look at the other omap drivers before I change.

Yes, but the platform_driver structure, ->probe() and ->remove()
methods are not usually at a random place with all the other static
methods and structure definitions. They are located *just* above the
module init/cleanup routines.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

end of thread, other threads:[~2010-10-08  7:43 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-06 11:14 [PATCH v1 00/16] OMAP3: hwmod DSS Adaptation Guruswamy Senthilvadivu
2010-10-06 11:14 ` [PATCH v1 01/16] OMAP2420: hwmod data: add DSS DISPC RFBI VENC Guruswamy Senthilvadivu
2010-10-06 11:14   ` [PATCH v1 02/16] OMAP2430: " Guruswamy Senthilvadivu
2010-10-06 11:14     ` [PATCH v1 03/16] OMAP3: hwmod data: add DSS DISPC RFBI DSI VENC Guruswamy Senthilvadivu
2010-10-06 11:14       ` [PATCH v1 04/16] OMAP3: hwmod data: change dss_hwmod to dss_dss_hwmod Guruswamy Senthilvadivu
2010-10-06 11:14         ` [PATCH v1 05/16] OMAP3 DSS Driver register moved to mach_omap2 Guruswamy Senthilvadivu
2010-10-06 11:14           ` [PATCH v1 06/16] OMAP3: hwmod DSS: Build omap_device for each DSS HWIP Guruswamy Senthilvadivu
2010-10-06 11:14             ` [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP Guruswamy Senthilvadivu
2010-10-06 11:14               ` [PATCH v1 08/16] OMAP3: clock data: change dss driver name Guruswamy Senthilvadivu
2010-10-06 11:14                 ` [PATCH v1 09/16] OMAP3: hwmod DSS: Move clocks from core driver to dss driver Guruswamy Senthilvadivu
2010-10-06 11:14                   ` [PATCH v1 10/16] OMAP3: hwmod DSS: DSS Move init,exit to driver Guruswamy Senthilvadivu
2010-10-06 11:14                     ` [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI " Guruswamy Senthilvadivu
2010-10-06 11:14                       ` [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC " Guruswamy Senthilvadivu
2010-10-06 11:14                         ` [PATCH v1 13/16] OMAP3: hwmod DSS: VENC " Guruswamy Senthilvadivu
2010-10-06 11:14                           ` [PATCH v1 14/16] OMAP3: hwmod DSS: DSI Move init, exit " Guruswamy Senthilvadivu
2010-10-06 11:14                             ` [PATCH v1 15/16] OMAP3: hwmod DSS: Use platform device to get baseaddr Guruswamy Senthilvadivu
2010-10-06 11:14                               ` [PATCH v1 16/16] OMAP3: hwmod DSS: Get DSS IRQ from platform device Guruswamy Senthilvadivu
2010-10-07 20:00                             ` [PATCH v1 14/16] OMAP3: hwmod DSS: DSI Move init, exit to driver Thomas Petazzoni
2010-10-07 19:57                           ` [PATCH v1 13/16] OMAP3: hwmod DSS: VENC Move init,exit " Thomas Petazzoni
2010-10-08  7:09                             ` Guruswamy, Senthilvadivu
2010-10-06 14:19                         ` [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC " Premi, Sanjeev
2010-10-07  6:16                           ` Guruswamy, Senthilvadivu
2010-10-07  7:17                             ` Cousson, Benoit
2010-10-07  8:44                               ` Guruswamy, Senthilvadivu
2010-10-07  9:04                                 ` Cousson, Benoit
2010-10-07 19:48                         ` Thomas Petazzoni
2010-10-07 19:47                       ` [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI " Thomas Petazzoni
2010-10-08  7:13                         ` Guruswamy, Senthilvadivu
2010-10-07 19:47               ` [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP Thomas Petazzoni
2010-10-07 19:49               ` Thomas Petazzoni
2010-10-08  7:11                 ` Guruswamy, Senthilvadivu
2010-10-08  7:43                   ` Thomas Petazzoni
2010-10-07 19:30             ` [PATCH v1 06/16] OMAP3: hwmod DSS: Build omap_device for each DSS HWIP Thomas Petazzoni
2010-10-07 19:06           ` [PATCH v1 05/16] OMAP3 DSS Driver register moved to mach_omap2 Thomas Petazzoni
2010-10-08  6:54             ` Guruswamy, Senthilvadivu

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.