All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs
@ 2012-10-23 21:43 Nishanth Menon
  2012-10-23 21:43 ` [RFC PATCH 1/6] PM / AVS / OMAP: move Kconfig definition of smartreflex to avs directory Nishanth Menon
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Nishanth Menon @ 2012-10-23 21:43 UTC (permalink / raw)
  To: l-o; +Cc: Kevin Hilman, Jean Pihet, J Keerthy, Nishanth Menon

smartreflex.c now resides in drivers/power/avs directory, but class driver
is in mach-omap2. High time we move it off to drivers/power/avs.

This series *does not* try to fix VP/VC to be voltage regulator OR introduce
a new OMAP voltage regulator series. instead, it purely tries to do the minimal
changes needed to move code to drivers/power/avs as a start.

Baseline: k.org v3.7-rc2 
Testing: Platform: beagle XM C1 (3730)
while [ 1 ]
do
echo -n "0" >/sys/kernel/debug/smartreflex/smartreflex_core/autocomp
date
echo -n "1" >/sys/kernel/debug/smartreflex/smartreflex_core/autocomp
done
Screen capture after the series: on inductor L5 (VDD2 - core):
https://plus.google.com/photos/112464029509057661457/albums/5715034179943520193/5802619719180530114

RFC for a view if this is ok as an intermediate step.

Nishanth Menon (6):
  PM / AVS / OMAP: move Kconfig definition of smartreflex to avs
    directory
  ARM: OMAP: voltage: remove duplicate header definitions
  ARM: OMAP: voltage: move voltdm_reset to platform_data header
  ARM: OMAP: SmartReflex: provide SoC integration API for VP
  ARM: OMAP: SmartReflex: use pr_warn instead of pr_warning
  PM / AVS / OMAP: move Smartreflex-class3 driver to power/avs

 arch/arm/mach-omap2/Makefile                       |    1 -
 arch/arm/mach-omap2/sr_device.c                    |    5 ++++
 arch/arm/mach-omap2/voltage.h                      |    4 ---
 arch/arm/plat-omap/Kconfig                         |   31 --------------------
 drivers/power/avs/Kconfig                          |   31 ++++++++++++++++++++
 drivers/power/avs/Makefile                         |    1 +
 .../power/avs}/smartreflex-class3.c                |   20 +++++++++----
 drivers/power/avs/smartreflex.c                    |    2 ++
 include/linux/platform_data/voltage-omap.h         |    1 +
 include/linux/power/smartreflex.h                  |   18 ++++++++++++
 10 files changed, 73 insertions(+), 41 deletions(-)
 rename {arch/arm/mach-omap2 => drivers/power/avs}/smartreflex-class3.c (75%)

Regards,
Nishanth Menon
-- 
1.7.9.5

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

* [RFC PATCH 1/6] PM / AVS / OMAP: move Kconfig definition of smartreflex to avs directory
  2012-10-23 21:43 [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs Nishanth Menon
@ 2012-10-23 21:43 ` Nishanth Menon
  2012-10-23 21:43 ` [RFC PATCH 2/6] ARM: OMAP: voltage: remove duplicate header definitions Nishanth Menon
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Nishanth Menon @ 2012-10-23 21:43 UTC (permalink / raw)
  To: l-o; +Cc: Kevin Hilman, Jean Pihet, J Keerthy, Nishanth Menon

Don't see why the source should be in drivers/power/avs, but not
config option

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/plat-omap/Kconfig |   22 ----------------------
 drivers/power/avs/Kconfig  |   22 ++++++++++++++++++++++
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 7cd56ed..e5e7520 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -46,28 +46,6 @@ config OMAP_DEBUG_LEDS
 	depends on OMAP_DEBUG_DEVICES
 	select LEDS_CLASS
 
-config POWER_AVS_OMAP
-	bool "AVS(Adaptive Voltage Scaling) support for OMAP IP versions 1&2"
-	depends on POWER_AVS && (ARCH_OMAP3 || ARCH_OMAP4) && PM
-	select POWER_SUPPLY
-	help
-	  Say Y to enable AVS(Adaptive Voltage Scaling)
-	  support on OMAP containing the version 1 or
-	  version 2 of the SmartReflex IP.
-	  V1 is the 65nm version used in OMAP3430.
-	  V2 is the update for the 45nm version of the IP used in OMAP3630
-	  and OMAP4430
-
-	  Please note, that by default SmartReflex is only
-	  initialized and not enabled. To enable the automatic voltage
-	  compensation for vdd mpu and vdd core from user space,
-	  user must write 1 to
-		/debug/smartreflex/sr_<X>/autocomp,
-	  where X is mpu_iva or core for OMAP3.
-	  Optionally autocompensation can be enabled in the kernel
-	  by default during system init via the enable_on_init flag
-	  which an be passed as platform data to the smartreflex driver.
-
 config POWER_AVS_OMAP_CLASS3
 	bool "Class 3 mode of Smartreflex Implementation"
 	depends on POWER_AVS_OMAP && TWL4030_CORE
diff --git a/drivers/power/avs/Kconfig b/drivers/power/avs/Kconfig
index 2a1008b..466a391 100644
--- a/drivers/power/avs/Kconfig
+++ b/drivers/power/avs/Kconfig
@@ -10,3 +10,25 @@ menuconfig POWER_AVS
 	  AVS is also called SmartReflex on OMAP devices.
 
 	  Say Y here to enable Adaptive Voltage Scaling class support.
+
+config POWER_AVS_OMAP
+	bool "AVS(Adaptive Voltage Scaling) support for OMAP IP versions 1&2"
+	depends on POWER_AVS && (ARCH_OMAP3 || ARCH_OMAP4) && PM
+	select POWER_SUPPLY
+	help
+	  Say Y to enable AVS(Adaptive Voltage Scaling)
+	  support on OMAP containing the version 1 or
+	  version 2 of the SmartReflex IP.
+	  V1 is the 65nm version used in OMAP3430.
+	  V2 is the update for the 45nm version of the IP used in OMAP3630
+	  and OMAP4430
+
+	  Please note, that by default SmartReflex is only
+	  initialized and not enabled. To enable the automatic voltage
+	  compensation for vdd mpu and vdd core from user space,
+	  user must write 1 to
+		/debug/smartreflex/sr_<X>/autocomp,
+	  where X is mpu_iva or core for OMAP3.
+	  Optionally autocompensation can be enabled in the kernel
+	  by default during system init via the enable_on_init flag
+	  which an be passed as platform data to the smartreflex driver.
-- 
1.7.9.5


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

* [RFC PATCH 2/6] ARM: OMAP: voltage: remove duplicate header definitions
  2012-10-23 21:43 [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs Nishanth Menon
  2012-10-23 21:43 ` [RFC PATCH 1/6] PM / AVS / OMAP: move Kconfig definition of smartreflex to avs directory Nishanth Menon
