regulator: rk808: Convert to use regulator_set_ramp_delay_regmap
PATCH 1/1 regulator: rk808: Convert to use regulator_set_ramp_delay_regmap
Use regulator_set_ramp_delay_regmap instead of open-coded.
--- drivers/regulator/rk808-regulator.c | 109 +++++++++++++--------------- 1 file changed, 51 insertions(+), 58 deletions(-)
drivers/regulator/rk808-regulator.c +51 -58
@@ -215,6 +215,15 @@ static const struct linear_range rk817_buck3_voltage_ranges[] = { RK817_BUCK3_SEL_CNT, RK817_BUCK1_STP1), }; +static const unsigned int rk808_buck1_2_ramp_table[] = { +2000 ,4000 ,6000 ,10000 +}; + +/* RK817 RK809 */ +static const unsigned int rk817_buck1_4_ramp_table[] = { +3000 ,6300 ,12500 ,25000 +}; +static int rk808_buck1_2_get_voltage_sel_regmap (struct regulator_dev *rdev) {struct rk808_regulator_data *pdata =rdev_get_drvdata (rdev);
@@ -340,62 +349,6 @@ static int rk808_buck1_2_set_voltage_time_sel(struct regulator_dev *rdev,return regulator_set_voltage_time_sel (rdev, old_selector, new_selector); } -static int rk808_set_ramp_delay (struct regulator_dev *rdev,int ramp_delay) -{ -unsigned int ramp_value =RK808_RAMP_RATE_10MV_PER_US ; -unsigned int reg = rk808_buck_config_regs[rdev_get_id (rdev)]; - -switch (ramp_delay) { - case 1 ... 2000: - ramp_value =RK808_RAMP_RATE_2MV_PER_US ; -break ; - case 2001 ... 4000: - ramp_value =RK808_RAMP_RATE_4MV_PER_US ; -break ; - case 4001 ... 6000: - ramp_value =RK808_RAMP_RATE_6MV_PER_US ; -break ; - case 6001 ... 10000: -break ; -default : -pr_warn ("%s ramp_delay: %d not supported, setting 10000\n" , - rdev->desc->name, ramp_delay); - } - -return regmap_update_bits (rdev->regmap, reg, -RK808_RAMP_RATE_MASK , ramp_value); -} - -/* -* RK817 RK809 -*/ -static int rk817_set_ramp_delay (struct regulator_dev *rdev,int ramp_delay) -{ -unsigned int ramp_value =RK817_RAMP_RATE_25MV_PER_US ; -unsigned int reg =RK817_BUCK_CONFIG_REG (rdev_get_id (rdev)); - -switch (ramp_delay) { - case 0 ... 3000: - ramp_value =RK817_RAMP_RATE_3MV_PER_US ; -break ; - case 3001 ... 6300: - ramp_value =RK817_RAMP_RATE_6_3MV_PER_US ; -break ; - case 6301 ... 12500: - ramp_value =RK817_RAMP_RATE_12_5MV_PER_US ; -break ; - case 12501 ... 25000: -break ; -default : -dev_warn (&rdev->dev, -"%s ramp_delay: %d not supported, setting 25000\n" , - rdev->desc->name, ramp_delay); - } - -return regmap_update_bits (rdev->regmap, reg, -RK817_RAMP_RATE_MASK , ramp_value); -} -static int rk808_set_suspend_voltage (struct regulator_dev *rdev,int uv) {unsigned int reg;
@@ -625,7 +578,7 @@ static const struct regulator_ops rk808_buck1_2_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap, - .set_ramp_delay = rk808_set_ramp_delay, + .set_ramp_delay = regulator_set_ramp_delay_regmap, .set_suspend_voltage = rk808_set_suspend_voltage, .set_suspend_enable = rk808_set_suspend_enable, .set_suspend_disable = rk808_set_suspend_disable,
@@ -722,7 +675,7 @@ static const struct regulator_ops rk817_buck_ops_range = { .set_mode = rk8xx_set_mode, .get_mode = rk8xx_get_mode, .set_suspend_mode = rk8xx_set_suspend_mode, - .set_ramp_delay = rk817_set_ramp_delay, + .set_ramp_delay = regulator_set_ramp_delay_regmap, .set_suspend_voltage = rk808_set_suspend_voltage_range, .set_suspend_enable = rk817_set_suspend_enable, .set_suspend_disable = rk817_set_suspend_disable,
@@ -814,6 +767,10 @@ static const struct regulator_desc rk808_reg[] = { .vsel_mask = RK808_BUCK_VSEL_MASK, .enable_reg = RK808_DCDC_EN_REG, .enable_mask = BIT(0), + .ramp_reg = RK808_BUCK1_CONFIG_REG, + .ramp_mask = RK808_RAMP_RATE_MASK, + .ramp_delay_table = rk808_buck1_2_ramp_table, + .n_ramp_values = ARRAY_SIZE(rk808_buck1_2_ramp_table), .owner = THIS_MODULE, }, { .name = "DCDC_REG2",
@@ -830,6 +787,10 @@ static const struct regulator_desc rk808_reg[] = { .vsel_mask = RK808_BUCK_VSEL_MASK, .enable_reg = RK808_DCDC_EN_REG, .enable_mask = BIT(1), + .ramp_reg = RK808_BUCK2_CONFIG_REG, + .ramp_mask = RK808_RAMP_RATE_MASK, + .ramp_delay_table = rk808_buck1_2_ramp_table, + .n_ramp_values = ARRAY_SIZE(rk808_buck1_2_ramp_table), .owner = THIS_MODULE, }, { .name = "DCDC_REG3",
@@ -910,6 +871,10 @@ static const struct regulator_desc rk809_reg[] = { .enable_mask = ENABLE_MASK(RK817_ID_DCDC1), .enable_val = ENABLE_MASK(RK817_ID_DCDC1), .disable_val = DISABLE_VAL(RK817_ID_DCDC1), + .ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC1), + .ramp_mask = RK817_RAMP_RATE_MASK, + .ramp_delay_table = rk817_buck1_4_ramp_table, + .n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table), .of_map_mode = rk8xx_regulator_of_map_mode, .owner = THIS_MODULE, }, {
@@ -929,6 +894,10 @@ static const struct regulator_desc rk809_reg[] = { .enable_mask = ENABLE_MASK(RK817_ID_DCDC2), .enable_val = ENABLE_MASK(RK817_ID_DCDC2), .disable_val = DISABLE_VAL(RK817_ID_DCDC2), + .ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC2), + .ramp_mask = RK817_RAMP_RATE_MASK, + .ramp_delay_table = rk817_buck1_4_ramp_table, + .n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table), .of_map_mode = rk8xx_regulator_of_map_mode, .owner = THIS_MODULE, }, {
@@ -948,6 +917,10 @@ static const struct regulator_desc rk809_reg[] = { .enable_mask = ENABLE_MASK(RK817_ID_DCDC3), .enable_val = ENABLE_MASK(RK817_ID_DCDC3), .disable_val = DISABLE_VAL(RK817_ID_DCDC3), + .ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC3), + .ramp_mask = RK817_RAMP_RATE_MASK, + .ramp_delay_table = rk817_buck1_4_ramp_table, + .n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table), .of_map_mode = rk8xx_regulator_of_map_mode, .owner = THIS_MODULE, }, {
@@ -967,6 +940,10 @@ static const struct regulator_desc rk809_reg[] = { .enable_mask = ENABLE_MASK(RK817_ID_DCDC4), .enable_val = ENABLE_MASK(RK817_ID_DCDC4), .disable_val = DISABLE_VAL(RK817_ID_DCDC4), + .ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC4), + .ramp_mask = RK817_RAMP_RATE_MASK, + .ramp_delay_table = rk817_buck1_4_ramp_table, + .n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table), .of_map_mode = rk8xx_regulator_of_map_mode, .owner = THIS_MODULE, },
@@ -1052,6 +1029,10 @@ static const struct regulator_desc rk817_reg[] = { .enable_mask = ENABLE_MASK(RK817_ID_DCDC1), .enable_val = ENABLE_MASK(RK817_ID_DCDC1), .disable_val = DISABLE_VAL(RK817_ID_DCDC1), + .ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC1), + .ramp_mask = RK817_RAMP_RATE_MASK, + .ramp_delay_table = rk817_buck1_4_ramp_table, + .n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table), .of_map_mode = rk8xx_regulator_of_map_mode, .owner = THIS_MODULE, }, {
@@ -1071,6 +1052,10 @@ static const struct regulator_desc rk817_reg[] = { .enable_mask = ENABLE_MASK(RK817_ID_DCDC2), .enable_val = ENABLE_MASK(RK817_ID_DCDC2), .disable_val = DISABLE_VAL(RK817_ID_DCDC2), + .ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC2), + .ramp_mask = RK817_RAMP_RATE_MASK, + .ramp_delay_table = rk817_buck1_4_ramp_table, + .n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table), .of_map_mode = rk8xx_regulator_of_map_mode, .owner = THIS_MODULE, }, {
@@ -1090,6 +1075,10 @@ static const struct regulator_desc rk817_reg[] = { .enable_mask = ENABLE_MASK(RK817_ID_DCDC3), .enable_val = ENABLE_MASK(RK817_ID_DCDC3), .disable_val = DISABLE_VAL(RK817_ID_DCDC3), + .ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC3), + .ramp_mask = RK817_RAMP_RATE_MASK, + .ramp_delay_table = rk817_buck1_4_ramp_table, + .n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table), .of_map_mode = rk8xx_regulator_of_map_mode, .owner = THIS_MODULE, }, {
@@ -1109,6 +1098,10 @@ static const struct regulator_desc rk817_reg[] = { .enable_mask = ENABLE_MASK(RK817_ID_DCDC4), .enable_val = ENABLE_MASK(RK817_ID_DCDC4), .disable_val = DISABLE_VAL(RK817_ID_DCDC4), + .ramp_reg = RK817_BUCK_CONFIG_REG(RK817_ID_DCDC4), + .ramp_mask = RK817_RAMP_RATE_MASK, + .ramp_delay_table = rk817_buck1_4_ramp_table, + .n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table), .of_map_mode = rk8xx_regulator_of_map_mode, .owner = THIS_MODULE, },
Signature · 1 line
2.25.1
kernel test robot
build botThank you for the patch! Perhaps something to improve:
Hi Axel,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on regulator/for-next]
[also build test WARNING on v5.13-rc3 next-20210525]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Axel-Lin/regulator-rk808-Convert-to-use-regulator_set_ramp_delay_regmap/20210525-183912 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next config: x86_64-randconfig-r002-20210525 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 99155e913e9bad5f7f8a247f8bb3a3ff3da74af1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/7455e23c1f5517ad398e81f902db347870905668
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Axel-Lin/regulator-rk808-Convert-to-use-regulator_set_ramp_delay_regmap/20210525-183912 git checkout 7455e23c1f5517ad398e81f902db347870905668
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/regulator/rk808-regulator.c:161:18: warning: unused variable 'rk808_buck_config_regs' [-Wunused-const-variable]
static const int rk808_buck_config_regs[] = {
^1 warning generated.
vim +/rk808_buck_config_regs +161 drivers/regulator/rk808-regulator.c
bad47ad2eef341 Chris Zhong 2015-07-20 160
8af252272a0d63 Doug Anderson 2014-09-16 @161 static const int rk808_buck_config_regs[] = {
8af252272a0d63 Doug Anderson 2014-09-16 162 RK808_BUCK1_CONFIG_REG,
8af252272a0d63 Doug Anderson 2014-09-16 163 RK808_BUCK2_CONFIG_REG,
8af252272a0d63 Doug Anderson 2014-09-16 164 RK808_BUCK3_CONFIG_REG,
8af252272a0d63 Doug Anderson 2014-09-16 165 RK808_BUCK4_CONFIG_REG,
8af252272a0d63 Doug Anderson 2014-09-16 166 };8af252272a0d63 Doug Anderson 2014-09-16 167
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org