diff options
Diffstat (limited to 'drivers/regulator/core.c')
| -rw-r--r-- | drivers/regulator/core.c | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index d158715e..b754f4bd 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1948,6 +1948,16 @@ int regulator_enable(struct regulator *regulator) struct regulator_dev *rdev = regulator->rdev; int ret = 0; + /* lenovo.sw begin. chenyb1 add to dump ldo using info */ + #ifdef CONFIG_LENOVO_PM_LOG + if (strstr(rdev_get_name(rdev), "l6")) + printk(KERN_WARNING "ldo=%s,supply=%s+\n", rdev_get_name(rdev), regulator->supply_name); + if (strstr(rdev_get_name(rdev), "l17")) + printk(KERN_WARNING "ldo=%s,supply=%s+\n", rdev_get_name(rdev), regulator->supply_name); + if (strstr(rdev_get_name(rdev), "l22")) + printk(KERN_WARNING "ldo=%s,supply=%s+\n", rdev_get_name(rdev), regulator->supply_name); + #endif + /* lenovo.sw end. chenyb1 add to dump ldo using info */ if (regulator->always_on) return 0; @@ -2067,6 +2077,16 @@ int regulator_disable(struct regulator *regulator) struct regulator_dev *rdev = regulator->rdev; int ret = 0; + /* lenovo.sw begin. chenyb1 add to dump ldo using info */ + #ifdef CONFIG_LENOVO_PM_LOG + if (strstr(rdev_get_name(rdev), "l6")) + printk(KERN_WARNING "ldo=%s,supply=%s-\n", rdev_get_name(rdev), regulator->supply_name); + if (strstr(rdev_get_name(rdev), "l17")) + printk(KERN_WARNING "ldo=%s,supply=%s-\n", rdev_get_name(rdev), regulator->supply_name); + if (strstr(rdev_get_name(rdev), "l22")) + printk(KERN_WARNING "ldo=%s,supply=%s-\n", rdev_get_name(rdev), regulator->supply_name); + #endif + /* lenovo.sw end. chenyb1 add to dump ldo using info */ if (regulator->always_on) return 0; @@ -4389,6 +4409,123 @@ unlock: } EXPORT_SYMBOL_GPL(regulator_suspend_finish); +/* chenyb1, 20130513, Add for vreg debug, START */ +#define VREG_NUM_MAX 64 + +int vreg_dump_info(char* buf) +{ + char* p = buf; + struct regulator_dev *rdev; + unsigned on, mv; + int id; + const struct regulator_ops *ops; + + mutex_lock(®ulator_list_mutex); + + id = 0; + list_for_each_entry(rdev, ®ulator_list, list) { + ops = rdev->desc->ops; + + p += sprintf(p, "[%2d]%10s: ", id++, rdev->desc->name); + + on = mv = 0; + mutex_lock(&rdev->mutex); + + if (ops->is_enabled) + on = ops->is_enabled(rdev); + if (ops->get_voltage) + mv = ops->get_voltage(rdev) / 1000; + + mutex_unlock(&rdev->mutex); + + p += sprintf(p, "%s ", on ? "on " : "off"); + p += sprintf(p, "%4d mv ", mv); + p += sprintf(p, "\n"); + } + + mutex_unlock(®ulator_list_mutex); + + return p - buf; +} + + +/* save vreg config before sleep */ +static unsigned before_sleep_fetched; +static unsigned before_sleep_configs[VREG_NUM_MAX]; +void vreg_before_sleep_save_configs(void) +{ + struct regulator_dev *rdev; + unsigned on, mv; + int id; + const struct regulator_ops *ops; + + //only save vreg configs when it has been fetched + if (!before_sleep_fetched) + return; + + printk("%s(), before_sleep_fetched=%d\n", __func__, before_sleep_fetched); + before_sleep_fetched = false; + + mutex_lock(®ulator_list_mutex); + + id = 0; + list_for_each_entry(rdev, ®ulator_list, list) { + ops = rdev->desc->ops; + + on = mv = 0; + mutex_lock(&rdev->mutex); + + if (ops->is_enabled) + on = ops->is_enabled(rdev); + if (ops->get_voltage) + mv = ops->get_voltage(rdev) / 1000; + + mutex_unlock(&rdev->mutex); + + before_sleep_configs[id] = mv | (on << 31); + if (++id >= VREG_NUM_MAX) + break; + } + + mutex_unlock(®ulator_list_mutex); +} + +int vreg_before_sleep_dump_info(char* buf) +{ + char* p = buf; + + p += sprintf(p, "vreg_before_sleep:\n"); + if (!before_sleep_fetched) { + struct regulator_dev *rdev; + unsigned on, mv; + int id; + + before_sleep_fetched = true; + + mutex_lock(®ulator_list_mutex); + + id = 0; + list_for_each_entry(rdev, ®ulator_list, list) { + p += sprintf(p, "[%2d]%10s: ", id, rdev->desc->name); + + mv = before_sleep_configs[id]; + on = (mv & 0x80000000) >> 31; + mv &= ~0x80000000; + + p += sprintf(p, "%s ", on ? "on " : "off"); + p += sprintf(p, "%4d mv ", mv); + p += sprintf(p, "\n"); + + if (++id >= VREG_NUM_MAX) + break; + } + + mutex_unlock(®ulator_list_mutex); + } + return p - buf; +} +/* chenyb1, 20130513, Add for vreg debug, END */ + /** * regulator_has_full_constraints - the system has fully specified constraints * |
