summaryrefslogtreecommitdiff
path: root/drivers/regulator/mcp16502.c
AgeCommit message (Collapse)AuthorFilesLines
2024-05-27regulator: Drop explicit initialization of struct i2c_device_id::driver_data ↵Uwe Kleine-König1-1/+1
to 0 These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member. This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own. While add it, also remove commas after the sentinel entries. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://msgid.link/r/20240513080525.2353168-2-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-09regulator: mcp16502: Remove redundant of_match_ptr() macrosChen Jiahao1-3/+3
Since the driver mcp16502 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-5-chenjiahao16@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-08regulator: mcp16502: Drop useless headerLinus Walleij1-1/+0
The mcp16502 regulator driver includes the legacy header <linux/gpio.h> for no reason, it is already using the proper <linux/gpio/consumer.h> include. Drop the include. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230808-descriptors-regulator-v1-7-939b5e84dd18@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-08regulator: Switch i2c drivers back to use .probe()Uwe Kleine-König1-1/+1
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
2023-03-20regulator: Set PROBE_PREFER_ASYNCHRONOUS for drivers between 4.19 and 5.4Douglas Anderson1-0/+1
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 4.19 but did exist in Linux 5.4. Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://lore.kernel.org/r/20230316125351.3.I45bf925ca9537da5f647e2acb0ad207c0c98af81@changeid Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-18regulator: mcp16502: add enum MCP16502_REG_HPM descriptionRandy Dunlap1-0/+1
Add description for MCP16502_REG_HPM to prevent a kernel-doc warning: drivers/regulator/mcp16502.c:90: warning: Enum value 'MCP16502_REG_HPM' not described in enum 'mcp16502_reg' Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/20230117070139.28905-1-rdunlap@infradead.org Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-01regulator: mcp16502: Convert to use regulator_set_ramp_delay_regmapAxel Lin1-48/+26
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/20210526125026.82549-2-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-01regulator: mcp16502: Convert to use .probe_newAxel Lin1-3/+2
Use the new .probe_new for mcp16502. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20210526125026.82549-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-07regulator: mcp16502: lpm pin can be optional on some platformsClaudiu Beznea1-1/+1
On some platform (e.g. SAMA7G5) LPM pin should be optional as it can be controlled explicitly (via shutdown controller registers) in the platform specific power saving code to decrease the power consumption while suspended as this SoC pin may be connected to other devices that could take power saving actions based on its value. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/1610028927-9842-3-git-send-email-claudiu.beznea@microchip.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13regulator: mcp16502: remove void documentation of struct mcp16502Claudiu Beznea1-2/+0
struct mcp16502 has no members called rdev or rmap. Remove the documentation. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/1605280870-32432-7-git-send-email-claudiu.beznea@microchip.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13regulator: mcp16502: add support for ramp delayClaudiu Beznea1-2/+87
MCP16502 have configurable ramp delay support (via DVSR bits in regulators' CFG register). Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/1605280870-32432-6-git-send-email-claudiu.beznea@microchip.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13regulator: mcp16502: adapt for get/set on other registersClaudiu Beznea1-16/+27
MCP16502 have multiple registers for each regulator (as described in enum mcp16502_reg). Adapt the code to be able to get/set all these registers. This is necessary for the following commits. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/1605280870-32432-5-git-send-email-claudiu.beznea@microchip.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13regulator: mcp16502: add linear_min_selClaudiu Beznea1-0/+1
Selectors b/w zero and VDD_LOW_SEL are not valid. Use linear_min_sel. Fixes: 919261c03e7ca ("regulator: mcp16502: add regulator driver for MCP16502") Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/1605280870-32432-4-git-send-email-claudiu.beznea@microchip.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-08regulator: use linear_ranges helperMatti Vaittinen1-2/+2
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>
2019-04-11regulator: mcp16502: Remove setup_regulators functionAxel Lin1-26/+11
It seems a little bit odd current code pass struct regulator_config rather than a pointer to setup_regulators. The setup_regulators is so simple and only has one caller, so remove it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-11regulator: mcp16502: Remove unneeded fields from struct mcp16502Axel Lin1-24/+16
At the context with rdev, we can use rdev->regmap instead of mcp->rmap. The *rdev[NUM_REGULATORS] is not required because current code uses devm_regulator_register() so we don't need to store *rdev for clean up paths. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-26regulator: mcp16502: Remove module versionAxel Lin1-1/+0
The module version is unlikely to be updated, use kernel version should be enough. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-28regulator: mcp16502: Include linux/gpio/consumer.h to fix build errorAxel Lin1-0/+1
Fix below build error: drivers/regulator/mcp16502.c: In function ‘mcp16502_gpio_set_mode’: drivers/regulator/mcp16502.c:135:3: error: implicit declaration of function ‘gpiod_set_value’; did you mean ‘gpio_set_value’? [-Werror=implicit-function-declaration] gpiod_set_value(mcp->lpm, 0); ^~~~~~~~~~~~~~~ gpio_set_value drivers/regulator/mcp16502.c: In function ‘mcp16502_probe’: drivers/regulator/mcp16502.c:486:13: error: implicit declaration of function ‘devm_gpiod_get’; did you mean ‘devm_gpio_free’? [-Werror=implicit-function-declaration] mcp->lpm = devm_gpiod_get(dev, "lpm", GPIOD_OUT_LOW); ^~~~~~~~~~~~~~ devm_gpio_free drivers/regulator/mcp16502.c:486:40: error: ‘GPIOD_OUT_LOW’ undeclared (first use in this function); did you mean ‘GPIOF_INIT_LOW’? mcp->lpm = devm_gpiod_get(dev, "lpm", GPIOD_OUT_LOW); ^~~~~~~~~~~~~ GPIOF_INIT_LOW Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-20regulator: mcp16502: Fix missing n_voltages settingAxel Lin1-0/+1
The n_voltages setting is not set, fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-20regulator: mcp16502: Use #ifdef CONFIG_PM_SLEEP around ↵Axel Lin1-5/+2
mcp16502_suspend/resume_noirq mcp16502_suspend/resume_noirq is only used by SET_NOIRQ_SYSTEM_SLEEP_PM_OPS when CONFIG_PM_SLEEP is defined. So use #ifdef CONFIG_PM_SLEEP instead CONFIG_SUSPEND guard. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-19regulator: mcp16502: code cleanupAndrei.Stefanescu@microchip.com1-3/+3
This patch does the following: - align parameter with parenthesis - fix compile error If CONFIG_SUSPEND is not set the dummy pm_ops callbacks are named mcp16502_suspend and mcp16502_resume instead of mcp16502_suspend_noirq and mcp16502_resume_noirq. Excerpt from compile log (kbuild test robot): In file included from include/linux/device.h:23:0, from include/linux/gpio/driver.h:5, from include/asm-generic/gpio.h:13, from include/linux/gpio.h:62, from drivers/regulator/mcp16502.c:11: >> drivers/regulator/mcp16502.c:527:32: error: 'mcp16502_suspend_noirq' undeclared here (not in a function); did you mean 'mcp16502_suspend'? SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mcp16502_suspend_noirq, >> drivers/regulator/mcp16502.c:528:10: error: 'mcp16502_resume_noirq' undeclared here (not in a function); did you mean 'mcp16502_suspend_noirq'? mcp16502_resume_noirq) vim +527 drivers/regulator/mcp16502.c 524 525 #ifdef CONFIG_PM 526 static const struct dev_pm_ops mcp16502_pm_ops = { > 527 SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mcp16502_suspend_noirq, > 528 mcp16502_resume_noirq) 529 }; 530 #endif 531 static const struct i2c_device_id mcp16502_i2c_id[] = { 532 { "mcp16502", 0 }, 533 { } 534 }; 535 MODULE_DEVICE_TABLE(i2c, mcp16502_i2c_id); 536 Signed-off-by: Andrei Stefanescu <andrei.stefanescu@microchip.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-14regulator: mcp16502: add support for suspendAndrei.Stefanescu@microchip.com1-0/+34
This patch adds support for entering/resuming suspend states. It does this by setting the LPM pin of the PMIC. When suspending the PMIC will enter the Low-power mode when the LPM pin will be set to high. If the suspend target state is suspend-to-mem, the PMIC will transition to Hibernate mode, otherwise, if it is standby, it will remain in Low-power mode. Signed-off-by: Andrei Stefanescu <andrei.stefanescu@microchip.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-13regulator: mcp16502: add regulator driver for MCP16502Andrei.Stefanescu@microchip.com1-0/+520
This patch adds a regulator driver for the MCP16502 PMIC. This drivers supports basic operations through the regulator interface such as: - setting/reading voltage - setting/reading operating mode - reading current status Signed-off-by: Andrei Stefanescu <andrei.stefanescu@microchip.com> Signed-off-by: Mark Brown <broonie@kernel.org>