diff options
author | mgross <mark.gross@intel.com> | 2011-10-27 16:50:20 -0700 |
---|---|---|
committer | mgross <mark.gross@intel.com> | 2011-11-09 13:17:40 -0800 |
commit | 8fd056e590c2bea6cde1b5e024a5afd632c606c7 (patch) | |
tree | 3ff981d898de645257fd99c81e6c73923a56b8af | |
parent | 44bd6d75665c0151b23157e47f8cfa0be3533ac4 (diff) | |
download | kernel-mfld-blackbay-8fd056e590c2bea6cde1b5e024a5afd632c606c7.tar.gz kernel-mfld-blackbay-8fd056e590c2bea6cde1b5e024a5afd632c606c7.tar.bz2 kernel-mfld-blackbay-8fd056e590c2bea6cde1b5e024a5afd632c606c7.zip |
fix up old touch screen implementation
Change-Id: Ib7fe714a770f5295d43a1b40dca40b3abd8a4a16
-rw-r--r-- | arch/x86/platform/mrst/mrst.c | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c index f8c29a26bce..f891827c510 100644 --- a/arch/x86/platform/mrst/mrst.c +++ b/arch/x86/platform/mrst/mrst.c @@ -31,6 +31,7 @@ #include <linux/irq.h> #include <linux/module.h> #include <linux/notifier.h> +#include <linux/atmel_mxt224.h> #include <asm/setup.h> #include <asm/mpspec_def.h> @@ -565,6 +566,70 @@ static void __init *lis331dl_platform_data(void *info) return &intr2nd_pdata; } +static int mxt_reset_gpio; + +static u8 mxt_valid_interrupt(void) +{ + return 1; +} + +static void mxt_init_platform_hw(void) +{ + int err; + + err = gpio_request(mxt_reset_gpio, "MaxTouch-reset"); + if (err < 0) + printk(KERN_ERR "Failed to request GPIO%d (MaxTouch-reset) err=%d\n", + mxt_reset_gpio, err); + + err = gpio_direction_output(mxt_reset_gpio, 0); + if (err) + printk(KERN_ERR "Failed to change direction, err=%d\n", err); + + /* maXTouch wants 40mSec minimum after reset to get organized */ + gpio_set_value(mxt_reset_gpio, 1); + msleep(40); +} + +static void mxt_exit_platform_hw(void) +{ + printk(KERN_INFO "In %s.", __func__); + gpio_set_value(mxt_reset_gpio, 0); +} + +static void *mxt_platform_data(void *info) +{ + struct i2c_board_info *i2c_info = (struct i2c_board_info *) info; + static struct mxt_platform_data mfld_mxt_platform_data; + int intr = 0; + + printk(KERN_INFO "In %s.", __func__); + + memset(&mfld_mxt_platform_data, 0x00, + sizeof(struct mxt_platform_data)); + mfld_mxt_platform_data.numtouch = 10; + mfld_mxt_platform_data.init_platform_hw = &mxt_init_platform_hw; + mfld_mxt_platform_data.exit_platform_hw = &mxt_exit_platform_hw; + mfld_mxt_platform_data.max_x = 864; + mfld_mxt_platform_data.max_y = 480; + mfld_mxt_platform_data.orientation = MXT_MSGB_T9_ORIENT_HORZ_FLIP; + mfld_mxt_platform_data.valid_interrupt = &mxt_valid_interrupt; + + intr = get_gpio_by_name("TS0-intr"); + if (intr == -1) { + printk(KERN_ERR "Missing GPIO(s) for MXT.\n"); + return NULL; + } + + /* On nCDK EB2.0, Atmel max touch reset is on + GP_CORE_033 = 33 + 96 = 129 */ + mxt_reset_gpio = 129; /* TODO: Use SFI, when SFI is available */ + + i2c_info->irq = intr + MRST_IRQ_OFFSET; + return &mfld_mxt_platform_data; +} + + /* MFLD iCDK touchscreen data */ #define CYTTSP_GPIO_PIN 0x3E static int cyttsp_init(int on) @@ -772,6 +837,7 @@ static const struct devs_id __initconst device_ids[] = { {"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data}, {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data}, {"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data}, + {"mXT224", SFI_DEV_TYPE_I2C, 1, &mxt_platform_data}, {"ektf2136_spi", SFI_DEV_TYPE_SPI, 0, &ektf2136_spi_platform_data}, {"msic_adc", SFI_DEV_TYPE_IPC, 1, &msic_adc_platform_data}, @@ -1042,6 +1108,10 @@ static int __init sfi_parse_devs(struct sfi_table_header *table) i2c_info.type, i2c_info.irq, i2c_info.addr); + if (!strcmp(i2c_info.type, "mxt224")){ + printk(KERN_INFO "[%s:%d] Breaking mxt224 driver\n",__func__,__LINE__); + break; + } sfi_handle_i2c_dev(bus, &i2c_info); break; case SFI_DEV_TYPE_UART: @@ -1242,4 +1312,4 @@ void mfld_hsu_disable_wakeup(int index, struct device *dev) dev_err(dev, "hsu: unknow hsu port\n"); } } -EXPORT_SYMBOL_GPL(mfld_hsu_disable_wakeup);
\ No newline at end of file + |