diff mbox series

[2/3,v6] Input: cyttsp - Probe from compatibles

Message ID 20210526230352.1433537-2-linus.walleij@linaro.org
State Accepted
Commit 007704c99f52e22cd93bcc16c610d7c1a41fd9cd
Headers show
Series [1/3,v6] Input: cyttsp - Convert bindings to YAML and extend | expand

Commit Message

Linus Walleij May 26, 2021, 11:03 p.m. UTC
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>

---
ChangeLog v5->v6:
- No changes just resending with the other patches.
ChangeLog v3->v5:
- Rebase on v5.13-rc1
ChangeLog v1->v3:
- Add MODULE_DEVICE_TABLE() for both sets of compatible
  strings.
- Collect Javiers review tag.
---
 drivers/input/touchscreen/cyttsp_i2c.c | 8 ++++++++
 drivers/input/touchscreen/cyttsp_spi.c | 8 ++++++++
 2 files changed, 16 insertions(+)

-- 
2.31.1

Comments

Dmitry Torokhov May 26, 2021, 11:58 p.m. UTC | #1
On Thu, May 27, 2021 at 01:03:51AM +0200, Linus Walleij 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.

> 

> Reviewed-by: Javier Martinez Canillas <javier@dowhile0.org>

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


Applied, thank you.

-- 
Dmitry
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/cyttsp_i2c.c b/drivers/input/touchscreen/cyttsp_i2c.c
index 061debf64a2b..0a09f07bc23a 100644
--- a/drivers/input/touchscreen/cyttsp_i2c.c
+++ b/drivers/input/touchscreen/cyttsp_i2c.c
@@ -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,
diff --git a/drivers/input/touchscreen/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp_spi.c
index 54e410921d53..8715e5354d79 100644
--- a/drivers/input/touchscreen/cyttsp_spi.c
+++ b/drivers/input/touchscreen/cyttsp_spi.c
@@ -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,
 };