mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
mmi-smbcharger-iio: Add charging power interface
CQA factory test need to get the charging power, so we add it. The unit of chg_watt is W. Change-Id: I861d8fcfa5bedcbd992a6943b6b4d885beba65fb Signed-off-by: Guocheng Wang <wanggc6@motorola.com> Reviewed-on: https://gerrit.mot.com/2696461 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yuecai Liu <liuyc20@motorola.com> Reviewed-by: Haijian Ma <mahj8@motorola.com> Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
0e7775eef5
commit
e2e260f135
1 changed files with 28 additions and 0 deletions
|
|
@ -1623,6 +1623,28 @@ static DEVICE_ATTR(force_chg_itrick, 0664,
|
|||
force_chg_itrick_show,
|
||||
force_chg_itrick_store);
|
||||
|
||||
static ssize_t chg_watt_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
int power_watt = -ENODEV;
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct smb_mmi_charger *mmi_chip = platform_get_drvdata(pdev);
|
||||
|
||||
if (mmi_chip) {
|
||||
power_watt = mmi_chip->power_watt / 1000;
|
||||
mmi_info(mmi_chip, "power_watt %dW\n", power_watt);
|
||||
} else {
|
||||
pr_err("chip not valid\n");
|
||||
}
|
||||
|
||||
return scnprintf(buf, CHG_SHOW_MAX_SIZE, "%d\n", power_watt);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(chg_watt, 0444,
|
||||
chg_watt_show,
|
||||
NULL);
|
||||
|
||||
enum {
|
||||
MMI_FACTORY_MODE,
|
||||
MMI_FACTORY_BUILD,
|
||||
|
|
@ -5049,6 +5071,12 @@ static int smb_mmi_probe(struct platform_device *pdev)
|
|||
if (rc)
|
||||
mmi_err(chip, "Couldn't create force_pd_power_max\n");
|
||||
|
||||
rc = device_create_file(chip->dev,
|
||||
&dev_attr_chg_watt);
|
||||
if (rc) {
|
||||
mmi_err(chip, "Couldn't create chg_watt\n");
|
||||
}
|
||||
|
||||
/* Register the notifier for the psy updates*/
|
||||
chip->mmi_psy_notifier.notifier_call = mmi_psy_notifier_call;
|
||||
rc = power_supply_reg_notifier(&chip->mmi_psy_notifier);
|
||||
|
|
|
|||
Loading…
Reference in a new issue