All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] OMAP: omap_device cleanup before device-tree integration
@ 2011-08-22 15:19 ` Benoit Cousson
  0 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: khilman; +Cc: linux-omap, linux-arm-kernel, paul, Benoit Cousson

Hi Kevin,

Here are a couple of cleanups on top of your for_3.2/omap_device series
rebased on top of 3.1-rc2 to get your pm-fixes.
The goal is to help building core devices using device-tree by removing
direct reference to the device inside PM.
For that, I took and rebased the two patches done by Nishanth to use hwmod
to identify the device from the generic IP name.
The currently "unused" omap_device_pm_latency is moved inside the
omap_device core code to avoid the duplication.

patches are available here:
git://gitorious.org/omap-pm/linux.git for_3.2/omap_device_cleanup

It is tested on OMAP4 SDP and Panda only. I don't even have the Beagle
to test the beagle patch :-(

Regards,
Benoit


Benoit Cousson (5):
  OMAP3: beagle-board: Use the omap_hwmod_name_get_dev API
  OMAP2+: pm: Use hwmod name instead of dev pointer
  OMAP2+: pm: Remove static devices variable for mpu, dsp, iva and l3 PM
  OMAP: omap_device: Create a default omap_device_pm_latency
  OMAP2+: devices: Remove all omap_device_pm_latency structures

Nishanth Menon (2):
  OMAP: PM: omap_device: add omap_hwmod_name_get_odev
  OMAP: PM: omap_device: add few quick access functions

 arch/arm/mach-omap2/board-omap3beagle.c       |    4 +-
 arch/arm/mach-omap2/devices.c                 |   46 ++---------------
 arch/arm/mach-omap2/display.c                 |   11 +----
 arch/arm/mach-omap2/dma.c                     |   11 +----
 arch/arm/mach-omap2/gpio.c                    |   12 +----
 arch/arm/mach-omap2/hsmmc.c                   |   18 +------
 arch/arm/mach-omap2/hwspinlock.c              |   12 +----
 arch/arm/mach-omap2/mcbsp.c                   |   11 +----
 arch/arm/mach-omap2/pm.c                      |   69 ++++++++-----------------
 arch/arm/mach-omap2/serial.c                  |   25 +---------
 arch/arm/mach-omap2/sr_device.c               |   11 +----
 arch/arm/mach-omap2/usb-musb.c                |   11 +----
 arch/arm/plat-omap/i2c.c                      |   10 +---
 arch/arm/plat-omap/include/plat/omap_device.h |   16 ++++++
 arch/arm/plat-omap/omap_device.c              |   49 +++++++++++++++++-
 15 files changed, 101 insertions(+), 215 deletions(-)


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

* [PATCH 0/7] OMAP: omap_device cleanup before device-tree integration
@ 2011-08-22 15:19 ` Benoit Cousson
  0 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kevin,

Here are a couple of cleanups on top of your for_3.2/omap_device series
rebased on top of 3.1-rc2 to get your pm-fixes.
The goal is to help building core devices using device-tree by removing
direct reference to the device inside PM.
For that, I took and rebased the two patches done by Nishanth to use hwmod
to identify the device from the generic IP name.
The currently "unused" omap_device_pm_latency is moved inside the
omap_device core code to avoid the duplication.

patches are available here:
git://gitorious.org/omap-pm/linux.git for_3.2/omap_device_cleanup

It is tested on OMAP4 SDP and Panda only. I don't even have the Beagle
to test the beagle patch :-(

Regards,
Benoit


Benoit Cousson (5):
  OMAP3: beagle-board: Use the omap_hwmod_name_get_dev API
  OMAP2+: pm: Use hwmod name instead of dev pointer
  OMAP2+: pm: Remove static devices variable for mpu, dsp, iva and l3 PM
  OMAP: omap_device: Create a default omap_device_pm_latency
  OMAP2+: devices: Remove all omap_device_pm_latency structures

Nishanth Menon (2):
  OMAP: PM: omap_device: add omap_hwmod_name_get_odev
  OMAP: PM: omap_device: add few quick access functions

 arch/arm/mach-omap2/board-omap3beagle.c       |    4 +-
 arch/arm/mach-omap2/devices.c                 |   46 ++---------------
 arch/arm/mach-omap2/display.c                 |   11 +----
 arch/arm/mach-omap2/dma.c                     |   11 +----
 arch/arm/mach-omap2/gpio.c                    |   12 +----
 arch/arm/mach-omap2/hsmmc.c                   |   18 +------
 arch/arm/mach-omap2/hwspinlock.c              |   12 +----
 arch/arm/mach-omap2/mcbsp.c                   |   11 +----
 arch/arm/mach-omap2/pm.c                      |   69 ++++++++-----------------
 arch/arm/mach-omap2/serial.c                  |   25 +---------
 arch/arm/mach-omap2/sr_device.c               |   11 +----
 arch/arm/mach-omap2/usb-musb.c                |   11 +----
 arch/arm/plat-omap/i2c.c                      |   10 +---
 arch/arm/plat-omap/include/plat/omap_device.h |   16 ++++++
 arch/arm/plat-omap/omap_device.c              |   49 +++++++++++++++++-
 15 files changed, 101 insertions(+), 215 deletions(-)

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

* [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev
  2011-08-22 15:19 ` Benoit Cousson
@ 2011-08-22 15:19   ` Benoit Cousson
  -1 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: khilman
  Cc: linux-omap, linux-arm-kernel, paul, Nishanth Menon, Benoit Cousson

From: Nishanth Menon <nm@ti.com>

An API which translates a standard hwmod name to corresponding
omap_device is useful for drivers when they need to look up the
device associated with a hwmod name to map back into the device
structure pointers. These ideally should be used by drivers in
mach directory. Using a generic hwmod name like "gpu" instead of
the actual device name which could change in the future, allows
us to:
a) Could in effect help replace apis such as omap2_get_mpuss_device,
omap2_get_iva_device, omap2_get_l3_device, omap4_get_dsp_device,
etc..
b) Scale to more devices rather than be restricted to named functions
c) Simplify driver's platform_data from passing additional fields
all doing the same thing with different function pointer names
just for accessing a different device name.

Signed-off-by: Nishanth Menon <nm@ti.com>
[b-cousson@ti.com: rebased on top of Kevin's changes]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
---
 arch/arm/plat-omap/include/plat/omap_device.h |    1 +
 arch/arm/plat-omap/omap_device.c              |   32 +++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
index d4d9b96..bdc2804 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -101,6 +101,7 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
 					 int pm_lats_cnt, int is_early_device);
 
 void __iomem *omap_device_get_rt_va(struct omap_device *od);
+struct omap_device *omap_hwmod_name_get_odev(const char *oh_name);
 
 /* OMAP PM interface */
 int omap_device_align_pm_lat(struct platform_device *pdev,
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index d8f2299..455594a 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -840,6 +840,38 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)
 	return omap_hwmod_get_mpu_rt_va(od->hwmods[0]);
 }
 
+/**
+ * omap_hwmod_name_get_odev() - convert a hwmod name to omap_device pointer
+ * @oh_name: name of the hwmod device
+ *
+ * returns back a struct omap_device * pointer associated with a hwmod
+ * device represented by a hwmod_name
+ */
+struct omap_device *omap_hwmod_name_get_odev(const char *oh_name)
+{
+	struct omap_hwmod *oh;
+
+	if (!oh_name) {
+		WARN(1, "%s: no hwmod name!\n", __func__);
+		return ERR_PTR(-EINVAL);
+	}
+
+	oh = omap_hwmod_lookup(oh_name);
+	if (IS_ERR_OR_NULL(oh)) {
+		WARN(1, "%s: no hwmod for %s\n", __func__,
+			oh_name);
+		return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV);
+	}
+	if (IS_ERR_OR_NULL(oh->od)) {
+		WARN(1, "%s: no omap_device for %s\n", __func__,
+			oh_name);
+		return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV);
+	}
+
+	return oh->od;
+}
+EXPORT_SYMBOL(omap_hwmod_name_get_odev);
+
 /*
  * Public functions intended for use in omap_device_pm_latency
  * .activate_func and .deactivate_func function pointers
-- 
1.7.0.4


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

* [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev
@ 2011-08-22 15:19   ` Benoit Cousson
  0 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

From: Nishanth Menon <nm@ti.com>

An API which translates a standard hwmod name to corresponding
omap_device is useful for drivers when they need to look up the
device associated with a hwmod name to map back into the device
structure pointers. These ideally should be used by drivers in
mach directory. Using a generic hwmod name like "gpu" instead of
the actual device name which could change in the future, allows
us to:
a) Could in effect help replace apis such as omap2_get_mpuss_device,
omap2_get_iva_device, omap2_get_l3_device, omap4_get_dsp_device,
etc..
b) Scale to more devices rather than be restricted to named functions
c) Simplify driver's platform_data from passing additional fields
all doing the same thing with different function pointer names
just for accessing a different device name.

Signed-off-by: Nishanth Menon <nm@ti.com>
[b-cousson at ti.com: rebased on top of Kevin's changes]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
---
 arch/arm/plat-omap/include/plat/omap_device.h |    1 +
 arch/arm/plat-omap/omap_device.c              |   32 +++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
index d4d9b96..bdc2804 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -101,6 +101,7 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
 					 int pm_lats_cnt, int is_early_device);
 
 void __iomem *omap_device_get_rt_va(struct omap_device *od);
+struct omap_device *omap_hwmod_name_get_odev(const char *oh_name);
 
 /* OMAP PM interface */
 int omap_device_align_pm_lat(struct platform_device *pdev,
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index d8f2299..455594a 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -840,6 +840,38 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)
 	return omap_hwmod_get_mpu_rt_va(od->hwmods[0]);
 }
 
+/**
+ * omap_hwmod_name_get_odev() - convert a hwmod name to omap_device pointer
+ * @oh_name: name of the hwmod device
+ *
+ * returns back a struct omap_device * pointer associated with a hwmod
+ * device represented by a hwmod_name
+ */
+struct omap_device *omap_hwmod_name_get_odev(const char *oh_name)
+{
+	struct omap_hwmod *oh;
+
+	if (!oh_name) {
+		WARN(1, "%s: no hwmod name!\n", __func__);
+		return ERR_PTR(-EINVAL);
+	}
+
+	oh = omap_hwmod_lookup(oh_name);
+	if (IS_ERR_OR_NULL(oh)) {
+		WARN(1, "%s: no hwmod for %s\n", __func__,
+			oh_name);
+		return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV);
+	}
+	if (IS_ERR_OR_NULL(oh->od)) {
+		WARN(1, "%s: no omap_device for %s\n", __func__,
+			oh_name);
+		return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV);
+	}
+
+	return oh->od;
+}
+EXPORT_SYMBOL(omap_hwmod_name_get_odev);
+
 /*
  * Public functions intended for use in omap_device_pm_latency
  * .activate_func and .deactivate_func function pointers
-- 
1.7.0.4

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

* [PATCH 2/7] OMAP: PM: omap_device: add few quick access functions
  2011-08-22 15:19 ` Benoit Cousson
@ 2011-08-22 15:19   ` Benoit Cousson
  -1 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: khilman
  Cc: Nishanth Menon, paul, linux-omap, Benoit Cousson, linux-arm-kernel

From: Nishanth Menon <nm@ti.com>

Provide a quick set of access functions:
a) Convert omap_device to platform_device - This is the flip of
   to_omap_device for equivalent usage
b) Convert omap_device to device pointer - This is useful for
   most devices that need to go through standard linux functions that
   take device pointer.
c) Convert hwmod to device pointer - This wrapper provides ability for
   drivers to convert directly from hwmod name back to device pointer
   without having to handle this on a driver by driver basis

Signed-off-by: Nishanth Menon <nm@ti.com>
[b-cousson@ti.com: Adapt it to the new pdev pointer inside od]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
---
 arch/arm/plat-omap/include/plat/omap_device.h |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
index bdc2804..903f329 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -152,6 +152,21 @@ static inline struct omap_device *to_omap_device(struct platform_device *pdev)
 	return pdev ? pdev->archdata.od : NULL;
 }
 
+/* Convert omap_device to platform device pointer */
+#define omap_device_get_pdev(x) ((x)->pdev)
+/* Convert omap_device to device pointer */
+#define omap_device_get_dev(x) (&omap_device_get_pdev(x)->dev)
+
+/* Convert omap_hwmod name to device pointer */
+static inline struct device *omap_hwmod_name_get_dev(const char *oh_name)
+{
+	struct omap_device *od;
+	od = omap_hwmod_name_get_odev(oh_name);
+	if (IS_ERR_OR_NULL(od))
+		return ERR_PTR(od ? PTR_ERR(od) : -ENODEV);
+	return omap_device_get_dev(od);
+}
+
 static inline
 void omap_device_disable_idle_on_suspend(struct platform_device *pdev)
 {
-- 
1.7.0.4

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

* [PATCH 2/7] OMAP: PM: omap_device: add few quick access functions
@ 2011-08-22 15:19   ` Benoit Cousson
  0 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

From: Nishanth Menon <nm@ti.com>

Provide a quick set of access functions:
a) Convert omap_device to platform_device - This is the flip of
   to_omap_device for equivalent usage
b) Convert omap_device to device pointer - This is useful for
   most devices that need to go through standard linux functions that
   take device pointer.
c) Convert hwmod to device pointer - This wrapper provides ability for
   drivers to convert directly from hwmod name back to device pointer
   without having to handle this on a driver by driver basis

Signed-off-by: Nishanth Menon <nm@ti.com>
[b-cousson at ti.com: Adapt it to the new pdev pointer inside od]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
---
 arch/arm/plat-omap/include/plat/omap_device.h |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
index bdc2804..903f329 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -152,6 +152,21 @@ static inline struct omap_device *to_omap_device(struct platform_device *pdev)
 	return pdev ? pdev->archdata.od : NULL;
 }
 
+/* Convert omap_device to platform device pointer */
+#define omap_device_get_pdev(x) ((x)->pdev)
+/* Convert omap_device to device pointer */
+#define omap_device_get_dev(x) (&omap_device_get_pdev(x)->dev)
+
+/* Convert omap_hwmod name to device pointer */
+static inline struct device *omap_hwmod_name_get_dev(const char *oh_name)
+{
+	struct omap_device *od;
+	od = omap_hwmod_name_get_odev(oh_name);
+	if (IS_ERR_OR_NULL(od))
+		return ERR_PTR(od ? PTR_ERR(od) : -ENODEV);
+	return omap_device_get_dev(od);
+}
+
 static inline
 void omap_device_disable_idle_on_suspend(struct platform_device *pdev)
 {
-- 
1.7.0.4

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

* [PATCH 3/7] OMAP3: beagle-board: Use the omap_hwmod_name_get_dev API
  2011-08-22 15:19 ` Benoit Cousson
@ 2011-08-22 15:19   ` Benoit Cousson
  -1 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: khilman
  Cc: linux-omap, linux-arm-kernel, paul, Benoit Cousson, Nishanth Menon

Replace the multiple omap2_get_XXX_device APIs with the new
omap_hwmod_name_get_dev that uses the hwmod name to get the proper
device.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 3ae16b4..dab16e0 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -493,8 +493,8 @@ static void __init beagle_opp_init(void)
 	if (cpu_is_omap3630()) {
 		struct device *mpu_dev, *iva_dev;
 
-		mpu_dev = omap2_get_mpuss_device();
-		iva_dev = omap2_get_iva_device();
+		mpu_dev = omap_hwmod_name_get_dev("mpu");
+		iva_dev = omap_hwmod_name_get_dev("iva");
 
 		if (!mpu_dev || !iva_dev) {
 			pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",
-- 
1.7.0.4


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

* [PATCH 3/7] OMAP3: beagle-board: Use the omap_hwmod_name_get_dev API
@ 2011-08-22 15:19   ` Benoit Cousson
  0 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

Replace the multiple omap2_get_XXX_device APIs with the new
omap_hwmod_name_get_dev that uses the hwmod name to get the proper
device.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 3ae16b4..dab16e0 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -493,8 +493,8 @@ static void __init beagle_opp_init(void)
 	if (cpu_is_omap3630()) {
 		struct device *mpu_dev, *iva_dev;
 
-		mpu_dev = omap2_get_mpuss_device();
-		iva_dev = omap2_get_iva_device();
+		mpu_dev = omap_hwmod_name_get_dev("mpu");
+		iva_dev = omap_hwmod_name_get_dev("iva");
 
 		if (!mpu_dev || !iva_dev) {
 			pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",
-- 
1.7.0.4

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

* [PATCH 4/7] OMAP2+: pm: Use hwmod name instead of dev pointer
  2011-08-22 15:19 ` Benoit Cousson
@ 2011-08-22 15:19   ` Benoit Cousson
  -1 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: khilman; +Cc: linux-omap, linux-arm-kernel, paul, Benoit Cousson

Replace the struct device parameter of omap2_set_init_voltage
by the hwmod name. It will avoid having to store explicitely
the device pointer into a static variable.
Moreover, it will be a little bit more scalable if we introduce
new DVFS devices.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/pm.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 54281e5..17725d2 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -171,18 +171,26 @@ err:
  * in the opp entry
  */
 static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
-						struct device *dev)
+					 const char *oh_name)
 {
 	struct voltagedomain *voltdm;
 	struct clk *clk;
 	struct opp *opp;
 	unsigned long freq, bootup_volt;
+	struct device *dev;
 
-	if (!vdd_name || !clk_name || !dev) {
+	if (!vdd_name || !clk_name || !oh_name) {
 		printk(KERN_ERR "%s: Invalid parameters!\n", __func__);
 		goto exit;
 	}
 
+	dev = omap_hwmod_name_get_dev(oh_name);
+	if (IS_ERR(dev)) {
+		pr_err("%s: Unable to get dev pointer for hwmod %s\n",
+			__func__, oh_name);
+		goto exit;
+	}
+
 	voltdm = omap_voltage_domain_lookup(vdd_name);
 	if (IS_ERR(voltdm)) {
 		printk(KERN_ERR "%s: Unable to get vdd pointer for vdd_%s\n",
@@ -228,8 +236,8 @@ static void __init omap3_init_voltages(void)
 	if (!cpu_is_omap34xx())
 		return;
 
-	omap2_set_init_voltage("mpu", "dpll1_ck", mpu_dev);
-	omap2_set_init_voltage("core", "l3_ick", l3_dev);
+	omap2_set_init_voltage("mpu", "dpll1_ck", "mpu");
+	omap2_set_init_voltage("core", "l3_ick", "l3_main");
 }
 
 static void __init omap4_init_voltages(void)
@@ -237,9 +245,9 @@ static void __init omap4_init_voltages(void)
 	if (!cpu_is_omap44xx())
 		return;
 
-	omap2_set_init_voltage("mpu", "dpll_mpu_ck", mpu_dev);
-	omap2_set_init_voltage("core", "l3_div_ck", l3_dev);
-	omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", iva_dev);
+	omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu");
+	omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1");
+	omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
 }
 
 static int __init omap2_common_pm_init(void)
-- 
1.7.0.4


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

* [PATCH 4/7] OMAP2+: pm: Use hwmod name instead of dev pointer
@ 2011-08-22 15:19   ` Benoit Cousson
  0 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

Replace the struct device parameter of omap2_set_init_voltage
by the hwmod name. It will avoid having to store explicitely
the device pointer into a static variable.
Moreover, it will be a little bit more scalable if we introduce
new DVFS devices.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/pm.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 54281e5..17725d2 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -171,18 +171,26 @@ err:
  * in the opp entry
  */
 static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
-						struct device *dev)
+					 const char *oh_name)
 {
 	struct voltagedomain *voltdm;
 	struct clk *clk;
 	struct opp *opp;
 	unsigned long freq, bootup_volt;
+	struct device *dev;
 
-	if (!vdd_name || !clk_name || !dev) {
+	if (!vdd_name || !clk_name || !oh_name) {
 		printk(KERN_ERR "%s: Invalid parameters!\n", __func__);
 		goto exit;
 	}
 
+	dev = omap_hwmod_name_get_dev(oh_name);
+	if (IS_ERR(dev)) {
+		pr_err("%s: Unable to get dev pointer for hwmod %s\n",
+			__func__, oh_name);
+		goto exit;
+	}
+
 	voltdm = omap_voltage_domain_lookup(vdd_name);
 	if (IS_ERR(voltdm)) {
 		printk(KERN_ERR "%s: Unable to get vdd pointer for vdd_%s\n",
@@ -228,8 +236,8 @@ static void __init omap3_init_voltages(void)
 	if (!cpu_is_omap34xx())
 		return;
 
-	omap2_set_init_voltage("mpu", "dpll1_ck", mpu_dev);
-	omap2_set_init_voltage("core", "l3_ick", l3_dev);
+	omap2_set_init_voltage("mpu", "dpll1_ck", "mpu");
+	omap2_set_init_voltage("core", "l3_ick", "l3_main");
 }
 
 static void __init omap4_init_voltages(void)
@@ -237,9 +245,9 @@ static void __init omap4_init_voltages(void)
 	if (!cpu_is_omap44xx())
 		return;
 
-	omap2_set_init_voltage("mpu", "dpll_mpu_ck", mpu_dev);
-	omap2_set_init_voltage("core", "l3_div_ck", l3_dev);
-	omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", iva_dev);
+	omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu");
+	omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1");
+	omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
 }
 
 static int __init omap2_common_pm_init(void)
-- 
1.7.0.4

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

* [PATCH 5/7] OMAP2+: pm: Remove static devices variable for mpu, dsp, iva and l3 PM
  2011-08-22 15:19 ` Benoit Cousson
@ 2011-08-22 15:19   ` Benoit Cousson
  -1 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: khilman; +Cc: linux-omap, linux-arm-kernel, paul, Benoit Cousson

Since the device pointer is now retrieved using the hwmod name, remove
the static variables used to store the device pointers for DSP, MPU, IVA
and L3 devices for PM/DVFS usage.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/pm.c |   47 ++++++---------------------------------------
 1 files changed, 7 insertions(+), 40 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 17725d2..832577a 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -26,38 +26,7 @@
 
 static struct omap_device_pm_latency *pm_lats;
 
-static struct device *mpu_dev;
-static struct device *iva_dev;
-static struct device *l3_dev;
-static struct device *dsp_dev;
-
-struct device *omap2_get_mpuss_device(void)
-{
-	WARN_ON_ONCE(!mpu_dev);
-	return mpu_dev;
-}
-
-struct device *omap2_get_iva_device(void)
-{
-	WARN_ON_ONCE(!iva_dev);
-	return iva_dev;
-}
-
-struct device *omap2_get_l3_device(void)
-{
-	WARN_ON_ONCE(!l3_dev);
-	return l3_dev;
-}
-
-struct device *omap4_get_dsp_device(void)
-{
-	WARN_ON_ONCE(!dsp_dev);
-	return dsp_dev;
-}
-EXPORT_SYMBOL(omap4_get_dsp_device);
-
-/* static int _init_omap_device(struct omap_hwmod *oh, void *user) */
-static int _init_omap_device(char *name, struct device **new_dev)
+static int _init_omap_device(char *name)
 {
 	struct omap_hwmod *oh;
 	struct platform_device *pdev;
@@ -72,8 +41,6 @@ static int _init_omap_device(char *name, struct device **new_dev)
 		 __func__, name))
 		return -ENODEV;
 
-	*new_dev = &pdev->dev;
-
 	return 0;
 }
 
@@ -82,16 +49,16 @@ static int _init_omap_device(char *name, struct device **new_dev)
  */
 static void omap2_init_processor_devices(void)
 {
-	_init_omap_device("mpu", &mpu_dev);
+	_init_omap_device("mpu");
 	if (omap3_has_iva())
-		_init_omap_device("iva", &iva_dev);
+		_init_omap_device("iva");
 
 	if (cpu_is_omap44xx()) {
-		_init_omap_device("l3_main_1", &l3_dev);
-		_init_omap_device("dsp", &dsp_dev);
-		_init_omap_device("iva", &iva_dev);
+		_init_omap_device("l3_main_1");
+		_init_omap_device("dsp");
+		_init_omap_device("iva");
 	} else {
-		_init_omap_device("l3_main", &l3_dev);
+		_init_omap_device("l3_main");
 	}
 }
 
-- 
1.7.0.4


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

* [PATCH 5/7] OMAP2+: pm: Remove static devices variable for mpu, dsp, iva and l3 PM
@ 2011-08-22 15:19   ` Benoit Cousson
  0 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

Since the device pointer is now retrieved using the hwmod name, remove
the static variables used to store the device pointers for DSP, MPU, IVA
and L3 devices for PM/DVFS usage.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/pm.c |   47 ++++++---------------------------------------
 1 files changed, 7 insertions(+), 40 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 17725d2..832577a 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -26,38 +26,7 @@
 
 static struct omap_device_pm_latency *pm_lats;
 
-static struct device *mpu_dev;
-static struct device *iva_dev;
-static struct device *l3_dev;
-static struct device *dsp_dev;
-
-struct device *omap2_get_mpuss_device(void)
-{
-	WARN_ON_ONCE(!mpu_dev);
-	return mpu_dev;
-}
-
-struct device *omap2_get_iva_device(void)
-{
-	WARN_ON_ONCE(!iva_dev);
-	return iva_dev;
-}
-
-struct device *omap2_get_l3_device(void)
-{
-	WARN_ON_ONCE(!l3_dev);
-	return l3_dev;
-}
-
-struct device *omap4_get_dsp_device(void)
-{
-	WARN_ON_ONCE(!dsp_dev);
-	return dsp_dev;
-}
-EXPORT_SYMBOL(omap4_get_dsp_device);
-
-/* static int _init_omap_device(struct omap_hwmod *oh, void *user) */
-static int _init_omap_device(char *name, struct device **new_dev)
+static int _init_omap_device(char *name)
 {
 	struct omap_hwmod *oh;
 	struct platform_device *pdev;
@@ -72,8 +41,6 @@ static int _init_omap_device(char *name, struct device **new_dev)
 		 __func__, name))
 		return -ENODEV;
 
-	*new_dev = &pdev->dev;
-
 	return 0;
 }
 
@@ -82,16 +49,16 @@ static int _init_omap_device(char *name, struct device **new_dev)
  */
 static void omap2_init_processor_devices(void)
 {
-	_init_omap_device("mpu", &mpu_dev);
+	_init_omap_device("mpu");
 	if (omap3_has_iva())
-		_init_omap_device("iva", &iva_dev);
+		_init_omap_device("iva");
 
 	if (cpu_is_omap44xx()) {
-		_init_omap_device("l3_main_1", &l3_dev);
-		_init_omap_device("dsp", &dsp_dev);
-		_init_omap_device("iva", &iva_dev);
+		_init_omap_device("l3_main_1");
+		_init_omap_device("dsp");
+		_init_omap_device("iva");
 	} else {
-		_init_omap_device("l3_main", &l3_dev);
+		_init_omap_device("l3_main");
 	}
 }
 
-- 
1.7.0.4

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

* [PATCH 6/7] OMAP: omap_device: Create a default omap_device_pm_latency
  2011-08-22 15:19 ` Benoit Cousson
@ 2011-08-22 15:19   ` Benoit Cousson
  -1 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: khilman; +Cc: linux-omap, linux-arm-kernel, paul, Benoit Cousson

Most devices are using the same default omap_device_pm_latency structure
during device built. In order to avoid the duplication of the same
structure everywhere, add a default structure that will be used if
the device does not have an explicit one.

Next patches will clean the duplicated structures.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/plat-omap/omap_device.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 455594a..f2149be 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -97,6 +97,14 @@
 static int omap_device_register(struct platform_device *pdev);
 static int omap_early_device_register(struct platform_device *pdev);
 
+static struct omap_device_pm_latency omap_default_latency[] = {
+	{
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func   = omap_device_enable_hwmods,
+		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	}
+};
+
 /* Private functions */
 
 /**
@@ -510,8 +518,13 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
 	if (ret)
 		goto odbs_exit3;
 
-	od->pm_lats = pm_lats;
-	od->pm_lats_cnt = pm_lats_cnt;
+	if (pm_lats) {
+		od->pm_lats = pm_lats;
+		od->pm_lats_cnt = pm_lats_cnt;
+	} else {
+		od->pm_lats = omap_default_latency;
+		od->pm_lats_cnt = ARRAY_SIZE(omap_default_latency);
+	}
 
 	for (i = 0; i < oh_cnt; i++) {
 		hwmods[i]->od = od;
-- 
1.7.0.4


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

* [PATCH 6/7] OMAP: omap_device: Create a default omap_device_pm_latency
@ 2011-08-22 15:19   ` Benoit Cousson
  0 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

Most devices are using the same default omap_device_pm_latency structure
during device built. In order to avoid the duplication of the same
structure everywhere, add a default structure that will be used if
the device does not have an explicit one.

Next patches will clean the duplicated structures.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/plat-omap/omap_device.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 455594a..f2149be 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -97,6 +97,14 @@
 static int omap_device_register(struct platform_device *pdev);
 static int omap_early_device_register(struct platform_device *pdev);
 
+static struct omap_device_pm_latency omap_default_latency[] = {
+	{
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func   = omap_device_enable_hwmods,
+		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	}
+};
+
 /* Private functions */
 
 /**
@@ -510,8 +518,13 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
 	if (ret)
 		goto odbs_exit3;
 
-	od->pm_lats = pm_lats;
-	od->pm_lats_cnt = pm_lats_cnt;
+	if (pm_lats) {
+		od->pm_lats = pm_lats;
+		od->pm_lats_cnt = pm_lats_cnt;
+	} else {
+		od->pm_lats = omap_default_latency;
+		od->pm_lats_cnt = ARRAY_SIZE(omap_default_latency);
+	}
 
 	for (i = 0; i < oh_cnt; i++) {
 		hwmods[i]->od = od;
-- 
1.7.0.4

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

* [PATCH 7/7] OMAP2+: devices: Remove all omap_device_pm_latency structures
  2011-08-22 15:19 ` Benoit Cousson
@ 2011-08-22 15:19   ` Benoit Cousson
  -1 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: khilman; +Cc: linux-omap, linux-arm-kernel, paul, Benoit Cousson

Remove all these duplicated structures since a default one is now
available.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/devices.c    |   46 +++----------------------------------
 arch/arm/mach-omap2/display.c    |   11 +--------
 arch/arm/mach-omap2/dma.c        |   11 +--------
 arch/arm/mach-omap2/gpio.c       |   12 +---------
 arch/arm/mach-omap2/hsmmc.c      |   18 +--------------
 arch/arm/mach-omap2/hwspinlock.c |   12 +---------
 arch/arm/mach-omap2/mcbsp.c      |   11 +--------
 arch/arm/mach-omap2/serial.c     |   25 +-------------------
 arch/arm/mach-omap2/sr_device.c  |   11 +--------
 arch/arm/mach-omap2/usb-musb.c   |   11 +--------
 arch/arm/plat-omap/i2c.c         |   10 +-------
 11 files changed, 14 insertions(+), 164 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 10adf66..2d4a199 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -221,14 +221,6 @@ static inline void omap_init_camera(void)
 #endif
 }
 
-struct omap_device_pm_latency omap_keyboard_latency[] = {
-	{
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func   = omap_device_enable_hwmods,
-		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 int __init omap4_keyboard_init(struct omap4_keypad_platform_data
 			*sdp4430_keypad_data, struct omap_board_data *bdata)
 {
@@ -248,9 +240,7 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
 	keypad_data = sdp4430_keypad_data;
 
 	pdev = omap_device_build(name, id, oh, keypad_data,
-			sizeof(struct omap4_keypad_platform_data),
-			omap_keyboard_latency,
-			ARRAY_SIZE(omap_keyboard_latency), 0);
+			sizeof(struct omap4_keypad_platform_data), NULL, 0, 0);
 
 	if (IS_ERR(pdev)) {
 		WARN(1, "Can't build omap_device for %s:%s.\n",
@@ -263,14 +253,6 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
 }
 
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
-static struct omap_device_pm_latency mbox_latencies[] = {
-	[0] = {
-		.activate_func = omap_device_enable_hwmods,
-		.deactivate_func = omap_device_idle_hwmods,
-		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static inline void omap_init_mbox(void)
 {
 	struct omap_hwmod *oh;
@@ -282,8 +264,7 @@ static inline void omap_init_mbox(void)
 		return;
 	}
 
-	pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0,
-				mbox_latencies, ARRAY_SIZE(mbox_latencies), 0);
+	pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0, NULL, 0, 0);
 	WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n",
 						__func__, PTR_ERR(pdev));
 }
@@ -334,14 +315,6 @@ static inline void omap_init_audio(void) {}
 
 #include <plat/mcspi.h>
 
-struct omap_device_pm_latency omap_mcspi_latency[] = {
-	[0] = {
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func   = omap_device_enable_hwmods,
-		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
 {
 	struct platform_device *pdev;
@@ -372,8 +345,7 @@ static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
 
 	spi_num++;
 	pdev = omap_device_build(name, spi_num, oh, pdata,
-				sizeof(*pdata),	omap_mcspi_latency,
-				ARRAY_SIZE(omap_mcspi_latency), 0);
+				sizeof(*pdata),	NULL, 0, 0);
 	WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
 				name, oh->name);
 	kfree(pdata);
@@ -698,14 +670,6 @@ static int __init omap2_init_devices(void)
 arch_initcall(omap2_init_devices);
 
 #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
-static struct omap_device_pm_latency omap_wdt_latency[] = {
-	[0] = {
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func   = omap_device_enable_hwmods,
-		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static int __init omap_init_wdt(void)
 {
 	int id = -1;
@@ -723,9 +687,7 @@ static int __init omap_init_wdt(void)
 		return -EINVAL;
 	}
 
-	pdev = omap_device_build(dev_name, id, oh, NULL, 0,
-				omap_wdt_latency,
-				ARRAY_SIZE(omap_wdt_latency), 0);
+	pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
 	WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
 				dev_name, oh->name);
 	return 0;
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 18693f6..8ad0a2f 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -35,14 +35,6 @@ 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,
-		.flags			= OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 struct omap_dss_hwmod_data {
 	const char *oh_name;
 	const char *dev_name;
@@ -111,8 +103,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
 		pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
 				curr_dss_hwmod[i].id, oh, &pdata,
 				sizeof(struct omap_display_platform_data),
-				omap_dss_latency,
-				ARRAY_SIZE(omap_dss_latency), 0);
+				NULL, 0, 0);
 
 		if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
 				curr_dss_hwmod[i].oh_name))
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index ae8cb3f..a59a45a 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -87,14 +87,6 @@ static u16 reg_map[] = {
 	[CCDN]			= 0xd8,
 };
 
-static struct omap_device_pm_latency omap2_dma_latency[] = {
-	{
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func	 = omap_device_enable_hwmods,
-		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static void __iomem *dma_base;
 static inline void dma_write(u32 val, int reg, int lch)
 {
@@ -258,8 +250,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 
 	p->errata		= configure_dma_errata();
 
-	pdev = omap_device_build(name, 0, oh, p, sizeof(*p),
-			omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0);
+	pdev = omap_device_build(name, 0, oh, p, sizeof(*p), NULL, 0, 0);
 	kfree(p);
 	if (IS_ERR(pdev)) {
 		pr_err("%s: Can't build omap_device for %s:%s.\n",
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 652ccc5..8cbfbc2 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -24,14 +24,6 @@
 #include <plat/omap_hwmod.h>
 #include <plat/omap_device.h>
 
-static struct omap_device_pm_latency omap_gpio_latency[] = {
-	[0] = {
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func   = omap_device_enable_hwmods,
-		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 {
 	struct platform_device *pdev;
@@ -108,9 +100,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 	}
 
 	pdev = omap_device_build(name, id - 1, oh, pdata,
-				sizeof(*pdata),	omap_gpio_latency,
-				ARRAY_SIZE(omap_gpio_latency),
-				false);
+				sizeof(*pdata),	NULL, 0, false);
 	kfree(pdata);
 
 	if (IS_ERR(pdev)) {
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index cc87919..fe16da4 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -413,31 +413,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
 	return 0;
 }
 
-static struct omap_device_pm_latency omap_hsmmc_latency[] = {
-	[0] = {
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func	 = omap_device_enable_hwmods,
-		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-	/*
-	 * XXX There should also be an entry here to power off/on the
-	 * MMC regulators/PBIAS cells, etc.
-	 */
-};
-
 #define MAX_OMAP_MMC_HWMOD_NAME_LEN		16
 
 void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
 {
 	struct omap_hwmod *oh;
 	struct platform_device *pdev;
-	struct omap_device_pm_latency *ohl;
 	char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
 	struct omap_mmc_platform_data *mmc_data;
 	struct omap_mmc_dev_attr *mmc_dev_attr;
 	char *name;
 	int l;
-	int ohl_cnt = 0;
 
 	mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
 	if (!mmc_data) {
@@ -452,8 +438,6 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
 	omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));
 
 	name = "omap_hsmmc";
