regulator: fixed: Don't supply voltage change ops when no GPIO is given
Rather than replicating the core support for always on regulators use a different set of ops with none of the enable related operations provided when we don't have any ops. This ensures that we automatically pick up any enhanced support for such regulators that the core has such as the warnings about regulation constraints that can't be used. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Родитель
c45bb35f8b
Коммит
9d442061da
|
@ -105,10 +105,8 @@ static int fixed_voltage_enable(struct regulator_dev *dev)
|
||||||
{
|
{
|
||||||
struct fixed_voltage_data *data = rdev_get_drvdata(dev);
|
struct fixed_voltage_data *data = rdev_get_drvdata(dev);
|
||||||
|
|
||||||
if (gpio_is_valid(data->gpio)) {
|
gpio_set_value_cansleep(data->gpio, data->enable_high);
|
||||||
gpio_set_value_cansleep(data->gpio, data->enable_high);
|
data->is_enabled = true;
|
||||||
data->is_enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -117,10 +115,8 @@ static int fixed_voltage_disable(struct regulator_dev *dev)
|
||||||
{
|
{
|
||||||
struct fixed_voltage_data *data = rdev_get_drvdata(dev);
|
struct fixed_voltage_data *data = rdev_get_drvdata(dev);
|
||||||
|
|
||||||
if (gpio_is_valid(data->gpio)) {
|
gpio_set_value_cansleep(data->gpio, !data->enable_high);
|
||||||
gpio_set_value_cansleep(data->gpio, !data->enable_high);
|
data->is_enabled = false;
|
||||||
data->is_enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +149,7 @@ static int fixed_voltage_list_voltage(struct regulator_dev *dev,
|
||||||
return data->microvolts;
|
return data->microvolts;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct regulator_ops fixed_voltage_ops = {
|
static struct regulator_ops fixed_voltage_gpio_ops = {
|
||||||
.is_enabled = fixed_voltage_is_enabled,
|
.is_enabled = fixed_voltage_is_enabled,
|
||||||
.enable = fixed_voltage_enable,
|
.enable = fixed_voltage_enable,
|
||||||
.disable = fixed_voltage_disable,
|
.disable = fixed_voltage_disable,
|
||||||
|
@ -162,6 +158,11 @@ static struct regulator_ops fixed_voltage_ops = {
|
||||||
.list_voltage = fixed_voltage_list_voltage,
|
.list_voltage = fixed_voltage_list_voltage,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct regulator_ops fixed_voltage_ops = {
|
||||||
|
.get_voltage = fixed_voltage_get_voltage,
|
||||||
|
.list_voltage = fixed_voltage_list_voltage,
|
||||||
|
};
|
||||||
|
|
||||||
static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
|
static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct fixed_voltage_config *config;
|
struct fixed_voltage_config *config;
|
||||||
|
@ -192,7 +193,6 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
drvdata->desc.type = REGULATOR_VOLTAGE;
|
drvdata->desc.type = REGULATOR_VOLTAGE;
|
||||||
drvdata->desc.owner = THIS_MODULE;
|
drvdata->desc.owner = THIS_MODULE;
|
||||||
drvdata->desc.ops = &fixed_voltage_ops;
|
|
||||||
|
|
||||||
if (config->microvolts)
|
if (config->microvolts)
|
||||||
drvdata->desc.n_voltages = 1;
|
drvdata->desc.n_voltages = 1;
|
||||||
|
@ -242,11 +242,10 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
|
||||||
goto err_gpio;
|
goto err_gpio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drvdata->desc.ops = &fixed_voltage_gpio_ops;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* Regulator without GPIO control is considered
|
drvdata->desc.ops = &fixed_voltage_ops;
|
||||||
* always enabled
|
|
||||||
*/
|
|
||||||
drvdata->is_enabled = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drvdata->dev = regulator_register(&drvdata->desc, &pdev->dev,
|
drvdata->dev = regulator_register(&drvdata->desc, &pdev->dev,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче