From: hq_qiaoquanbin_tmp Date: Mon, 14 Jan 2019 08:17:08 +0000 (+0800) Subject: EKKANE-544:[Kane]:[kernel](1/1)Fix AC charger flag change TP parameter. X-Git-Tag: MMI-QSAS30.62-33-3~285 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9a1546ea679d28b76c3ea7e3ad057c9c359eefdc;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git EKKANE-544:[Kane]:[kernel](1/1)Fix AC charger flag change TP parameter. Fix AC charger flag change TP parameter. bug:EKKANE-544 Change-Id: I277ec73d6e6c9ed995aa0e0b3a89e3a0b69a9e48 Signed-off-by: hq_qiaoquanbin_tmp --- diff --git a/drivers/input/touchscreen/hxchipset/himax_common.c b/drivers/input/touchscreen/hxchipset/himax_common.c index eca4f3f02343..087bd8b02160 100755 --- a/drivers/input/touchscreen/hxchipset/himax_common.c +++ b/drivers/input/touchscreen/hxchipset/himax_common.c @@ -2419,6 +2419,7 @@ device_destroy: static int charger_notifier_callback(struct notifier_block *nb, unsigned long val, void *v) { int ret = 0; + int charger_flag = 0; struct power_supply *psy = NULL; struct himax_ts_data *ts = container_of(nb, struct himax_ts_data, charger_notif); union power_supply_propval prop; @@ -2428,6 +2429,7 @@ static int charger_notifier_callback(struct notifier_block *nb, return -EINVAL; E("Couldn't get usbpsy\n"); } + if (!strcmp(psy->desc->name, "usb")) { if (psy && ts && val == POWER_SUPPLY_PROP_STATUS) { ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,&prop); @@ -2435,7 +2437,26 @@ static int charger_notifier_callback(struct notifier_block *nb, E("Couldn't get POWER_SUPPLY_PROP_ONLINE rc=%d\n", ret); return ret; } else { - USB_detect_flag = prop.intval; + charger_flag |= prop.intval; + } + } + } + + psy= power_supply_get_by_name("ac"); + if (!psy){ + return -EINVAL; + E("Couldn't get usbpsy\n"); + } + + if (!strcmp(psy->desc->name, "ac")) { + if (psy && ts && val == POWER_SUPPLY_PROP_STATUS) { + ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,&prop); + if (ret < 0) { + E("Couldn't get POWER_SUPPLY_PROP_ONLINE rc=%d\n", ret); + return ret; + } else { + charger_flag |= prop.intval; + USB_detect_flag = charger_flag; } } } diff --git a/drivers/input/touchscreen/nt36xxx/nt36xxx.c b/drivers/input/touchscreen/nt36xxx/nt36xxx.c index 72d4020bc8bf..9d3d9910826a 100755 --- a/drivers/input/touchscreen/nt36xxx/nt36xxx.c +++ b/drivers/input/touchscreen/nt36xxx/nt36xxx.c @@ -1799,6 +1799,7 @@ static int charger_notifier_callback(struct notifier_block *nb, unsigned long val, void *v) { int ret = 0; + int charger_flag = 0; struct power_supply *psy = NULL; struct nvt_ts_data *ts = container_of(nb, struct nvt_ts_data, charger_notif); union power_supply_propval prop; @@ -1808,14 +1809,34 @@ static int charger_notifier_callback(struct notifier_block *nb, return -EINVAL; NVT_ERR("Couldn't get usbpsy\n"); } - if (!strcmp(psy->desc->name, "usb")){ + + if (!strcmp(psy->desc->name, "usb")) { if (psy && ts && val == POWER_SUPPLY_PROP_STATUS) { ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,&prop); if (ret < 0) { NVT_ERR("Couldn't get POWER_SUPPLY_PROP_ONLINE rc=%d\n", ret); return ret; - }else{ - usb_detect_flag = prop.intval; + } else { + charger_flag |= prop.intval; + } + } + } + + psy= power_supply_get_by_name("ac"); + if (!psy){ + return -EINVAL; + NVT_ERR("Couldn't get usbpsy\n"); + } + + if (!strcmp(psy->desc->name, "ac")) { + if (psy && ts && val == POWER_SUPPLY_PROP_STATUS) { + ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,&prop); + if (ret < 0) { + NVT_ERR("Couldn't get POWER_SUPPLY_PROP_ONLINE rc=%d\n", ret); + return ret; + } else { + charger_flag |= prop.intval; + usb_detect_flag = charger_flag; if(usb_detect_flag != ts->usb_connected) { if (USB_DETECT_IN == usb_detect_flag) { ts->usb_connected = USB_DETECT_IN;