Devicetree
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: Conor Dooley <conor+dt@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Rob Herring <robh@kernel.org>, David Airlie <airlied@gmail.com>,
	Maxime Ripard <mripard@kernel.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Neil Armstrong <neil.armstrong@linaro.org>
Cc: <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<dri-devel@lists.freedesktop.org>,
	Robert Nelson <robertcnelson@gmail.com>,
	Jason Kridner <jkridner@beagleboard.org>, <afd@ti.com>,
	Nishanth Menon <nm@ti.com>
Subject: [PATCH V2 2/3] drm/bridge: it66121: Convert the vid/pid entries into a list
Date: Wed, 13 Aug 2025 15:41:05 -0500	[thread overview]
Message-ID: <20250813204106.580141-3-nm@ti.com> (raw)
In-Reply-To: <20250813204106.580141-1-nm@ti.com>

The IT66122 is a drop in replacement for the IT66122. The part is
register compatible with what we use of the IT66121. The only relevant
change being the PID is now 0x0622 vs 0x0612. Add this extra PID so
probe does not fail during the PID check with these new parts.

Since production flow can result in multiple devices as the part gets
replaced, prepare for a match list that allows introducing additional
vid/pid matches for the same device profile.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
New Patch
- This sets up the stage for introducing it66122 support

 drivers/gpu/drm/bridge/ite-it66121.c | 29 ++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index aa7b1dcc5d70..208e118df0e2 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -289,9 +289,13 @@ enum chip_id {
 	ID_IT66121,
 };
 
+struct it66121_device_id {
+	u16 vid, pid;
+};
+
 struct it66121_chip_info {
 	enum chip_id id;
-	u16 vid, pid;
+	struct it66121_device_id device_id[]; /* NULL terminated List */
 };
 
 struct it66121_ctx {
@@ -1511,6 +1515,7 @@ static int it66121_probe(struct i2c_client *client)
 	int ret;
 	struct it66121_ctx *ctx;
 	struct device *dev = &client->dev;
+	const struct it66121_device_id *device_id;
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
 		dev_err(dev, "I2C check functionality failed.\n");
@@ -1574,11 +1579,15 @@ static int it66121_probe(struct i2c_client *client)
 	revision_id = FIELD_GET(IT66121_REVISION_MASK, device_ids[1]);
 	device_ids[1] &= IT66121_DEVICE_ID1_MASK;
 
-	if ((vendor_ids[1] << 8 | vendor_ids[0]) != ctx->info->vid ||
-	    (device_ids[1] << 8 | device_ids[0]) != ctx->info->pid) {
-		return -ENODEV;
+	for (device_id = ctx->info->device_id; device_id->vid; device_id++) {
+		if ((vendor_ids[1] << 8 | vendor_ids[0]) == device_id->vid &&
+		    (device_ids[1] << 8 | device_ids[0]) == device_id->pid)
+			break;
 	}
 
+	if (!device_id->vid)
+		return -ENODEV;
+
 	ctx->bridge.of_node = dev->of_node;
 	ctx->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
 	ctx->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID;
@@ -1614,14 +1623,18 @@ static void it66121_remove(struct i2c_client *client)
 
 static const struct it66121_chip_info it66121_chip_info = {
 	.id = ID_IT66121,
-	.vid = 0x4954,
-	.pid = 0x0612,
+	.device_id = {
+		{.vid = 0x4954, .pid = 0x0612 },
+		{ }
+	},
 };
 
 static const struct it66121_chip_info it6610_chip_info = {
 	.id = ID_IT6610,
-	.vid = 0xca00,
-	.pid = 0x0611,
+	.device_id = {
+		{ .vid = 0xca00, .pid = 0x0611},
+		{ }
+	},
 };
 
 static const struct of_device_id it66121_dt_match[] = {
-- 
2.47.0


  parent reply	other threads:[~2025-08-13 20:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13 20:41 [PATCH V2 0/3] drm/bridge: it66121: Add it66122 support Nishanth Menon
2025-08-13 20:41 ` [PATCH V2 1/3] dt-bindings: display: bridge: it66121: Add compatible string for IT66122 Nishanth Menon
2025-08-13 20:41 ` Nishanth Menon [this message]
2025-08-13 20:41 ` [PATCH V2 3/3] drm/bridge: it66121: Add it66122 support Nishanth Menon
2025-08-14 10:32   ` Tomi Valkeinen
2025-08-14 11:06     ` Nishanth Menon
2025-08-13 22:41 ` [PATCH V2 0/3] " Andrew Davis

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=20250813204106.580141-3-nm@ti.com \
    --to=nm@ti.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=afd@ti.com \
    --cc=airlied@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jkridner@beagleboard.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=robertcnelson@gmail.com \
    --cc=robh@kernel.org \
    /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