@ 2012-10-23 21:43 ` Nishanth Menon
  2012-10-23 21:43 ` [RFC PATCH 3/6] ARM: OMAP: voltage: move voltdm_reset to platform_data header Nishanth Menon
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Nishanth Menon @ 2012-10-23 21:43 UTC (permalink / raw)
  To: l-o; +Cc: Kevin Hilman, Jean Pihet, J Keerthy, Nishanth Menon

Remove duplicate definitions which are already present
in linux/platform_data/voltage-omap.h

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/voltage.h |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 7283b7e..af9d469 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -142,7 +142,6 @@ extern void omap3xxx_voltagedomains_init(void);
 extern void am33xx_voltagedomains_init(void);
 extern void omap44xx_voltagedomains_init(void);
 
-struct voltagedomain *voltdm_lookup(const char *name);
 void voltdm_init(struct voltagedomain **voltdm_list);
 int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
 int voltdm_for_each(int (*fn)(struct voltagedomain *voltdm, void *user),
@@ -150,7 +149,5 @@ int voltdm_for_each(int (*fn)(struct voltagedomain *voltdm, void *user),
 int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
 			  int (*fn)(struct voltagedomain *voltdm,
 				    struct powerdomain *pwrdm));
-int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt);
 void voltdm_reset(struct voltagedomain *voltdm);
-unsigned long voltdm_get_voltage(struct voltagedomain *voltdm);
 #endif
-- 
1.7.9.5


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

* [RFC PATCH 3/6] ARM: OMAP: voltage: move voltdm_reset to platform_data header
  2012-10-23 21:43 [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs Nishanth Menon
  2012-10-23 21:43 ` [RFC PATCH 1/6] PM / AVS / OMAP: move Kconfig definition of smartreflex to avs directory Nishanth Menon
  2012-10-23 21:43 ` [RFC PATCH 2/6] ARM: OMAP: voltage: remove duplicate header definitions Nishanth Menon
@ 2012-10-23 21:43 ` Nishanth Menon
  2012-10-23 21:43 ` [RFC PATCH 4/6] ARM: OMAP: SmartReflex: provide SoC integration API for VP Nishanth Menon
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Nishanth Menon @ 2012-10-23 21:43 UTC (permalink / raw)
  To: l-o; +Cc: Kevin Hilman, Jean Pihet, J Keerthy, Nishanth Menon

Move voltdm_reset to include/linux/platform_data/voltage-omap.h
This is an intermediate step to allow usage of the header by smartreflex
driver for usage of the same.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/voltage.h              |    1 -
 include/linux/platform_data/voltage-omap.h |    1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index af9d469..0665f21 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -149,5 +149,4 @@ int voltdm_for_each(int (*fn)(struct voltagedomain *voltdm, void *user),
 int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
 			  int (*fn)(struct voltagedomain *voltdm,
 				    struct powerdomain *pwrdm));
-void voltdm_reset(struct voltagedomain *voltdm);
 #endif
diff --git a/include/linux/platform_data/voltage-omap.h b/include/linux/platform_data/voltage-omap.h
index 5be4d5d..4eb3d43 100644
--- a/include/linux/platform_data/voltage-omap.h
+++ b/include/linux/platform_data/voltage-omap.h
@@ -36,4 +36,5 @@ int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt);
 unsigned long voltdm_get_voltage(struct voltagedomain *voltdm);
 struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
 		unsigned long volt);
