add wm831x restart support
authorroot <root@lw.(none)>
Tue, 17 May 2011 13:54:52 +0000 (21:54 +0800)
committerroot <root@lw.(none)>
Tue, 17 May 2011 13:54:52 +0000 (21:54 +0800)
arch/arm/mach-rk29/board-rk29-a22.c
arch/arm/mach-rk29/board-rk29-phonesdk.c [changed mode: 0755->0644]
drivers/mfd/wm831x-core.c
include/linux/mfd/wm831x/core.h

index 545093e37b07840967b890abc9f1659126f26cac..3f1966fe00cc484804a6fd25761f513d27472a74 100755 (executable)
@@ -3093,15 +3093,24 @@ static void __init machine_rk29_init_irq(void)
 }
 
 #define POWER_ON_PIN RK29_PIN4_PA4
-extern void wm831x_power_off(void);
 static void rk29_pm_power_off(void)
 {
        printk(KERN_ERR "rk29_pm_power_off start...\n");
+       gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
 #if defined(CONFIG_MFD_WM831X)
        wm831x_device_shutdown(gWm831x);
 #endif
        while (1);
 }
+static void rk29_pm_power_restart(void)
+{
+       printk("%s\n",__FUNCTION__);
+       mdelay(2);
+#if defined(CONFIG_MFD_WM831X)
+       wm831x_device_restart(gWm831x);
+#endif
+
+}
 
 static void __init machine_rk29_board_init(void)
 {
@@ -3111,6 +3120,7 @@ static void __init machine_rk29_board_init(void)
        gpio_set_value(POWER_ON_PIN, GPIO_HIGH);
        gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
        pm_power_off = rk29_pm_power_off;
+       arm_pm_restart = rk29_pm_power_restart;
 
        platform_add_devices(devices, ARRAY_SIZE(devices));
 #ifdef CONFIG_I2C0_RK29
old mode 100755 (executable)
new mode 100644 (file)
index 4addc63..b0c21d0
@@ -3099,6 +3099,15 @@ static void rk29_pm_power_off(void)
 #endif
        while (1);
 }
+static void rk29_pm_power_restart(void)
+{
+       printk("%s\n",__FUNCTION__);
+       mdelay(2);
+#if defined(CONFIG_MFD_WM831X)
+       wm831x_device_restart(gWm831x);
+#endif
+
+}
 
 static void __init machine_rk29_board_init(void)
 {
@@ -3108,6 +3117,7 @@ static void __init machine_rk29_board_init(void)
        gpio_set_value(POWER_ON_PIN, GPIO_HIGH);
        gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
        pm_power_off = rk29_pm_power_off;
+       arm_pm_restart = rk29_pm_power_restart;
 
        platform_add_devices(devices, ARRAY_SIZE(devices));
 #ifdef CONFIG_I2C0_RK29
index 0ce83bee2c8498eab80d2a974393b40d2aaa36cc..761f86ea4a88d07270b5fdad8db294b169ed9531 100755 (executable)
@@ -1809,6 +1809,15 @@ int wm831x_device_shutdown(struct wm831x *wm831x)
 
 EXPORT_SYMBOL_GPL(wm831x_device_shutdown);
 
+
+int wm831x_device_restart(struct wm831x *wm831x)
+{
+       wm831x_reg_write(wm831x,WM831X_RESET_ID, 0xffff); 
+
+       return 0;
+}
+
+
 MODULE_DESCRIPTION("Core support for the WM831X AudioPlus PMIC");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Mark Brown");
index 7a9e8805356d69f731c62e1a81334d68b5ad96cc..fb21267f026726a8a03849684ed10dcbc835b883 100755 (executable)
@@ -344,6 +344,7 @@ void wm831x_device_exit(struct wm831x *wm831x);
 int wm831x_device_suspend(struct wm831x *wm831x);
 int wm831x_device_resume(struct wm831x *wm831x);
 int wm831x_device_shutdown(struct wm831x *wm831x);
+int wm831x_device_restart(struct wm831x *wm831x);
 int wm831x_irq_init(struct wm831x *wm831x, int irq);
 void wm831x_irq_exit(struct wm831x *wm831x);