summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremiah Lott <jeremiah.lott@timesys.com>2009-09-29 15:06:38 -0400
committerAndy Voltz <andy.voltz@timesys.com>2010-11-22 11:05:13 -0500
commit314962c0d88a183088b05b4ffcb48a271364bd5a (patch)
tree1371f6ef3aedea7b238c6ca34867922b345e9a34
parent1f2668a74423d2f9a576aeb12c8bfa72ef8dd14b (diff)
mx27lite spi and touchscreen support.
-Setup pin muxing and register drivers. -Rename clocks to match new spi driver. -Change BTN_TOUCH events to ABS_PRESSURE to make tslib happy.
-rw-r--r--arch/arm/mach-mx2/mx27lite.c39
-rw-r--r--drivers/input/touchscreen/mc13783_ts.c6
2 files changed, 43 insertions, 2 deletions
diff --git a/arch/arm/mach-mx2/mx27lite.c b/arch/arm/mach-mx2/mx27lite.c
index 26cc4a81ac03..ee1f1efaf270 100644
--- a/arch/arm/mach-mx2/mx27lite.c
+++ b/arch/arm/mach-mx2/mx27lite.c
@@ -20,8 +20,10 @@
#include <linux/platform_device.h>
#include <linux/gpio.h>
+#include <linux/mfd/mc13783.h>
#include <linux/mtd/plat-ram.h>
#include <linux/mtd/physmap.h>
+#include <linux/spi/spi.h>
#include <linux/fsl_devices.h>
#include <linux/i2c/at24.h>
#include <asm/mach-types.h>
@@ -39,6 +41,7 @@
#include <mach/keypad.h>
#include <mach/mmc.h>
#include <mach/i2c.h>
+#include <mach/spi.h>
#include "devices.h"
@@ -135,6 +138,11 @@ static unsigned int mx27lite_pins[] = {
PB7_PF_SD2_D3,
PB8_PF_SD2_CMD,
PB9_PF_SD2_CLK,
+ /* SPI1 */
+ PD25_PF_CSPI1_RDY,
+ PD29_PF_CSPI1_SCLK,
+ PD30_PF_CSPI1_MISO,
+ PD31_PF_CSPI1_MOSI,
};
static struct mxc_nand_platform_data mx27lite_nand_board_info = {
@@ -327,6 +335,32 @@ static struct platform_device mxc_rtc_device = {
.resource = rtc_resources,
};
+/* SS0 (pin D28) -> MC13783 touchscreen controller
+ * SS1 (pin D27) -> available on breakout board
+ */
+static int mx27lite_spi_cs[] = {GPIO_PORTD | 28, GPIO_PORTD | 27};
+
+static struct spi_imx_master mx27lite_spi_0_data = {
+ .chipselect = mx27lite_spi_cs,
+ .num_chipselect = ARRAY_SIZE(mx27lite_spi_cs),
+};
+
+static struct mc13783_platform_data mc13783_data = {
+ .regulators = NULL,
+ .num_regulators = 0,
+ .flags = MC13783_USE_TOUCHSCREEN,
+};
+static struct spi_board_info mxc_spi_board_info[] __initdata = {
+ {
+ .modalias = "mc13783",
+ .platform_data = &mc13783_data,
+ .irq = IRQ_GPIOB(29),
+ .max_speed_hz = 4000000,
+ .bus_num = 0,
+ .chip_select = 0,
+ },
+};
+
static struct platform_device *platform_devices[] __initdata = {
&mx27lite_nor_mtd_device,
&mxc_fec_device,
@@ -338,6 +372,8 @@ static void __init mx27lite_init(void)
{
mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins),
"imx27lite");
+ mxc_gpio_mode(PD28_PF_CSPI1_SS0);
+ mxc_gpio_mode(PD27_PF_CSPI1_SS1);
mxc_register_device(&mxc_uart_device0, &uart_pdata);
mxc_register_device(&mxc_nand_device, &mx27lite_nand_board_info);
mxc_register_device(&mxc_fb_device, &logic_mbimx27_fb_data);
@@ -349,6 +385,9 @@ static void __init mx27lite_init(void)
mxc_register_device(&mxc_sdhc_device1, &sdhc2_pdata);
+ mxc_register_device(&mxc_spi_device0, &mx27lite_spi_0_data);
+ spi_register_board_info(mxc_spi_board_info, ARRAY_SIZE(mxc_spi_board_info));
+
i2c_register_board_info(0, mx27lite_i2c_devices_0,
ARRAY_SIZE(mx27lite_i2c_devices_0));
mxc_register_device(&mxc_i2c_device0, &mx27lite_i2c_data_0);
diff --git a/drivers/input/touchscreen/mc13783_ts.c b/drivers/input/touchscreen/mc13783_ts.c
index 80163f1ad9fc..085a884dd350 100644
--- a/drivers/input/touchscreen/mc13783_ts.c
+++ b/drivers/input/touchscreen/mc13783_ts.c
@@ -75,7 +75,9 @@ static void mc13783_ts_report_sample(struct mc13783_ts_priv *priv)
queue_delayed_work(priv->workq, &priv->work, HZ / 50);
}
- input_report_key(priv->idev, BTN_TOUCH, press);
+ // XXX: must use ABS_PRESSURE instead of touch for tslib
+ //input_report_key(priv->idev, BTN_TOUCH, press);
+ input_report_abs(priv->idev, ABS_PRESSURE, press);
input_sync(priv->idev);
}
@@ -138,7 +140,7 @@ static int __devinit mc13783_ts_probe(struct platform_device *pdev)
idev->name = MC13783_TS_NAME;
idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
- idev->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y);
+ idev->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | BIT_MASK(ABS_PRESSURE);
idev->open = mc13783_ts_open;
idev->close = mc13783_ts_close;
input_set_abs_params(idev, ABS_X, TS_MIN, TS_MAX, 0, 0);