rk30:sdk:support pwm set voltage
author张晴 <zhangqing@rock-chips.com>
Tue, 14 Aug 2012 08:34:41 +0000 (16:34 +0800)
committer张晴 <zhangqing@rock-chips.com>
Tue, 14 Aug 2012 08:34:41 +0000 (16:34 +0800)
arch/arm/mach-rk30/board-rk30-sdk.c

index dc753d662cff4d84d73c885652d2bb1ea4247c33..2cf324e4ea6df5f02f8f47a4565df899242d53e0 100755 (executable)
@@ -44,6 +44,7 @@
 #include <linux/regulator/machine.h>
 #include <linux/rfkill-rk.h>
 #include <linux/sensor-dev.h>
+#include <linux/regulator/rk29-pwm-regulator.h>
 #if defined(CONFIG_HDMI_RK30)
        #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
 #endif
@@ -1401,6 +1402,60 @@ static struct platform_device rk30_device_adc_battery = {
 };
 #endif
 
+#if CONFIG_RK30_PWM_REGULATOR
+const static int pwm_voltage_map[] = {
+       1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
+};
+
+static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
+       {
+               .supply = "vdd_core",
+       }
+};
+
+struct regulator_init_data pwm_regulator_init_dcdc[1] =
+{
+       {
+               .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,
+       },
+};
+
+static struct pwm_platform_data pwm_regulator_info[1] = {
+       {
+               .pwm_id = 3,
+               .pwm_gpio = RK30_PIN0_PD7,
+               .pwm_iomux_name = GPIO0D7_PWM3_NAME,
+               .pwm_iomux_pwm = GPIO0D_PWM3,
+               .pwm_iomux_gpio = GPIO0D_GPIO0D6,
+               .pwm_voltage = 1100000,
+               .suspend_voltage = 1050000,
+               .min_uV = 1000000,
+               .max_uV = 1400000,
+               .coefficient = 455,     //45.5%
+               .pwm_voltage_map = pwm_voltage_map,
+               .init_data      = &pwm_regulator_init_dcdc[0],
+       },
+};
+
+struct platform_device pwm_regulator_device[1] = {
+       {
+               .name = "pwm-voltage-regulator",
+               .id = 0,
+               .dev            = {
+                       .platform_data = &pwm_regulator_info[0],
+               }
+       },
+};
+#endif
+
 #ifdef CONFIG_RK29_VMAC
 #define PHY_PWR_EN_GPIO        RK30_PIN1_PD6
 #include "board-rk30-sdk-vmac.c"