diff options
author | Sebastian Reichel <sebastian.reichel@collabora.co.uk> | 2017-07-10 16:33:40 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-07-17 12:12:58 +0100 |
commit | 74ff8e06510196dfa31679010d9a05c5cdc39754 (patch) | |
tree | ac9b7f75e05e1ece92af7bd3840a2924ac414d96 /drivers/regulator | |
parent | 91a024e80336528d12b67b5a2e636b9e4467d3ec (diff) | |
download | linux-74ff8e06510196dfa31679010d9a05c5cdc39754.tar.bz2 |
regulator: cpcap: Add OF mode mapping
Add device tree mode mapping capabilities to the cpcap driver.
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/cpcap-regulator.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/regulator/cpcap-regulator.c b/drivers/regulator/cpcap-regulator.c index ce1cab320f6f..f541b80f1b54 100644 --- a/drivers/regulator/cpcap-regulator.c +++ b/drivers/regulator/cpcap-regulator.c @@ -123,6 +123,7 @@ struct cpcap_regulator { .enable_val = (mode_val), \ .disable_val = (off_val), \ .ramp_delay = (volt_trans_time), \ + .of_map_mode = cpcap_map_mode, \ }, \ .assign_reg = (assignment_reg), \ .assign_mask = (assignment_mask), \ @@ -213,6 +214,18 @@ static int cpcap_regulator_disable(struct regulator_dev *rdev) return error; } +static unsigned int cpcap_map_mode(unsigned int mode) +{ + switch (mode) { + case CPCAP_BIT_AUDIO_NORMAL_MODE: + return REGULATOR_MODE_NORMAL; + case CPCAP_BIT_AUDIO_LOW_PWR: + return REGULATOR_MODE_STANDBY; + default: + return -EINVAL; + } +} + static unsigned int cpcap_regulator_get_mode(struct regulator_dev *rdev) { int value; |