+void voltdm_reset(struct voltagedomain *voltdm);
 #endif
-- 
1.7.9.5


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

* [RFC PATCH 4/6] ARM: OMAP: SmartReflex: provide SoC integration API for VP
  2012-10-23 21:43 [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs Nishanth Menon
                   ` (2 preceding siblings ...)
  2012-10-23 21:43 ` [RFC PATCH 3/6] ARM: OMAP: voltage: move voltdm_reset to platform_data header Nishanth Menon
@ 2012-10-23 21:43 ` Nishanth Menon
  2012-10-25  8:27   ` Jean Pihet
  2012-11-03 13:10   ` Kevin Hilman
  2012-10-23 21:44 ` [RFC PATCH 5/6] ARM: OMAP: SmartReflex: use pr_warn instead of pr_warning Nishanth Menon
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 13+ messages in thread
From: Nishanth Menon @ 2012-10-23 21:43 UTC (permalink / raw)
  To: l-o; +Cc: Kevin Hilman, Jean Pihet, J Keerthy, Nishanth Menon

SoC integration of SmartReflex AVS block is varied. Some use
Voltage Processor for a hardware loop in certain OMAP SoC (called
hardware loop), while others have just the AVS block without
hardware loop automatic calibration mechanism for AVS block
to talk through. So provide the Voltage Processor API
to allow for SmartReflex class drivers to use the same.

NOTE: SmartReflex class 3 mode of operation mandates VP APIs
so, refuse to enable AVS driver if corresponding APIs are
not available.

As part of this change, remove the inclusion of voltage.h
which is no longer needed as smartreflex.h includes
linux/platform_data/voltage-omap.h which contain relevant
definitions used here.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/smartreflex-class3.c |   16 +++++++++++++---
 arch/arm/mach-omap2/sr_device.c          |    5 +++++
 drivers/power/avs/smartreflex.c          |    2 ++
 include/linux/power/smartreflex.h        |   18 ++++++++++++++++++
 4 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
index 1da8f03..201e219 100644
--- a/arch/arm/mach-omap2/smartreflex-class3.c
+++ b/arch/arm/mach-omap2/smartreflex-class3.c
@@ -12,7 +12,6 @@
  */
 
 #include <linux/power/smartreflex.h>
-#include "voltage.h"
 
 static int sr_class3_enable(struct omap_sr *sr)
 {
@@ -23,15 +22,26 @@ static int sr_class3_enable(struct omap_sr *sr)
 				__func__, sr->name);
 		return -ENODATA;
 	}
+	if (!sr->soc_ops.vp_enable) {
+		pr_warn("%s: no VP enable available.Cannot enable %s!!\n",
+			__func__, sr->name);
+		return -EINVAL;
+	}
 
-	omap_vp_enable(sr->voltdm);
+	sr->soc_ops.vp_enable(sr->voltdm);
 	return sr_enable(sr->voltdm, volt);
 }
 
 static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
 {
+	if (!sr->soc_ops.vp_enable) {
+		pr_warn("%s: no VP disable available.Cannot disable %s!!\n",
+			__func__, sr->name);
+		return -EINVAL;
+	}
 	sr_disable_errgen(sr->voltdm);
-	omap_vp_disable(sr->voltdm);
+
+	sr->soc_ops.vp_disable(sr->voltdm);
 	sr_disable(sr->voltdm);
 	if (is_volt_reset)
 		voltdm_reset(sr->voltdm);
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index f8217a5..6aac2c7 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -139,6 +139,11 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
 
 	sr_data->enable_on_init = sr_enable_on_init;
 
+	if (sr_data->voltdm->vp) {
+		sr_data->soc_ops.vp_enable = omap_vp_enable;
+		sr_data->soc_ops.vp_disable = omap_vp_disable;
+	}
+
 	pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data),
 				 NULL, 0, 0);
 	if (IS_ERR(pdev))
diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
index 24768a2..32a9e3e 100644
--- a/drivers/power/avs/smartreflex.c
+++ b/drivers/power/avs/smartreflex.c
@@ -920,6 +920,8 @@ static int __init omap_sr_probe(struct platform_device *pdev)
 	sr_info->pdev = pdev;
 	sr_info->srid = pdev->id;
 	sr_info->voltdm = pdata->voltdm;
+	sr_info->soc_ops.vp_enable =  pdata->soc_ops.vp_enable;
+	sr_info->soc_ops.vp_disable =  pdata->soc_ops.vp_disable;
 	sr_info->nvalue_table = pdata->nvalue_table;
 	sr_info->nvalue_count = pdata->nvalue_count;
 	sr_info->senn_mod = pdata->senn_mod;
diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h
index 4a496eb..203fc64 100644
--- a/include/linux/power/smartreflex.h
+++ b/include/linux/power/smartreflex.h
@@ -143,6 +143,21 @@
 #define OMAP3430_SR_ERRWEIGHT		0x04
 #define OMAP3430_SR_ERRMAXLIMIT		0x02
 
+/**
+ * struct omap_sr_soc_ops - SoC specific APIs
+ * @vp_enable:	Voltage Processor enable
+ * @vp_disable:	Voltage Processor disable
+ *
+ * SmartReflex AVS module integration tends to be SoC
+ * variant. some are integrated with modules like
+ * Voltage Processor (VP), while, some SoC integration
+ * donot use VP. Provide that variance here.
+ */
+struct omap_sr_soc_ops {
+	void (*vp_enable)(struct voltagedomain *voltdm);
+	void (*vp_disable)(struct voltagedomain *voltdm);
+};
+
 struct omap_sr {
 	char				*name;
 	struct list_head		node;
@@ -165,6 +180,7 @@ struct omap_sr {
 	u32				senp_mod;
 	u32				senn_mod;
 	void __iomem			*base;
+	struct omap_sr_soc_ops		soc_ops;
 };
 
 /**
@@ -268,6 +284,7 @@ struct omap_sr_nvalue_table {
  * @nvalue_table:	table containing the  efuse offsets and nvalues
  *			corresponding to them.
  * @voltdm:		Pointer to the voltage domain associated with the SR
+ * @soc_ops:		SoC specific ops to deal with integration variance
  */
 struct omap_sr_data {
 	const char			*name;
@@ -278,6 +295,7 @@ struct omap_sr_data {
 	bool				enable_on_init;
 	struct omap_sr_nvalue_table	*nvalue_table;
 	struct voltagedomain		*voltdm;
+	struct omap_sr_soc_ops		soc_ops;
 };
 
 /* Smartreflex module enable/disable interface */
-- 
1.7.9.5


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

* [RFC PATCH 5/6] ARM: OMAP: SmartReflex: use pr_warn instead of pr_warning
  2012-10-23 21:43 [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs Nishanth Menon
                   ` (3 preceding siblings ...)
  2012-10-23 21:43 ` [RFC PATCH 4/6] ARM: OMAP: SmartReflex: provide SoC integration API for VP Nishanth Menon
@ 2012-10-23 21:44 ` Nishanth Menon
  2012-10-23 21:44 ` [RFC PATCH 6/6] PM / AVS / OMAP: move Smartreflex-class3 driver to power/avs Nishanth Menon
  2012-10-25  8:21 ` [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs Jean Pihet
  6 siblings, 0 replies; 13+ messages in thread
From: Nishanth Menon @ 2012-10-23 21:44 UTC (permalink / raw)
  To: l-o; +Cc: Kevin Hilman, Jean Pihet, J Keerthy, Nishanth Menon

Minor cleanup to use the preferred pr_warn

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/smartreflex-class3.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
index 201e219..75a505a 100644
--- a/arch/arm/mach-omap2/smartreflex-class3.c
+++ b/arch/arm/mach-omap2/smartreflex-class3.c
@@ -18,8 +18,8 @@ static int sr_class3_enable(struct omap_sr *sr)
 	unsigned long volt = voltdm_get_voltage(sr->voltdm);
 
 	if (!volt) {
-		pr_warning("%s: Curr voltage unknown. Cannot enable %s\n",
-				__func__, sr->name);
+		pr_warn("%s: Curr voltage unknown. Cannot enable %s\n",
+			__func__, sr->name);
 		return -ENODATA;
 	}
 	if (!sr->soc_ops.vp_enable) {
-- 
1.7.9.5


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

* [RFC PATCH 6/6] PM / AVS / OMAP: move Smartreflex-class3 driver to power/avs
  2012-10-23 21:43 [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs Nishanth Menon
                   ` (4 preceding siblings ...)
  2012-10-23 21:44 ` [RFC PATCH 5/6] ARM: OMAP: SmartReflex: use pr_warn instead of pr_warning Nishanth Menon
@ 2012-10-23 21:44 ` Nishanth Menon
  2012-10-25  8:21 ` [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs Jean Pihet
  6 siblings, 0 replies; 13+ messages in thread
From: Nishanth Menon @ 2012-10-23 21:44 UTC (permalink / raw)
  To: l-o; +Cc: Kevin Hilman, Jean Pihet, J Keerthy, Nishanth Menon

Move the SmartReflex AVS class3 driver to AVS directory along with the
config definition

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/Makefile                       |    1 -
 arch/arm/plat-omap/Kconfig                         |    9 ---------
 drivers/power/avs/Kconfig                          |    9 +++++++++
 drivers/power/avs/Makefile                         |    1 +
 .../power/avs}/smartreflex-class3.c                |    0
 5 files changed, 10 insertions(+), 10 deletions(-)
 rename {arch/arm/mach-omap2 => drivers/power/avs}/smartreflex-class3.c (100%)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index fe40d9e..1eae31d 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -71,7 +71,6 @@ obj-$(CONFIG_SOC_OMAP5)			+= omap-mpuss-lowpower.o sleep44xx.o
 obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o
 
 obj-$(CONFIG_POWER_AVS_OMAP)		+= sr_device.o
-obj-$(CONFIG_POWER_AVS_OMAP_CLASS3)	+= smartreflex-class3.o
 
 AFLAGS_sleep24xx.o			:=-Wa,-march=armv6
 AFLAGS_sleep34xx.o			:=-Wa,-march=armv7-a$(plus_sec)
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index e5e7520..dba674b 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -46,15 +46,6 @@ config OMAP_DEBUG_LEDS
 	depends on OMAP_DEBUG_DEVICES
 	select LEDS_CLASS
 
-config POWER_AVS_OMAP_CLASS3
-	bool "Class 3 mode of Smartreflex Implementation"
-	depends on POWER_AVS_OMAP && TWL4030_CORE
-	help
-	  Say Y to enable Class 3 implementation of Smartreflex
-
-	  Class 3 implementation of Smartreflex employs continuous hardware
-	  voltage calibration.
-
 config OMAP_RESET_CLOCKS
 	bool "Reset unused clocks during boot"
 	depends on ARCH_OMAP
diff --git a/drivers/power/avs/Kconfig b/drivers/power/avs/Kconfig
index 466a391..4f1c1b4 100644
--- a/drivers/power/avs/Kconfig
+++ b/drivers/power/avs/Kconfig
@@ -32,3 +32,12 @@ config POWER_AVS_OMAP
 	  Optionally autocompensation can be enabled in the kernel
 	  by default during system init via the enable_on_init flag
 	  which an be passed as platform data to the smartreflex driver.
+
+config POWER_AVS_OMAP_CLASS3
+	bool "Class 3 mode of Smartreflex Implementation"
+	depends on POWER_AVS_OMAP && TWL4030_CORE
+	help
+	  Say Y to enable Class 3 implementation of Smartreflex
+
+	  Class 3 implementation of Smartreflex employs continuous hardware
+	  voltage calibration.
diff --git a/drivers/power/avs/Makefile b/drivers/power/avs/Makefile
index 0843386..ac72ec5 100644
--- a/drivers/power/avs/Makefile
+++ b/drivers/power/avs/Makefile
@@ -1 +1,2 @@
 obj-$(CONFIG_POWER_AVS_OMAP)		+= smartreflex.o
+obj-$(CONFIG_POWER_AVS_OMAP_CLASS3)	+= smartreflex-class3.o
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/drivers/power/avs/smartreflex-class3.c
similarity index 100%
rename from arch/arm/mach-omap2/smartreflex-class3.c
rename to drivers/power/avs/smartreflex-class3.c
-- 
1.7.9.5


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

* Re: [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs
  2012-10-23 21:43 [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs Nishanth Menon
                   ` (5 preceding siblings ...)
  2012-10-23 21:44 ` [RFC PATCH 6/6] PM / AVS / OMAP: move Smartreflex-class3 driver to power/avs Nishanth Menon
@ 2012-10-25  8:21 ` Jean Pihet
  2012-11-03 13:14   ` Kevin Hilman
  6 siblings, 1 reply; 13+ messages in thread
From: Jean Pihet @ 2012-10-25  8:21 UTC (permalink / raw)
  To: Nishanth Menon, Kevin Hilman; +Cc: l-o, Jean Pihet, J Keerthy

Hi Nishant,

On Tue, Oct 23, 2012 at 11:43 PM, Nishanth Menon <nm@ti.com> wrote:
> smartreflex.c now resides in drivers/power/avs directory, but class driver
> is in mach-omap2. High time we move it off to drivers/power/avs.
Great to see the SR fully moved to drivers/.

After review of the code I am OK with the changes besides remarks sent
on the patches:
Acked-by: Jean Pihet <j-pihet@ti.com>

I let Kevin comment on the VC/VP aspect though.

> This series *does not* try to fix VP/VC to be voltage regulator OR introduce
> a new OMAP voltage regulator series. instead, it purely tries to do the minimal
> changes needed to move code to drivers/power/avs as a start.
>
> Baseline: k.org v3.7-rc2
> Testing: Platform: beagle XM C1 (3730)
> while [ 1 ]
> do
> echo -n "0" >/sys/kernel/debug/smartreflex/smartreflex_core/autocomp
> date
> echo -n "1" >/sys/kernel/debug/smartreflex/smartreflex_core/autocomp
> done
> Screen capture after the series: on inductor L5 (VDD2 - core):
> https://plus.google.com/photos/112464029509057661457/albums/5715034179943520193/5802619719180530114
>
> RFC for a view if this is ok as an intermediate step.

Thanks!
Jean

>
> Nishanth Menon (6):
>   PM / AVS / OMAP: move Kconfig definition of smartreflex to avs
>     directory
>   ARM: OMAP: voltage: remove duplicate header definitions
>   ARM: OMAP: voltage: move voltdm_reset to platform_data header
>   ARM: OMAP: SmartReflex: provide SoC integration API for VP
>   ARM: OMAP: SmartReflex: use pr_warn instead of pr_warning
>   PM / AVS / OMAP: move Smartreflex-class3 driver to power/avs
>
>  arch/arm/mach-omap2/Makefile                       |    1 -
>  arch/arm/mach-omap2/sr_device.c                    |    5 ++++
>  arch/arm/mach-omap2/voltage.h                      |    4 ---
>  arch/arm/plat-omap/Kconfig                         |   31 --------------------
>  drivers/power/avs/Kconfig                          |   31 ++++++++++++++++++++
>  drivers/power/avs/Makefile                         |    1 +
>  .../power/avs}/smartreflex-class3.c                |   20 +++++++++----
>  drivers/power/avs/smartreflex.c                    |    2 ++
>  include/linux/platform_data/voltage-omap.h         |    1 +
>  include/linux/power/smartreflex.h                  |   18 ++++++++++++
>  10 files changed, 73 insertions(+), 41 deletions(-)
>  rename {arch/arm/mach-omap2 => drivers/power/avs}/smartreflex-class3.c (75%)
>
> Regards,
> Nishanth Menon
> --
> 1.7.9.5
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [RFC PATCH 4/6] ARM: OMAP: SmartReflex: provide SoC integration API for VP
  2012-10-23 21:43 ` [RFC PATCH 4/6] ARM: OMAP: SmartReflex: provide SoC integration API for VP Nishanth Menon
@ 2012-10-25  8:27   ` Jean Pihet
  2012-10-25 12:55     ` Nishanth Menon
  2012-11-03 13:10   ` Kevin Hilman
  1 sibling, 1 reply; 13+ messages in thread
From: Jean Pihet @ 2012-10-25  8:27 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: l-o, Kevin Hilman, Jean Pihet, J Keerthy

Nishant,

On Tue, Oct 23, 2012 at 11:43 PM, Nishanth Menon <nm@ti.com> wrote:
> SoC integration of SmartReflex AVS block is varied. Some use
> Voltage Processor for a hardware loop in certain OMAP SoC (called
> hardware loop), while others have just the AVS block without
> hardware loop automatic calibration mechanism for AVS block
> to talk through. So provide the Voltage Processor API
> to allow for SmartReflex class drivers to use the same.
>
> NOTE: SmartReflex class 3 mode of operation mandates VP APIs
> so, refuse to enable AVS driver if corresponding APIs are
> not available.
>
> As part of this change, remove the inclusion of voltage.h
> which is no longer needed as smartreflex.h includes
> linux/platform_data/voltage-omap.h which contain relevant
> definitions used here.
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>  arch/arm/mach-omap2/smartreflex-class3.c |   16 +++++++++++++---
>  arch/arm/mach-omap2/sr_device.c          |    5 +++++
>  drivers/power/avs/smartreflex.c          |    2 ++
>  include/linux/power/smartreflex.h        |   18 ++++++++++++++++++
>  4 files changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
> index 1da8f03..201e219 100644
> --- a/arch/arm/mach-omap2/smartreflex-class3.c
> +++ b/arch/arm/mach-omap2/smartreflex-class3.c
> @@ -12,7 +12,6 @@
>   */
>
>  #include <linux/power/smartreflex.h>
> -#include "voltage.h"
>
>  static int sr_class3_enable(struct omap_sr *sr)
>  {
> @@ -23,15 +22,26 @@ static int sr_class3_enable(struct omap_sr *sr)
>                                 __func__, sr->name);
>                 return -ENODATA;
>         }
> +       if (!sr->soc_ops.vp_enable) {
> +               pr_warn("%s: no VP enable available.Cannot enable %s!!\n",
> +                       __func__, sr->name);
> +               return -EINVAL;
> +       }
>
> -       omap_vp_enable(sr->voltdm);
> +       sr->soc_ops.vp_enable(sr->voltdm);
>         return sr_enable(sr->voltdm, volt);
>  }
>
>  static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
>  {
> +       if (!sr->soc_ops.vp_enable) {
This should be ' if (!sr->soc_ops.vp_disbable) {'.

> +               pr_warn("%s: no VP disable available.Cannot disable %s!!\n",
> +                       __func__, sr->name);
> +               return -EINVAL;
> +       }
>         sr_disable_errgen(sr->voltdm);
> -       omap_vp_disable(sr->voltdm);
> +
> +       sr->soc_ops.vp_disable(sr->voltdm);
>         sr_disable(sr->voltdm);
>         if (is_volt_reset)
>                 voltdm_reset(sr->voltdm);
> diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
> index f8217a5..6aac2c7 100644
> --- a/arch/arm/mach-omap2/sr_device.c
> +++ b/arch/arm/mach-omap2/sr_device.c
> @@ -139,6 +139,11 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
>
>         sr_data->enable_on_init = sr_enable_on_init;
>
> +       if (sr_data->voltdm->vp) {
> +               sr_data->soc_ops.vp_enable = omap_vp_enable;
> +               sr_data->soc_ops.vp_disable = omap_vp_disable;
> +       }
> +
>         pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data),
>                                  NULL, 0, 0);
>         if (IS_ERR(pdev))
> diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
> index 24768a2..32a9e3e 100644
> --- a/drivers/power/avs/smartreflex.c
> +++ b/drivers/power/avs/smartreflex.c
> @@ -920,6 +920,8 @@ static int __init omap_sr_probe(struct platform_device *pdev)
>         sr_info->pdev = pdev;
>         sr_info->srid = pdev->id;
>         sr_info->voltdm = pdata->voltdm;
> +       sr_info->soc_ops.vp_enable =  pdata->soc_ops.vp_enable;
> +       sr_info->soc_ops.vp_disable =  pdata->soc_ops.vp_disable;
>         sr_info->nvalue_table = pdata->nvalue_table;
>         sr_info->nvalue_count = pdata->nvalue_count;
>         sr_info->senn_mod = pdata->senn_mod;
> diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h
> index 4a496eb..203fc64 100644
> --- a/include/linux/power/smartreflex.h
> +++ b/include/linux/power/smartreflex.h
> @@ -143,6 +143,21 @@
>  #define OMAP3430_SR_ERRWEIGHT          0x04
>  #define OMAP3430_SR_ERRMAXLIMIT                0x02
>
> +/**
> + * struct omap_sr_soc_ops - SoC specific APIs
> + * @vp_enable: Voltage Processor enable
> + * @vp_disable:        Voltage Processor disable
> + *
> + * SmartReflex AVS module integration tends to be SoC
> + * variant. some are integrated with modules like
> + * Voltage Processor (VP), while, some SoC integration
> + * donot use VP. Provide that variance here.
> + */
> +struct omap_sr_soc_ops {
> +       void (*vp_enable)(struct voltagedomain *voltdm);
> +       void (*vp_disable)(struct voltagedomain *voltdm);
> +};
> +
>  struct omap_sr {
>         char                            *name;
>         struct list_head                node;
> @@ -165,6 +180,7 @@ struct omap_sr {
>         u32                             senp_mod;
>         u32                             senn_mod;
>         void __iomem                    *base;
> +       struct omap_sr_soc_ops          soc_ops;
>  };
>
>  /**
> @@ -268,6 +284,7 @@ struct omap_sr_nvalue_table {
>   * @nvalue_table:      table containing the  efuse offsets and nvalues
>   *                     corresponding to them.
>   * @voltdm:            Pointer to the voltage domain associated with the SR
> + * @soc_ops:           SoC specific ops to deal with integration variance
>   */
>  struct omap_sr_data {
>         const char                      *name;
> @@ -278,6 +295,7 @@ struct omap_sr_data {
>         bool                            enable_on_init;
>         struct omap_sr_nvalue_table     *nvalue_table;
>         struct voltagedomain            *voltdm;
> +       struct omap_sr_soc_ops          soc_ops;
>  };
>
>  /* Smartreflex module enable/disable interface */
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Regards,
Jean

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

* Re: [RFC PATCH 4/6] ARM: OMAP: SmartReflex: provide SoC integration API for VP
  2012-10-25  8:27   ` Jean Pihet
@ 2012-10-25 12:55     ` Nishanth Menon
  0 siblings, 0 replies; 13+ messages in thread
From: Nishanth Menon @ 2012-10-25 12:55 UTC (permalink / raw)
  To: Jean Pihet; +Cc: l-o, Kevin Hilman, Jean Pihet, J Keerthy

On 10:27-20121025, Jean Pihet wrote:
> On Tue, Oct 23, 2012 at 11:43 PM, Nishanth Menon <nm@ti.com> wrote:
[..]
> >  static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
> >  {
> > +       if (!sr->soc_ops.vp_enable) {
> This should be ' if (!sr->soc_ops.vp_disbable) {'.
Argh.. yes. thanks for catching it. I will wait for any further comments
prior to reposting with the fix.
-- 
Regards,
Nishanth Menon

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

* Re: [RFC PATCH 4/6] ARM: OMAP: SmartReflex: provide SoC integration API for VP
  2012-10-23 21:43 ` [RFC PATCH 4/6] ARM: OMAP: SmartReflex: provide SoC integration API for VP Nishanth Menon
  2012-10-25  8:27   ` Jean Pihet
@ 2012-11-03 13:10   ` Kevin Hilman
  1 sibling, 0 replies; 13+ messages in thread
From: Kevin Hilman @ 2012-11-03 13:10 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: l-o, Jean Pihet, J Keerthy

On 10/23/2012 10:43 PM, Nishanth Menon wrote:
> SoC integration of SmartReflex AVS block is varied. Some use
> Voltage Processor for a hardware loop in certain OMAP SoC (called
> hardware loop), while others have just the AVS block without
> hardware loop automatic calibration mechanism for AVS block
> to talk through. So provide the Voltage Processor API
> to allow for SmartReflex class drivers to use the same.
>
> NOTE: SmartReflex class 3 mode of operation mandates VP APIs
> so, refuse to enable AVS driver if corresponding APIs are
> not available.
>
> As part of this change, remove the inclusion of voltage.h
> which is no longer needed as smartreflex.h includes
> linux/platform_data/voltage-omap.h which contain relevant
> definitions used here.
>
> Signed-off-by: Nishanth Menon <nm@ti.com>

[...]

> @@ -23,15 +22,26 @@ static int sr_class3_enable(struct omap_sr *sr)
>   				__func__, sr->name);
>   		return -ENODATA;
>   	}
> +	if (!sr->soc_ops.vp_enable) {
> +		pr_warn("%s: no VP enable available.Cannot enable %s!!\n",

nit: add space after '.'

There's a couple of these in the patch.

Kevin

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

* Re: [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs
  2012-10-25  8:21 ` [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs Jean Pihet
@ 2012-11-03 13:14   ` Kevin Hilman
  2012-11-03 14:44     ` Jean Pihet
  0 siblings, 1 reply; 13+ messages in thread
From: Kevin Hilman @ 2012-11-03 13:14 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: Jean Pihet, l-o, Jean Pihet, J Keerthy

Hi Nishanth,

On 10/25/2012 09:21 AM, Jean Pihet wrote:
> Hi Nishant,
>
> On Tue, Oct 23, 2012 at 11:43 PM, Nishanth Menon <nm@ti.com> wrote:
>> smartreflex.c now resides in drivers/power/avs directory, but class driver
>> is in mach-omap2. High time we move it off to drivers/power/avs.
> Great to see the SR fully moved to drivers/.
>
> After review of the code I am OK with the changes besides remarks sent
> on the patches:
> Acked-by: Jean Pihet <j-pihet@ti.com>
>
> I let Kevin comment on the VC/VP aspect though.
>

This move looks good to me.  Thanks!

Just had one nit, but after that.  Feel free to post without the RFC, 
and be sure to
include Rafael and linux-pm since it's moving to drivers/power.  I'll 
then queue it
up for Rafael for v3.8.

Thanks,

Kevin

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

* Re: [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs
  2012-11-03 13:14   ` Kevin Hilman
@ 2012-11-03 14:44     ` Jean Pihet
  0 siblings, 0 replies; 13+ messages in thread
From: Jean Pihet @ 2012-11-03 14:44 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: Kevin Hilman, l-o, Jean Pihet, J Keerthy

Hi Nishant,

On Sat, Nov 3, 2012 at 2:14 PM, Kevin Hilman
<khilman@deeprootsystems.com> wrote:
> Hi Nishanth,
>
>
> On 10/25/2012 09:21 AM, Jean Pihet wrote:
>>
>> Hi Nishant,
>>
>> On Tue, Oct 23, 2012 at 11:43 PM, Nishanth Menon <nm@ti.com> wrote:
>>>
>>> smartreflex.c now resides in drivers/power/avs directory, but class
>>> driver
>>> is in mach-omap2. High time we move it off to drivers/power/avs.
>>
>> Great to see the SR fully moved to drivers/.
>>
>> After review of the code I am OK with the changes besides remarks sent
>> on the patches:
>> Acked-by: Jean Pihet <j-pihet@ti.com>
>>
>> I let Kevin comment on the VC/VP aspect though.
>>
>
> This move looks good to me.  Thanks!
>
> Just had one nit, but after that.  Feel free to post without the RFC, and be
> sure to
> include Rafael and linux-pm since it's moving to drivers/power.
Please also include Anton, cf.
http://marc.info/?l=linux-pm&m=134424298230568&w=2

Regards,
Jean

> I'll then
> queue it
> up for Rafael for v3.8.
>
> Thanks,
>
> Kevin

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

end of thread, other threads:[~2012-11-03 14:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-23 21:43 [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs Nishanth Menon
2012-10-23 21:43 ` [RFC PATCH 1/6] PM / AVS / OMAP: move Kconfig definition of smartreflex to avs directory Nishanth Menon
2012-10-23 21:43 ` [RFC PATCH 2/6] ARM: OMAP: voltage: remove duplicate header definitions Nishanth Menon
2012-10-23 21:43 ` [RFC PATCH 3/6] ARM: OMAP: voltage: move voltdm_reset to platform_data header Nishanth Menon
2012-10-23 21:43 ` [RFC PATCH 4/6] ARM: OMAP: SmartReflex: provide SoC integration API for VP Nishanth Menon
2012-10-25  8:27   ` Jean Pihet
2012-10-25 12:55     ` Nishanth Menon
2012-11-03 13:10   ` Kevin Hilman
2012-10-23 21:44 ` [RFC PATCH 5/6] ARM: OMAP: SmartReflex: use pr_warn instead of pr_warning Nishanth Menon
2012-10-23 21:44 ` [RFC PATCH 6/6] PM / AVS / OMAP: move Smartreflex-class3 driver to power/avs Nishanth Menon
2012-10-25  8:21 ` [RFC PATCH 0/6] ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs Jean Pihet
2012-11-03 13:14   ` Kevin Hilman
2012-11-03 14:44     ` Jean Pihet

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.