mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 11:03:07 -04:00
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>
This commit is contained in:
committed by
Mark Brown
parent
bde9b2c351
commit
99bc5744e9
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user