rk30:sdk:Solve shutdown to restart,add 8326 sleep support
author张晴 <zhangqing@rock-chips.com>
Thu, 5 Apr 2012 09:53:15 +0000 (17:53 +0800)
committer张晴 <zhangqing@rock-chips.com>
Thu, 5 Apr 2012 09:53:15 +0000 (17:53 +0800)
arch/arm/mach-rk30/board-rk30-sdk-wm8326.c
arch/arm/mach-rk30/board-rk30-wm831x.c

index 0f5c8409304a66ce2fcab7f0f46cf6ba82f0c77e..4d808513a6c17ee79bd9984f114c7753291930d4 100755 (executable)
@@ -3,12 +3,33 @@
 #include <linux/mfd/wm831x/core.h>
 #include <linux/mfd/wm831x/gpio.h>
 
+#include <mach/sram.h>
+
+#define cru_readl(offset)      readl_relaxed(RK30_CRU_BASE + offset)
+#define cru_writel(v, offset)  do { writel_relaxed(v, RK30_CRU_BASE + offset); dsb(); } while (0)
+
+#define grf_readl(offset)      readl_relaxed(RK30_GRF_BASE + offset)
+#define grf_writel(v, offset)  do { writel_relaxed(v, RK30_GRF_BASE + offset); dsb(); } while (0)
+
+#define CRU_CLKGATE5_CON_ADDR 0x00e4
+#define GRF_GPIO6L_DIR_ADDR 0x0030
+#define GRF_GPIO6L_DO_ADDR 0x0068
+#define GRF_GPIO6L_EN_ADDR 0x00a0
+#define CRU_CLKGATE5_GRFCLK_ON 0x00100000
+#define CRU_CLKGATE5_GRFCLK_OFF 0x00100010
+#define GPIO6_PB1_DIR_OUT  0x02000200
+#define GPIO6_PB1_DO_LOW  0x02000000
+#define GPIO6_PB1_DO_HIGH  0x02000200
+#define GPIO6_PB1_EN_MASK  0x02000200
+#define GPIO6_PB1_UNEN_MASK  0x02000000
+
 /* wm8326 pmu*/
 #if defined(CONFIG_GPIO_WM831X)
 static struct rk29_gpio_expander_info wm831x_gpio_settinginfo[] = {
        {
                .gpio_num = WM831X_P01, // tp3
-               .pin_type = GPIO_IN,
+               .pin_type = GPIO_OUT,
+               .pin_value = GPIO_LOW,
        },
        {
                .gpio_num = WM831X_P02, //tp4
@@ -98,6 +119,8 @@ static int wm831x_pre_init(struct wm831x *parm)
        wm831x_set_bits(parm,WM831X_STATUS_LED_1 ,0xc300,0xc100);// set led1 on(in manual mode)
        wm831x_set_bits(parm,WM831X_STATUS_LED_2 ,0xc300,0xc000);//set led2 off(in manual mode)
 
+       wm831x_set_bits(parm,WM831X_LDO5_SLEEP_CONTROL ,0xe000,0x2000);// set ldo5 is disable in sleep mode 
+       
        wm831x_reg_write(parm, WM831X_SECURITY_KEY, LOCK_SECURITY_KEY); // lock security key
 
        return 0;
@@ -119,7 +142,7 @@ int wm831x_post_init(struct wm831x *Wm831x)
        
        ldo = regulator_get(NULL, "ldo4");      // vdd_11
        regulator_set_voltage(ldo, 1100000, 1100000);
-       regulator_set_suspend_voltage(ldo, 1100000);
+       regulator_set_suspend_voltage(ldo, 1000000);
        regulator_enable(ldo);
 //     printk("%s set ldo4 vdd_11=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo);
@@ -142,15 +165,20 @@ int wm831x_post_init(struct wm831x *Wm831x)
 
        dcdc = regulator_get(NULL, "vdd_cpu");  // vdd_arm
        regulator_set_voltage(dcdc, 1100000, 1100000);
-       regulator_set_suspend_voltage(dcdc, 1100000);
+       regulator_set_suspend_voltage(dcdc, 1000000);
        regulator_enable(dcdc);
        printk("%s set dcdc2 vdd_cpu(vdd_arm)=%dmV end\n", __func__, regulator_get_voltage(dcdc));
        regulator_put(dcdc);
        udelay(100);
 
        dcdc = regulator_get(NULL, "vdd_core"); // vdd_log
+<<<<<<< Updated upstream
        regulator_set_voltage(dcdc, 1150000, 1150000);
        regulator_set_suspend_voltage(dcdc, 1100000);
+=======
+       regulator_set_voltage(dcdc, 1100000, 1100000);
+       regulator_set_suspend_voltage(dcdc, 1000000);
+>>>>>>> Stashed changes
        regulator_enable(dcdc);
        printk("%s set dcdc1 vdd_core(vdd_log)=%dmV end\n", __func__, regulator_get_voltage(dcdc));
        regulator_put(dcdc);
@@ -246,11 +274,11 @@ static int wm831x_last_deinit(struct wm831x *Wm831x)
        regulator_put(ldo);
 
        ldo = regulator_get(NULL, "ldo5");
-       regulator_disable(ldo);
+//     regulator_disable(ldo);
        regulator_put(ldo);
 
        ldo = regulator_get(NULL, "ldo6");
-       regulator_disable(ldo);
+//     regulator_disable(ldo);
        regulator_put(ldo);
 
        ldo = regulator_get(NULL, "ldo7");
@@ -258,7 +286,7 @@ static int wm831x_last_deinit(struct wm831x *Wm831x)
        regulator_put(ldo);
 
        ldo = regulator_get(NULL, "ldo8");
-       //regulator_disable(ldo);
+       regulator_disable(ldo);
        regulator_put(ldo);
 
        ldo = regulator_get(NULL, "ldo9");
@@ -613,22 +641,16 @@ static int wm831x_init_pin_type(struct wm831x *wm831x)
                                        WM831X_GPIO1_CONTROL + i,
                                        WM831X_GPN_DIR_MASK | WM831X_GPN_TRI_MASK,
                                        1 << WM831X_GPN_DIR_SHIFT | 1 << WM831X_GPN_TRI_SHIFT);
-
-                       wm831x_set_bits(wm831x,
-                                       (WM831X_GPIO1_CONTROL + i),
-                                       WM831X_GPN_PULL_MASK, 1 << WM831X_GPN_PULL_SHIFT);      //pull down
-                       if (i == 0 ) {
+               if (i == 1) {
                                wm831x_set_bits(wm831x,
                                                WM831X_GPIO1_CONTROL + i,
-                                               WM831X_GPN_PWR_DOM_MASK,
-                                               WM831X_GPN_PWR_DOM);
-                       }       // set gpiox power domain
-                       else {
+                                               WM831X_GPN_POL_MASK,
+                                               0x0000);
                                wm831x_set_bits(wm831x,
                                                WM831X_GPIO1_CONTROL + i,
-                                               WM831X_GPN_PWR_DOM_MASK,
-                                               ~WM831X_GPN_PWR_DOM);
-                       }
+                                               WM831X_GPN_FN_MASK,
+                                               0x0004);                                
+                       }       // set gpio2 sleep/wakeup
                                        
                } else {
                        wm831x_set_bits(wm831x,
@@ -672,6 +694,20 @@ out:
        return 0;
 }
 
+void __sramfunc board_pmu_suspend(void)
+{      
+       cru_writel(CRU_CLKGATE5_GRFCLK_ON,CRU_CLKGATE5_CON_ADDR); //open grf clk
+       grf_writel(GPIO6_PB1_DIR_OUT, GRF_GPIO6L_DIR_ADDR);
+       grf_writel(GPIO6_PB1_DO_LOW, GRF_GPIO6L_DO_ADDR);  //set gpio6_b1 output low
+       grf_writel(GPIO6_PB1_EN_MASK, GRF_GPIO6L_EN_ADDR);
+}
+void __sramfunc board_pmu_resume(void)
+{
+       grf_writel(GPIO6_PB1_DIR_OUT, GRF_GPIO6L_DIR_ADDR);
+       grf_writel(GPIO6_PB1_DO_HIGH, GRF_GPIO6L_DO_ADDR);     //set gpio6_b1 output high
+       grf_writel(GPIO6_PB1_EN_MASK, GRF_GPIO6L_EN_ADDR);
+
+}
 static struct wm831x_pdata wm831x_platdata = {
 
        /** Called before subdevices are set up */
index d33fa4ea9a552a9d9cf8af56f9da4c0a029ecd55..47edb073457bc871f361e758ce87156a7547173a 100755 (executable)
@@ -91,9 +91,9 @@ static int wm831x_pre_init(struct wm831x *parm)
        wm831x_set_bits(parm,WM831X_DC1_ON_CONFIG ,0x0300,0x0000); //set dcdc mode is FCCM
        wm831x_set_bits(parm,WM831X_DC2_ON_CONFIG ,0x0300,0x0000);
        wm831x_set_bits(parm,WM831X_DC3_ON_CONFIG ,0x0300,0x0000);
-       wm831x_set_bits(parm,0x4066,0x0300,0x0000);
+//     wm831x_set_bits(parm,0x4066,0x0300,0x0000);
 
-       wm831x_set_bits(parm,WM831X_LDO10_CONTROL ,0x0040,0x0040);// set ldo10 in switch mode
+//     wm831x_set_bits(parm,WM831X_LDO10_CONTROL ,0x0040,0x0040);// set ldo10 in switch mode
 
        wm831x_set_bits(parm,WM831X_STATUS_LED_1 ,0xc300,0xc100);// set led1 on(in manual mode)
        wm831x_set_bits(parm,WM831X_STATUS_LED_2 ,0xc300,0xc000);//set led2 off(in manual mode)
@@ -109,22 +109,37 @@ int wm831x_post_init(struct wm831x *Wm831x)
        struct regulator *ldo;
 
 
-       ldo = regulator_get(NULL, "ldo6");      //vcc_33
+       ldo = regulator_get(NULL, "ldo8");      //vcca33
        regulator_set_voltage(ldo, 3300000, 3300000);
        regulator_set_suspend_voltage(ldo, 3300000);
        regulator_enable(ldo);
-//     printk("%s set ldo6 vcc_33=%dmV end\n", __func__, regulator_get_voltage(ldo));
+//     printk("%s set ldo8 vcca33=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo);
        udelay(100);
        
-       ldo = regulator_get(NULL, "ldo4");      // vdd_11
+       ldo = regulator_get(NULL, "ldo3");      // vdd_11
        regulator_set_voltage(ldo, 1100000, 1100000);
        regulator_set_suspend_voltage(ldo, 1100000);
        regulator_enable(ldo);
-//     printk("%s set ldo4 vdd_11=%dmV end\n", __func__, regulator_get_voltage(ldo));
+//     printk("%s set ldo3 vdd_11=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo);
        udelay(100);
 
+       dcdc = regulator_get(NULL, "dcdc3");    // vcc_io
+       regulator_set_voltage(dcdc, 3000000, 3000000);
+       regulator_set_suspend_voltage(dcdc, 3000000);
+       regulator_enable(dcdc);
+//     printk("%s set dcdc3 vcc_io=%dmV end\n", __func__, regulator_get_voltage(dcdc));
+       regulator_put(dcdc);
+       udelay(100);
+
+       ldo = regulator_get(NULL, "ldo4");      //vdd_usb11
+       regulator_set_voltage(ldo, 1100000, 1100000);
+       regulator_set_suspend_voltage(ldo, 1100000);
+       regulator_enable(ldo);
+//     printk("%s set ldo4 vdd_usb11=%dmV end\n", __func__, regulator_get_voltage(ldo));
+       regulator_put(ldo);
+
        ldo = regulator_get(NULL, "ldo5");      //vcc_25
        regulator_set_voltage(ldo, 2500000, 2500000);
        regulator_set_suspend_voltage(ldo, 2500000);
@@ -132,94 +147,71 @@ int wm831x_post_init(struct wm831x *Wm831x)
 //     printk("%s set ldo5 vcc_25=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo);
 
-       dcdc = regulator_get(NULL, "dcdc4");    // vcc_io
-       regulator_set_voltage(dcdc, 3000000, 3000000);
-       regulator_set_suspend_voltage(dcdc, 3000000);
-       regulator_enable(dcdc);
-//     printk("%s set dcdc4 vcc_io=%dmV end\n", __func__, regulator_get_voltage(dcdc));
-       regulator_put(dcdc);
-       udelay(100);
 
-       dcdc = regulator_get(NULL, "vdd_cpu");  // vdd_arm
-       regulator_set_voltage(dcdc, 1100000, 1100000);
-       regulator_set_suspend_voltage(dcdc, 1100000);
-       regulator_enable(dcdc);
-       printk("%s set dcdc2 vdd_cpu(vdd_arm)=%dmV end\n", __func__, regulator_get_voltage(dcdc));
-       regulator_put(dcdc);
-       udelay(100);
+       ldo = regulator_get(NULL, "ldo10");     //vcc_usb33
+       regulator_set_voltage(ldo, 3300000, 3300000);
+       regulator_set_suspend_voltage(ldo, 3300000);
+       regulator_enable(ldo);
+//     printk("%s set ldo10 vcc_usb33=%dmV end\n", __func__, regulator_get_voltage(ldo));
+       regulator_put(ldo);
 
-       dcdc = regulator_get(NULL, "vdd_core"); // vdd_log
-       regulator_set_voltage(dcdc, 1100000, 1100000);
-       regulator_set_suspend_voltage(dcdc, 1100000);
+       dcdc = regulator_get(NULL, "dcdc1");    // vcc_lpddr2_1v8
+       regulator_set_voltage(dcdc, 1800000, 1800000);
+       regulator_set_suspend_voltage(dcdc, 1800000);
        regulator_enable(dcdc);
-       printk("%s set dcdc1 vdd_core(vdd_log)=%dmV end\n", __func__, regulator_get_voltage(dcdc));
+       printk("%s set dcdc1 vcc_lpddr2_1v8=%dmV end\n", __func__, regulator_get_voltage(dcdc));
        regulator_put(dcdc);
        udelay(100);
 
-       dcdc = regulator_get(NULL, "dcdc3");    // vcc_ddr
-       regulator_set_voltage(dcdc, 1150000, 1150000);
-       regulator_set_suspend_voltage(dcdc, 1150000);
+       dcdc = regulator_get(NULL, "dcdc2");    // vcc_lpddr2_1v2
+       regulator_set_voltage(dcdc, 1200000, 1200000);
+       regulator_set_suspend_voltage(dcdc, 1200000);
        regulator_enable(dcdc);
-//     printk("%s set dcdc3 vcc_ddr=%dmV end\n", __func__, regulator_get_voltage(dcdc));
+       printk("%s set dcdc2 vcc_lpddr2_1v2=%dmV end\n", __func__, regulator_get_voltage(dcdc));
        regulator_put(dcdc);
        udelay(100);
-
-       ldo = regulator_get(NULL, "ldo7");      // vcc28_cif
-       regulator_set_voltage(ldo, 2800000, 2800000);
-       regulator_set_suspend_voltage(ldo, 2800000);
-       regulator_enable(ldo);
-//     printk("%s set ldo7 vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo));
-       regulator_put(ldo);
-       udelay(100);
-
-       ldo = regulator_get(NULL, "ldo1");      // vcc18_cif
-       regulator_set_voltage(ldo, 1800000, 1800000);
-       regulator_set_suspend_voltage(ldo, 1800000);
-       regulator_enable(ldo);
-//     printk("%s set ldo1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo));
-       regulator_put(ldo);
-       udelay(100);
-
-       ldo = regulator_get(NULL, "ldo8");      // vcca_33
-       regulator_set_voltage(ldo, 3300000, 3300000);
-       regulator_set_suspend_voltage(ldo, 3300000);
+       
+       ldo = regulator_get(NULL, "ldo2");      // vcc_emmc3v3
+       regulator_set_voltage(ldo, 3000000, 3000000);
+       regulator_set_suspend_voltage(ldo, 3000000);
        regulator_enable(ldo);
-//     printk("%s set ldo8 vcca_33=%dmV end\n", __func__, regulator_get_voltage(ldo));
+//     printk("%s set ldo2 vcc_emmc3v3=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo);
        udelay(100);
 
-       ldo = regulator_get(NULL, "ldo2");      //vccio_wl
+       ldo = regulator_get(NULL, "ldo6");      // vcc_codec18
        regulator_set_voltage(ldo, 1800000, 1800000);
        regulator_set_suspend_voltage(ldo, 1800000);
        regulator_enable(ldo);
-//     printk("%s set ldo2 vccio_wl=%dmV end\n", __func__, regulator_get_voltage(ldo));
+//     printk("%s set ldo6 vcc_codec18=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo);
        udelay(100);
 
-       ldo = regulator_get(NULL, "ldo10");     //vcca_wl
-       regulator_set_voltage(ldo, 3300000, 3300000);
-       regulator_set_suspend_voltage(ldo, 3300000);
+       ldo = regulator_get(NULL, "ldo1");      // vcc_lcd
+       regulator_set_voltage(ldo, 3000000, 3000000);
+       regulator_set_suspend_voltage(ldo, 3000000);
        regulator_enable(ldo);
-//     printk("%s set ldo10 vcca_wl=%dmV end\n", __func__, regulator_get_voltage(ldo));
+//     printk("%s set ldo1 vcc_lcd=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo);
        udelay(100);
+#if 0 
 
-       ldo = regulator_get(NULL, "ldo3");      //vdd_12
+       ldo = regulator_get(NULL, "ldo7");      //vdd_mtv_1v2
        regulator_set_voltage(ldo, 1200000, 1200000);
        regulator_set_suspend_voltage(ldo, 1200000);
        regulator_enable(ldo);
-//     printk("%s set ldo3 vdd_12=%dmV end\n", __func__, regulator_get_voltage(ldo));
+//     printk("%s set ldo7 vdd_mtv_1v2=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo);
        udelay(100);
-
-       ldo = regulator_get(NULL, "ldo9");      //vcc_tp
-       regulator_set_voltage(ldo, 3300000, 3300000);
-       regulator_set_suspend_voltage(ldo, 3300000);
+       
+       ldo = regulator_get(NULL, "ldo9");      //vdd_mtv_3v
+       regulator_set_voltage(ldo, 3000000, 3000000);
+       regulator_set_suspend_voltage(ldo, 3000000);
        regulator_enable(ldo);
-//     printk("%s set ldo9 vcc_tp=%dmV end\n", __func__, regulator_get_voltage(ldo));
+//     printk("%s set ldo9 vdd_mtv_3v=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo);
        udelay(100);
-
+#endif
        printk("wm831x_post_init end");
        return 0;
 }
@@ -238,15 +230,15 @@ static int wm831x_last_deinit(struct wm831x *Wm831x)
        regulator_put(ldo);
 
        ldo = regulator_get(NULL, "ldo3");
-       regulator_disable(ldo);
+       //regulator_disable(ldo);
        regulator_put(ldo);
 
        ldo = regulator_get(NULL, "ldo4");
-       //regulator_disable(ldo);
+       regulator_disable(ldo);
        regulator_put(ldo);
 
        ldo = regulator_get(NULL, "ldo5");
-       regulator_disable(ldo);
+       //regulator_disable(ldo);
        regulator_put(ldo);
 
        ldo = regulator_get(NULL, "ldo6");
@@ -272,6 +264,31 @@ static int wm831x_last_deinit(struct wm831x *Wm831x)
        return 0;
 }
 
