* Applied "regulator: axp20x: support AXP809 variant" to the regulator tree @ 2016-03-29 16:55 Mark Brown 2016-03-29 17:19 ` kbuild test robot 2016-03-29 19:09 ` kbuild test robot 0 siblings, 2 replies; 5+ messages in thread From: Mark Brown @ 2016-03-29 16:55 UTC (permalink / raw) To: Chen-Yu Tsai, Mark Brown; +Cc: linux-kernel The patch regulator: axp20x: support AXP809 variant has been applied to the regulator tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 6387990e059d2a30b2c668bfa7e06f8922cf7483 Mon Sep 17 00:00:00 2001 From: Chen-Yu Tsai <wens@csie.org> Date: Tue, 29 Mar 2016 17:22:27 +0800 Subject: [PATCH] regulator: axp20x: support AXP809 variant The X-Powers AXP809 PMIC has a similar set of regulators as the AXP221, though a few LDOs were removed, and a new switch output added. Like the AXP221, AXP809 also has DC1SW and DC5LDO, which are internally chained to DCDC1 and DCDC5, respectively. Add support for this new variant. Also remove the "axp22x_" prefix from DC1SW/DC5LDO supply handling code, as the AXP809 uses it as well. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Mark Brown <broonie@kernel.org> --- drivers/regulator/axp20x-regulator.c | 119 ++++++++++++++++++++++++++--------- 1 file changed, 90 insertions(+), 29 deletions(-) diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c index 40cd894e4df5..6a601f377019 100644 --- a/drivers/regulator/axp20x-regulator.c +++ b/drivers/regulator/axp20x-regulator.c @@ -224,6 +224,61 @@ static const struct regulator_desc axp22x_regulators[] = { AXP_DESC_FIXED(AXP22X, RTC_LDO, "rtc_ldo", "ips", 3000), }; +static const struct regulator_linear_range axp809_dcdc4_ranges[] = { + REGULATOR_LINEAR_RANGE(600000, 0x0, 0x2f, 20000), + REGULATOR_LINEAR_RANGE(1800000, 0x30, 0x38, 100000), +}; + +static const struct regulator_linear_range axp809_dldo1_ranges[] = { + REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000), + REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000), +}; + +static const struct regulator_desc axp809_regulators[] = { + AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100, + AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(1)), + AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20, + AXP22X_DCDC2_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(2)), + AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20, + AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)), + AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", axp809_dcdc4_ranges, + 57, AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, + BIT(4)), + AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50, + AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)), + /* secondary switchable output of DCDC1 */ + AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2, + BIT(7)), + /* LDO regulator internally chained to DCDC5 */ + AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100, + AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)), + AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100, + AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(6)), + AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100, + AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)), + AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100, + AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)), + AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges, + 32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, + BIT(3)), + AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100, + AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(4)), + AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100, + AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)), + AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100, + AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)), + AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100, + AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)), + AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100, + AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07, + AXP22X_IO_ENABLED, AXP22X_IO_DISABLED), + AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100, + AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07, + AXP22X_IO_ENABLED, AXP22X_IO_DISABLED), + AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800), + AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)), +}; + static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) { struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); @@ -239,6 +294,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) break; case AXP221_ID: case AXP223_ID: + case AXP809_ID: min = 1800; max = 4050; def = 3000; @@ -318,6 +374,7 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work case AXP221_ID: case AXP223_ID: + case AXP809_ID: if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5) return -EINVAL; @@ -346,8 +403,8 @@ static int axp20x_regulator_probe(struct platform_device *pdev) }; int ret, i, nregulators; u32 workmode; - const char *axp22x_dc1_name = axp22x_regulators[AXP22X_DCDC1].name; - const char *axp22x_dc5_name = axp22x_regulators[AXP22X_DCDC5].name; + const char *dcdc1_name = axp22x_regulators[AXP22X_DCDC1].name; + const char *dcdc5_name = axp22x_regulators[AXP22X_DCDC5].name; switch (axp20x->variant) { case AXP202_ID: @@ -360,6 +417,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev) regulators = axp22x_regulators; nregulators = AXP22X_REG_ID_MAX; break; + case AXP809_ID: + regulators = axp809_regulators; + nregulators = AXP809_REG_ID_MAX; + break; default: dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n", axp20x->variant); @@ -382,22 +443,22 @@ static int axp20x_regulator_probe(struct platform_device *pdev) * part of this loop to see where we save the DT defined * name. */ - if (regulators == axp22x_regulators) { - if (i == AXP22X_DC1SW) { - new_desc = devm_kzalloc(&pdev->dev, - sizeof(*desc), - GFP_KERNEL); - *new_desc = regulators[i]; - new_desc->supply_name = axp22x_dc1_name; - desc = new_desc; - } else if (i == AXP22X_DC5LDO) { - new_desc = devm_kzalloc(&pdev->dev, - sizeof(*desc), - GFP_KERNEL); - *new_desc = regulators[i]; - new_desc->supply_name = axp22x_dc5_name; - desc = new_desc; - } + if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) || + (regulators == axp809_regulators && i == AXP809_DC1SW)) { + new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc), + GFP_KERNEL); + *new_desc = regulators[i]; + new_desc->supply_name = dcdc1_name; + desc = new_desc; + } + + if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) || + (regulators == axp809_regulators && i == AXP809_DC5LDO)) { + new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc), + GFP_KERNEL); + *new_desc = regulators[i]; + new_desc->supply_name = dcdc5_name; + desc = new_desc; } rdev = devm_regulator_register(&pdev->dev, desc, &config); @@ -420,17 +481,17 @@ static int axp20x_regulator_probe(struct platform_device *pdev) /* * Save AXP22X DCDC1 / DCDC5 regulator names for later. */ - if (regulators == axp22x_regulators) { - /* Can we use rdev->constraints->name instead? */ - if (i == AXP22X_DCDC1) - of_property_read_string(rdev->dev.of_node, - "regulator-name", - &axp22x_dc1_name); - else if (i == AXP22X_DCDC5) - of_property_read_string(rdev->dev.of_node, - "regulator-name", - &axp22x_dc5_name); - } + if ((regulators == axp22x_regulators && i == AXP22X_DCDC1) || + (regulators == axp809_regulators && i == AXP809_DCDC1)) + of_property_read_string(rdev->dev.of_node, + "regulator-name", + &dcdc1_name); + + if ((regulators == axp22x_regulators && i == AXP22X_DCDC5) || + (regulators == axp809_regulators && i == AXP809_DCDC5)) + of_property_read_string(rdev->dev.of_node, + "regulator-name", + &dcdc5_name); } return 0; -- 2.8.0.rc3 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: Applied "regulator: axp20x: support AXP809 variant" to the regulator tree 2016-03-29 16:55 Applied "regulator: axp20x: support AXP809 variant" to the regulator tree Mark Brown @ 2016-03-29 17:19 ` kbuild test robot 2016-03-29 17:24 ` Mark Brown 2016-03-29 19:09 ` kbuild test robot 1 sibling, 1 reply; 5+ messages in thread From: kbuild test robot @ 2016-03-29 17:19 UTC (permalink / raw) To: Mark Brown; +Cc: kbuild-all, Chen-Yu Tsai, Mark Brown, linux-kernel [-- Attachment #1: Type: text/plain, Size: 28822 bytes --] Hi Mark, [auto build test ERROR on regulator/for-next] [also build test ERROR on v4.6-rc1 next-20160329] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Mark-Brown/Applied-regulator-axp20x-support-AXP809-variant-to-the-regulator-tree/20160330-005751 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next config: sparc64-allmodconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=sparc64 All error/warnings (new ones prefixed by >>): >> drivers/regulator/axp20x-regulator.c:238:11: error: 'AXP809_DCDC1' undeclared here (not in a function) AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100, ^ drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC' [_family##_##_id] = { \ ^ >> drivers/regulator/axp20x-regulator.c:238:2: error: array index in initializer not of integer type AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100, ^ drivers/regulator/axp20x-regulator.c:238:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:240:11: error: 'AXP809_DCDC2' undeclared here (not in a function) AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20, ^ drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:240:2: error: array index in initializer not of integer type AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20, ^ drivers/regulator/axp20x-regulator.c:240:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:242:11: error: 'AXP809_DCDC3' undeclared here (not in a function) AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20, ^ drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:242:2: error: array index in initializer not of integer type AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20, ^ drivers/regulator/axp20x-regulator.c:242:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:244:18: error: 'AXP809_DCDC4' undeclared here (not in a function) AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", axp809_dcdc4_ranges, ^ drivers/regulator/axp20x-regulator.c:111:3: note: in definition of macro 'AXP_DESC_RANGES' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:244:2: error: array index in initializer not of integer type AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", axp809_dcdc4_ranges, ^ drivers/regulator/axp20x-regulator.c:244:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:247:11: error: 'AXP809_DCDC5' undeclared here (not in a function) AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50, ^ drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:247:2: error: array index in initializer not of integer type AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50, ^ drivers/regulator/axp20x-regulator.c:247:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:250:14: error: 'AXP809_DC1SW' undeclared here (not in a function) AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2, ^ drivers/regulator/axp20x-regulator.c:82:3: note: in definition of macro 'AXP_DESC_SW' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:250:2: error: array index in initializer not of integer type AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2, ^ drivers/regulator/axp20x-regulator.c:250:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:253:11: error: 'AXP809_DC5LDO' undeclared here (not in a function) AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100, ^ drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:253:2: error: array index in initializer not of integer type AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100, ^ drivers/regulator/axp20x-regulator.c:253:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:255:11: error: 'AXP809_ALDO1' undeclared here (not in a function) AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:255:2: error: array index in initializer not of integer type AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:255:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:257:11: error: 'AXP809_ALDO2' undeclared here (not in a function) AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:257:2: error: array index in initializer not of integer type AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:257:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:259:11: error: 'AXP809_ALDO3' undeclared here (not in a function) AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:259:2: error: array index in initializer not of integer type AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:259:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:261:18: error: 'AXP809_DLDO1' undeclared here (not in a function) AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges, ^ drivers/regulator/axp20x-regulator.c:111:3: note: in definition of macro 'AXP_DESC_RANGES' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:261:2: error: array index in initializer not of integer type AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges, ^ drivers/regulator/axp20x-regulator.c:261:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:264:11: error: 'AXP809_DLDO2' undeclared here (not in a function) AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:264:2: error: array index in initializer not of integer type AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:264:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:266:11: error: 'AXP809_ELDO1' undeclared here (not in a function) AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:266:2: error: array index in initializer not of integer type AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:266:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:268:11: error: 'AXP809_ELDO2' undeclared here (not in a function) AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:268:2: error: array index in initializer not of integer type AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:268:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:270:11: error: 'AXP809_ELDO3' undeclared here (not in a function) AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:270:2: error: array index in initializer not of integer type AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:270:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:272:14: error: 'AXP809_LDO_IO0' undeclared here (not in a function) AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:272:2: error: array index in initializer not of integer type AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:272:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:275:14: error: 'AXP809_LDO_IO1' undeclared here (not in a function) AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:275:2: error: array index in initializer not of integer type AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:275:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:278:17: error: 'AXP809_RTC_LDO' undeclared here (not in a function) AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800), ^ drivers/regulator/axp20x-regulator.c:96:3: note: in definition of macro 'AXP_DESC_FIXED' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:278:2: error: array index in initializer not of integer type AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800), ^ drivers/regulator/axp20x-regulator.c:278:2: error: (near initialization for 'axp809_regulators') >> drivers/regulator/axp20x-regulator.c:279:14: error: 'AXP809_SW' undeclared here (not in a function) AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)), ^ drivers/regulator/axp20x-regulator.c:82:3: note: in definition of macro 'AXP_DESC_SW' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:279:2: error: array index in initializer not of integer type AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)), ^ drivers/regulator/axp20x-regulator.c:279:2: error: (near initialization for 'axp809_regulators') drivers/regulator/axp20x-regulator.c: In function 'axp20x_set_dcdc_freq': vim +/AXP809_DCDC1 +238 drivers/regulator/axp20x-regulator.c 35 #define AXP22X_WORKMODE_DCDCX_MASK(x) BIT(x) 36 37 #define AXP20X_FREQ_DCDC_MASK 0x0f 38 39 #define AXP_DESC_IO(_family, _id, _match, _supply, _min, _max, _step, _vreg, \ 40 _vmask, _ereg, _emask, _enable_val, _disable_val) \ > 41 [_family##_##_id] = { \ 42 .name = (_match), \ 43 .supply_name = (_supply), \ 44 .of_match = of_match_ptr(_match), \ 45 .regulators_node = of_match_ptr("regulators"), \ 46 .type = REGULATOR_VOLTAGE, \ 47 .id = _family##_##_id, \ 48 .n_voltages = (((_max) - (_min)) / (_step) + 1), \ 49 .owner = THIS_MODULE, \ 50 .min_uV = (_min) * 1000, \ 51 .uV_step = (_step) * 1000, \ 52 .vsel_reg = (_vreg), \ 53 .vsel_mask = (_vmask), \ 54 .enable_reg = (_ereg), \ 55 .enable_mask = (_emask), \ 56 .enable_val = (_enable_val), \ 57 .disable_val = (_disable_val), \ 58 .ops = &axp20x_ops, \ 59 } 60 61 #define AXP_DESC(_family, _id, _match, _supply, _min, _max, _step, _vreg, \ 62 _vmask, _ereg, _emask) \ > 63 [_family##_##_id] = { \ 64 .name = (_match), \ 65 .supply_name = (_supply), \ 66 .of_match = of_match_ptr(_match), \ 67 .regulators_node = of_match_ptr("regulators"), \ 68 .type = REGULATOR_VOLTAGE, \ 69 .id = _family##_##_id, \ 70 .n_voltages = (((_max) - (_min)) / (_step) + 1), \ 71 .owner = THIS_MODULE, \ 72 .min_uV = (_min) * 1000, \ 73 .uV_step = (_step) * 1000, \ 74 .vsel_reg = (_vreg), \ 75 .vsel_mask = (_vmask), \ 76 .enable_reg = (_ereg), \ 77 .enable_mask = (_emask), \ 78 .ops = &axp20x_ops, \ 79 } 80 81 #define AXP_DESC_SW(_family, _id, _match, _supply, _ereg, _emask) \ > 82 [_family##_##_id] = { \ 83 .name = (_match), \ 84 .supply_name = (_supply), \ 85 .of_match = of_match_ptr(_match), \ 86 .regulators_node = of_match_ptr("regulators"), \ 87 .type = REGULATOR_VOLTAGE, \ 88 .id = _family##_##_id, \ 89 .owner = THIS_MODULE, \ 90 .enable_reg = (_ereg), \ 91 .enable_mask = (_emask), \ 92 .ops = &axp20x_ops_sw, \ 93 } 94 95 #define AXP_DESC_FIXED(_family, _id, _match, _supply, _volt) \ > 96 [_family##_##_id] = { \ 97 .name = (_match), \ 98 .supply_name = (_supply), \ 99 .of_match = of_match_ptr(_match), \ 100 .regulators_node = of_match_ptr("regulators"), \ 101 .type = REGULATOR_VOLTAGE, \ 102 .id = _family##_##_id, \ 103 .n_voltages = 1, \ 104 .owner = THIS_MODULE, \ 105 .min_uV = (_volt) * 1000, \ 106 .ops = &axp20x_ops_fixed \ 107 } 108 109 #define AXP_DESC_RANGES(_family, _id, _match, _supply, _ranges, _n_voltages, \ 110 _vreg, _vmask, _ereg, _emask) \ > 111 [_family##_##_id] = { \ 112 .name = (_match), \ 113 .supply_name = (_supply), \ 114 .of_match = of_match_ptr(_match), \ 115 .regulators_node = of_match_ptr("regulators"), \ 116 .type = REGULATOR_VOLTAGE, \ 117 .id = _family##_##_id, \ 118 .n_voltages = (_n_voltages), \ 119 .owner = THIS_MODULE, \ 120 .vsel_reg = (_vreg), \ 121 .vsel_mask = (_vmask), \ 122 .enable_reg = (_ereg), \ 123 .enable_mask = (_emask), \ 124 .linear_ranges = (_ranges), \ 125 .n_linear_ranges = ARRAY_SIZE(_ranges), \ 126 .ops = &axp20x_ops_range, \ 127 } 128 129 static struct regulator_ops axp20x_ops_fixed = { 130 .list_voltage = regulator_list_voltage_linear, 131 }; 132 133 static struct regulator_ops axp20x_ops_range = { 134 .set_voltage_sel = regulator_set_voltage_sel_regmap, 135 .get_voltage_sel = regulator_get_voltage_sel_regmap, 136 .list_voltage = regulator_list_voltage_linear_range, 137 .enable = regulator_enable_regmap, 138 .disable = regulator_disable_regmap, 139 .is_enabled = regulator_is_enabled_regmap, 140 }; 141 142 static struct regulator_ops axp20x_ops = { 143 .set_voltage_sel = regulator_set_voltage_sel_regmap, 144 .get_voltage_sel = regulator_get_voltage_sel_regmap, 145 .list_voltage = regulator_list_voltage_linear, 146 .enable = regulator_enable_regmap, 147 .disable = regulator_disable_regmap, 148 .is_enabled = regulator_is_enabled_regmap, 149 }; 150 151 static struct regulator_ops axp20x_ops_sw = { 152 .enable = regulator_enable_regmap, 153 .disable = regulator_disable_regmap, 154 .is_enabled = regulator_is_enabled_regmap, 155 }; 156 157 static const struct regulator_linear_range axp20x_ldo4_ranges[] = { 158 REGULATOR_LINEAR_RANGE(1250000, 0x0, 0x0, 0), 159 REGULATOR_LINEAR_RANGE(1300000, 0x1, 0x8, 100000), 160 REGULATOR_LINEAR_RANGE(2500000, 0x9, 0xf, 100000), 161 }; 162 163 static const struct regulator_desc axp20x_regulators[] = { 164 AXP_DESC(AXP20X, DCDC2, "dcdc2", "vin2", 700, 2275, 25, 165 AXP20X_DCDC2_V_OUT, 0x3f, AXP20X_PWR_OUT_CTRL, 0x10), 166 AXP_DESC(AXP20X, DCDC3, "dcdc3", "vin3", 700, 3500, 25, 167 AXP20X_DCDC3_V_OUT, 0x7f, AXP20X_PWR_OUT_CTRL, 0x02), 168 AXP_DESC_FIXED(AXP20X, LDO1, "ldo1", "acin", 1300), 169 AXP_DESC(AXP20X, LDO2, "ldo2", "ldo24in", 1800, 3300, 100, 170 AXP20X_LDO24_V_OUT, 0xf0, AXP20X_PWR_OUT_CTRL, 0x04), 171 AXP_DESC(AXP20X, LDO3, "ldo3", "ldo3in", 700, 3500, 25, 172 AXP20X_LDO3_V_OUT, 0x7f, AXP20X_PWR_OUT_CTRL, 0x40), 173 AXP_DESC_RANGES(AXP20X, LDO4, "ldo4", "ldo24in", axp20x_ldo4_ranges, 174 16, AXP20X_LDO24_V_OUT, 0x0f, AXP20X_PWR_OUT_CTRL, 175 0x08), 176 AXP_DESC_IO(AXP20X, LDO5, "ldo5", "ldo5in", 1800, 3300, 100, 177 AXP20X_LDO5_V_OUT, 0xf0, AXP20X_GPIO0_CTRL, 0x07, 178 AXP20X_IO_ENABLED, AXP20X_IO_DISABLED), 179 }; 180 181 static const struct regulator_desc axp22x_regulators[] = { 182 AXP_DESC(AXP22X, DCDC1, "dcdc1", "vin1", 1600, 3400, 100, 183 AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(1)), 184 AXP_DESC(AXP22X, DCDC2, "dcdc2", "vin2", 600, 1540, 20, 185 AXP22X_DCDC2_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(2)), 186 AXP_DESC(AXP22X, DCDC3, "dcdc3", "vin3", 600, 1860, 20, 187 AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)), 188 AXP_DESC(AXP22X, DCDC4, "dcdc4", "vin4", 600, 1540, 20, 189 AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(4)), 190 AXP_DESC(AXP22X, DCDC5, "dcdc5", "vin5", 1000, 2550, 50, 191 AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)), 192 /* secondary switchable output of DCDC1 */ 193 AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2, 194 BIT(7)), 195 /* LDO regulator internally chained to DCDC5 */ 196 AXP_DESC(AXP22X, DC5LDO, "dc5ldo", NULL, 700, 1400, 100, 197 AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)), 198 AXP_DESC(AXP22X, ALDO1, "aldo1", "aldoin", 700, 3300, 100, 199 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(6)), 200 AXP_DESC(AXP22X, ALDO2, "aldo2", "aldoin", 700, 3300, 100, 201 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)), 202 AXP_DESC(AXP22X, ALDO3, "aldo3", "aldoin", 700, 3300, 100, 203 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(7)), 204 AXP_DESC(AXP22X, DLDO1, "dldo1", "dldoin", 700, 3300, 100, 205 AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(3)), 206 AXP_DESC(AXP22X, DLDO2, "dldo2", "dldoin", 700, 3300, 100, 207 AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(4)), 208 AXP_DESC(AXP22X, DLDO3, "dldo3", "dldoin", 700, 3300, 100, 209 AXP22X_DLDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)), 210 AXP_DESC(AXP22X, DLDO4, "dldo4", "dldoin", 700, 3300, 100, 211 AXP22X_DLDO4_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(6)), 212 AXP_DESC(AXP22X, ELDO1, "eldo1", "eldoin", 700, 3300, 100, 213 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)), 214 AXP_DESC(AXP22X, ELDO2, "eldo2", "eldoin", 700, 3300, 100, 215 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)), 216 AXP_DESC(AXP22X, ELDO3, "eldo3", "eldoin", 700, 3300, 100, 217 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)), 218 AXP_DESC_IO(AXP22X, LDO_IO0, "ldo_io0", "ips", 1800, 3300, 100, 219 AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07, 220 AXP22X_IO_ENABLED, AXP22X_IO_DISABLED), 221 AXP_DESC_IO(AXP22X, LDO_IO1, "ldo_io1", "ips", 1800, 3300, 100, 222 AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07, 223 AXP22X_IO_ENABLED, AXP22X_IO_DISABLED), 224 AXP_DESC_FIXED(AXP22X, RTC_LDO, "rtc_ldo", "ips", 3000), 225 }; 226 227 static const struct regulator_linear_range axp809_dcdc4_ranges[] = { 228 REGULATOR_LINEAR_RANGE(600000, 0x0, 0x2f, 20000), 229 REGULATOR_LINEAR_RANGE(1800000, 0x30, 0x38, 100000), 230 }; 231 232 static const struct regulator_linear_range axp809_dldo1_ranges[] = { 233 REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000), 234 REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000), 235 }; 236 237 static const struct regulator_desc axp809_regulators[] = { > 238 AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100, 239 AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(1)), > 240 AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20, 241 AXP22X_DCDC2_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(2)), > 242 AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20, 243 AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)), > 244 AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", axp809_dcdc4_ranges, 245 57, AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, 246 BIT(4)), > 247 AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50, 248 AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)), 249 /* secondary switchable output of DCDC1 */ > 250 AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2, 251 BIT(7)), 252 /* LDO regulator internally chained to DCDC5 */ > 253 AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100, 254 AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)), > 255 AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100, 256 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(6)), > 257 AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100, 258 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)), > 259 AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100, 260 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)), > 261 AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges, 262 32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, 263 BIT(3)), > 264 AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100, 265 AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(4)), > 266 AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100, 267 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)), > 268 AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100, 269 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)), > 270 AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100, 271 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)), > 272 AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100, 273 AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07, 274 AXP22X_IO_ENABLED, AXP22X_IO_DISABLED), > 275 AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100, 276 AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07, 277 AXP22X_IO_ENABLED, AXP22X_IO_DISABLED), > 278 AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800), > 279 AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)), 280 }; 281 282 static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) 283 { 284 struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); 285 u32 min, max, def, step; 286 287 switch (axp20x->variant) { 288 case AXP202_ID: 289 case AXP209_ID: 290 min = 750; 291 max = 1875; 292 def = 1500; 293 step = 75; 294 break; 295 case AXP221_ID: 296 case AXP223_ID: > 297 case AXP809_ID: 298 min = 1800; 299 max = 4050; 300 def = 3000; 301 step = 150; 302 break; 303 default: 304 dev_err(&pdev->dev, 305 "Setting DCDC frequency for unsupported AXP variant\n"); 306 return -EINVAL; 307 } 308 309 if (dcdcfreq == 0) 310 dcdcfreq = def; 311 312 if (dcdcfreq < min) { 313 dcdcfreq = min; 314 dev_warn(&pdev->dev, "DCDC frequency too low. Set to %ukHz\n", 315 min); 316 } 317 318 if (dcdcfreq > max) { 319 dcdcfreq = max; 320 dev_warn(&pdev->dev, "DCDC frequency too high. Set to %ukHz\n", 321 max); 322 } 323 324 dcdcfreq = (dcdcfreq - min) / step; 325 326 return regmap_update_bits(axp20x->regmap, AXP20X_DCDC_FREQ, 327 AXP20X_FREQ_DCDC_MASK, dcdcfreq); 328 } 329 330 static int axp20x_regulator_parse_dt(struct platform_device *pdev) 331 { 332 struct device_node *np, *regulators; 333 int ret; 334 u32 dcdcfreq = 0; 335 336 np = of_node_get(pdev->dev.parent->of_node); 337 if (!np) 338 return 0; 339 340 regulators = of_get_child_by_name(np, "regulators"); 341 if (!regulators) { 342 dev_warn(&pdev->dev, "regulators node not found\n"); 343 } else { 344 of_property_read_u32(regulators, "x-powers,dcdc-freq", &dcdcfreq); 345 ret = axp20x_set_dcdc_freq(pdev, dcdcfreq); 346 if (ret < 0) { 347 dev_err(&pdev->dev, "Error setting dcdc frequency: %d\n", ret); 348 return ret; 349 } 350 351 of_node_put(regulators); 352 } 353 354 return 0; 355 } 356 357 static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 workmode) 358 { 359 struct axp20x_dev *axp20x = rdev_get_drvdata(rdev); 360 unsigned int mask; 361 362 switch (axp20x->variant) { 363 case AXP202_ID: 364 case AXP209_ID: 365 if ((id != AXP20X_DCDC2) && (id != AXP20X_DCDC3)) 366 return -EINVAL; 367 368 mask = AXP20X_WORKMODE_DCDC2_MASK; 369 if (id == AXP20X_DCDC3) 370 mask = AXP20X_WORKMODE_DCDC3_MASK; 371 372 workmode <<= ffs(mask) - 1; 373 break; 374 375 case AXP221_ID: 376 case AXP223_ID: 377 case AXP809_ID: 378 if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5) 379 return -EINVAL; 380 381 mask = AXP22X_WORKMODE_DCDCX_MASK(id - AXP22X_DCDC1); 382 workmode <<= id - AXP22X_DCDC1; 383 break; 384 385 default: 386 /* should not happen */ 387 WARN_ON(1); 388 return -EINVAL; 389 } 390 391 return regmap_update_bits(rdev->regmap, AXP20X_DCDC_MODE, mask, workmode); 392 } 393 394 static int axp20x_regulator_probe(struct platform_device *pdev) 395 { 396 struct regulator_dev *rdev; 397 struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); 398 const struct regulator_desc *regulators; 399 struct regulator_config config = { 400 .dev = pdev->dev.parent, 401 .regmap = axp20x->regmap, 402 .driver_data = axp20x, 403 }; 404 int ret, i, nregulators; 405 u32 workmode; 406 const char *dcdc1_name = axp22x_regulators[AXP22X_DCDC1].name; 407 const char *dcdc5_name = axp22x_regulators[AXP22X_DCDC5].name; 408 409 switch (axp20x->variant) { 410 case AXP202_ID: 411 case AXP209_ID: 412 regulators = axp20x_regulators; 413 nregulators = AXP20X_REG_ID_MAX; 414 break; 415 case AXP221_ID: 416 case AXP223_ID: 417 regulators = axp22x_regulators; 418 nregulators = AXP22X_REG_ID_MAX; 419 break; > 420 case AXP809_ID: 421 regulators = axp809_regulators; > 422 nregulators = AXP809_REG_ID_MAX; 423 break; 424 default: 425 dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n", --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/octet-stream, Size: 45793 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Applied "regulator: axp20x: support AXP809 variant" to the regulator tree 2016-03-29 17:19 ` kbuild test robot @ 2016-03-29 17:24 ` Mark Brown 0 siblings, 0 replies; 5+ messages in thread From: Mark Brown @ 2016-03-29 17:24 UTC (permalink / raw) To: kbuild test robot; +Cc: kbuild-all, Chen-Yu Tsai, linux-kernel [-- Attachment #1: Type: text/plain, Size: 338 bytes --] On Wed, Mar 30, 2016 at 01:19:45AM +0800, kbuild test robot wrote: > Hi Mark, > > [auto build test ERROR on regulator/for-next] > [also build test ERROR on v4.6-rc1 next-20160329] > [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] This was pushed by mistake, I've dropped it. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Applied "regulator: axp20x: support AXP809 variant" to the regulator tree 2016-03-29 16:55 Applied "regulator: axp20x: support AXP809 variant" to the regulator tree Mark Brown 2016-03-29 17:19 ` kbuild test robot @ 2016-03-29 19:09 ` kbuild test robot 1 sibling, 0 replies; 5+ messages in thread From: kbuild test robot @ 2016-03-29 19:09 UTC (permalink / raw) To: Mark Brown; +Cc: kbuild-all, Chen-Yu Tsai, Mark Brown, linux-kernel [-- Attachment #1: Type: text/plain, Size: 13383 bytes --] Hi Mark, [auto build test WARNING on regulator/for-next] [also build test WARNING on v4.6-rc1 next-20160329] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Mark-Brown/Applied-regulator-axp20x-support-AXP809-variant-to-the-regulator-tree/20160330-005751 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next config: x86_64-randconfig-n0-03300206 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): ^ drivers/regulator/axp20x-regulator.c:272:14: error: 'AXP809_LDO_IO0' undeclared here (not in a function) AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:272:14: error: array index in initializer not of integer type AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:272:14: note: (near initialization for 'axp809_regulators') AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:275:14: error: 'AXP809_LDO_IO1' undeclared here (not in a function) AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:275:14: error: array index in initializer not of integer type AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:275:14: note: (near initialization for 'axp809_regulators') AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100, ^ drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:278:17: error: 'AXP809_RTC_LDO' undeclared here (not in a function) AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800), ^ drivers/regulator/axp20x-regulator.c:96:3: note: in definition of macro 'AXP_DESC_FIXED' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:278:17: error: array index in initializer not of integer type AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800), ^ drivers/regulator/axp20x-regulator.c:96:3: note: in definition of macro 'AXP_DESC_FIXED' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:278:17: note: (near initialization for 'axp809_regulators') AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800), ^ drivers/regulator/axp20x-regulator.c:96:3: note: in definition of macro 'AXP_DESC_FIXED' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:279:14: error: 'AXP809_SW' undeclared here (not in a function) AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)), ^ drivers/regulator/axp20x-regulator.c:82:3: note: in definition of macro 'AXP_DESC_SW' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:279:14: error: array index in initializer not of integer type AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)), ^ drivers/regulator/axp20x-regulator.c:82:3: note: in definition of macro 'AXP_DESC_SW' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c:279:14: note: (near initialization for 'axp809_regulators') AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)), ^ drivers/regulator/axp20x-regulator.c:82:3: note: in definition of macro 'AXP_DESC_SW' [_family##_##_id] = { \ ^ drivers/regulator/axp20x-regulator.c: In function 'axp20x_set_dcdc_freq': drivers/regulator/axp20x-regulator.c:297:7: error: 'AXP809_ID' undeclared (first use in this function) case AXP809_ID: ^ drivers/regulator/axp20x-regulator.c:297:7: note: each undeclared identifier is reported only once for each function it appears in drivers/regulator/axp20x-regulator.c: In function 'axp20x_set_dcdc_workmode': drivers/regulator/axp20x-regulator.c:377:7: error: 'AXP809_ID' undeclared (first use in this function) case AXP809_ID: ^ drivers/regulator/axp20x-regulator.c: In function 'axp20x_regulator_probe': drivers/regulator/axp20x-regulator.c:420:7: error: 'AXP809_ID' undeclared (first use in this function) case AXP809_ID: ^ drivers/regulator/axp20x-regulator.c:422:17: error: 'AXP809_REG_ID_MAX' undeclared (first use in this function) nregulators = AXP809_REG_ID_MAX; ^ drivers/regulator/axp20x-regulator.c:422:15: warning: assignment makes integer from pointer without a cast [-Wint-conversion] nregulators = AXP809_REG_ID_MAX; ^ In file included from include/linux/err.h:4:0, from drivers/regulator/axp20x-regulator.c:16: drivers/regulator/axp20x-regulator.c:447:45: warning: comparison between pointer and integer (regulators == axp809_regulators && i == AXP809_DC1SW)) { ^ include/linux/compiler.h:151:30: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^ >> drivers/regulator/axp20x-regulator.c:446:3: note: in expansion of macro 'if' if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) || ^ drivers/regulator/axp20x-regulator.c:447:45: warning: comparison between pointer and integer (regulators == axp809_regulators && i == AXP809_DC1SW)) { ^ include/linux/compiler.h:151:42: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^ >> drivers/regulator/axp20x-regulator.c:446:3: note: in expansion of macro 'if' if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) || ^ drivers/regulator/axp20x-regulator.c:447:45: warning: comparison between pointer and integer (regulators == axp809_regulators && i == AXP809_DC1SW)) { ^ include/linux/compiler.h:162:16: note: in definition of macro '__trace_if' ______r = !!(cond); \ ^ >> drivers/regulator/axp20x-regulator.c:446:3: note: in expansion of macro 'if' if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) || ^ drivers/regulator/axp20x-regulator.c:456:45: warning: comparison between pointer and integer (regulators == axp809_regulators && i == AXP809_DC5LDO)) { ^ include/linux/compiler.h:151:30: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^ drivers/regulator/axp20x-regulator.c:455:3: note: in expansion of macro 'if' if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) || ^ drivers/regulator/axp20x-regulator.c:456:45: warning: comparison between pointer and integer (regulators == axp809_regulators && i == AXP809_DC5LDO)) { ^ include/linux/compiler.h:151:42: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^ drivers/regulator/axp20x-regulator.c:455:3: note: in expansion of macro 'if' if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) || ^ drivers/regulator/axp20x-regulator.c:456:45: warning: comparison between pointer and integer (regulators == axp809_regulators && i == AXP809_DC5LDO)) { ^ include/linux/compiler.h:162:16: note: in definition of macro '__trace_if' ______r = !!(cond); \ ^ drivers/regulator/axp20x-regulator.c:455:3: note: in expansion of macro 'if' if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) || ^ drivers/regulator/axp20x-regulator.c:485:45: warning: comparison between pointer and integer (regulators == axp809_regulators && i == AXP809_DCDC1)) ^ include/linux/compiler.h:151:30: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^ drivers/regulator/axp20x-regulator.c:484:3: note: in expansion of macro 'if' if ((regulators == axp22x_regulators && i == AXP22X_DCDC1) || ^ drivers/regulator/axp20x-regulator.c:485:45: warning: comparison between pointer and integer (regulators == axp809_regulators && i == AXP809_DCDC1)) ^ include/linux/compiler.h:151:42: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^ drivers/regulator/axp20x-regulator.c:484:3: note: in expansion of macro 'if' if ((regulators == axp22x_regulators && i == AXP22X_DCDC1) || ^ drivers/regulator/axp20x-regulator.c:485:45: warning: comparison between pointer and integer (regulators == axp809_regulators && i == AXP809_DCDC1)) ^ include/linux/compiler.h:162:16: note: in definition of macro '__trace_if' ______r = !!(cond); \ ^ drivers/regulator/axp20x-regulator.c:484:3: note: in expansion of macro 'if' if ((regulators == axp22x_regulators && i == AXP22X_DCDC1) || ^ drivers/regulator/axp20x-regulator.c:491:45: warning: comparison between pointer and integer (regulators == axp809_regulators && i == AXP809_DCDC5)) ^ include/linux/compiler.h:151:30: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^ drivers/regulator/axp20x-regulator.c:490:3: note: in expansion of macro 'if' if ((regulators == axp22x_regulators && i == AXP22X_DCDC5) || ^ drivers/regulator/axp20x-regulator.c:491:45: warning: comparison between pointer and integer (regulators == axp809_regulators && i == AXP809_DCDC5)) ^ include/linux/compiler.h:151:42: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^ drivers/regulator/axp20x-regulator.c:490:3: note: in expansion of macro 'if' if ((regulators == axp22x_regulators && i == AXP22X_DCDC5) || ^ drivers/regulator/axp20x-regulator.c:491:45: warning: comparison between pointer and integer (regulators == axp809_regulators && i == AXP809_DCDC5)) ^ include/linux/compiler.h:162:16: note: in definition of macro '__trace_if' ______r = !!(cond); \ ^ drivers/regulator/axp20x-regulator.c:490:3: note: in expansion of macro 'if' if ((regulators == axp22x_regulators && i == AXP22X_DCDC5) || ^ vim +/if +446 drivers/regulator/axp20x-regulator.c 430 /* This only sets the dcdc freq. Ignore any errors */ 431 axp20x_regulator_parse_dt(pdev); 432 433 for (i = 0; i < nregulators; i++) { 434 const struct regulator_desc *desc = ®ulators[i]; 435 struct regulator_desc *new_desc; 436 437 /* 438 * Regulators DC1SW and DC5LDO are connected internally, 439 * so we have to handle their supply names separately. 440 * 441 * We always register the regulators in proper sequence, 442 * so the supply names are correctly read. See the last 443 * part of this loop to see where we save the DT defined 444 * name. 445 */ > 446 if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) || 447 (regulators == axp809_regulators && i == AXP809_DC1SW)) { 448 new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc), 449 GFP_KERNEL); 450 *new_desc = regulators[i]; 451 new_desc->supply_name = dcdc1_name; 452 desc = new_desc; 453 } 454 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/octet-stream, Size: 21692 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 06/11] regulator: axp20x: support AXP809 variant @ 2016-02-02 10:27 Chen-Yu Tsai 2016-05-31 17:46 ` Applied "regulator: axp20x: support AXP809 variant" to the regulator tree Mark Brown 0 siblings, 1 reply; 5+ messages in thread From: Chen-Yu Tsai @ 2016-02-02 10:27 UTC (permalink / raw) To: Lee Jones, Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Maxime Ripard Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel, linux-sunxi The X-Powers AXP809 PMIC has a similar set of regulators as the AXP221, though a few LDOs were removed, and a new switch output added. Like the AXP221, AXP809 also has DC1SW and DC5LDO, which are internally chained to DCDC1 and DCDC5, respectively. Add support for this new variant. Also remove the "axp22x_" prefix from DC1SW/DC5LDO supply handling code, as the AXP809 uses it as well. Signed-off-by: Chen-Yu Tsai <wens@csie.org> --- drivers/regulator/axp20x-regulator.c | 119 ++++++++++++++++++++++++++--------- 1 file changed, 90 insertions(+), 29 deletions(-) diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c index 81f25383f2d5..c9f2084659e4 100644 --- a/drivers/regulator/axp20x-regulator.c +++ b/drivers/regulator/axp20x-regulator.c @@ -224,6 +224,61 @@ static const struct regulator_desc axp22x_regulators[] = { AXP_DESC_FIXED(AXP22X, RTC_LDO, "rtc_ldo", "ips", 3000), }; +static const struct regulator_linear_range axp809_dcdc4_ranges[] = { + REGULATOR_LINEAR_RANGE(600000, 0x0, 0x2f, 20000), + REGULATOR_LINEAR_RANGE(1800000, 0x30, 0x38, 100000), +}; + +static const struct regulator_linear_range axp809_dldo1_ranges[] = { + REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000), + REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000), +}; + +static const struct regulator_desc axp809_regulators[] = { + AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100, + AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(1)), + AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20, + AXP22X_DCDC2_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(2)), + AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20, + AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)), + AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", axp809_dcdc4_ranges, + 57, AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, + BIT(4)), + AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50, + AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)), + /* secondary switchable output of DCDC1 */ + AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2, + BIT(7)), + /* LDO regulator internally chained to DCDC5 */ + AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100, + AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)), + AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100, + AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(6)), + AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100, + AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)), + AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100, + AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)), + AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges, + 32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, + BIT(3)), + AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100, + AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(4)), + AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100, + AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)), + AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100, + AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)), + AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100, + AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)), + AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100, + AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07, + AXP22X_IO_ENABLED, AXP22X_IO_DISABLED), + AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100, + AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07, + AXP22X_IO_ENABLED, AXP22X_IO_DISABLED), + AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800), + AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)), +}; + static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) { struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); @@ -239,6 +294,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) break; case AXP221_ID: case AXP223_ID: + case AXP809_ID: min = 1800; max = 4050; def = 3000; @@ -318,6 +374,7 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work case AXP221_ID: case AXP223_ID: + case AXP809_ID: if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5) return -EINVAL; @@ -346,8 +403,8 @@ static int axp20x_regulator_probe(struct platform_device *pdev) }; int ret, i, nregulators; u32 workmode; - const char *axp22x_dc1_name = axp22x_regulators[AXP22X_DCDC1].name; - const char *axp22x_dc5_name = axp22x_regulators[AXP22X_DCDC5].name; + const char *dcdc1_name = axp22x_regulators[AXP22X_DCDC1].name; + const char *dcdc5_name = axp22x_regulators[AXP22X_DCDC5].name; switch (axp20x->variant) { case AXP202_ID: @@ -360,6 +417,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev) regulators = axp22x_regulators; nregulators = AXP22X_REG_ID_MAX; break; + case AXP809_ID: + regulators = axp809_regulators; + nregulators = AXP809_REG_ID_MAX; + break; default: dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n", axp20x->variant); @@ -382,22 +443,22 @@ static int axp20x_regulator_probe(struct platform_device *pdev) * part of this loop to see where we save the DT defined * name. */ - if (regulators == axp22x_regulators) { - if (i == AXP22X_DC1SW) { - new_desc = devm_kzalloc(&pdev->dev, - sizeof(*desc), - GFP_KERNEL); - *new_desc = regulators[i]; - new_desc->supply_name = axp22x_dc1_name; - desc = new_desc; - } else if (i == AXP22X_DC5LDO) { - new_desc = devm_kzalloc(&pdev->dev, - sizeof(*desc), - GFP_KERNEL); - *new_desc = regulators[i]; - new_desc->supply_name = axp22x_dc5_name; - desc = new_desc; - } + if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) || + (regulators == axp809_regulators && i == AXP809_DC1SW)) { + new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc), + GFP_KERNEL); + *new_desc = regulators[i]; + new_desc->supply_name = dcdc1_name; + desc = new_desc; + } + + if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) || + (regulators == axp809_regulators && i == AXP809_DC5LDO)) { + new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc), + GFP_KERNEL); + *new_desc = regulators[i]; + new_desc->supply_name = dcdc5_name; + desc = new_desc; } rdev = devm_regulator_register(&pdev->dev, desc, &config); @@ -420,17 +481,17 @@ static int axp20x_regulator_probe(struct platform_device *pdev) /* * Save AXP22X DCDC1 / DCDC5 regulator names for later. */ - if (regulators == axp22x_regulators) { - /* Can we use rdev->constraints->name instead? */ - if (i == AXP22X_DCDC1) - of_property_read_string(rdev->dev.of_node, - "regulator-name", - &axp22x_dc1_name); - else if (i == AXP22X_DCDC5) - of_property_read_string(rdev->dev.of_node, - "regulator-name", - &axp22x_dc5_name); - } + if ((regulators == axp22x_regulators && i == AXP22X_DCDC1) || + (regulators == axp809_regulators && i == AXP809_DCDC1)) + of_property_read_string(rdev->dev.of_node, + "regulator-name", + &dcdc1_name); + + if ((regulators == axp22x_regulators && i == AXP22X_DCDC5) || + (regulators == axp809_regulators && i == AXP809_DCDC5)) + of_property_read_string(rdev->dev.of_node, + "regulator-name", + &dcdc5_name); } return 0; -- 2.7.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Applied "regulator: axp20x: support AXP809 variant" to the regulator tree 2016-02-02 10:27 [PATCH 06/11] regulator: axp20x: support AXP809 variant Chen-Yu Tsai @ 2016-05-31 17:46 ` Mark Brown 0 siblings, 0 replies; 5+ messages in thread From: Mark Brown @ 2016-05-31 17:46 UTC (permalink / raw) To: Chen-Yu Tsai Cc: Mark Brown, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Maxime Ripard, devicetree, linux-arm-kernel, linux-kernel, linux-sunxi The patch regulator: axp20x: support AXP809 variant has been applied to the regulator tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From a51f9f4622a34eb19b5658c08b083345d763657b Mon Sep 17 00:00:00 2001 From: Chen-Yu Tsai <wens@csie.org> Date: Wed, 1 Jun 2016 00:23:19 +0800 Subject: [PATCH] regulator: axp20x: support AXP809 variant The X-Powers AXP809 PMIC has a similar set of regulators as the AXP221, though a few LDOs were removed, and a new switch output added. Like the AXP221, AXP809 also has DC1SW and DC5LDO, which are internally chained to DCDC1 and DCDC5, respectively. Add support for this new variant. Also remove the "axp22x_" prefix from DC1SW/DC5LDO supply handling code, as the AXP809 uses it as well. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Mark Brown <broonie@kernel.org> --- drivers/regulator/axp20x-regulator.c | 119 ++++++++++++++++++++++++++--------- 1 file changed, 90 insertions(+), 29 deletions(-) diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c index 514a5e8fdbab..728be64e817a 100644 --- a/drivers/regulator/axp20x-regulator.c +++ b/drivers/regulator/axp20x-regulator.c @@ -230,6 +230,61 @@ static const struct regulator_desc axp22x_regulators[] = { AXP_DESC_FIXED(AXP22X, RTC_LDO, "rtc_ldo", "ips", 3000), }; +static const struct regulator_linear_range axp809_dcdc4_ranges[] = { + REGULATOR_LINEAR_RANGE(600000, 0x0, 0x2f, 20000), + REGULATOR_LINEAR_RANGE(1800000, 0x30, 0x38, 100000), +}; + +static const struct regulator_linear_range axp809_dldo1_ranges[] = { + REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000), + REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000), +}; + +static const struct regulator_desc axp809_regulators[] = { + AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100, + AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(1)), + AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20, + AXP22X_DCDC2_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(2)), + AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20, + AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)), + AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", axp809_dcdc4_ranges, + 57, AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, + BIT(4)), + AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50, + AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)), + /* secondary switchable output of DCDC1 */ + AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2, + BIT(7)), + /* LDO regulator internally chained to DCDC5 */ + AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100, + AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)), + AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100, + AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(6)), + AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100, + AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)), + AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100, + AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)), + AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges, + 32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, + BIT(3)), + AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100, + AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(4)), + AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100, + AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)), + AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100, + AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)), + AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100, + AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)), + AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100, + AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07, + AXP22X_IO_ENABLED, AXP22X_IO_DISABLED), + AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100, + AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07, + AXP22X_IO_ENABLED, AXP22X_IO_DISABLED), + AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800), + AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)), +}; + static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) { struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); @@ -245,6 +300,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) break; case AXP221_ID: case AXP223_ID: + case AXP809_ID: min = 1800; max = 4050; def = 3000; @@ -324,6 +380,7 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work case AXP221_ID: case AXP223_ID: + case AXP809_ID: if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5) return -EINVAL; @@ -352,8 +409,8 @@ static int axp20x_regulator_probe(struct platform_device *pdev) }; int ret, i, nregulators; u32 workmode; - const char *axp22x_dc1_name = axp22x_regulators[AXP22X_DCDC1].name; - const char *axp22x_dc5_name = axp22x_regulators[AXP22X_DCDC5].name; + const char *dcdc1_name = axp22x_regulators[AXP22X_DCDC1].name; + const char *dcdc5_name = axp22x_regulators[AXP22X_DCDC5].name; switch (axp20x->variant) { case AXP202_ID: @@ -366,6 +423,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev) regulators = axp22x_regulators; nregulators = AXP22X_REG_ID_MAX; break; + case AXP809_ID: + regulators = axp809_regulators; + nregulators = AXP809_REG_ID_MAX; + break; default: dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n", axp20x->variant); @@ -388,22 +449,22 @@ static int axp20x_regulator_probe(struct platform_device *pdev) * part of this loop to see where we save the DT defined * name. */ - if (regulators == axp22x_regulators) { - if (i == AXP22X_DC1SW) { - new_desc = devm_kzalloc(&pdev->dev, - sizeof(*desc), - GFP_KERNEL); - *new_desc = regulators[i]; - new_desc->supply_name = axp22x_dc1_name; - desc = new_desc; - } else if (i == AXP22X_DC5LDO) { - new_desc = devm_kzalloc(&pdev->dev, - sizeof(*desc), - GFP_KERNEL); - *new_desc = regulators[i]; - new_desc->supply_name = axp22x_dc5_name; - desc = new_desc; - } + if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) || + (regulators == axp809_regulators && i == AXP809_DC1SW)) { + new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc), + GFP_KERNEL); + *new_desc = regulators[i]; + new_desc->supply_name = dcdc1_name; + desc = new_desc; + } + + if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) || + (regulators == axp809_regulators && i == AXP809_DC5LDO)) { + new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc), + GFP_KERNEL); + *new_desc = regulators[i]; + new_desc->supply_name = dcdc5_name; + desc = new_desc; } rdev = devm_regulator_register(&pdev->dev, desc, &config); @@ -426,17 +487,17 @@ static int axp20x_regulator_probe(struct platform_device *pdev) /* * Save AXP22X DCDC1 / DCDC5 regulator names for later. */ - if (regulators == axp22x_regulators) { - /* Can we use rdev->constraints->name instead? */ - if (i == AXP22X_DCDC1) - of_property_read_string(rdev->dev.of_node, - "regulator-name", - &axp22x_dc1_name); - else if (i == AXP22X_DCDC5) - of_property_read_string(rdev->dev.of_node, - "regulator-name", - &axp22x_dc5_name); - } + if ((regulators == axp22x_regulators && i == AXP22X_DCDC1) || + (regulators == axp809_regulators && i == AXP809_DCDC1)) + of_property_read_string(rdev->dev.of_node, + "regulator-name", + &dcdc1_name); + + if ((regulators == axp22x_regulators && i == AXP22X_DCDC5) || + (regulators == axp809_regulators && i == AXP809_DCDC5)) + of_property_read_string(rdev->dev.of_node, + "regulator-name", + &dcdc5_name); } return 0; -- 2.8.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-05-31 17:46 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-03-29 16:55 Applied "regulator: axp20x: support AXP809 variant" to the regulator tree Mark Brown 2016-03-29 17:19 ` kbuild test robot 2016-03-29 17:24 ` Mark Brown 2016-03-29 19:09 ` kbuild test robot -- strict thread matches above, loose matches on Subject: below -- 2016-02-02 10:27 [PATCH 06/11] regulator: axp20x: support AXP809 variant Chen-Yu Tsai 2016-05-31 17:46 ` Applied "regulator: axp20x: support AXP809 variant" to the regulator tree Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).