regulator: Support list_voltage for fixed voltage regulator
PATCH 1/2 regulator: Support list_voltage for fixed voltage regulator
Signed-off-by Mark Brown <[email protected]>
--- drivers/regulator/fixed.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-)
drivers/regulator/fixed.c +14 -1
@@ -44,10 +44,22 @@ static int fixed_voltage_get_voltage(struct regulator_dev *dev)return data->microvolts; } +static int fixed_voltage_list_voltage (struct regulator_dev *dev, +unsigned selector) +{ +struct fixed_voltage_data *data =rdev_get_drvdata (dev); + +if (selector !=0 ) +return -EINVAL ; + +return data->microvolts; +} +static struct regulator_ops fixed_voltage_ops = { .is_enabled = fixed_voltage_is_enabled, .enable = fixed_voltage_enable, .get_voltage = fixed_voltage_get_voltage, + .list_voltage = fixed_voltage_list_voltage, };static int regulator_fixed_voltage_probe (struct platform_device *pdev)
@@ -69,7 +81,8 @@ static int regulator_fixed_voltage_probe(struct platform_device *pdev) } drvdata->desc.type =REGULATOR_VOLTAGE ; drvdata->desc.owner =THIS_MODULE ; - drvdata->desc.ops = &fixed_voltage_ops, + drvdata->desc.ops = &fixed_voltage_ops; + drvdata->desc.n_voltages =1 ; drvdata->microvolts = config->microvolts;
Signature · 1 line
1.6.2.4
PATCH 2/2 regulator: Set MODULE_ALIAS for regulator drivers
Several of the regulator drivers didn't have MODULE_ALIAS so couldn't be auto loaded. Add the MODULE_ALIAS in case they do get built as modules.
Signed-off-by Mark Brown <[email protected]>
--- drivers/regulator/fixed.c | 1 + drivers/regulator/virtual.c | 1 + drivers/regulator/wm8350-regulator.c | 1 + 3 files changed, 3 insertions(+), 0 deletions(-)
drivers/regulator/fixed.c +1 -0
@@ -141,3 +141,4 @@ module_exit(regulator_fixed_voltage_exit);MODULE_AUTHOR ("Mark Brown <[email protected]>" );MODULE_DESCRIPTION ("Fixed voltage regulator" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:reg-fixed-voltage" );
drivers/regulator/virtual.c +1 -0
@@ -347,3 +347,4 @@ module_exit(regulator_virtual_consumer_exit);MODULE_AUTHOR ("Mark Brown <[email protected]>" );MODULE_DESCRIPTION ("Virtual regulator consumer" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:reg-virt-consumer" );
drivers/regulator/wm8350-regulator.c +1 -0
@@ -1570,3 +1570,4 @@ module_exit(wm8350_regulator_exit);MODULE_AUTHOR ("Liam Girdwood" );MODULE_DESCRIPTION ("WM8350 voltage and current regulator driver" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:wm8350-regulator" );
Signature · 1 line
1.6.2.4
Liam Girdwood
AppliedRe: [PATCH 2/2] regulator: Set MODULE_ALIAS for regulator drivers
Quoted 10 lines · Mark Brown
Several of the regulator drivers didn't have
MODULE_ALIASso couldn't be auto loaded. Add theMODULE_ALIASin case they do get built as modules.Signed-off-by Mark Brown <[email protected]>--- drivers/regulator/fixed.c | 1 + drivers/regulator/virtual.c | 1 + drivers/regulator/wm8350-regulator.c | 1 + 3 files changed, 3 insertions(+), 0 deletions(-)
Applied.
Thanks
Liam
Liam Girdwood
AppliedQuoted 33 lines · Mark Brown
Signed-off-by Mark Brown <[email protected]>--- drivers/regulator/fixed.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-)drivers/regulator/fixed.c +12
-0@@ -44,10 +44,22 @@ static int fixed_voltage_get_voltage(struct regulator_dev *dev)return data->microvolts; } +static int fixed_voltage_list_voltage (struct regulator_dev *dev, +unsigned selector) +{ +struct fixed_voltage_data *data =rdev_get_drvdata (dev); + +if (selector !=0 ) +return -EINVAL ; + +return data->microvolts; +} +static struct regulator_ops fixed_voltage_ops = { .is_enabled = fixed_voltage_is_enabled, .enable = fixed_voltage_enable, .get_voltage = fixed_voltage_get_voltage, + .list_voltage = fixed_voltage_list_voltage, };static int regulator_fixed_voltage_probe (struct platform_device *pdev)
drivers/regulator/fixed.c static int regulator_fixed_voltage_probe(struct platform_device *pdev) · line 88
Quoted 9 lines
drivers/regulator/fixed.c +2
-1@@ -69,7 +81,8 @@ static int regulator_fixed_voltage_probe(struct platform_device *pdev) } drvdata->desc.type =REGULATOR_VOLTAGE ; drvdata->desc.owner =THIS_MODULE ; - drvdata->desc.ops = &fixed_voltage_ops, + drvdata->desc.ops = &fixed_voltage_ops; + drvdata->desc.n_voltages =1 ; drvdata->microvolts = config->microvolts;
Applied.
Thanks
Liam