summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/pfuze100-regulator.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'regulator/for-5.11' into regulator-nextMark Brown2020-12-111-33/+1
|\
| * regulator: pfuze100: Convert the driver to DT-onlyFabio Estevam2020-12-111-33/+1
| | | | | | | | | | | | | | | | | | Since 5.10-rc1 i.MX is a devicetree-only platform, so simplify the code by removing the unused non-DT support. Signed-off-by: Fabio Estevam <festevam@gmail.com> Link: https://lore.kernel.org/r/20201210212748.5849-1-festevam@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | regulator: pfuze100: limit pfuze-support-disable-sw to pfuze{100,200}Sean Nyekjaer2020-11-111-5/+8
|/ | | | | | | | | | | | | | Limit the fsl,pfuze-support-disable-sw to the pfuze100 and pfuze200 variants. When enabling fsl,pfuze-support-disable-sw and using a pfuze3000 or pfuze3001, the driver would choose pfuze100_sw_disable_regulator_ops instead of the newly introduced and correct pfuze3000_sw_regulator_ops. Signed-off-by: Sean Nyekjaer <sean@geanix.com> Fixes: 6f1cf5257acc ("regualtor: pfuze100: correct sw1a/sw2 on pfuze3000") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20201110174113.2066534-1-sean@geanix.com Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100: add condition check for 'ramp_delay = 0'Robin Gong2020-06-231-3/+6
| | | | | | | | Checking for 'ramp_delay = 0' to avoid Coverity warning report. Signed-off-by: Robin Gong <yibin.gong@nxp.com> Link: https://lore.kernel.org/r/1592920870-12693-1-git-send-email-yibin.gong@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
* regualtor: pfuze100: correct sw1a/sw2 on pfuze3000Robin Gong2020-06-151-21/+39
| | | | | | | | | | | | | | PFUZE100_SWB_REG is not proper for sw1a/sw2, because enable_mask/enable_reg is not correct. On PFUZE3000, sw1a/sw2 should be the same as sw1a/sw2 on pfuze100 except that voltages are not linear, so add new PFUZE3000_SW_REG and pfuze3000_sw_regulator_ops which like the non-linear PFUZE100_SW_REG and pfuze100_sw_regulator_ops. Fixes: 1dced996ee70 ("regulator: pfuze100: update voltage setting for pfuze3000 sw1a") Reported-by: Christophe Meynard <Christophe.Meynard@ign.fr> Signed-off-by: Robin Gong <yibin.gong@nxp.com> Link: https://lore.kernel.org/r/1592171648-8752-1-git-send-email-yibin.gong@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100-regulator: Variable "val" in pfuze100_regulator_probe() ↵Yizhuo2019-10-011-1/+7
| | | | | | | | | | | | | could be uninitialized In function pfuze100_regulator_probe(), variable "val" could be initialized if regmap_read() fails. However, "val" is used to decide the control flow later in the if statement, which is potentially unsafe. Signed-off-by: Yizhuo <yzhai003@ucr.edu> Link: https://lore.kernel.org/r/20190929170957.14775-1-yzhai003@ucr.edu Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100-regulator: add coin support to PF0100Adam Ford2018-11-061-0/+2
| | | | | | | | | The driver currently supports coin cell / super cap charging, so this patch extends it to support PF0100. Signed-off-by: Adam Ford <aford173@gmail.com> Reviewed-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100-regulator: fix spelling mistake "standy" -> "standby"Colin Ian King2018-09-171-1/+1
| | | | | | | Trivial fix to spelling mistake in dev_info message Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100-regulator: provide pm_power_off_prepare handlerOleksij Rempel2018-09-111-0/+91
| | | | | | | | | | | | | | | | | | | On some boards the SoC can use one pin "PMIC_STBY_REQ" to notify th PMIC about state changes. In this case internal state of PMIC must be preconfigured for upcomming state change. It works fine with the current regulator framework, except with the power-off case. This patch is providing an optional pm_power_off_prepare handler which will configure standby state of the PMIC to disable all power lines. In my power consumption test on RIoTBoard, I got the following results: power off without this patch: 320 mA power off with this patch: 2 mA suspend to ram: 40 mA Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100: add support to en-/disable switch regulatorsMarco Felsch2018-07-231-0/+36
| | | | | | | | | | | | | | | | Add enable/disable support for switch regulators on pfuze100. Based on commit 5fe156f1cab4 ("regulator: pfuze100: add enable/disable for switch") which is reverted due to boot regressions by commit 464a5686e6c9 ("regulator: Revert "regulator: pfuze100: add enable/disable for switch""). Disabling the switch regulators will only be done if the user specifies "fsl,pfuze-support-disable-sw" in its device tree to keep backward compatibility with current dtb's [1]. [1] https://patchwork.kernel.org/patch/10490381/ Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: Revert "regulator: pfuze100: add enable/disable for switch"Fabio Estevam2018-07-021-8/+0
| | | | | | | | | | | | | | | | | | This reverts commit 5fe156f1cab4f340ddb6283c993912be77594016. Commit 5fe156f1cab4 ("regulator: pfuze100: add enable/disable for switch") causes boot regression on some platforms such as imx6sl-evk and imx6sll-evk. After this commit the SW4 regulator will be turned off and since it supplies the DDR voltage on these boards, a kernel hang is observed. Revert it to avoid breaking old dtb's. Fixes: 5fe156f1cab4 ("regulator: pfuze100: add enable/disable for switch") Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100: add pfuze3001 supportStefan Wahren2018-06-181-7/+71
| | | | | | | | | | | This extends the pfuze100 driver with pfuze3001 support. Latest datasheet: https://www.nxp.com/docs/en/data-sheet/PF3001.pdf Signed-off-by: Robin Gong <yibin.gong@nxp.com> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100: Delete reference to ena_gpioLinus Walleij2018-05-241-1/+0
| | | | | | | | | We now pass a GPIO descriptor to the core instead of a global GPIO number, if this descriptor is NULL the GPIO line is not used. Just delete the assignment of an invalid GPIO line. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100: Switch to SPDX identifierFabio Estevam2018-05-241-17/+4
| | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100: add .is_enable() for pfuze100_swb_regulator_opsAnson Huang2018-05-171-0/+1
| | | | | | | | | | | If is_enabled() is not defined, regulator core will assume this regulator is already enabled, then it can NOT be really enabled after disabled. Based on Li Jun's patch from the NXP kernel tree. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100: add enable/disable for switchAnson Huang2018-05-171-0/+8
| | | | | | | | | Add enable/disable support for switch regulator on pfuze100. Based on Robin Gong's patch from the NXP kernel tree. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100: update voltage setting for pfuze3000 sw1aAnson Huang2018-04-181-1/+8
| | | | | | | | | | | | | | | | | | | pfuze3000 datasheet(Rev.9.0) from: https://www.nxp.com/docs/en/data-sheet/PF3000.pdf updates sw1a's voltage range, the settings for 1.450V and 1.475V are replaced with 1.8V and 3.3V: 5b'11110 1.450 (SW1B), 1.8 (SW1A/SW1AB) 5b'11111 1.475 (SW1B), 3.3 (SW1A/SW1AB) the voltage calculation using steps is NOT available for sw1a now, use voltage table instead. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Robin Gong <yibin.gong@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
*-. Merge remote-tracking branches 'regulator/topic/notifier', ↵Mark Brown2017-04-301-0/+24
|\ \ | | | | | | | | | 'regulator/topic/pfuze100', 'regulator/topic/settle', 'regulator/topic/tps65132' and 'regulator/topic/twl6030' into regulator-next
| | * regulator: pfuze100-regulator: add coin supportGeorge McCollister2017-03-131-0/+24
| |/ | | | | | | | | | | | | | | | | | | | | Add support for PF0200 coin cell/super capacitor charger which works as a current limited voltage source via the LICELL pin. When VIN goes below a certain threshold LICELL is used to provide power for VSNVS which is usually used to hold up secure non-volatile storage and the real-time clock on the SoC. Signed-off-by: George McCollister <george.mccollister@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* / regulator: pfuze100-regulator: constify regulator_ops structureBhumika Goyal2017-01-311-4/+4
|/ | | | | | | | | | | | | | | | | Declare regulator_ops structure as const as it is only stored in the ops field of a regulator_desc structure. This field is of type const, so regulator_ops structures having this property can be made const too. File size before: drivers/regulator/pfuze100-regulator.o text data bss dec hex filename 3552 12528 16 16096 3ee0 regulator/pfuze100-regulator.o File size after: drivers/regulator/pfuze100-regulator.o text data bss dec hex filename 4576 11496 16 16088 3ed8 regulator/pfuze100-regulator.o Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100-regulator: Adjust MODULE_DESCRIPTION()Fabio Estevam2016-06-061-1/+1
| | | | | | | | Adjust the MODULE_DESCRIPTION() text to also include the PFUZE3000 as a supported device. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100-regulator: Remove global variableFabio Estevam2016-06-061-7/+6
| | | | | | | | | | We should better not use a global 'struct pfuze_regulator' variable, as this could cause problems if multiple regulator chips are used. Place it inside the private struct instead. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
*-. Merge remote-tracking branches 'regulator/topic/mt6311', ↵Mark Brown2015-08-301-2/+0
|\ \ | | | | | | | | | 'regulator/topic/ocp', 'regulator/topic/owner', 'regulator/topic/pfuze100' and 'regulator/topic/pwm' into regulator-next
| | * regulator: pfuze100: Remove unnecessary MODULE_ALIAS()Javier Martinez Canillas2015-08-291-1/+0
| |/ |/| | | | | | | | | | | | | The driver has a I2C device id table that is used to create the modaliases and also "pfuze100-regulator" is not a supported I2C id, so is never used. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * regulator: drivers: Drop owner assignment from i2c_driverKrzysztof Kozlowski2015-07-141-1/+0
|/ | | | | | | | i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100-regulator: add pfuze3000 supportRobin Gong2015-01-091-9/+125
| | | | | | | Add pfuze3000 chip support. Signed-off-by: Robin Gong <b38343@freescale.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: pfuze100: Support enable/disable for fixed regulatorAxel Lin2014-05-271-0/+3
| | | | | | | | | | Current code has .enable_reg and .enable_mask settings, but the implementation for corresponding callbacks are missing. Fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Tested-by: Robin Gong <b38343@freescale.com> Acked-by: Robin Gong <b38343@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: pfuze100: Don't allocate an invalid gpioSean Cross2014-05-261-0/+1
| | | | | | | | | Previously, the PFUZE100 would try to allocate gpio0 io0 because config.ena_gpio defaults to 0, which can be a valid GPIO. To prevent this from happening, set this parameter to -EINVAL. Signed-off-by: Sean Cross <xobs@kosagi.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: pfuze100: Support SWB enable/disableSean Cross2014-05-261-0/+4
| | | | | | | | The SWB regulators have the ability to be turned on and off. Add enable/disable support for these regulators. Signed-off-by: Sean Cross <xobs@kosagi.com> Signed-off-by: Mark Brown <broonie@linaro.org>
*-. Merge remote-tracking branches 'regulator/topic/max8973', ↵Mark Brown2014-03-261-55/+147
|\ \ | | | | | | | | | 'regulator/topic/max8997', 'regulator/topic/max8998', 'regulator/topic/mc13xxx', 'regulator/topic/pfuze100', 'regulator/topic/rc5t583' and 'regulator/topic/s2mps11' into regulator-next
| | * regulator: pfuze100: Add PFUZE200 support to Kconfig and module descriptionAxel Lin2014-03-061-1/+1
| | | | | | | | | | | | | | | | | | Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Robin Gong <b38343@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * regulator: pfuze100: Add terminate entry for [i2c|of]_device_id tablesAxel Lin2014-03-041-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also remove PFUZE_NUM to avoid below build warnings: CC [M] drivers/regulator/pfuze100-regulator.o drivers/regulator/pfuze100-regulator.c:86:2: warning: excess elements in array initializer [enabled by default] drivers/regulator/pfuze100-regulator.c:86:2: warning: (near initialization for 'pfuze_device_id') [enabled by default] drivers/regulator/pfuze100-regulator.c:93:2: warning: excess elements in array initializer [enabled by default] drivers/regulator/pfuze100-regulator.c:93:2: warning: (near initialization for 'pfuze_dt_ids') [enabled by default] Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * regulator: pfuze100: add pfuze200 supportRobin Gong2014-03-041-53/+143
| | | | | | | | | | | | | | | | | | | | | support pfuze200 chip which remove SW1C and SW4 based on pfuze100. Signed-off-by: Robin Gong <b38343@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * pfuze100-regulator: Return error on of_node_get() failureFabio Estevam2014-02-231-1/+1
| | | | | | | | | | | | | | | | | | | | | If of_node_get() fails, we should return an error. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * pfuze100-regulator: Fix of_node_get() parameterFabio Estevam2014-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit d7857c42 (regulator: pfuze100: Use of_get_child_by_name) we get the following probe failure: pfuze100-regulator 1-0008: Full layer: 1, Metal layer: 0 pfuze100-regulator 1-0008: FAB: 0, FIN: 0 pfuze100-regulator 1-0008: regulators node not found pfuze100-regulator: probe of 1-0008 failed with error -22 Now that of_get_child_by_name() is used we should adjust the device_node pointer 'np' to not get the parent node anymore. Suggested-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * regulator: pfuze100: Use of_get_child_by_nameSachin Kamat2014-02-141-1/+1
| |/ | | | | | | | | | | | | | | of_find_node_by_name walks the allnodes list, and can thus walk outside of the parent node. Use of_get_child_by_name instead. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
* / regulator: Make use of rdev_get_id() function where possible.Thiago Farina2014-02-031-1/+1
|/ | | | | Signed-off-by: Thiago Farina <tfarina@chromium.org> Signed-off-by: Mark Brown <broonie@linaro.org>
*-. Merge remote-tracking branches 'regulator/topic/db8500', ↵Mark Brown2014-01-231-25/+14
|\ \ | | | | | | | | | 'regulator/topic/gpio', 'regulator/topic/lp3971', 'regulator/topic/lp3972', 'regulator/topic/max14577', 'regulator/topic/max77693', 'regulator/topic/mc13892', 'regulator/topic/pcf50633' and 'regulator/topic/pfuze100' into regulator-linus
| | * regulator: pfuze100-regulator: Fix some checkpatch complaintsFabio Estevam2014-01-151-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following checkpatch error and warning: ERROR: switch and case should be at the same indent #311: FILE: drivers/regulator/pfuze100-regulator.c:311: + switch (value & 0x0f) { [...] + case 0x8: [...] + case 0x0: [...] + default: WARNING: line over 80 characters #312: FILE: drivers/regulator/pfuze100-regulator.c:312: + /* Freescale misprogrammed 1-3% of parts prior to week 8 of 2013 as ID=8 */ Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * Merge tag 'v3.13-rc4' into regulator-pfuze100Mark Brown2014-01-151-4/+10
| | |\ | | | | | | | | | | | | Linux 3.13-rc4
| | * | regulator: pfuze100: use devm_regulator_register()Jingoo Han2013-12-091-17/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | Use devm_regulator_register() to make cleanup paths simpler, and remove unnecessary remove(). Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Robin Gong <b38343@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | / regulator: pfuze100-regulator: Improve dev_info() messageFabio Estevam2014-01-231-1/+1
| |/ |/| | | | | | | | | | | | | 'lay' is not very meaningful, so use it 'layer' instead to let the dev_info() clearer. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | regulator: pfuze100: allow misprogrammed IDTim Harvey2013-12-091-3/+9
| | | | | | | | | | | | | | | | | | prior to week 08 of 2013 Freescale misprogrammed between 1 and 3% of PFUZE1000 parts with a ID=0x8 instead of the expected ID=0x0 Signed-off-by: Tim Harvey <tharvey@gateworks.com> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
* | regulator: pfuze100: Fix address of FABIDAxel Lin2013-12-091-1/+1
|/ | | | | | | | | According to the datasheet, the address of FABID is 0x4. Fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Robin Gong <b38343@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
* regulator: pfuze100: Fix off-by-one for max_register settingAxel Lin2013-08-021-1/+1
| | | | | | | | 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>
* regulator: pfuze100: Simplify pfuze100_set_ramp_delay implementationAxel Lin2013-07-311-16/+5
| | | | | | | | | | | | | | | | | 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>
* regulator: pfuze100: Fix n_voltages setting for SW2~SW4 with high bit setAxel Lin2013-07-301-8/+8
| | | | | | | | | | | | | | | | | | | | 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>
* regulator: pfuze100: Use regulator_map_voltage_ascendAxel Lin2013-07-291-0/+1
| | | | | | | | 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>
* regulator: pfuze100: Fix module alias prefixAxel Lin2013-07-291-1/+1
| | | | | | | 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>
* regulator: pfuze100: Use i2c_[set|get]_clientdataAxel Lin2013-07-291-2/+2
| | | | | | | | 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>