From: hq_qiaoquanbin_tmp Date: Thu, 6 Dec 2018 02:34:27 +0000 (+0800) Subject: Merge "(CR):[kane]:tp:Modify the charger change tp parameter" into huaqin/exynos9609 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a47405010e45a806d155ab5eb2013a006bdac771;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Merge "(CR):[kane]:tp:Modify the charger change tp parameter" into huaqin/exynos9609 Change-Id: I9df38bd907c121f3313f79af9300bcc5338b142c 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 bca87f922264..eca4f3f02343 100755 --- a/drivers/input/touchscreen/hxchipset/himax_common.c +++ b/drivers/input/touchscreen/hxchipset/himax_common.c @@ -2415,6 +2415,34 @@ device_destroy: return -ENODEV; } +#if defined(HX_USB_DETECT_GLOBAL) +static int charger_notifier_callback(struct notifier_block *nb, + unsigned long val, void *v) { + int ret = 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; + + psy= power_supply_get_by_name("usb"); + if (!psy) { + 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); + if (ret < 0) { + E("Couldn't get POWER_SUPPLY_PROP_ONLINE rc=%d\n", ret); + return ret; + } else { + USB_detect_flag = prop.intval; + } + } + } + return 0; +} +#endif + int himax_chip_common_init(void) { @@ -2563,6 +2591,13 @@ FW_force_upgrade: #if defined(HX_USB_DETECT_CALLBACK) || defined(HX_USB_DETECT_GLOBAL) ts->usb_connected = 0x00; ts->cable_config = pdata->cable_config; + + ts->charger_notif.notifier_call = charger_notifier_callback; + ret = power_supply_reg_notifier(&ts->charger_notif); + if (ret) { + E("Unable to register charger_notifier: %d\n",ret); + goto err_register_charger_notify_failed; + } #endif #ifdef HX_PROTOCOL_A ts->protocol_type = PROTOCOL_TYPE_A; @@ -2677,6 +2712,11 @@ err_detect_failed: } err_update_wq_failed: #endif +#if defined(HX_USB_DETECT_GLOBAL) +err_register_charger_notify_failed: + if (ts->charger_notif.notifier_call) + power_supply_unreg_notifier(&ts->charger_notif); +#endif error_ic_detect_failed: if (gpio_is_valid(pdata->gpio_irq)) { gpio_free(pdata->gpio_irq); diff --git a/drivers/input/touchscreen/hxchipset/himax_common.h b/drivers/input/touchscreen/hxchipset/himax_common.h index ae99bf5bc0e3..a5ed349eecff 100755 --- a/drivers/input/touchscreen/hxchipset/himax_common.h +++ b/drivers/input/touchscreen/hxchipset/himax_common.h @@ -67,7 +67,7 @@ /*#define HX_GESTURE_TRACK*/ /*#define HX_HIGH_SENSE*/ /*#define HX_PALM_REPORT*/ -/*#define HX_USB_DETECT_GLOBAL*/ +#define HX_USB_DETECT_GLOBAL /*#define HX_USB_DETECT_CALLBACK*/ /*#define HX_PROTOCOL_A*/ /* for MTK special platform.If turning on,it will report to system by using specific format. */ /*#define HX_RESUME_HW_RESET*/ @@ -84,6 +84,10 @@ /*#define HX_PLATFOME_DEFINE_KEY*/ /* for specfic platform to set key(button) */ #endif +#ifdef HX_USB_DETECT_GLOBAL +#include +#endif + #define HX_KEY_MAX_COUNT 4 #define DEFAULT_RETRY_CNT 3 @@ -368,9 +372,8 @@ struct himax_ts_data { #if defined(HX_USB_DETECT_CALLBACK) || defined(HX_USB_DETECT_GLOBAL) uint8_t usb_connected; uint8_t *cable_config; + struct notifier_block charger_notif; #endif - - }; struct himax_debug { diff --git a/drivers/input/touchscreen/hxchipset/himax_platform.c b/drivers/input/touchscreen/hxchipset/himax_platform.c index 696b0b0f08fd..4e038e899e9d 100755 --- a/drivers/input/touchscreen/hxchipset/himax_platform.c +++ b/drivers/input/touchscreen/hxchipset/himax_platform.c @@ -682,11 +682,9 @@ int fb_notifier_callback(struct notifier_block *self, struct fb_event *evdata = data; int *blank; struct himax_ts_data *ts = - container_of(self, struct himax_ts_data, fb_notif); - I(" %s\n", __func__); + container_of(self, struct himax_ts_data, fb_notif); - if (evdata && evdata->data && event == FB_EVENT_BLANK && ts && - ts->client) { + if (evdata && evdata->data && event == FB_EVENT_BLANK && ts && ts->client) { blank = evdata->data; switch (*blank) { @@ -743,8 +741,14 @@ int himax_chip_common_probe(struct i2c_client *client, const struct i2c_device_i int himax_chip_common_remove(struct i2c_client *client) { + struct himax_ts_data *ts = private_ts; himax_chip_common_deinit(); +#if defined(HX_USB_DETECT_GLOBAL) + if (ts->charger_notif.notifier_call) + power_supply_unreg_notifier(&ts->charger_notif); +#endif + return 0; } diff --git a/drivers/input/touchscreen/nt36xxx/nt36xxx.c b/drivers/input/touchscreen/nt36xxx/nt36xxx.c index f5f3f76ea4e7..72d4020bc8bf 100755 --- a/drivers/input/touchscreen/nt36xxx/nt36xxx.c +++ b/drivers/input/touchscreen/nt36xxx/nt36xxx.c @@ -49,12 +49,13 @@ #elif defined(CONFIG_HAS_EARLYSUSPEND) #include #endif + +#include "nt36xxx.h" + #if defined(CONFIG_CHARGER_NOTIFY) #include #endif -#include "nt36xxx.h" - #if NVT_TOUCH_ESD_PROTECT #include @@ -1809,7 +1810,7 @@ static int charger_notifier_callback(struct notifier_block *nb, } if (!strcmp(psy->desc->name, "usb")){ if (psy && ts && val == POWER_SUPPLY_PROP_STATUS) { - ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_PRESENT,&prop); + 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; @@ -1822,7 +1823,7 @@ static int charger_notifier_callback(struct notifier_block *nb, ts->usb_connected = USB_DETECT_OUT; } if (bTouchIsAwake){ - queue_work(ts->nvt_charger_notify_wq, &ts->charger_notify_work); + queue_work(ts->nvt_charger_notify_wq, &ts->charger_notify_work); } } } diff --git a/drivers/input/touchscreen/nt36xxx/nt36xxx.h b/drivers/input/touchscreen/nt36xxx/nt36xxx.h index 9f4415fcd775..21c3558eb309 100755 --- a/drivers/input/touchscreen/nt36xxx/nt36xxx.h +++ b/drivers/input/touchscreen/nt36xxx/nt36xxx.h @@ -30,6 +30,7 @@ #include "nt36xxx_mem_map.h" #define NVT_DEBUG 0 +#define CONFIG_CHARGER_NOTIFY //---GPIO number--- #define NVTTOUCH_RST_PIN 980