Add is_enabled interface for anatop regulator in case some drivers need to know regulator's status.
Signed-off-by: Anson Huang <b20...@freescale.com> --- drivers/regulator/anatop-regulator.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index c734d09..770d836 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c @@ -97,10 +97,25 @@ static int anatop_regmap_get_voltage_sel(struct regulator_dev *reg) return regulator_get_voltage_sel_regmap(reg); } +static int anatop_regmap_is_enabled(struct regulator_dev *reg) +{ + struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); + u32 val; + + if (!anatop_reg->control_reg) + return -ENOTSUPP; + + regmap_read(anatop_reg->anatop, anatop_reg->control_reg, &val); + + return (val >> anatop_reg->vol_bit_shift) & + ((1 << anatop_reg->vol_bit_width) - 1) ? 1 : 0; +} + static struct regulator_ops anatop_rops = { .set_voltage_sel = anatop_regmap_set_voltage_sel, .set_voltage_time_sel = anatop_regmap_set_voltage_time_sel, .get_voltage_sel = anatop_regmap_get_voltage_sel, + .is_enabled = anatop_regmap_is_enabled, .list_voltage = regulator_list_voltage_linear, .map_voltage = regulator_map_voltage_linear, }; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/