mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
rk:act8846:support regulator_set_voltage_time, disable act8846 gpio3 when power on
This commit is contained in:
@@ -430,6 +430,23 @@ static int act8846_dcdc_set_mode(struct regulator_dev *dev, unsigned int mode)
|
||||
|
||||
|
||||
}
|
||||
static int act8846_dcdc_set_voltage_time_sel(struct regulator_dev *dev, unsigned int old_selector,
|
||||
unsigned int new_selector)
|
||||
{
|
||||
struct act8846 *act8846 = rdev_get_drvdata(dev);
|
||||
int ret =0,old_volt, new_volt;
|
||||
|
||||
old_volt = act8846_dcdc_list_voltage(dev, old_selector);
|
||||
if (old_volt < 0)
|
||||
return old_volt;
|
||||
|
||||
new_volt = act8846_dcdc_list_voltage(dev, new_selector);
|
||||
if (new_volt < 0)
|
||||
return new_volt;
|
||||
|
||||
return DIV_ROUND_UP(abs(old_volt - new_volt)*2, 25000);
|
||||
}
|
||||
|
||||
static struct regulator_ops act8846_dcdc_ops = {
|
||||
.set_voltage = act8846_dcdc_set_voltage,
|
||||
.get_voltage = act8846_dcdc_get_voltage,
|
||||
@@ -440,6 +457,7 @@ static struct regulator_ops act8846_dcdc_ops = {
|
||||
.get_mode = act8846_dcdc_get_mode,
|
||||
.set_mode = act8846_dcdc_set_mode,
|
||||
.set_suspend_voltage = act8846_dcdc_set_sleep_voltage,
|
||||
.set_voltage_time_sel = act8846_dcdc_set_voltage_time_sel,
|
||||
};
|
||||
static struct regulator_desc regulators[] = {
|
||||
|
||||
@@ -726,6 +744,12 @@ static int __devinit act8846_i2c_probe(struct i2c_client *i2c, const struct i2c_
|
||||
printk("The device is not act8846 \n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = act8846_set_bits(act8846, 0xf4,(0x1<<7),(0x0<<7));
|
||||
if (ret < 0) {
|
||||
printk("act8846 set 0xf4 error!\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (pdata) {
|
||||
ret = setup_regulators(act8846, pdata);
|
||||
|
||||
Reference in New Issue
Block a user