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 | |
parent | cd3fc794cb25863cc0c83f8d44fc69e343910875 (diff) | |
download | upstream-58abdeaa982a1531e10556028cdbe78123c595c6.tar.gz upstream-58abdeaa982a1531e10556028cdbe78123c595c6.tar.bz2 upstream-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
12 files changed, 489 insertions, 27 deletions
diff --git a/target/linux/imx6/patches-3.10/0020-pfuze100-regulator.patch b/target/linux/imx6/patches-3.10/0019-regulator-pfuze100-add-pfuze100-regulator-driver.patch index 1e1294a443..cbce5e79c1 100644 --- a/target/linux/imx6/patches-3.10/0020-pfuze100-regulator.patch +++ b/target/linux/imx6/patches-3.10/0019-regulator-pfuze100-add-pfuze100-regulator-driver.patch @@ -1,13 +1,149 @@ +From 3784b6d64dc52ed3fbebad61a85ab9b7a687a167 Mon Sep 17 00:00:00 2001 +From: Robin Gong <b38343@freescale.com> +Date: Thu, 25 Jul 2013 11:33:18 +0800 +Subject: [PATCH] regulator: pfuze100: add pfuze100 regulator driver + +Add pfuze100 regulator driver. + +Signed-off-by: Robin Gong <b38343@freescale.com> +Tested-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> +Signed-off-by: Mark Brown <broonie@linaro.org> +--- + .../devicetree/bindings/regulator/pfuze100.txt | 113 +++++ + drivers/regulator/Kconfig | 7 + + drivers/regulator/Makefile | 1 + + drivers/regulator/pfuze100-regulator.c | 454 +++++++++++++++++++++ + include/linux/regulator/pfuze100.h | 44 ++ + 5 files changed, 619 insertions(+) + create mode 100644 Documentation/devicetree/bindings/regulator/pfuze100.txt + create mode 100644 drivers/regulator/pfuze100-regulator.c + create mode 100644 include/linux/regulator/pfuze100.h + +--- /dev/null ++++ b/Documentation/devicetree/bindings/regulator/pfuze100.txt +@@ -0,0 +1,113 @@ ++PFUZE100 family of regulators ++ ++Required properties: ++- compatible: "fsl,pfuze100" ++- reg: I2C slave address ++- regulators: This is the list of child nodes that specify the regulator ++ initialization data for defined regulators. Please refer to below doc ++ Documentation/devicetree/bindings/regulator/regulator.txt. ++ ++ The valid names for regulators are: ++ sw1ab,sw1c,sw2,sw3a,sw3b,sw4,swbst,vsnvs,vrefddr,vgen1~vgen6 ++ ++Each regulator is defined using the standard binding for regulators. ++ ++Example: ++ ++ pmic: pfuze100@08 { ++ compatible = "fsl,pfuze100"; ++ reg = <0x08>; ++ ++ regulators { ++ sw1a_reg: sw1ab { ++ regulator-min-microvolt = <300000>; ++ regulator-max-microvolt = <1875000>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-ramp-delay = <6250>; ++ }; ++ ++ sw1c_reg: sw1c { ++ regulator-min-microvolt = <300000>; ++ regulator-max-microvolt = <1875000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ sw2_reg: sw2 { ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ sw3a_reg: sw3a { ++ regulator-min-microvolt = <400000>; ++ regulator-max-microvolt = <1975000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ sw3b_reg: sw3b { ++ regulator-min-microvolt = <400000>; ++ regulator-max-microvolt = <1975000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ sw4_reg: sw4 { ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ swbst_reg: swbst { ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5150000>; ++ }; ++ ++ snvs_reg: vsnvs { ++ regulator-min-microvolt = <1000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ vref_reg: vrefddr { ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ vgen1_reg: vgen1 { ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1550000>; ++ }; ++ ++ vgen2_reg: vgen2 { ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1550000>; ++ }; ++ ++ vgen3_reg: vgen3 { ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vgen4_reg: vgen4 { ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ }; ++ ++ vgen5_reg: vgen5 { ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ }; ++ ++ vgen6_reg: vgen6 { ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ }; ++ }; ++ }; --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig -@@ -300,6 +300,14 @@ config REGULATOR_PCF50633 +@@ -300,6 +300,13 @@ config REGULATOR_PCF50633 Say Y here to support the voltage regulators and convertors on PCF50633 +config REGULATOR_PFUZE100 + tristate "Support regulators on Freescale PFUZE100 PMIC" + depends on I2C -+ select REGMAP_I2C + help + Say y here to support the regulators found on the Freescale PFUZE100 + PMIC. @@ -27,7 +163,7 @@ obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o --- /dev/null +++ b/drivers/regulator/pfuze100-regulator.c -@@ -0,0 +1,445 @@ +@@ -0,0 +1,454 @@ +/* + * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved. + * @@ -123,15 +259,26 @@ +{ + struct pfuze_chip *pfuze100 = rdev_get_drvdata(rdev); + int id = rdev->desc->id; -+ unsigned int ramp_bits; ++ unsigned int val, ramp_bits, reg; + int ret; + + if (id < PFUZE100_SWBST) { -+ ramp_delay = 12500 / ramp_delay; ++ if (id == PFUZE100_SW1AB) ++ reg = PFUZE100_SW1ABVOL; ++ else ++ reg = PFUZE100_SW1CVOL + (id - PFUZE100_SW1C) * 7; ++ regmap_read(pfuze100->regmap, reg, &val); ++ ++ if (id <= PFUZE100_SW1C) ++ ramp_delay = 25000 / (2 * ramp_delay); ++ else if (val & 0x40) ++ ramp_delay = 50000 / (4 * ramp_delay); ++ else ++ ramp_delay = 25000 / (2 * ramp_delay); ++ + ramp_bits = (ramp_delay >> 1) - (ramp_delay >> 3); -+ ret = regmap_update_bits(pfuze100->regmap, -+ rdev->desc->vsel_reg + 4, -+ 0xc0, ramp_bits << 6); ++ ret = regmap_update_bits(pfuze100->regmap, reg + 4 , 0xc0, ++ ramp_bits << 6); + if (ret < 0) + dev_err(pfuze100->dev, "ramp failed, err %d\n", ret); + } else @@ -163,7 +310,6 @@ + +static struct regulator_ops pfuze100_swb_regulator_ops = { + .list_voltage = regulator_list_voltage_table, -+ .map_voltage = regulator_map_voltage_ascend, + .set_voltage_sel = regulator_set_voltage_sel_regmap, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + @@ -315,7 +461,7 @@ +#else +static int pfuze_parse_regulators_dt(struct pfuze_chip *chip) +{ -+ return 0; ++ return NULL; +} + +static inline struct regulator_init_data *match_init_data(int index) @@ -362,7 +508,7 @@ +static const struct regmap_config pfuze_regmap_config = { + .reg_bits = 8, + .val_bits = 8, -+ .max_register = PFUZE_NUMREGS - 1, ++ .max_register = PFUZE_NUMREGS, + .cache_type = REGCACHE_RBTREE, +}; + @@ -380,7 +526,7 @@ + if (!pfuze_chip) + return -ENOMEM; + -+ i2c_set_clientdata(client, pfuze_chip); ++ dev_set_drvdata(&client->dev, pfuze_chip); + + memcpy(pfuze_chip->regulator_descs, pfuze100_regulators, + sizeof(pfuze_chip->regulator_descs)); @@ -407,11 +553,8 @@ + + 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 @@ -419,11 +562,13 @@ + + /* SW2~SW4 high bit check and modify the voltage value table */ + if (i > PFUZE100_SW1C && i < PFUZE100_SWBST) { -+ regmap_read(pfuze_chip->regmap, desc->vsel_reg, &val); ++ regmap_read(pfuze_chip->regmap, PFUZE100_SW2VOL + ++ (i - PFUZE100_SW2) * 7, &val); + if (val & 0x40) { -+ desc->min_uV = 800000; -+ desc->uV_step = 50000; -+ desc->n_voltages = 51; ++ pfuze_chip->regulator_descs[i].desc.min_uV ++ = 800000; ++ pfuze_chip->regulator_descs[i].desc.uV_step ++ = 50000; + } + } + @@ -432,7 +577,8 @@ + config.driver_data = pfuze_chip; + config.of_node = match_of_node(i); + -+ pfuze_chip->regulators[i] = regulator_register(desc, &config); ++ pfuze_chip->regulators[i] = regulator_register(&pfuze_chip ++ ->regulator_descs[i].desc, &config); + if (IS_ERR(pfuze_chip->regulators[i])) { + dev_err(&client->dev, "register regulator%s failed\n", + pfuze100_regulators[i].desc.name); @@ -449,7 +595,7 @@ +static int pfuze100_regulator_remove(struct i2c_client *client) +{ + int i; -+ struct pfuze_chip *pfuze_chip = i2c_get_clientdata(client); ++ struct pfuze_chip *pfuze_chip = dev_get_drvdata(&client->dev); + + for (i = 0; i < PFUZE100_MAX_REGULATOR; i++) + regulator_unregister(pfuze_chip->regulators[i]); @@ -471,8 +617,7 @@ + +MODULE_AUTHOR("Robin Gong <b38343@freescale.com>"); +MODULE_DESCRIPTION("Regulator Driver for Freescale PFUZE100 PMIC"); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("i2c:pfuze100-regulator"); ++MODULE_ALIAS("pfuze100-regulator"); --- /dev/null +++ b/include/linux/regulator/pfuze100.h @@ -0,0 +1,44 @@ diff --git a/target/linux/imx6/patches-3.10/0020-regulator-pfuze100-REGULATOR_PFUZE100-needs-to-selec.patch b/target/linux/imx6/patches-3.10/0020-regulator-pfuze100-REGULATOR_PFUZE100-needs-to-selec.patch new file mode 100644 index 0000000000..2a9fdff214 --- /dev/null +++ b/target/linux/imx6/patches-3.10/0020-regulator-pfuze100-REGULATOR_PFUZE100-needs-to-selec.patch @@ -0,0 +1,44 @@ +From: Axel Lin <axel.lin@ingics.com> +Subject: [PATCH] regulator: pfuze100: REGULATOR_PFUZE100 needs to select + REGMAP_I2C + +This fixes below build errors: + + CC [M] drivers/regulator/pfuze100-regulator.o +drivers/regulator/pfuze100-regulator.c:342:21: error: variable 'pfuze_regmap_config' has initializer but incomplete type +drivers/regulator/pfuze100-regulator.c:343:2: error: unknown field 'reg_bits' specified in initializer +drivers/regulator/pfuze100-regulator.c:343:2: warning: excess elements in struct initializer [enabled by default] +drivers/regulator/pfuze100-regulator.c:343:2: warning: (near initialization for 'pfuze_regmap_config') [enabled by default] +drivers/regulator/pfuze100-regulator.c:344:2: error: unknown field 'val_bits' specified in initializer +drivers/regulator/pfuze100-regulator.c:344:2: warning: excess elements in struct initializer [enabled by default] +drivers/regulator/pfuze100-regulator.c:344:2: warning: (near initialization for 'pfuze_regmap_config') [enabled by default] +drivers/regulator/pfuze100-regulator.c:345:2: error: unknown field 'max_register' specified in initializer +drivers/regulator/pfuze100-regulator.c:345:2: warning: excess elements in struct initializer [enabled by default] +drivers/regulator/pfuze100-regulator.c:345:2: warning: (near initialization for 'pfuze_regmap_config') [enabled by default] +drivers/regulator/pfuze100-regulator.c:346:2: error: unknown field 'cache_type' specified in initializer +drivers/regulator/pfuze100-regulator.c:346:2: warning: excess elements in struct initializer [enabled by default] +drivers/regulator/pfuze100-regulator.c:346:2: warning: (near initialization for 'pfuze_regmap_config') [enabled by default] +drivers/regulator/pfuze100-regulator.c: In function 'pfuze100_regulator_probe': +drivers/regulator/pfuze100-regulator.c:370:2: error: implicit declaration of function 'devm_regmap_init_i2c' [-Werror=implicit-function-declaration] +drivers/regulator/pfuze100-regulator.c:370:21: warning: assignment makes pointer from integer without a cast [enabled by default] +cc1: some warnings being treated as errors +make[2]: *** [drivers/regulator/pfuze100-regulator.o] Error 1 +make[1]: *** [drivers/regulator] Error 2 +make: *** [drivers] Error 2 + +Signed-off-by: Axel Lin <axel.lin@ingics.com> +Signed-off-by: Mark Brown <broonie@linaro.org> +--- + drivers/regulator/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/regulator/Kconfig ++++ b/drivers/regulator/Kconfig +@@ -303,6 +303,7 @@ config REGULATOR_PCF50633 + config REGULATOR_PFUZE100 + tristate "Support regulators on Freescale PFUZE100 PMIC" + depends on I2C ++ select REGMAP_I2C + help + Say y here to support the regulators found on the Freescale PFUZE100 + PMIC. diff --git a/target/linux/imx6/patches-3.10/0021-regulator-pfuze100-fix-build-warning-and-correct-the.patch b/target/linux/imx6/patches-3.10/0021-regulator-pfuze100-fix-build-warning-and-correct-the.patch new file mode 100644 index 0000000000..488edb6332 --- /dev/null +++ b/target/linux/imx6/patches-3.10/0021-regulator-pfuze100-fix-build-warning-and-correct-the.patch @@ -0,0 +1,35 @@ +From: Robin Gong <b38343@freescale.com> +Subject: [PATCH] regulator:pfuze100: fix build warning and correct the binding + doc + +fix building warning and correct the binding doc + +Signed-off-by: Robin Gong <b38343@freescale.com> +Signed-off-by: Mark Brown <broonie@linaro.org> +--- + Documentation/devicetree/bindings/regulator/pfuze100.txt | 2 ++ + drivers/regulator/pfuze100-regulator.c | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +--- a/Documentation/devicetree/bindings/regulator/pfuze100.txt ++++ b/Documentation/devicetree/bindings/regulator/pfuze100.txt +@@ -3,6 +3,8 @@ PFUZE100 family of regulators + Required properties: + - compatible: "fsl,pfuze100" + - reg: I2C slave address ++ ++Required child node: + - regulators: This is the list of child nodes that specify the regulator + initialization data for defined regulators. Please refer to below doc + Documentation/devicetree/bindings/regulator/regulator.txt. +--- a/drivers/regulator/pfuze100-regulator.c ++++ b/drivers/regulator/pfuze100-regulator.c +@@ -295,7 +295,7 @@ static inline struct device_node *match_ + #else + static int pfuze_parse_regulators_dt(struct pfuze_chip *chip) + { +- return NULL; ++ return 0; + } + + static inline struct regulator_init_data *match_init_data(int index) diff --git a/target/linux/imx6/patches-3.10/0022-regulator-pfuze100-add-MODULE_LICENSE-in-pfuze100-dr.patch b/target/linux/imx6/patches-3.10/0022-regulator-pfuze100-add-MODULE_LICENSE-in-pfuze100-dr.patch new file mode 100644 index 0000000000..dfdefe7394 --- /dev/null +++ b/target/linux/imx6/patches-3.10/0022-regulator-pfuze100-add-MODULE_LICENSE-in-pfuze100-dr.patch @@ -0,0 +1,21 @@ +From: Robin Gong <b38343@freescale.com> +Subject: [PATCH] regulator: pfuze100: add MODULE_LICENSE() in pfuze100 driver + +Fix building error on x86_64 and i386: +WARNING: modpost: missing MODULE_LICENSE() in +drivers/regulator/pfuze100-regulator.o + +Signed-off-by: Robin Gong <b38343@freescale.com> +Signed-off-by: Mark Brown <broonie@linaro.org> +--- + drivers/regulator/pfuze100-regulator.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/regulator/pfuze100-regulator.c ++++ b/drivers/regulator/pfuze100-regulator.c +@@ -451,4 +451,5 @@ module_i2c_driver(pfuze_driver); + + MODULE_AUTHOR("Robin Gong <b38343@freescale.com>"); + MODULE_DESCRIPTION("Regulator Driver for Freescale PFUZE100 PMIC"); ++MODULE_LICENSE("GPL v2"); + MODULE_ALIAS("pfuze100-regulator"); diff --git a/target/linux/imx6/patches-3.10/0023-regulator-pfuze100-Use-i2c_-set-get-_clientdata.patch b/target/linux/imx6/patches-3.10/0023-regulator-pfuze100-Use-i2c_-set-get-_clientdata.patch new file mode 100644 index 0000000000..609ed05b20 --- /dev/null +++ b/target/linux/imx6/patches-3.10/0023-regulator-pfuze100-Use-i2c_-set-get-_clientdata.patch @@ -0,0 +1,32 @@ +From: Axel Lin <axel.lin@ingics.com> +Subject: [PATCH] regulator: pfuze100: Use i2c_[set|get]_clientdata + +Since this is a i2c driver, use i2c_[set|get]_clientdata instead of +dev_[set|get]_drvdata. + +Signed-off-by: Axel Lin <axel.lin@ingics.com> +Signed-off-by: Mark Brown <broonie@linaro.org> +--- + drivers/regulator/pfuze100-regulator.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/regulator/pfuze100-regulator.c ++++ b/drivers/regulator/pfuze100-regulator.c +@@ -360,7 +360,7 @@ static int pfuze100_regulator_probe(stru + if (!pfuze_chip) + return -ENOMEM; + +- dev_set_drvdata(&client->dev, pfuze_chip); ++ i2c_set_clientdata(client, pfuze_chip); + + memcpy(pfuze_chip->regulator_descs, pfuze100_regulators, + sizeof(pfuze_chip->regulator_descs)); +@@ -429,7 +429,7 @@ static int pfuze100_regulator_probe(stru + static int pfuze100_regulator_remove(struct i2c_client *client) + { + int i; +- struct pfuze_chip *pfuze_chip = dev_get_drvdata(&client->dev); ++ struct pfuze_chip *pfuze_chip = i2c_get_clientdata(client); + + for (i = 0; i < PFUZE100_MAX_REGULATOR; i++) + regulator_unregister(pfuze_chip->regulators[i]); diff --git a/target/linux/imx6/patches-3.10/0024-regulator-pfuze100-Fix-module-alias-prefix.patch b/target/linux/imx6/patches-3.10/0024-regulator-pfuze100-Fix-module-alias-prefix.patch new file mode 100644 index 0000000000..41ee1fee01 --- /dev/null +++ b/target/linux/imx6/patches-3.10/0024-regulator-pfuze100-Fix-module-alias-prefix.patch @@ -0,0 +1,19 @@ +From: Axel Lin <axel.lin@ingics.com> +Subject: [PATCH] regulator: pfuze100: Fix module alias prefix + +i2c drivers use "i2c:" prefix for module alias. + +Signed-off-by: Axel Lin <axel.lin@ingics.com> +Signed-off-by: Mark Brown <broonie@linaro.org> +--- + drivers/regulator/pfuze100-regulator.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/regulator/pfuze100-regulator.c ++++ b/drivers/regulator/pfuze100-regulator.c +@@ -452,4 +452,4 @@ module_i2c_driver(pfuze_driver); + MODULE_AUTHOR("Robin Gong <b38343@freescale.com>"); + MODULE_DESCRIPTION("Regulator Driver for Freescale PFUZE100 PMIC"); + MODULE_LICENSE("GPL v2"); +-MODULE_ALIAS("pfuze100-regulator"); ++MODULE_ALIAS("i2c:pfuze100-regulator"); diff --git a/target/linux/imx6/patches-3.10/0025-regulator-pfuze100-Use-regulator_map_voltage_ascend.patch b/target/linux/imx6/patches-3.10/0025-regulator-pfuze100-Use-regulator_map_voltage_ascend.patch new file mode 100644 index 0000000000..0821991cce --- /dev/null +++ b/target/linux/imx6/patches-3.10/0025-regulator-pfuze100-Use-regulator_map_voltage_ascend.patch @@ -0,0 +1,22 @@ +From: Axel Lin <axel.lin@ingics.com> +Subject: [PATCH] regulator: pfuze100: Use regulator_map_voltage_ascend + +All table based voltage list have ascendant order. +Use regulator_map_voltage_ascend for them. + +Signed-off-by: Axel Lin <axel.lin@ingics.com> +Signed-off-by: Mark Brown <broonie@linaro.org> +--- + drivers/regulator/pfuze100-regulator.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/regulator/pfuze100-regulator.c ++++ b/drivers/regulator/pfuze100-regulator.c +@@ -144,6 +144,7 @@ static struct regulator_ops pfuze100_sw_ + + static struct regulator_ops pfuze100_swb_regulator_ops = { + .list_voltage = regulator_list_voltage_table, ++ .map_voltage = regulator_map_voltage_ascend, + .set_voltage_sel = regulator_set_voltage_sel_regmap, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + 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); diff --git a/target/linux/imx6/patches-3.10/0027-regulator-pfuze100-Simplify-pfuze100_set_ramp_delay-.patch b/target/linux/imx6/patches-3.10/0027-regulator-pfuze100-Simplify-pfuze100_set_ramp_delay-.patch new file mode 100644 index 0000000000..1089dffba2 --- /dev/null +++ b/target/linux/imx6/patches-3.10/0027-regulator-pfuze100-Simplify-pfuze100_set_ramp_delay-.patch @@ -0,0 +1,56 @@ +From: Axel Lin <axel.lin@ingics.com> +Subject: [PATCH] regulator: pfuze100: Simplify pfuze100_set_ramp_delay + implementation + +Simplify the equation to calculate ramp_delay. +Below equations are equivalent: + ramp_delay = 25000 / (2 * ramp_delay); + ramp_delay = 50000 / (4 * ramp_delay); + ramp_delay = 25000 / (2 * ramp_delay); + ramp_delay = 12500 / ramp_delay; +So we don't need to read BIT6 of rdev->desc->vsel_reg for applying different +equations. + +Also use rdev->desc->vsel_reg instead of run-time calculate register address. + +Signed-off-by: Axel Lin <axel.lin@ingics.com> +Reviewed-by: Robin Gong <b38343@freescale.com> +Signed-off-by: Mark Brown <broonie@linaro.org> +--- + drivers/regulator/pfuze100-regulator.c | 21 +++++---------------- + 1 file changed, 5 insertions(+), 16 deletions(-) + +--- a/drivers/regulator/pfuze100-regulator.c ++++ b/drivers/regulator/pfuze100-regulator.c +@@ -93,26 +93,15 @@ static int pfuze100_set_ramp_delay(struc + { + struct pfuze_chip *pfuze100 = rdev_get_drvdata(rdev); + int id = rdev->desc->id; +- unsigned int val, ramp_bits, reg; ++ unsigned int ramp_bits; + int ret; + + if (id < PFUZE100_SWBST) { +- if (id == PFUZE100_SW1AB) +- reg = PFUZE100_SW1ABVOL; +- else +- reg = PFUZE100_SW1CVOL + (id - PFUZE100_SW1C) * 7; +- regmap_read(pfuze100->regmap, reg, &val); +- +- if (id <= PFUZE100_SW1C) +- ramp_delay = 25000 / (2 * ramp_delay); +- else if (val & 0x40) +- ramp_delay = 50000 / (4 * ramp_delay); +- else +- ramp_delay = 25000 / (2 * ramp_delay); +- ++ ramp_delay = 12500 / ramp_delay; + ramp_bits = (ramp_delay >> 1) - (ramp_delay >> 3); +- ret = regmap_update_bits(pfuze100->regmap, reg + 4 , 0xc0, +- ramp_bits << 6); ++ ret = regmap_update_bits(pfuze100->regmap, ++ rdev->desc->vsel_reg + 4, ++ 0xc0, ramp_bits << 6); + if (ret < 0) + dev_err(pfuze100->dev, "ramp failed, err %d\n", ret); + } else diff --git a/target/linux/imx6/patches-3.10/0028-regulator-pfuze100-Fix-off-by-one-for-max_register-s.patch b/target/linux/imx6/patches-3.10/0028-regulator-pfuze100-Fix-off-by-one-for-max_register-s.patch new file mode 100644 index 0000000000..34ff796e83 --- /dev/null +++ b/target/linux/imx6/patches-3.10/0028-regulator-pfuze100-Fix-off-by-one-for-max_register-s.patch @@ -0,0 +1,23 @@ +From: Axel Lin <axel.lin@ingics.com> +Subject: [PATCH] regulator: pfuze100: Fix off-by-one for max_register setting + +max_register should be register count - 1. + +Signed-off-by: Axel Lin <axel.lin@ingics.com> +Reviewed-by: Robin Gong <b38343@freescale.com> +Signed-off-by: Mark Brown <broonie@linaro.org> +--- + drivers/regulator/pfuze100-regulator.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/regulator/pfuze100-regulator.c ++++ b/drivers/regulator/pfuze100-regulator.c +@@ -332,7 +332,7 @@ static int pfuze_identify(struct pfuze_c + static const struct regmap_config pfuze_regmap_config = { + .reg_bits = 8, + .val_bits = 8, +- .max_register = PFUZE_NUMREGS, ++ .max_register = PFUZE_NUMREGS - 1, + .cache_type = REGCACHE_RBTREE, + }; + diff --git a/target/linux/imx6/patches-3.10/0021-pfuze100-allow-misprogrammed-id.patch b/target/linux/imx6/patches-3.10/0029-pfuze100-allow-misprogrammed-id.patch index a9399a9297..a9399a9297 100644 --- a/target/linux/imx6/patches-3.10/0021-pfuze100-allow-misprogrammed-id.patch +++ b/target/linux/imx6/patches-3.10/0029-pfuze100-allow-misprogrammed-id.patch diff --git a/target/linux/imx6/patches-3.10/0034-PCI-imx6-swizzle-interrupts.patch b/target/linux/imx6/patches-3.10/0034-PCI-imx6-swizzle-interrupts.patch index 775bc78179..d716fe4b6e 100644 --- a/target/linux/imx6/patches-3.10/0034-PCI-imx6-swizzle-interrupts.patch +++ b/target/linux/imx6/patches-3.10/0034-PCI-imx6-swizzle-interrupts.patch @@ -1,6 +1,4 @@ -From 73a0e49b562da9b06e487fb8e051075543495be5 Mon Sep 17 00:00:00 2001 From: Tim Harvey <tharvey@gateworks.com> -Date: Thu, 17 Oct 2013 15:50:48 -0700 Subject: [PATCH 1/5] PCI: imx6: swizzle interrupts @@ -11,7 +9,7 @@ Signed-off-by: Tim Harvey <tharvey@gateworks.com> --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c -@@ -676,7 +676,13 @@ int dw_pcie_map_irq(const struct pci_dev +@@ -447,7 +447,13 @@ int dw_pcie_map_irq(const struct pci_dev { struct pcie_port *pp = sys_to_pcie(dev->bus->sysdata); @@ -25,4 +23,4 @@ Signed-off-by: Tim Harvey <tharvey@gateworks.com> + } } - static void dw_pcie_add_bus(struct pci_bus *bus) + static struct hw_pci dw_pci = { |