(CR):[Kane]:[kernel](1/1)Fix AC charger flag change TP parameter.
authorhq_qiaoquanbin_tmp <qiaoquanbin@huaqin.com>
Mon, 14 Jan 2019 08:17:08 +0000 (16:17 +0800)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:53 +0000 (20:23 +0300)
Fix AC charger flag change TP parameter.

bug:(CR)

Change-Id: I277ec73d6e6c9ed995aa0e0b3a89e3a0b69a9e48
Signed-off-by: hq_qiaoquanbin_tmp <qiaoquanbin@huaqin.com>
drivers/input/touchscreen/hxchipset/himax_common.c
drivers/input/touchscreen/nt36xxx/nt36xxx.c

index eca4f3f02343ea29351fdd2ee40b95fdf32fa0ba..087bd8b021604ca060fb44af11dd7499cd26f017 100755 (executable)
@@ -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;
                        }
                }
        }
index 72d4020bc8bf02504aacbc591a76a546b7849263..9d3d9910826adf583d4c0c57a4504c213162ca6d 100755 (executable)
@@ -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;