diff options
| author | Kiran Gunda <kgunda@codeaurora.org> | 2017-05-03 12:11:20 +0530 |
|---|---|---|
| committer | Kiran Gunda <kgunda@codeaurora.org> | 2017-05-04 14:33:41 +0530 |
| commit | 8f48ec6a5abca8351e6511c51bc6bb1e247bbdab (patch) | |
| tree | b54b5b00587d1d9fc448501bd7a76aee80a9f21a | |
| parent | 08e56dd325923c76752d160a3ee2b938bad66e48 (diff) | |
regulator: onsemi-ncp6335d: Add is_enabled API support
Without is_enabled function support, regualtor framework treats
it as an always on regulator and does not invoke the regulator enable
function call. Hence, add support for it.
Also, define a parent supply ("vin") for the regulator. This parent
can be used to pin-control the regulator. While at it, change the initcall
level to subsys_init. so that the driver registers after the parent supply
("vin" - provided by fixed-regualtor).
Change-Id: I93e870d2e4b89f7874c3e17be91bc417dadf1777
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
| -rw-r--r-- | drivers/regulator/onsemi-ncp6335d.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/regulator/onsemi-ncp6335d.c b/drivers/regulator/onsemi-ncp6335d.c index 595fde1c825f..3b4ca4f81527 100644 --- a/drivers/regulator/onsemi-ncp6335d.c +++ b/drivers/regulator/onsemi-ncp6335d.c @@ -153,6 +153,20 @@ static void ncp633d_slew_delay(struct ncp6335d_info *dd, udelay(delay); } +static int ncp6335d_is_enabled(struct regulator_dev *rdev) +{ + int rc, val = 0; + struct ncp6335d_info *dd = rdev_get_drvdata(rdev); + + rc = ncp6335x_read(dd, dd->vsel_reg, &val); + if (rc) + dev_err(dd->dev, "Unable to read enable register rc(%d)", rc); + + dump_registers(dd, dd->vsel_reg, __func__); + + return ((val & NCP6335D_ENABLE) ? 1 : 0); +} + static int ncp6335d_enable(struct regulator_dev *rdev) { int rc; @@ -297,6 +311,7 @@ static struct regulator_ops ncp6335d_ops = { .set_voltage = ncp6335d_set_voltage, .get_voltage = ncp6335d_get_voltage, .list_voltage = ncp6335d_list_voltage, + .is_enabled = ncp6335d_is_enabled, .enable = ncp6335d_enable, .disable = ncp6335d_disable, .set_mode = ncp6335d_set_mode, @@ -305,6 +320,7 @@ static struct regulator_ops ncp6335d_ops = { static struct regulator_desc rdesc = { .name = "ncp6335d", + .supply_name = "vin", .owner = THIS_MODULE, .n_voltages = NCP6335D_VOLTAGE_STEPS, .ops = &ncp6335d_ops, @@ -748,7 +764,7 @@ int __init ncp6335d_regulator_init(void) return i2c_add_driver(&ncp6335d_regulator_driver); } EXPORT_SYMBOL(ncp6335d_regulator_init); -arch_initcall(ncp6335d_regulator_init); +subsys_initcall(ncp6335d_regulator_init); static void __exit ncp6335d_regulator_exit(void) { |
