[PATCH] i2c-mux-pca954x: use OF match table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Alvin Šipraga <alsi@xxxxxxxxxxxxxxx>

Allow the mux driver to match against device tree compatible strings.

Signed-off-by: Alvin Šipraga <alsi@xxxxxxxxxxxxxxx>
---
 drivers/i2c/muxes/i2c-mux-pca954x.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 6c21b92860f0..fef95fa57eb7 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -255,9 +255,23 @@ static int pca954x_probe(struct device *dev)
 	return ret;
 }
 
+static const struct of_device_id pca954x_dt_ids[] = {
+	{ .compatible = "nxp,pca9540", .data = (const void *)pca_9540 },
+	{ .compatible = "nxp,pca9542", .data = (const void *)pca_9542 },
+	{ .compatible = "nxp,pca9543", .data = (const void *)pca_9543 },
+	{ .compatible = "nxp,pca9544", .data = (const void *)pca_9544 },
+	{ .compatible = "nxp,pca9545", .data = (const void *)pca_9545 },
+	{ .compatible = "nxp,pca9546", .data = (const void *)pca_9546 },
+	{ .compatible = "nxp,pca9547", .data = (const void *)pca_9547 },
+	{ .compatible = "nxp,pca9548", .data = (const void *)pca_9548 },
+	{}
+};
+MODULE_DEVICE_TABLE(of, pca954x_of_match);
+
 static struct driver pca954x_driver = {
 	.name	= "pca954x",
 	.probe		= pca954x_probe,
+	.of_compatible	= DRV_OF_COMPAT(pca954x_dt_ids),
 	.id_table	= pca954x_id,
 };
 device_i2c_driver(pca954x_driver);

---
base-commit: cd2f24268402207a20467ddc41be9865a73ca4f8
change-id: 20231222-pca954x-of-dd6da5a25622





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux