regulator: Convert pcap-regulator to get_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
d5ec96357d
commit
3cbff37ea0
1 changed files with 4 additions and 7 deletions
|
@ -165,21 +165,18 @@ static int pcap_regulator_set_voltage_sel(struct regulator_dev *rdev,
|
||||||
selector << vreg->index);
|
selector << vreg->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pcap_regulator_get_voltage(struct regulator_dev *rdev)
|
static int pcap_regulator_get_voltage_sel(struct regulator_dev *rdev)
|
||||||
{
|
{
|
||||||
struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
|
struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
|
||||||
void *pcap = rdev_get_drvdata(rdev);
|
void *pcap = rdev_get_drvdata(rdev);
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
int mV;
|
|
||||||
|
|
||||||
if (vreg->n_voltages == 1)
|
if (vreg->n_voltages == 1)
|
||||||
return vreg->voltage_table[0] * 1000;
|
return 0;
|
||||||
|
|
||||||
ezx_pcap_read(pcap, vreg->reg, &tmp);
|
ezx_pcap_read(pcap, vreg->reg, &tmp);
|
||||||
tmp = ((tmp >> vreg->index) & (vreg->n_voltages - 1));
|
tmp = ((tmp >> vreg->index) & (vreg->n_voltages - 1));
|
||||||
mV = vreg->voltage_table[tmp];
|
return tmp;
|
||||||
|
|
||||||
return mV * 1000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pcap_regulator_enable(struct regulator_dev *rdev)
|
static int pcap_regulator_enable(struct regulator_dev *rdev)
|
||||||
|
@ -228,7 +225,7 @@ static int pcap_regulator_list_voltage(struct regulator_dev *rdev,
|
||||||
static struct regulator_ops pcap_regulator_ops = {
|
static struct regulator_ops pcap_regulator_ops = {
|
||||||
.list_voltage = pcap_regulator_list_voltage,
|
.list_voltage = pcap_regulator_list_voltage,
|
||||||
.set_voltage_sel = pcap_regulator_set_voltage_sel,
|
.set_voltage_sel = pcap_regulator_set_voltage_sel,
|
||||||
.get_voltage = pcap_regulator_get_voltage,
|
.get_voltage_sel = pcap_regulator_get_voltage_sel,
|
||||||
.enable = pcap_regulator_enable,
|
.enable = pcap_regulator_enable,
|
||||||
.disable = pcap_regulator_disable,
|
.disable = pcap_regulator_disable,
|
||||||
.is_enabled = pcap_regulator_is_enabled,
|
.is_enabled = pcap_regulator_is_enabled,
|
||||||
|
|
Reference in a new issue