aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/pfuze100-regulator.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-10-01regulator: pfuze100-regulator: Variable "val" in pfuze100_regulator_probe() could be uninitializedYizhuo1-1/+7
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>
2018-11-06regulator: pfuze100-regulator: add coin support to PF0100Adam Ford1-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>
2018-09-17regulator: pfuze100-regulator: fix spelling mistake "standy" -> "standby"Colin Ian King1-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>
2018-09-11regulator: pfuze100-regulator: provide pm_power_off_prepare handlerOleksij Rempel1-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>
2018-07-23regulator: pfuze100: add support to en-/disable switch regulatorsMarco Felsch1-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>
2018-07-02regulator: Revert "regulator: pfuze100: add enable/disable for switch"Fabio Estevam1-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>
2018-06-18regulator: pfuze100: add pfuze3001 supportStefan Wahren1-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>
2018-05-24regulator: pfuze100: Delete reference to ena_gpioLinus Walleij1-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>
2018-05-24regulator: pfuze100: Switch to SPDX identifierFabio Estevam1-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>
2018-05-17regulator: pfuze100: add .is_enable() for pfuze100_swb_regulator_opsAnson Huang1-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>
2018-05-17regulator: pfuze100: add enable/disable for switchAnson Huang1-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>
2018-04-18regulator: pfuze100: update voltage setting for pfuze3000 sw1aAnson Huang1-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>
2017-04-30Merge remote-tracking branches 'regulator/topic/notifier', 'regulator/topic/pfuze100', 'regulator/topic/settle', 'regulator/topic/tps65132' and 'regulator/topic/twl6030' into regulator-nextMark Brown1-0/+24
2017-03-13regulator: pfuze100-regulator: add coin supportGeorge McCollister1-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>
2017-01-31regulator: pfuze100-regulator: constify regulator_ops structureBhumika Goyal1-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>
2016-06-06regulator: pfuze100-regulator: Adjust MODULE_DESCRIPTION()Fabio Estevam1-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>
2016-06-06regulator: pfuze100-regulator: Remove global variableFabio Estevam1-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>
2015-08-30Merge remote-tracking branches 'regulator/topic/mt6311', 'regulator/topic/ocp', 'regulator/topic/owner', 'regulator/topic/pfuze100' and 'regulator/topic/pwm' into regulator-nextMark Brown1-2/+0
2015-08-29regulator: pfuze100: Remove unnecessary MODULE_ALIAS()Javier Martinez Canillas1-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>
2015-07-14regulator: drivers: Drop owner assignment from i2c_driverKrzysztof Kozlowski1-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>
2015-01-09regulator: pfuze100-regulator: add pfuze3000 supportRobin Gong1-9/+125
Add pfuze3000 chip support. Signed-off-by: Robin Gong <b38343@freescale.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-05-27regulator: pfuze100: Support enable/disable for fixed regulatorAxel Lin1-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>
2014-05-26regulator: pfuze100: Don't allocate an invalid gpioSean Cross1-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>
2014-05-26regulator: pfuze100: Support SWB enable/disableSean Cross1-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>
2014-03-26Merge remote-tracking branches 'regulator/topic/max8973', 'regulator/topic/max8997', 'regulator/topic/max8998', 'regulator/topic/mc13xxx', 'regulator/topic/pfuze100', 'regulator/topic/rc5t583' and 'regulator/topic/s2mps11' into regulator-nextMark Brown1-55/+147
2014-03-06regulator: pfuze100: Add PFUZE200 support to Kconfig and module descriptionAxel Lin1-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>
2014-03-04regulator: pfuze100: Add terminate entry for [i2c|of]_device_id tablesAxel Lin1-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>
2014-03-04regulator: pfuze100: add pfuze200 supportRobin Gong1-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>
2014-02-23pfuze100-regulator: Return error on of_node_get() failureFabio Estevam1-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>
2014-02-19pfuze100-regulator: Fix of_node_get() parameterFabio Estevam1-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>
2014-02-14regulator: pfuze100: Use of_get_child_by_nameSachin Kamat1-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>
2014-02-03regulator: Make use of rdev_get_id() function where possible.Thiago Farina1-1/+1
Signed-off-by: Thiago Farina <tfarina@chromium.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-23Merge remote-tracking branches 'regulator/topic/db8500', '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-linusMark Brown1-25/+14
2014-01-23regulator: pfuze100-regulator: Improve dev_info() messageFabio Estevam1-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>
2014-01-15regulator: pfuze100-regulator: Fix some checkpatch complaintsFabio Estevam1-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>
2014-01-15Merge tag 'v3.13-rc4' into regulator-pfuze100Mark Brown1-4/+10
Linux 3.13-rc4
2013-12-09regulator: pfuze100: use devm_regulator_register()Jingoo Han1-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>
2013-12-09regulator: pfuze100: allow misprogrammed IDTim Harvey1-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
2013-12-09regulator: pfuze100: Fix address of FABIDAxel Lin1-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
2013-08-02regulator: pfuze100: Fix off-by-one for max_register settingAxel Lin1-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>
2013-07-31regulator: pfuze100: Simplify pfuze100_set_ramp_delay implementationAxel Lin1-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>
2013-07-30regulator: pfuze100: Fix n_voltages setting for SW2~SW4 with high bit setAxel Lin1-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>
2013-07-29regulator: pfuze100: Use regulator_map_voltage_ascendAxel Lin1-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>
2013-07-29regulator: pfuze100: Fix module alias prefixAxel Lin1-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>
2013-07-29regulator: pfuze100: Use i2c_[set|get]_clientdataAxel Lin1-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>
2013-07-29regulator: pfuze100: add MODULE_LICENSE() in pfuze100 driverRobin Gong1-0/+1
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>
2013-07-26regulator:pfuze100: fix build warning and correct the binding docRobin Gong1-1/+1
fix building warning and correct the binding doc Signed-off-by: Robin Gong <b38343@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-25regulator: pfuze100: add pfuze100 regulator driverRobin Gong1-0/+454
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>