summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/fan53555.c
AgeCommit message (Collapse)AuthorFilesLines
2021-06-04regulator: fan53555: add tcs4526Rudi Heitbaum1-0/+11
For rk3399pro boards the tcs4526 regulator supports the vdd_gpu regulator. The tcs4526 regulator has a chip id of <0>. Add the compatibile tcs,tcs4526 without this patch, the dmesg output is: fan53555-regulator 0-0010: Chip ID 0 not supported! fan53555-regulator 0-0010: Failed to setup device! fan53555-regulator: probe of 0-0010 failed with error -22 with this patch, the dmesg output is: vdd_gpu: supplied by vcc5v0_sys The regulators are described as: - Dedicated power management IC TCS4525 - Lithium battery protection chip TCS4526 This has been tested with a Radxa Rock Pi N10. Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com> Link: https://lore.kernel.org/r/20210602112943.GA119@5f9be87369f8 Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-03regulator: fan53555: Convert to use regulator_set_ramp_delay_regmapAxel Lin1-46/+17
Use regulator_set_ramp_delay_regmap instead of open-coded. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20210525124017.2550029-2-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-03regulator: fan53555: Fix missing slew_reg/mask/shift settings for FAN53526Axel Lin1-0/+3
The di->slew_reg/di->slew_mask/di->slew_shift was not set in current code, fix it. Fixes: f2a9eb975ab2 ("regulator: fan53555: Add support for FAN53526") Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20210525124017.2550029-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-19regulator: fan53555: Cleanup unused define and redundant assignmentAxel Lin1-2/+0
TCS_VSEL_NSEL_MASK is not used so remove it. Also remove redundant assignment for di->slew_reg. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20210517010318.1027949-2-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-19regulator: fan53555: Fix slew_shift setting for tcs4525Axel Lin1-1/+1
Fix trivial copy-paste mistake. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20210517010318.1027949-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-12regulator: fan53555: fix tcs4525 function namesPeter Geis1-9/+9
The tcs4525 is based off the fan53526. Rename the tcs4525 functions to align with this. Signed-off-by: Peter Geis <pgwipeout@gmail.com> Link: https://lore.kernel.org/r/20210511211335.2935163-4-pgwipeout@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-12regulator: fan53555: only bind tcs4525 to correct chip idPeter Geis1-7/+18
The tcs4525 regulator has a chip id of <12>. Only allow the driver to bind to the correct chip id for safety, in accordance with the other supported devices. Signed-off-by: Peter Geis <pgwipeout@gmail.com> Link: https://lore.kernel.org/r/20210511211335.2935163-3-pgwipeout@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-12regulator: fan53555: fix TCS4525 voltage calulationPeter Geis1-2/+1
The TCS4525 has 128 voltage steps. With the calculation set to 127 the most significant bit is disregarded which leads to a miscalculation of the voltage by about 200mv. Fix the calculation to end deadlock on the rk3566-quartz64 which uses this as the cpu regulator. Fixes: 914df8faa7d6 ("regulator: fan53555: Add TCS4525 DCDC support") Signed-off-by: Peter Geis <pgwipeout@gmail.com> Link: https://lore.kernel.org/r/20210511211335.2935163-2-pgwipeout@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23regulator: fan53555: Add TCS4525 DCDC supportJoseph Chen1-14/+122
TCS4525 main features: - 2.7V to 5.5V Input Voltage Range; - 3MHz Constant Switching Frequency; - 5A Available Load Current; - Programmable Output Voltage: 0.6V to 1.4V in 6.25mV Steps; - PFM/PWM Operation for Optimum Increased Efficiency; Signed-off-by: Joseph Chen <chenjh@rock-chips.com> [Ezequiel: Forward port] Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Link: https://lore.kernel.org/r/20210421210338.43819-3-ezequiel@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-21regulator: fan53555: Fix W=1 build warning when CONFIG_OF=nJisheng Zhang1-1/+1
Fix below warning when CONFIG_OF=n: drivers/regulator/fan53555.c:439:34: warning: ‘fan53555_dt_ids’ defined but not used [-Wunused-const-variable=] 439 | static const struct of_device_id fan53555_dt_ids[] = { | ^~~~~~~~~~~~~~~ Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20200821111324.430fe1da@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-06regulator: fan53555: add chip id for Silergy SYR83XVasily Khoruzhick1-0/+2
SYR83X is used in Rockpro64 and it has die ID == 9. All other registers are the same as in SYR82X Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> Link: https://lore.kernel.org/r/20191106161211.1700663-1-anarsoul@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-26regulator: fan53555: Switch to SPDX identifierAxel Lin1-14/+10
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-26regulator: fan53555: Clean up unneeded fields from struct fan53555_device_infoAxel Lin1-19/+17
The *regmap and *rdev can be replaced by local variables. The slew_rate is no longer used since commit dd7e71fbeefe ("regulator: fan53555: use set_ramp_delay to set the ramp up slew rate"). Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-26regulator: fan53555: Check pdata->slew_rate settingAxel Lin1-3/+5
Current code does not really avoid array access out of bounds, fix it by add checking for pdata->slew_rate. If pdata->slew_rate is too big, it's a bug in pdata that needs fix. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-21regulator: fan53555: Add support for FAN53526Bjorn Andersson1-10/+91
The FAN53526 differs from the FAN53555 only in that the mode bit in VSEL0/VSEL1 is moved to the CONTROL register, the voltage selector mask is extended by 1 bit and the step is different. So extend the existing fan53555 driver to support FAN53526 as well. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21regulator: fan53555: fix I2C device idsGuillaume Tucker1-1/+4
The device tree nodes all correctly describe the regulators as syr827 or syr828, but the I2C device id is currently set to the wildcard value of syr82x in the driver. This causes udev to fail to match the driver module with the modalias data from sysfs. Fix this by replacing the I2C device ids with ones that match the device tree descriptions, with syr827 and syr828. Tested on Firefly rk3288 board. The syr82x id was not used anywhere. Fixes: e80c47bd738b (regulator: fan53555: Export I2C module alias information) Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-20regulator: fan53555: Use of_device_get_match_data() to simplify probeJisheng Zhang1-8/+2
if fan53555_regulator_probe() is called and the "client->dev.of_node" isn't NULL, it means OF registered a device with a valid compatible string, so match cannot be NULL. Use of_device_get_match_data() to retrieve the drvdata pointer. No functional change intended. Signed-off-by: Jisheng Zhang <jszhang@marvell.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-31regulator: fan53555: constify regulator_ops structureBhumika Goyal1-1/+1
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/fan53555.o text data bss dec hex filename 3512 496 8 4016 fb0 drivers/regulator/fan53555.o File size after: drivers/regulator/fan53555.o text data bss dec hex filename 3768 240 8 4016 fb0 drivers/regulator/fan53555.o Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-20regulator: fan53555: Add support for FAN53555UC13X typeWadim Egorov1-0/+22
IC type options 00, 13 and 23 are sharing the same DIE_ID 0. Let's differentiate between these revisions. FAN53555UC13X has the ID 0 and REV 0xf, starts at 800mV and increments in 10mV steps. Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-20regulator: fan53555: Add support for FAN53555BUC18X typeWadim Egorov1-0/+2
FAN53555BUC18X has the DIE_ID 8, starts at 600mV and increments in 10mV steps. Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-15regulator: fan53555: fill set_suspend_enable/disable callbackzhangqing1-0/+18
Setting the set_suspend_enable/disable callback to support enable and disable the dcdc when system is suspend. Signed-off-by: zhangqing <zhangqing@rock-chips.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-31regulator: fan53555: Export I2C module alias informationJavier Martinez Canillas1-0/+1
The I2C core always reports the MODALIAS uevent as "i2c:<client name" regardless if the driver was matched using the I2C id_table or the of_match_table. So the driver needs to export the I2C table and this be built into the module or udev won't have the necessary information to auto load the correct module when the device is added. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-26regulator: fan53555: fill set_voltage_time_set callbackHeiko Stuebner1-0/+1
Setting the set_voltage_time_sel callback to the standard function regulator_set_voltage_time_sel enables the regulator to actually honor ramp-delays when during regulator_set_voltage calls. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-05regulator: fan53555: Constify struct regmap_config and slew_rates arrayKrzysztof Kozlowski1-2/+2
The regmap_config struct may be const because it is not modified by the driver and regmap_init() accepts pointer to const. Make const also slew_rates array. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-26regulator: of: Add regulator desc param to of_get_regulator_init_data()Javier Martinez Canillas1-8/+9
The of_get_regulator_init_data() function is used to extract the regulator init_data but information on how to extract certain data is defined in the static regulator descriptor (e.g: how to map the hardware operating modes). Add a const struct regulator_desc * parameter to the function signature so the parsing logic could use the information in the struct regulator_desc. of_get_regulator_init_data() relies on of_get_regulation_constraints() to actually extract the init_data so it has to pass the struct regulator_desc but that is modified on a later patch. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-18regulator: fan53555: Fix null pointer dereferenceAxel Lin1-1/+1
Set di->regulator before dereference it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-18regulator: fan53555: Fixup report wrong vendor messageAxel Lin1-2/+1
Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-17regulator: fan53555: fix wrong cast in probeHeiko Stübner1-1/+1
The vendor-id gathered from the dt match-data was cast to int but assigned to an unsigned long, producing warnings on at least sparc, like drivers/regulator/fan53555.c: In function 'fan53555_regulator_probe': >> drivers/regulator/fan53555.c:373:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] di->vendor = (int) match->data; Fix this by using an appropriate cast. Reported-by: kbuild test robot Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-16regulator: fan53555: add support for Silergy SYR82x regulatorsHeiko Stuebner1-15/+87
Silergy SYR82x regulators share the exact same functionality and register layout as the Fairchild FAN53555 regulators. Therefore extend the driver to add support for them. Both types use the same vendor id in their ID1 register, so it's not possible to distinguish them automatically. Similarly, the types also do not match. Type 8 used by the SYR827 and SYR828 start at 712.5mV and increment in 12.5mv steps, while the FAN53555 type 8 starts at 600mV and increments in 10mV steps. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-16regulator: fan53555: add devicetree supportHeiko Stuebner1-4/+46
Add the ability to parse regulator-data from the devicetree. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-16regulator: fan53555: use set_ramp_delay to set the ramp up slew rateHeiko Stuebner1-11/+42
The regulator constraints already provide a field for the ramp_delay, so there is no need to set this manually. Therefore implement the set_ramp_delay callback and convert the pdata value to the constraint value if necessary. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-15regulator: fan53555: enable vin supplyHeiko Stuebner1-0/+1
The regulator can be supplied by a parent regulator through its vin pin, so add the supply_name for it. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-02-20regulator: fan53555: Remove redundant error messageSachin Kamat1-3/+2
kzalloc prints its own OOM message upon failure. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Yunfan Zhang <yfzhang@marvell.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-20regulator: fan53555: Do not hardcode return valuesSachin Kamat1-4/+4
Propagate the error values returned by the function instead. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17regulator: fan53555: Convert to devm_regulator_registerAxel Lin1-11/+1
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-04Merge tag 'PTR_RET-for-linus' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux Pull PTR_RET() removal patches from Rusty Russell: "PTR_RET() is a weird name, and led to some confusing usage. We ended up with PTR_ERR_OR_ZERO(), and replacing or fixing all the usages. This has been sitting in linux-next for a whole cycle" [ There are still some PTR_RET users scattered about, with some of them possibly being new, but most of them existing in Rusty's tree too. We have that #define PTR_RET(p) PTR_ERR_OR_ZERO(p) thing in <linux/err.h>, so they continue to work for now - Linus ] * tag 'PTR_RET-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: GFS2: Replace PTR_RET with PTR_ERR_OR_ZERO Btrfs: volume: Replace PTR_RET with PTR_ERR_OR_ZERO drm/cma: Replace PTR_RET with PTR_ERR_OR_ZERO sh_veu: Replace PTR_RET with PTR_ERR_OR_ZERO dma-buf: Replace PTR_RET with PTR_ERR_OR_ZERO drivers/rtc: Replace PTR_RET with PTR_ERR_OR_ZERO mm/oom_kill: remove weird use of ERR_PTR()/PTR_ERR(). staging/zcache: don't use PTR_RET(). remoteproc: don't use PTR_RET(). pinctrl: don't use PTR_RET(). acpi: Replace weird use of PTR_RET. s390: Replace weird use of PTR_RET. PTR_RET is now PTR_ERR_OR_ZERO(): Replace most. PTR_RET is now PTR_ERR_OR_ZERO
2013-07-30regulator: use dev_get_platdata()Jingoo Han1-1/+1
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15PTR_RET is now PTR_ERR_OR_ZERO(): Replace most.Rusty Russell1-1/+1
Sweep of the simple cases. Cc: netdev@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-arm-kernel@lists.infradead.org Cc: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Acked-by: David S. Miller <davem@davemloft.net> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2013-03-20regulator: fan53555: Use PTR_RET functionAlexandru Gheorghiu1-3/+1
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-20regulator: remove use of __devexitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-20regulator: remove use of __devinitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-20regulator: remove use of __devexit_pBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-10regulator: fan53555: remove vsel_max not usedYunfan Zhang1-3/+0
The max voltage will be bounded by min_uV, uV_step and n_voltages, so remove it to avoid confusing. Signed-off-by: Yunfan Zhang <yfzhang@marvell.com> Reviewed-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-10regulator: Fairchild fan53555 supportYunfan Zhang1-0/+325
This driver supports Fairchild FAN53555 Digitally Programmable TinyBuck Regulator. The FAN53555 is a step-down switching voltage regulator that delivers a digitally programmable output from an input voltage supply of 2.5V to 5.5V. The output voltage is programmed through an I2C interface. Signed-off-by: Yunfan Zhang <yfzhang@marvell.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>