From f873212d3ed5a49c28b559f129136999014d6508 Mon Sep 17 00:00:00 2001 From: Elaine Zhang Date: Mon, 22 Aug 2016 10:03:38 +0800 Subject: [PATCH] regulator: fan53555: add regulator-initial-mode to set default mode regulator-initial-mode: default mode to set on startup regulator-initial-mode is set as: REGULATOR_MODE_FAST 0x1 REGULATOR_MODE_NORMAL 0x2 Example: vdd_cpu_b: syr827@40 { compatible = "silergy,syr827"; reg = <0x40>; vin-supply = <&vcc5v0_sys>; regulator-compatible = "fan53555-reg"; regulator-name = "vdd_cpu_b"; regulator-min-microvolt = <712500>; regulator-max-microvolt = <1500000>; regulator-ramp-delay = <1000>; fcs,suspend-voltage-selector = <1>; regulator-always-on; regulator-boot-on; regulator-initial-state = <3>; regulator-initial-mode = <1>;/*1:pwm 2: auto mode*/ regulator-state-mem { regulator-off-in-suspend; }; }; Change-Id: I4d3bbd50fd40531113f2cc6fe63905e24888a752 Signed-off-by: Elaine Zhang --- drivers/regulator/fan53555.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index 2cb5cc311610..1ddb9d12dda3 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c @@ -93,6 +93,12 @@ struct fan53555_device_info { unsigned int sleep_vol_cache; }; +static unsigned int fan53555_map_mode(unsigned int mode) +{ + return mode == REGULATOR_MODE_FAST ? + REGULATOR_MODE_FAST : REGULATOR_MODE_NORMAL; +} + static int fan53555_set_suspend_voltage(struct regulator_dev *rdev, int uV) { struct fan53555_device_info *di = rdev_get_drvdata(rdev); @@ -372,6 +378,8 @@ static int fan53555_regulator_probe(struct i2c_client *client, if (!di) return -ENOMEM; + di->desc.of_map_mode = fan53555_map_mode; + pdata = dev_get_platdata(&client->dev); if (!pdata) pdata = fan53555_parse_dt(&client->dev, np, &di->desc); -- 2.34.1