History log of /linux-master/drivers/regulator/lp8788-buck.c
Revision Date Author Comments
# e6f0b08a 06-Mar-2024 Dan Carpenter <dan.carpenter@linaro.org>

regulator: lp8788-buck: fix copy and paste bug in lp8788_dvs_gpio_request()

"gpio2" as intended here, not "gpio1".

Fixes: 95daa868f22b ("regulator: lp8788-buck: Fully convert to GPIO descriptors")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://msgid.link/r/19f62cc2-bdcf-46f7-a5c5-971ef05e1ea7@moroto.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>


# 95daa868 20-Feb-2024 Linus Walleij <linus.walleij@linaro.org>

regulator: lp8788-buck: Fully convert to GPIO descriptors

This converts the LP8788 BUCK regulator driver to use GPIO
descriptors.

BUCK1 can use one DVS GPIO and BUCK2 can use two DVS GPIOS,
and no more so just hardcode two GPIO descriptors into
the per-DVS state containers.

Obtain the descriptors from each regulators subdevice.

As there are no in-tree users, board files need to populate
descriptor tables for the buck regulator devices when
they want to use this driver. BUCK1 need a GPIO descriptor
at index 0 and BUCK2 needs two GPIO descriptors at
indices 0 and 1.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://msgid.link/r/20240220-descriptors-regulators-v1-3-097f608694be@linaro.org
Acked-by: Lee Jones <lee@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 259b93b2 16-Mar-2023 Douglas Anderson <dianders@chromium.org>

regulator: Set PROBE_PREFER_ASYNCHRONOUS for drivers that existed in 4.14

Probing of regulators can be a slow operation and can contribute to
slower boot times. This is especially true if a regulator is turned on
at probe time (with regulator-boot-on or regulator-always-on) and the
regulator requires delays (off-on-time, ramp time, etc).

While the overall kernel is not ready to switch to async probe by
default, as per the discussion on the mailing lists [1] it is believed
that the regulator subsystem is in good shape and we can move
regulator drivers over wholesale. There is no way to just magically
opt in all regulators (regulators are just normal drivers like
platform_driver), so we set PROBE_PREFER_ASYNCHRONOUS for all
regulators found in 'drivers/regulator' individually.

Given the number of drivers touched and the impossibility to test this
ahead of time, it wouldn't be shocking at all if this caused a
regression for someone. If there is a regression caused by this patch,
it's likely to be one of the cases talked about in [1]. As a "quick
fix", drivers involved in the regression could be fixed by changing
them to PROBE_FORCE_SYNCHRONOUS. That being said, the correct fix
would be to directly fix the problem that caused the issue with async
probe.

The approach here follows a similar approach that was used for the mmc
subsystem several years ago [2]. In fact, I ran nearly the same python
script to auto-generate the changes. The only thing I changed was to
search for "i2c_driver", "spmi_driver", and "spi_driver" in addition
to "platform_driver".

[1] https://lore.kernel.org/r/06db017f-e985-4434-8d1d-02ca2100cca0@sirena.org.uk
[2] https://lore.kernel.org/r/20200903232441.2694866-1-dianders@chromium.org/

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20230316125351.1.I2a4677392a38db5758dee0788b2cea5872562a82@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>


# 60ab7f41 08-May-2020 Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>

regulator: use linear_ranges helper

Change the regulator helpers to use common linear_ranges code.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/64f01d5e381b8631a271616b7790f9d5640974fb.1588944082.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d2912cb1 04-Jun-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500

Based on 2 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation #

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 4122 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Enrico Weigelt <info@metux.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7932a880 09-Feb-2019 Axel Lin <axel.lin@ingics.com>

regulator: lp8788-buck: Convert to linear range

linear range is suitable for this driver, let's convert it to linear range.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b133305c 25-Jan-2019 Axel Lin <axel.lin@ingics.com>

regulator: lp8788-buck: Constify lp8788_buck_desc

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 95dfead1 19-Dec-2015 Julia Lawall <Julia.Lawall@lip6.fr>

regulator: lp8788: constify regulator_ops structures

The regulator_ops structures are never modified, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6c794b26 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

regulator: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 3343fa17 29-Sep-2013 Jingoo Han <jg1.han@samsung.com>

regulator: lp8788-buck: use devm_regulator_register()