-	ohl = omap_hsmmc_latency;
-	ohl_cnt = ARRAY_SIZE(omap_hsmmc_latency);
 
 	l = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
 		     "mmc%d", ctrl_nr);
@@ -472,7 +456,7 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
 	}
 
 	pdev = omap_device_build(name, ctrl_nr - 1, oh, mmc_data,
-		sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false);
+		sizeof(struct omap_mmc_platform_data), NULL, 0, false);
 	if (IS_ERR(pdev)) {
 		WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name);
 		kfree(mmc_data->slots[0].name);
diff --git a/arch/arm/mach-omap2/hwspinlock.c b/arch/arm/mach-omap2/hwspinlock.c
index 0b3ae9d..36e2109 100644
--- a/arch/arm/mach-omap2/hwspinlock.c
+++ b/arch/arm/mach-omap2/hwspinlock.c
@@ -23,14 +23,6 @@
 #include <plat/omap_hwmod.h>
 #include <plat/omap_device.h>
 
-struct omap_device_pm_latency omap_spinlock_latency[] = {
-	{
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func   = omap_device_enable_hwmods,
-		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	}
-};
-
 int __init hwspinlocks_init(void)
 {
 	int retval = 0;
@@ -48,9 +40,7 @@ int __init hwspinlocks_init(void)
 	if (oh == NULL)
 		return -EINVAL;
 
-	pdev = omap_device_build(dev_name, 0, oh, NULL, 0,
-				omap_spinlock_latency,
-				ARRAY_SIZE(omap_spinlock_latency), false);
+	pdev = omap_device_build(dev_name, 0, oh, NULL, 0, NULL, 0, false);
 	if (IS_ERR(pdev)) {
 		pr_err("Can't build omap_device for %s:%s\n", dev_name,
 								oh_name);
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 7a42f32..9fb5d7d 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -102,14 +102,6 @@ int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
 }
 EXPORT_SYMBOL(omap2_mcbsp_set_clks_src);
 
-struct omap_device_pm_latency omap2_mcbsp_latency[] = {
-	{
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func   = omap_device_enable_hwmods,
-		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
 {
 	int id, count = 1;
@@ -145,8 +137,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
 		count++;
 	}
 	pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
-				sizeof(*pdata), omap2_mcbsp_latency,
-				ARRAY_SIZE(omap2_mcbsp_latency), false);
+				sizeof(*pdata), NULL, 0, false);
 	kfree(pdata);
 	if (IS_ERR(pdev))  {
 		pr_err("%s: Can't build omap_device for %s:%s.\n", __func__,
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 3d1c1d3..9992dbf 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -107,28 +107,6 @@ struct omap_uart_state {
 static LIST_HEAD(uart_list);
 static u8 num_uarts;
 
-static int uart_idle_hwmod(struct omap_device *od)
-{
-	omap_hwmod_idle(od->hwmods[0]);
-
-	return 0;
-}
-
-static int uart_enable_hwmod(struct omap_device *od)
-{
-	omap_hwmod_enable(od->hwmods[0]);
-
-	return 0;
-}
-
-static struct omap_device_pm_latency omap_uart_latency[] = {
-	{
-		.deactivate_func = uart_idle_hwmod,
-		.activate_func	 = uart_enable_hwmod,
-		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static inline unsigned int __serial_read_reg(struct uart_port *up,
 					     int offset)
 {
@@ -800,8 +778,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
 		return;
 
 	pdev = omap_device_build(name, uart->num, oh, pdata, pdata_size,
-			       omap_uart_latency,
-			       ARRAY_SIZE(omap_uart_latency), false);
+				 NULL, 0, false);
 	WARN(IS_ERR(pdev), "Could not build omap_device for %s: %s.\n",
 	     name, oh->name);
 
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index 624264d..3b5cf50 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -31,14 +31,6 @@
 
 static bool sr_enable_on_init;
 
-static struct omap_device_pm_latency omap_sr_latency[] = {
-	{
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func	 = omap_device_enable_hwmods,
-		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST
-	},
-};
-
 /* Read EFUSE values from control registers for OMAP3430 */
 static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
 				struct omap_sr_data *sr_data)
@@ -121,8 +113,7 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
 	sr_data->enable_on_init = sr_enable_on_init;
 
 	pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data),
-			       omap_sr_latency,
-			       ARRAY_SIZE(omap_sr_latency), 0);
+				 NULL, 0, 0);
 	if (IS_ERR(pdev))
 		pr_warning("%s: Could not build omap_device for %s: %s.\n\n",
 			__func__, name, oh->name);
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index a65145b..c13ff3f 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -60,14 +60,6 @@ static struct musb_hdrc_platform_data musb_plat = {
 
 static u64 musb_dmamask = DMA_BIT_MASK(32);
 
-static struct omap_device_pm_latency omap_musb_latency[] = {
-	{
-		.deactivate_func	= omap_device_idle_hwmods,
-		.activate_func		= omap_device_enable_hwmods,
-		.flags			= OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static void usb_musb_mux_init(struct omap_musb_board_data *board_data)
 {
 	switch (board_data->interface_type) {
@@ -155,8 +147,7 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
 	}
 
 	od = omap_device_build(name, bus_id, oh, &musb_plat,
-			       sizeof(musb_plat), omap_musb_latency,
-			       ARRAY_SIZE(omap_musb_latency), false);
+			       sizeof(musb_plat), NULL, 0, false);
 	if (IS_ERR(od)) {
 		pr_err("Could not build omap_device for %s %s\n",
 						name, oh_name);
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 0c7caf2..c20beb8 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -123,14 +123,6 @@ static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, long t)
 	omap_pm_set_max_mpu_wakeup_lat(dev, t);
 }
 
-static struct omap_device_pm_latency omap_i2c_latency[] = {
-	[0] = {
-		.deactivate_func	= omap_device_idle_hwmods,
-		.activate_func		= omap_device_enable_hwmods,
-		.flags			= OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static inline int omap2_i2c_add_bus(int bus_id)
 {
 	int l;
@@ -162,7 +154,7 @@ static inline int omap2_i2c_add_bus(int bus_id)
 		pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
 	pdev = omap_device_build(name, bus_id, oh, pdata,
 			sizeof(struct omap_i2c_bus_platform_data),
-			omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0);
+			NULL, 0, 0);
 	WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
 
 	return PTR_ERR(pdev);
-- 
1.7.0.4


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

* [PATCH 7/7] OMAP2+: devices: Remove all omap_device_pm_latency structures
@ 2011-08-22 15:19   ` Benoit Cousson
  0 siblings, 0 replies; 46+ messages in thread
From: Benoit Cousson @ 2011-08-22 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

Remove all these duplicated structures since a default one is now
available.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/devices.c    |   46 +++----------------------------------
 arch/arm/mach-omap2/display.c    |   11 +--------
 arch/arm/mach-omap2/dma.c        |   11 +--------
 arch/arm/mach-omap2/gpio.c       |   12 +---------
 arch/arm/mach-omap2/hsmmc.c      |   18 +--------------
 arch/arm/mach-omap2/hwspinlock.c |   12 +---------
 arch/arm/mach-omap2/mcbsp.c      |   11 +--------
 arch/arm/mach-omap2/serial.c     |   25 +-------------------
 arch/arm/mach-omap2/sr_device.c  |   11 +--------
 arch/arm/mach-omap2/usb-musb.c   |   11 +--------
 arch/arm/plat-omap/i2c.c         |   10 +-------
 11 files changed, 14 insertions(+), 164 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 10adf66..2d4a199 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -221,14 +221,6 @@ static inline void omap_init_camera(void)
 #endif
 }
 
-struct omap_device_pm_latency omap_keyboard_latency[] = {
-	{
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func   = omap_device_enable_hwmods,
-		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 int __init omap4_keyboard_init(struct omap4_keypad_platform_data
 			*sdp4430_keypad_data, struct omap_board_data *bdata)
 {
@@ -248,9 +240,7 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
 	keypad_data = sdp4430_keypad_data;
 
 	pdev = omap_device_build(name, id, oh, keypad_data,
-			sizeof(struct omap4_keypad_platform_data),
-			omap_keyboard_latency,
-			ARRAY_SIZE(omap_keyboard_latency), 0);
+			sizeof(struct omap4_keypad_platform_data), NULL, 0, 0);
 
 	if (IS_ERR(pdev)) {
 		WARN(1, "Can't build omap_device for %s:%s.\n",
@@ -263,14 +253,6 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
 }
 
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
-static struct omap_device_pm_latency mbox_latencies[] = {
-	[0] = {
-		.activate_func = omap_device_enable_hwmods,
-		.deactivate_func = omap_device_idle_hwmods,
-		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static inline void omap_init_mbox(void)
 {
 	struct omap_hwmod *oh;
@@ -282,8 +264,7 @@ static inline void omap_init_mbox(void)
 		return;
 	}
 
-	pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0,
-				mbox_latencies, ARRAY_SIZE(mbox_latencies), 0);
+	pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0, NULL, 0, 0);
 	WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n",
 						__func__, PTR_ERR(pdev));
 }
@@ -334,14 +315,6 @@ static inline void omap_init_audio(void) {}
 
 #include <plat/mcspi.h>
 
-struct omap_device_pm_latency omap_mcspi_latency[] = {
-	[0] = {
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func   = omap_device_enable_hwmods,
-		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
 {
 	struct platform_device *pdev;
@@ -372,8 +345,7 @@ static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
 
 	spi_num++;
 	pdev = omap_device_build(name, spi_num, oh, pdata,
-				sizeof(*pdata),	omap_mcspi_latency,
-				ARRAY_SIZE(omap_mcspi_latency), 0);
+				sizeof(*pdata),	NULL, 0, 0);
 	WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
 				name, oh->name);
 	kfree(pdata);
@@ -698,14 +670,6 @@ static int __init omap2_init_devices(void)
 arch_initcall(omap2_init_devices);
 
 #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
-static struct omap_device_pm_latency omap_wdt_latency[] = {
-	[0] = {
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func   = omap_device_enable_hwmods,
-		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static int __init omap_init_wdt(void)
 {
 	int id = -1;
@@ -723,9 +687,7 @@ static int __init omap_init_wdt(void)
 		return -EINVAL;
 	}
 
-	pdev = omap_device_build(dev_name, id, oh, NULL, 0,
-				omap_wdt_latency,
-				ARRAY_SIZE(omap_wdt_latency), 0);
+	pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
 	WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
 				dev_name, oh->name);
 	return 0;
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 18693f6..8ad0a2f 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -35,14 +35,6 @@ 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,
-		.flags			= OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 struct omap_dss_hwmod_data {
 	const char *oh_name;
 	const char *dev_name;
@@ -111,8 +103,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
 		pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
 				curr_dss_hwmod[i].id, oh, &pdata,
 				sizeof(struct omap_display_platform_data),
-				omap_dss_latency,
-				ARRAY_SIZE(omap_dss_latency), 0);
+				NULL, 0, 0);
 
 		if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
 				curr_dss_hwmod[i].oh_name))
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index ae8cb3f..a59a45a 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -87,14 +87,6 @@ static u16 reg_map[] = {
 	[CCDN]			= 0xd8,
 };
 
-static struct omap_device_pm_latency omap2_dma_latency[] = {
-	{
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func	 = omap_device_enable_hwmods,
-		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static void __iomem *dma_base;
 static inline void dma_write(u32 val, int reg, int lch)
 {
@@ -258,8 +250,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 
 	p->errata		= configure_dma_errata();
 
-	pdev = omap_device_build(name, 0, oh, p, sizeof(*p),
-			omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0);
+	pdev = omap_device_build(name, 0, oh, p, sizeof(*p), NULL, 0, 0);
 	kfree(p);
 	if (IS_ERR(pdev)) {
 		pr_err("%s: Can't build omap_device for %s:%s.\n",
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 652ccc5..8cbfbc2 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -24,14 +24,6 @@
 #include <plat/omap_hwmod.h>
 #include <plat/omap_device.h>
 
-static struct omap_device_pm_latency omap_gpio_latency[] = {
-	[0] = {
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func   = omap_device_enable_hwmods,
-		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 {
 	struct platform_device *pdev;
@@ -108,9 +100,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
 	}
 
 	pdev = omap_device_build(name, id - 1, oh, pdata,
-				sizeof(*pdata),	omap_gpio_latency,
-				ARRAY_SIZE(omap_gpio_latency),
-				false);
+				sizeof(*pdata),	NULL, 0, false);
 	kfree(pdata);
 
 	if (IS_ERR(pdev)) {
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index cc87919..fe16da4 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -413,31 +413,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
 	return 0;
 }
 
-static struct omap_device_pm_latency omap_hsmmc_latency[] = {
-	[0] = {
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func	 = omap_device_enable_hwmods,
-		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-	/*
-	 * XXX There should also be an entry here to power off/on the
-	 * MMC regulators/PBIAS cells, etc.
-	 */
-};
-
 #define MAX_OMAP_MMC_HWMOD_NAME_LEN		16
 
 void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
 {
 	struct omap_hwmod *oh;
 	struct platform_device *pdev;
-	struct omap_device_pm_latency *ohl;
 	char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
 	struct omap_mmc_platform_data *mmc_data;
 	struct omap_mmc_dev_attr *mmc_dev_attr;
 	char *name;
 	int l;
-	int ohl_cnt = 0;
 
 	mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
 	if (!mmc_data) {
@@ -452,8 +438,6 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
 	omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));
 
 	name = "omap_hsmmc";
-	ohl = omap_hsmmc_latency;
-	ohl_cnt = ARRAY_SIZE(omap_hsmmc_latency);
 
 	l = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
 		     "mmc%d", ctrl_nr);
@@ -472,7 +456,7 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
 	}
 
 	pdev = omap_device_build(name, ctrl_nr - 1, oh, mmc_data,
-		sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false);
+		sizeof(struct omap_mmc_platform_data), NULL, 0, false);
 	if (IS_ERR(pdev)) {
 		WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name);
 		kfree(mmc_data->slots[0].name);
diff --git a/arch/arm/mach-omap2/hwspinlock.c b/arch/arm/mach-omap2/hwspinlock.c
index 0b3ae9d..36e2109 100644
--- a/arch/arm/mach-omap2/hwspinlock.c
+++ b/arch/arm/mach-omap2/hwspinlock.c
@@ -23,14 +23,6 @@
 #include <plat/omap_hwmod.h>
 #include <plat/omap_device.h>
 
-struct omap_device_pm_latency omap_spinlock_latency[] = {
-	{
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func   = omap_device_enable_hwmods,
-		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	}
-};
-
 int __init hwspinlocks_init(void)
 {
 	int retval = 0;
@@ -48,9 +40,7 @@ int __init hwspinlocks_init(void)
 	if (oh == NULL)
 		return -EINVAL;
 
-	pdev = omap_device_build(dev_name, 0, oh, NULL, 0,
-				omap_spinlock_latency,
-				ARRAY_SIZE(omap_spinlock_latency), false);
+	pdev = omap_device_build(dev_name, 0, oh, NULL, 0, NULL, 0, false);
 	if (IS_ERR(pdev)) {
 		pr_err("Can't build omap_device for %s:%s\n", dev_name,
 								oh_name);
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 7a42f32..9fb5d7d 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -102,14 +102,6 @@ int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
 }
 EXPORT_SYMBOL(omap2_mcbsp_set_clks_src);
 
-struct omap_device_pm_latency omap2_mcbsp_latency[] = {
-	{
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func   = omap_device_enable_hwmods,
-		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
 {
 	int id, count = 1;
@@ -145,8 +137,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
 		count++;
 	}
 	pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
-				sizeof(*pdata), omap2_mcbsp_latency,
-				ARRAY_SIZE(omap2_mcbsp_latency), false);
+				sizeof(*pdata), NULL, 0, false);
 	kfree(pdata);
 	if (IS_ERR(pdev))  {
 		pr_err("%s: Can't build omap_device for %s:%s.\n", __func__,
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 3d1c1d3..9992dbf 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -107,28 +107,6 @@ struct omap_uart_state {
 static LIST_HEAD(uart_list);
 static u8 num_uarts;
 
-static int uart_idle_hwmod(struct omap_device *od)
-{
-	omap_hwmod_idle(od->hwmods[0]);
-
-	return 0;
-}
-
-static int uart_enable_hwmod(struct omap_device *od)
-{
-	omap_hwmod_enable(od->hwmods[0]);
-
-	return 0;
-}
-
-static struct omap_device_pm_latency omap_uart_latency[] = {
-	{
-		.deactivate_func = uart_idle_hwmod,
-		.activate_func	 = uart_enable_hwmod,
-		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static inline unsigned int __serial_read_reg(struct uart_port *up,
 					     int offset)
 {
@@ -800,8 +778,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
 		return;
 
 	pdev = omap_device_build(name, uart->num, oh, pdata, pdata_size,
-			       omap_uart_latency,
-			       ARRAY_SIZE(omap_uart_latency), false);
+				 NULL, 0, false);
 	WARN(IS_ERR(pdev), "Could not build omap_device for %s: %s.\n",
 	     name, oh->name);
 
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index 624264d..3b5cf50 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -31,14 +31,6 @@
 
 static bool sr_enable_on_init;
 
-static struct omap_device_pm_latency omap_sr_latency[] = {
-	{
-		.deactivate_func = omap_device_idle_hwmods,
-		.activate_func	 = omap_device_enable_hwmods,
-		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST
-	},
-};
-
 /* Read EFUSE values from control registers for OMAP3430 */
 static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
 				struct omap_sr_data *sr_data)
@@ -121,8 +113,7 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
 	sr_data->enable_on_init = sr_enable_on_init;
 
 	pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data),
-			       omap_sr_latency,
-			       ARRAY_SIZE(omap_sr_latency), 0);
+				 NULL, 0, 0);
 	if (IS_ERR(pdev))
 		pr_warning("%s: Could not build omap_device for %s: %s.\n\n",
 			__func__, name, oh->name);
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index a65145b..c13ff3f 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -60,14 +60,6 @@ static struct musb_hdrc_platform_data musb_plat = {
 
 static u64 musb_dmamask = DMA_BIT_MASK(32);
 
-static struct omap_device_pm_latency omap_musb_latency[] = {
-	{
-		.deactivate_func	= omap_device_idle_hwmods,
-		.activate_func		= omap_device_enable_hwmods,
-		.flags			= OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static void usb_musb_mux_init(struct omap_musb_board_data *board_data)
 {
 	switch (board_data->interface_type) {
@@ -155,8 +147,7 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
 	}
 
 	od = omap_device_build(name, bus_id, oh, &musb_plat,
-			       sizeof(musb_plat), omap_musb_latency,
-			       ARRAY_SIZE(omap_musb_latency), false);
+			       sizeof(musb_plat), NULL, 0, false);
 	if (IS_ERR(od)) {
 		pr_err("Could not build omap_device for %s %s\n",
 						name, oh_name);
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 0c7caf2..c20beb8 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -123,14 +123,6 @@ static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, long t)
 	omap_pm_set_max_mpu_wakeup_lat(dev, t);
 }
 
-static struct omap_device_pm_latency omap_i2c_latency[] = {
-	[0] = {
-		.deactivate_func	= omap_device_idle_hwmods,
-		.activate_func		= omap_device_enable_hwmods,
-		.flags			= OMAP_DEVICE_LATENCY_AUTO_ADJUST,
-	},
-};
-
 static inline int omap2_i2c_add_bus(int bus_id)
 {
 	int l;
@@ -162,7 +154,7 @@ static inline int omap2_i2c_add_bus(int bus_id)
 		pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
 	pdev = omap_device_build(name, bus_id, oh, pdata,
 			sizeof(struct omap_i2c_bus_platform_data),
-			omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0);
+			NULL, 0, 0);
 	WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
 
 	return PTR_ERR(pdev);
-- 
1.7.0.4

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

* Re: [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev
  2011-08-22 15:19   ` Benoit Cousson
@ 2011-08-31 22:20     ` Kevin Hilman
  -1 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:20 UTC (permalink / raw)
  To: Benoit Cousson; +Cc: linux-omap, linux-arm-kernel, paul, Nishanth Menon

Benoit Cousson <b-cousson@ti.com> writes:

> From: Nishanth Menon <nm@ti.com>
>
> An API which translates a standard hwmod name to corresponding
> omap_device is useful for drivers when they need to look up the
> device associated with a hwmod name to map back into the device
> structure pointers. These ideally should be used by drivers in
> mach directory. Using a generic hwmod name like "gpu" instead of
> the actual device name which could change in the future, allows
> us to:
> a) Could in effect help replace apis such as omap2_get_mpuss_device,
> omap2_get_iva_device, omap2_get_l3_device, omap4_get_dsp_device,
> etc..
> b) Scale to more devices rather than be restricted to named functions
> c) Simplify driver's platform_data from passing additional fields
> all doing the same thing with different function pointer names
> just for accessing a different device name.
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> [b-cousson@ti.com: rebased on top of Kevin's changes]
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>

OK, I cerainly like this better than the omap2_get_*_device APIs, but
I don't see the point in returning an omap_device pointer.

In my series, I tried to make all the OMAP device APIs return/use a
platform_device pointer instead of an omap_device pointer, so I'd rather
just see this return the platform_device pointer directly.

Kevin

> ---
>  arch/arm/plat-omap/include/plat/omap_device.h |    1 +
>  arch/arm/plat-omap/omap_device.c              |   32 +++++++++++++++++++++++++
>  2 files changed, 33 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
> index d4d9b96..bdc2804 100644
> --- a/arch/arm/plat-omap/include/plat/omap_device.h
> +++ b/arch/arm/plat-omap/include/plat/omap_device.h
> @@ -101,6 +101,7 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
>  					 int pm_lats_cnt, int is_early_device);
>  
>  void __iomem *omap_device_get_rt_va(struct omap_device *od);
> +struct omap_device *omap_hwmod_name_get_odev(const char *oh_name);
>  
>  /* OMAP PM interface */
>  int omap_device_align_pm_lat(struct platform_device *pdev,
> diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
> index d8f2299..455594a 100644
> --- a/arch/arm/plat-omap/omap_device.c
> +++ b/arch/arm/plat-omap/omap_device.c
> @@ -840,6 +840,38 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)
>  	return omap_hwmod_get_mpu_rt_va(od->hwmods[0]);
>  }
>  
> +/**
> + * omap_hwmod_name_get_odev() - convert a hwmod name to omap_device pointer
> + * @oh_name: name of the hwmod device
> + *
> + * returns back a struct omap_device * pointer associated with a hwmod
> + * device represented by a hwmod_name
> + */
> +struct omap_device *omap_hwmod_name_get_odev(const char *oh_name)
> +{
> +	struct omap_hwmod *oh;
> +
> +	if (!oh_name) {
> +		WARN(1, "%s: no hwmod name!\n", __func__);
> +		return ERR_PTR(-EINVAL);
> +	}
> +
> +	oh = omap_hwmod_lookup(oh_name);
> +	if (IS_ERR_OR_NULL(oh)) {
> +		WARN(1, "%s: no hwmod for %s\n", __func__,
> +			oh_name);
> +		return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV);
> +	}
> +	if (IS_ERR_OR_NULL(oh->od)) {
> +		WARN(1, "%s: no omap_device for %s\n", __func__,
> +			oh_name);
> +		return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV);
> +	}
> +
> +	return oh->od;
> +}
> +EXPORT_SYMBOL(omap_hwmod_name_get_odev);
> +
>  /*
>   * Public functions intended for use in omap_device_pm_latency
>   * .activate_func and .deactivate_func function pointers

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

* [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev
@ 2011-08-31 22:20     ` Kevin Hilman
  0 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:20 UTC (permalink / raw)
  To: linux-arm-kernel

Benoit Cousson <b-cousson@ti.com> writes:

> From: Nishanth Menon <nm@ti.com>
>
> An API which translates a standard hwmod name to corresponding
> omap_device is useful for drivers when they need to look up the
> device associated with a hwmod name to map back into the device
> structure pointers. These ideally should be used by drivers in
> mach directory. Using a generic hwmod name like "gpu" instead of
> the actual device name which could change in the future, allows
> us to:
> a) Could in effect help replace apis such as omap2_get_mpuss_device,
> omap2_get_iva_device, omap2_get_l3_device, omap4_get_dsp_device,
> etc..
> b) Scale to more devices rather than be restricted to named functions
> c) Simplify driver's platform_data from passing additional fields
> all doing the same thing with different function pointer names
> just for accessing a different device name.
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> [b-cousson at ti.com: rebased on top of Kevin's changes]
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>

OK, I cerainly like this better than the omap2_get_*_device APIs, but
I don't see the point in returning an omap_device pointer.

In my series, I tried to make all the OMAP device APIs return/use a
platform_device pointer instead of an omap_device pointer, so I'd rather
just see this return the platform_device pointer directly.

Kevin

> ---
>  arch/arm/plat-omap/include/plat/omap_device.h |    1 +
>  arch/arm/plat-omap/omap_device.c              |   32 +++++++++++++++++++++++++
>  2 files changed, 33 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
> index d4d9b96..bdc2804 100644
> --- a/arch/arm/plat-omap/include/plat/omap_device.h
> +++ b/arch/arm/plat-omap/include/plat/omap_device.h
> @@ -101,6 +101,7 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
>  					 int pm_lats_cnt, int is_early_device);
>  
>  void __iomem *omap_device_get_rt_va(struct omap_device *od);
> +struct omap_device *omap_hwmod_name_get_odev(const char *oh_name);
>  
>  /* OMAP PM interface */
>  int omap_device_align_pm_lat(struct platform_device *pdev,
> diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
> index d8f2299..455594a 100644
> --- a/arch/arm/plat-omap/omap_device.c
> +++ b/arch/arm/plat-omap/omap_device.c
> @@ -840,6 +840,38 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)
>  	return omap_hwmod_get_mpu_rt_va(od->hwmods[0]);
>  }
>  
> +/**
> + * omap_hwmod_name_get_odev() - convert a hwmod name to omap_device pointer
> + * @oh_name: name of the hwmod device
> + *
> + * returns back a struct omap_device * pointer associated with a hwmod
> + * device represented by a hwmod_name
> + */
> +struct omap_device *omap_hwmod_name_get_odev(const char *oh_name)
> +{
> +	struct omap_hwmod *oh;
> +
> +	if (!oh_name) {
> +		WARN(1, "%s: no hwmod name!\n", __func__);
> +		return ERR_PTR(-EINVAL);
> +	}
> +
> +	oh = omap_hwmod_lookup(oh_name);
> +	if (IS_ERR_OR_NULL(oh)) {
> +		WARN(1, "%s: no hwmod for %s\n", __func__,
> +			oh_name);
> +		return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV);
> +	}
> +	if (IS_ERR_OR_NULL(oh->od)) {
> +		WARN(1, "%s: no omap_device for %s\n", __func__,
> +			oh_name);
> +		return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV);
> +	}
> +
> +	return oh->od;
> +}
> +EXPORT_SYMBOL(omap_hwmod_name_get_odev);
> +
>  /*
>   * Public functions intended for use in omap_device_pm_latency
>   * .activate_func and .deactivate_func function pointers

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

* Re: [PATCH 2/7] OMAP: PM: omap_device: add few quick access functions
  2011-08-22 15:19   ` Benoit Cousson
@ 2011-08-31 22:23     ` Kevin Hilman
  -1 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:23 UTC (permalink / raw)
  To: Benoit Cousson; +Cc: linux-omap, linux-arm-kernel, paul, Nishanth Menon

Benoit Cousson <b-cousson@ti.com> writes:

> From: Nishanth Menon <nm@ti.com>
>
> Provide a quick set of access functions:
> a) Convert omap_device to platform_device - This is the flip of
>    to_omap_device for equivalent usage
> b) Convert omap_device to device pointer - This is useful for
>    most devices that need to go through standard linux functions that
>    take device pointer.
> c) Convert hwmod to device pointer - This wrapper provides ability for
>    drivers to convert directly from hwmod name back to device pointer
>    without having to handle this on a driver by driver basis
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> [b-cousson@ti.com: Adapt it to the new pdev pointer inside od]
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> ---
>  arch/arm/plat-omap/include/plat/omap_device.h |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
> index bdc2804..903f329 100644
> --- a/arch/arm/plat-omap/include/plat/omap_device.h
> +++ b/arch/arm/plat-omap/include/plat/omap_device.h
> @@ -152,6 +152,21 @@ static inline struct omap_device *to_omap_device(struct platform_device *pdev)
>  	return pdev ? pdev->archdata.od : NULL;
>  }
>  
> +/* Convert omap_device to platform device pointer */
> +#define omap_device_get_pdev(x) ((x)->pdev)
> +/* Convert omap_device to device pointer */
> +#define omap_device_get_dev(x) (&omap_device_get_pdev(x)->dev)

