Browse files

added sweep to unlock (showp1984)

  • Loading branch information...
1 parent 5c761fc commit 5c2c9536cc172df2d8ea8e1bed86ffa1fb2e4ba4 @klquicksall committed Apr 11, 2012
View
3 arch/arm/configs/ken_defconfig
@@ -31,7 +31,7 @@ CONFIG_IRQ_WORK=y
CONFIG_EXPERIMENTAL=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
-CONFIG_LOCALVERSION="-RCMIX-SENSATION-V5.2"
+CONFIG_LOCALVERSION="-RCMIX-SENSATION-V5.3"
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_LZMA=y
@@ -1266,6 +1266,7 @@ CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_TOUCHSCREEN_AD7879 is not set
# CONFIG_TOUCHSCREEN_ATMEL_MAXTOUCH is not set
CONFIG_TOUCHSCREEN_CYPRESS_TMA=y
+CONFIG_TOUCHSCREEN_CYPRESS_SWEEP2WAKE=y
# CONFIG_TOUCHSCREEN_ATMEL is not set
# CONFIG_TOUCHSCREEN_COMPATIBLE_REPORT is not set
# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set
View
10 drivers/input/misc/gpio_event.c
@@ -20,6 +20,9 @@
#include <linux/hrtimer.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
+#ifdef CONFIG_TOUCHSCREEN_CYPRESS_SWEEP2WAKE
+#include <linux/cy8c_tma_ts.h>
+#endif
struct gpio_event {
struct gpio_event_input_devs *input_devs;
@@ -166,6 +169,12 @@ static int gpio_event_probe(struct platform_device *pdev)
event_info->name : event_info->names[i];
input_dev->event = gpio_input_event;
ip->input_devs->dev[i] = input_dev;
+#ifdef CONFIG_TOUCHSCREEN_CYPRESS_SWEEP2WAKE
+ if (!strcmp(input_dev->name, "pyramid-keypad")) {
+ sweep2wake_setdev(input_dev);
+ printk(KERN_INFO "[sweep2wake]: set device %s\n", input_dev->name);
+ }
+#endif
}
ip->input_devs->count = dev_count;
ip->info = event_info;
@@ -258,3 +267,4 @@ module_exit(gpio_event_exit);
MODULE_DESCRIPTION("GPIO Event Driver");
MODULE_LICENSE("GPL");
+
View
6 drivers/input/touchscreen/Kconfig
@@ -118,6 +118,11 @@ config TOUCHSCREEN_CYPRESS_TMA
depends on I2C
default n
+config TOUCHSCREEN_CYPRESS_SWEEP2WAKE
+ tristate "Sweep2Wake for Cypress TMA300 based touchscreens"
+ depends on TOUCHSCREEN_CYPRESS_TMA
+ default n
+
config TOUCHSCREEN_COMPATIBLE_REPORT
bool "Touchscreen compatible repodepends on I2C"
default n
@@ -888,3 +893,4 @@ config TOUCHSCREEN_HIMAX_SH
Allen Xu <allen_xu@htc.com>
endif
+
View
126 drivers/input/touchscreen/cy8c_tma_ts.c
@@ -73,6 +73,37 @@ static int cy8c_reset_baseline(void);
static DEFINE_MUTEX(cy8c_mutex);
+#ifdef CONFIG_TOUCHSCREEN_CYPRESS_SWEEP2WAKE
+bool scr_suspended = false, exec_count = true, barrier[2] = {false, false};
+static struct input_dev * sweep2wake_pwrdev;
+static DEFINE_MUTEX(pwrlock);
+
+extern void sweep2wake_setdev(struct input_dev * input_device) {
+ sweep2wake_pwrdev = input_device;
+ return;
+}
+EXPORT_SYMBOL(sweep2wake_setdev);
+
+static void sweep2wake_presspwr(struct work_struct * sweep2wake_presspwr_work) {
+ input_event(sweep2wake_pwrdev, EV_KEY, KEY_POWER, 1);
+ input_event(sweep2wake_pwrdev, EV_SYN, 0, 0);
+ msleep(50);
+ input_event(sweep2wake_pwrdev, EV_KEY, KEY_POWER, 0);
+ input_event(sweep2wake_pwrdev, EV_SYN, 0, 0);
+ msleep(50);
+ mutex_unlock(&pwrlock);
+ return;
+}
+static DECLARE_WORK(sweep2wake_presspwr_work, sweep2wake_presspwr);
+
+void sweep2wake_pwrtrigger(void) {
+ if (mutex_trylock(&pwrlock)) {
+ schedule_work(&sweep2wake_presspwr_work);
+ }
+ return;
+}
+#endif
+
int i2c_cy8c_read(struct i2c_client *client, uint8_t addr, uint8_t *data, uint8_t length)
{
int retry;
@@ -714,7 +745,9 @@ static irqreturn_t cy8c_ts_irq_thread(int irq, void *ptr)
{
struct cy8c_ts_data *ts = ptr;
uint8_t buf[32] = {0}, loop_i, loop_j;
-
+#ifdef CONFIG_TOUCHSCREEN_CYPRESS_SWEEP2WAKE
+ int prevx = 0, nextx = 0;
+#endif
i2c_cy8c_read(ts->client, 0x00, buf, 32);
if (ts->debug_log_level & 0x1) {
for (loop_i = 0; loop_i < 32; loop_i++) {
@@ -805,9 +838,9 @@ static irqreturn_t cy8c_ts_irq_thread(int irq, void *ptr)
if (ts->ambiguous_state == ts->finger_count
|| ts->ambiguous_state == report) {
- if (ts->flag_htc_event == 0)
+ if (ts->flag_htc_event == 0) {
input_mt_sync(ts->input_dev);
- else {
+ } else {
input_report_abs(ts->input_dev, ABS_MT_AMPLITUDE, 0);
input_report_abs(ts->input_dev, ABS_MT_POSITION, 1 << 31);
}
@@ -867,6 +900,9 @@ static irqreturn_t cy8c_ts_irq_thread(int irq, void *ptr)
base = 3;
}
+ /* reset sameFilter */
+ ts->sameFilter[2] = ts->sameFilter[0] = ts->sameFilter[1] = -1;
+
for (loop_i = 0; loop_i < ts->finger_count; loop_i++) {
if (!(ts->grip_suppression & BIT(loop_i))) {
if (ts->flag_htc_event == 0) {
@@ -910,6 +946,69 @@ static irqreturn_t cy8c_ts_irq_thread(int irq, void *ptr)
ts->pre_finger_data[0] = finger_data[0][0];
ts->pre_finger_data[1] = finger_data[0][1];
}
+#ifdef CONFIG_TOUCHSCREEN_CYPRESS_SWEEP2WAKE
+ if ((ts->finger_count == 1) && (scr_suspended == true)) {
+ prevx = 240;
+ nextx = 580;
+ if ((barrier[0] == true) ||
+ ((finger_data[loop_i][0] > prevx) &&
+ (finger_data[loop_i][0] < nextx) &&
+ (finger_data[loop_i][1] > 950))) {
+ prevx = 580;
+ nextx = 920;
+ barrier[0] = true;
+ if ((barrier[1] == true) ||
+ ((finger_data[loop_i][0] > prevx) &&
+ (finger_data[loop_i][0] < nextx) &&
+ (finger_data[loop_i][1] > 950))) {
+ prevx = 920;
+ barrier[1] = true;
+ if ((finger_data[loop_i][0] > prevx) &&
+ (finger_data[loop_i][1] > 950)) {
+ if (finger_data[loop_i][0] > 940) {
+ if (exec_count) {
+ printk(KERN_INFO "[sweep2wake]: ON");
+ sweep2wake_pwrtrigger();
+ exec_count = false;
+ scr_suspended = false;
+ break;
+ }
+ }
+ }
+ }
+ }
+ } else if ((ts->finger_count == 1) && (scr_suspended == false)) {
+ prevx = 1020;
+ nextx = 680;
+ if ((barrier[0] == true) ||
+ ((finger_data[loop_i][0] < prevx) &&
+ (finger_data[loop_i][0] > nextx) &&
+ ( finger_data[loop_i][1] > 950))) {
+ prevx = 680;
+ nextx = 340;
+ barrier[0] = true;
+ if ((barrier[1] == true) ||
+ ((finger_data[loop_i][0] < prevx) &&
+ (finger_data[loop_i][0] > nextx) &&
+ (finger_data[loop_i][1] > 950))) {
+ prevx = 340;
+ barrier[1] = true;
+ if ((finger_data[loop_i][0] < prevx) &&
+ (finger_data[loop_i][1] > 950)) {
+ if (finger_data[loop_i][0] < 200) {
+ if (exec_count) {
+ printk(KERN_INFO "[sweep2wake]: OFF");
+ sweep2wake_pwrtrigger();
+ exec_count = false;
+ scr_suspended = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+#endif
}
}
if ((ts->unlock_page) &&
@@ -943,6 +1042,14 @@ static irqreturn_t cy8c_ts_irq_thread(int irq, void *ptr)
if (ts->flag_htc_event == 0) {
input_report_key(ts->input_dev, BTN_TOUCH, (ts->finger_count > 0)?1:0);
input_sync(ts->input_dev);
+#ifdef CONFIG_TOUCHSCREEN_CYPRESS_SWEEP2WAKE
+ /* if finger released, reset count & barriers & wakelock */
+ if (((ts->finger_count > 0)?1:0) == 0) {
+ exec_count = true;
+ barrier[0] = false;
+ barrier[1] = false;
+ }
+#endif
}
return IRQ_HANDLED;
@@ -1139,6 +1246,10 @@ static int cy8c_ts_remove(struct i2c_client *client)
static int cy8c_ts_suspend(struct i2c_client *client, pm_message_t mesg)
{
+#ifdef CONFIG_TOUCHSCREEN_CYPRESS_SWEEP2WAKE
+ scr_suspended = true;
+ enable_irq_wake(client->irq);
+#else
struct cy8c_ts_data *ts = i2c_get_clientdata(client);
uint8_t buf[2] = {0};
@@ -1169,12 +1280,16 @@ static int cy8c_ts_suspend(struct i2c_client *client, pm_message_t mesg)
i2c_cy8c_write_byte_data(ts->client, 0x00, (buf[0] & 0x8F) | 0x02);
ts->suspend = 1;
mutex_unlock(&cy8c_mutex);
-
+#endif
return 0;
}
static int cy8c_ts_resume(struct i2c_client *client)
{
+#ifdef CONFIG_TOUCHSCREEN_CYPRESS_SWEEP2WAKE
+ scr_suspended = false;
+ disable_irq_wake(client->irq);
+#else
struct cy8c_ts_data *ts = i2c_get_clientdata(client);
uint8_t buf[2] = {0};
@@ -1201,7 +1316,7 @@ static int cy8c_ts_resume(struct i2c_client *client)
ts->unlock_page = 1;
enable_irq(client->irq);
-
+#endif
return 0;
}
@@ -1243,7 +1358,6 @@ static struct i2c_driver cy8c_ts_driver = {
static int __devinit cy8c_ts_init(void)
{
printk(KERN_INFO "%s: enter\n", __func__);
-
return i2c_add_driver(&cy8c_ts_driver);
}
View
9 include/linux/cy8c_tma_ts.h
@@ -17,6 +17,9 @@
#define CY8C_I2C_H
#include <linux/types.h>
+#ifdef CONFIG_TOUCHSCREEN_CYPRESS_SWEEP2WAKE
+#include <linux/input.h>
+#endif
#define CYPRESS_TMA_NAME "CY8CTMA340"
@@ -42,5 +45,11 @@ struct cy8c_i2c_platform_data {
uint16_t filter_level[4];
};
+#ifdef CONFIG_TOUCHSCREEN_CYPRESS_SWEEP2WAKE
+/* Sweep2Wake */
+extern void sweep2wake_setdev(struct input_dev * input_device);
+#endif
+
#endif
+

0 comments on commit 5c2c953

Please sign in to comment.