/* Time (micro sec) taken for 1uV change */
int voltage_change_uv_per_us;
+ unsigned int config_flags;
};
static inline struct device *to_tps6591x_dev(struct regulator_dev *rdev)
}
tps_pdata = pdev->dev.platform_data;
ri->ectrl = tps_pdata->ectrl;
+ ri->config_flags = tps_pdata->flags;
if (tps_pdata->slew_rate_uV_per_us)
ri->voltage_change_uv_per_us = tps_pdata->slew_rate_uV_per_us;
}
}
+static int tps6591x_suspend(struct platform_device *pdev)
+{
+ struct regulator_dev *rdev = platform_get_drvdata(pdev);
+ struct tps6591x_regulator *ri = rdev_get_drvdata(rdev);
+ struct device *parent = to_tps6591x_dev(rdev);
+ int ret = 0;
+ uint8_t reg_val;
+
+ if (ri->config_flags & LDO_LOW_POWER_ON_SUSPEND) {
+ ret = tps6591x_clr_bits(parent, ri->en1_reg.addr,
+ (1 << ri->en1_reg.shift_bits));
+ reg_val = ri->supply_reg.cache_val;
+ reg_val = (reg_val & ~0x3) | (0x3);
+ ret = tps6591x_write(parent, ri->supply_reg.addr, reg_val);
+ if (ret >= 0)
+ ri->supply_reg.cache_val = reg_val;
+ else
+ dev_err(&pdev->dev, "Error in updating the supply state\n");
+ }
+ return ret;
+}
+
+static int tps6591x_resume(struct platform_device *pdev)
+{
+ struct regulator_dev *rdev = platform_get_drvdata(pdev);
+ struct tps6591x_regulator *ri = rdev_get_drvdata(rdev);
+ struct device *parent = to_tps6591x_dev(rdev);
+ int ret = 0;
+ uint8_t reg_val;
+
+ if (ri->config_flags & LDO_LOW_POWER_ON_SUSPEND) {
+ ret = tps6591x_clr_bits(parent, ri->en1_reg.addr,
+ (1 << ri->en1_reg.shift_bits));
+ reg_val = ri->supply_reg.cache_val;
+ reg_val = (reg_val & ~0x3) | (0x1);
+ ret = tps6591x_write(parent, ri->supply_reg.addr, reg_val);
+ if (ret >= 0)
+ ri->supply_reg.cache_val = reg_val;
+ else
+ dev_err(&pdev->dev, "Error in updating the supply state\n");
+ }
+ return ret;
+}
+
static struct platform_driver tps6591x_regulator_driver = {
.driver = {
.name = "tps6591x-regulator",
.probe = tps6591x_regulator_probe,
.remove = __devexit_p(tps6591x_regulator_remove),
.shutdown = tps6591x_regulator_shutdown,
+ .suspend = tps6591x_suspend,
+ .resume = tps6591x_resume,
};
static int __init tps6591x_regulator_init(void)