mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 12:57:06 +09:00
A22 and phonesdk: make wm831x enter sleep in suspend, change vdd voltage to 1.0V
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
obj-y += timer.o io.o devices.o iomux.o clock.o rk29-pl330.o dma.o gpio.o ddr.o sram.o memcpy_dma.o reset.o
|
||||
obj-y += tests.o memtester.o
|
||||
obj-y += early_printk.o
|
||||
obj-y += pm-gpio.o
|
||||
ifndef CONFIG_DEBUG_LL
|
||||
obj-y += ../kernel/debug.o
|
||||
endif
|
||||
|
||||
@@ -625,6 +625,7 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
dcdc = regulator_get(NULL, "dcdc3"); // 1th IO
|
||||
regulator_set_voltage(dcdc,3000000,3000000);
|
||||
regulator_set_suspend_voltage(dcdc, 3000000);
|
||||
regulator_enable(dcdc);
|
||||
printk("%s set dcdc3=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
|
||||
regulator_put(dcdc);
|
||||
@@ -632,6 +633,7 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
ldo = regulator_get(NULL, "ldo10"); // 1th modem IO
|
||||
regulator_set_voltage(ldo,3000000,3000000);
|
||||
regulator_set_suspend_voltage(ldo,3000000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo10=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
@@ -639,6 +641,7 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
dcdc = regulator_get(NULL, "dcdc2"); // 2th CORE
|
||||
regulator_set_voltage(dcdc,1300000,1300000);
|
||||
regulator_set_suspend_voltage(dcdc,1000000);
|
||||
regulator_enable(dcdc);
|
||||
printk("%s set dcdc2=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
|
||||
regulator_put(dcdc);
|
||||
@@ -646,6 +649,7 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
dcdc = regulator_get(NULL, "dcdc1"); // 3th ddr
|
||||
regulator_set_voltage(dcdc,1800000,1800000);
|
||||
regulator_set_suspend_voltage(dcdc,1800000);
|
||||
regulator_enable(dcdc);
|
||||
printk("%s set dcdc1=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
|
||||
regulator_put(dcdc);
|
||||
@@ -653,6 +657,7 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
ldo = regulator_get(NULL, "ldo1"); // 3th nand
|
||||
regulator_set_voltage(ldo,1800000,1800000);
|
||||
regulator_set_suspend_voltage(ldo,1800000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo1=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
@@ -660,6 +665,7 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
ldo = regulator_get(NULL, "ldo4"); // 4th usb
|
||||
regulator_set_voltage(ldo,2500000,2500000);
|
||||
regulator_set_suspend_voltage(ldo,2500000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo4=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
@@ -667,13 +673,15 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
ldo = regulator_get(NULL, "ldo7"); // 5th usb
|
||||
regulator_set_voltage(ldo,3300000,3300000);
|
||||
regulator_set_suspend_voltage(ldo,3300000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo7=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
udelay(100);
|
||||
|
||||
dcdc = regulator_get(NULL, "dcdc4"); // backlight
|
||||
regulator_set_voltage(dcdc,20000000,20000000);
|
||||
regulator_set_voltage(dcdc,20000000,20000000);
|
||||
regulator_set_suspend_voltage(dcdc, 20000000);
|
||||
regulator_enable(dcdc);
|
||||
printk("%s set dcdc4=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
|
||||
regulator_put(dcdc);
|
||||
@@ -682,36 +690,42 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
ldo = regulator_get(NULL, "ldo2"); //lcd
|
||||
regulator_set_voltage(ldo,3000000,3000000);
|
||||
regulator_set_suspend_voltage(ldo,3000000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo2=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo3"); //sram
|
||||
regulator_set_voltage(ldo,1800000,1800000);
|
||||
regulator_set_suspend_voltage(ldo,1800000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo3=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo5"); //tf
|
||||
regulator_set_voltage(ldo,3000000,3000000);
|
||||
regulator_set_suspend_voltage(ldo,3000000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo5=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo6"); //camera
|
||||
regulator_set_voltage(ldo,1800000,1800000);
|
||||
regulator_set_suspend_voltage(ldo,1800000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo6=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo8"); //tp
|
||||
regulator_set_voltage(ldo,3000000,3000000);
|
||||
regulator_set_suspend_voltage(ldo,3000000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo8=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo9"); //cmmb
|
||||
regulator_set_voltage(ldo,3000000,3000000);
|
||||
regulator_set_suspend_voltage(ldo,3000000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo9=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
|
||||
@@ -678,6 +678,7 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
dcdc = regulator_get(NULL, "dcdc3"); // 1th IO
|
||||
regulator_set_voltage(dcdc,3000000,3000000);
|
||||
regulator_set_suspend_voltage(dcdc, 3000000);
|
||||
regulator_enable(dcdc);
|
||||
printk("%s set dcdc3=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
|
||||
regulator_put(dcdc);
|
||||
@@ -685,6 +686,7 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
ldo = regulator_get(NULL, "ldo10"); // 1th modem IO
|
||||
regulator_set_voltage(ldo,3000000,3000000);
|
||||
regulator_set_suspend_voltage(ldo,3000000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo10=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
@@ -692,6 +694,7 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
dcdc = regulator_get(NULL, "dcdc2"); // 2th CORE
|
||||
regulator_set_voltage(dcdc,1300000,1300000);
|
||||
regulator_set_suspend_voltage(dcdc,1000000);
|
||||
regulator_enable(dcdc);
|
||||
printk("%s set dcdc2=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
|
||||
regulator_put(dcdc);
|
||||
@@ -699,6 +702,7 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
dcdc = regulator_get(NULL, "dcdc1"); // 3th ddr
|
||||
regulator_set_voltage(dcdc,1800000,1800000);
|
||||
regulator_set_suspend_voltage(ldo, 1800000);
|
||||
regulator_enable(dcdc);
|
||||
printk("%s set dcdc1=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
|
||||
regulator_put(dcdc);
|
||||
@@ -706,6 +710,7 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
ldo = regulator_get(NULL, "ldo1"); // 3th nand
|
||||
regulator_set_voltage(ldo,1800000,1800000);
|
||||
regulator_set_suspend_voltage(ldo,1800000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo1=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
@@ -713,6 +718,7 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
ldo = regulator_get(NULL, "ldo4"); // 4th usb
|
||||
regulator_set_voltage(ldo,2500000,2500000);
|
||||
regulator_set_suspend_voltage(ldo,2500000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo4=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
@@ -720,13 +726,15 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
ldo = regulator_get(NULL, "ldo7"); // 5th usb
|
||||
regulator_set_voltage(ldo,3300000,3300000);
|
||||
regulator_set_suspend_voltage(ldo,3300000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo7=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
udelay(100);
|
||||
|
||||
dcdc = regulator_get(NULL, "dcdc4"); // backlight
|
||||
regulator_set_voltage(dcdc,20000000,20000000);
|
||||
regulator_set_voltage(dcdc,20000000,20000000);
|
||||
regulator_set_suspend_voltage(dcdc, 20000000);
|
||||
regulator_enable(dcdc);
|
||||
printk("%s set dcdc4=%dmV end\n", __FUNCTION__, regulator_get_voltage(dcdc));
|
||||
regulator_put(dcdc);
|
||||
@@ -735,36 +743,42 @@ int wm831x_post_init(struct wm831x *parm)
|
||||
|
||||
ldo = regulator_get(NULL, "ldo2"); //lcd
|
||||
regulator_set_voltage(ldo,3000000,3000000);
|
||||
regulator_set_suspend_voltage(ldo,3000000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo2=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo3"); //sram
|
||||
regulator_set_voltage(ldo,1800000,1800000);
|
||||
regulator_set_suspend_voltage(ldo,1800000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo3=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo5"); //tf
|
||||
regulator_set_voltage(ldo,3000000,3000000);
|
||||
regulator_set_suspend_voltage(ldo,3000000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo5=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo6"); //camera
|
||||
regulator_set_voltage(ldo,1800000,1800000);
|
||||
regulator_set_suspend_voltage(ldo,1800000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo6=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo8"); //cmmb
|
||||
regulator_set_voltage(ldo,1200000,1200000);
|
||||
regulator_set_suspend_voltage(ldo,1200000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo8=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
|
||||
ldo = regulator_get(NULL, "ldo9"); //cmmb
|
||||
regulator_set_voltage(ldo,3000000,3000000);
|
||||
regulator_set_suspend_voltage(ldo,3000000);
|
||||
regulator_enable(ldo);
|
||||
printk("%s set ldo9=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
|
||||
regulator_put(ldo);
|
||||
|
||||
8
arch/arm/mach-rk29/pm.c
Normal file → Executable file
8
arch/arm/mach-rk29/pm.c
Normal file → Executable file
@@ -225,6 +225,8 @@ void __sramfunc ddr_testmode(void)
|
||||
{}
|
||||
|
||||
#endif
|
||||
void __sramfunc pm_spi_gpio_suspend(void);
|
||||
void __sramfunc pm_spi_gpio_resume(void);
|
||||
static void __sramfunc rk29_sram_suspend(void)
|
||||
{
|
||||
u32 clksel0;
|
||||
@@ -238,6 +240,9 @@ static void __sramfunc rk29_sram_suspend(void)
|
||||
|
||||
printch('6');
|
||||
vol=rk29_suspend_voltage_set(1000000);
|
||||
pm_spi_gpio_suspend();
|
||||
|
||||
|
||||
printch('7');
|
||||
clksel0 = cru_readl(CRU_CLKSEL0_CON);
|
||||
/* set arm clk 24MHz/32 = 750KHz */
|
||||
@@ -251,7 +256,8 @@ static void __sramfunc rk29_sram_suspend(void)
|
||||
/* resume arm clk */
|
||||
cru_writel(clksel0, CRU_CLKSEL0_CON);
|
||||
printch('7');
|
||||
|
||||
|
||||
pm_spi_gpio_resume();
|
||||
rk29_suspend_voltage_resume(vol);
|
||||
|
||||
|
||||
|
||||
2
arch/arm/mach-rk29/spi_sram.c
Normal file → Executable file
2
arch/arm/mach-rk29/spi_sram.c
Normal file → Executable file
@@ -272,7 +272,7 @@ static unsigned short __sramfunc sram_spi_read(unsigned short add,unsigned short
|
||||
|
||||
unsigned int __sramfunc rk29_suspend_voltage_set(unsigned int vol)
|
||||
{
|
||||
#if 1 //test
|
||||
#if 0 //test
|
||||
unsigned short addr_4003=0x4003,addr_405d=0x405d,
|
||||
addr_4059=0x4059,addr_405e=0x405e,addr_4063=0x4063;
|
||||
unsigned short data_4003,data_405d,
|
||||
|
||||
16
drivers/regulator/core.c
Normal file → Executable file
16
drivers/regulator/core.c
Normal file → Executable file
@@ -1543,7 +1543,23 @@ out:
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regulator_set_voltage);
|
||||
int regulator_set_suspend_voltage(struct regulator *regulator, int uV)
|
||||
{
|
||||
struct regulator_dev *rdev = regulator->rdev;
|
||||
int ret = 0;
|
||||
|
||||
if (rdev->desc->ops->set_suspend_voltage && uV > 0) {
|
||||
ret = rdev->desc->ops->set_suspend_voltage(rdev, uV);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "%s: failed to set voltage\n",
|
||||
__func__);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regulator_set_suspend_voltage);
|
||||
static int _regulator_get_voltage(struct regulator_dev *rdev)
|
||||
{
|
||||
/* sanity check */
|
||||
|
||||
9
include/linux/regulator/consumer.h
Normal file → Executable file
9
include/linux/regulator/consumer.h
Normal file → Executable file
@@ -149,6 +149,9 @@ int regulator_list_voltage(struct regulator *regulator, unsigned selector);
|
||||
int regulator_is_supported_voltage(struct regulator *regulator,
|
||||
int min_uV, int max_uV);
|
||||
int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
|
||||
|
||||
int regulator_set_suspend_voltage(struct regulator *regulator, int uV);
|
||||
|
||||
int regulator_get_voltage(struct regulator *regulator);
|
||||
int regulator_set_current_limit(struct regulator *regulator,
|
||||
int min_uA, int max_uA);
|
||||
@@ -230,6 +233,12 @@ static inline int regulator_set_voltage(struct regulator *regulator,
|
||||
int min_uV, int max_uV)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int regulator_set_suspend_voltage(struct regulator *regulator, int uV)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static inline int regulator_get_voltage(struct regulator *regulator)
|
||||
|
||||
Reference in New Issue
Block a user