]> www.infradead.org Git - users/willy/xarray.git/commitdiff
Input: cyttsp - probe from compatibles
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 26 May 2021 23:34:41 +0000 (16:34 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 26 May 2021 23:58:59 +0000 (16:58 -0700)
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.

Reviewed-by: Javier Martinez Canillas <javier@dowhile0.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210526230352.1433537-2-linus.walleij@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/cyttsp_i2c.c
drivers/input/touchscreen/cyttsp_spi.c

index 061debf64a2bd35cef4f5a325b96e6012910119f..0a09f07bc23aa4bd87ecde71e560f1acf87ab9e9 100644 (file)
@@ -52,10 +52,18 @@ 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 */ }
+};
+MODULE_DEVICE_TABLE(of, cyttsp_of_i2c_match);
+
 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,
index 54e410921d531256ce42a5057600a96e833b5b69..8715e5354d795de994bf26b27639e6d9d814b741 100644 (file)
@@ -160,10 +160,18 @@ 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 */ }
+};
+MODULE_DEVICE_TABLE(of, cyttsp_of_spi_match);
+
 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,
 };