A22 and phonesdk: make wm831x enter sleep in suspend, change vdd voltage to 1.0V
authorxsf@rock-chips.com <root@xxx-desktop.(none)>
Tue, 14 Jun 2011 07:22:04 +0000 (15:22 +0800)
committerxsf@rock-chips.com <root@xxx-desktop.(none)>
Tue, 14 Jun 2011 07:22:04 +0000 (15:22 +0800)
arch/arm/mach-rk29/Makefile
arch/arm/mach-rk29/board-rk29-a22.c
arch/arm/mach-rk29/board-rk29-phonesdk.c
arch/arm/mach-rk29/pm.c [changed mode: 0644->0755]
arch/arm/mach-rk29/spi_sram.c [changed mode: 0644->0755]
drivers/regulator/core.c [changed mode: 0644->0755]
include/linux/regulator/consumer.h [changed mode: 0644->0755]

index 39a6a7e66e20c970e4167fcfcca2b8aaa9c2c0e0..1471fb2353d2acb441a09265427b1f8e1541cc74 100644 (file)
@@ -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
index c776c25961db8ad8360b1181b957d6ab5ca85141..eac9ede0c0d83394d49110cb439f33969dc59a45 100755 (executable)
@@ -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);
index 84604ed82fd9f0f41cdcbf16d0c9f43d8f04593f..b8a0d1e7f1d9a3c0b98902c774b04c09d2696141 100755 (executable)
@@ -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);
old mode 100644 (file)
new mode 100755 (executable)
index db55f2f..e59a6f5
@@ -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);
 
 
old mode 100644 (file)
new mode 100755 (executable)
index 7052d36..6496aee
@@ -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,
old mode 100644 (file)
new mode 100755 (executable)
index 1836053..365ef02
@@ -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 */
old mode 100644 (file)
new mode 100755 (executable)
index 490c5b3..73286b2
@@ -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)