#include <linux/spi/spi.h>
#ifdef CONFIG_ARCH_OMAP
-#include <asm/arch/gpio.h>
+#include <mach/gpio.h>
#endif
#include <linux/spi/tsc2005.h>
* during the last 20ms which means the pen has been lifted.
*/
-#define TSC2005_HZ (14000000)
+#define TSC2005_VDD_LOWER_27
+
+#ifdef TSC2005_VDD_LOWER_27
+#define TSC2005_HZ (10000000)
+#else
+#define TSC2005_HZ (25000000)
+#endif
#define TSC2005_CMD (0x80)
#define TSC2005_REG (0x00)
struct spi_message msg;
struct spi_transfer xfer = { 0 };
- spi_message_init(&msg);
- msg.spi = ts->spi;
xfer.tx_buf = &data;
xfer.rx_buf = NULL;
- xfer.len = 2;
+ xfer.len = 1;
xfer.bits_per_word = 8;
+ spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
spi_sync(ts->spi, &msg);
}
struct spi_transfer xfer = { 0 };
tx = (TSC2005_REG | reg | TSC2005_REG_PND0 |
- TSC2005_REG_WRITE) << (2 * 8);
+ TSC2005_REG_WRITE) << 16;
tx |= value;
- spi_message_init(&msg);
- msg.spi = ts->spi;
xfer.tx_buf = &tx;
xfer.rx_buf = NULL;
xfer.len = 4;
- xfer.bits_per_word = 3 * 8;
+ xfer.bits_per_word = 24;
+ spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
spi_sync(ts->spi, &msg);
}
}
} else {
input_report_abs(ts->idev, ABS_PRESSURE, 0);
- if (ts->pen_down)
+ if (ts->pen_down) {
input_report_key(ts->idev, BTN_TOUCH, 0);
-
- ts->pen_down = 0;
+ ts->pen_down = 0;
+ }
}
input_sync(ts->idev);
/*
* This interrupt is called when pen is down and coordinates are
- * available. That is indicated by a falling edge on DEV line.
+ * available. That is indicated by a falling edge on DAV line.
*/
static irqreturn_t tsc2005_ts_irq_handler(int irq, void *dev_id)
{
int i;
spi_message_init(m);
- m->spi = ts->spi;
for (i = 0; i < NUM_READ_REGS; i++, x++) {
x->tx_buf = &tsc2005_read_reg[i];
dev_err(&ts->spi->dev, "unable to get DAV GPIO");
goto err1;
}
- omap_set_gpio_direction(dav_gpio, 1);
- ts->irq = OMAP_GPIO_IRQ(dav_gpio);
+ gpio_direction_input(dav_gpio);
+ ts->irq = gpio_to_irq(dav_gpio);
dev_dbg(&ts->spi->dev, "TSC2005: DAV IRQ = %d\n", ts->irq);
#endif
init_timer(&ts->penup_timer);
goto err2;
}
- /*
- * TODO: should be "TSC2005 touchscreen", but X has hardcoded these
- * strings and doesn't accept TSC2005 yet...
- */
- idev->name = "TSC2301 touchscreen";
+ idev->name = "TSC2005 touchscreen";
snprintf(ts->phys, sizeof(ts->phys), "%s/input-ts",
ts->spi->dev.bus_id);
idev->phys = ts->phys;
static int __devexit tsc2005_remove(struct spi_device *spi)
{
struct tsc2005 *ts = dev_get_drvdata(&spi->dev);
- unsigned long flags;
- spin_lock_irqsave(&ts->lock, flags);
+ mutex_lock(&ts->mutex);
tsc2005_disable(ts);
- spin_unlock_irqrestore(&ts->lock, flags);
+ mutex_unlock(&ts->mutex);
device_remove_file(&ts->spi->dev, &dev_attr_disable_ts);
device_remove_file(&ts->spi->dev, &dev_attr_pen_down);
static struct spi_driver tsc2005_driver = {
.driver = {
.name = "tsc2005",
- .bus = &spi_bus_type,
.owner = THIS_MODULE,
},
#ifdef CONFIG_PM
MODULE_AUTHOR("Lauri Leukkunen <lauri.leukkunen@nokia.com>");
MODULE_LICENSE("GPL");
-
+MODULE_ALIAS("platform:tsc2005");