+struct wm831x_backlight_pdata wm831x_backlight_platdata = {
+       .isink = 1,     /** ISINK to use, 1 or 2 */
+       .max_uA = 19484,    /** Maximum current to allow */
+};
+
+struct wm831x_backup_pdata wm831x_backup_platdata = {
+       .charger_enable = 1,
+       .no_constant_voltage = 0,  /** Disable constant voltage charging */
+       .vlim = 3100,   /** Voltage limit in milivolts */
+       .ilim = 300,   /** Current limit in microamps */
+};
+
+struct wm831x_battery_pdata wm831x_battery_platdata = {
+       .enable = 1,         /** Enable charging */
+       .fast_enable = 1,    /** Enable fast charging */
+       .off_mask = 1,       /** Mask OFF while charging */
+       .trickle_ilim = 200,   /** Trickle charge current limit, in mA */
+       .vsel = 4200,           /** Target voltage, in mV */
+       .eoc_iterm = 50,      /** End of trickle charge current, in mA */
+       .fast_ilim = 500,      /** Fast charge current limit, in mA */
+       .timeout = 480,        /** Charge cycle timeout, in minutes */
+       .syslo = 3300,    /* syslo threshold, in mV*/
+       .sysok = 3500,    /* sysko threshold, in mV*/
+};
+
 struct wm831x_status_pdata wm831x_status_platdata[WM831X_MAX_STATUS] = {
        {
                .default_src = WM831X_STATUS_OTP,
@@ -287,13 +304,13 @@ struct wm831x_status_pdata wm831x_status_platdata[WM831X_MAX_STATUS] = {
 
 static struct regulator_consumer_supply dcdc1_consumers[] = {
        {
-               .supply = "vdd_core",
+               .supply = "dcdc1",
        }
 };
 
 static struct regulator_consumer_supply dcdc2_consumers[] = {
        {
-               .supply = "vdd_cpu",
+               .supply = "dcdc2",
        }
        
 };
@@ -310,7 +327,7 @@ static struct regulator_consumer_supply dcdc4_consumers[] = {
        }
 };
 
-#if 0
+
 static struct regulator_consumer_supply epe1_consumers[] = {
        {
                .supply = "epe1",
@@ -322,7 +339,7 @@ static struct regulator_consumer_supply epe2_consumers[] = {
                .supply = "epe2",
        }
 };
-#endif
+
 
 static struct regulator_consumer_supply ldo1_consumers[] = {
        {
@@ -390,6 +407,16 @@ static struct regulator_consumer_supply ldo11_consumers[] = {
        }
 };
 
+static struct regulator_consumer_supply isink1_consumers[] = {
+       {
+               .supply = "isink1",
+       }
+};
+static struct regulator_consumer_supply isink2_consumers[] = {
+       {
+               .supply = "isink2",
+       }
+};
 struct regulator_init_data wm831x_regulator_init_dcdc[WM831X_MAX_DCDC] = {
        {
                .constraints = {
@@ -427,17 +454,16 @@ struct regulator_init_data wm831x_regulator_init_dcdc[WM831X_MAX_DCDC] = {
        {
                .constraints = {
                        .name = "DCDC4",
-                       .min_uV = 850000,
-                       .max_uV = 3400000,      //0.85-3.4V
-                       .apply_uV = true,
-                       .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
+                       .min_uV = 00000000,
+                       .max_uV = 30000000,//30V/40mA
+                       .apply_uV = true,               
+                       .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,           
                },
                .num_consumer_supplies = ARRAY_SIZE(dcdc4_consumers),
                .consumer_supplies = dcdc4_consumers,
        },
 };
 
-#if 0
 struct regulator_init_data wm831x_regulator_init_epe[WM831X_MAX_EPE] = {
        {
                .constraints = {
@@ -462,7 +488,7 @@ struct regulator_init_data wm831x_regulator_init_epe[WM831X_MAX_EPE] = {
                .consumer_supplies = epe2_consumers,
        },
 };
-#endif
+
 
 struct regulator_init_data wm831x_regulator_init_ldo[WM831X_MAX_LDO] = {
        {
@@ -587,7 +613,38 @@ struct regulator_init_data wm831x_regulator_init_ldo[WM831X_MAX_LDO] = {
                .consumer_supplies = ldo11_consumers,
        },
 };
-
+struct regulator_init_data wm831x_regulator_init_isink[WM831X_MAX_ISINK] = {
+       {
+               .constraints = {
+                       .name = "ISINK1",
+                       .min_uA = 00000,
+                       .max_uA = 40000,
+                       .always_on = true,
+                       .apply_uV = true,               
+                       .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT,           
+               },
+               .num_consumer_supplies = ARRAY_SIZE(isink1_consumers),
+               .consumer_supplies = isink1_consumers,
+       },
+       {
+               .constraints = {
+                       .name = "ISINK2",
+                       .min_uA = 0000000,
+                       .max_uA = 0000000,
+                       .apply_uV = false,              
+                       .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT,           
+               },
+               .num_consumer_supplies = ARRAY_SIZE(isink2_consumers),
+               .consumer_supplies = isink2_consumers,
+       },
+};
+static int wm831x_checkrange(int start,int num,int val)
+{   
+       if((val<(start+num))&&(val>=start))
+               return 0;
+       else 
+               return -1;
+}
 static int wm831x_init_pin_type(struct wm831x *wm831x)
 {
        struct wm831x_pdata *pdata;
@@ -615,7 +672,7 @@ static int wm831x_init_pin_type(struct wm831x *wm831x)
                                        1 << WM831X_GPN_DIR_SHIFT | 1 << WM831X_GPN_TRI_SHIFT);
 
                        wm831x_set_bits(wm831x,
-                                       (WM831X_GPIO1_CONTROL + i),
+                                       WM831X_GPIO1_CONTROL + i,
                                        WM831X_GPN_PULL_MASK, 1 << WM831X_GPN_PULL_SHIFT);      //pull down
                        if (i == 0 ) {
                                wm831x_set_bits(wm831x,
@@ -629,6 +686,16 @@ static int wm831x_init_pin_type(struct wm831x *wm831x)
                                                WM831X_GPN_PWR_DOM_MASK,
                                                ~WM831X_GPN_PWR_DOM);
                        }
+                       if (i == 1) {
+                               wm831x_set_bits(wm831x,
+                                               WM831X_GPIO1_CONTROL + i,
+                                               WM831X_GPN_POL_MASK,
+                                               0x0000);
+                               wm831x_set_bits(wm831x,
+                                               WM831X_GPIO1_CONTROL + i,
+                                               WM831X_GPN_FN_MASK,
+                                               0x0004);                                
+                       }       // set gpio2 sleep/wakeup
                                        
                } else {
                        wm831x_set_bits(wm831x,
@@ -671,6 +738,73 @@ static int wm831x_init_pin_type(struct wm831x *wm831x)
 out:
        return 0;
 }
+#if defined(CONFIG_KEYBOARD_WM831X_GPIO)
+static struct wm831x_gpio_keys_button wm831x_gpio_buttons[] = {
+{      
+       .code           = KEY_MEDIA,
+       .gpio           = TCA6424_P21,
+       .active_low     = 1,
+       .desc           = "media",
+       .wakeup         = 0,
+       .debounce_interval = 120,
+},
+{
+    .code= KEY_VOLUMEUP,
+               .gpio= WM831X_P05,
+               .active_low= 1,
+               .desc= "volume_up",
+               .wakeup= 0,
+},
+{
+               .code= KEY_CAMERA,
+               .gpio= WM831X_P06,
+               .active_low= 1,
+               .desc= "camera",
+               .wakeup= 0,
+},
+{
+               .code= KEY_VOLUMEDOWN,
+               .gpio= WM831X_P07,
+               .active_low= 1,
+               .desc= "volume_down",
+               .wakeup= 0,
+},
+{
+               .code= KEY_END,
+               .gpio= WM831X_P09,
+               .active_low= 1,
+               .desc= "enter",
+               .wakeup= 0,
+},
+{
+               .code= KEY_MENU,
+               .gpio= WM831X_P10,
+               .active_low= 1,
+               .desc= "menu",
+               .wakeup= 0,
+},
+{
+               .code= KEY_SEND,
+               .gpio= WM831X_P11,
+               .active_low= 1,
+               .desc= "esc",
+               .wakeup= 0,
+},
+{
+               .code= KEY_BACK,
+               .gpio= WM831X_P12,
+               .active_low= 1,
+               .desc= "home",
+               .wakeup= 0,                     
+},
+};
+
+struct wm831x_gpio_keys_pdata wm831x_gpio_keys_platdata = {
+       .buttons        = wm831x_gpio_buttons,
+       .nbuttons       = ARRAY_SIZE(wm831x_gpio_buttons),
+};
+
+#endif
 
 static struct wm831x_pdata wm831x_platdata = {
 
@@ -689,7 +823,17 @@ static struct wm831x_pdata wm831x_platdata = {
        .pin_type_init = wm831x_init_pin_type,
        .irq_base = NR_GIC_IRQS + NR_GPIO_IRQS,
 #endif
+       .backlight = &wm831x_backlight_platdata,
 
+       .backup = &wm831x_backup_platdata,
+       
+       .battery = &wm831x_battery_platdata,
+       //.wm831x_touch_pdata = NULL,
+       //.watchdog = NULL,
+       
+#if defined(CONFIG_KEYBOARD_WM831X_GPIO)       
+       .gpio_keys = &wm831x_gpio_keys_platdata,
+#endif
        /** LED1 = 0 and so on */
        .status = { &wm831x_status_platdata[0], &wm831x_status_platdata[1] },
 
@@ -702,7 +846,7 @@ static struct wm831x_pdata wm831x_platdata = {
        },
 
        /** EPE1 = 0 and so on */
-       //.epe = { &wm831x_regulator_init_epe[0], &wm831x_regulator_init_epe[1] },
+       .epe = { &wm831x_regulator_init_epe[0], &wm831x_regulator_init_epe[1] },
 
        /** LDO1 = 0 and so on */
        .ldo = {
@@ -718,5 +862,7 @@ static struct wm831x_pdata wm831x_platdata = {
                &wm831x_regulator_init_ldo[9],
                &wm831x_regulator_init_ldo[10],
        },
+       /** ISINK1 = 0 and so on*/
+       .isink = {&wm831x_regulator_init_isink[0], &wm831x_regulator_init_isink[1]},
 };
 #endif