I don't see these used elsewhere, and I don't think they're needed...

> +/* Convert omap_hwmod name to device pointer */
> +static inline struct device *omap_hwmod_name_get_dev(const char *oh_name)
> +{
> +	struct omap_device *od;
> +	od = omap_hwmod_name_get_odev(oh_name);
> +	if (IS_ERR_OR_NULL(od))
> +		return ERR_PTR(od ? PTR_ERR(od) : -ENODEV);
> +	return omap_device_get_dev(od);
> +}
> +

After comments on patch 1 are addressed, the 

      pdev = omap_hwmod_name_get_pdev(oh_name)
      return &pdev->dev;

Kevin

>  static inline
>  void omap_device_disable_idle_on_suspend(struct platform_device *pdev)
>  {

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

* [PATCH 2/7] OMAP: PM: omap_device: add few quick access functions
@ 2011-08-31 22:23     ` Kevin Hilman
  0 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:23 UTC (permalink / raw)
  To: linux-arm-kernel

Benoit Cousson <b-cousson@ti.com> writes:

> From: Nishanth Menon <nm@ti.com>
>
> Provide a quick set of access functions:
> a) Convert omap_device to platform_device - This is the flip of
>    to_omap_device for equivalent usage
> b) Convert omap_device to device pointer - This is useful for
>    most devices that need to go through standard linux functions that
>    take device pointer.
> c) Convert hwmod to device pointer - This wrapper provides ability for
>    drivers to convert directly from hwmod name back to device pointer
>    without having to handle this on a driver by driver basis
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> [b-cousson at ti.com: Adapt it to the new pdev pointer inside od]
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> ---
>  arch/arm/plat-omap/include/plat/omap_device.h |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
> index bdc2804..903f329 100644
> --- a/arch/arm/plat-omap/include/plat/omap_device.h
> +++ b/arch/arm/plat-omap/include/plat/omap_device.h
> @@ -152,6 +152,21 @@ static inline struct omap_device *to_omap_device(struct platform_device *pdev)
>  	return pdev ? pdev->archdata.od : NULL;
>  }
>  
> +/* Convert omap_device to platform device pointer */
> +#define omap_device_get_pdev(x) ((x)->pdev)
> +/* Convert omap_device to device pointer */
> +#define omap_device_get_dev(x) (&omap_device_get_pdev(x)->dev)

I don't see these used elsewhere, and I don't think they're needed...

> +/* Convert omap_hwmod name to device pointer */
> +static inline struct device *omap_hwmod_name_get_dev(const char *oh_name)
> +{
> +	struct omap_device *od;
> +	od = omap_hwmod_name_get_odev(oh_name);
> +	if (IS_ERR_OR_NULL(od))
> +		return ERR_PTR(od ? PTR_ERR(od) : -ENODEV);
> +	return omap_device_get_dev(od);
> +}
> +

After comments on patch 1 are addressed, the 

      pdev = omap_hwmod_name_get_pdev(oh_name)
      return &pdev->dev;

Kevin

>  static inline
>  void omap_device_disable_idle_on_suspend(struct platform_device *pdev)
>  {

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

* Re: [PATCH 3/7] OMAP3: beagle-board: Use the omap_hwmod_name_get_dev API
  2011-08-22 15:19   ` Benoit Cousson
@ 2011-08-31 22:24     ` Kevin Hilman
  -1 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:24 UTC (permalink / raw)
  To: Benoit Cousson; +Cc: linux-omap, linux-arm-kernel, paul, Nishanth Menon

Benoit Cousson <b-cousson@ti.com> writes:

> Replace the multiple omap2_get_XXX_device APIs with the new
> omap_hwmod_name_get_dev that uses the hwmod name to get the proper
> device.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Nishanth Menon <nm@ti.com>
> ---
>  arch/arm/mach-omap2/board-omap3beagle.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
> index 3ae16b4..dab16e0 100644
> --- a/arch/arm/mach-omap2/board-omap3beagle.c
> +++ b/arch/arm/mach-omap2/board-omap3beagle.c
> @@ -493,8 +493,8 @@ static void __init beagle_opp_init(void)
>  	if (cpu_is_omap3630()) {
>  		struct device *mpu_dev, *iva_dev;
>  
> -		mpu_dev = omap2_get_mpuss_device();
> -		iva_dev = omap2_get_iva_device();
> +		mpu_dev = omap_hwmod_name_get_dev("mpu");
> +		iva_dev = omap_hwmod_name_get_dev("iva");
>  
>  		if (!mpu_dev || !iva_dev) {
>  			pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",

Looks fine.

Kevin

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

* [PATCH 3/7] OMAP3: beagle-board: Use the omap_hwmod_name_get_dev API
@ 2011-08-31 22:24     ` Kevin Hilman
  0 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:24 UTC (permalink / raw)
  To: linux-arm-kernel

Benoit Cousson <b-cousson@ti.com> writes:

> Replace the multiple omap2_get_XXX_device APIs with the new
> omap_hwmod_name_get_dev that uses the hwmod name to get the proper
> device.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Nishanth Menon <nm@ti.com>
> ---
>  arch/arm/mach-omap2/board-omap3beagle.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
> index 3ae16b4..dab16e0 100644
> --- a/arch/arm/mach-omap2/board-omap3beagle.c
> +++ b/arch/arm/mach-omap2/board-omap3beagle.c
> @@ -493,8 +493,8 @@ static void __init beagle_opp_init(void)
>  	if (cpu_is_omap3630()) {
>  		struct device *mpu_dev, *iva_dev;
>  
> -		mpu_dev = omap2_get_mpuss_device();
> -		iva_dev = omap2_get_iva_device();
> +		mpu_dev = omap_hwmod_name_get_dev("mpu");
> +		iva_dev = omap_hwmod_name_get_dev("iva");
>  
>  		if (!mpu_dev || !iva_dev) {
>  			pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",

Looks fine.

Kevin

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

* Re: [PATCH 4/7] OMAP2+: pm: Use hwmod name instead of dev pointer
  2011-08-22 15:19   ` Benoit Cousson
@ 2011-08-31 22:24     ` Kevin Hilman
  -1 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:24 UTC (permalink / raw)
  To: Benoit Cousson; +Cc: linux-omap, linux-arm-kernel, paul

Benoit Cousson <b-cousson@ti.com> writes:

> Replace the struct device parameter of omap2_set_init_voltage
> by the hwmod name. It will avoid having to store explicitely
> the device pointer into a static variable.
> Moreover, it will be a little bit more scalable if we introduce
> new DVFS devices.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> ---
>  arch/arm/mach-omap2/pm.c |   22 +++++++++++++++-------
>  1 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
> index 54281e5..17725d2 100644
> --- a/arch/arm/mach-omap2/pm.c
> +++ b/arch/arm/mach-omap2/pm.c
> @@ -171,18 +171,26 @@ err:
>   * in the opp entry
>   */
>  static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
> -						struct device *dev)
> +					 const char *oh_name)
>  {
>  	struct voltagedomain *voltdm;
>  	struct clk *clk;
>  	struct opp *opp;
>  	unsigned long freq, bootup_volt;
> +	struct device *dev;
>  
> -	if (!vdd_name || !clk_name || !dev) {
> +	if (!vdd_name || !clk_name || !oh_name) {
>  		printk(KERN_ERR "%s: Invalid parameters!\n", __func__);
>  		goto exit;
>  	}
>  
> +	dev = omap_hwmod_name_get_dev(oh_name);
> +	if (IS_ERR(dev)) {
> +		pr_err("%s: Unable to get dev pointer for hwmod %s\n",
> +			__func__, oh_name);
> +		goto exit;
> +	}
> +
>  	voltdm = omap_voltage_domain_lookup(vdd_name);
>  	if (IS_ERR(voltdm)) {
>  		printk(KERN_ERR "%s: Unable to get vdd pointer for vdd_%s\n",
> @@ -228,8 +236,8 @@ static void __init omap3_init_voltages(void)
>  	if (!cpu_is_omap34xx())
>  		return;
>  
> -	omap2_set_init_voltage("mpu", "dpll1_ck", mpu_dev);
> -	omap2_set_init_voltage("core", "l3_ick", l3_dev);
> +	omap2_set_init_voltage("mpu", "dpll1_ck", "mpu");
> +	omap2_set_init_voltage("core", "l3_ick", "l3_main");
>  }
>  
>  static void __init omap4_init_voltages(void)
> @@ -237,9 +245,9 @@ static void __init omap4_init_voltages(void)
>  	if (!cpu_is_omap44xx())
>  		return;
>  
> -	omap2_set_init_voltage("mpu", "dpll_mpu_ck", mpu_dev);
> -	omap2_set_init_voltage("core", "l3_div_ck", l3_dev);
> -	omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", iva_dev);
> +	omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu");
> +	omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1");
> +	omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
>  }
>  
>  static int __init omap2_common_pm_init(void)

Looks fine.

Kevin

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

* [PATCH 4/7] OMAP2+: pm: Use hwmod name instead of dev pointer
@ 2011-08-31 22:24     ` Kevin Hilman
  0 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:24 UTC (permalink / raw)
  To: linux-arm-kernel

Benoit Cousson <b-cousson@ti.com> writes:

> Replace the struct device parameter of omap2_set_init_voltage
> by the hwmod name. It will avoid having to store explicitely
> the device pointer into a static variable.
> Moreover, it will be a little bit more scalable if we introduce
> new DVFS devices.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> ---
>  arch/arm/mach-omap2/pm.c |   22 +++++++++++++++-------
>  1 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
> index 54281e5..17725d2 100644
> --- a/arch/arm/mach-omap2/pm.c
> +++ b/arch/arm/mach-omap2/pm.c
> @@ -171,18 +171,26 @@ err:
>   * in the opp entry
>   */
>  static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
> -						struct device *dev)
> +					 const char *oh_name)
>  {
>  	struct voltagedomain *voltdm;
>  	struct clk *clk;
>  	struct opp *opp;
>  	unsigned long freq, bootup_volt;
> +	struct device *dev;
>  
> -	if (!vdd_name || !clk_name || !dev) {
> +	if (!vdd_name || !clk_name || !oh_name) {
>  		printk(KERN_ERR "%s: Invalid parameters!\n", __func__);
>  		goto exit;
>  	}
>  
> +	dev = omap_hwmod_name_get_dev(oh_name);
> +	if (IS_ERR(dev)) {
> +		pr_err("%s: Unable to get dev pointer for hwmod %s\n",
> +			__func__, oh_name);
> +		goto exit;
> +	}
> +
>  	voltdm = omap_voltage_domain_lookup(vdd_name);
>  	if (IS_ERR(voltdm)) {
>  		printk(KERN_ERR "%s: Unable to get vdd pointer for vdd_%s\n",
> @@ -228,8 +236,8 @@ static void __init omap3_init_voltages(void)
>  	if (!cpu_is_omap34xx())
>  		return;
>  
> -	omap2_set_init_voltage("mpu", "dpll1_ck", mpu_dev);
> -	omap2_set_init_voltage("core", "l3_ick", l3_dev);
> +	omap2_set_init_voltage("mpu", "dpll1_ck", "mpu");
> +	omap2_set_init_voltage("core", "l3_ick", "l3_main");
>  }
>  
>  static void __init omap4_init_voltages(void)
> @@ -237,9 +245,9 @@ static void __init omap4_init_voltages(void)
>  	if (!cpu_is_omap44xx())
>  		return;
>  
> -	omap2_set_init_voltage("mpu", "dpll_mpu_ck", mpu_dev);
> -	omap2_set_init_voltage("core", "l3_div_ck", l3_dev);
> -	omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", iva_dev);
> +	omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu");
> +	omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1");
> +	omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
>  }
>  
>  static int __init omap2_common_pm_init(void)

Looks fine.

Kevin

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

* Re: [PATCH 5/7] OMAP2+: pm: Remove static devices variable for mpu, dsp, iva and l3 PM
  2011-08-22 15:19   ` Benoit Cousson
@ 2011-08-31 22:25     ` Kevin Hilman
  -1 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:25 UTC (permalink / raw)
  To: Benoit Cousson; +Cc: paul, linux-omap, linux-arm-kernel

Benoit Cousson <b-cousson@ti.com> writes:

> Since the device pointer is now retrieved using the hwmod name, remove
> the static variables used to store the device pointers for DSP, MPU, IVA
> and L3 devices for PM/DVFS usage.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>

Looks fine,

Kevin

> ---
>  arch/arm/mach-omap2/pm.c |   47 ++++++---------------------------------------
>  1 files changed, 7 insertions(+), 40 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
> index 17725d2..832577a 100644
> --- a/arch/arm/mach-omap2/pm.c
> +++ b/arch/arm/mach-omap2/pm.c
> @@ -26,38 +26,7 @@
>  
>  static struct omap_device_pm_latency *pm_lats;
>  
> -static struct device *mpu_dev;
> -static struct device *iva_dev;
> -static struct device *l3_dev;
> -static struct device *dsp_dev;
> -
> -struct device *omap2_get_mpuss_device(void)
> -{
> -	WARN_ON_ONCE(!mpu_dev);
> -	return mpu_dev;
> -}
> -
> -struct device *omap2_get_iva_device(void)
> -{
> -	WARN_ON_ONCE(!iva_dev);
> -	return iva_dev;
> -}
> -
> -struct device *omap2_get_l3_device(void)
> -{
> -	WARN_ON_ONCE(!l3_dev);
> -	return l3_dev;
> -}
> -
> -struct device *omap4_get_dsp_device(void)
> -{
> -	WARN_ON_ONCE(!dsp_dev);
> -	return dsp_dev;
> -}
> -EXPORT_SYMBOL(omap4_get_dsp_device);
> -
> -/* static int _init_omap_device(struct omap_hwmod *oh, void *user) */
> -static int _init_omap_device(char *name, struct device **new_dev)
> +static int _init_omap_device(char *name)
>  {
>  	struct omap_hwmod *oh;
>  	struct platform_device *pdev;
> @@ -72,8 +41,6 @@ static int _init_omap_device(char *name, struct device **new_dev)
>  		 __func__, name))
>  		return -ENODEV;
>  
> -	*new_dev = &pdev->dev;
> -
>  	return 0;
>  }
>  
> @@ -82,16 +49,16 @@ static int _init_omap_device(char *name, struct device **new_dev)
>   */
>  static void omap2_init_processor_devices(void)
>  {
> -	_init_omap_device("mpu", &mpu_dev);
> +	_init_omap_device("mpu");
>  	if (omap3_has_iva())
> -		_init_omap_device("iva", &iva_dev);
> +		_init_omap_device("iva");
>  
>  	if (cpu_is_omap44xx()) {
> -		_init_omap_device("l3_main_1", &l3_dev);
> -		_init_omap_device("dsp", &dsp_dev);
> -		_init_omap_device("iva", &iva_dev);
> +		_init_omap_device("l3_main_1");
> +		_init_omap_device("dsp");
> +		_init_omap_device("iva");
>  	} else {
> -		_init_omap_device("l3_main", &l3_dev);
> +		_init_omap_device("l3_main");
>  	}
>  }

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

* [PATCH 5/7] OMAP2+: pm: Remove static devices variable for mpu, dsp, iva and l3 PM
@ 2011-08-31 22:25     ` Kevin Hilman
  0 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:25 UTC (permalink / raw)
  To: linux-arm-kernel

Benoit Cousson <b-cousson@ti.com> writes:

> Since the device pointer is now retrieved using the hwmod name, remove
> the static variables used to store the device pointers for DSP, MPU, IVA
> and L3 devices for PM/DVFS usage.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>

Looks fine,

Kevin

> ---
>  arch/arm/mach-omap2/pm.c |   47 ++++++---------------------------------------
>  1 files changed, 7 insertions(+), 40 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
> index 17725d2..832577a 100644
> --- a/arch/arm/mach-omap2/pm.c
> +++ b/arch/arm/mach-omap2/pm.c
> @@ -26,38 +26,7 @@
>  
>  static struct omap_device_pm_latency *pm_lats;
>  
> -static struct device *mpu_dev;
> -static struct device *iva_dev;
> -static struct device *l3_dev;
> -static struct device *dsp_dev;
> -
> -struct device *omap2_get_mpuss_device(void)
> -{
> -	WARN_ON_ONCE(!mpu_dev);
> -	return mpu_dev;
> -}
> -
> -struct device *omap2_get_iva_device(void)
> -{
> -	WARN_ON_ONCE(!iva_dev);
> -	return iva_dev;
> -}
> -
> -struct device *omap2_get_l3_device(void)
> -{
> -	WARN_ON_ONCE(!l3_dev);
> -	return l3_dev;
> -}
> -
> -struct device *omap4_get_dsp_device(void)
> -{
> -	WARN_ON_ONCE(!dsp_dev);
> -	return dsp_dev;
> -}
> -EXPORT_SYMBOL(omap4_get_dsp_device);
> -
> -/* static int _init_omap_device(struct omap_hwmod *oh, void *user) */
> -static int _init_omap_device(char *name, struct device **new_dev)
> +static int _init_omap_device(char *name)
>  {
>  	struct omap_hwmod *oh;
>  	struct platform_device *pdev;
> @@ -72,8 +41,6 @@ static int _init_omap_device(char *name, struct device **new_dev)
>  		 __func__, name))
>  		return -ENODEV;
>  
> -	*new_dev = &pdev->dev;
> -
>  	return 0;
>  }
>  
> @@ -82,16 +49,16 @@ static int _init_omap_device(char *name, struct device **new_dev)
>   */
>  static void omap2_init_processor_devices(void)
>  {
> -	_init_omap_device("mpu", &mpu_dev);
> +	_init_omap_device("mpu");
>  	if (omap3_has_iva())
> -		_init_omap_device("iva", &iva_dev);
> +		_init_omap_device("iva");
>  
>  	if (cpu_is_omap44xx()) {
> -		_init_omap_device("l3_main_1", &l3_dev);
> -		_init_omap_device("dsp", &dsp_dev);
> -		_init_omap_device("iva", &iva_dev);
> +		_init_omap_device("l3_main_1");
> +		_init_omap_device("dsp");
> +		_init_omap_device("iva");
>  	} else {
> -		_init_omap_device("l3_main", &l3_dev);
> +		_init_omap_device("l3_main");
>  	}
>  }

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

* Re: [PATCH 6/7] OMAP: omap_device: Create a default omap_device_pm_latency
  2011-08-22 15:19   ` Benoit Cousson
@ 2011-08-31 22:30     ` Kevin Hilman
  -1 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:30 UTC (permalink / raw)
  To: Benoit Cousson; +Cc: paul, linux-omap, linux-arm-kernel

Benoit Cousson <b-cousson@ti.com> writes:

> Most devices are using the same default omap_device_pm_latency structure
> during device built. In order to avoid the duplication of the same
> structure everywhere, add a default structure that will be used if
> the device does not have an explicit one.
>
> Next patches will clean the duplicated structures.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Paul Walmsley <paul@pwsan.com>

Excellent, queuing this for v3.2 (branch: for_3.2/omap_device)

Kevin

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

* [PATCH 6/7] OMAP: omap_device: Create a default omap_device_pm_latency
@ 2011-08-31 22:30     ` Kevin Hilman
  0 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:30 UTC (permalink / raw)
  To: linux-arm-kernel

Benoit Cousson <b-cousson@ti.com> writes:

> Most devices are using the same default omap_device_pm_latency structure
> during device built. In order to avoid the duplication of the same
> structure everywhere, add a default structure that will be used if
> the device does not have an explicit one.
>
> Next patches will clean the duplicated structures.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Paul Walmsley <paul@pwsan.com>

Excellent, queuing this for v3.2 (branch: for_3.2/omap_device)

Kevin

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

* Re: [PATCH 7/7] OMAP2+: devices: Remove all omap_device_pm_latency structures
  2011-08-22 15:19   ` Benoit Cousson
@ 2011-08-31 22:31     ` Kevin Hilman
  -1 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:31 UTC (permalink / raw)
  To: Benoit Cousson; +Cc: paul, linux-omap, linux-arm-kernel

Benoit Cousson <b-cousson@ti.com> writes:

> Remove all these duplicated structures since a default one is now
> available.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> ---
>  arch/arm/mach-omap2/devices.c    |   46 +++----------------------------------
>  arch/arm/mach-omap2/display.c    |   11 +--------
>  arch/arm/mach-omap2/dma.c        |   11 +--------
>  arch/arm/mach-omap2/gpio.c       |   12 +---------
>  arch/arm/mach-omap2/hsmmc.c      |   18 +--------------
>  arch/arm/mach-omap2/hwspinlock.c |   12 +---------
>  arch/arm/mach-omap2/mcbsp.c      |   11 +--------
>  arch/arm/mach-omap2/serial.c     |   25 +-------------------
>  arch/arm/mach-omap2/sr_device.c  |   11 +--------
>  arch/arm/mach-omap2/usb-musb.c   |   11 +--------
>  arch/arm/plat-omap/i2c.c         |   10 +-------
>  11 files changed, 14 insertions(+), 164 deletions(-)

Nice!  queuing this for v3.2 (branch: for_3.2/omap_device)

Kevin

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

* [PATCH 7/7] OMAP2+: devices: Remove all omap_device_pm_latency structures
@ 2011-08-31 22:31     ` Kevin Hilman
  0 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-08-31 22:31 UTC (permalink / raw)
  To: linux-arm-kernel

Benoit Cousson <b-cousson@ti.com> writes:

> Remove all these duplicated structures since a default one is now
> available.
>
> Signed-off-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> ---
>  arch/arm/mach-omap2/devices.c    |   46 +++----------------------------------
>  arch/arm/mach-omap2/display.c    |   11 +--------
>  arch/arm/mach-omap2/dma.c        |   11 +--------
>  arch/arm/mach-omap2/gpio.c       |   12 +---------
>  arch/arm/mach-omap2/hsmmc.c      |   18 +--------------
>  arch/arm/mach-omap2/hwspinlock.c |   12 +---------
>  arch/arm/mach-omap2/mcbsp.c      |   11 +--------
>  arch/arm/mach-omap2/serial.c     |   25 +-------------------
>  arch/arm/mach-omap2/sr_device.c  |   11 +--------
>  arch/arm/mach-omap2/usb-musb.c   |   11 +--------
>  arch/arm/plat-omap/i2c.c         |   10 +-------
>  11 files changed, 14 insertions(+), 164 deletions(-)

Nice!  queuing this for v3.2 (branch: for_3.2/omap_device)

Kevin

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

* Re: [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev
  2011-08-31 22:20     ` Kevin Hilman
@ 2011-09-01 11:48       ` Cousson, Benoit
  -1 siblings, 0 replies; 46+ messages in thread
From: Cousson, Benoit @ 2011-09-01 11:48 UTC (permalink / raw)
  To: Hilman, Kevin, Menon, Nishanth; +Cc: linux-omap, linux-arm-kernel, paul

On 9/1/2011 12:20 AM, Hilman, Kevin wrote:
> Benoit Cousson<b-cousson@ti.com>  writes:
>
>> From: Nishanth Menon<nm@ti.com>
>>
>> An API which translates a standard hwmod name to corresponding
>> omap_device is useful for drivers when they need to look up the
>> device associated with a hwmod name to map back into the device
>> structure pointers. These ideally should be used by drivers in
>> mach directory. Using a generic hwmod name like "gpu" instead of
>> the actual device name which could change in the future, allows
>> us to:
>> a) Could in effect help replace apis such as omap2_get_mpuss_device,
>> omap2_get_iva_device, omap2_get_l3_device, omap4_get_dsp_device,
>> etc..
>> b) Scale to more devices rather than be restricted to named functions
>> c) Simplify driver's platform_data from passing additional fields
>> all doing the same thing with different function pointer names
>> just for accessing a different device name.
>>
>> Signed-off-by: Nishanth Menon<nm@ti.com>
>> [b-cousson@ti.com: rebased on top of Kevin's changes]
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>
> OK, I cerainly like this better than the omap2_get_*_device APIs, but
> I don't see the point in returning an omap_device pointer.

That's a good point.

Nishanth,
Do you have any objection to replace that API with omap_hwmod_name_get_pdev?

> In my series, I tried to make all the OMAP device APIs return/use a
> platform_device pointer instead of an omap_device pointer, so I'd rather
> just see this return the platform_device pointer directly.

It make sense to me.

Thanks,
Benoit

>
> Kevin
>
>> ---
>>   arch/arm/plat-omap/include/plat/omap_device.h |    1 +
>>   arch/arm/plat-omap/omap_device.c              |   32 +++++++++++++++++++++++++
>>   2 files changed, 33 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
>> index d4d9b96..bdc2804 100644
>> --- a/arch/arm/plat-omap/include/plat/omap_device.h
>> +++ b/arch/arm/plat-omap/include/plat/omap_device.h
>> @@ -101,6 +101,7 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
>>   					 int pm_lats_cnt, int is_early_device);
>>
>>   void __iomem *omap_device_get_rt_va(struct omap_device *od);
>> +struct omap_device *omap_hwmod_name_get_odev(const char *oh_name);
>>
>>   /* OMAP PM interface */
>>   int omap_device_align_pm_lat(struct platform_device *pdev,
>> diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
>> index d8f2299..455594a 100644
>> --- a/arch/arm/plat-omap/omap_device.c
>> +++ b/arch/arm/plat-omap/omap_device.c
>> @@ -840,6 +840,38 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)
>>   	return omap_hwmod_get_mpu_rt_va(od->hwmods[0]);
>>   }
>>
>> +/**
>> + * omap_hwmod_name_get_odev() - convert a hwmod name to omap_device pointer
>> + * @oh_name: name of the hwmod device
>> + *
>> + * returns back a struct omap_device * pointer associated with a hwmod
>> + * device represented by a hwmod_name
>> + */
>> +struct omap_device *omap_hwmod_name_get_odev(const char *oh_name)
>> +{
>> +	struct omap_hwmod *oh;
>> +
>> +	if (!oh_name) {
>> +		WARN(1, "%s: no hwmod name!\n", __func__);
>> +		return ERR_PTR(-EINVAL);
>> +	}
>> +
>> +	oh = omap_hwmod_lookup(oh_name);
>> +	if (IS_ERR_OR_NULL(oh)) {
>> +		WARN(1, "%s: no hwmod for %s\n", __func__,
>> +			oh_name);
>> +		return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV);
>> +	}
>> +	if (IS_ERR_OR_NULL(oh->od)) {
>> +		WARN(1, "%s: no omap_device for %s\n", __func__,
>> +			oh_name);
>> +		return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV);
>> +	}
>> +
>> +	return oh->od;
>> +}
>> +EXPORT_SYMBOL(omap_hwmod_name_get_odev);
>> +
>>   /*
>>    * Public functions intended for use in omap_device_pm_latency
>>    * .activate_func and .deactivate_func function pointers


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

* [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev
@ 2011-09-01 11:48       ` Cousson, Benoit
  0 siblings, 0 replies; 46+ messages in thread
From: Cousson, Benoit @ 2011-09-01 11:48 UTC (permalink / raw)
  To: linux-arm-kernel

On 9/1/2011 12:20 AM, Hilman, Kevin wrote:
> Benoit Cousson<b-cousson@ti.com>  writes:
>
>> From: Nishanth Menon<nm@ti.com>
>>
>> An API which translates a standard hwmod name to corresponding
>> omap_device is useful for drivers when they need to look up the
>> device associated with a hwmod name to map back into the device
>> structure pointers. These ideally should be used by drivers in
>> mach directory. Using a generic hwmod name like "gpu" instead of
>> the actual device name which could change in the future, allows
>> us to:
>> a) Could in effect help replace apis such as omap2_get_mpuss_device,
>> omap2_get_iva_device, omap2_get_l3_device, omap4_get_dsp_device,
>> etc..
>> b) Scale to more devices rather than be restricted to named functions
>> c) Simplify driver's platform_data from passing additional fields
>> all doing the same thing with different function pointer names
>> just for accessing a different device name.
>>
>> Signed-off-by: Nishanth Menon<nm@ti.com>
>> [b-cousson at ti.com: rebased on top of Kevin's changes]
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>
> OK, I cerainly like this better than the omap2_get_*_device APIs, but
> I don't see the point in returning an omap_device pointer.

That's a good point.

Nishanth,
Do you have any objection to replace that API with omap_hwmod_name_get_pdev?

> In my series, I tried to make all the OMAP device APIs return/use a
> platform_device pointer instead of an omap_device pointer, so I'd rather
> just see this return the platform_device pointer directly.

It make sense to me.

Thanks,
Benoit

>
> Kevin
>
>> ---
>>   arch/arm/plat-omap/include/plat/omap_device.h |    1 +
>>   arch/arm/plat-omap/omap_device.c              |   32 +++++++++++++++++++++++++
>>   2 files changed, 33 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
>> index d4d9b96..bdc2804 100644
>> --- a/arch/arm/plat-omap/include/plat/omap_device.h
>> +++ b/arch/arm/plat-omap/include/plat/omap_device.h
>> @@ -101,6 +101,7 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
>>   					 int pm_lats_cnt, int is_early_device);
>>
>>   void __iomem *omap_device_get_rt_va(struct omap_device *od);
>> +struct omap_device *omap_hwmod_name_get_odev(const char *oh_name);
>>
>>   /* OMAP PM interface */
>>   int omap_device_align_pm_lat(struct platform_device *pdev,
>> diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
>> index d8f2299..455594a 100644
>> --- a/arch/arm/plat-omap/omap_device.c
>> +++ b/arch/arm/plat-omap/omap_device.c
>> @@ -840,6 +840,38 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)
>>   	return omap_hwmod_get_mpu_rt_va(od->hwmods[0]);
>>   }
>>
>> +/**
>> + * omap_hwmod_name_get_odev() - convert a hwmod name to omap_device pointer
>> + * @oh_name: name of the hwmod device
>> + *
>> + * returns back a struct omap_device * pointer associated with a hwmod
>> + * device represented by a hwmod_name
>> + */
>> +struct omap_device *omap_hwmod_name_get_odev(const char *oh_name)
>> +{
>> +	struct omap_hwmod *oh;
>> +
>> +	if (!oh_name) {
>> +		WARN(1, "%s: no hwmod name!\n", __func__);
>> +		return ERR_PTR(-EINVAL);
>> +	}
>> +
>> +	oh = omap_hwmod_lookup(oh_name);
>> +	if (IS_ERR_OR_NULL(oh)) {
>> +		WARN(1, "%s: no hwmod for %s\n", __func__,
>> +			oh_name);
>> +		return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV);
>> +	}
>> +	if (IS_ERR_OR_NULL(oh->od)) {
>> +		WARN(1, "%s: no omap_device for %s\n", __func__,
>> +			oh_name);
>> +		return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV);
>> +	}
>> +
>> +	return oh->od;
>> +}
>> +EXPORT_SYMBOL(omap_hwmod_name_get_odev);
>> +
>>   /*
>>    * Public functions intended for use in omap_device_pm_latency
>>    * .activate_func and .deactivate_func function pointers

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

* Re: [PATCH 2/7] OMAP: PM: omap_device: add few quick access functions
  2011-08-31 22:23     ` Kevin Hilman
@ 2011-09-01 11:55       ` Cousson, Benoit
  -1 siblings, 0 replies; 46+ messages in thread
From: Cousson, Benoit @ 2011-09-01 11:55 UTC (permalink / raw)
  To: Hilman, Kevin; +Cc: linux-omap, linux-arm-kernel, paul, Menon, Nishanth

On 9/1/2011 12:23 AM, Hilman, Kevin wrote:
> Benoit Cousson<b-cousson@ti.com>  writes:
>
>> From: Nishanth Menon<nm@ti.com>
>>
>> Provide a quick set of access functions:
>> a) Convert omap_device to platform_device - This is the flip of
>>     to_omap_device for equivalent usage
>> b) Convert omap_device to device pointer - This is useful for
>>     most devices that need to go through standard linux functions that
>>     take device pointer.
>> c) Convert hwmod to device pointer - This wrapper provides ability for
>>     drivers to convert directly from hwmod name back to device pointer
>>     without having to handle this on a driver by driver basis
>>
>> Signed-off-by: Nishanth Menon<nm@ti.com>
>> [b-cousson@ti.com: Adapt it to the new pdev pointer inside od]
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>> ---
>>   arch/arm/plat-omap/include/plat/omap_device.h |   15 +++++++++++++++
>>   1 files changed, 15 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
>> index bdc2804..903f329 100644
>> --- a/arch/arm/plat-omap/include/plat/omap_device.h
>> +++ b/arch/arm/plat-omap/include/plat/omap_device.h
>> @@ -152,6 +152,21 @@ static inline struct omap_device *to_omap_device(struct platform_device *pdev)
>>   	return pdev ? pdev->archdata.od : NULL;
>>   }
>>
>> +/* Convert omap_device to platform device pointer */
>> +#define omap_device_get_pdev(x) ((x)->pdev)
>> +/* Convert omap_device to device pointer */
>> +#define omap_device_get_dev(x) (&omap_device_get_pdev(x)->dev)
>
> I don't see these used elsewhere, and I don't think they're needed...

Well, there are used once... just below, and that's all.

>> +/* Convert omap_hwmod name to device pointer */
>> +static inline struct device *omap_hwmod_name_get_dev(const char *oh_name)
>> +{
>> +	struct omap_device *od;
>> +	od = omap_hwmod_name_get_odev(oh_name);
>> +	if (IS_ERR_OR_NULL(od))
>> +		return ERR_PTR(od ? PTR_ERR(od) : -ENODEV);
>> +	return omap_device_get_dev(od);
>> +}
>> +

I will let Nishant comment, but I guess the idea was that an omap_device 
API should handle omap_device pointer, and then access to pdev or dev is 
done using these helpers.

Assuming that now omap_device API should preferably use pdev, we can 
remove one step of indirection and thus get rid of the helpers, since 
they are not used anywhere else.

> After comments on patch 1 are addressed, the
>
>        pdev = omap_hwmod_name_get_pdev(oh_name)
>        return&pdev->dev;

Thanks,
Benoit

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

* [PATCH 2/7] OMAP: PM: omap_device: add few quick access functions
@ 2011-09-01 11:55       ` Cousson, Benoit
  0 siblings, 0 replies; 46+ messages in thread
From: Cousson, Benoit @ 2011-09-01 11:55 UTC (permalink / raw)
  To: linux-arm-kernel

On 9/1/2011 12:23 AM, Hilman, Kevin wrote:
> Benoit Cousson<b-cousson@ti.com>  writes:
>
>> From: Nishanth Menon<nm@ti.com>
>>
>> Provide a quick set of access functions:
>> a) Convert omap_device to platform_device - This is the flip of
>>     to_omap_device for equivalent usage
>> b) Convert omap_device to device pointer - This is useful for
>>     most devices that need to go through standard linux functions that
>>     take device pointer.
>> c) Convert hwmod to device pointer - This wrapper provides ability for
>>     drivers to convert directly from hwmod name back to device pointer
>>     without having to handle this on a driver by driver basis
>>
>> Signed-off-by: Nishanth Menon<nm@ti.com>
>> [b-cousson at ti.com: Adapt it to the new pdev pointer inside od]
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>> ---
>>   arch/arm/plat-omap/include/plat/omap_device.h |   15 +++++++++++++++
>>   1 files changed, 15 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
>> index bdc2804..903f329 100644
>> --- a/arch/arm/plat-omap/include/plat/omap_device.h
>> +++ b/arch/arm/plat-omap/include/plat/omap_device.h
>> @@ -152,6 +152,21 @@ static inline struct omap_device *to_omap_device(struct platform_device *pdev)
>>   	return pdev ? pdev->archdata.od : NULL;
>>   }
>>
>> +/* Convert omap_device to platform device pointer */
>> +#define omap_device_get_pdev(x) ((x)->pdev)
>> +/* Convert omap_device to device pointer */
>> +#define omap_device_get_dev(x) (&omap_device_get_pdev(x)->dev)
>
> I don't see these used elsewhere, and I don't think they're needed...

Well, there are used once... just below, and that's all.

>> +/* Convert omap_hwmod name to device pointer */
>> +static inline struct device *omap_hwmod_name_get_dev(const char *oh_name)
>> +{
>> +	struct omap_device *od;
>> +	od = omap_hwmod_name_get_odev(oh_name);
>> +	if (IS_ERR_OR_NULL(od))
>> +		return ERR_PTR(od ? PTR_ERR(od) : -ENODEV);
>> +	return omap_device_get_dev(od);
>> +}
>> +

I will let Nishant comment, but I guess the idea was that an omap_device 
API should handle omap_device pointer, and then access to pdev or dev is 
done using these helpers.

Assuming that now omap_device API should preferably use pdev, we can 
remove one step of indirection and thus get rid of the helpers, since 
they are not used anywhere else.

> After comments on patch 1 are addressed, the
>
>        pdev = omap_hwmod_name_get_pdev(oh_name)
>        return&pdev->dev;

Thanks,
Benoit

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

* Re: [PATCH 7/7] OMAP2+: devices: Remove all omap_device_pm_latency structures
  2011-08-31 22:31     ` Kevin Hilman
