#define UNLOCK_SECURITY_KEY ~(0x1<<5)
#define LOCK_SECURITY_KEY 0x00
+#define PMU_POWER_SLEEP RK30_PIN6_PB1
+static struct wm831x *Wm831x;
static int wm831x_pre_init(struct wm831x *parm)
{
int ret;
-
+ Wm831x = parm;
// printk("%s\n", __func__);
- //ILIM = 900ma
+ gpio_request(PMU_POWER_SLEEP, "NULL");
+ gpio_direction_output(PMU_POWER_SLEEP, GPIO_HIGH);
+
ret = wm831x_reg_read(parm, WM831X_POWER_STATE) & 0xffff;
wm831x_reg_write(parm, WM831X_POWER_STATE, (ret & 0xfff8) | 0x04);
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)
+
wm831x_reg_write(parm, WM831X_SECURITY_KEY, LOCK_SECURITY_KEY); // lock security key
return 0;
dcdc = regulator_get(NULL, "vdd_cpu"); // vdd_arm
regulator_set_voltage(dcdc, 1100000, 1100000);
- regulator_set_suspend_voltage(dcdc, 1000000);
+ 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);
wm831x_set_bits(wm831x,
(WM831X_GPIO1_CONTROL + i),
WM831X_GPN_PULL_MASK, 1 << WM831X_GPN_PULL_SHIFT); //pull down
- if (i == 0) {
+ if (i == 0 ) {
wm831x_set_bits(wm831x,
WM831X_GPIO1_CONTROL + i,
WM831X_GPN_PWR_DOM_MASK,
WM831X_GPN_PWR_DOM_MASK,
~WM831X_GPN_PWR_DOM);
}
+
} else {
wm831x_set_bits(wm831x,
WM831X_GPIO1_CONTROL + i,
//end of i2c
#define POWER_ON_PIN RK30_PIN6_PB0 //power_hold
+static void rk30_pm_power_off(void)
+{
+ printk(KERN_ERR "rk30_pm_power_off start...\n");
+ gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
+#if defined(CONFIG_MFD_WM831X)
+ wm831x_device_shutdown(Wm831x);//wm8326 shutdown
+#endif
+ while (1);
+}
static void __init machine_rk30_board_init(void)
{
gpio_request(POWER_ON_PIN, "poweronpin");
gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
-
+
+ pm_power_off = rk30_pm_power_off;
+
rk30_i2c_register_board_info();
spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
platform_add_devices(devices, ARRAY_SIZE(devices));