Skip to contentSkip to conversation

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

PATCH In review Nishanth Menon 2 participants 14 messages Nov 5, 2012 – Nov 8, 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 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-rc4
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(RFC): on inductor L5 (VDD2 - core):
https://plus.google.com/photos/112464029509057661457/albums/5715034179943520193/5802619719180530114

RFC: http://marc.info/?t=135102876700003&r=1&w=2
Changes since RFC:
- added Jean's Acked-by
- review comments addressed
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

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 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-rc4
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(RFC): on inductor L5 (VDD2 - core):
https://plus.google.com/photos/112464029509057661457/albums/5715034179943520193/5802619719180530114

RFC: http://marc.info/?t=135102876700003&r=1&w=2

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
#2 lore raw

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

In reply to Nishanth Menon

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 82fcb20..b49cff3 100644
@@ -47,28 +47,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
#3 lore raw

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
#4 lore raw

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

---
 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
maintainer
#5 lore raw

Re: [PATCH 3/6] ARM: OMAP: voltage: move voltdm_reset to platform_data header

Quoted 24 lines · Nishanth Menon

Move voltdm_reset to include/linux/platform_data/voltage-omap.h

---
 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 +0 -0
index 5be4d5d..4eb3d43 100644

include/linux/platform_data/voltage-omap.h int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt); · line 40

Quoted 5 lines
include/linux/platform_data/voltage-omap.h +1 -0
@@ -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

The include/linux/platform_data/voltage-omap.h should only contain pure platform_data, these should internal defines to the driver.

Looks like there are other things there too that's not platform data:

struct voltagedomain *voltdm_lookup(const char *name);
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);

Can you please add a patch fixing that ASAP?

Thanks,

Tony

author maintainer
#6 lore raw

Re: [PATCH 3/6] ARM: OMAP: voltage: move voltdm_reset to platform_data header

Quoted 25 lines · Tony Lindgren
Quoted 24 lines · Nishanth Menon

Move voltdm_reset to include/linux/platform_data/voltage-omap.h

---
 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 +0 -0
index 5be4d5d..4eb3d43 100644
@@ -36,4 +36,5 @@ int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt);
Quoted 8 lines

include/linux/platform_data/voltage-omap.h int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt); · line 40

Quoted 5 lines
include/linux/platform_data/voltage-omap.h +1 -0
 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

The include/linux/platform_data/voltage-omap.h should only contain pure platform_data, these should internal defines to the driver.

considering the move took place as part of:
commit 2203747c97712975accc5e69bdaf1ad38a691635
(ARM: omap: move platform_data definitions)
I suppose we should clean up the following as well include/linux/platform_data/dsp-omap.h - has function - reserve include/linux/platform_data/mtd-nand-omap2.h - has function -init include/linux/platform_data/mtd-onenand-omap2.h - has function -init include/linux/platform_data/remoteproc-omap.h - has function - reserve

Quoted 10 lines

Looks like there are other things there too that's not platform data:

struct voltagedomain *voltdm_lookup(const char *name);
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);

Can you please add a patch fixing that ASAP?

Agreed include/linux/platform_data/voltage-omap.h has more functions as well. Considering it did:
rename arch/arm/plat-omap/include/plat/voltage.h => include/linux/platform_data/voltage-omap.h

Where do we move these functions to?

drivers/power/avs/smartreflex.c needs:
omap_voltage_get_voltdata
and
drivers/power/avs/smartreflex-class3.c
will need voltdm_reset and voltdm_get_voltage

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

Re: [PATCH 3/6] ARM: OMAP: voltage: move voltdm_reset to platform_data header

Quoted 17 lines · Nishanth Menon
Quoted 10 lines · Tony Lindgren

Looks like there are other things there too that's not platform data:

struct voltagedomain *voltdm_lookup(const char *name);
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);

Can you please add a patch fixing that ASAP?

Agreed include/linux/platform_data/voltage-omap.h has more functions as well. Considering it did:
rename arch/arm/plat-omap/include/plat/voltage.h => include/linux/platform_data/voltage-omap.h

Quoted 7 lines

Where do we move these functions to?

drivers/power/avs/smartreflex.c needs:
omap_voltage_get_voltdata
and
drivers/power/avs/smartreflex-class3.c
will need voltdm_reset and voltdm_get_voltage

How about something local drivers/power/avs/smartreflex.h?

Regards,

Tony

author maintainer
#8 lore raw

