Commit 9ee40d9a authored by Eric Miao's avatar Eric Miao Committed by Russell King

[ARM] pxa/poodle: use SPI based ads7846 touch screen driver

Signed-off-by: default avatarEric Miao <eric.miao@marvell.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 26b4c8dd
...@@ -31,7 +31,7 @@ obj-$(CONFIG_MACH_COLIBRI) += colibri.o ...@@ -31,7 +31,7 @@ obj-$(CONFIG_MACH_COLIBRI) += colibri.o
obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o
obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o spitz_pm.o obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o spitz_pm.o
obj-$(CONFIG_MACH_AKITA) += akita-ioexp.o obj-$(CONFIG_MACH_AKITA) += akita-ioexp.o
obj-$(CONFIG_MACH_POODLE) += poodle.o corgi_ssp.o obj-$(CONFIG_MACH_POODLE) += poodle.o
obj-$(CONFIG_MACH_PCM027) += pcm027.o obj-$(CONFIG_MACH_PCM027) += pcm027.o
obj-$(CONFIG_MACH_PCM990_BASEBOARD) += pcm990-baseboard.o obj-$(CONFIG_MACH_PCM990_BASEBOARD) += pcm990-baseboard.o
obj-$(CONFIG_MACH_TOSA) += tosa.o obj-$(CONFIG_MACH_TOSA) += tosa.o
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#define POODLE_GPIO_AC_IN (1) #define POODLE_GPIO_AC_IN (1)
#define POODLE_GPIO_CO 16 #define POODLE_GPIO_CO 16
#define POODLE_GPIO_TP_INT (5) #define POODLE_GPIO_TP_INT (5)
#define POODLE_GPIO_TP_CS (24)
#define POODLE_GPIO_WAKEUP (11) /* change battery */ #define POODLE_GPIO_WAKEUP (11) /* change battery */
#define POODLE_GPIO_GA_INT (10) #define POODLE_GPIO_GA_INT (10)
#define POODLE_GPIO_IR_ON (22) #define POODLE_GPIO_IR_ON (22)
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
...@@ -43,6 +45,7 @@ ...@@ -43,6 +45,7 @@
#include <mach/pxafb.h> #include <mach/pxafb.h>
#include <mach/sharpsl.h> #include <mach/sharpsl.h>
#include <mach/ssp.h> #include <mach/ssp.h>
#include <mach/pxa2xx_spi.h>
#include <asm/hardware/scoop.h> #include <asm/hardware/scoop.h>
#include <asm/hardware/locomo.h> #include <asm/hardware/locomo.h>
...@@ -63,9 +66,9 @@ static unsigned long poodle_pin_config[] __initdata = { ...@@ -63,9 +66,9 @@ static unsigned long poodle_pin_config[] __initdata = {
/* SSP1 */ /* SSP1 */
GPIO23_SSP1_SCLK, GPIO23_SSP1_SCLK,
GPIO24_SSP1_SFRM,
GPIO25_SSP1_TXD, GPIO25_SSP1_TXD,
GPIO26_SSP1_RXD, GPIO26_SSP1_RXD,
GPIO24_GPIO, /* POODLE_GPIO_TP_CS - SFRM as chip select */
/* I2S */ /* I2S */
GPIO28_I2S_BITCLK_OUT, GPIO28_I2S_BITCLK_OUT,
...@@ -197,62 +200,55 @@ struct platform_device poodle_locomo_device = { ...@@ -197,62 +200,55 @@ struct platform_device poodle_locomo_device = {
EXPORT_SYMBOL(poodle_locomo_device); EXPORT_SYMBOL(poodle_locomo_device);
/* #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
* Poodle SSP Device static struct pxa2xx_spi_master poodle_spi_info = {
*/ .num_chipselect = 1,
struct platform_device poodle_ssp_device = {
.name = "corgi-ssp",
.id = -1,
}; };
struct corgissp_machinfo poodle_ssp_machinfo = { static struct ads7846_platform_data poodle_ads7846_info = {
.port = 1, .model = 7846,
.cs_lcdcon = -1, .vref_delay_usecs = 100,
.cs_ads7846 = -1, .x_plate_ohms = 419,
.cs_max1111 = -1, .y_plate_ohms = 486,
.clk_lcdcon = 2, .gpio_pendown = POODLE_GPIO_TP_INT,
.clk_ads7846 = 36,
.clk_max1111 = 2,
}; };
static void ads7846_cs(u32 command)
/*
* Poodle Touch Screen Device
*/
static struct resource poodlets_resources[] = {
[0] = {
.start = POODLE_IRQ_GPIO_TP_INT,
.end = POODLE_IRQ_GPIO_TP_INT,
.flags = IORESOURCE_IRQ,
},
};
static unsigned long poodle_get_hsync_invperiod(void)
{ {
return 0; gpio_set_value(POODLE_GPIO_TP_CS, !(command == PXA2XX_CS_ASSERT));
} }
static void poodle_null_hsync(void) static struct pxa2xx_spi_chip poodle_ads7846_chip = {
{ .cs_control = ads7846_cs,
}
static struct corgits_machinfo poodle_ts_machinfo = {
.get_hsync_invperiod = poodle_get_hsync_invperiod,
.put_hsync = poodle_null_hsync,
.wait_hsync = poodle_null_hsync,
}; };
static struct platform_device poodle_ts_device = { static struct spi_board_info poodle_spi_devices[] = {
.name = "corgi-ts", {
.dev = { .modalias = "ads7846",
.platform_data = &poodle_ts_machinfo, .max_speed_hz = 10000,
.bus_num = 1,
.platform_data = &poodle_ads7846_info,
.controller_data= &poodle_ads7846_chip,
.irq = gpio_to_irq(POODLE_GPIO_TP_INT),
}, },
.id = -1,
.num_resources = ARRAY_SIZE(poodlets_resources),
.resource = poodlets_resources,
}; };
static void __init poodle_init_spi(void)
{
int err;
err = gpio_request(POODLE_GPIO_TP_CS, "ADS7846_CS");
if (err)
return;
gpio_direction_output(POODLE_GPIO_TP_CS, 1);
pxa2xx_set_spi_info(1, &poodle_spi_info);
spi_register_board_info(ARRAY_AND_SIZE(poodle_spi_devices));
}
#else
static inline void poodle_init_spi(void) {}
#endif
/* /*
* MMC/SD Device * MMC/SD Device
...@@ -419,8 +415,6 @@ static struct pxafb_mach_info poodle_fb_info = { ...@@ -419,8 +415,6 @@ static struct pxafb_mach_info poodle_fb_info = {
static struct platform_device *devices[] __initdata = { static struct platform_device *devices[] __initdata = {
&poodle_locomo_device, &poodle_locomo_device,
&poodle_scoop_device, &poodle_scoop_device,
&poodle_ssp_device,
&poodle_ts_device,
}; };
static void poodle_poweroff(void) static void poodle_poweroff(void)
...@@ -445,7 +439,6 @@ static void __init poodle_init(void) ...@@ -445,7 +439,6 @@ static void __init poodle_init(void)
pxa2xx_mfp_config(ARRAY_AND_SIZE(poodle_pin_config)); pxa2xx_mfp_config(ARRAY_AND_SIZE(poodle_pin_config));
platform_scoop_config = &poodle_pcmcia_config; platform_scoop_config = &poodle_pcmcia_config;
corgi_ssp_set_machinfo(&poodle_ssp_machinfo);
ret = platform_add_devices(devices, ARRAY_SIZE(devices)); ret = platform_add_devices(devices, ARRAY_SIZE(devices));
if (ret) if (ret)
...@@ -457,6 +450,7 @@ static void __init poodle_init(void) ...@@ -457,6 +450,7 @@ static void __init poodle_init(void)
pxa_set_mci_info(&poodle_mci_platform_data); pxa_set_mci_info(&poodle_mci_platform_data);
pxa_set_ficp_info(&poodle_ficp_platform_data); pxa_set_ficp_info(&poodle_ficp_platform_data);
pxa_set_i2c_info(NULL); pxa_set_i2c_info(NULL);
poodle_init_spi();
} }
static void __init fixup_poodle(struct machine_desc *desc, static void __init fixup_poodle(struct machine_desc *desc,
......
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