Use devm_regulator_register() to make cleanup paths simpler,
and remove unnecessary remove().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 405c5400 03-May-2013 Axel Lin <axel.lin@ingics.com>

regulator: Remove all platform_set_drvdata(pdev, NULL) in drivers

Since 0998d06310 "device-core: Ensure drvdata = NULL when no driver is bound",
this is done by driver core after device_release or on probe failure.
Thus we can remove all platform_set_drvdata(pdev, NULL) in drivers.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 6dcbc200 24-Apr-2013 Axel Lin <axel.lin@ingics.com>

regulator: lp8788-buck: Use regulator_map_voltage_ascend

All regulators have ascendant voltage list in this driver.
Use regulator_map_voltage_ascend for them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# e69995d3 16-Jan-2013 Axel Lin <axel.lin@ingics.com>

regulator: lp8788-buck: Remove buck[1|2]_vout_addr array

The vout address for buck[1|2] can be easily calculated,
thus remote these arrays.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# eb758de6 09-Jan-2013 Axel Lin <axel.lin@ingics.com>

regulator: lp8788-buck: Silence build warning

This driver use id as array index, thus add bounder checking for id.

This patch fixes below build warning:
drivers/regulator/lp8788-buck.c: In function 'lp8788_buck_probe':
drivers/regulator/lp8788-buck.c:490:8: warning: array subscript is above array bounds [-Warray-bounds]
drivers/regulator/lp8788-buck.c:489:63: warning: array subscript is above array bounds [-Warray-bounds]

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1ef01e74 02-Jan-2013 Kim, Milo <Milo.Kim@ti.com>

lp8788-buck: fix a for-loop coding style

Remove space before semicolon in for-loop.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 38d8f67c 02-Jan-2013 Kim, Milo <Milo.Kim@ti.com>

lp8788-buck: fix a parent device on devm_gpio_request()

Use 'platform_device' rather than i2c client device node.
Arguments are added in lp8788_init_dvs() and lp8788_dvs_gpio_request().

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 3b0e8f12 02-Jan-2013 Kim, Milo <Milo.Kim@ti.com>

lp8788-buck: fix a parent deivce in _probe()

The lp8788-buck is a platform driver of lp8788-mfd.
The platform device is allocated when mfd_add_devices() is called
in lp8788-mfd.
On the other hand, 'lp->dev' is the i2c client device.

Therefore, this 'platform_device' is a proper parent device in case of
resource managed mem alloc, registering a regulator and device kernel message.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 131a5b9d 07-Dec-2012 Axel Lin <axel.lin@ingics.com>

regulator: lp8788-buck: Kill _gpio_request function

Simply use devm_gpio_request_one() instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 8dc995f5 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

regulator: remove use of __devexit

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>


# a5023574 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

regulator: remove use of __devinit

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>


# 5eb9f2b9 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

regulator: remove use of __devexit_p

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>


# 0f4c46d2 20-Jul-2012 Axel Lin <axel.lin@gmail.com>

regulator: Use BUCK_FPWM_[MASK|SHIFT] macros to replace buck_pmap table

Below is the buck_pmap mapping table:

BUCK1: mask = 1 << 0, shift = 0
BUCK2: mask = 1 << 1, shift = 1
BUCK3: mask = 1 << 2, shift = 2
BUCK4: mask = 1 << 3, shift = 3

The mask and shift can be easily calculated by:
mask = 1 << BUCK_ID
shift = BUCK_ID

This patch defines BUCK_FPWM_MASK and BUCK_FPWM_SHIFT macros to replace
buck_pmap mapping table.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Tested-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c42ea5cd 20-Jul-2012 Axel Lin <axel.lin@gmail.com>

regulator: lp8788-buck: Remove lp8788_set_default_dvs_ctrl_mode function

We already know the mask in lp8788_init_dvs() function, and we can update
the corresponding bit for default_dvs_mode in lp8788_init_dvs() function.
This function looks not necessary to me.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Tested-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# ade7515f 18-Jul-2012 Kim, Milo <Milo.Kim@ti.com>

regulator: add new lp8788 regulator driver

TI LP8788 PMU has 4 BUCKS and 22 LDOs.
The voltage of BUCK1 and BUCK2 can be controlled by external gpios.
And some LDOs also can be enabled by external gpios.
The regmap interface is used for regulator operations.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>