ODROID-G12: Make hid-multitouch and dwav-usb-mt driver as mouldes.

Change-Id: I9b3a8973c7d0d89bcf52e22b6e690cdc14a24e6c
This commit is contained in:
Chris
2022-02-09 14:36:51 +09:00
parent a3da637359
commit c92d7f2b90
5 changed files with 94 additions and 56 deletions

View File

@@ -2672,7 +2672,7 @@ CONFIG_TOUCHSCREEN_PROPERTIES=y
# CONFIG_TOUCHSCREEN_TPS6507X is not set
# CONFIG_TOUCHSCREEN_ZFORCE is not set
# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set
CONFIG_TOUCHSCREEN_DWAV_USB_MT=y
CONFIG_TOUCHSCREEN_DWAV_USB_MT=m
CONFIG_TOUCHSCREEN_SX8650=m
CONFIG_INPUT_MISC=y
# CONFIG_INPUT_AD714X is not set
@@ -4043,7 +4043,7 @@ CONFIG_LOGIWHEELS_FF=y
# CONFIG_HID_MAGICMOUSE is not set
# CONFIG_HID_MICROSOFT is not set
# CONFIG_HID_MONTEREY is not set
CONFIG_HID_MULTITOUCH=y
CONFIG_HID_MULTITOUCH=m
# CONFIG_HID_NTRIG is not set
# CONFIG_HID_ORTEK is not set
# CONFIG_HID_PANTHERLORD is not set

View File

@@ -2325,7 +2325,7 @@ CONFIG_TOUCHSCREEN_PROPERTIES=y
# CONFIG_TOUCHSCREEN_TPS6507X is not set
# CONFIG_TOUCHSCREEN_ZFORCE is not set
# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set
CONFIG_TOUCHSCREEN_DWAV_USB_MT=y
CONFIG_TOUCHSCREEN_DWAV_USB_MT=m
CONFIG_TOUCHSCREEN_SX8650=m
CONFIG_INPUT_MISC=y
# CONFIG_INPUT_AD714X is not set
@@ -3541,7 +3541,7 @@ CONFIG_LOGIWHEELS_FF=y
# CONFIG_HID_MAGICMOUSE is not set
# CONFIG_HID_MICROSOFT is not set
# CONFIG_HID_MONTEREY is not set
CONFIG_HID_MULTITOUCH=y
CONFIG_HID_MULTITOUCH=m
# CONFIG_HID_NTRIG is not set
# CONFIG_HID_ORTEK is not set
# CONFIG_HID_PANTHERLORD is not set

View File

@@ -33,6 +33,78 @@
#include <linux/hrtimer.h>
#include <asm/setup.h>
bool touch_invert_x;
/*-------------------------------------------------------------------------*/
static int __init touch_invert_x_para_setup(char *s)
{
touch_invert_x = false;
if (!strncmp(s, "true", 4))
touch_invert_x = true;
else if (!strncmp(s, "false", 5))
touch_invert_x = false;
else {
pr_err("%s - wrong touch_invert_x parameter", __func__);
touch_invert_x = true;
}
return 0;
}
__setup("touch_invert_x=", touch_invert_x_para_setup);
bool get_touch_invert_x(void)
{
return touch_invert_x;
}
EXPORT_SYMBOL(get_touch_invert_x);
bool touch_invert_y;
/*-------------------------------------------------------------------------*/
static int __init touch_invert_y_para_setup(char *s)
{
touch_invert_y = false;
if (!strncmp(s, "true", 4))
touch_invert_y = true;
else if (!strncmp(s, "false", 5))
touch_invert_y = false;
else {
pr_err("%s - wrong touch_invert_y parameter", __func__);
touch_invert_y = true;
}
return 0;
}
__setup("touch_invert_y=", touch_invert_y_para_setup);
bool get_touch_invert_y(void)
{
return touch_invert_y;
}
EXPORT_SYMBOL(get_touch_invert_y);
static bool disable_vu7;
/*-------------------------------------------------------------------------*/
static int __init dwav_usb_mt_boot_para_setup(char *s)
{
disable_vu7 = false;
if (!strncmp(s, "true", 4))
disable_vu7 = true;
else if (!strncmp(s, "false", 5))
disable_vu7 = false;
else {
pr_err("%s - wrong disable_vu7 parameter", __func__);
disable_vu7 = true;
}
return 0;
}
__setup("disable_vu7=", dwav_usb_mt_boot_para_setup);
bool get_disable_vu7(void)
{
return touch_invert_y;
}
EXPORT_SYMBOL(get_disable_vu7);
static int prevent_sleep = 0;
static int __init prevent_sleep_setup(char *s)

