History log of /linux-master/drivers/regulator/da9121-regulator.c
Revision Date Author Comments
# d7370964 28-Feb-2024 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

regulator: da9121: Remove unused of_gpio.h

of_gpio.h is deprecated and subject to remove.
The driver doesn't use it, simply remove the unused header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://msgid.link/r/20240228195730.3607154-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 46537a86 17-Oct-2023 Rob Herring <robh@kernel.org>

regulator: da9121: Use i2c_get_match_data()

Use preferred i2c_get_match_data() instead of of_match_device() to get
the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231017203429.2699039-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3a6d93eb 09-Aug-2023 Chen Jiahao <chenjiahao16@huawei.com>

regulator: da9121-regulator: Remove redundant of_match_ptr() macros

Since the driver da9121-regulator depends on CONFIG_OF,
it makes no difference to wrap of_match_ptr() here.

Remove of_match_ptr() macros to clean it up.

Signed-off-by: Chen Jiahao <chenjiahao16@huawei.com>
Link: https://lore.kernel.org/r/20230809100428.2669817-2-chenjiahao16@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 964e1865 05-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

regulator: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de
Link: https://lore.kernel.org/r/20230505220218.1239542-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org


# 46600ab1 16-Mar-2023 Douglas Anderson <dianders@chromium.org>

regulator: Set PROBE_PREFER_ASYNCHRONOUS for drivers between 5.10 and 5.15

