Commit 046bde9e authored by Kalle Jokiniemi's avatar Kalle Jokiniemi Committed by Tony Lindgren

ARM: OMAP: SmartReflex driver integration

This patch integrates TI's SmartReflex driver into linux-omap. SmartReflex is
a module that adjusts OMAP3 VDD1 and VDD2 operating voltages around the
nominal values of current operating point depending on silicon
characteristics and operating conditions.

The patch adds Kconfig options "SmartReflex support" and a sub-option
"SmartReflex testing support" under "System type"->"TI OMAP implementations"
menu. The testing support can be used to test SmartReflex functionality, if
the E-fuse values have not been set for the device. It however uses software
hard coded sensor parameters, which may not work on all devices. Beware.

The driver creates two sysfs entries into /sys/power/ named
"sr_vdd1_autocomp" and "sr_vdd2_autocomp" which can be used to activate
voltage autocompensation feature of SmartReflex modules 1 and 2.

Use the following commands to enable autocompensation:

echo -n 1 > /sys/power/sr_vdd1_autocomp
echo -n 1 > /sys/power/sr_vdd2_autocomp

To disable:

echo -n 0 > /sys/power/sr_vdd1_autocomp
echo -n 0 > /sys/power/sr_vdd2_autocomp
Signed-off-by: default avatarKalle Jokiniemi <ext-kalle.jokiniemi@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 3f42fa9c
......@@ -24,6 +24,9 @@ obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o
obj-$(CONFIG_PM_DEBUG) += pm-debug.o
endif
# SmartReflex driver
obj-$(CONFIG_OMAP_SMARTREFLEX) += smartreflex.o
# Clock framework
obj-$(CONFIG_ARCH_OMAP2) += clock24xx.o
obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o
......
......@@ -36,6 +36,7 @@
#include "prm.h"
#include "pm.h"
#include "smartreflex.h"
struct power_state {
struct powerdomain *pwrdm;
......@@ -259,6 +260,10 @@ static int omap3_pm_suspend(void)
struct power_state *pwrst;
int state, ret = 0;
/* XXX Disable smartreflex before entering suspend */
disable_smartreflex(SR1);
disable_smartreflex(SR2);
/* Read current next_pwrsts */
list_for_each_entry(pwrst, &pwrst_list, node)
pwrst->saved_state = pwrdm_read_next_pwrst(pwrst->pwrdm);
......@@ -290,6 +295,10 @@ restore:
printk(KERN_INFO "Successfully put all powerdomains "
"to target state\n");
/* XXX Enable smartreflex after suspend */
enable_smartreflex(SR1);
enable_smartreflex(SR2);
return ret;
}
......
This diff is collapsed.
......@@ -230,6 +230,27 @@
#define PRCM_NO_VDD2_OPPS 3
/* XXX: end remove/move */
/* XXX: find more appropriate place for these once DVFS is in place */
extern u32 current_vdd1_opp;
extern u32 current_vdd2_opp;
#ifdef CONFIG_OMAP_SMARTREFLEX_TESTING
#define SR_TESTING_NVALUES 1
#else
#define SR_TESTING_NVALUES 0
#endif
/*
* Smartreflex module enable/disable interface.
* NOTE: if smartreflex is not enabled from sysfs, these functions will not
* do anything.
*/
#ifdef CONFIG_OMAP_SMARTREFLEX
void enable_smartreflex(int srid);
void disable_smartreflex(int srid);
#else
static inline void enable_smartreflex(int srid) {}
static inline void disable_smartreflex(int srid) {}
#endif
#endif
......@@ -56,6 +56,37 @@ config OMAP_DEBUG_CLOCKDOMAIN
for every clockdomain register write. However, the
extra detail costs some memory.
config OMAP_SMARTREFLEX
bool "SmartReflex support"
depends on ARCH_OMAP34XX && TWL4030_CORE
help
Say Y if you want to enable SmartReflex.
SmartReflex can perform continuous dynamic voltage
scaling around the nominal operating point voltage
according to silicon characteristics and operating
conditions. Enabling SmartReflex reduces power
consumption.
Please note, that by default SmartReflex is only
initialized. To enable the automatic voltage
compensation for VDD1 and VDD2, user must write 1 to
/sys/power/sr_vddX_autocomp, where X is 1 or 2.
config OMAP_SMARTREFLEX_TESTING
bool "Smartreflex testing support"
depends on OMAP_SMARTREFLEX
default n
help
Say Y if you want to enable SmartReflex testing with SW hardcoded
NVALUES intead of E-fuse NVALUES set in factory silicon testing.
In some devices the E-fuse values have not been set, even though
SmartReflex modules are included. Using these hardcoded values set
in software, one can test the SmartReflex features without E-fuse.
WARNING: Enabling this option may cause your device to hang!
config OMAP_RESET_CLOCKS
bool "Reset unused clocks during boot"
depends on ARCH_OMAP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment