From: David Brownell Date: Fri, 26 May 2006 23:42:29 +0000 (-0700) Subject: [PATCH] Remove OSK/Mistral and Innovator old touchscreen support X-Git-Tag: v2.6.17-omap1~42 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=46c0c428bc0b14ee7ef3c96822d292656f0854c6;p=linux-2.6-omap-h63xx.git [PATCH] Remove OSK/Mistral and Innovator old touchscreen support Remove OSK/Mistral and Innovator support for the old OMAP-specfic touchscreen framework; both of those board should be able to use the new SPI framework with the ads7846 touchscreen driver that's now in the upstream kernels. Signed-off-by: David Brownell --- diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index a3e9ceb9592..3253906a365 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -114,13 +114,13 @@ config TOUCHSCREEN_HP600 endif config TOUCHSCREEN_OMAP tristate "OMAP touchscreen input driver" - depends on INPUT && INPUT_TOUCHSCREEN && ARCH_OMAP + depends on INPUT && INPUT_TOUCHSCREEN && (MACH_OMAP_H2 || MACH_OMAP_H3) help Say Y here if you have an OMAP based board with touchscreen - attached to it, e.g. OMAP Innovator, OSK, H2 or H3 + attached to it, e.g. OMAP H2 or H3 If unsure, or you're using drivers in the newer SPI - framework, say N. + framework (as with Innovator or OSK/Mistral), say N. To compile this driver as a module, choose M here: the module will be called omap_ts. diff --git a/drivers/input/touchscreen/omap/Makefile b/drivers/input/touchscreen/omap/Makefile index 687c068fd76..af6344e02df 100644 --- a/drivers/input/touchscreen/omap/Makefile +++ b/drivers/input/touchscreen/omap/Makefile @@ -6,7 +6,5 @@ obj-$(CONFIG_TOUCHSCREEN_OMAP) += omapts.o objs-$(CONFIG_ARCH_OMAP16XX)$(CONFIG_MACH_OMAP_H2) += ts_hx.o objs-$(CONFIG_ARCH_OMAP16XX)$(CONFIG_MACH_OMAP_H3) += ts_hx.o -objs-$(CONFIG_ARCH_OMAP15XX)$(CONFIG_MACH_OMAP_INNOVATOR) += ts_inn1510.o -objs-$(CONFIG_ARCH_OMAP16XX)$(CONFIG_MACH_OMAP_OSK) += ts_osk.o omapts-objs := omap_ts.o $(objs-yy) diff --git a/drivers/input/touchscreen/omap/ads7846.h b/drivers/input/touchscreen/omap/ads7846.h deleted file mode 100644 index ae4347a8f68..00000000000 --- a/drivers/input/touchscreen/omap/ads7846.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * ads7846.h - header file for ADS7846 touchscreen controller - * - * Copyright 2002 MontaVista Software Inc. - * Author: MontaVista Software, Inc. - * stevel@mvista.com or source@mvista.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __ADS7846_H -#define __ADS7846_H - -// ADS7846 Control Byte bit defines -#define ADS7846_S (1<<7) -#define ADS7846_ADDR_BIT 4 -#define ADS7846_ADDR_MASK (0x7< -#include -#include -#include -#include - -#include "omap_ts.h" -#include "ads7846.h" - -// The Touch Screen Register on Innovator FPGA -#define FPGA_TS_BCLK (1<<0) -#define FPGA_TS_BDIN (1<<1) -#define FPGA_TS_BCS (1<<2) -#define FPGA_TS_BBUSY (1<<3) -#define FPGA_TS_BOUT (1<<4) -#define FPGA_TS_BPENUP (1<<5) - -#define X_PLATE_OHMS 419 -#define Y_PLATE_OHMS 486 - -static int inn1510_ts_penup(void); -static int inn1510_ts_probe(struct omap_ts_t *ts); -static void inn1510_ts_read(u16 * data); -static void inn1510_ts_enable(void); -static void inn1510_ts_disable(void); -#ifdef MODULE -static void inn1510_ts_remove(void); -#endif - -struct ts_device innovator1510_ts = { - .probe = inn1510_ts_probe, - .read = inn1510_ts_read, - .enable = inn1510_ts_enable, - .disable = inn1510_ts_disable, - .remove = __exit_p(inn1510_ts_remove), - .penup = inn1510_ts_penup, -}; - -static inline u8 fpga_ts_read(void) -{ - return fpga_read(OMAP1510_FPGA_TOUCHSCREEN); -} - -static inline void fpga_ts_write(u8 val) -{ - fpga_write(val, OMAP1510_FPGA_TOUCHSCREEN); -} - -static inline void fpga_ts_set_bits(u8 mask) -{ - fpga_ts_write(fpga_ts_read() | mask); -} - -static inline void fpga_ts_clear_bits(u8 mask) -{ - fpga_ts_write(fpga_ts_read() & ~mask); -} - -static inline void CS_H(void) -{ - // EPLD inverts active low signals. - fpga_ts_clear_bits(FPGA_TS_BCS); -} - -static inline void CS_L(void) -{ - fpga_ts_set_bits(FPGA_TS_BCS); -} - -static inline void SCLK_L(void) -{ - fpga_ts_clear_bits(FPGA_TS_BCLK); -} - -static inline void SCLK_H(void) -{ - fpga_ts_set_bits(FPGA_TS_BCLK); -} - -static inline void SDI_L(void) -{ - fpga_ts_clear_bits(FPGA_TS_BDIN); -} - -static inline void SDI_H(void) -{ - fpga_ts_set_bits(FPGA_TS_BDIN); -} - -static inline int BUSY(void) -{ - return (((fpga_ts_read() & FPGA_TS_BBUSY) == 0) ? 1 : 0) ; -} - -static inline u8 DOUT(void) -{ - return ((fpga_ts_read() & FPGA_TS_BOUT) ? 1 : 0) ; -} - -static u16 ads7846_do(u8 cmd) -{ - int i; - u16 val=0; - - SCLK_L() ; - SDI_L(); - CS_L() ; // enable the chip select - - // send the command to the ADS7846 - for (i=0; i<8; i++ ) { - if (cmd & 0x80) - SDI_H(); - else - SDI_L(); // prepare the data on line sdi OR din - - SCLK_H() ; // clk in the data - cmd <<= 1 ; - SCLK_L() ; - } - - SDI_L(); - while (BUSY()) - ; - - // now read returned data - for (i=0 ; i<16 ; i++ ) { - SCLK_L() ; - - if (i < 12) { - val <<= 1 ; - val |= DOUT(); - } - SCLK_H() ; - } - - SCLK_L() ; - CS_H() ; // disable the chip select - - return val; -} - -static int inn1510_ts_penup(void) -{ - return ((fpga_ts_read() & FPGA_TS_BPENUP) ? 0 : 1) ; -} - -static int __init inn1510_ts_probe(struct omap_ts_t *ts) -{ - if (!cpu_is_omap15xx() || !machine_is_omap_innovator()) - return -ENODEV; - - ts->irq = OMAP1510_INT_FPGA_TS; - ts->irq_type = 0; - - return 0; -} - -static void inn1510_ts_read(u16 *data) -{ - unsigned int Rt = 0; - - data[0] = ads7846_do(MEASURE_12BIT_X); - data[1] = ads7846_do(MEASURE_12BIT_Y); - data[2] = ads7846_do(MEASURE_12BIT_Z1); - data[3] = ads7846_do(MEASURE_12BIT_Z2); - - // Calculate touch pressure resistance - if (data[2]) { - Rt = (X_PLATE_OHMS * (u32)data[0] * - ((u32)data[3] - (u32)data[2])) / (u32)data[2]; - - Rt = (Rt + 2048) >> 12; // round up to nearest ohm - } - - data[2] = Rt; -} - -static void inn1510_ts_enable(void) -{ - -} - -static void inn1510_ts_disable(void) -{ - -} - -#ifdef MODULE -static void __exit inn1510_ts_remove(void) -{ - /* Nothing to do here */ -} -#endif diff --git a/drivers/input/touchscreen/omap/ts_osk.c b/drivers/input/touchscreen/omap/ts_osk.c deleted file mode 100644 index 9531fcdb95a..00000000000 --- a/drivers/input/touchscreen/omap/ts_osk.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * ts_osk.c - touchscreen support for OMAP OSK board - * - * Copyright 2002 MontaVista Software Inc. - * Author: MontaVista Software, Inc. - * stevel@mvista.com or source@mvista.com - * - * The touchscreen hardware on the OSK uses OMAP5912 uWire interface, - * GPIO4 (/PENIRQ) and GPIO6 (BUSY) to connect to an ADS7846 - * touch screen controller. GPIO6 doesn't seem to be necessary here. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include - -#include "../drivers/ssi/omap-uwire.h" - -#include "omap_ts.h" -#include "ads7846.h" - -// /PENIRQ on GPIO4 on OSK -#define PEN_IRQ OMAP_GPIO_IRQ(4) - -// ADS7846 is on OSK uWire CS 0 -#define ADS7846_UWIRE_CS 0 -#define UWIRE_LEAVE_CS 1 - -#define X_PLATE_OHMS 419 -#define Y_PLATE_OHMS 486 - -static int osk_ts_penup(void); -static int osk_ts_probe(struct omap_ts_t *ts); -static void osk_ts_read(u16 * data); -static void osk_ts_enable(void); -static void osk_ts_disable(void); -#ifdef MODULE -static void osk_ts_remove(void); -#endif - -struct ts_device osk_ts = { - .probe = osk_ts_probe, - .read = osk_ts_read, - .enable = osk_ts_enable, - .disable = osk_ts_disable, - .remove = __exit_p(osk_ts_remove), - .penup = osk_ts_penup, -}; - -static u16 ads7846_do(u8 cmd) -{ - u16 val = 0; - - // send the command to the ADS7846, leave CS active after this - omap_uwire_data_transfer(ADS7846_UWIRE_CS, cmd, 8, 0, NULL, UWIRE_LEAVE_CS); - - // now read returned data - omap_uwire_data_transfer(ADS7846_UWIRE_CS, 0, 0, 16, &val, !UWIRE_LEAVE_CS); - - return val; -} - -static int osk_ts_penup(void) -{ - return (omap_get_gpio_datain(4)); -} - -static int __init osk_ts_probe(struct omap_ts_t *ts) -{ -#ifdef CONFIG_OMAP_OSK_MISTRAL - if (!machine_is_omap_osk()) - return -ENODEV; - - /* Configure GPIO4 (pin M17 ZDY) as /PENIRQ interrupt input */ - omap_cfg_reg(P20_1610_GPIO4); - omap_request_gpio(4); - omap_set_gpio_direction(4, 1); - ts->irq_type = SA_TRIGGER_FALLING; - - ts->irq = PEN_IRQ; - - /* Configure uWire interface. ADS7846 is on CS0 */ - omap_uwire_configure_mode(ADS7846_UWIRE_CS, UWIRE_READ_RISING_EDGE | - UWIRE_WRITE_RISING_EDGE | - UWIRE_CS_ACTIVE_LOW | - UWIRE_FREQ_DIV_2); - - /* FIXME verify there's really a Mistral board: - * see if the AD7846 chip responds. - */ - - /* NOTE: no VREF; must ignore the temp, VBAT, and AUX sensors */ - return 0; -#else - return -ENODEV; -#endif -} - -static void osk_ts_read(u16 *data) -{ - unsigned int Rt = 0; - - data[0] = ads7846_do(MEASURE_12BIT_X); - data[1] = ads7846_do(MEASURE_12BIT_Y); - data[2] = ads7846_do(MEASURE_12BIT_Z1); - data[3] = ads7846_do(MEASURE_12BIT_Z2); - - // Calculate touch pressure resistance - if (data[2]) { - Rt = (X_PLATE_OHMS * (u32)data[0] * - ((u32)data[3] - (u32)data[2])) / (u32)data[2]; - - Rt = (Rt + 2048) >> 12; // round up to nearest ohm - } - - /* - * Raw OSK touchscreen data values are between ~4000 and - * ~60000. This seems to be to large for calibration - * systems (e.g. tslib). Make the values smaller. - */ - data[0] = data[0] >> 4; - data[1] = data[1] >> 4; - - data[2] = Rt; -} - -static void osk_ts_enable(void) -{ - -} - -static void osk_ts_disable(void) -{ - -} - -#ifdef MODULE -static void __exit osk_ts_remove(void) -{ - omap_free_gpio(4); -} -#endif