summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Krawiec <victor.krawiec@arturia.com>2026-07-23 11:40:01 +0200
committerMark Brown <broonie@kernel.org>2026-07-28 19:23:29 +0100
commit99bc5744e966911e706b857feba7cd877ec3ccb4 (patch)
tree56d532a23e14527b845f2c2640b9827eee1c313b
parentbde9b2c351c8009a270054d3822e164af0ecfdb0 (diff)
downloadlinux-next-99bc5744e966911e706b857feba7cd877ec3ccb4.tar.gz
linux-next-99bc5744e966911e706b857feba7cd877ec3ccb4.zip
regulator: fan53555: Add support for mode operations on Silergy devices
Make the PWM mode configurable from devicetree. Some boards require forced PWM mode to keep the supply ripple within acceptable limits under light load conditions Support is restricted to Silergy manufacturer as it is the only one currently tested. Signed-off-by: Victor Krawiec <victor.krawiec@arturia.com> Link: https://patch.msgid.link/20260723094001.120264-5-victor.krawiec@arturia.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/regulator/fan53555.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c
index c282236959b1..85f46874eb49 100644
--- a/drivers/regulator/fan53555.c
+++ b/drivers/regulator/fan53555.c
@@ -21,6 +21,7 @@
#include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
#include <linux/slab.h>
+#include <dt-bindings/regulator/fcs,fan53555-regulator.h>
/* Voltage setting */
#define FAN53555_VSEL0 0x00
@@ -389,6 +390,18 @@ static int rk8602_voltages_setup_rockchip(struct fan53555_device_info *di)
return 0;
}
+static inline unsigned int fan53555_map_mode(unsigned int mode)
+{
+ switch (mode) {
+ case FAN53555_REGULATOR_MODE_FORCE_PWM:
+ return REGULATOR_MODE_FAST;
+ case FAN53555_REGULATOR_MODE_AUTO:
+ return REGULATOR_MODE_NORMAL;
+ default:
+ return REGULATOR_MODE_INVALID;
+ }
+}
+
static int fan53555_voltages_setup_silergy(struct fan53555_device_info *di)
{
/* Init voltage range and step */
@@ -586,6 +599,17 @@ static int fan53555_device_setup(struct fan53555_device_info *di,
return ret;
}
+static void fan53555_device_mode_map_setup(struct fan53555_device_info *di)
+{
+ switch (di->vendor) {
+ case FAN53555_VENDOR_SILERGY:
+ di->desc.of_map_mode = fan53555_map_mode;
+ break;
+ default:
+ break;
+ }
+}
+
static int fan53555_regulator_register(struct fan53555_device_info *di,
struct regulator_config *config)
{
@@ -686,6 +710,10 @@ static int fan53555_regulator_probe(struct i2c_client *client)
if (!di)
return -ENOMEM;
+ di->vendor = (uintptr_t)i2c_get_match_data(client);
+
+ fan53555_device_mode_map_setup(di);
+
pdata = dev_get_platdata(&client->dev);
if (!pdata)
pdata = fan53555_parse_dt(&client->dev, np, &di->desc);
@@ -695,7 +723,6 @@ static int fan53555_regulator_probe(struct i2c_client *client)
"Platform data not found!\n");
di->regulator = pdata->regulator;
- di->vendor = (uintptr_t)i2c_get_match_data(client);
if (!dev_fwnode(&client->dev)) {
/* if no ramp constraint set, get the pdata ramp_delay */
if (!di->regulator->constraints.ramp_delay) {