summaryrefslogtreecommitdiff
path: root/drivers/regulator/pfuze100-regulator.c
AgeCommit message (Collapse)Author
2021-03-19regulator: pfuze100-regulator: provide pm_power_off_prepare handlerOleksij Rempel
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 Related-to: ELB-3580 Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org> (cherry-picked from commit c29daffa322ad36978cbce487f8ebcd9c3c3f7c0) (tuned for 4.14 kernel) Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2021-03-19regulator: pfuze100: fix system hang on suspendOleksandr Suvorov
The shutdown() callback of i2c client device calls for both scenarios, power off and reboot the system. In case of rebooting, the PMIC is configured to power off the power rails when receiveing the PMIC_STBY_REQ request. It leads to powering the module down and system hanging while suspending the system after soft reboot. Remove the shutdown() callback. Related-to: ELB-3580 Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com> (cherry-picked from commit 22072a0ae32d68771e254aeb45c0edf87c61f7d5) (tuned for kernel 4.14)
2020-02-09regulator: pfuze100: Apalis iMX6: Fix poweroff does not release ↵Sanchayan Maity
POWER_ENABLE_MOCI Poweroff failed powering off the carrier board side of things and did not deassert POWER_ENABLE_MOCI on poweroff. Fix this. Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com> Acked-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit 090138a21869fe2a4b1efa725e6f962ecdff86e5)
2020-02-09colibri-imx6: use stopmode for poweroffMax Krummenacher
After the system has been shutdown with PMIC_ON_REQ and VCC_BATT is supplied from a battery it will never restart either by RESET or power cycle. So use the PMIC_STBY_REQ after shutdown to switch off power rails. Conflicts: arch/arm/mach-imx/pm-imx6.c drivers/regulator/pfuze100-regulator.c (cherry-picked from commit c8b186404065c4502b485820ad4a51515924795c) (cherry-picked from commit ee4c5c4da3b32f65528a2d523ca4bce574dee3c5) Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> (cherry picked from commit 29ff2389ecf7cb4e30924c80b8d42165cf306936)
2020-02-07Merge tag 'v4.14.164' into 4.14-2.3.x-imxMarcel Ziswiler
This is the 4.14.164 stable release Conflicts: arch/arm/Kconfig.debug arch/arm/boot/dts/imx7s.dtsi arch/arm/mach-imx/cpuidle-imx6q.c arch/arm/mach-imx/cpuidle-imx6sx.c arch/arm64/kernel/cpu_errata.c arch/arm64/kvm/hyp/tlb.c drivers/crypto/caam/caamalg.c drivers/crypto/mxs-dcp.c drivers/dma/imx-sdma.c drivers/gpio/gpio-vf610.c drivers/gpu/drm/bridge/adv7511/adv7511_drv.c drivers/input/keyboard/imx_keypad.c drivers/input/keyboard/snvs_pwrkey.c drivers/mmc/core/block.c drivers/mmc/core/queue.h drivers/mmc/host/sdhci-esdhc-imx.c drivers/net/can/flexcan.c drivers/net/can/rx-offload.c drivers/net/ethernet/freescale/fec_main.c drivers/net/wireless/ath/ath10k/pci.c drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c drivers/pci/dwc/pci-imx6.c drivers/spi/spi-fsl-lpspi.c drivers/usb/dwc3/gadget.c include/net/tcp.h sound/soc/fsl/Kconfig sound/soc/fsl/fsl_esai.c
2019-11-10regulator: pfuze100-regulator: Variable "val" in pfuze100_regulator_probe() ↵Yizhuo
could be uninitialized [ Upstream commit 1252b283141f03c3dffd139292c862cae10e174d ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-07-24MLK-22302-5: regulator: pfuze100: fix build warning with CONFIG_PM_SLEEP=nRobin Gong
Fix build waring with CONFIG_PM_SLEEP=n. Signed-off-by: Robin Gong <yibin.gong@nxp.com> Reviewed-by: Andy Duan <fugang.duan@nxp.com>
2019-07-23MLK-21076-4 regulator: pfuze100: Fix build warning when CONFIG_PM_SLEEP=nAnson Huang
Fix below build warning when CONFIG_PM_SLEEP=n: drivers/regulator/pfuze100-regulator.c:743:12: warning: 'pfuze_resume' defined but not used [-Wunused-function] static int pfuze_resume(struct device *dev) ^~~~~~~~~~~~ drivers/regulator/pfuze100-regulator.c:717:12: warning: 'pfuze_suspend' defined but not used [-Wunused-functio ] static int pfuze_suspend(struct device *dev) ^~~~~~~~~~~~~ Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Jacky Bai <ping.bai@nxp.com>
2019-02-12MLK-16283 regulator: pfuze100: add 500us wait time for switch enableRobin Gong
add 500us enable_time for switch to be stable while turned on. Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-16202-01 driver: regulator: add enable/disable for switch for pfuze100Robin Gong
Add enable/disable support for switch regulator on pfuze100. Signed-off-by: Robin Gong <yibin.gong@nxp.com> Signed-off-by: Bai Ping <ping.bai@nxp.com>
2019-02-12MLK-11465-1: regulator: pfuze100: update voltage setting for SW1A of PF3000Robin Gong
Regards to the pfuze3000 doc update, regulator driver need to be updated too. Otherwise the voltage information show wrongly. Signed-off-by: Robin Gong <b38343@freescale.com>
2019-02-12MLK-11550-1: regulator: pfuze100: restore some registers after LPSR for ↵Robin Gong
pfuze3000 Some registers on pfuze3000 will lost after exit from LPSR, need restore them, otherwise system may reboot with below command after system enter LPSR one time: root@imx7d_all:~# echo enabled > /sys/class/tty/ttymxc0/power/wakeup root@imx7d_all:~# echo mem > /sys/power/state because LDOGCTL not recover as 1. Add 'fsl,lpsr-mode' property to this case, please add this property if your board support LPSR mode as imx7d-12x12-lpddr3-arm2 board. Signed-off-by: Robin Gong <b38343@freescale.com>
2018-08-03regulator: pfuze100: add .is_enable() for pfuze100_swb_regulator_opsAnson Huang
[ Upstream commit 0b01fd3d40fe6402e5fa3b491ef23109feb1aaa5 ] 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> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-30Merge remote-tracking branches 'regulator/topic/notifier', ↵Mark Brown
'regulator/topic/pfuze100', 'regulator/topic/settle', 'regulator/topic/tps65132' and 'regulator/topic/twl6030' into regulator-next
2017-03-13regulator: pfuze100-regulator: add coin supportGeorge McCollister
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 Goyal
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 Estevam
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 Estevam
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', ↵Mark Brown
'regulator/topic/ocp', 'regulator/topic/owner', 'regulator/topic/pfuze100' and 'regulator/topic/pwm' into regulator-next
2015-08-29regulator: pfuze100: Remove unnecessary MODULE_ALIAS()Javier Martinez Canillas
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 Kozlowski
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 Gong
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 Lin
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 Cross
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 Cross
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', ↵Mark Brown
'regulator/topic/max8997', 'regulator/topic/max8998', 'regulator/topic/mc13xxx', 'regulator/topic/pfuze100', 'regulator/topic/rc5t583' and 'regulator/topic/s2mps11' into regulator-next
2014-03-06regulator: pfuze100: Add PFUZE200 support to Kconfig and module descriptionAxel Lin
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 Lin
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 Gong
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 Estevam
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 Estevam
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 Kamat
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 Farina
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', ↵Mark Brown
'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
2014-01-23regulator: pfuze100-regulator: Improve dev_info() messageFabio Estevam
'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 Estevam
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 Brown
Linux 3.13-rc4
2013-12-09regulator: pfuze100: use devm_regulator_register()Jingoo Han
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 Harvey
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 Lin
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 Lin
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 Lin
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 Lin
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 Lin
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 Lin
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 Lin
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 Gong
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 Gong
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 Gong
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>