This follows on the change ("regulator: Set PROBE_PREFER_ASYNCHRONOUS
for drivers that existed in 4.14") but changes regulators didn't exist
in Linux 5.10 but did exist in Linux 5.15.

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


# 020cf73b 18-Nov-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

regulator: da9121-regulator: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-for-MFD-by: Lee Jones <lee@kernel.org>
Acked-for-Backlight-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20221118224540.619276-541-uwe@kleine-koenig.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# ed5c2f5f 15-Aug-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

i2c: Make remove callback return void

The value returned by an i2c driver's remove function is mostly ignored.
(Only an error message is printed if the value is non-zero that the
error is ignored.)

So change the prototype of the remove function to return no value. This
way driver authors are not tempted to assume that passing an error to
the upper layer is a good idea. All drivers are adapted accordingly.
There is no intended change of behaviour, all callbacks were prepared to
return 0 before.

Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com>
Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Crt Mori <cmo@melexis.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/*
Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5
Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio
Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860
Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b
Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes
Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# bab76514 21-Apr-2022 Wei Yongjun <weiyongjun1@huawei.com>

regulator: da9121: Fix uninit-value in da9121_assign_chip_model()

KASAN report slab-out-of-bounds in __regmap_init as follows:

BUG: KASAN: slab-out-of-bounds in __regmap_init drivers/base/regmap/regmap.c:841
Read of size 1 at addr ffff88803678cdf1 by task xrun/9137

CPU: 0 PID: 9137 Comm: xrun Tainted: G W 5.18.0-rc2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x15a lib/dump_stack.c:88
print_report.cold+0xcd/0x69b mm/kasan/report.c:313
kasan_report+0x8e/0xc0 mm/kasan/report.c:491
__regmap_init+0x4540/0x4ba0 drivers/base/regmap/regmap.c:841
__devm_regmap_init+0x7a/0x100 drivers/base/regmap/regmap.c:1266
__devm_regmap_init_i2c+0x65/0x80 drivers/base/regmap/regmap-i2c.c:394
da9121_i2c_probe+0x386/0x6d1 drivers/regulator/da9121-regulator.c:1039
i2c_device_probe+0x959/0xac0 drivers/i2c/i2c-core-base.c:563

This happend when da9121 device is probe by da9121_i2c_id, but with
invalid dts. Thus, chip->subvariant_id is set to -EINVAL, and later
da9121_assign_chip_model() will access 'regmap' without init it.

Fix it by return -EINVAL from da9121_assign_chip_model() if
'chip->subvariant_id' is invalid.

Fixes: f3fbd5566f6a ("regulator: da9121: Add device variants")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Adam Ward <Adam.Ward.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/20220421090335.1876149-1-weiyongjun1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9c7cf33c 21-Feb-2022 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Remove surplus DA9141 parameters

Remove ramp_delay/enable_time values - subject to OTP, incorrect

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/a175201b4a7ea323c6a70d77f7f6d2124bfc0bed.1645489455.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# c8c57fbc 21-Feb-2022 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Fix DA914x voltage value

Update DA9141/2 max voltage to match spec change

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/9d1ec5b6db70d27f56d05b8a0139fc0840f03e20.1645489455.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# f0fdfc04 21-Feb-2022 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Fix DA914x current values

Update DA9141/2 ranges to correct errors

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/cd5732c5061ce49dcfbcebb306d12ba1664b4ea6.1645489455.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# c5187a24 29-Nov-2021 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Add DA914x support

Add the DA9141 and DA9142 regulators device recognition data and
operational parameters.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/5f5b9b02f07578cd36c6bc266349a56efc9b08d1.1638223185.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 24f08532 29-Nov-2021 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Prevent current limit change when enabled

Prevent changing current limit when enabled as a precaution against
possibile instability due to tight integration with switching cycle

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/52ee682476004a1736c1e0293358987319c1c415.1638223185.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4950486c 15-Nov-2021 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

regulator: da9121: Emit only one error message in .remove()

When an i2c remove callback fails, the i2c core emits a generic error
message and still removes the device. Apart from the message there the
return value isn't further used.

So don't return an error code after having already emitted a driver
specific warning about the problem to prevent two messages about the
same issue.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20211116110951.1213566-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0b1e5526 16-May-2021 Axel Lin <axel.lin@ingics.com>

regulator: da9121: Return REGULATOR_MODE_INVALID for invalid mode

-EINVAL is not a valid return value for .of_map_mode, return
REGULATOR_MODE_INVALID instead.

Fixes: 65ac97042d4e ("regulator: da9121: add mode support")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/20210517052721.1063375-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 013592be 20-Apr-2021 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: automotive variants identity fix

This patch fixes identification of DA913x parts by the DA9121 driver,
where a lack of clarity lead to implementation on the basis that variant
IDs were to be identical to the equivalent rated non-automotive parts.

There is a new emphasis on the DT identity to cope with overlap in these
ID's - this is not considered to be problematic, because projects would
be exclusively using automotive or consumer grade parts.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/20210421120306.DB5B880007F@slsrvapps-01.diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8db06423 07-Dec-2020 Dan Carpenter <dan.carpenter@oracle.com>

regulator: da9121: Potential Oops in da9121_assign_chip_model()

There is a missing "return ret;" on this error path so we call
"da9121_check_device_type(i2c, chip);" which will end up dereferencing
"chip->regmap" and lead to an Oops.

Fixes: c860476b9e3a ("regulator: da9121: Add device variant regmaps")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/X85soGKnWAjPUA7a@mwanda
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9536ce63 07-Dec-2020 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Fix index used for DT property

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/2cf324b68d37c4059c7995e8cab5fc9a608ea65d.1607361013.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 416c29e9 07-Dec-2020 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Remove uninitialised string variable

Erroneously left in when switched to using of_parse_cb()

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/c7a9e947a9582fe0150d860b5eab7e093cd832bb.1607361013.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# b4b27776 04-Dec-2020 Arnd Bergmann <arnd@arndb.de>

regulator: da9121: include linux/gpio/consumer.h

When CONFIG_GPIOLIB is disabled, the declarations from linux/gpio/consumer.h
are not visible:

drivers/regulator/da9121-regulator.c:371:14: error: implicit declaration of function 'fwnode_gpiod_get_index' [-Werror,-Wimplicit-function-declaration]
ena_gpiod = fwnode_gpiod_get_index(of_fwnode_handle(np), "enable", 0,
^
drivers/regulator/da9121-regulator.c:372:7: error: use of undeclared identifier 'GPIOD_OUT_HIGH'
GPIOD_OUT_HIGH |
^
drivers/regulator/da9121-regulator.c:373:7: error: use of undeclared identifier 'GPIOD_FLAGS_BIT_NONEXCLUSIVE'
GPIOD_FLAGS_BIT_NONEXCLUSIVE,

Include this explicitly to help compile testing.

Fixes: 46c413d5bb23 ("regulator: da9121: Add support for device variants via devicetree")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20201204165229.3754763-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# c8dbf2f2 03-Dec-2020 Zou Wei <zou_wei@huawei.com>

regulator: da9121: Mark some symbols with static keyword

Fix the following sparse warnings:

drivers/regulator/da9121-regulator.c:55:21: warning: symbol 'da9121_10A_2phase_current' was not declared. Should it be static?
drivers/regulator/da9121-regulator.c:63:21: warning: symbol 'da9121_6A_2phase_current' was not declared. Should it be static?
drivers/regulator/da9121-regulator.c:71:21: warning: symbol 'da9121_5A_1phase_current' was not declared. Should it be static?
drivers/regulator/da9121-regulator.c:79:21: warning: symbol 'da9121_3A_1phase_current' was not declared. Should it be static?
drivers/regulator/da9121-regulator.c:151:32: warning: symbol 'status_event_handling' was not declared. Should it be static?

Signed-off-by: Zou Wei <zou_wei@huawei.com>
Acked-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/1606994795-36182-1-git-send-email-zou_wei@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5e191d2e 02-Dec-2020 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Request IRQ directly and free in release function to avoid masking race

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/24b2d8b0c3536408369add034221b1141e58bbfc.1606908582.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 40bb5b02 30-Nov-2020 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: add interrupt support

Adds interrupt handler for variants, and notifications for events; over
temperature/voltage/current. Because the IRQs are triggered by persisting
status, they must be masked and the status polled until clear, before the
IRQ can be enabled again.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/fe21796bbcbadff84a472a4cc581ae8fafc7f8f5.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 65ac9704 30-Nov-2020 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: add mode support

Adds get/set for mode, and mapping from REGULATOR_MODE_* to select
PFM/PWM/Auto operation.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/7844c8f6facb6f7c0649381629cc75ccad14723d.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5c4b62af 30-Nov-2020 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: add current support

This commit adds support for getting/setting current for all supported
variants. Limits are adjusted per variant to match HW implementation.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/9aa80b909893dbe609730919ed595c6a8ac26606.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9929900d 30-Nov-2020 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Update registration to support multiple buck variants

Add function which iterates the regulator descriptors for the confirmed
variant ID and registers each buck.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/1fd53c3ab032ef3c8a92f80a2247381db1c09ced.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 46c413d5 30-Nov-2020 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Add support for device variants via devicetree

Add devicetree configuration and device variant parameters. Use the latter
to enable the check and use of parameters specific to dual buck variants.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/5849ce60595aef1018bdde7dcfb54a7397597545.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 91863239 30-Nov-2020 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Add device variant descriptors

Descriptors for bucks in all variants, ready for of_regulator_match

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/8f7a11d59e5ac3ba1bfd448bcfc905efc99b7874.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# c860476b 30-Nov-2020 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Add device variant regmaps

Add ability to probe device and validate configuration, then apply a regmap
configuration for a single or dual buck device accordingly.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/068c6b8d5e1b4e221e899e4c914c429429a2ec7d.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# f3fbd556 30-Nov-2020 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Add device variants

Add basic support for configuration to reference variants of this device,
and track the selected variant within the driver.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/aaabd3063593e5172fa6b605884d475df64e6d65.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 86f162c9 30-Nov-2020 Adam Ward <Adam.Ward.opensource@diasemi.com>

regulator: da9121: Add header file

Add header file for Dialog Semiconductor DA9121 regulator and related
devices, mostly autogenerated from the chip design databases, and update
driver to replace local defines with those from header.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/3527d84448d1e6ddc0fcb883ae564880f75a6cb0.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# e6ff10f2 03-Nov-2020 Vincent Whitchurch <vincent.whitchurch@axis.com>

regulator: Add support for DA9121 regulator

Add support for the Dialog Semiconductor DA9121, a single-channel
dual-phase buck converter controlled via I2C.

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Link: https://lore.kernel.org/r/20201103100021.19603-3-vincent.whitchurch@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>