View File

@@ -609,8 +609,12 @@ static int mt_compute_slot(struct mt_device *td, struct input_dev *input)
return input_mt_get_slot_by_key(input, td->curdata.contactid);
}
extern bool touch_invert_x;
extern bool touch_invert_y;
bool touch_invert_x;
bool touch_invert_y;
extern bool get_touch_invert_x(void);
extern bool get_touch_invert_y(void);
/*
* this function is called when a whole contact has been processed,
* so that it can assign it to a slot and store the data there
@@ -651,6 +655,9 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
int major = max(s->w, s->h) >> 1;
int minor = min(s->w, s->h) >> 1;
touch_invert_x = get_touch_invert_x();
touch_invert_y = get_touch_invert_y();
if (touch_invert_x)
input_event(input, EV_ABS, ABS_MT_POSITION_X,
input->absinfo[0].maximum - s->x);

View File

@@ -123,41 +123,13 @@ struct dwav_usb_mt {
struct finger_t *finger;
};
bool disable_vu7;
bool touch_invert_x;
/*-------------------------------------------------------------------------*/
static int __init touch_invert_x_para_setup(char *s)
{
touch_invert_x = false;
if (!strncmp(s, "true", 4))
touch_invert_x = true;
else if (!strncmp(s, "false", 5))
touch_invert_x = false;
else {
pr_err("%s - wrong touch_invert_x parameter", __func__);
touch_invert_x = true;
}
return 0;
}
__setup("touch_invert_x=", touch_invert_x_para_setup);
bool touch_invert_y;
/*-------------------------------------------------------------------------*/
static int __init touch_invert_y_para_setup(char *s)
{
touch_invert_y = false;
if (!strncmp(s, "true", 4))
touch_invert_y = true;
else if (!strncmp(s, "false", 5))
touch_invert_y = false;
else {
pr_err("%s - wrong touch_invert_y parameter", __func__);
touch_invert_y = true;
}
return 0;
}
__setup("touch_invert_y=", touch_invert_y_para_setup);
extern bool get_touch_invert_x(void);
extern bool get_touch_invert_y(void);
extern bool get_disable_vu7(void);
/*-------------------------------------------------------------------------*/
static void dwav_usb_mt_report(struct dwav_usb_mt *dwav_usb_mt)
@@ -183,6 +155,10 @@ static void dwav_usb_mt_report(struct dwav_usb_mt *dwav_usb_mt)
if (dwav_usb_mt->finger[id].status != TS_EVENT_RELEASE) {
input_mt_report_slot_state(dwav_usb_mt->input,
MT_TOOL_FINGER, true);
touch_invert_x = get_touch_invert_x();
touch_invert_y = get_touch_invert_y();
if (touch_invert_x)
input_report_abs(dwav_usb_mt->input,
ABS_MT_POSITION_X,
@@ -458,27 +434,10 @@ static int dwav_usb_mt_init(struct dwav_usb_mt *dwav_usb_mt, void *dev)
return 0;
}
static bool disable_vu7;
/*-------------------------------------------------------------------------*/
static int __init dwav_usb_mt_boot_para_setup(char *s)
{
disable_vu7 = false;
if (!strncmp(s, "true", 4))
disable_vu7 = true;
else if (!strncmp(s, "false", 5))
disable_vu7 = false;
else {
pr_err("%s - wrong disable_vu7 parameter", __func__);
disable_vu7 = true;
}
return 0;
}
__setup("disable_vu7=", dwav_usb_mt_boot_para_setup);
/*-------------------------------------------------------------------------*/
static bool dwav_usb_mt_ignore(const struct usb_device_id *id)
{
disable_vu7 = get_disable_vu7();
if (disable_vu7 && id->driver_info == ODROID_VU7)
return true;
else