diff --git a/Documentation/devicetree/bindings/regulator/anatop-regulator.txt b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt index 37c4ea076f88..1d58c8cfdbc0 100644 --- a/Documentation/devicetree/bindings/regulator/anatop-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt @@ -14,6 +14,7 @@ Optional properties: - anatop-delay-bit-shift: Bit shift for the step time register - anatop-delay-bit-width: Number of bits used in the step time register - vin-supply: The supply for this regulator +- anatop-enable-bit: Regulator enable bit offset Any property defined as part of the core regulator binding, defined in regulator.txt, can also be used. diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 3a6d0290c54c..b041f277a38b 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c @@ -301,7 +301,19 @@ static int anatop_regulator_probe(struct platform_device *pdev) return -EINVAL; } } else { + u32 enable_bit; + rdesc->ops = &anatop_rops; + + if (!of_property_read_u32(np, "anatop-enable-bit", + &enable_bit)) { + anatop_rops.enable = regulator_enable_regmap; + anatop_rops.disable = regulator_disable_regmap; + anatop_rops.is_enabled = regulator_is_enabled_regmap; + + rdesc->enable_reg = sreg->control_reg; + rdesc->enable_mask = BIT(enable_bit); + } } /* register regulator */ diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c index 302b57cb89c6..e76d094591e7 100644 --- a/drivers/regulator/arizona-ldo1.c +++ b/drivers/regulator/arizona-ldo1.c @@ -109,7 +109,7 @@ static int arizona_ldo1_hc_get_voltage_sel(struct regulator_dev *rdev) return (val & ARIZONA_LDO1_VSEL_MASK) >> ARIZONA_LDO1_VSEL_SHIFT; } -static struct regulator_ops arizona_ldo1_hc_ops = { +static const struct regulator_ops arizona_ldo1_hc_ops = { .list_voltage = arizona_ldo1_hc_list_voltage, .map_voltage = arizona_ldo1_hc_map_voltage, .get_voltage_sel = arizona_ldo1_hc_get_voltage_sel, @@ -135,7 +135,7 @@ static const struct regulator_desc arizona_ldo1_hc = { .owner = THIS_MODULE, }; -static struct regulator_ops arizona_ldo1_ops = { +static const struct regulator_ops arizona_ldo1_ops = { .list_voltage = regulator_list_voltage_linear, .map_voltage = regulator_map_voltage_linear, .get_voltage_sel = regulator_get_voltage_sel_regmap, diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c index fcb98dbda837..22bd71407622 100644 --- a/drivers/regulator/arizona-micsupp.c +++ b/drivers/regulator/arizona-micsupp.c @@ -45,6 +45,7 @@ static void arizona_micsupp_check_cp(struct work_struct *work) struct arizona_micsupp *micsupp = container_of(work, struct arizona_micsupp, check_cp_work); struct snd_soc_dapm_context *dapm = micsupp->arizona->dapm; + struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); struct arizona *arizona = micsupp->arizona; struct regmap *regmap = arizona->regmap; unsigned int reg; @@ -59,9 +60,10 @@ static void arizona_micsupp_check_cp(struct work_struct *work) if (dapm) { if ((reg & (ARIZONA_CPMIC_ENA | ARIZONA_CPMIC_BYPASS)) == ARIZONA_CPMIC_ENA) - snd_soc_dapm_force_enable_pin(dapm, "MICSUPP"); + snd_soc_component_force_enable_pin(component, + "MICSUPP"); else - snd_soc_dapm_disable_pin(dapm, "MICSUPP"); + snd_soc_component_disable_pin(component, "MICSUPP"); snd_soc_dapm_sync(dapm); } @@ -104,7 +106,7 @@ static int arizona_micsupp_set_bypass(struct regulator_dev *rdev, bool ena) return ret; } -static struct regulator_ops arizona_micsupp_ops = { +static const struct regulator_ops arizona_micsupp_ops = { .enable = arizona_micsupp_enable, .disable = arizona_micsupp_disable, .is_enabled = regulator_is_enabled_regmap, diff --git a/drivers/regulator/as3711-regulator.c b/drivers/regulator/as3711-regulator.c index c0e93b1332f7..874d415d6b4f 100644 --- a/drivers/regulator/as3711-regulator.c +++ b/drivers/regulator/as3711-regulator.c @@ -82,7 +82,7 @@ static unsigned int as3711_get_mode_sd(struct regulator_dev *rdev) return -EINVAL; } -static struct regulator_ops as3711_sd_ops = { +static const struct regulator_ops as3711_sd_ops = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, @@ -94,7 +94,7 @@ static struct regulator_ops as3711_sd_ops = { .set_mode = as3711_set_mode_sd, }; -static struct regulator_ops as3711_aldo_ops = { +static const struct regulator_ops as3711_aldo_ops = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, @@ -104,7 +104,7 @@ static struct regulator_ops as3711_aldo_ops = { .map_voltage = regulator_map_voltage_linear_range, }; -static struct regulator_ops as3711_dldo_ops = { +static const struct regulator_ops as3711_dldo_ops = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c index a3ade9e4ef47..0b9d4e3e52c7 100644 --- a/drivers/regulator/axp20x-regulator.c +++ b/drivers/regulator/axp20x-regulator.c @@ -128,11 +128,11 @@ .ops = &axp20x_ops_range, \ } -static struct regulator_ops axp20x_ops_fixed = { +static const struct regulator_ops axp20x_ops_fixed = { .list_voltage = regulator_list_voltage_linear, }; -static struct regulator_ops axp20x_ops_range = { +static const struct regulator_ops axp20x_ops_range = { .set_voltage_sel = regulator_set_voltage_sel_regmap, .get_voltage_sel = regulator_get_voltage_sel_regmap, .list_voltage = regulator_list_voltage_linear_range, @@ -141,7 +141,7 @@ static struct regulator_ops axp20x_ops_range = { .is_enabled = regulator_is_enabled_regmap, }; -static struct regulator_ops axp20x_ops = { +static const struct regulator_ops axp20x_ops = { .set_voltage_sel = regulator_set_voltage_sel_regmap, .get_voltage_sel = regulator_get_voltage_sel_regmap, .list_voltage = regulator_list_voltage_linear, @@ -150,7 +150,7 @@ static struct regulator_ops axp20x_ops = { .is_enabled = regulator_is_enabled_regmap, }; -static struct regulator_ops axp20x_ops_sw = { +static const struct regulator_ops axp20x_ops_sw = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap, diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c index 76b01835dcb4..9dd715407b39 100644 --- a/drivers/regulator/bcm590xx-regulator.c +++ b/drivers/regulator/bcm590xx-regulator.c @@ -250,7 +250,7 @@ static int bcm590xx_get_enable_register(int id) return reg; } -static struct regulator_ops bcm590xx_ops_ldo = { +static const struct regulator_ops bcm590xx_ops_ldo = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, @@ -260,7 +260,7 @@ static struct regulator_ops bcm590xx_ops_ldo = { .map_voltage = regulator_map_voltage_iterate, }; -static struct regulator_ops bcm590xx_ops_dcdc = { +static const struct regulator_ops bcm590xx_ops_dcdc = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, @@ -270,7 +270,7 @@ static struct regulator_ops bcm590xx_ops_dcdc = { .map_voltage = regulator_map_voltage_linear_range, }; -static struct regulator_ops bcm590xx_ops_vbus = { +static const struct regulator_ops bcm590xx_ops_vbus = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap,