Hi Grant, Thanks. 2011/6/13 Grant Likely <grant.likely@xxxxxxxxxxxx>: > On Thu, Jun 9, 2011 at 8:28 PM, Barry Song <Baohua.Song@xxxxxxx> wrote: >> 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@xxxxxxxxx> >> Cc: Grant Likely <grant.likely@xxxxxxxxxxxx> >> cc: Thomas Chou <thomas@xxxxxxxxxxxxx> >> --- >> Âdrivers/input/touchscreen/ads7846.c |  14 ++++++++++++++ > > There should also be documentation for the new binding added to > Documentation/devicetree/bindings for the new compatible strings. Which directory do you think is the best to place this document? or do we build a new diretory named Documentation/devicetree/bindings/input/touchscreen/ ? The dir Documentation/devicetree/bindings seems to be for spi host, not for spi clients. > >> Â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); > > #else > #define ads7846_spi_of_match_table NULL > >> +#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 > > With the #else Âblock added above, you can drop the #if/#endif > protection around of_match_table. ok. thanks > > Otherwise: > > Acked-by: Grant Likely <grant.likely@xxxxxxxxxxxx> > -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html