Loading drivers/input/touchscreen/Kconfig +11 −0 Original line number Diff line number Diff line Loading @@ -1127,4 +1127,15 @@ config TOUCHSCREEN_MAXIM_STI module will be called maxim_sti. source "drivers/input/touchscreen/gt9xx/Kconfig" config SECURE_TOUCH_SYNAPTICS_DSX_V26 bool "Secure Touch support for Synaptics V2.6 Touchscreen" depends on TOUCHSCREEN_SYNAPTICS_DSX_I2C_v26 help Say Y here -Synaptics DSX V2.6 touch driver is connected -To enable secure touch for Synaptics DSX V2.6 touch driver If unsure, say N. endif drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_core.c +221 −1 Original line number Diff line number Diff line Loading @@ -172,6 +172,19 @@ static ssize_t synaptics_rmi4_wake_gesture_store(struct device *dev, static ssize_t synaptics_rmi4_virtual_key_map_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf); #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) static ssize_t synaptics_rmi4_secure_touch_enable_show(struct device *dev, struct device_attribute *attr, char *buf); static ssize_t synaptics_rmi4_secure_touch_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); static ssize_t synaptics_rmi4_secure_touch_show(struct device *dev, struct device_attribute *attr, char *buf); #endif static irqreturn_t synaptics_rmi4_irq(int irq, void *data); struct synaptics_rmi4_f01_device_status { union { struct { Loading Loading @@ -617,6 +630,14 @@ static struct device_attribute attrs[] = { __ATTR(wake_gesture, (S_IRUGO | S_IWUSR | S_IWGRP), synaptics_rmi4_wake_gesture_show, synaptics_rmi4_wake_gesture_store), #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) __ATTR(secure_touch_enable, (S_IRUGO | S_IWUSR | S_IWGRP), synaptics_rmi4_secure_touch_enable_show, synaptics_rmi4_secure_touch_enable_store), __ATTR(secure_touch, S_IRUGO , synaptics_rmi4_secure_touch_show, NULL), #endif }; static struct kobj_attribute virtual_key_map_attr = { Loading @@ -627,6 +648,182 @@ static struct kobj_attribute virtual_key_map_attr = { .show = synaptics_rmi4_virtual_key_map_show, }; #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) static void synaptics_secure_touch_init(struct synaptics_rmi4_data *data) { init_completion(&data->st_powerdown); init_completion(&data->st_irq_processed); } static void synaptics_secure_touch_notify(struct synaptics_rmi4_data *rmi4_data) { sysfs_notify(&rmi4_data->input_dev->dev.kobj, NULL, "secure_touch"); } static irqreturn_t synaptics_filter_interrupt( struct synaptics_rmi4_data *rmi4_data) { if (atomic_read(&rmi4_data->st_enabled)) { if (atomic_cmpxchg(&rmi4_data->st_pending_irqs, 0, 1) == 0) { reinit_completion(&rmi4_data->st_irq_processed); synaptics_secure_touch_notify(rmi4_data); wait_for_completion_interruptible( &rmi4_data->st_irq_processed); } return IRQ_HANDLED; } return IRQ_NONE; } /* * 'blocking' variable will have value 'true' when we want to prevent the driver * from accessing the xPU/SMMU protected HW resources while the session is * active. */ static void synaptics_secure_touch_stop(struct synaptics_rmi4_data *rmi4_data, bool blocking) { if (atomic_read(&rmi4_data->st_enabled)) { atomic_set(&rmi4_data->st_pending_irqs, -1); synaptics_secure_touch_notify(rmi4_data); if (blocking) wait_for_completion_interruptible( &rmi4_data->st_powerdown); } } #else static void synaptics_secure_touch_init(struct synaptics_rmi4_data *rmi4_data) { } static irqreturn_t synaptics_filter_interrupt( struct synaptics_rmi4_data *rmi4_data) { return IRQ_NONE; } static void synaptics_secure_touch_stop(struct synaptics_rmi4_data *rmi4_data, bool blocking) { } #endif #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) static ssize_t synaptics_rmi4_secure_touch_enable_show(struct device *dev, struct device_attribute *attr, char *buf) { struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev); return scnprintf(buf, PAGE_SIZE, "%d", atomic_read(&rmi4_data->st_enabled)); } /* * Accept only "0" and "1" valid values. * "0" will reset the st_enabled flag, then wake up the reading process and * the interrupt handler. * The bus driver is notified via pm_runtime that it is not required to stay * awake anymore. * It will also make sure the queue of events is emptied in the controller, * in case a touch happened in between the secure touch being disabled and * the local ISR being ungated. * "1" will set the st_enabled flag and clear the st_pending_irqs flag. * The bus driver is requested via pm_runtime to stay awake. */ static ssize_t synaptics_rmi4_secure_touch_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev); unsigned long value; int err = 0; if (count > 2) return -EINVAL; err = kstrtoul(buf, 10, &value); if (err != 0) return err; err = count; switch (value) { case 0: if (atomic_read(&rmi4_data->st_enabled) == 0) break; synaptics_rmi4_bus_put(rmi4_data); atomic_set(&rmi4_data->st_enabled, 0); synaptics_secure_touch_notify(rmi4_data); complete(&rmi4_data->st_irq_processed); synaptics_rmi4_irq(rmi4_data->irq, rmi4_data); complete(&rmi4_data->st_powerdown); break; case 1: if (atomic_read(&rmi4_data->st_enabled)) { err = -EBUSY; break; } synchronize_irq(rmi4_data->irq); if (synaptics_rmi4_bus_get(rmi4_data) < 0) { dev_err( rmi4_data->pdev->dev.parent, "synaptics_rmi4_bus_get failed\n"); err = -EIO; break; } reinit_completion(&rmi4_data->st_powerdown); reinit_completion(&rmi4_data->st_irq_processed); atomic_set(&rmi4_data->st_enabled, 1); atomic_set(&rmi4_data->st_pending_irqs, 0); break; default: dev_err( rmi4_data->pdev->dev.parent, "unsupported value: %lu\n", value); err = -EINVAL; break; } return err; } /* * This function returns whether there are pending interrupts, or * other error conditions that need to be signaled to the userspace library, * according tot he following logic: * - st_enabled is 0 if secure touch is not enabled, returning -EBADF * - st_pending_irqs is -1 to signal that secure touch is in being stopped, * returning -EINVAL * - st_pending_irqs is 1 to signal that there is a pending irq, returning * the value "1" to the sysfs read operation * - st_pending_irqs is 0 (only remaining case left) if the pending interrupt * has been processed, so the interrupt handler can be allowed to continue. */ static ssize_t synaptics_rmi4_secure_touch_show(struct device *dev, struct device_attribute *attr, char *buf) { struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev); int val = 0; if (atomic_read(&rmi4_data->st_enabled) == 0) return -EBADF; if (atomic_cmpxchg(&rmi4_data->st_pending_irqs, -1, 0) == -1) return -EINVAL; if (atomic_cmpxchg(&rmi4_data->st_pending_irqs, 1, 0) == 1) val = 1; else complete(&rmi4_data->st_irq_processed); return scnprintf(buf, PAGE_SIZE, "%u", val); } #endif static ssize_t synaptics_rmi4_f01_reset_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { Loading Loading @@ -1512,6 +1709,9 @@ static irqreturn_t synaptics_rmi4_irq(int irq, void *data) const struct synaptics_dsx_board_data *bdata = rmi4_data->hw_if->board_data; if (IRQ_HANDLED == synaptics_filter_interrupt(data)) return IRQ_HANDLED; if (gpio_get_value(bdata->irq_gpio) != bdata->irq_on_state) goto exit; Loading Loading @@ -3866,6 +4066,10 @@ static int synaptics_rmi4_probe(struct platform_device *pdev) queue_work(rmi4_data->reset_workqueue, &rmi4_data->reset_work); #endif /* Initialize secure touch */ synaptics_secure_touch_init(rmi4_data); synaptics_secure_touch_stop(rmi4_data, true); return retval; err_sysfs: Loading Loading @@ -4106,7 +4310,9 @@ static int synaptics_rmi4_fb_notifier_cb(struct notifier_block *self, fb_notifier); if (evdata && evdata->data && rmi4_data) { if (event == FB_EVENT_BLANK) { if (event == FB_EARLY_EVENT_BLANK) { synaptics_secure_touch_stop(rmi4_data, false); } else if (event == FB_EVENT_BLANK) { transition = evdata->data; if (*transition == FB_BLANK_POWERDOWN) { synaptics_rmi4_suspend(&rmi4_data->pdev->dev); Loading @@ -4133,6 +4339,14 @@ static void synaptics_rmi4_early_suspend(struct early_suspend *h) if (rmi4_data->stay_awake) return; /* * During early suspend/late resume, the driver doesn't access xPU/SMMU * protected HW resources. So, there is no compelling need to block, * but notifying the userspace that a power event has occurred is * enough. Hence 'blocking' variable can be set to false. */ synaptics_secure_touch_stop(rmi4_data, false); if (rmi4_data->enable_wakeup_gesture) { synaptics_rmi4_wakeup_gesture(rmi4_data, true); enable_irq_wake(rmi4_data->irq); Loading Loading @@ -4170,6 +4384,8 @@ static void synaptics_rmi4_late_resume(struct early_suspend *h) if (rmi4_data->stay_awake) return; synaptics_secure_touch_stop(rmi4_data, false); if (rmi4_data->enable_wakeup_gesture) { synaptics_rmi4_wakeup_gesture(rmi4_data, false); disable_irq_wake(rmi4_data->irq); Loading Loading @@ -4216,6 +4432,8 @@ static int synaptics_rmi4_suspend(struct device *dev) if (rmi4_data->stay_awake) return 0; synaptics_secure_touch_stop(rmi4_data, true); if (rmi4_data->enable_wakeup_gesture) { synaptics_rmi4_wakeup_gesture(rmi4_data, true); enable_irq_wake(rmi4_data->irq); Loading Loading @@ -4253,6 +4471,8 @@ static int synaptics_rmi4_resume(struct device *dev) if (rmi4_data->stay_awake) return 0; synaptics_secure_touch_stop(rmi4_data, true); if (rmi4_data->enable_wakeup_gesture) { synaptics_rmi4_wakeup_gesture(rmi4_data, false); disable_irq_wake(rmi4_data->irq); Loading drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_core.h +27 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,12 @@ #include <linux/earlysuspend.h> #endif #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) #include <linux/completion.h> #include <linux/atomic.h> #include <linux/pm_runtime.h> #endif #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)) #define KERNEL_ABOVE_2_6_38 #endif Loading Loading @@ -374,6 +380,12 @@ struct synaptics_rmi4_data { bool enable); void (*report_touch)(struct synaptics_rmi4_data *rmi4_data, struct synaptics_rmi4_fn *fhandler); #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) atomic_t st_enabled; atomic_t st_pending_irqs; struct completion st_powerdown; struct completion st_irq_processed; #endif }; struct synaptics_dsx_bus_access { Loading @@ -382,6 +394,10 @@ struct synaptics_dsx_bus_access { unsigned char *data, unsigned short length); int (*write)(struct synaptics_rmi4_data *rmi4_data, unsigned short addr, unsigned char *data, unsigned short length); #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) int (*get)(struct synaptics_rmi4_data *rmi4_data); void (*put)(struct synaptics_rmi4_data *rmi4_data); #endif }; struct synaptics_dsx_hw_interface { Loading Loading @@ -432,6 +448,17 @@ static inline int synaptics_rmi4_reg_write( return rmi4_data->hw_if->bus_access->write(rmi4_data, addr, data, len); } #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) static inline int synaptics_rmi4_bus_get(struct synaptics_rmi4_data *rmi4_data) { return rmi4_data->hw_if->bus_access->get(rmi4_data); } static inline void synaptics_rmi4_bus_put(struct synaptics_rmi4_data *rmi4_data) { rmi4_data->hw_if->bus_access->put(rmi4_data); } #endif static inline ssize_t synaptics_rmi4_show_error(struct device *dev, struct device_attribute *attr, char *buf) { Loading drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_i2c.c +27 −0 Original line number Diff line number Diff line Loading @@ -497,10 +497,37 @@ exit: return retval; } #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) static int synaptics_rmi4_i2c_get(struct synaptics_rmi4_data *rmi4_data) { int retval; struct i2c_client *i2c = to_i2c_client(rmi4_data->pdev->dev.parent); mutex_lock(&rmi4_data->rmi4_io_ctrl_mutex); retval = pm_runtime_get_sync(i2c->adapter->dev.parent); mutex_unlock(&rmi4_data->rmi4_io_ctrl_mutex); return retval; } static void synaptics_rmi4_i2c_put(struct synaptics_rmi4_data *rmi4_data) { struct i2c_client *i2c = to_i2c_client(rmi4_data->pdev->dev.parent); mutex_lock(&rmi4_data->rmi4_io_ctrl_mutex); pm_runtime_put_sync(i2c->adapter->dev.parent); mutex_unlock(&rmi4_data->rmi4_io_ctrl_mutex); } #endif static struct synaptics_dsx_bus_access bus_access = { .type = BUS_I2C, .read = synaptics_rmi4_i2c_read, .write = synaptics_rmi4_i2c_write, #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) .get = synaptics_rmi4_i2c_get, .put = synaptics_rmi4_i2c_put, #endif }; static void synaptics_rmi4_i2c_dev_release(struct device *dev) Loading Loading
drivers/input/touchscreen/Kconfig +11 −0 Original line number Diff line number Diff line Loading @@ -1127,4 +1127,15 @@ config TOUCHSCREEN_MAXIM_STI module will be called maxim_sti. source "drivers/input/touchscreen/gt9xx/Kconfig" config SECURE_TOUCH_SYNAPTICS_DSX_V26 bool "Secure Touch support for Synaptics V2.6 Touchscreen" depends on TOUCHSCREEN_SYNAPTICS_DSX_I2C_v26 help Say Y here -Synaptics DSX V2.6 touch driver is connected -To enable secure touch for Synaptics DSX V2.6 touch driver If unsure, say N. endif
drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_core.c +221 −1 Original line number Diff line number Diff line Loading @@ -172,6 +172,19 @@ static ssize_t synaptics_rmi4_wake_gesture_store(struct device *dev, static ssize_t synaptics_rmi4_virtual_key_map_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf); #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) static ssize_t synaptics_rmi4_secure_touch_enable_show(struct device *dev, struct device_attribute *attr, char *buf); static ssize_t synaptics_rmi4_secure_touch_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); static ssize_t synaptics_rmi4_secure_touch_show(struct device *dev, struct device_attribute *attr, char *buf); #endif static irqreturn_t synaptics_rmi4_irq(int irq, void *data); struct synaptics_rmi4_f01_device_status { union { struct { Loading Loading @@ -617,6 +630,14 @@ static struct device_attribute attrs[] = { __ATTR(wake_gesture, (S_IRUGO | S_IWUSR | S_IWGRP), synaptics_rmi4_wake_gesture_show, synaptics_rmi4_wake_gesture_store), #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) __ATTR(secure_touch_enable, (S_IRUGO | S_IWUSR | S_IWGRP), synaptics_rmi4_secure_touch_enable_show, synaptics_rmi4_secure_touch_enable_store), __ATTR(secure_touch, S_IRUGO , synaptics_rmi4_secure_touch_show, NULL), #endif }; static struct kobj_attribute virtual_key_map_attr = { Loading @@ -627,6 +648,182 @@ static struct kobj_attribute virtual_key_map_attr = { .show = synaptics_rmi4_virtual_key_map_show, }; #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) static void synaptics_secure_touch_init(struct synaptics_rmi4_data *data) { init_completion(&data->st_powerdown); init_completion(&data->st_irq_processed); } static void synaptics_secure_touch_notify(struct synaptics_rmi4_data *rmi4_data) { sysfs_notify(&rmi4_data->input_dev->dev.kobj, NULL, "secure_touch"); } static irqreturn_t synaptics_filter_interrupt( struct synaptics_rmi4_data *rmi4_data) { if (atomic_read(&rmi4_data->st_enabled)) { if (atomic_cmpxchg(&rmi4_data->st_pending_irqs, 0, 1) == 0) { reinit_completion(&rmi4_data->st_irq_processed); synaptics_secure_touch_notify(rmi4_data); wait_for_completion_interruptible( &rmi4_data->st_irq_processed); } return IRQ_HANDLED; } return IRQ_NONE; } /* * 'blocking' variable will have value 'true' when we want to prevent the driver * from accessing the xPU/SMMU protected HW resources while the session is * active. */ static void synaptics_secure_touch_stop(struct synaptics_rmi4_data *rmi4_data, bool blocking) { if (atomic_read(&rmi4_data->st_enabled)) { atomic_set(&rmi4_data->st_pending_irqs, -1); synaptics_secure_touch_notify(rmi4_data); if (blocking) wait_for_completion_interruptible( &rmi4_data->st_powerdown); } } #else static void synaptics_secure_touch_init(struct synaptics_rmi4_data *rmi4_data) { } static irqreturn_t synaptics_filter_interrupt( struct synaptics_rmi4_data *rmi4_data) { return IRQ_NONE; } static void synaptics_secure_touch_stop(struct synaptics_rmi4_data *rmi4_data, bool blocking) { } #endif #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) static ssize_t synaptics_rmi4_secure_touch_enable_show(struct device *dev, struct device_attribute *attr, char *buf) { struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev); return scnprintf(buf, PAGE_SIZE, "%d", atomic_read(&rmi4_data->st_enabled)); } /* * Accept only "0" and "1" valid values. * "0" will reset the st_enabled flag, then wake up the reading process and * the interrupt handler. * The bus driver is notified via pm_runtime that it is not required to stay * awake anymore. * It will also make sure the queue of events is emptied in the controller, * in case a touch happened in between the secure touch being disabled and * the local ISR being ungated. * "1" will set the st_enabled flag and clear the st_pending_irqs flag. * The bus driver is requested via pm_runtime to stay awake. */ static ssize_t synaptics_rmi4_secure_touch_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev); unsigned long value; int err = 0; if (count > 2) return -EINVAL; err = kstrtoul(buf, 10, &value); if (err != 0) return err; err = count; switch (value) { case 0: if (atomic_read(&rmi4_data->st_enabled) == 0) break; synaptics_rmi4_bus_put(rmi4_data); atomic_set(&rmi4_data->st_enabled, 0); synaptics_secure_touch_notify(rmi4_data); complete(&rmi4_data->st_irq_processed); synaptics_rmi4_irq(rmi4_data->irq, rmi4_data); complete(&rmi4_data->st_powerdown); break; case 1: if (atomic_read(&rmi4_data->st_enabled)) { err = -EBUSY; break; } synchronize_irq(rmi4_data->irq); if (synaptics_rmi4_bus_get(rmi4_data) < 0) { dev_err( rmi4_data->pdev->dev.parent, "synaptics_rmi4_bus_get failed\n"); err = -EIO; break; } reinit_completion(&rmi4_data->st_powerdown); reinit_completion(&rmi4_data->st_irq_processed); atomic_set(&rmi4_data->st_enabled, 1); atomic_set(&rmi4_data->st_pending_irqs, 0); break; default: dev_err( rmi4_data->pdev->dev.parent, "unsupported value: %lu\n", value); err = -EINVAL; break; } return err; } /* * This function returns whether there are pending interrupts, or * other error conditions that need to be signaled to the userspace library, * according tot he following logic: * - st_enabled is 0 if secure touch is not enabled, returning -EBADF * - st_pending_irqs is -1 to signal that secure touch is in being stopped, * returning -EINVAL * - st_pending_irqs is 1 to signal that there is a pending irq, returning * the value "1" to the sysfs read operation * - st_pending_irqs is 0 (only remaining case left) if the pending interrupt * has been processed, so the interrupt handler can be allowed to continue. */ static ssize_t synaptics_rmi4_secure_touch_show(struct device *dev, struct device_attribute *attr, char *buf) { struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev); int val = 0; if (atomic_read(&rmi4_data->st_enabled) == 0) return -EBADF; if (atomic_cmpxchg(&rmi4_data->st_pending_irqs, -1, 0) == -1) return -EINVAL; if (atomic_cmpxchg(&rmi4_data->st_pending_irqs, 1, 0) == 1) val = 1; else complete(&rmi4_data->st_irq_processed); return scnprintf(buf, PAGE_SIZE, "%u", val); } #endif static ssize_t synaptics_rmi4_f01_reset_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { Loading Loading @@ -1512,6 +1709,9 @@ static irqreturn_t synaptics_rmi4_irq(int irq, void *data) const struct synaptics_dsx_board_data *bdata = rmi4_data->hw_if->board_data; if (IRQ_HANDLED == synaptics_filter_interrupt(data)) return IRQ_HANDLED; if (gpio_get_value(bdata->irq_gpio) != bdata->irq_on_state) goto exit; Loading Loading @@ -3866,6 +4066,10 @@ static int synaptics_rmi4_probe(struct platform_device *pdev) queue_work(rmi4_data->reset_workqueue, &rmi4_data->reset_work); #endif /* Initialize secure touch */ synaptics_secure_touch_init(rmi4_data); synaptics_secure_touch_stop(rmi4_data, true); return retval; err_sysfs: Loading Loading @@ -4106,7 +4310,9 @@ static int synaptics_rmi4_fb_notifier_cb(struct notifier_block *self, fb_notifier); if (evdata && evdata->data && rmi4_data) { if (event == FB_EVENT_BLANK) { if (event == FB_EARLY_EVENT_BLANK) { synaptics_secure_touch_stop(rmi4_data, false); } else if (event == FB_EVENT_BLANK) { transition = evdata->data; if (*transition == FB_BLANK_POWERDOWN) { synaptics_rmi4_suspend(&rmi4_data->pdev->dev); Loading @@ -4133,6 +4339,14 @@ static void synaptics_rmi4_early_suspend(struct early_suspend *h) if (rmi4_data->stay_awake) return; /* * During early suspend/late resume, the driver doesn't access xPU/SMMU * protected HW resources. So, there is no compelling need to block, * but notifying the userspace that a power event has occurred is * enough. Hence 'blocking' variable can be set to false. */ synaptics_secure_touch_stop(rmi4_data, false); if (rmi4_data->enable_wakeup_gesture) { synaptics_rmi4_wakeup_gesture(rmi4_data, true); enable_irq_wake(rmi4_data->irq); Loading Loading @@ -4170,6 +4384,8 @@ static void synaptics_rmi4_late_resume(struct early_suspend *h) if (rmi4_data->stay_awake) return; synaptics_secure_touch_stop(rmi4_data, false); if (rmi4_data->enable_wakeup_gesture) { synaptics_rmi4_wakeup_gesture(rmi4_data, false); disable_irq_wake(rmi4_data->irq); Loading Loading @@ -4216,6 +4432,8 @@ static int synaptics_rmi4_suspend(struct device *dev) if (rmi4_data->stay_awake) return 0; synaptics_secure_touch_stop(rmi4_data, true); if (rmi4_data->enable_wakeup_gesture) { synaptics_rmi4_wakeup_gesture(rmi4_data, true); enable_irq_wake(rmi4_data->irq); Loading Loading @@ -4253,6 +4471,8 @@ static int synaptics_rmi4_resume(struct device *dev) if (rmi4_data->stay_awake) return 0; synaptics_secure_touch_stop(rmi4_data, true); if (rmi4_data->enable_wakeup_gesture) { synaptics_rmi4_wakeup_gesture(rmi4_data, false); disable_irq_wake(rmi4_data->irq); Loading
drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_core.h +27 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,12 @@ #include <linux/earlysuspend.h> #endif #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) #include <linux/completion.h> #include <linux/atomic.h> #include <linux/pm_runtime.h> #endif #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 38)) #define KERNEL_ABOVE_2_6_38 #endif Loading Loading @@ -374,6 +380,12 @@ struct synaptics_rmi4_data { bool enable); void (*report_touch)(struct synaptics_rmi4_data *rmi4_data, struct synaptics_rmi4_fn *fhandler); #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) atomic_t st_enabled; atomic_t st_pending_irqs; struct completion st_powerdown; struct completion st_irq_processed; #endif }; struct synaptics_dsx_bus_access { Loading @@ -382,6 +394,10 @@ struct synaptics_dsx_bus_access { unsigned char *data, unsigned short length); int (*write)(struct synaptics_rmi4_data *rmi4_data, unsigned short addr, unsigned char *data, unsigned short length); #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) int (*get)(struct synaptics_rmi4_data *rmi4_data); void (*put)(struct synaptics_rmi4_data *rmi4_data); #endif }; struct synaptics_dsx_hw_interface { Loading Loading @@ -432,6 +448,17 @@ static inline int synaptics_rmi4_reg_write( return rmi4_data->hw_if->bus_access->write(rmi4_data, addr, data, len); } #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) static inline int synaptics_rmi4_bus_get(struct synaptics_rmi4_data *rmi4_data) { return rmi4_data->hw_if->bus_access->get(rmi4_data); } static inline void synaptics_rmi4_bus_put(struct synaptics_rmi4_data *rmi4_data) { rmi4_data->hw_if->bus_access->put(rmi4_data); } #endif static inline ssize_t synaptics_rmi4_show_error(struct device *dev, struct device_attribute *attr, char *buf) { Loading
drivers/input/touchscreen/synaptics_dsx_2.6/synaptics_dsx_i2c.c +27 −0 Original line number Diff line number Diff line Loading @@ -497,10 +497,37 @@ exit: return retval; } #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) static int synaptics_rmi4_i2c_get(struct synaptics_rmi4_data *rmi4_data) { int retval; struct i2c_client *i2c = to_i2c_client(rmi4_data->pdev->dev.parent); mutex_lock(&rmi4_data->rmi4_io_ctrl_mutex); retval = pm_runtime_get_sync(i2c->adapter->dev.parent); mutex_unlock(&rmi4_data->rmi4_io_ctrl_mutex); return retval; } static void synaptics_rmi4_i2c_put(struct synaptics_rmi4_data *rmi4_data) { struct i2c_client *i2c = to_i2c_client(rmi4_data->pdev->dev.parent); mutex_lock(&rmi4_data->rmi4_io_ctrl_mutex); pm_runtime_put_sync(i2c->adapter->dev.parent); mutex_unlock(&rmi4_data->rmi4_io_ctrl_mutex); } #endif static struct synaptics_dsx_bus_access bus_access = { .type = BUS_I2C, .read = synaptics_rmi4_i2c_read, .write = synaptics_rmi4_i2c_write, #if defined(CONFIG_SECURE_TOUCH_SYNAPTICS_DSX_V26) .get = synaptics_rmi4_i2c_get, .put = synaptics_rmi4_i2c_put, #endif }; static void synaptics_rmi4_i2c_dev_release(struct device *dev) Loading