diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 2a40016100e9..2839986c72eb 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -241,6 +241,137 @@ config TOUCHSCREEN_CYTTSP4_SPI To compile this driver as a module, choose M here: the module will be called cyttsp4_spi. +config TOUCHSCREEN_CYPRESS_CYTTSP5 + tristate "Parade TrueTouch Gen5 Touchscreen Driver" + default n + help + Core driver for Parade TrueTouch(tm) Standard Product + Geneartion5 touchscreen controllers. + + Say Y here if you have a Parade Gen5 touchscreen. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called cyttsp5. + +config TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICETREE_SUPPORT + bool "Enable Device Tree support" + depends on TOUCHSCREEN_CYPRESS_CYTTSP5 && OF + default n + help + Devicetree parsor for Parade TrueTouch(tm) Standard Product + Geneartion5 touchscreen controllers. Say Y here to enable + support for device tree. + + If unsure, say N. + +config TOUCHSCREEN_CYPRESS_CYTTSP5_I2C + tristate "Parade TrueTouch Gen5 I2C" + depends on TOUCHSCREEN_CYPRESS_CYTTSP5 + select I2C + default n + help + Say Y here to enable I2C bus interface to Parade + TrueTouch(tm) Standard Product Generation5 touchscreen + controller. + + If unsure, say Y. + + To compile this driver as a module, choose M here: the + module will be called cyttsp5_i2c. + +config TOUCHSCREEN_CYPRESS_CYTTSP5_SPI + tristate "Parade TrueTouch Gen5 SPI" + depends on TOUCHSCREEN_CYPRESS_CYTTSP5 + select SPI + help + Say Y here to enable SPI bus interface to Parade + TrueTouch(tm) Standard Product Generation5 touchscreen + controller. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called cyttsp5_spi. + +config TOUCHSCREEN_CYPRESS_CYTTSP5_MT_A + bool "Parade TrueTouch Gen5 MultiTouch Protocol A" + depends on TOUCHSCREEN_CYPRESS_CYTTSP5 + help + This option controls which MultiTouch protocol will be + used to report the touch events. This depends on your + usage. + + Select to enable MultiTouch touch reporting using protocol A + on Parade TrueTouch(tm) Standard Product Generation4 touchscreen + controller. + + If unsure, say N. + +config TOUCHSCREEN_CYPRESS_CYTTSP5_MT_B + bool "Parade TrueTouch Gen5 MultiTouch Protocol B" + depends on TOUCHSCREEN_CYPRESS_CYTTSP5 + default n + help + This option controls which MultiTouch protocol will be + used to report the touch events. This depends on your + usage. + + Select to enable MultiTouch touch reporting using protocol B + on Parade TrueTouch(tm) Standard Product Generation4 touchscreen + controller. + + If unsure, say N. + +config TOUCHSCREEN_CYPRESS_CYTTSP5_BUTTON + bool "Parade TrueTouch Gen5 MultiTouch CapSense Button" + depends on TOUCHSCREEN_CYPRESS_CYTTSP5 + default n + help + Say Y here to enable CapSense reporting on Parade + TrueTouch(tm) Standard Product Generation5 touchscreen + controller. + + If unsure, say N. + +config TOUCHSCREEN_CYPRESS_CYTTSP5_PROXIMITY + bool "Parade TrueTouch Gen5 Proximity" + depends on TOUCHSCREEN_CYPRESS_CYTTSP5 + default n + help + Say Y here to enable proximity reporting on Parade + TrueTouch(tm) Standard Product Generation5 touchscreen + controller. + + If unsure, say N. + +config TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICE_ACCESS + tristate "Parade TrueTouch Gen5 MultiTouch Device Access" + depends on TOUCHSCREEN_CYPRESS_CYTTSP5 + default n + help + Say Y here to enable Parade TrueTouch(tm) Standard Product + Generation5 touchscreen controller device access module. + + This modules adds an interface to access touchscreen + controller using driver sysfs nodes. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called cyttsp5_device_access. + +config TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICE_ACCESS_API + bool "Enable Device Access kernel API" + depends on TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICE_ACCESS + help + Say Y here to enable Device access kernel API which provides + access to Parade TrueTouch(tm) Standard Product Generation5 + touchscreen controller for other modules. + + If unsure, say N. + config TOUCHSCREEN_DA9034 tristate "Touchscreen support for Dialog Semiconductor DA9034" depends on PMIC_DA903X diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index e9815e94848e..778f63356886 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -25,6 +25,7 @@ obj-$(CONFIG_TOUCHSCREEN_CYTTSP_SPI) += cyttsp_spi.o obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_CORE) += cyttsp4_core.o obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_I2C) += cyttsp4_i2c.o cyttsp_i2c_common.o obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_SPI) += cyttsp4_spi.o +obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5) += cyttsp5/ obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index f5abba443f6d..463f6da2ea02 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -2462,50 +2462,10 @@ static int mxt_read_rev(struct mxt_data *data) if (val == 0) break; - - case MXT_TOUCH_MULTI_T9: - data->multitouch = MXT_TOUCH_MULTI_T9; - /* Only handle messages from first T9 instance */ - data->T9_reportid_min = min_id; - data->T9_reportid_max = min_id + - object->num_report_ids - 1; - data->num_touchids = object->num_report_ids; - break; - case MXT_SPT_MESSAGECOUNT_T44: - data->T44_address = object->start_address; - break; - case MXT_SPT_GPIOPWM_T19: - data->T19_reportid = min_id; - break; - case MXT_TOUCH_MULTITOUCHSCREEN_T100: - data->multitouch = MXT_TOUCH_MULTITOUCHSCREEN_T100; - data->T100_reportid_min = min_id; - data->T100_reportid_max = max_id; - /* first two report IDs reserved */ - data->num_touchids = object->num_report_ids - 2; - break; - } - - end_address = object->start_address - + mxt_obj_size(object) * mxt_obj_instances(object) - 1; - - if (end_address >= data->mem_size) - data->mem_size = end_address + 1; - i++; msleep(10); } - /* Store maximum reportid */ - data->max_reportid = reportid; - - /* If T44 exists, T5 position has to be directly after */ - if (data->T44_address && (data->T5_address != data->T44_address + 1)) { - dev_err(&client->dev, "Invalid T44 position\n"); - error = -EINVAL; - goto free_object_table; - } - ret = mxt_read_object(data, MXT_DEBUG_DIAGNOSTIC_T37, MXT_DIAG_REV_ID, &data->rev_id); if (ret) { diff --git a/drivers/input/touchscreen/cyttsp5/cyttsp5_device_access.c b/drivers/input/touchscreen/cyttsp5/cyttsp5_device_access.c index f501b5cbd7ba..14dcdb572db4 100644 --- a/drivers/input/touchscreen/cyttsp5/cyttsp5_device_access.c +++ b/drivers/input/touchscreen/cyttsp5/cyttsp5_device_access.c @@ -1666,11 +1666,11 @@ static ssize_t cyttsp5_cmcp_test_show(struct device *dev, if (no_builtin_file) goto no_builtin; - if (test_item & CM_ENABLED) + if (test_item && CM_ENABLED) validate_cm_test_results(dev, configuration, cmcp_info, result, &final_pass, test_item); - if (test_item & CP_ENABLED) + if (test_item && CP_ENABLED) validate_cp_test_results(dev, configuration, cmcp_info, result, &final_pass, test_item); no_builtin: diff --git a/drivers/input/touchscreen/cyttsp5/cyttsp5_loader.c b/drivers/input/touchscreen/cyttsp5/cyttsp5_loader.c index 2a38669b44b5..c7dbafa5e31a 100644 --- a/drivers/input/touchscreen/cyttsp5/cyttsp5_loader.c +++ b/drivers/input/touchscreen/cyttsp5/cyttsp5_loader.c @@ -42,19 +42,13 @@ #define CYTTSP5_AUTO_LOAD_FOR_CORRUPTED_FW 1 #define CYTTSP5_LOADER_FW_UPGRADE_RETRY_COUNT 3 -#if defined(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_PLATFORM_FW_UPGRADE) || \ - defined(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_BINARY_FW_UPGRADE) -#define CYTTSP5_FW_UPGRADE 1 -#else -#define CYTTSP5_FW_UPGRADE 0 -#endif +#define CYTTSP5_FW_UPGRADE \ + (defined(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_PLATFORM_FW_UPGRADE) \ + || defined(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_BINARY_FW_UPGRADE)) -#if defined(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_PLATFORM_TTCONFIG_UPGRADE) || \ - defined(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_MANUAL_TTCONFIG_UPGRADE) -#define CYTTSP5_TTCONFIG_UPGRADE 1 -#else -#define CYTTSP5_TTCONFIG_UPGRADE 0 -#endif +#define CYTTSP5_TTCONFIG_UPGRADE \ + (defined(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_PLATFORM_TTCONFIG_UPGRADE) \ + || defined(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_MANUAL_TTCONFIG_UPGRADE)) static const u8 cyttsp5_security_key[] = { 0xA5, 0x01, 0x02, 0x03, 0xFF, 0xFE, 0xFD, 0x5A @@ -121,7 +115,7 @@ static inline struct cyttsp5_loader_data *cyttsp5_get_loader_data( return cyttsp5_get_module_data(dev, &loader_module); } -#if defined(CYTTSP5_FW_UPGRADE) \ +#if CYTTSP5_FW_UPGRADE \ || defined(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_PLATFORM_TTCONFIG_UPGRADE) static u8 cyttsp5_get_panel_id(struct device *dev) { @@ -131,7 +125,7 @@ static u8 cyttsp5_get_panel_id(struct device *dev) } #endif -#if defined(CYTTSP5_FW_UPGRADE) || defined(CYTTSP5_TTCONFIG_UPGRADE) +#if CYTTSP5_FW_UPGRADE || CYTTSP5_TTCONFIG_UPGRADE /* * return code: * -1: Do not upgrade firmware @@ -236,7 +230,7 @@ static int cyttsp5_calibration_attention(struct device *dev) #endif /* CYTTSP5_FW_UPGRADE || CYTTSP5_TTCONFIG_UPGRADE */ -#ifdef CYTTSP5_FW_UPGRADE +#if CYTTSP5_FW_UPGRADE static u8 *cyttsp5_get_row_(struct device *dev, u8 *row_buf, u8 *image_buf, int size) { @@ -832,7 +826,7 @@ static int upgrade_firmware_from_builtin(struct device *dev) } #endif /* CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_BINARY_FW_UPGRADE */ -#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_MANUAL_TTCONFIG_UPGRADE +#if CYTTSP5_TTCONFIG_UPGRADE static int cyttsp5_write_config_row_(struct device *dev, u8 ebid, u16 row_number, u16 row_size, u8 *data) { @@ -973,7 +967,9 @@ static int cyttsp5_upgrade_ttconfig(struct device *dev, return rc; } +#endif /* CYTTSP5_TTCONFIG_UPGRADE */ +#ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_PLATFORM_TTCONFIG_UPGRADE static int cyttsp5_get_ttconfig_crc(struct device *dev, const u8 *ttconfig_data, int ttconfig_size, u16 *crc) { @@ -1362,7 +1358,7 @@ static void cyttsp5_fw_and_config_upgrade( if (!ld->si) dev_err(dev, "%s: Fail get sysinfo pointer from core\n", __func__); -#if !defined(CYTTSP5_FW_UPGRADE) +#if !CYTTSP5_FW_UPGRADE dev_info(dev, "%s: No FW upgrade method selected!\n", __func__); #endif @@ -1382,7 +1378,7 @@ static void cyttsp5_fw_and_config_upgrade( #endif } -#ifdef CYTTSP5_FW_UPGRADE +#if CYTTSP5_FW_UPGRADE static int cyttsp5_fw_upgrade_cb(struct device *dev) { #ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_PLATFORM_FW_UPGRADE @@ -1493,7 +1489,7 @@ static int cyttsp5_loader_probe(struct device *dev, void **data) ld->dev = dev; *data = ld; -#ifdef CYTTSP5_FW_UPGRADE +#if CYTTSP5_FW_UPGRADE init_completion(&ld->int_running); #ifdef CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_BINARY_FW_UPGRADE init_completion(&ld->builtin_bin_fw_complete); @@ -1504,7 +1500,7 @@ static int cyttsp5_loader_probe(struct device *dev, void **data) cmd->subscribe_attention(dev, CY_ATTEN_LOADER, CYTTSP5_LOADER_NAME, cyttsp5_fw_upgrade_cb, CY_MODE_UNKNOWN); #endif -#if defined(CYTTSP5_FW_UPGRADE) || defined(CYTTSP5_TTCONFIG_UPGRADE) +#if CYTTSP5_FW_UPGRADE || CYTTSP5_TTCONFIG_UPGRADE init_completion(&ld->calibration_complete); INIT_WORK(&ld->calibration_work, cyttsp5_calibrate_idacs); #endif @@ -1547,7 +1543,7 @@ static void cyttsp5_loader_release(struct device *dev, void *data) { struct cyttsp5_loader_data *ld = (struct cyttsp5_loader_data *)data; -#ifdef CYTTSP5_FW_UPGRADE +#if CYTTSP5_FW_UPGRADE cmd->unsubscribe_attention(dev, CY_ATTEN_IRQ, CYTTSP5_LOADER_NAME, cyttsp5_loader_attention, CY_MODE_BOOTLOADER); diff --git a/drivers/input/touchscreen/palm_sensor.c b/drivers/input/touchscreen/palm_sensor.c deleted file mode 100644 index f457dffb27ab..000000000000 --- a/drivers/input/touchscreen/palm_sensor.c +++ /dev/null @@ -1,314 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "palm_sensor.h" - -static void palmsensor_ops_work(struct work_struct *work) -{ - struct palm_sensor_device *palm_sensor = NULL; - int ret; - - palm_sensor = container_of(work, struct palm_sensor_device, palm_work); - - if (!palm_sensor) - return; - - ret = palm_sensor->palmsensor_switch(palm_sensor->palmsensor_onoff); - if (ret == 0) - return; - - pr_err("%s palmsensor_switch error\n", __func__); - palm_sensor->palmsensor_onoff = false; -} - -static int palmsensor_dev_open(struct inode *inode, struct file *file) -{ - struct palm_sensor_device *palm_sensor = NULL; - int i = MINOR(inode->i_rdev); - - pr_info("%s\n", __func__); - palm_sensor = palmsensor_dev_get(i); - if (palm_sensor == NULL || - palm_sensor->palmsensor_switch == NULL) { - pr_info("%s can't get palm sensor\n", __func__); - return -ENODEV; - } - palm_sensor->open_status = true; - palm_sensor->report_value = 0; - file->private_data = palm_sensor; - return 0; -} - -static bool palmsensor_get_status(struct palm_sensor_device *palm_sensor) -{ - bool status = false; - - mutex_lock(&palm_sensor->mutex); - status = palm_sensor->status_changed; - mutex_unlock(&palm_sensor->mutex); - - return status; -} - -static void palmsensor_set_status(struct palm_sensor_device *palm_sensor, - bool status) -{ - mutex_lock(&palm_sensor->mutex); - palm_sensor->status_changed = status; - mutex_unlock(&palm_sensor->mutex); -} - -static ssize_t palmsensor_dev_read(struct file *file, char __user *buf, - size_t count, loff_t *pos) -{ - ssize_t ret = 0; - struct palm_sensor_device *palm_sensor = file->private_data; - - if (palm_sensor->palmsensor_onoff) - wait_event_interruptible(palm_sensor->wait_queue, - palmsensor_get_status(palm_sensor)); - else { - pr_info("%s has been off, skip report\n", __func__); - return 0; - } - pr_info("%s, report value:%d\n", __func__, palm_sensor->report_value); - if (copy_to_user(buf, &palm_sensor->report_value, - sizeof(palm_sensor->report_value))) - return -EFAULT; - - palmsensor_set_status(palm_sensor, false); - - ret = sizeof(palm_sensor->report_value); - - return ret; -} - -static ssize_t palmsensor_dev_write(struct file *file, - const char __user *buf, size_t count, loff_t *pos) -{ - char buff[10]; - struct palm_sensor_device *palm_sensor = file->private_data; - - if (copy_from_user(buff, buf, sizeof(palm_sensor->palmsensor_onoff))) - return -EFAULT; - if (!palm_sensor->open_status) { - pr_err("%s has closed\n", __func__); - return -EFAULT; - } - - if (buff[0] == '1') - palm_sensor->palmsensor_onoff = true; - else - palm_sensor->palmsensor_onoff = false; - - flush_work(&palm_sensor->palm_work); - schedule_work(&palm_sensor->palm_work); - - return sizeof(palm_sensor->palmsensor_onoff); -} - -static unsigned int palmsensor_dev_poll(struct file *file, - poll_table *wait) -{ - int ret = 0; - struct palm_sensor_device *palm_sensor = file->private_data; - - poll_wait(file, &palm_sensor->wait_queue, wait); - ret = palmsensor_get_status(palm_sensor); - if (!palm_sensor->open_status) { - pr_err("%s has closed\n", __func__); - ret = 0; - } - pr_info("%s:%d\n", __func__, ret); - - return ret; -} - -static long palmsensor_dev_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - int ret = -EINVAL; - int buf; - struct palm_sensor_device *palm_sensor = file->private_data; - void __user *argp = (void __user *) arg; - - ret = copy_from_user(&buf, (int __user *)argp, sizeof(int)); - - switch (cmd) { - case PALM_SENSOR_SWITCH: - palm_sensor->palmsensor_onoff = (buf == 1 ? true : false); - palm_sensor->report_value = 0; - flush_work(&palm_sensor->palm_work); - schedule_work(&palm_sensor->palm_work); - wake_up_interruptible(&palm_sensor->wait_queue); - break; - default: - break; - } - - pr_info("%s: onoff:%d, ret:%d\n", __func__, - palm_sensor->palmsensor_onoff, ret); - - return ret; -} - -static int palmsensor_dev_release(struct inode *inode, struct file *file) -{ - struct palm_sensor_device *palm_sensor = file->private_data; - - pr_info("%s\n", __func__); - flush_work(&palm_sensor->palm_work); - - palmsensor_set_status(palm_sensor, false); - palm_sensor->report_value = 0; - palm_sensor->open_status = false; - wake_up_interruptible(&palm_sensor->wait_queue); - - return 0; -} - -static const struct file_operations palmsensor_dev_fops = { - .owner = THIS_MODULE, - .open = palmsensor_dev_open, - .read = palmsensor_dev_read, - .write = palmsensor_dev_write, - .poll = palmsensor_dev_poll, - .unlocked_ioctl = palmsensor_dev_ioctl, - .compat_ioctl = palmsensor_dev_ioctl, - .release = palmsensor_dev_release, - .llseek = no_llseek, -}; - -static struct palm_sensor_device palm_sensor_dev = { - .misc_dev = { - .minor = MISC_DYNAMIC_MINOR, - .name = "xiaomi_palm_sensor", - .fops = &palmsensor_dev_fops, - .parent = NULL, - }, - .wait_queue = __WAIT_QUEUE_HEAD_INITIALIZER(palm_sensor_dev.wait_queue), - .mutex = __MUTEX_INITIALIZER(palm_sensor_dev.mutex), -}; - -struct palm_sensor_device *palmsensor_dev_get(int minor) -{ - if (palm_sensor_dev.misc_dev.minor == minor) - return &palm_sensor_dev; - else - return NULL; -} - -void palmsensor_update_data(int data) -{ - mutex_lock(&palm_sensor_dev.mutex); - pr_info("%s ++, value:%d\n", __func__, data); - if (palm_sensor_dev.palmsensor_onoff && - palm_sensor_dev.report_value != data) { - palm_sensor_dev.report_value = data; - palm_sensor_dev.status_changed = true; - pr_info("%s --, value:%d\n", __func__, data); - wake_up_interruptible(&palm_sensor_dev.wait_queue); - } - mutex_unlock(&palm_sensor_dev.mutex); -} - -int palmsensor_register_switch(int (*cb)(bool on)) -{ - if (cb) { - palm_sensor_dev.palmsensor_switch = cb; - return 0; - } - return -EINVAL; -} - -static int palm_sensor_parse_dt(struct device *dev, struct palm_sensor_data *data) -{ - int ret; - struct device_node *np; - - np = dev->of_node; - if (!np) - return -ENODEV; - - ret = of_property_read_string(np, "ps,name", &data->name); - if (ret) - return ret; - - pr_info("%s ps,name:%s\n", __func__, data->name); - - return 0; -} - -static int palm_sensor_probe(struct platform_device *pdev) -{ - int ret = 0; - struct device *dev = &pdev->dev; - struct palm_sensor_data *pdata; - - pdata = devm_kzalloc(dev, sizeof(struct palm_sensor_data), GFP_KERNEL); - if (!pdata) - return -ENOMEM; - - ret = palm_sensor_parse_dt(dev, pdata); - if (ret < 0) - goto out; - - ret = misc_register(&palm_sensor_dev.misc_dev); - if (ret) - goto out; - - INIT_WORK(&palm_sensor_dev.palm_work, palmsensor_ops_work); - -out: - return ret; - -} - -static int palm_sensor_remove(struct platform_device *pdev) -{ - misc_deregister(&palm_sensor_dev.misc_dev); - - return 0; -} - -static const struct of_device_id palm_sensor_of_match[] = { - { .compatible = "palm-sensor", }, - { }, -}; - -static struct platform_driver palm_sensor_device_driver = { - .probe = palm_sensor_probe, - .remove = palm_sensor_remove, - .driver = { - .name = "palm-sensor", - .of_match_table = of_match_ptr(palm_sensor_of_match), - } -}; - -static int __init palm_sensor_init(void) -{ - return platform_driver_register(&palm_sensor_device_driver); -} - -static void __exit palm_sensor_exit(void) -{ - platform_driver_unregister(&palm_sensor_device_driver); -} - -late_initcall(palm_sensor_init); -module_exit(palm_sensor_exit); - -MODULE_LICENSE("GPL"); diff --git a/drivers/input/touchscreen/palm_sensor.h b/drivers/input/touchscreen/palm_sensor.h deleted file mode 100644 index da604a0784e0..000000000000 --- a/drivers/input/touchscreen/palm_sensor.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _TOUCH_PALM_SENSOR_H -#define _TOUCH_PALM_SENSOR_H - -#include -#include -#include - -struct palm_sensor_device { - struct miscdevice misc_dev; - wait_queue_head_t wait_queue; - struct mutex mutex; - struct work_struct palm_work; - /*struct completion update_completion;*/ - int (* palmsensor_switch)(bool on); - bool palmsensor_onoff; - bool status_changed; - bool open_status; - int report_value; -}; - -struct palm_sensor_data { - struct palm_sensor_device *device; - const char *name; -}; - -#define PALM_SENSOR_SWITCH 0x1 - -struct palm_sensor_device *palmsensor_dev_get(int minor); -int palmsensor_register_switch(int (*cb)(bool on)); -void palmsensor_update_data(int data); - -#endif - diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c index f502c8488be8..867772878c0c 100644 --- a/drivers/input/touchscreen/silead.c +++ b/drivers/input/touchscreen/silead.c @@ -504,20 +504,33 @@ static int __maybe_unused silead_ts_suspend(struct device *dev) static int __maybe_unused silead_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); + bool second_try = false; int error, status; silead_ts_set_power(client, SILEAD_POWER_ON); + retry: error = silead_ts_reset(client); if (error) return error; + if (second_try) { + error = silead_ts_load_fw(client); + if (error) + return error; + } + error = silead_ts_startup(client); if (error) return error; status = silead_ts_get_status(client); if (status != SILEAD_STATUS_OK) { + if (!second_try) { + second_try = true; + dev_dbg(dev, "Reloading firmware after unsuccessful resume\n"); + goto retry; + } dev_err(dev, "Resume error, status: 0x%02x\n", status); return -ENODEV; } diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c index e943678ce54c..f1c574d6be17 100644 --- a/drivers/input/touchscreen/st1232.c +++ b/drivers/input/touchscreen/st1232.c @@ -203,6 +203,7 @@ static int st1232_ts_probe(struct i2c_client *client, input_dev->id.bustype = BUS_I2C; input_dev->dev.parent = &client->dev; + __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); __set_bit(EV_SYN, input_dev->evbit); __set_bit(EV_KEY, input_dev->evbit); __set_bit(EV_ABS, input_dev->evbit); diff --git a/drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_fw_update.c b/drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_fw_update.c index 0ba4faae79f4..4db9da148642 100644 --- a/drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_fw_update.c +++ b/drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_fw_update.c @@ -1951,7 +1951,7 @@ static int fwu_write_f34_v7_blocks(unsigned char *block_ptr, return retval; } - retval = fwu_wait_for_idle(WRITE_WAIT_MS, false); + retval = fwu_wait_for_idle(WRITE_WAIT_MS, true); if (retval < 0) { dev_err(rmi4_data->pdev->dev.parent, "%s: Failed to wait for idle status (%d blocks remaining)\n", @@ -1961,6 +1961,8 @@ static int fwu_write_f34_v7_blocks(unsigned char *block_ptr, block_ptr += (transfer * fwu->block_size); remaining -= transfer; + dev_dbg(rmi4_data->pdev->dev.parent, "%s: remaining %d\n", + __func__, remaining); } while (remaining); return 0; @@ -2010,7 +2012,7 @@ static int fwu_write_f34_v5v6_blocks(unsigned char *block_ptr, return retval; } - retval = fwu_wait_for_idle(WRITE_WAIT_MS, false); + retval = fwu_wait_for_idle(WRITE_WAIT_MS, true); if (retval < 0) { dev_err(rmi4_data->pdev->dev.parent, "%s: Failed to wait for idle status (block %d)\n", @@ -2019,6 +2021,8 @@ static int fwu_write_f34_v5v6_blocks(unsigned char *block_ptr, } block_ptr += fwu->block_size; + dev_dbg(rmi4_data->pdev->dev.parent, "%s: remaining %d\n", + __func__, block_cnt - blk); } return 0; diff --git a/drivers/input/touchscreen/xiaomi/Kconfig b/drivers/input/touchscreen/xiaomi/Kconfig deleted file mode 100644 index 928677ce21f6..000000000000 --- a/drivers/input/touchscreen/xiaomi/Kconfig +++ /dev/null @@ -1,29 +0,0 @@ -config TOUCHSCREEN_XIAOMI_TOUCHFEATURE - tristate "Xiaomi Touch Feature" - depends on INPUT_TOUCHSCREEN - help - Say Y here if you enable xiaomi touch feature. - - If unsure, say N. - - To compile this driver as a module, choose M here: - -config TOUCHSCREEN_XIAOMI_TOUCHFEATURE_GAMEMODE - tristate "Xiaomi Touch Feature Gamemode" - depends on TOUCHSCREEN_XIAOMI_TOUCHFEATURE - help - Say Y here if you enable xiaomi touch feature. - - If unsure, say N. - - To compile this driver as a module, choose M here: - -config TOUCHSCREEN_XIAOMI_TOUCHFEATURE_SENSOR - tristate "Xiaomi Touch Feature Sensor" - depends on TOUCHSCREEN_XIAOMI_TOUCHFEATURE - help - Say Y here if you enable xiaomi touch feature. - - If unsure, say N. - - To compile this driver as a module, choose M here: diff --git a/drivers/input/touchscreen/xiaomi/Makefile b/drivers/input/touchscreen/xiaomi/Makefile deleted file mode 100644 index 9ed31b6c4a73..000000000000 --- a/drivers/input/touchscreen/xiaomi/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-$(CONFIG_TOUCHSCREEN_XIAOMI_TOUCHFEATURE) += xiaomi_touch.o diff --git a/drivers/input/touchscreen/xiaomi/xiaomi_touch.c b/drivers/input/touchscreen/xiaomi/xiaomi_touch.c deleted file mode 100644 index 347ebd747b2a..000000000000 --- a/drivers/input/touchscreen/xiaomi/xiaomi_touch.c +++ /dev/null @@ -1,430 +0,0 @@ -#include "xiaomi_touch.h" - -static struct xiaomi_touch_pdata *touch_pdata; - -static int xiaomi_touch_dev_open(struct inode *inode, struct file *file) -{ - struct xiaomi_touch *dev = NULL; - int i = MINOR(inode->i_rdev); - struct xiaomi_touch_pdata *touch_pdata; - - pr_info("%s\n", __func__); - dev = xiaomi_touch_dev_get(i); - if (!dev) { - pr_err("%s cant get dev\n", __func__); - return -ENOMEM; - } - touch_pdata = dev_get_drvdata(dev->dev); - - file->private_data = touch_pdata; - return 0; -} - -static ssize_t xiaomi_touch_dev_read(struct file *file, char __user *buf, - size_t count, loff_t *pos) -{ - return 0; -} - -static ssize_t xiaomi_touch_dev_write(struct file *file, - const char __user *buf, size_t count, loff_t *pos) -{ - return 0; -} - -static unsigned int xiaomi_touch_dev_poll(struct file *file, - poll_table *wait) -{ - return 0; -} - -static long xiaomi_touch_dev_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - int ret = -EINVAL; - int buf[VALUE_TYPE_SIZE] = {0,}; - struct xiaomi_touch_pdata *pdata = file->private_data; - void __user *argp = (void __user *) arg; - struct xiaomi_touch_interface *touch_data = pdata->touch_data; - struct xiaomi_touch *dev = pdata->device; - int user_cmd = _IOC_NR(cmd); - - if (!pdata || !touch_data || !dev) { - pr_err("%s invalid memory\n", __func__); - return -ENOMEM; - } - - mutex_lock(&dev->mutex); - ret = copy_from_user(&buf, (int __user *)argp, sizeof(buf)); - - pr_info("%s cmd:%d, mode:%d, value:%d\n", __func__, user_cmd, buf[0], buf[1]); - - switch (user_cmd) { - case SET_CUR_VALUE: - if (touch_data->setModeValue) - buf[0] = touch_data->setModeValue(buf[0], buf[1]); - break; - case GET_CUR_VALUE: - case GET_DEF_VALUE: - case GET_MIN_VALUE: - case GET_MAX_VALUE: - if (touch_data->getModeValue) - buf[0] = touch_data->getModeValue(buf[0], user_cmd); - break; - case RESET_MODE: - if (touch_data->resetMode) - buf[0] = touch_data->resetMode(buf[0]); - break; - case GET_MODE_VALUE: - if (touch_data->getModeValue) - ret = touch_data->getModeAll(buf[0], buf); - break; - default: - pr_err("%s don't support mode\n", __func__); - ret = -EINVAL; - break; - } - - if (ret >= 0) - ret = copy_to_user((int __user *)argp, &buf, sizeof(buf)); - else - pr_err("%s can't get data from touch driver\n", __func__); - - mutex_unlock(&dev->mutex); - - return ret; -} - -static int xiaomi_touch_dev_release(struct inode *inode, struct file *file) -{ - return 0; -} - -static const struct file_operations xiaomitouch_dev_fops = { - .owner = THIS_MODULE, - .open = xiaomi_touch_dev_open, - .read = xiaomi_touch_dev_read, - .write = xiaomi_touch_dev_write, - .poll = xiaomi_touch_dev_poll, - .unlocked_ioctl = xiaomi_touch_dev_ioctl, - .compat_ioctl = xiaomi_touch_dev_ioctl, - .release = xiaomi_touch_dev_release, - .llseek = no_llseek, -}; - -static struct xiaomi_touch xiaomi_touch_dev = { - .misc_dev = { - .minor = MISC_DYNAMIC_MINOR, - .name = "xiaomi-touch", - .fops = &xiaomitouch_dev_fops, - .parent = NULL, - }, - .mutex = __MUTEX_INITIALIZER(xiaomi_touch_dev.mutex), - .palm_mutex = __MUTEX_INITIALIZER(xiaomi_touch_dev.palm_mutex), - .psensor_mutex = __MUTEX_INITIALIZER(xiaomi_touch_dev.psensor_mutex), - .wait_queue = __WAIT_QUEUE_HEAD_INITIALIZER(xiaomi_touch_dev.wait_queue), -}; - -struct xiaomi_touch *xiaomi_touch_dev_get(int minor) -{ - if (xiaomi_touch_dev.misc_dev.minor == minor) - return &xiaomi_touch_dev; - else - return NULL; -} - -struct class *get_xiaomi_touch_class() -{ - return xiaomi_touch_dev.class; -} - -struct device *get_xiaomi_touch_dev() -{ - return xiaomi_touch_dev.dev; -} - -int xiaomitouch_register_modedata(struct xiaomi_touch_interface *data) -{ - int ret = 0; - struct xiaomi_touch_interface *touch_data = NULL; - - if (!touch_pdata) - ret = -ENOMEM; - - touch_data = touch_pdata->touch_data; - pr_info("%s\n", __func__); - - mutex_lock(&xiaomi_touch_dev.mutex); - - touch_data->setModeValue = data->setModeValue; - touch_data->getModeValue = data->getModeValue; - touch_data->resetMode = data->resetMode; - touch_data->getModeAll = data->getModeAll; - touch_data->palm_sensor_read = data->palm_sensor_read; - touch_data->palm_sensor_write = data->palm_sensor_write; - touch_data->p_sensor_read = data->p_sensor_read; - touch_data->p_sensor_write = data->p_sensor_write; - - mutex_unlock(&xiaomi_touch_dev.mutex); - - return ret; -} - -int update_palm_sensor_value(int value) -{ - struct xiaomi_touch *dev = NULL; - - mutex_lock(&xiaomi_touch_dev.palm_mutex); - - if (!touch_pdata) { - mutex_unlock(&xiaomi_touch_dev.palm_mutex); - return -ENODEV; - } - - dev = touch_pdata->device; - - if (value != touch_pdata->palm_value) { - pr_info("%s value:%d\n", __func__, value); - touch_pdata->palm_value = value; - touch_pdata->palm_changed = true; - wake_up(&dev->wait_queue); - } - - mutex_unlock(&xiaomi_touch_dev.palm_mutex); - return 0; -} - -static ssize_t palm_sensor_show(struct device *dev, -struct device_attribute *attr, char *buf) -{ - struct xiaomi_touch_pdata *pdata = dev_get_drvdata(dev); - struct xiaomi_touch *touch_dev = pdata->device; - - wait_event_interruptible(touch_dev->wait_queue, pdata->palm_changed); - pdata->palm_changed = false; - - return snprintf(buf, PAGE_SIZE, "%d\n", pdata->palm_value); -} - -static ssize_t palm_sensor_store(struct device *dev, -struct device_attribute *attr, const char *buf, size_t count) -{ - unsigned int input; - struct xiaomi_touch_pdata *pdata = dev_get_drvdata(dev); - - if (sscanf(buf, "%d", &input) < 0) - return -EINVAL; - - if (pdata->touch_data->palm_sensor_write) - pdata->touch_data->palm_sensor_write(!!input); - else { - pr_err("%s has not implement\n", __func__); - } - pr_info("%s value:%d\n", __func__, !!input); - - return count; -} - -int update_p_sensor_value(int value) -{ - struct xiaomi_touch *dev = NULL; - - mutex_lock(&xiaomi_touch_dev.psensor_mutex); - - if (!touch_pdata) { - mutex_unlock(&xiaomi_touch_dev.psensor_mutex); - return -ENODEV; - } - - dev = touch_pdata->device; - - if (value != touch_pdata->psensor_value) { - pr_info("%s value:%d\n", __func__, value); - touch_pdata->psensor_value = value; - touch_pdata->psensor_changed = true; - wake_up(&dev->wait_queue); - } - - mutex_unlock(&xiaomi_touch_dev.psensor_mutex); - return 0; -} - -static ssize_t p_sensor_show(struct device *dev, -struct device_attribute *attr, char *buf) -{ - struct xiaomi_touch_pdata *pdata = dev_get_drvdata(dev); - struct xiaomi_touch *touch_dev = pdata->device; - - wait_event_interruptible(touch_dev->wait_queue, pdata->psensor_changed); - pdata->psensor_changed = false; - - return snprintf(buf, PAGE_SIZE, "%d\n", pdata->psensor_value); -} - -static ssize_t p_sensor_store(struct device *dev, -struct device_attribute *attr, const char *buf, size_t count) -{ - unsigned int input; - struct xiaomi_touch_pdata *pdata = dev_get_drvdata(dev); - - if (sscanf(buf, "%d", &input) < 0) - return -EINVAL; - - if (pdata->touch_data->p_sensor_write) - pdata->touch_data->p_sensor_write(!!input); - else { - pr_err("%s has not implement\n", __func__); - } - pr_info("%s value:%d\n", __func__, !!input); - - return count; -} - -static DEVICE_ATTR(palm_sensor, (S_IRUGO | S_IWUSR | S_IWGRP), - palm_sensor_show, palm_sensor_store); - -static DEVICE_ATTR(p_sensor, (S_IRUGO | S_IWUSR | S_IWGRP), - p_sensor_show, p_sensor_store); - -static struct attribute *touch_attr_group[] = { - &dev_attr_palm_sensor.attr, - &dev_attr_p_sensor.attr, - NULL, -}; - -static const struct of_device_id xiaomi_touch_of_match[] = { - { .compatible = "xiaomi-touch", }, - { }, -}; - -static int xiaomi_touch_parse_dt(struct device *dev, struct xiaomi_touch_pdata *data) -{ - int ret; - struct device_node *np; - - np = dev->of_node; - if (!np) - return -ENODEV; - - ret = of_property_read_string(np, "touch,name", &data->name); - if (ret) - return ret; - - pr_info("%s touch,name:%s\n", __func__, data->name); - - return 0; -} - -static int xiaomi_touch_probe(struct platform_device *pdev) -{ - int ret = 0; - struct device *dev = &pdev->dev; - struct xiaomi_touch_pdata *pdata; - - pdata = devm_kzalloc(dev, sizeof(struct xiaomi_touch_pdata), GFP_KERNEL); - if (!pdata) - return -ENOMEM; - - pr_info("%s enter\n", __func__); - - ret = xiaomi_touch_parse_dt(dev, pdata); - if (ret < 0) { - pr_err("%s parse dt error:%d\n", __func__, ret); - goto parse_dt_err; - } - - ret = misc_register(&xiaomi_touch_dev.misc_dev); - if (ret) { - pr_err("%s create misc device err:%d\n", __func__, ret); - goto parse_dt_err; - } - - if (!xiaomi_touch_dev.class) - xiaomi_touch_dev.class = class_create(THIS_MODULE, "touch"); - - if (!xiaomi_touch_dev.class) { - pr_err("%s create device class err\n", __func__); - goto class_create_err; - } - - xiaomi_touch_dev.dev = device_create(xiaomi_touch_dev.class, NULL, 'T', NULL, "touch_dev"); - if (!xiaomi_touch_dev.dev) { - pr_err("%s create device dev err\n", __func__); - goto device_create_err; - } - - pdata->touch_data = (struct xiaomi_touch_interface *)kzalloc(sizeof(struct xiaomi_touch_interface), GFP_KERNEL); - if (pdata->touch_data == NULL) { - ret = -ENOMEM; - pr_err("%s alloc mem for touch_data\n", __func__); - goto data_mem_err; - } - - pdata->device = &xiaomi_touch_dev; - dev_set_drvdata(xiaomi_touch_dev.dev, pdata); - - touch_pdata = pdata; - - xiaomi_touch_dev.attrs.attrs = touch_attr_group; - ret = sysfs_create_group(&xiaomi_touch_dev.dev->kobj, &xiaomi_touch_dev.attrs); - if (ret) { - pr_err("%s ERROR: Cannot create sysfs structure!:%d\n", __func__, ret); - ret = -ENODEV; - goto sys_group_err; - } - - pr_info("%s over\n", __func__); - - return ret; - -sys_group_err: - if (pdata->touch_data) { - kfree(pdata->touch_data); - pdata->touch_data = NULL; - } -data_mem_err: - device_destroy(xiaomi_touch_dev.class, 0); -device_create_err: - class_destroy(xiaomi_touch_dev.class); -class_create_err: - misc_deregister(&xiaomi_touch_dev.misc_dev); -parse_dt_err: - pr_err("%s fail!\n", __func__); - return ret; -} - -static int xiaomi_touch_remove(struct platform_device *pdev) -{ - device_destroy(xiaomi_touch_dev.class, 0); - class_destroy(xiaomi_touch_dev.class); - misc_deregister(&xiaomi_touch_dev.misc_dev); - if (touch_pdata->touch_data) { - kfree(touch_pdata->touch_data); - touch_pdata->touch_data = NULL; - } - - return 0; -} - -static struct platform_driver xiaomi_touch_device_driver = { - .probe = xiaomi_touch_probe, - .remove = xiaomi_touch_remove, - .driver = { - .name = "xiaomi-touch", - .of_match_table = of_match_ptr(xiaomi_touch_of_match), - } -}; - -static int __init xiaomi_touch_init(void) -{ - return platform_driver_register(&xiaomi_touch_device_driver); - -} - -static void __exit xiaomi_touch_exit(void) -{ - platform_driver_unregister(&xiaomi_touch_device_driver); -} - -subsys_initcall(xiaomi_touch_init); -module_exit(xiaomi_touch_exit); diff --git a/drivers/input/touchscreen/xiaomi/xiaomi_touch.h b/drivers/input/touchscreen/xiaomi/xiaomi_touch.h deleted file mode 100644 index cac2a39886df..000000000000 --- a/drivers/input/touchscreen/xiaomi/xiaomi_touch.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef __XIAOMI__TOUCH_H -#define __XIAOMI__TOUCH_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/*CUR,DEFAULT,MIN,MAX*/ -#define VALUE_TYPE_SIZE 6 -#define VALUE_GRIP_SIZE 9 -enum MODE_CMD { - SET_CUR_VALUE = 0, - GET_CUR_VALUE, - GET_DEF_VALUE, - GET_MIN_VALUE, - GET_MAX_VALUE, - GET_MODE_VALUE, - RESET_MODE, -}; - -enum MODE_TYPE { - Touch_Game_Mode = 0, - Touch_Active_MODE = 1, - Touch_UP_THRESHOLD = 2, - Touch_Tolerance = 3, - Touch_Wgh_Min = 4, - Touch_Wgh_Max = 5, - Touch_Wgh_Step = 6, - Touch_Edge_Filter = 7, - Touch_Panel_Orientation = 8, - Touch_Report_Rate = 9, - Touch_Mode_NUM = 10, -}; - -struct xiaomi_touch_interface { - int touch_mode[Touch_Mode_NUM][VALUE_TYPE_SIZE]; - int touch_edge[VALUE_GRIP_SIZE]; - int (*setModeValue)(int Mode, int value); - int (*getModeValue)(int Mode, int value_type); - int (*getModeAll)(int Mode, int *modevalue); - int (*resetMode)(int Mode); - int (*p_sensor_read)(void); - int (*p_sensor_write)(int on); - int (*palm_sensor_read)(void); - int (*palm_sensor_write)(int on); - int (*pocket_read)(void); - int (*pocket_write)(int on); -}; - -struct xiaomi_touch { - struct miscdevice misc_dev; - struct device *dev; - struct class *class; - struct attribute_group attrs; - struct mutex mutex; - struct mutex palm_mutex; - struct mutex psensor_mutex; - struct mutex pocket_mutex; - wait_queue_head_t wait_queue; -}; - -struct xiaomi_touch_pdata{ - struct xiaomi_touch *device; - struct xiaomi_touch_interface *touch_data; - int palm_value; - bool palm_changed; - int psensor_value; - bool psensor_changed; - int pocket_value; - bool pocket_changed; - const char *name; -}; - -struct xiaomi_touch *xiaomi_touch_dev_get(int minor); - -extern struct class *get_xiaomi_touch_class(void); - -extern struct device *get_xiaomi_touch_dev(void); - -extern int update_palm_sensor_value(int value); - -extern int update_p_sensor_value(int value); - -extern int update_pocket_value(int value); - -int xiaomitouch_register_modedata(struct xiaomi_touch_interface *data); - -#endif