Update battery driver

Change-Id: I55cd8da5c2dc6f1ee69ccf12f48424085af153db
This commit is contained in:
eric.luo 2025-05-15 17:31:44 +08:00
parent c9d08f45f9
commit a14a2b909b

View file

@ -192,6 +192,7 @@ enum battery_property_id {
BATT_FAKE_TUSB,
BATT_FAKE_SOC,
BATT_SHUT_DOWN,
BATT_ID,
#endif
BATT_PROP_MAX,
};
@ -2400,6 +2401,27 @@ static int nt_real_soc_open(struct inode *inode, struct file *file)
return single_open(file, nt_real_soc_show, pde_data(inode));
}
static int nt_battid_show(struct seq_file *m, void *v)
{
struct battery_chg_dev *bcdev = m->private;
struct psy_state *pst = &bcdev->psy_list[PSY_TYPE_BATTERY];
int rc;
if((pst == NULL) || (bcdev == NULL))
{
return -EINVAL;
}
rc = read_property_id(bcdev, pst, BATT_ID);
if (rc < 0)
return rc;
seq_printf(m, "%d\n", pst->prop[BATT_ID]);
return 0;
}
static int nt_battid_open(struct inode *inode, struct file *file)
{
return single_open(file, nt_battid_show, pde_data(inode));
}
const struct nt_proc entries[] = {
{"battery_health",{.proc_open = battery_health_open,
.proc_read = seq_read,
@ -2568,6 +2590,11 @@ const struct nt_proc entries[] = {
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,}
},
{"battid",{.proc_open = nt_battid_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,}
}
};
#endif