From a2cf542e126a8fe6c7d721dea8809625264327e0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BC=A0=E6=99=B4?= Date: Mon, 28 May 2012 20:22:36 +0800 Subject: [PATCH] rk30:sdk:Solve the RTC alarm automatic startup --- arch/arm/mach-rk30/board-rk30-sdk-wm8326.c | 2 ++ drivers/mfd/wm831x-core.c | 7 ++++--- include/linux/mfd/wm831x/pmu.h | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-rk30/board-rk30-sdk-wm8326.c b/arch/arm/mach-rk30/board-rk30-sdk-wm8326.c index f84d22640f32..dcc7a2929d69 100755 --- a/arch/arm/mach-rk30/board-rk30-sdk-wm8326.c +++ b/arch/arm/mach-rk30/board-rk30-sdk-wm8326.c @@ -2,6 +2,7 @@ #include #include #include +#include #include @@ -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); diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c index 4fc2b755a6e2..fdc7e9bb1852 100755 --- a/drivers/mfd/wm831x-core.c +++ b/drivers/mfd/wm831x-core.c @@ -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; } diff --git a/include/linux/mfd/wm831x/pmu.h b/include/linux/mfd/wm831x/pmu.h index b18cbb027bc3..163a31d66662 100644 --- a/include/linux/mfd/wm831x/pmu.h +++ b/include/linux/mfd/wm831x/pmu.h @@ -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 */ -- 2.34.1