aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/linux/linux-2.6.30/ronetix-pm9g45/0001-ads7846-.c-and-.h-add-swap_xy.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/linux/linux-2.6.30/ronetix-pm9g45/0001-ads7846-.c-and-.h-add-swap_xy.patch')
-rw-r--r--recipes/linux/linux-2.6.30/ronetix-pm9g45/0001-ads7846-.c-and-.h-add-swap_xy.patch100
1 files changed, 100 insertions, 0 deletions
diff --git a/recipes/linux/linux-2.6.30/ronetix-pm9g45/0001-ads7846-.c-and-.h-add-swap_xy.patch b/recipes/linux/linux-2.6.30/ronetix-pm9g45/0001-ads7846-.c-and-.h-add-swap_xy.patch
new file mode 100644
index 0000000000..676b0c2d86
--- /dev/null
+++ b/recipes/linux/linux-2.6.30/ronetix-pm9g45/0001-ads7846-.c-and-.h-add-swap_xy.patch
@@ -0,0 +1,100 @@
+From 84325d6118849188bd765933e0f2db6795df9756 Mon Sep 17 00:00:00 2001
+From: Asen Dimov <dimov@ronetix.at>
+Date: Tue, 2 Mar 2010 00:58:51 +0200
+Subject: [PATCH] ads7846 .c and .h add swap_xy
+
+---
+ drivers/input/touchscreen/ads7846.c | 24 ++++++++++++++++++++----
+ include/linux/spi/ads7846.h | 1 +
+ 2 files changed, 21 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
+index 2b01e56..09c8109 100644
+--- a/drivers/input/touchscreen/ads7846.c
++++ b/drivers/input/touchscreen/ads7846.c
+@@ -83,6 +83,7 @@ struct ads7846_packet {
+ struct ads7846 {
+ struct input_dev *input;
+ char phys[32];
++ char name[32];
+
+ struct spi_device *spi;
+
+@@ -97,6 +98,8 @@ struct ads7846 {
+ u16 x_plate_ohms;
+ u16 pressure_max;
+
++ bool swap_xy;
++
+ struct ads7846_packet *packet;
+
+ struct spi_transfer xfer[18];
+@@ -599,6 +602,10 @@ static void ads7846_rx(void *ads)
+ dev_dbg(&ts->spi->dev, "DOWN\n");
+ #endif
+ }
++
++ if (ts->swap_xy)
++ swap(x, y);
++
+ input_report_abs(input, ABS_X, x);
+ input_report_abs(input, ABS_Y, y);
+ input_report_abs(input, ABS_PRESSURE, Rt);
+@@ -917,6 +924,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
+ ts->spi = spi;
+ ts->input = input_dev;
+ ts->vref_mv = pdata->vref_mv;
++ ts->swap_xy = pdata->swap_xy;
+
+ hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+ ts->timer.function = ads7846_timer;
+@@ -958,8 +966,9 @@ static int __devinit ads7846_probe(struct spi_device *spi)
+ ts->wait_for_sync = pdata->wait_for_sync ? : null_wait_for_sync;
+
+ snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&spi->dev));
++ snprintf(ts->name, sizeof(ts->name), "ADS%d Touchscreen", ts->model);
+
+- input_dev->name = "ADS784x Touchscreen";
++ input_dev->name = ts->name;
+ input_dev->phys = ts->phys;
+ input_dev->dev.parent = &spi->dev;
+
+@@ -1141,9 +1150,15 @@ static int __devinit ads7846_probe(struct spi_device *spi)
+
+ if (request_irq(spi->irq, ads7846_irq, IRQF_TRIGGER_FALLING,
+ spi->dev.driver->name, ts)) {
+- dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
+- err = -EBUSY;
+- goto err_free_gpio;
++ dev_info(&spi->dev,
++ "trying pin change workaround on irq %d\n", spi->irq);
++ err = request_irq(spi->irq, ads7846_irq,
++ IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
++ spi->dev.driver->name, ts);
++ if (err) {
++ dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
++ goto err_free_gpio;
++ }
+ }
+
+ err = ads784x_hwmon_register(spi, ts);
+@@ -1241,3 +1256,4 @@ module_exit(ads7846_exit);
+
+ MODULE_DESCRIPTION("ADS7846 TouchScreen Driver");
+ MODULE_LICENSE("GPL");
++MODULE_ALIAS("spi:ads7846");
+diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
+index 2ea2032..51948eb 100644
+--- a/include/linux/spi/ads7846.h
++++ b/include/linux/spi/ads7846.h
+@@ -17,6 +17,7 @@ struct ads7846_platform_data {
+ u16 vref_mv; /* external vref value, milliVolts */
+ bool keep_vref_on; /* set to keep vref on for differential
+ * measurements as well */
++ bool swap_xy; /* swap x and y axes */
+
+ /* Settling time of the analog signals; a function of Vcc and the
+ * capacitance on the X/Y drivers. If set to non-zero, two samples
+--
+1.5.5.6
+