All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] qt602240_ts changes for Intel mid platform
@ 2010-11-16 20:41 Chris Leech
  2010-11-16 20:41 ` [PATCH 1/5] qt602240_ts: fix wrong sizeof in object table allocation Chris Leech
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Chris Leech @ 2010-11-16 20:41 UTC (permalink / raw)
  To: linux-input; +Cc: Joonyoung Shim

The following changes were made while getting this driver to work on an Intel
mid platform.

---

Chris Leech (4):
      qt602240_ts: fix wrong sizeof in object table allocation
      qt602240_ts: move clearing of pending interrupt closer to request_threaded_irq
      qt602240_ts: Trust factory configuration of touchscreen.
      qt602240_ts: add optional hooks for board specific reset logic


 drivers/input/touchscreen/qt602240_ts.c |  138 +++++++++++++++++++++++--------
 include/linux/i2c/qt602240_ts.h         |   12 +++
 2 files changed, 114 insertions(+), 36 deletions(-)

---

Here is an example of the platform device setup code that makes use of these
changes.  The platform code will be sent upstream via a different channel.

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 <linux/i2c/tc35894xbg.h>
 #include <linux/bh1770glc.h>
 #include <linux/leds-lp5523.h>
+#include <linux/i2c/qt602240_ts.h>
 
 #include <asm/setup.h>
 #include <asm/mpspec_def.h>
@@ -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},


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-11-18 22:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-16 20:41 [PATCH 0/4] qt602240_ts changes for Intel mid platform Chris Leech
2010-11-16 20:41 ` [PATCH 1/5] qt602240_ts: fix wrong sizeof in object table allocation Chris Leech
2010-11-18 11:16   ` Joonyoung Shim
2010-11-18 11:30     ` Joonyoung Shim
2010-11-16 20:41 ` [PATCH 2/5] qt602240_ts: move clearing of pending interrupt closer to request_threaded_irq Chris Leech
2010-11-18 12:53   ` Joonyoung Shim
2010-11-18 19:29     ` Chris Leech
2010-11-18 22:54       ` Dmitry Torokhov
2010-11-16 20:42 ` [PATCH 3/5] qt602240_ts: Trust factory configuration of touchscreen Chris Leech
2010-11-18 13:09   ` Joonyoung Shim
2010-11-18 19:41     ` Chris Leech
2010-11-16 20:42 ` [PATCH 4/5] qt602240_ts: add optional hooks for board specific reset logic Chris Leech
2010-11-18 11:32   ` Joonyoung Shim
2010-11-18 19:46     ` Chris Leech
2010-11-16 20:42 ` [PATCH 5/5] qt602240_ts: add mXT224 identifier to id_table, to match Intel mid firmware identifier Chris Leech
2010-11-18 11:34   ` Joonyoung Shim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.