Commit 46c0c428 authored by David Brownell's avatar David Brownell Committed by Tony Lindgren

[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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
parent a5304da4
...@@ -114,13 +114,13 @@ config TOUCHSCREEN_HP600 ...@@ -114,13 +114,13 @@ config TOUCHSCREEN_HP600
endif endif
config TOUCHSCREEN_OMAP config TOUCHSCREEN_OMAP
tristate "OMAP touchscreen input driver" tristate "OMAP touchscreen input driver"
depends on INPUT && INPUT_TOUCHSCREEN && ARCH_OMAP depends on INPUT && INPUT_TOUCHSCREEN && (MACH_OMAP_H2 || MACH_OMAP_H3)
help help
Say Y here if you have an OMAP based board with touchscreen 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 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 To compile this driver as a module, choose M here: the
module will be called omap_ts. module will be called omap_ts.
......
...@@ -6,7 +6,5 @@ obj-$(CONFIG_TOUCHSCREEN_OMAP) += omapts.o ...@@ -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_H2) += ts_hx.o
objs-$(CONFIG_ARCH_OMAP16XX)$(CONFIG_MACH_OMAP_H3) += 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) omapts-objs := omap_ts.o $(objs-yy)
/*
* 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<<ADS7846_ADDR_BIT)
#define ADS7846_MEASURE_X (0x5<<ADS7846_ADDR_BIT)
#define ADS7846_MEASURE_Y (0x1<<ADS7846_ADDR_BIT)
#define ADS7846_MEASURE_Z1 (0x3<<ADS7846_ADDR_BIT)
#define ADS7846_MEASURE_Z2 (0x4<<ADS7846_ADDR_BIT)
#define ADS7846_8BITS (1<<3)
#define ADS7846_12BITS 0
#define ADS7846_SER (1<<2)
#define ADS7846_DFR 0
#define ADS7846_PWR_BIT 0
#define ADS7846_PD 0
#define ADS7846_ADC_ON (0x1<<ADS7846_PWR_BIT)
#define ADS7846_REF_ON (0x2<<ADS7846_PWR_BIT)
#define ADS7846_REF_ADC_ON (0x3<<ADS7846_PWR_BIT)
#define MEASURE_12BIT_X \
(ADS7846_S | ADS7846_MEASURE_X | ADS7846_12BITS | ADS7846_DFR | ADS7846_PD)
#define MEASURE_12BIT_Y \
(ADS7846_S | ADS7846_MEASURE_Y | ADS7846_12BITS | ADS7846_DFR | ADS7846_PD)
#define MEASURE_12BIT_Z1 \
(ADS7846_S | ADS7846_MEASURE_Z1 | ADS7846_12BITS | ADS7846_DFR | ADS7846_PD)
#define MEASURE_12BIT_Z2 \
(ADS7846_S | ADS7846_MEASURE_Z2 | ADS7846_12BITS | ADS7846_DFR | ADS7846_PD)
#endif /* __ADS7846_H */
...@@ -49,12 +49,6 @@ static struct ts_device *__initdata ts_devs[] = { ...@@ -49,12 +49,6 @@ static struct ts_device *__initdata ts_devs[] = {
#if defined(CONFIG_MACH_OMAP_H2) || defined(CONFIG_MACH_OMAP_H3) #if defined(CONFIG_MACH_OMAP_H2) || defined(CONFIG_MACH_OMAP_H3)
&hx_ts, &hx_ts,
#endif #endif
#ifdef CONFIG_MACH_OMAP_OSK
&osk_ts,
#endif
#if defined(CONFIG_MACH_OMAP_INNOVATOR) && defined(CONFIG_ARCH_OMAP15XX)
&innovator1510_ts,
#endif
}; };
static struct omap_ts_t ts_omap; static struct omap_ts_t ts_omap;
...@@ -245,6 +239,9 @@ static int __init omap_ts_init(void) ...@@ -245,6 +239,9 @@ static int __init omap_ts_init(void)
{ {
int ret; int ret;
if (machine_is_omap_osk() || machine_is_omap_innovator())
return -ENODEV;
ret = platform_device_register(&omap_ts_device); ret = platform_device_register(&omap_ts_device);
if (ret != 0) if (ret != 0)
return -ENODEV; return -ENODEV;
......
...@@ -53,7 +53,5 @@ struct omap_ts_t{ ...@@ -53,7 +53,5 @@ struct omap_ts_t{
}; };
extern struct ts_device hx_ts; extern struct ts_device hx_ts;
extern struct ts_device osk_ts;
extern struct ts_device innovator1510_ts;
#endif /* __OMAP_TS_H */ #endif /* __OMAP_TS_H */
/*
* ts_inn1510.c - touchscreen support for OMAP1510 Innovator board
*
* Copyright 2002 MontaVista Software Inc.
* Author: MontaVista Software, Inc.
* stevel@mvista.com or source@mvista.com
*
* The touchscreen hardware on the Innovator consists of an FPGA
* register which is bit-banged to generate SPI-like transactions
* to an ADS7846 touch screen controller.
*
* 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 <linux/input.h>
#include <linux/device.h>
#include <asm/io.h>
#include <asm/mach-types.h>
#include <asm/arch/fpga.h>
#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
/*
* 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 <linux/input.h>
#include <linux/device.h>
#include <asm/arch/mux.h>
#include <asm/arch/gpio.h>
#include <asm/mach-types.h>
#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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment