diff options
author | Luka Perkov <luka@openwrt.org> | 2013-10-29 02:19:03 +0000 |
---|---|---|
committer | Luka Perkov <luka@openwrt.org> | 2013-10-29 02:19:03 +0000 |
commit | 58abdeaa982a1531e10556028cdbe78123c595c6 (patch) | |
tree | 1ef85890e05852e44eb71ef5f88c1f000f2cfa9c /target/linux/imx6/patches-3.10/0026-regulator-pfuze100-Fix-n_voltages-setting-for-SW2-SW.patch | |
parent | cd3fc794cb25863cc0c83f8d44fc69e343910875 (diff) | |
download | master-187ad058-58abdeaa982a1531e10556028cdbe78123c595c6.tar.gz master-187ad058-58abdeaa982a1531e10556028cdbe78123c595c6.tar.bz2 master-187ad058-58abdeaa982a1531e10556028cdbe78123c595c6.zip |
imx6: update 3.10 patches
Signed-off-by: Luka Perkov <luka@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@38571 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/imx6/patches-3.10/0026-regulator-pfuze100-Fix-n_voltages-setting-for-SW2-SW.patch')
-rw-r--r-- | target/linux/imx6/patches-3.10/0026-regulator-pfuze100-Fix-n_voltages-setting-for-SW2-SW.patch | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/target/linux/imx6/patches-3.10/0026-regulator-pfuze100-Fix-n_voltages-setting-for-SW2-SW.patch b/target/linux/imx6/patches-3.10/0026-regulator-pfuze100-Fix-n_voltages-setting-for-SW2-SW.patch new file mode 100644 index 0000000000..026eccec4d --- /dev/null +++ b/target/linux/imx6/patches-3.10/0026-regulator-pfuze100-Fix-n_voltages-setting-for-SW2-SW.patch @@ -0,0 +1,67 @@ +From: Axel Lin <axel.lin@ingics.com> +Subject: [PATCH] regulator: pfuze100: Fix n_voltages setting for SW2~SW4 with + high bit set + +Current code adjust min_uV and uV_step but missed adjusting the n_voltages +setting. + +When BIT6 is clear: + n_voltages = (1975000 - 400000) / 25000 + 1 = 64 +When BIT6 is set: + n_voltages = (3300000 - 800000) / 50000 + 1 = 51 + +The n_voltages needs update because when BIT6 is set 0x73 ~ 0x7f are reserved. +When using regulator_list_voltage_linear, the n_voltages does matter here +because wrong n_voltages setting make the equation return wrong result. +e.g. if selector is 63, regulator_list_voltage_linear returns + 800000 + (50000 * 63) = 4000000 + It should return -EINVAL if the selector is in the range of 51 ~ 63. + +Signed-off-by: Axel Lin <axel.lin@ingics.com> +Signed-off-by: Mark Brown <broonie@linaro.org> +--- + drivers/regulator/pfuze100-regulator.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +--- a/drivers/regulator/pfuze100-regulator.c ++++ b/drivers/regulator/pfuze100-regulator.c +@@ -388,8 +388,11 @@ static int pfuze100_regulator_probe(stru + + for (i = 0; i < PFUZE100_MAX_REGULATOR; i++) { + struct regulator_init_data *init_data; ++ struct regulator_desc *desc; + int val; + ++ desc = &pfuze_chip->regulator_descs[i].desc; ++ + if (pdata) + init_data = pdata->init_data[i]; + else +@@ -397,13 +400,11 @@ static int pfuze100_regulator_probe(stru + + /* SW2~SW4 high bit check and modify the voltage value table */ + if (i > PFUZE100_SW1C && i < PFUZE100_SWBST) { +- regmap_read(pfuze_chip->regmap, PFUZE100_SW2VOL + +- (i - PFUZE100_SW2) * 7, &val); ++ regmap_read(pfuze_chip->regmap, desc->vsel_reg, &val); + if (val & 0x40) { +- pfuze_chip->regulator_descs[i].desc.min_uV +- = 800000; +- pfuze_chip->regulator_descs[i].desc.uV_step +- = 50000; ++ desc->min_uV = 800000; ++ desc->uV_step = 50000; ++ desc->n_voltages = 51; + } + } + +@@ -412,8 +413,7 @@ static int pfuze100_regulator_probe(stru + config.driver_data = pfuze_chip; + config.of_node = match_of_node(i); + +- pfuze_chip->regulators[i] = regulator_register(&pfuze_chip +- ->regulator_descs[i].desc, &config); ++ pfuze_chip->regulators[i] = regulator_register(desc, &config); + if (IS_ERR(pfuze_chip->regulators[i])) { + dev_err(&client->dev, "register regulator%s failed\n", + pfuze100_regulators[i].desc.name); |