@ 2011-09-01 11:59       ` Cousson, Benoit
  -1 siblings, 0 replies; 46+ messages in thread
From: Cousson, Benoit @ 2011-09-01 11:59 UTC (permalink / raw)
  To: Hilman, Kevin; +Cc: linux-omap, linux-arm-kernel, paul

On 9/1/2011 12:31 AM, Hilman, Kevin wrote:
> Benoit Cousson<b-cousson@ti.com>  writes:
>
>> Remove all these duplicated structures since a default one is now
>> available.
>>
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>> Cc: Kevin Hilman<khilman@ti.com>
>> ---
>>   arch/arm/mach-omap2/devices.c    |   46 +++----------------------------------
>>   arch/arm/mach-omap2/display.c    |   11 +--------
>>   arch/arm/mach-omap2/dma.c        |   11 +--------
>>   arch/arm/mach-omap2/gpio.c       |   12 +---------
>>   arch/arm/mach-omap2/hsmmc.c      |   18 +--------------
>>   arch/arm/mach-omap2/hwspinlock.c |   12 +---------
>>   arch/arm/mach-omap2/mcbsp.c      |   11 +--------
>>   arch/arm/mach-omap2/serial.c     |   25 +-------------------
>>   arch/arm/mach-omap2/sr_device.c  |   11 +--------
>>   arch/arm/mach-omap2/usb-musb.c   |   11 +--------
>>   arch/arm/plat-omap/i2c.c         |   10 +-------
>>   11 files changed, 14 insertions(+), 164 deletions(-)
>
> Nice!  queuing this for v3.2 (branch: for_3.2/omap_device)

Thanks,
Benoit

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

* [PATCH 7/7] OMAP2+: devices: Remove all omap_device_pm_latency structures
@ 2011-09-01 11:59       ` Cousson, Benoit
  0 siblings, 0 replies; 46+ messages in thread
