rk30_phone:add discrete dcdc driver support
authorlw@rock-chips.com <lw@rock-chips.com>
Tue, 17 Apr 2012 03:08:26 +0000 (11:08 +0800)
committerlw <lw@rock-chips.com>
Tue, 17 Apr 2012 03:08:47 +0000 (11:08 +0800)
arch/arm/mach-rk30/board-rk30-phone-key.c
arch/arm/mach-rk30/board-rk30-phone-wm831x.c
arch/arm/mach-rk30/board-rk30-phone.c
drivers/regulator/Kconfig
drivers/regulator/Makefile

index ab2bc3b322c1731a58826777274b6ad38eef9b28..46ef9165f0ee4735b93b2b74bffe9d352ecb800e 100755 (executable)
@@ -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,
index 22aaed0eb53de517a428cb351c068360018bf605..20f4e7b68a2b4592d7d4abeda11fade14dc91f69 100755 (executable)
@@ -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;
 }
index d4ee353c2341eb3a66d6b9b59bd65574d4943ca4..6887f5aca86a58d408b1dc966e2b7914cc345a6f 100755 (executable)
@@ -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
index bc147414a6b972d5795e5abb858c0b729b8a29af..90c87c9797c5c5da8972d7a03f7f0f40255006ea 100755 (executable)
@@ -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
index 5b98d6cd9803ad6a953936f0c32a4da643050b37..68db7129f878e9eaa9f30ff2985b7da524bd86dc 100755 (executable)
@@ -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