mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Alvin Šipraga" <alvin@pqrs.dk>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	 BAREBOX <barebox@lists.infradead.org>
Cc: "Alvin Šipraga" <alsi@bang-olufsen.dk>
Subject: [PATCH] i2c-mux-pca954x: use OF match table
Date: Fri, 22 Dec 2023 03:12:33 +0100	[thread overview]
Message-ID: <20231222-pca954x-of-v1-1-d39efe336b06@bang-olufsen.dk> (raw)

From: Alvin Šipraga <alsi@bang-olufsen.dk>

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

Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
---
 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




             reply	other threads:[~2023-12-22  2:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22  2:12 Alvin Šipraga [this message]
2023-12-22 12:37 ` Ahmad Fatoum
2023-12-22 13:23   ` Alvin Šipraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231222-pca954x-of-v1-1-d39efe336b06@bang-olufsen.dk \
    --to=alvin@pqrs.dk \
    --cc=alsi@bang-olufsen.dk \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox