[PATCH 1/2] Add platform data of pcap7200 touch panel device.

Matt Hsu matt_hsu at openmoko.org
Mon Feb 9 09:04:50 CET 2009


The following two features are added as platform data.

- externel reset
- operating mode

Signed-off-by: Matt Hsu <matt_hsu at openmoko.org>
---
 drivers/input/touchscreen/pcap7200_ts.c |   12 +++++++++++-
 include/linux/pcap7200.h                |    5 +++++
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/drivers/input/touchscreen/pcap7200_ts.c b/drivers/input/touchscreen/pcap7200_ts.c
index 730ee32..70f7d89 100644
--- a/drivers/input/touchscreen/pcap7200_ts.c
+++ b/drivers/input/touchscreen/pcap7200_ts.c
@@ -161,8 +161,9 @@ pcap7200_probe(struct i2c_client *client, const struct i2c_device_id *ids)
 	struct pcap7200_data *pcap;
 	struct input_dev *input_dev;
 	int err;
+	struct pcap7200_platform_data *pdata = client->dev.platform_data;
 
-	/* allocat pcap7200 data */
+	/* allocate pcap7200 data */
 	pcap = kzalloc(sizeof(struct pcap7200_data), GFP_KERNEL);
 	if (!pcap)
 		return -ENOMEM;
@@ -172,6 +173,15 @@ pcap7200_probe(struct i2c_client *client, const struct i2c_device_id *ids)
 
 	mutex_init(&pcap->lock);
 
+	/* reset */
+	if (pdata->reset) {
+		pdata->reset();
+		dev_dbg(&client->dev, "hard reset\n");
+	}
+
+	/* operating mode */
+	__set_op_mode(pcap, pdata->mode);
+
 	/* initialize input device */
 	input_dev = input_allocate_device();
 	if (!input_dev) {
diff --git a/include/linux/pcap7200.h b/include/linux/pcap7200.h
index f52ba15..0fafb86 100644
--- a/include/linux/pcap7200.h
+++ b/include/linux/pcap7200.h
@@ -17,4 +17,9 @@ enum gesture {
 	SND_SLIDE,
 };
 
+struct pcap7200_platform_data {
+	enum op_mode mode;
+	void (*reset)(void);
+};
+
 #endif 	/* _LINUX_PCPA7200_H */
-- 
1.5.6.5




More information about the openmoko-kernel mailing list