From patchwork Tue Nov 16 20:41:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Leech X-Patchwork-Id: 329201 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAGKg0Pn029662 for ; Tue, 16 Nov 2010 20:42:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757122Ab0KPUlq (ORCPT ); Tue, 16 Nov 2010 15:41:46 -0500 Received: from mga01.intel.com ([192.55.52.88]:46758 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757111Ab0KPUlp (ORCPT ); Tue, 16 Nov 2010 15:41:45 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 16 Nov 2010 12:41:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.59,207,1288594800"; d="scan'208";a="627436695" Received: from cleech-lnx (HELO localhost6.localdomain6) ([10.7.197.231]) by fmsmga002.fm.intel.com with ESMTP; 16 Nov 2010 12:41:45 -0800 Subject: [PATCH 0/4] qt602240_ts changes for Intel mid platform To: linux-input@vger.kernel.org From: Chris Leech Cc: Joonyoung Shim Date: Tue, 16 Nov 2010 12:41:45 -0800 Message-ID: <20101116203914.28796.23141.stgit@localhost6.localdomain6> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 16 Nov 2010 20:42:02 +0000 (UTC) diff --git a/arch/x86/kernel/mrst.c b/arch/x86/kernel/mrst.c index 9ed9e6b..d1ebdc8 100644 --- a/arch/x86/kernel/mrst.c +++ b/arch/x86/kernel/mrst.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -1032,6 +1033,76 @@ void *tc35894xbg_n_platform_data(void *info) &tc35894xbg_ncdk_data); } +static int qt602240_reset; +static int qt602240_intr; + +static int qt602240_hw_setup(struct i2c_client *client) +{ + int err; + int intr; + + err = gpio_request(qt602240_intr, "maXTouch-intr"); + if (err) { + dev_err(&client->dev, "GPIO-%d request failed (err %d)\n", + qt602240_intr, err); + goto err_request_intr; + } + + err = gpio_request(qt602240_reset, "maXTouch-reset"); + if (err) { + dev_err(&client->dev, "GPIO-%d request failed (err %d)\n", + qt602240_reset, err); + goto err_request_reset; + } + + err = gpio_direction_output(qt602240_reset, 0); + if (err) { + dev_err(&client->dev, "GPIO-%d direction set failed (err %d)\n", + qt602240_reset, err); + goto err_reset_direction; + } + + gpio_set_value(qt602240_reset, 1); + /* maXTouch wants 40mSec minimum after reset to get organized */ + /* double that to be safe as a maximum required delay */ + msleep(80); + return 0; + +err_reset_direction: + gpio_free(qt602240_reset); +err_request_reset: + gpio_free(qt602240_intr); +err_request_intr: + return -EIO; +} + +static void qt602240_hw_teardown(struct i2c_client *client) +{ + gpio_set_value(qt602240_reset, 0); + gpio_free(qt602240_reset); + gpio_free(qt602240_intr); +} + +static void *qt602240_platform_data(void *info) +{ + struct i2c_board_info *i2c_info = info; + static struct qt602240_platform_data pdata = { + .trust_nvm = 1, + .hw_setup = qt602240_hw_setup, + .hw_teardown = qt602240_hw_teardown, + }; + + qt602240_reset = get_gpio_by_name("TS0-reset"); + qt602240_intr = get_gpio_by_name("TS0-intr"); + if (qt602240_reset < 0 || qt602240_intr < 0) { + printk(KERN_ERR "Touchscreen-0 GPIOs not in SFI table\n"); + return NULL; + } + + i2c_info->irq = qt602240_intr + MRST_IRQ_OFFSET; + return &pdata; +} + static const struct devs_id device_ids[] = { {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data}, {"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data}, @@ -1053,6 +1124,7 @@ static const struct devs_id device_ids[] = { {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data}, {"msic_audio", SFI_DEV_TYPE_SPI, 1, &no_platform_data}, {"msic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data}, + {"mXT224", SFI_DEV_TYPE_I2C, 0, &qt602240_platform_data}, {"i2c_TC35894-nEB1", SFI_DEV_TYPE_I2C, 0, &tc35894xbg_n_platform_data}, {"i2c_TC35894-i", SFI_DEV_TYPE_I2C, 0, &tc35894xbg_i_platform_data}, {"bh1770glc", SFI_DEV_TYPE_I2C, 0, &bh1770glc_platform_data_init},