Loading drivers/input/misc/hbtp_input.c +39 −3 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ #define HBTP_HOLD_DURATION_US (10) #define HBTP_PINCTRL_DDIC_SEQ_NUM (4) #define HBTP_WAIT_TIMEOUT_MS 2000 #define MSC_HBTP_ACTIVE_BLOB 0x05 struct hbtp_data { struct platform_device *pdev; Loading Loading @@ -91,6 +92,7 @@ struct hbtp_data { s16 ROI[MAX_ROI_SIZE]; s16 accelBuffer[MAX_ACCEL_SIZE]; u32 display_status; u32 touch_flag; }; static struct hbtp_data *hbtp; Loading Loading @@ -234,6 +236,9 @@ static int hbtp_input_create_input_dev(struct hbtp_input_absinfo *absinfo) __set_bit(BTN_TOUCH, input_dev->keybit); __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); /* for Blob touch interference feature */ input_set_capability(input_dev, EV_MSC, MSC_HBTP_ACTIVE_BLOB); for (i = KEY_HOME; i <= KEY_MICMUTE; i++) __set_bit(i, input_dev->keybit); Loading Loading @@ -273,10 +278,12 @@ static int hbtp_input_create_input_dev(struct hbtp_input_absinfo *absinfo) } static int hbtp_input_report_events(struct hbtp_data *hbtp_data, struct hbtp_input_mt *mt_data) struct hbtp_input_mt *mt_data, u32 flag) { int i; struct hbtp_input_touch *tch; u32 flag_change; bool active_blob; for (i = 0; i < HBTP_MAX_FINGER; i++) { tch = &(mt_data->touches[i]); Loading Loading @@ -331,10 +338,19 @@ static int hbtp_input_report_events(struct hbtp_data *hbtp_data, hbtp_data->touch_status[i] = tch->active; } } flag_change = hbtp_data->touch_flag ^ flag; if (flag_change) { if (flag_change & HBTP_FLAG_ACTIVE_BLOB) { active_blob = (flag & HBTP_FLAG_ACTIVE_BLOB) ? true : false; input_event(hbtp_data->input_dev, EV_MSC, MSC_HBTP_ACTIVE_BLOB, active_blob); } } input_report_key(hbtp->input_dev, BTN_TOUCH, mt_data->num_touches > 0); input_sync(hbtp->input_dev); hbtp_data->touch_flag = flag; return 0; } Loading Loading @@ -595,6 +611,7 @@ static long hbtp_input_ioctl_handler(struct file *file, unsigned int cmd, { int error = 0; struct hbtp_input_mt mt_data; struct hbtp_input_mt_ext mt_data_ext; struct hbtp_input_absinfo absinfo[ABS_MT_LAST - ABS_MT_FIRST + 1]; struct hbtp_input_key key_data; enum hbtp_afe_power_cmd power_cmd; Loading Loading @@ -636,7 +653,26 @@ static long hbtp_input_ioctl_handler(struct file *file, unsigned int cmd, return -EFAULT; } hbtp_input_report_events(hbtp, &mt_data); hbtp_input_report_events(hbtp, &mt_data, 0); error = 0; break; case HBTP_SET_TOUCHDATA_EXT: if (!hbtp || !hbtp->input_dev) { pr_err("%s: The input device hasn't been created\n", __func__); return -EFAULT; } if (copy_from_user(&mt_data_ext, (void __user *)arg, sizeof(struct hbtp_input_mt_ext))) { pr_err("%s: Error copying data\n", __func__); return -EFAULT; } hbtp_input_report_events(hbtp, (struct hbtp_input_mt *)&mt_data_ext, mt_data_ext.flag); error = 0; break; Loading include/uapi/linux/hbtp_input.h +10 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ #define MAX_ROI_SIZE 144 #define MAX_ACCEL_SIZE 128 #define HBTP_FLAG_ACTIVE_BLOB 0x01 #define HBTP_EVENT_TYPE_DISPLAY "EVENT_TYPE=HBTP_DISPLAY" struct hbtp_input_touch { Loading @@ -33,6 +34,13 @@ struct hbtp_input_mt { struct timeval time_val; }; struct hbtp_input_mt_ext { __s32 num_touches; struct hbtp_input_touch touches[HBTP_MAX_FINGER]; struct timeval time_val; __u32 flag; }; struct hbtp_input_absinfo { bool active; __u16 code; Loading Loading @@ -77,6 +85,8 @@ enum hbtp_afe_power_ctrl { enum hbtp_afe_power_ctrl) #define HBTP_SET_SENSORDATA _IOW(HBTP_INPUT_IOCTL_BASE, 207, \ struct hbtp_sensor_data) #define HBTP_SET_TOUCHDATA_EXT _IOW(HBTP_INPUT_IOCTL_BASE, 208, \ struct hbtp_input_mt_ext) #endif /* _UAPI_HBTP_INPUT_H */ Loading
drivers/input/misc/hbtp_input.c +39 −3 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ #define HBTP_HOLD_DURATION_US (10) #define HBTP_PINCTRL_DDIC_SEQ_NUM (4) #define HBTP_WAIT_TIMEOUT_MS 2000 #define MSC_HBTP_ACTIVE_BLOB 0x05 struct hbtp_data { struct platform_device *pdev; Loading Loading @@ -91,6 +92,7 @@ struct hbtp_data { s16 ROI[MAX_ROI_SIZE]; s16 accelBuffer[MAX_ACCEL_SIZE]; u32 display_status; u32 touch_flag; }; static struct hbtp_data *hbtp; Loading Loading @@ -234,6 +236,9 @@ static int hbtp_input_create_input_dev(struct hbtp_input_absinfo *absinfo) __set_bit(BTN_TOUCH, input_dev->keybit); __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); /* for Blob touch interference feature */ input_set_capability(input_dev, EV_MSC, MSC_HBTP_ACTIVE_BLOB); for (i = KEY_HOME; i <= KEY_MICMUTE; i++) __set_bit(i, input_dev->keybit); Loading Loading @@ -273,10 +278,12 @@ static int hbtp_input_create_input_dev(struct hbtp_input_absinfo *absinfo) } static int hbtp_input_report_events(struct hbtp_data *hbtp_data, struct hbtp_input_mt *mt_data) struct hbtp_input_mt *mt_data, u32 flag) { int i; struct hbtp_input_touch *tch; u32 flag_change; bool active_blob; for (i = 0; i < HBTP_MAX_FINGER; i++) { tch = &(mt_data->touches[i]); Loading Loading @@ -331,10 +338,19 @@ static int hbtp_input_report_events(struct hbtp_data *hbtp_data, hbtp_data->touch_status[i] = tch->active; } } flag_change = hbtp_data->touch_flag ^ flag; if (flag_change) { if (flag_change & HBTP_FLAG_ACTIVE_BLOB) { active_blob = (flag & HBTP_FLAG_ACTIVE_BLOB) ? true : false; input_event(hbtp_data->input_dev, EV_MSC, MSC_HBTP_ACTIVE_BLOB, active_blob); } } input_report_key(hbtp->input_dev, BTN_TOUCH, mt_data->num_touches > 0); input_sync(hbtp->input_dev); hbtp_data->touch_flag = flag; return 0; } Loading Loading @@ -595,6 +611,7 @@ static long hbtp_input_ioctl_handler(struct file *file, unsigned int cmd, { int error = 0; struct hbtp_input_mt mt_data; struct hbtp_input_mt_ext mt_data_ext; struct hbtp_input_absinfo absinfo[ABS_MT_LAST - ABS_MT_FIRST + 1]; struct hbtp_input_key key_data; enum hbtp_afe_power_cmd power_cmd; Loading Loading @@ -636,7 +653,26 @@ static long hbtp_input_ioctl_handler(struct file *file, unsigned int cmd, return -EFAULT; } hbtp_input_report_events(hbtp, &mt_data); hbtp_input_report_events(hbtp, &mt_data, 0); error = 0; break; case HBTP_SET_TOUCHDATA_EXT: if (!hbtp || !hbtp->input_dev) { pr_err("%s: The input device hasn't been created\n", __func__); return -EFAULT; } if (copy_from_user(&mt_data_ext, (void __user *)arg, sizeof(struct hbtp_input_mt_ext))) { pr_err("%s: Error copying data\n", __func__); return -EFAULT; } hbtp_input_report_events(hbtp, (struct hbtp_input_mt *)&mt_data_ext, mt_data_ext.flag); error = 0; break; Loading
include/uapi/linux/hbtp_input.h +10 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ #define MAX_ROI_SIZE 144 #define MAX_ACCEL_SIZE 128 #define HBTP_FLAG_ACTIVE_BLOB 0x01 #define HBTP_EVENT_TYPE_DISPLAY "EVENT_TYPE=HBTP_DISPLAY" struct hbtp_input_touch { Loading @@ -33,6 +34,13 @@ struct hbtp_input_mt { struct timeval time_val; }; struct hbtp_input_mt_ext { __s32 num_touches; struct hbtp_input_touch touches[HBTP_MAX_FINGER]; struct timeval time_val; __u32 flag; }; struct hbtp_input_absinfo { bool active; __u16 code; Loading Loading @@ -77,6 +85,8 @@ enum hbtp_afe_power_ctrl { enum hbtp_afe_power_ctrl) #define HBTP_SET_SENSORDATA _IOW(HBTP_INPUT_IOCTL_BASE, 207, \ struct hbtp_sensor_data) #define HBTP_SET_TOUCHDATA_EXT _IOW(HBTP_INPUT_IOCTL_BASE, 208, \ struct hbtp_input_mt_ext) #endif /* _UAPI_HBTP_INPUT_H */