Loading Documentation/devicetree/bindings/regulator/fan53555.txt +0 −2 Original line number Diff line number Diff line Loading @@ -20,8 +20,6 @@ Required Properties: - regulator-max-microvolt: Maximum voltage in microvolts supported by this regulator. - regulator-ramp-delay: The slew rate of the regulator, in uV/us. Supported values are 64000, 32000, 16000, 8000, 4000, 2000, 1000 and 500. Optional Properties: - fairchild,vsel-gpio: Present: GPIO connects to the VSEL pin and set Loading drivers/regulator/fan53555.c +29 −19 Original line number Diff line number Diff line Loading @@ -183,6 +183,30 @@ static struct regulator_ops fan53555_regulator_disable_suspend_ops = { .get_mode = fan53555_get_mode, }; /* * The formula for calculating the actual slew rate is: * actual_slew_rate = 10mv_based_slew_rate * scaling_step_size_mv / 10mV */ #define FAN53555_DVS_DEFAULT_STEP_SIZE_UV 10000 static u32 fan53555_get_slew_rate_reg_value(struct fan53555_device_info *di, u32 slew_rate) { u32 index; int scaled_slew_rate = slew_rate * FAN53555_DVS_DEFAULT_STEP_SIZE_UV / di->vsel_step; for (index = 0; index < ARRAY_SIZE(slew_rate_plan); index++) if (scaled_slew_rate >= slew_rate_plan[index]) break; if (index == ARRAY_SIZE(slew_rate_plan)) { dev_err(di->dev, "invalid slew rate.\n"); index = FAN53555_SLEW_RATE_8MV; } return index; } /* For 00,01,03,05 options: * VOUT = 0.60V + NSELx * 10mV, from 0.60 to 1.23V. * For 04 option: Loading Loading @@ -241,10 +265,14 @@ static int fan53555_device_setup(struct fan53555_device_info *di, return -EINVAL; } /* Init slew rate */ if (pdata->slew_rate & 0x7) if (di->dev->of_node) pdata->slew_rate = fan53555_get_slew_rate_reg_value(di, pdata->regulator->constraints.ramp_delay); else if (pdata->slew_rate & 0x7) di->slew_rate = pdata->slew_rate; else di->slew_rate = FAN53555_SLEW_RATE_64MV; reg = FAN53555_CONTROL; data = di->slew_rate << CTL_SLEW_SHIFT; mask = CTL_SLEW_MASK; Loading Loading @@ -303,22 +331,6 @@ static int fan53555_parse_backup_reg(struct i2c_client *client, u32 *sleep_sel) return rc; } static u32 fan53555_get_slew_rate_reg_value(struct i2c_client *client, u32 slew_rate) { u32 index; for (index = 0; index < ARRAY_SIZE(slew_rate_plan); index++) if (slew_rate == slew_rate_plan[index]) break; if (index == ARRAY_SIZE(slew_rate_plan)) { dev_err(&client->dev, "invalid slew rate.\n"); index = FAN53555_SLEW_RATE_8MV; } return index; } static struct fan53555_platform_data * fan53555_get_of_platform_data(struct i2c_client *client) Loading Loading @@ -355,8 +367,6 @@ static struct fan53555_platform_data * init_data->constraints.initial_mode = REGULATOR_MODE_NORMAL; pdata->regulator = init_data; pdata->slew_rate = fan53555_get_slew_rate_reg_value(client, init_data->constraints.ramp_delay); pdata->sleep_vsel_id = sleep_sel; return pdata; Loading include/linux/regulator/fan53555.h +6 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,12 @@ enum { }; /* Transition slew rate limiting from a low to high voltage. * The slew rate values listed in this table are based on * 10 mV voltage scaling step. The actual slew rate has a * relationship between the slew rate based on 10 mV as its * voltage scaling step size and the actual voltage step size. * The formula for calculating the actual slew rate is: * actual_slew_rate = 10mv_based_slew_rate * scaling_step_size_mv / 10mV. * ----------------------- * Bin |Slew Rate(mV/uS) * ------|---------------- Loading Loading
Documentation/devicetree/bindings/regulator/fan53555.txt +0 −2 Original line number Diff line number Diff line Loading @@ -20,8 +20,6 @@ Required Properties: - regulator-max-microvolt: Maximum voltage in microvolts supported by this regulator. - regulator-ramp-delay: The slew rate of the regulator, in uV/us. Supported values are 64000, 32000, 16000, 8000, 4000, 2000, 1000 and 500. Optional Properties: - fairchild,vsel-gpio: Present: GPIO connects to the VSEL pin and set Loading
drivers/regulator/fan53555.c +29 −19 Original line number Diff line number Diff line Loading @@ -183,6 +183,30 @@ static struct regulator_ops fan53555_regulator_disable_suspend_ops = { .get_mode = fan53555_get_mode, }; /* * The formula for calculating the actual slew rate is: * actual_slew_rate = 10mv_based_slew_rate * scaling_step_size_mv / 10mV */ #define FAN53555_DVS_DEFAULT_STEP_SIZE_UV 10000 static u32 fan53555_get_slew_rate_reg_value(struct fan53555_device_info *di, u32 slew_rate) { u32 index; int scaled_slew_rate = slew_rate * FAN53555_DVS_DEFAULT_STEP_SIZE_UV / di->vsel_step; for (index = 0; index < ARRAY_SIZE(slew_rate_plan); index++) if (scaled_slew_rate >= slew_rate_plan[index]) break; if (index == ARRAY_SIZE(slew_rate_plan)) { dev_err(di->dev, "invalid slew rate.\n"); index = FAN53555_SLEW_RATE_8MV; } return index; } /* For 00,01,03,05 options: * VOUT = 0.60V + NSELx * 10mV, from 0.60 to 1.23V. * For 04 option: Loading Loading @@ -241,10 +265,14 @@ static int fan53555_device_setup(struct fan53555_device_info *di, return -EINVAL; } /* Init slew rate */ if (pdata->slew_rate & 0x7) if (di->dev->of_node) pdata->slew_rate = fan53555_get_slew_rate_reg_value(di, pdata->regulator->constraints.ramp_delay); else if (pdata->slew_rate & 0x7) di->slew_rate = pdata->slew_rate; else di->slew_rate = FAN53555_SLEW_RATE_64MV; reg = FAN53555_CONTROL; data = di->slew_rate << CTL_SLEW_SHIFT; mask = CTL_SLEW_MASK; Loading Loading @@ -303,22 +331,6 @@ static int fan53555_parse_backup_reg(struct i2c_client *client, u32 *sleep_sel) return rc; } static u32 fan53555_get_slew_rate_reg_value(struct i2c_client *client, u32 slew_rate) { u32 index; for (index = 0; index < ARRAY_SIZE(slew_rate_plan); index++) if (slew_rate == slew_rate_plan[index]) break; if (index == ARRAY_SIZE(slew_rate_plan)) { dev_err(&client->dev, "invalid slew rate.\n"); index = FAN53555_SLEW_RATE_8MV; } return index; } static struct fan53555_platform_data * fan53555_get_of_platform_data(struct i2c_client *client) Loading Loading @@ -355,8 +367,6 @@ static struct fan53555_platform_data * init_data->constraints.initial_mode = REGULATOR_MODE_NORMAL; pdata->regulator = init_data; pdata->slew_rate = fan53555_get_slew_rate_reg_value(client, init_data->constraints.ramp_delay); pdata->sleep_vsel_id = sleep_sel; return pdata; Loading
include/linux/regulator/fan53555.h +6 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,12 @@ enum { }; /* Transition slew rate limiting from a low to high voltage. * The slew rate values listed in this table are based on * 10 mV voltage scaling step. The actual slew rate has a * relationship between the slew rate based on 10 mV as its * voltage scaling step size and the actual voltage step size. * The formula for calculating the actual slew rate is: * actual_slew_rate = 10mv_based_slew_rate * scaling_step_size_mv / 10mV. * ----------------------- * Bin |Slew Rate(mV/uS) * ------|---------------- Loading