mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
charger: add wireless type judgement for healthd
For healthd's charge type judgment logic, we should set USB/online as false when wireless charger connected. And set DC/WIRELESS type as "wireless" at the same time. Change-Id: I5397224e7432802891706b3b7facf79cb749cbd7 Reviewed-on: https://gerrit.mot.com/2263683 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
5062a34253
commit
97cfc95e6c
2 changed files with 24 additions and 20 deletions
|
|
@ -1468,7 +1468,7 @@ static int cps_wls_register_psy(struct cps_wls_chrg_chip *chip)
|
|||
struct power_supply_config cps_wls_psy_cfg = {};
|
||||
|
||||
chip->wl_psd.name = CPS_WLS_CHRG_PSY_NAME;
|
||||
chip->wl_psd.type = POWER_SUPPLY_TYPE_UNKNOWN;
|
||||
chip->wl_psd.type = POWER_SUPPLY_TYPE_WIRELESS;
|
||||
chip->wl_psd.properties = cps_wls_chrg_props;
|
||||
chip->wl_psd.num_properties = ARRAY_SIZE(cps_wls_chrg_props);
|
||||
chip->wl_psd.get_property = cps_wls_chrg_get_property;
|
||||
|
|
|
|||
|
|
@ -304,6 +304,24 @@ int get_prop_usb_online(struct mmi_discrete_charger *chip,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int is_wls_online(struct mmi_discrete_charger *chip)
|
||||
{
|
||||
int rc;
|
||||
union power_supply_propval val;
|
||||
|
||||
if (!chip->wls_psy)
|
||||
return 0;
|
||||
|
||||
rc = power_supply_get_property(chip->wls_psy,
|
||||
POWER_SUPPLY_PROP_ONLINE, &val);
|
||||
if (rc < 0) {
|
||||
mmi_err(chip, "Error wls online rc = %d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return val.intval;
|
||||
}
|
||||
|
||||
static int get_usb_online(struct mmi_discrete_charger *chip,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
|
|
@ -320,6 +338,9 @@ static int get_usb_online(struct mmi_discrete_charger *chip,
|
|||
else
|
||||
val->intval = 1;
|
||||
|
||||
if (is_wls_online(chip))
|
||||
val->intval = 0;
|
||||
|
||||
if (chip->real_charger_type == POWER_SUPPLY_TYPE_UNKNOWN)
|
||||
val->intval = 0;
|
||||
|
||||
|
|
@ -609,24 +630,6 @@ static int set_prop_sdp_current_max(struct mmi_discrete_charger *chg,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int is_wls_online(struct mmi_discrete_charger *chip)
|
||||
{
|
||||
int rc;
|
||||
union power_supply_propval val;
|
||||
|
||||
if (!chip->wls_psy)
|
||||
return 0;
|
||||
|
||||
rc = power_supply_get_property(chip->wls_psy,
|
||||
POWER_SUPPLY_PROP_ONLINE, &val);
|
||||
if (rc < 0) {
|
||||
mmi_err(chip, "Error wls online rc = %d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return val.intval;
|
||||
}
|
||||
|
||||
static int mmi_discrete_update_usb_type(struct mmi_discrete_charger *chip)
|
||||
{
|
||||
int rc = 0;
|
||||
|
|
@ -1669,7 +1672,7 @@ static int mmi_discrete_dc_prop_is_writeable(struct power_supply *psy,
|
|||
|
||||
static const struct power_supply_desc dc_psy_desc = {
|
||||
.name = "dc",
|
||||
.type = POWER_SUPPLY_TYPE_MAINS,
|
||||
.type = POWER_SUPPLY_TYPE_WIRELESS,
|
||||
.properties = mmi_discrete_dc_props,
|
||||
.num_properties = ARRAY_SIZE(mmi_discrete_dc_props),
|
||||
.get_property = mmi_discrete_dc_get_prop,
|
||||
|
|
@ -2430,6 +2433,7 @@ static int mmi_discrete_get_chg_info(void *data, struct mmi_charger_info *chg_in
|
|||
|
||||
/* Wireless charger */
|
||||
if (is_wls_online(chip)) {
|
||||
chip->real_charger_type = POWER_SUPPLY_TYPE_WIRELESS;
|
||||
chip->chg_info.chrg_present = 1;
|
||||
val.intval = 0;
|
||||
rc = get_prop_dc_voltage_now(chip, &val);
|
||||
|
|
|
|||
Loading…
Reference in a new issue