Re: [PATCH 3/6] ARM: OMAP: voltage: move voltdm_reset to platform_data header

Quoted 20 lines · Tony Lindgren
Quoted 19 lines · Nishanth Menon
Quoted 10 lines · Tony Lindgren

Looks like there are other things there too that's not platform data:

struct voltagedomain *voltdm_lookup(const char *name);
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);

Can you please add a patch fixing that ASAP?

Agreed include/linux/platform_data/voltage-omap.h has more functions as well. Considering it did:
rename arch/arm/plat-omap/include/plat/voltage.h => include/linux/platform_data/voltage-omap.h

Where do we move these functions to?

Quoted 7 lines
Quoted 5 lines

drivers/power/avs/smartreflex.c needs:
omap_voltage_get_voltdata
and
drivers/power/avs/smartreflex-class3.c
will need voltdm_reset and voltdm_get_voltage

How about something local drivers/power/avs/smartreflex.h?

These APIs are exposed by voltage layer, not smartreflex :( stuff like voltdm_scale will have to be used by regulator logic eventually, so moving to AVS driver header is probably not right.

Signature · 2 lines
Regards,
Nishanth Menon
maintainer
#9 lore raw

Re: [PATCH 3/6] ARM: OMAP: voltage: move voltdm_reset to platform_data header

Quoted 27 lines · Nishanth Menon
Quoted 26 lines · Tony Lindgren
Quoted 24 lines · Nishanth Menon
Quoted 10 lines · Tony Lindgren

Looks like there are other things there too that's not platform data:

struct voltagedomain *voltdm_lookup(const char *name);
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);

Can you please add a patch fixing that ASAP?

Agreed include/linux/platform_data/voltage-omap.h has more functions as well. Considering it did:
rename arch/arm/plat-omap/include/plat/voltage.h => include/linux/platform_data/voltage-omap.h

Where do we move these functions to?

drivers/power/avs/smartreflex.c needs:
omap_voltage_get_voltdata
and
drivers/power/avs/smartreflex-class3.c
will need voltdm_reset and voltdm_get_voltage

Quoted 4 lines
Quoted 1 line

How about something local drivers/power/avs/smartreflex.h?

These APIs are exposed by voltage layer, not smartreflex :( stuff like voltdm_scale will have to be used by regulator logic eventually, so moving to AVS driver header is probably not right.

Well ideally you'd have some generic API doing it rather than these omap specifc exported functions.

Meanwhile, I guess you need to find some suitable location for the header file that works for Rafael.

Regards,

Tony

author maintainer
#10 lore raw

Re: [PATCH 3/6] ARM: OMAP: voltage: move voltdm_reset to platform_data header

Quoted 33 lines · Tony Lindgren
Quoted 27 lines · Nishanth Menon
Quoted 26 lines · Tony Lindgren
Quoted 24 lines · Nishanth Menon
Quoted 10 lines · Tony Lindgren

Looks like there are other things there too that's not platform data:

struct voltagedomain *voltdm_lookup(const char *name);
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);

Can you please add a patch fixing that ASAP?

Agreed include/linux/platform_data/voltage-omap.h has more functions as well. Considering it did:
rename arch/arm/plat-omap/include/plat/voltage.h => include/linux/platform_data/voltage-omap.h

Where do we move these functions to?

drivers/power/avs/smartreflex.c needs:
omap_voltage_get_voltdata
and
drivers/power/avs/smartreflex-class3.c
will need voltdm_reset and voltdm_get_voltage

Quoted 4 lines
Quoted 1 line

How about something local drivers/power/avs/smartreflex.h?

These APIs are exposed by voltage layer, not smartreflex :( stuff like voltdm_scale will have to be used by regulator logic eventually, so moving to AVS driver header is probably not right.

Quoted 5 lines

Well ideally you'd have some generic API doing it rather than these omap specifc exported functions.

Meanwhile, I guess you need to find some suitable location for the header file that works for Rafael.

I wonder if including mach/voltage.h is acceptable here? if Kevin could suggest an option as well, it will be great.

Signature · 2 lines
Regards,
Nishanth Menon
author maintainer
#11 lore raw

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..7ccf57f 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_disable) {
+		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
#12 lore raw

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 7ccf57f..23d45f9 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
#13 lore raw

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

In reply to Nishanth Menon

Move the AVS class 3 driver to AVS directory

---
 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 b49cff3..cd2c60d 100644
@@ -47,15 +47,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