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

目前定位到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里找对应的

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值