From: Cousson, Benoit @ 2011-09-01 11:59 UTC (permalink / raw)
  To: linux-arm-kernel

On 9/1/2011 12:31 AM, Hilman, Kevin wrote:
> Benoit Cousson<b-cousson@ti.com>  writes:
>
>> Remove all these duplicated structures since a default one is now
>> available.
>>
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>> Cc: Kevin Hilman<khilman@ti.com>
>> ---
>>   arch/arm/mach-omap2/devices.c    |   46 +++----------------------------------
>>   arch/arm/mach-omap2/display.c    |   11 +--------
>>   arch/arm/mach-omap2/dma.c        |   11 +--------
>>   arch/arm/mach-omap2/gpio.c       |   12 +---------
>>   arch/arm/mach-omap2/hsmmc.c      |   18 +--------------
>>   arch/arm/mach-omap2/hwspinlock.c |   12 +---------
>>   arch/arm/mach-omap2/mcbsp.c      |   11 +--------
>>   arch/arm/mach-omap2/serial.c     |   25 +-------------------
>>   arch/arm/mach-omap2/sr_device.c  |   11 +--------
>>   arch/arm/mach-omap2/usb-musb.c   |   11 +--------
>>   arch/arm/plat-omap/i2c.c         |   10 +-------
>>   11 files changed, 14 insertions(+), 164 deletions(-)
>
> Nice!  queuing this for v3.2 (branch: for_3.2/omap_device)

Thanks,
Benoit

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

* Re: [PATCH 2/7] OMAP: PM: omap_device: add few quick access functions
  2011-09-01 11:55       ` Cousson, Benoit
@ 2011-09-01 14:55         ` Kevin Hilman
  -1 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-09-01 14:55 UTC (permalink / raw)
  To: Cousson, Benoit; +Cc: linux-omap, linux-arm-kernel, paul, Menon, Nishanth

"Cousson, Benoit" <b-cousson@ti.com> writes:

> On 9/1/2011 12:23 AM, Hilman, Kevin wrote:
>> Benoit Cousson<b-cousson@ti.com>  writes:
>>
>>> From: Nishanth Menon<nm@ti.com>
>>>
>>> Provide a quick set of access functions:
>>> a) Convert omap_device to platform_device - This is the flip of
>>>     to_omap_device for equivalent usage
>>> b) Convert omap_device to device pointer - This is useful for
>>>     most devices that need to go through standard linux functions that
>>>     take device pointer.
>>> c) Convert hwmod to device pointer - This wrapper provides ability for
>>>     drivers to convert directly from hwmod name back to device pointer
>>>     without having to handle this on a driver by driver basis
>>>
>>> Signed-off-by: Nishanth Menon<nm@ti.com>
>>> [b-cousson@ti.com: Adapt it to the new pdev pointer inside od]
>>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>>> ---
>>>   arch/arm/plat-omap/include/plat/omap_device.h |   15 +++++++++++++++
>>>   1 files changed, 15 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
>>> index bdc2804..903f329 100644
>>> --- a/arch/arm/plat-omap/include/plat/omap_device.h
>>> +++ b/arch/arm/plat-omap/include/plat/omap_device.h
>>> @@ -152,6 +152,21 @@ static inline struct omap_device *to_omap_device(struct platform_device *pdev)
>>>   	return pdev ? pdev->archdata.od : NULL;
>>>   }
>>>
>>> +/* Convert omap_device to platform device pointer */
>>> +#define omap_device_get_pdev(x) ((x)->pdev)
>>> +/* Convert omap_device to device pointer */
>>> +#define omap_device_get_dev(x) (&omap_device_get_pdev(x)->dev)
>>
>> I don't see these used elsewhere, and I don't think they're needed...
>
> Well, there are used once... just below, and that's all.
>
>>> +/* Convert omap_hwmod name to device pointer */
>>> +static inline struct device *omap_hwmod_name_get_dev(const char *oh_name)
>>> +{
>>> +	struct omap_device *od;
>>> +	od = omap_hwmod_name_get_odev(oh_name);
>>> +	if (IS_ERR_OR_NULL(od))
>>> +		return ERR_PTR(od ? PTR_ERR(od) : -ENODEV);
>>> +	return omap_device_get_dev(od);
>>> +}
>>> +
>
> I will let Nishant comment, but I guess the idea was that an
> omap_device API should handle omap_device pointer, and then access to
> pdev or dev is done using these helpers.
>
> Assuming that now omap_device API should preferably use pdev, we can
> remove one step of indirection and thus get rid of the helpers, since
> they are not used anywhere else.
>

Yes please.

I've made most of the omap_device API now use pdev pointers already in
my series.

Thanks,


Kevin

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

* [PATCH 2/7] OMAP: PM: omap_device: add few quick access functions
@ 2011-09-01 14:55         ` Kevin Hilman
  0 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-09-01 14:55 UTC (permalink / raw)
  To: linux-arm-kernel

"Cousson, Benoit" <b-cousson@ti.com> writes:

> On 9/1/2011 12:23 AM, Hilman, Kevin wrote:
>> Benoit Cousson<b-cousson@ti.com>  writes:
>>
>>> From: Nishanth Menon<nm@ti.com>
>>>
>>> Provide a quick set of access functions:
>>> a) Convert omap_device to platform_device - This is the flip of
>>>     to_omap_device for equivalent usage
>>> b) Convert omap_device to device pointer - This is useful for
>>>     most devices that need to go through standard linux functions that
>>>     take device pointer.
>>> c) Convert hwmod to device pointer - This wrapper provides ability for
>>>     drivers to convert directly from hwmod name back to device pointer
>>>     without having to handle this on a driver by driver basis
>>>
>>> Signed-off-by: Nishanth Menon<nm@ti.com>
>>> [b-cousson at ti.com: Adapt it to the new pdev pointer inside od]
>>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>>> ---
>>>   arch/arm/plat-omap/include/plat/omap_device.h |   15 +++++++++++++++
>>>   1 files changed, 15 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
>>> index bdc2804..903f329 100644
>>> --- a/arch/arm/plat-omap/include/plat/omap_device.h
>>> +++ b/arch/arm/plat-omap/include/plat/omap_device.h
>>> @@ -152,6 +152,21 @@ static inline struct omap_device *to_omap_device(struct platform_device *pdev)
>>>   	return pdev ? pdev->archdata.od : NULL;
>>>   }
>>>
>>> +/* Convert omap_device to platform device pointer */
>>> +#define omap_device_get_pdev(x) ((x)->pdev)
>>> +/* Convert omap_device to device pointer */
>>> +#define omap_device_get_dev(x) (&omap_device_get_pdev(x)->dev)
>>
>> I don't see these used elsewhere, and I don't think they're needed...
>
> Well, there are used once... just below, and that's all.
>
>>> +/* Convert omap_hwmod name to device pointer */
>>> +static inline struct device *omap_hwmod_name_get_dev(const char *oh_name)
>>> +{
>>> +	struct omap_device *od;
>>> +	od = omap_hwmod_name_get_odev(oh_name);
>>> +	if (IS_ERR_OR_NULL(od))
>>> +		return ERR_PTR(od ? PTR_ERR(od) : -ENODEV);
>>> +	return omap_device_get_dev(od);
>>> +}
>>> +
>
> I will let Nishant comment, but I guess the idea was that an
> omap_device API should handle omap_device pointer, and then access to
> pdev or dev is done using these helpers.
>
> Assuming that now omap_device API should preferably use pdev, we can
> remove one step of indirection and thus get rid of the helpers, since
> they are not used anywhere else.
>

Yes please.

I've made most of the omap_device API now use pdev pointers already in
my series.

Thanks,


Kevin

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

* Re: [PATCH 0/7] OMAP: omap_device cleanup before device-tree integration
  2011-08-22 15:19 ` Benoit Cousson
@ 2011-09-01 16:28   ` Kevin Hilman
  -1 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-09-01 16:28 UTC (permalink / raw)
  To: Benoit Cousson; +Cc: linux-omap, linux-arm-kernel, paul

Benoit Cousson <b-cousson@ti.com> writes:

> Hi Kevin,
>
> Here are a couple of cleanups on top of your for_3.2/omap_device series
> rebased on top of 3.1-rc2 to get your pm-fixes.

OK, my for_3.2/omap_device is now based on v3.1-rc4 which has my
pm-fixes merged.

> The goal is to help building core devices using device-tree by removing
> direct reference to the device inside PM.

Great.

> For that, I took and rebased the two patches done by Nishanth to use hwmod
> to identify the device from the generic IP name.

OK, I had some minor comments on those.

> The currently "unused" omap_device_pm_latency is moved inside the
> omap_device core code to avoid the duplication.

And these two I've pulled into my for_3.2/omap_device branch.
(not yet pushed because main kernel.org server is down.)

Kevin

> patches are available here:
> git://gitorious.org/omap-pm/linux.git for_3.2/omap_device_cleanup
>
> It is tested on OMAP4 SDP and Panda only. I don't even have the Beagle
> to test the beagle patch :-(
>
> Regards,
> Benoit
>
>
> Benoit Cousson (5):
>   OMAP3: beagle-board: Use the omap_hwmod_name_get_dev API
>   OMAP2+: pm: Use hwmod name instead of dev pointer
>   OMAP2+: pm: Remove static devices variable for mpu, dsp, iva and l3 PM
>   OMAP: omap_device: Create a default omap_device_pm_latency
>   OMAP2+: devices: Remove all omap_device_pm_latency structures
>
> Nishanth Menon (2):
>   OMAP: PM: omap_device: add omap_hwmod_name_get_odev
>   OMAP: PM: omap_device: add few quick access functions
>
>  arch/arm/mach-omap2/board-omap3beagle.c       |    4 +-
>  arch/arm/mach-omap2/devices.c                 |   46 ++---------------
>  arch/arm/mach-omap2/display.c                 |   11 +----
>  arch/arm/mach-omap2/dma.c                     |   11 +----
>  arch/arm/mach-omap2/gpio.c                    |   12 +----
>  arch/arm/mach-omap2/hsmmc.c                   |   18 +------
>  arch/arm/mach-omap2/hwspinlock.c              |   12 +----
>  arch/arm/mach-omap2/mcbsp.c                   |   11 +----
>  arch/arm/mach-omap2/pm.c                      |   69 ++++++++-----------------
>  arch/arm/mach-omap2/serial.c                  |   25 +---------
>  arch/arm/mach-omap2/sr_device.c               |   11 +----
>  arch/arm/mach-omap2/usb-musb.c                |   11 +----
>  arch/arm/plat-omap/i2c.c                      |   10 +---
>  arch/arm/plat-omap/include/plat/omap_device.h |   16 ++++++
>  arch/arm/plat-omap/omap_device.c              |   49 +++++++++++++++++-
>  15 files changed, 101 insertions(+), 215 deletions(-)

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

* [PATCH 0/7] OMAP: omap_device cleanup before device-tree integration
@ 2011-09-01 16:28   ` Kevin Hilman
  0 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-09-01 16:28 UTC (permalink / raw)
  To: linux-arm-kernel

