rk30:sdk:Solve the RTC alarm automatic startup
author张晴 <zhangqing@rock-chips.com>
Mon, 28 May 2012 12:22:36 +0000 (20:22 +0800)
committer张晴 <zhangqing@rock-chips.com>
Mon, 28 May 2012 12:22:36 +0000 (20:22 +0800)
arch/arm/mach-rk30/board-rk30-sdk-wm8326.c
drivers/mfd/wm831x-core.c
include/linux/mfd/wm831x/pmu.h

index f84d22640f327cb595769757d9573b0950e28798..dcc7a2929d690f4043e5fafe1e524041762af794 100755 (executable)
@@ -2,6 +2,7 @@
 #include <linux/mfd/wm831x/pdata.h>
 #include <linux/mfd/wm831x/core.h>
 #include <linux/mfd/wm831x/gpio.h>
+#include <linux/mfd/wm831x/pmu.h>
 
 #include <mach/sram.h>
 
@@ -102,6 +103,7 @@ static int wm831x_pre_init(struct wm831x *parm)
        ret = wm831x_reg_read(parm, WM831X_POWER_STATE) & 0xffff;
        wm831x_reg_write(parm, WM831X_POWER_STATE, (ret & 0xfff8) | 0x04);
 
+       wm831x_set_bits(parm, WM831X_RTC_CONTROL, WM831X_RTC_ALAM_ENA_MASK, 0x0400);//enable rtc alam
        //BATT_FET_ENA = 1
        wm831x_reg_write(parm, WM831X_SECURITY_KEY, 0x9716);    // unlock security key
        wm831x_set_bits(parm, WM831X_RESET_CONTROL, 0x1003, 0x1001);
index 4fc2b755a6e2e9f4956e55b0e59e51d6e4a6156a..fdc7e9bb1852ee3b35da83dac9c2929a1d43a0a6 100755 (executable)
@@ -1832,19 +1832,20 @@ int wm831x_device_shutdown(struct wm831x *wm831x)
        
        printk("pre WM831X_POWER_STATE = 0x%x\n", wm831x_reg_read(wm831x, WM831X_POWER_STATE));
 
+       if(wm831x_set_bits(wm831x, WM831X_RTC_CONTROL, WM831X_RTC_ALAM_ENA_MASK, 0) < 0)
+                       printk("%s wm831x_set_bits err\n", __FUNCTION__);   //disable rtc alam
+
        if (pdata && pdata->last_deinit) {
                ret = pdata->last_deinit(wm831x);
                if (ret != 0) {
                        dev_info(wm831x->dev, "last_deinit() failed: %d\n", ret);
                }
        }
-
        //if(0 == reboot_cmd_get())
-       {
+       
                if(wm831x_set_bits(wm831x, WM831X_POWER_STATE, WM831X_CHIP_ON_MASK, 0) < 0)
                        printk("%s wm831x_set_bits err\n", __FUNCTION__);
                //printk("post WM831X_POWER_STATE = 0x%x\n", wm831x_reg_read(wm831x, WM831X_POWER_STATE));
-       }
 
        return 0;       
 }
index b18cbb027bc3869763fee983dd8a9ea111e8fce0..163a31d66662794fb95bf0135e558511e024b24b 100644 (file)
@@ -14,7 +14,8 @@
 
 #ifndef __MFD_WM831X_PMU_H__
 #define __MFD_WM831X_PMU_H__
-
+/*    rtc cntrol (0x4025) */
+#define WM831X_RTC_ALAM_ENA_MASK 0x0400
 /*
  * R16387 (0x4003) - Power State
  */