rk30_phone:add discrete dcdc driver support

This commit is contained in:
lw@rock-chips.com
2012-04-17 11:08:26 +08:00
committed by lw
parent 35a1932f2c
commit 322bef5abe
5 changed files with 120 additions and 56 deletions

View File

@@ -8,52 +8,43 @@
#define PRESS_LEV_HIGH 0
static struct rk29_keys_button key_button[] = {
#if 0
{
.desc = "menu",
.code = EV_MENU,
.gpio = RK30_PIN6_PA0,
.gpio = RK30_PIN0_PD0,
.active_low = PRESS_LEV_LOW,
},
{
.desc = "vol+",
.code = KEY_VOLUMEUP,
.gpio = RK30_PIN6_PA1,
.gpio = RK30_PIN4_PC4,
.active_low = PRESS_LEV_LOW,
},
#endif
{
.desc = "vol-",
.code = KEY_VOLUMEDOWN,
.gpio = RK30_PIN4_PC5,
.active_low = PRESS_LEV_LOW,
},
#if 0
{
.desc = "home",
.code = KEY_HOME,
.gpio = RK30_PIN6_PA3,
.gpio = RK30_PIN0_PD2,
.active_low = PRESS_LEV_LOW,
},
{
.desc = "search",
.code = KEY_SEARCH,
.gpio = RK30_PIN6_PA4,
.gpio = RK30_PIN0_PD1,
.active_low = PRESS_LEV_LOW,
},
{
.desc = "esc",
.code = KEY_BACK,
.gpio = RK30_PIN6_PA5,
.gpio = RK30_PIN0_PD3,
.active_low = PRESS_LEV_LOW,
},
{
.desc = "sensor",
.code = KEY_CAMERA,
.gpio = RK30_PIN6_PA6,
.active_low = PRESS_LEV_LOW,
},
#endif
#if 0
{
.desc = "play",
.code = KEY_POWER,
@@ -62,52 +53,13 @@ static struct rk29_keys_button key_button[] = {
//.code_long_press = EV_ENCALL,
.wakeup = 1,
},
#if 1
{
.desc = "vol+",
.code = KEY_VOLUMEUP,
.adc_value = 1,
.gpio = INVALID_GPIO,
.active_low = PRESS_LEV_LOW,
},
#if 0
{
.desc = "vol-",
.code = KEY_VOLUMEUP,
.adc_value = 249,
.gpio = INVALID_GPIO,
.active_low = PRESS_LEV_LOW,
},
#endif
{
.desc = "menu",
.code = EV_MENU,
.adc_value = 155,
.gpio = INVALID_GPIO,
.active_low = PRESS_LEV_LOW,
},
{
.desc = "home",
.code = KEY_HOME,
.adc_value = 630,
.gpio = INVALID_GPIO,
.active_low = PRESS_LEV_LOW,
},
{
.desc = "esc",
.code = KEY_BACK,
.adc_value = 386,
.gpio = INVALID_GPIO,
.active_low = PRESS_LEV_LOW,
},
{
.desc = "camera",
.code = KEY_CAMERA,
.adc_value = 827,
.gpio = INVALID_GPIO,
.gpio = RK30_PIN0_PD4,
.active_low = PRESS_LEV_LOW,
},
#endif
};
struct rk29_keys_platform_data rk29_keys_pdata = {
.buttons = key_button,

View File

@@ -212,6 +212,23 @@ int wm831x_post_init(struct wm831x *Wm831x)
regulator_put(ldo);
udelay(100);
#endif
//discrete dcdc device
#ifdef CONFIG_RK30_PWM_REGULATOR
dcdc = regulator_get(NULL, "vdd_core"); // vdd_log
regulator_set_voltage(dcdc, 1200000, 1200000);
regulator_enable(dcdc);
printk("%s set vdd_core=%dmV end\n", __func__, regulator_get_voltage(dcdc));
regulator_put(dcdc);
udelay(100);
dcdc = regulator_get(NULL, "vdd_cpu"); // vdd_arm
regulator_set_voltage(dcdc, 1200000, 1200000);
regulator_enable(dcdc);
printk("%s set vdd_cpu=%dmV end\n", __func__, regulator_get_voltage(dcdc));
regulator_put(dcdc);
udelay(100);
#endif
printk("wm831x_post_init end");
return 0;
}

View File

@@ -43,6 +43,7 @@
#include <linux/mfd/wm8994/pdata.h>
#include <linux/regulator/machine.h>
#include "../../../drivers/headset_observe/rk_headset.h"
#include <linux/regulator/rk29-pwm-regulator.h>
#if defined(CONFIG_SPIM_RK29)
#include "../../../drivers/spi/rk29_spim.h"
@@ -670,6 +671,88 @@ struct platform_device rk_device_headset = {
};
#endif
#if CONFIG_RK30_PWM_REGULATOR
static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
{
.supply = "vdd_core",
}
};
static struct regulator_consumer_supply pwm_dcdc2_consumers[] = {
{
.supply = "vdd_cpu",
}
};
struct regulator_init_data pwm_regulator_init_dcdc[2] =
{
{
.constraints = {
.name = "PWM_DCDC1",
.min_uV = 600000,
.max_uV = 1800000, //0.6-1.8V
.apply_uV = true,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
},
.num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
.consumer_supplies = pwm_dcdc1_consumers,
},
{
.constraints = {
.name = "PWM_DCDC2",
.min_uV = 600000,
.max_uV = 1800000, //0.6-1.8V
.apply_uV = true,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
},
.num_consumer_supplies = ARRAY_SIZE(pwm_dcdc2_consumers),
.consumer_supplies = pwm_dcdc2_consumers,
},
};
static struct pwm_platform_data pwm_regulator_info[2] = {
{
.pwm_id = 0,
.pwm_gpio = RK30_PIN0_PA3,
.pwm_iomux_name = GPIO0A3_PWM0_NAME,
.pwm_iomux_pwm = GPIO0A_PWM0,
.pwm_iomux_gpio = GPIO0A_GPIO0A3,
.pwm_voltage = 1100000,
.init_data = &pwm_regulator_init_dcdc[0],
},
{
.pwm_id = 2,
.pwm_gpio = RK30_PIN0_PD6,
.pwm_iomux_name = GPIO0D6_PWM2_NAME,
.pwm_iomux_pwm = GPIO0D_PWM2,
.pwm_iomux_gpio = GPIO0D_GPIO0D6,
.pwm_voltage = 1100000,
.init_data = &pwm_regulator_init_dcdc[1],
},
};
struct platform_device pwm_regulator_device[2] = {
{
.name = "pwm-voltage-regulator",
.id = 0,
.dev = {
.platform_data = &pwm_regulator_info[0],
}
},
{
.name = "pwm-voltage-regulator",
.id = 1,
.dev = {
.platform_data = &pwm_regulator_info[1],
}
},
};
#endif
/***********************************************************
* rk30 backlight
@@ -1444,6 +1527,10 @@ struct platform_device rk29_device_tdsc8800 = {
static struct platform_device *devices[] __initdata = {
#ifdef CONFIG_RK30_PWM_REGULATOR
&pwm_regulator_device[0],
&pwm_regulator_device[1],
#endif
#ifdef CONFIG_BACKLIGHT_RK29_BL
&rk29_device_backlight,
#endif
@@ -1479,8 +1566,9 @@ static struct platform_device *devices[] __initdata = {
&rk_device_headset,
#endif
#ifdef CONFIG_TDSC8800
&rk29_device_tdsc8800
&rk29_device_tdsc8800,
#endif
};
// i2c

View File

@@ -270,6 +270,11 @@ config RK29_PWM_REGULATOR
help
Say Y to enable support for the voltage regulators charge on the RK2918.
config RK30_PWM_REGULATOR
tristate "rk30 pwm voltage regulator for discrete dcdc or ldo"
help
Say Y to enable support for the voltage regulators control on the RK30 .
config REGULATOR_88PM8607
bool "Marvell 88PM8607 Power regulators"
depends on MFD_88PM860X=y

View File

@@ -38,6 +38,8 @@ obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o
obj-$(CONFIG_RK2818_REGULATOR_LP8725) += rk2818_lp8725.o
obj-$(CONFIG_RK2818_REGULATOR_CHARGE) += charge-regulator.o
obj-$(CONFIG_RK29_PWM_REGULATOR) += rk29-pwm-regulator.o
obj-$(CONFIG_RK30_PWM_REGULATOR) += rk30-pwm-regulator.o
obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o
obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o