From: Barry Song <Baohua.Song@csr.com>
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, Barry Song <21cnbao@gmail.com>,
Grant Likely <grant.likely@secretlab.ca>,
Thomas Chou <thomas@wytron.com.tw>
Subject: [PATCH] input: touchscreen: add OF match table for ads7846
Date: Thu, 9 Jun 2011 19:28:40 -0700 [thread overview]
Message-ID: <1307672920-6261-1-git-send-email-Baohua.Song@csr.com> (raw)
The current ads7846 has no OF match table. The method used is by applying a heuristic (of_modalias_node) which tries to name the device in a way that will match an existing device driver.
This patch adds explicit OF match table for ads7846, then the normal device tree match behaviour will always work.
It has been tested on PRIMA2 EVB board of CSR with a SPI's child node like the below:
ts@0 {
compatible = "ti,ads7845";
reg = <0x0>;
spi-max-frequency = <31250>;
interrupts = <90>;
};
Signed-off-by: Barry Song <21cnbao@gmail.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
cc: Thomas Chou <thomas@wytron.com.tw>
---
drivers/input/touchscreen/ads7846.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 5196861..643138b 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -28,6 +28,7 @@
#include <linux/slab.h>
#include <linux/pm.h>
#include <linux/gpio.h>
+#include <linux/of.h>
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>
#include <linux/regulator/consumer.h>
@@ -1425,12 +1426,25 @@ static int __devexit ads7846_remove(struct spi_device *spi)
return 0;
}
+#if defined(CONFIG_OF)
+static struct of_device_id ads7846_spi_of_match_table[] __devinitdata = {
+ { .compatible = "ti,ads7846", },
+ { .compatible = "ti,ads7845", },
+ { .compatible = "ti,ads7843", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, ads7846_spi_of_match_table);
+#endif
+
static struct spi_driver ads7846_driver = {
.driver = {
.name = "ads7846",
.bus = &spi_bus_type,
.owner = THIS_MODULE,
.pm = &ads7846_pm,
+#if defined(CONFIG_OF)
+ .of_match_table = ads7846_spi_of_match_table,
+#endif
},
.probe = ads7846_probe,
.remove = __devexit_p(ads7846_remove),
--
1.7.1
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
next reply other threads:[~2011-06-10 2:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-10 2:28 Barry Song [this message]
2011-06-13 5:15 ` [PATCH] input: touchscreen: add OF match table for ads7846 Grant Likely
2011-06-13 8:15 ` Barry Song
2011-06-13 13:24 ` Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1307672920-6261-1-git-send-email-Baohua.Song@csr.com \
--to=baohua.song@csr.com \
--cc=21cnbao@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=grant.likely@secretlab.ca \
--cc=linux-input@vger.kernel.org \
--cc=thomas@wytron.com.tw \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).