Thread (15 messages) 15 messages, 2 authors, 2021-03-30

Re: [PATCH 1/7] Input: cyttsp - Probe from compatibles

From: Javier Martinez Canillas <javier@dowhile0.org>
Date: 2021-03-30 10:52:12

Hello Linus,

On Tue, Mar 30, 2021 at 10:54 AM Linus Walleij [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
 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 ?
quoted hunk ↗ jump to hunk
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help