您的位置:首页 > 移动开发 > Android开发

解决android系统唤醒时间偏长------healthd里的一些调用

2016-05-31 18:12 344 查看
目前定位到healthd的调用过程耗时太长,于是去看看power相关的一些东西

healthd里一共调用了如下的节点获取数据

openat(AT_FDCWD, "/sys/class/power_supply/battery/present", 1    *******

openat(AT_FDCWD, "/sys/class/power_supply/battery/capacity",100     *****

openat(AT_FDCWD, "/sys/class/power_supply/battery/voltage_now", 4389402     ********

openat(AT_FDCWD, "/sys/class/power_supply/battery/temp", 291   ********

openat(AT_FDCWD, "/sys/class/power_supply/battery/status", Full 

到kernel里找节点

Power_supply_sysfs.c里

static struct device_attribute power_supply_attrs[] = {
/* Properties of type `int' */
POWER_SUPPLY_ATTR(status),

看看#define POWER_SUPPLY_ATTR(_name) \

{ \
.attr = { .name = #_name },
\
.show = power_supply_show_property,
\
.store = power_supply_store_property,
\

}

然后看static ssize_t power_supply_show_property(struct device *dev,
 struct device_attribute *attr,
 char *buf) 

这个里面调用了

if (off == POWER_SUPPLY_PROP_TYPE)
value.intval = psy->type;
else
ret = psy->get_property(psy, off, &value);

这个get_property需要在qpnp-vm-bms.c

static int qpnp_vm_bms_power_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)

{

switch (psp) {
case POWER_SUPPLY_PROP_CHARGE_NOW:
val->intval = get_remaining_usable_capacity(chip);
break;

}

这些的case都在power_supply.h

enum power_supply_property {
/* Properties of type `int' */
POWER_SUPPLY_PROP_STATUS = 0,
POWER_SUPPLY_PROP_CHARGE_TYPE,
POWER_SUPPLY_PROP_HEALTH,
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_AUTHENTIC,
POWER_SUPPLY_PROP_CHARGING_ENABLED,
POWER_SUPPLY_PROP_TECHNOLOGY,
POWER_SUPPLY_PROP_CYCLE_COUNT,
POWER_SUPPLY_PROP_VOLTAGE_MAX,
POWER_SUPPLY_PROP_VOLTAGE_MIN,
POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_VOLTAGE_AVG,
POWER_SUPPLY_PROP_VOLTAGE_OCV,
POWER_SUPPLY_PROP_INPUT_VOLTAGE_REGULATION,
POWER_SUPPLY_PROP_CURRENT_MAX,
POWER_SUPPLY_PROP_INPUT_CURRENT_MAX,
POWER_SUPPLY_PROP_INPUT_CURRENT_TRIM,
POWER_SUPPLY_PROP_INPUT_CURRENT_SETTLED,
POWER_SUPPLY_PROP_VCHG_LOOP_DBC_BYPASS,
POWER_SUPPLY_PROP_CURRENT_NOW,
POWER_SUPPLY_PROP_CURRENT_AVG,
POWER_SUPPLY_PROP_POWER_NOW,
POWER_SUPPLY_PROP_POWER_AVG,

如果找其中的一个比如POWER_SUPPLY_PROP_ONLINE

在kernel里搜索后只有在这几个文件里Qpnp-linear-charger.c  或者Smb358-charger.c 或者qpnp-vm-bms.c里找对应的
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android kernel