Message ID | 20210330085424.2244653-2-linus.walleij@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Input: cyttsp - First round of modernizations | expand |
Hello Linus, On Tue, Mar 30, 2021 at 10:54 AM Linus Walleij <linus.walleij@linaro.org> wrote: > > The driver (both SPI and I2C interface) should probe from > the compatible strings, cypress,cy8ctma340 etc when using > device tree, not as now, where it is probing implicitly from > the I2C/SPI node name "cypress,cyttsp-i2c" etc. > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > drivers/input/touchscreen/cyttsp_i2c.c | 7 +++++++ > drivers/input/touchscreen/cyttsp_spi.c | 7 +++++++ > 2 files changed, 14 insertions(+) > > diff --git a/drivers/input/touchscreen/cyttsp_i2c.c b/drivers/input/touchscreen/cyttsp_i2c.c > index 061debf64a2b..0f097f34832a 100644 > --- a/drivers/input/touchscreen/cyttsp_i2c.c > +++ b/drivers/input/touchscreen/cyttsp_i2c.c > @@ -52,10 +52,17 @@ static const struct i2c_device_id cyttsp_i2c_id[] = { > }; > MODULE_DEVICE_TABLE(i2c, cyttsp_i2c_id); > > +static const struct of_device_id cyttsp_of_i2c_match[] = { > + { .compatible = "cypress,cy8ctma340", }, > + { .compatible = "cypress,cy8ctst341", }, > + { /* sentinel */ } > +}; > + I think we want to export this as modalias with MODULE_DEVICE_TABLE(of, cyttsp_of_i2c_match) so the driver could be autoloaded if built as a module ? > static struct i2c_driver cyttsp_i2c_driver = { > .driver = { > .name = CY_I2C_NAME, > .pm = &cyttsp_pm_ops, > + .of_match_table = cyttsp_of_i2c_match, > }, > .probe = cyttsp_i2c_probe, > .id_table = cyttsp_i2c_id, > diff --git a/drivers/input/touchscreen/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp_spi.c > index 54e410921d53..ad8b3c6c4d3e 100644 > --- a/drivers/input/touchscreen/cyttsp_spi.c > +++ b/drivers/input/touchscreen/cyttsp_spi.c > @@ -160,10 +160,17 @@ static int cyttsp_spi_probe(struct spi_device *spi) > return 0; > } > > +static const struct of_device_id cyttsp_of_spi_match[] = { > + { .compatible = "cypress,cy8ctma340", }, > + { .compatible = "cypress,cy8ctst341", }, > + { /* sentinel */ } > +}; > + And same here. Other than that, the patch looks good to me. Reviewed-by: Javier Martinez Canillas <javier@dowhile0.org> Best regards, Javier
diff --git a/drivers/input/touchscreen/cyttsp_i2c.c b/drivers/input/touchscreen/cyttsp_i2c.c index 061debf64a2b..0f097f34832a 100644 --- a/drivers/input/touchscreen/cyttsp_i2c.c +++ b/drivers/input/touchscreen/cyttsp_i2c.c @@ -52,10 +52,17 @@ static const struct i2c_device_id cyttsp_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, cyttsp_i2c_id); +static const struct of_device_id cyttsp_of_i2c_match[] = { + { .compatible = "cypress,cy8ctma340", }, + { .compatible = "cypress,cy8ctst341", }, + { /* sentinel */ } +}; + static struct i2c_driver cyttsp_i2c_driver = { .driver = { .name = CY_I2C_NAME, .pm = &cyttsp_pm_ops, + .of_match_table = cyttsp_of_i2c_match, }, .probe = cyttsp_i2c_probe, .id_table = cyttsp_i2c_id, diff --git a/drivers/input/touchscreen/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp_spi.c index 54e410921d53..ad8b3c6c4d3e 100644 --- a/drivers/input/touchscreen/cyttsp_spi.c +++ b/drivers/input/touchscreen/cyttsp_spi.c @@ -160,10 +160,17 @@ static int cyttsp_spi_probe(struct spi_device *spi) return 0; } +static const struct of_device_id cyttsp_of_spi_match[] = { + { .compatible = "cypress,cy8ctma340", }, + { .compatible = "cypress,cy8ctst341", }, + { /* sentinel */ } +}; + static struct spi_driver cyttsp_spi_driver = { .driver = { .name = CY_SPI_NAME, .pm = &cyttsp_pm_ops, + .of_match_table = cyttsp_of_spi_match, }, .probe = cyttsp_spi_probe, };
The driver (both SPI and I2C interface) should probe from the compatible strings, cypress,cy8ctma340 etc when using device tree, not as now, where it is probing implicitly from the I2C/SPI node name "cypress,cyttsp-i2c" etc. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/input/touchscreen/cyttsp_i2c.c | 7 +++++++ drivers/input/touchscreen/cyttsp_spi.c | 7 +++++++ 2 files changed, 14 insertions(+)