Benoit Cousson <b-cousson@ti.com> writes:

> Hi Kevin,
>
> Here are a couple of cleanups on top of your for_3.2/omap_device series
> rebased on top of 3.1-rc2 to get your pm-fixes.

OK, my for_3.2/omap_device is now based on v3.1-rc4 which has my
pm-fixes merged.

> The goal is to help building core devices using device-tree by removing
> direct reference to the device inside PM.

Great.

> For that, I took and rebased the two patches done by Nishanth to use hwmod
> to identify the device from the generic IP name.

OK, I had some minor comments on those.

> The currently "unused" omap_device_pm_latency is moved inside the
> omap_device core code to avoid the duplication.

And these two I've pulled into my for_3.2/omap_device branch.
(not yet pushed because main kernel.org server is down.)

Kevin

> patches are available here:
> git://gitorious.org/omap-pm/linux.git for_3.2/omap_device_cleanup
>
> It is tested on OMAP4 SDP and Panda only. I don't even have the Beagle
> to test the beagle patch :-(
>
> Regards,
> Benoit
>
>
> Benoit Cousson (5):
>   OMAP3: beagle-board: Use the omap_hwmod_name_get_dev API
>   OMAP2+: pm: Use hwmod name instead of dev pointer
>   OMAP2+: pm: Remove static devices variable for mpu, dsp, iva and l3 PM
>   OMAP: omap_device: Create a default omap_device_pm_latency
>   OMAP2+: devices: Remove all omap_device_pm_latency structures
>
> Nishanth Menon (2):
>   OMAP: PM: omap_device: add omap_hwmod_name_get_odev
>   OMAP: PM: omap_device: add few quick access functions
>
>  arch/arm/mach-omap2/board-omap3beagle.c       |    4 +-
>  arch/arm/mach-omap2/devices.c                 |   46 ++---------------
>  arch/arm/mach-omap2/display.c                 |   11 +----
>  arch/arm/mach-omap2/dma.c                     |   11 +----
>  arch/arm/mach-omap2/gpio.c                    |   12 +----
>  arch/arm/mach-omap2/hsmmc.c                   |   18 +------
>  arch/arm/mach-omap2/hwspinlock.c              |   12 +----
>  arch/arm/mach-omap2/mcbsp.c                   |   11 +----
>  arch/arm/mach-omap2/pm.c                      |   69 ++++++++-----------------
>  arch/arm/mach-omap2/serial.c                  |   25 +---------
>  arch/arm/mach-omap2/sr_device.c               |   11 +----
>  arch/arm/mach-omap2/usb-musb.c                |   11 +----
>  arch/arm/plat-omap/i2c.c                      |   10 +---
>  arch/arm/plat-omap/include/plat/omap_device.h |   16 ++++++
>  arch/arm/plat-omap/omap_device.c              |   49 +++++++++++++++++-
>  15 files changed, 101 insertions(+), 215 deletions(-)

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

* Re: [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev
  2011-09-01 11:48       ` Cousson, Benoit
@ 2011-09-01 20:44         ` Menon, Nishanth
  -1 siblings, 0 replies; 46+ messages in thread
From: Menon, Nishanth @ 2011-09-01 20:44 UTC (permalink / raw)
  To: Cousson, Benoit; +Cc: Hilman, Kevin, linux-omap, linux-arm-kernel, paul

On Thu, Sep 1, 2011 at 06:48, Cousson, Benoit <b-cousson@ti.com> wrote:

>
> Nishanth,
> Do you have any objection to replace that API with omap_hwmod_name_get_pdev?
None.

Regards,
Nishanth Menon

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

* [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev
@ 2011-09-01 20:44         ` Menon, Nishanth
  0 siblings, 0 replies; 46+ messages in thread
From: Menon, Nishanth @ 2011-09-01 20:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 1, 2011 at 06:48, Cousson, Benoit <b-cousson@ti.com> wrote:

>
> Nishanth,
> Do you have any objection to replace that API with omap_hwmod_name_get_pdev?
None.

Regards,
Nishanth Menon

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

* Re: [PATCH 2/7] OMAP: PM: omap_device: add few quick access functions
  2011-08-31 22:23     ` Kevin Hilman
@ 2011-09-02 12:39       ` Cousson, Benoit
  -1 siblings, 0 replies; 46+ messages in thread
From: Cousson, Benoit @ 2011-09-02 12:39 UTC (permalink / raw)
  To: Hilman, Kevin; +Cc: Menon, Nishanth, paul, linux-omap, linux-arm-kernel

On 9/1/2011 12:23 AM, Hilman, Kevin wrote:
> Benoit Cousson<b-cousson@ti.com>  writes:
>
>> From: Nishanth Menon<nm@ti.com>
>>
>> Provide a quick set of access functions:
>> a) Convert omap_device to platform_device - This is the flip of
>>     to_omap_device for equivalent usage
>> b) Convert omap_device to device pointer - This is useful for
>>     most devices that need to go through standard linux functions that
>>     take device pointer.
>> c) Convert hwmod to device pointer - This wrapper provides ability for
>>     drivers to convert directly from hwmod name back to device pointer
>>     without having to handle this on a driver by driver basis
>>
>> Signed-off-by: Nishanth Menon<nm@ti.com>
>> [b-cousson@ti.com: Adapt it to the new pdev pointer inside od]
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>> ---
>>   arch/arm/plat-omap/include/plat/omap_device.h |   15 +++++++++++++++
>>   1 files changed, 15 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
>> index bdc2804..903f329 100644
>> --- a/arch/arm/plat-omap/include/plat/omap_device.h
>> +++ b/arch/arm/plat-omap/include/plat/omap_device.h
>> @@ -152,6 +152,21 @@ static inline struct omap_device *to_omap_device(struct platform_device *pdev)
>>   	return pdev ? pdev->archdata.od : NULL;
>>   }
>>
>> +/* Convert omap_device to platform device pointer */
>> +#define omap_device_get_pdev(x) ((x)->pdev)
>> +/* Convert omap_device to device pointer */
>> +#define omap_device_get_dev(x) (&omap_device_get_pdev(x)->dev)
>
> I don't see these used elsewhere, and I don't think they're needed...
>
>> +/* Convert omap_hwmod name to device pointer */
>> +static inline struct device *omap_hwmod_name_get_dev(const char *oh_name)
>> +{
>> +	struct omap_device *od;
>> +	od = omap_hwmod_name_get_odev(oh_name);
>> +	if (IS_ERR_OR_NULL(od))
>> +		return ERR_PTR(od ? PTR_ERR(od) : -ENODEV);
>> +	return omap_device_get_dev(od);
>> +}
>> +
>
> After comments on patch 1 are addressed, the
>
>        pdev = omap_hwmod_name_get_pdev(oh_name)
>        return&pdev->dev;

And in that case, that can be folded in the previous one I guess.

Benoit

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

* [PATCH 2/7] OMAP: PM: omap_device: add few quick access functions
@ 2011-09-02 12:39       ` Cousson, Benoit
  0 siblings, 0 replies; 46+ messages in thread
From: Cousson, Benoit @ 2011-09-02 12:39 UTC (permalink / raw)
  To: linux-arm-kernel

On 9/1/2011 12:23 AM, Hilman, Kevin wrote:
> Benoit Cousson<b-cousson@ti.com>  writes:
>
>> From: Nishanth Menon<nm@ti.com>
>>
>> Provide a quick set of access functions:
>> a) Convert omap_device to platform_device - This is the flip of
>>     to_omap_device for equivalent usage
>> b) Convert omap_device to device pointer - This is useful for
>>     most devices that need to go through standard linux functions that
>>     take device pointer.
>> c) Convert hwmod to device pointer - This wrapper provides ability for
>>     drivers to convert directly from hwmod name back to device pointer
>>     without having to handle this on a driver by driver basis
>>
>> Signed-off-by: Nishanth Menon<nm@ti.com>
>> [b-cousson at ti.com: Adapt it to the new pdev pointer inside od]
>> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
>> ---
>>   arch/arm/plat-omap/include/plat/omap_device.h |   15 +++++++++++++++
>>   1 files changed, 15 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
>> index bdc2804..903f329 100644
>> --- a/arch/arm/plat-omap/include/plat/omap_device.h
>> +++ b/arch/arm/plat-omap/include/plat/omap_device.h
>> @@ -152,6 +152,21 @@ static inline struct omap_device *to_omap_device(struct platform_device *pdev)
>>   	return pdev ? pdev->archdata.od : NULL;
>>   }
>>
>> +/* Convert omap_device to platform device pointer */
>> +#define omap_device_get_pdev(x) ((x)->pdev)
>> +/* Convert omap_device to device pointer */
>> +#define omap_device_get_dev(x) (&omap_device_get_pdev(x)->dev)
>
> I don't see these used elsewhere, and I don't think they're needed...
>
>> +/* Convert omap_hwmod name to device pointer */
>> +static inline struct device *omap_hwmod_name_get_dev(const char *oh_name)
>> +{
>> +	struct omap_device *od;
>> +	od = omap_hwmod_name_get_odev(oh_name);
>> +	if (IS_ERR_OR_NULL(od))
>> +		return ERR_PTR(od ? PTR_ERR(od) : -ENODEV);
>> +	return omap_device_get_dev(od);
>> +}
>> +
>
> After comments on patch 1 are addressed, the
>
>        pdev = omap_hwmod_name_get_pdev(oh_name)
>        return&pdev->dev;

And in that case, that can be folded in the previous one I guess.

Benoit

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

* Re: [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev
  2011-08-22 15:19   ` Benoit Cousson
@ 2011-09-26 18:18     ` Kevin Hilman
  -1 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-09-26 18:18 UTC (permalink / raw)
  To: Benoit Cousson
  Cc: khilman, linux-omap, linux-arm-kernel, paul, Nishanth Menon

On 08/22/2011 08:19 AM, Benoit Cousson wrote:
> From: Nishanth Menon<nm@ti.com>
>
> An API which translates a standard hwmod name to corresponding
> omap_device is useful for drivers when they need to look up the
> device associated with a hwmod name to map back into the device
> structure pointers. These ideally should be used by drivers in
> mach directory. Using a generic hwmod name like "gpu" instead of
> the actual device name which could change in the future, allows
> us to:
> a) Could in effect help replace apis such as omap2_get_mpuss_device,
> omap2_get_iva_device, omap2_get_l3_device, omap4_get_dsp_device,
> etc..
> b) Scale to more devices rather than be restricted to named functions
> c) Simplify driver's platform_data from passing additional fields
> all doing the same thing with different function pointer names
> just for accessing a different device name.
>
> Signed-off-by: Nishanth Menon<nm@ti.com>
> [b-cousson@ti.com: rebased on top of Kevin's changes]
> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
> ---
>   arch/arm/plat-omap/include/plat/omap_device.h |    1 +
>   arch/arm/plat-omap/omap_device.c              |   32 +++++++++++++++++++++++++
>   2 files changed, 33 insertions(+), 0 deletions(-)

One other comment on the API here.

This is an omap_hwmod_* API being added to omap_device.h.

Seems like the function name should be something more like:
omap_device_get_by_name()  (or _get_by_hwmod_name() or something.)

Kevin

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

* [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev
@ 2011-09-26 18:18     ` Kevin Hilman
  0 siblings, 0 replies; 46+ messages in thread
From: Kevin Hilman @ 2011-09-26 18:18 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/22/2011 08:19 AM, Benoit Cousson wrote:
> From: Nishanth Menon<nm@ti.com>
>
> An API which translates a standard hwmod name to corresponding
> omap_device is useful for drivers when they need to look up the
> device associated with a hwmod name to map back into the device
> structure pointers. These ideally should be used by drivers in
> mach directory. Using a generic hwmod name like "gpu" instead of
> the actual device name which could change in the future, allows
> us to:
> a) Could in effect help replace apis such as omap2_get_mpuss_device,
> omap2_get_iva_device, omap2_get_l3_device, omap4_get_dsp_device,
> etc..
> b) Scale to more devices rather than be restricted to named functions
> c) Simplify driver's platform_data from passing additional fields
> all doing the same thing with different function pointer names
> just for accessing a different device name.
>
> Signed-off-by: Nishanth Menon<nm@ti.com>
> [b-cousson at ti.com: rebased on top of Kevin's changes]
> Signed-off-by: Benoit Cousson<b-cousson@ti.com>
> ---
>   arch/arm/plat-omap/include/plat/omap_device.h |    1 +
>   arch/arm/plat-omap/omap_device.c              |   32 +++++++++++++++++++++++++
>   2 files changed, 33 insertions(+), 0 deletions(-)

One other comment on the API here.

This is an omap_hwmod_* API being added to omap_device.h.

Seems like the function name should be something more like:
omap_device_get_by_name()  (or _get_by_hwmod_name() or something.)

Kevin

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

end of thread, other threads:[~2011-09-26 18:19 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-22 15:19 [PATCH 0/7] OMAP: omap_device cleanup before device-tree integration Benoit Cousson
2011-08-22 15:19 ` Benoit Cousson
2011-08-22 15:19 ` [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev Benoit Cousson
2011-08-22 15:19   ` Benoit Cousson
2011-08-31 22:20   ` Kevin Hilman
2011-08-31 22:20     ` Kevin Hilman
2011-09-01 11:48     ` Cousson, Benoit
2011-09-01 11:48       ` Cousson, Benoit
2011-09-01 20:44       ` Menon, Nishanth
2011-09-01 20:44         ` Menon, Nishanth
2011-09-26 18:18   ` Kevin Hilman
2011-09-26 18:18     ` Kevin Hilman
2011-08-22 15:19 ` [PATCH 2/7] OMAP: PM: omap_device: add few quick access functions Benoit Cousson
2011-08-22 15:19   ` Benoit Cousson
2011-08-31 22:23   ` Kevin Hilman
2011-08-31 22:23     ` Kevin Hilman
2011-09-01 11:55     ` Cousson, Benoit
2011-09-01 11:55       ` Cousson, Benoit
2011-09-01 14:55       ` Kevin Hilman
2011-09-01 14:55         ` Kevin Hilman
2011-09-02 12:39     ` Cousson, Benoit
2011-09-02 12:39       ` Cousson, Benoit
2011-08-22 15:19 ` [PATCH 3/7] OMAP3: beagle-board: Use the omap_hwmod_name_get_dev API Benoit Cousson
2011-08-22 15:19   ` Benoit Cousson
2011-08-31 22:24   ` Kevin Hilman
2011-08-31 22:24     ` Kevin Hilman
2011-08-22 15:19 ` [PATCH 4/7] OMAP2+: pm: Use hwmod name instead of dev pointer Benoit Cousson
2011-08-22 15:19   ` Benoit Cousson
2011-08-31 22:24   ` Kevin Hilman
2011-08-31 22:24     ` Kevin Hilman
2011-08-22 15:19 ` [PATCH 5/7] OMAP2+: pm: Remove static devices variable for mpu, dsp, iva and l3 PM Benoit Cousson
2011-08-22 15:19   ` Benoit Cousson
2011-08-31 22:25   ` Kevin Hilman
2011-08-31 22:25     ` Kevin Hilman
2011-08-22 15:19 ` [PATCH 6/7] OMAP: omap_device: Create a default omap_device_pm_latency Benoit Cousson
2011-08-22 15:19   ` Benoit Cousson
2011-08-31 22:30   ` Kevin Hilman
2011-08-31 22:30     ` Kevin Hilman
2011-08-22 15:19 ` [PATCH 7/7] OMAP2+: devices: Remove all omap_device_pm_latency structures Benoit Cousson
2011-08-22 15:19   ` Benoit Cousson
2011-08-31 22:31   ` Kevin Hilman
2011-08-31 22:31     ` Kevin Hilman
2011-09-01 11:59     ` Cousson, Benoit
2011-09-01 11:59       ` Cousson, Benoit
2011-09-01 16:28 ` [PATCH 0/7] OMAP: omap_device cleanup before device-tree integration Kevin Hilman
2011-09-01 16:28   ` Kevin Hilman

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.