Skip to contentSkip to conversation

ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs

RFC PATCH In review Nishanth Menon 3 participants 13 messages Oct 23, 2012 – Nov 3, 2012

Subsystems (5)
lore
Share & tools
lore

Nishanth Menon

author maintainer
#0 lore raw

cover ARM: OMAP3+: move smartreflex-class3.c to drivers/power/avs

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

Signature · 1 line
1.7.9.5
author maintainer
#1 lore raw

RFC PATCH 1/6 PM / AVS / OMAP: move Kconfig definition of smartreflex to avs directory

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

---
 arch/arm/plat-omap/Kconfig |   22 ----------------------
 drivers/power/avs/Kconfig  |   22 ++++++++++++++++++++++
 2 files changed, 22 insertions(+), 22 deletions(-)
arch/arm/plat-omap/Kconfig +0 -22
index 7cd56ed..e5e7520 100644
@@ -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
drivers/power/avs/Kconfig +22 -0
index 2a1008b..466a391 100644
@@ -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.
Signature · 1 line
1.7.9.5
author maintainer
#2 lore raw

RFC PATCH 2/6 ARM: OMAP: voltage: remove duplicate header definitions

In reply to Nishanth Menon

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

---
 arch/arm/mach-omap2/voltage.h |    3 ---
 1 file changed, 3 deletions(-)
arch/arm/mach-omap2/voltage.h +0 -3
index 7283b7e..af9d469 100644
@@ -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
Signature · 1 line
1.7.9.5
author maintainer
#3 lore raw

RFC PATCH 3/6 ARM: OMAP: voltage: move voltdm_reset to platform_data header

In reply to 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.

---
 arch/arm/mach-omap2/voltage.h              |    1 -
 include/linux/platform_data/voltage-omap.h |    1 +
 2 files changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/voltage.h +0 -1
index af9d469..0665f21 100644
@@ -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
include/linux/platform_data/voltage-omap.h +1 -0
index 5be4d5d..4eb3d43 100644
@@ -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
Signature · 1 line
1.7.9.5
author maintainer
#4 lore raw

RFC PATCH 4/6 ARM: OMAP: SmartReflex: provide SoC integration API for VP

In reply to 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.

---
 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(-)
arch/arm/mach-omap2/smartreflex-class3.c +13 -3
index 1da8f03..201e219 100644
@@ -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);
arch/arm/mach-omap2/sr_device.c +5 -0
index f8217a5..6aac2c7 100644
@@ -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))
drivers/power/avs/smartreflex.c +2 -0
index 24768a2..32a9e3e 100644
@@ -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;
include/linux/power/smartreflex.h +18 -0
index 4a496eb..203fc64 100644
@@ -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 */
Signature · 1 line
1.7.9.5
author maintainer
#8 lore raw

RFC PATCH 5/6 ARM: OMAP: SmartReflex: use pr_warn instead of pr_warning

In reply to Nishanth Menon

Minor cleanup to use the preferred pr_warn

---
 arch/arm/mach-omap2/smartreflex-class3.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/smartreflex-class3.c +2 -2
index 201e219..75a505a 100644
@@ -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) {
Signature · 1 line
1.7.9.5
author maintainer
#9 lore raw

RFC PATCH 6/6 PM / AVS / OMAP: move Smartreflex-class3 driver to power/avs

In reply to Nishanth Menon

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

---
 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%)
arch/arm/mach-omap2/Makefile +0 -1
index fe40d9e..1eae31d 100644
@@ -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)
arch/arm/plat-omap/Kconfig +0 -9
index e5e7520..dba674b 100644
@@ -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
drivers/power/avs/Kconfig +9 -0
index 466a391..4f1c1b4 100644
@@ -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.
drivers/power/avs/Makefile +1 -0
index 0843386..ac72ec5 100644
@@ -1 +1,2 @@
 obj-$(CONFIG_POWER_AVS_OMAP)		+= smartreflex.o
+obj-$(CONFIG_POWER_AVS_OMAP_CLASS3)	+= smartreflex-class3.o
drivers/power/avs/smartreflex-class3.c renamed from arch/arm/mach-omap2/smartreflex-class3.c +0 -0
similarity index 100%
rename from arch/arm/mach-omap2/smartreflex-class3.c
rename to drivers/power/avs/smartreflex-class3.c
Signature · 1 line
1.7.9.5
Acked-by on the v1 series
#10 lore raw
In reply to Nishanth Menon

Hi Nishant,

Quoted 2 lines · 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.

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:

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

Quoted 15 lines

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

Quoted 1 line

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

Thanks!
Jean

Quoted 31 lines

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

Re: [RFC PATCH 4/6] ARM: OMAP: SmartReflex: provide SoC integration API for VP

In reply to Nishanth Menon

Nishant,

Quoted 44 lines · 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.

---
 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(-)
arch/arm/mach-omap2/smartreflex-class3.c +4 -1
index 1da8f03..201e219 100644
@@ -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;

arch/arm/mach-omap2/smartreflex-class3.c static int sr_class3_enable(struct omap_sr *sr) · line 37

Quoted 10 lines
arch/arm/mach-omap2/smartreflex-class3.c +3 -1
+       }
 
-       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) {'.

Quoted 93 lines
arch/arm/mach-omap2/smartreflex-class3.c +6 -1
+               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);
arch/arm/mach-omap2/sr_device.c +5 -0
index f8217a5..6aac2c7 100644
@@ -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))
drivers/power/avs/smartreflex.c +2 -0
index 24768a2..32a9e3e 100644
@@ -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;
include/linux/power/smartreflex.h +18 -1
index 4a496eb..203fc64 100644
@@ -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

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Regards,
Jean

author maintainer
#6 lore raw

Re: [RFC PATCH 4/6] ARM: OMAP: SmartReflex: provide SoC integration API for VP

Quoted 1 line · Jean Pihet

On Tue, Oct 23, 2012 at 11:43 PM, Nishanth Menon <[email protected]> wrote:

[..]

Quoted 4 lines
Quoted 3 lines

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.

Signature · 2 lines
Regards,
Nishanth Menon
#7 lore raw

Re: [RFC PATCH 4/6] ARM: OMAP: SmartReflex: provide SoC integration API for VP

In reply to Nishanth Menon
Quoted 17 lines · 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.

[...]

arch/arm/mach-omap2/smartreflex-class3.c static int sr_class3_enable(struct omap_sr *sr) · line 26

Quoted 6 lines
arch/arm/mach-omap2/smartreflex-class3.c +2 -0
@@ -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

#11 lore raw
In reply to Jean Pihet

Hi Nishanth,

Quoted 5 lines · Jean Pihet

Hi Nishant,

Quoted 2 lines · 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.

Quoted 8 lines

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:

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

#12 lore raw

Hi Nishant,

Quoted 19 lines · Kevin Hilman

Hi Nishanth,

Quoted 15 lines · Jean Pihet

Hi Nishant,

Quoted 4 lines · 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.

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:

Quoted 8 lines
Quoted 2 lines

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

Quoted 7 lines

I'll then
queue it
up for Rafael for v3.8.

Thanks,

Kevin