From: 张晴 Date: Fri, 30 Mar 2012 02:13:14 +0000 (+0800) Subject: rk30:sdk:add wm8326 power off,and modify led init state X-Git-Tag: firefly_0821_release~9557^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=882b86ce89d2afcbc1f166c7ff222db6b527dbcd;p=firefly-linux-kernel-4.4.55.git rk30:sdk:add wm8326 power off,and modify led init state --- diff --git a/arch/arm/mach-rk30/board-rk30-sdk-wm8326.c b/arch/arm/mach-rk30/board-rk30-sdk-wm8326.c index f3ceba9536a2..d33fa4ea9a55 100755 --- a/arch/arm/mach-rk30/board-rk30-sdk-wm8326.c +++ b/arch/arm/mach-rk30/board-rk30-sdk-wm8326.c @@ -67,13 +67,17 @@ static struct rk29_gpio_expander_info wm831x_gpio_settinginfo[] = { #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); @@ -91,6 +95,9 @@ static int wm831x_pre_init(struct wm831x *parm) 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; @@ -135,7 +142,7 @@ 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, 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); @@ -610,7 +617,7 @@ static int wm831x_init_pin_type(struct wm831x *wm831x) 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, @@ -622,6 +629,7 @@ static int wm831x_init_pin_type(struct wm831x *wm831x) WM831X_GPN_PWR_DOM_MASK, ~WM831X_GPN_PWR_DOM); } + } else { wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + i, diff --git a/arch/arm/mach-rk30/board-rk30-sdk.c b/arch/arm/mach-rk30/board-rk30-sdk.c index 22be0cae5552..a7d29273fd0c 100755 --- a/arch/arm/mach-rk30/board-rk30-sdk.c +++ b/arch/arm/mach-rk30/board-rk30-sdk.c @@ -1066,12 +1066,23 @@ static void __init rk30_i2c_register_board_info(void) //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));