From: Matthew Laux <matthew.laux@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil@kernel.org>,
Mehdi Djait <mehdi.djait@bootlin.com>
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
Matthew Laux <matthew.laux@gmail.com>
Subject: [PATCH v6 2/8] media: tw9900: accept the TW9910 chip ID
Date: Wed, 18 Nov 2026 14:42:59 -0600 [thread overview]
Message-ID: <20261118204305.28268-3-matthew.laux@gmail.com> (raw)
In-Reply-To: <20261118204305.28268-1-matthew.laux@gmail.com>
Allow tw9900.c to accept the tw9910's chip ID and revision fields as
well as the tw9900's. The tw9910 is a superset of the tw9900 for the
functionality used by the tw9900 driver, and USB3HDCAP/XCAPTURE-1
capture devices can have either chip.
Signed-off-by: Matthew Laux <matthew.laux@gmail.com>
---
drivers/media/i2c/tw9900.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/tw9900.c b/drivers/media/i2c/tw9900.c
index e07924faa84b..60d5686716f7 100644
--- a/drivers/media/i2c/tw9900.c
+++ b/drivers/media/i2c/tw9900.c
@@ -23,6 +23,8 @@
#include <media/v4l2-subdev.h>
#define TW9900_REG_CHIP_ID 0x00
+#define TW9900_REG_CHIP_ID_ID_MASK GENMASK(7, 3)
+#define TW9900_REG_CHIP_ID_REV_MASK GENMASK(2, 0)
#define TW9900_REG_CHIP_STATUS 0x01
#define TW9900_REG_CHIP_STATUS_VDLOSS BIT(7)
#define TW9900_REG_CHIP_STATUS_HLOCK BIT(6)
@@ -51,6 +53,7 @@
#define TW9900_REG_VVBI 0x55
#define TW9900_CHIP_ID 0x00
+#define TW9910_CHIP_ID 0x0B
#define TW9900_STD_NTSC_M 0
#define TW9900_STD_PAL_BDGHI 1
#define TW9900_STD_AUTO 7
@@ -574,6 +577,7 @@ static int tw9900_check_id(struct tw9900 *tw9900,
struct i2c_client *client)
{
struct device *dev = &tw9900->client->dev;
+ u8 id, rev;
int ret;
ret = pm_runtime_resume_and_get(&tw9900->client->dev);
@@ -581,7 +585,7 @@ static int tw9900_check_id(struct tw9900 *tw9900,
return ret;
mutex_lock(&tw9900->mutex);
- ret = tw9900_read_reg(client, TW9900_CHIP_ID);
+ ret = tw9900_read_reg(client, TW9900_REG_CHIP_ID);
mutex_unlock(&tw9900->mutex);
pm_runtime_put(&tw9900->client->dev);
@@ -589,11 +593,17 @@ static int tw9900_check_id(struct tw9900 *tw9900,
if (ret < 0)
return ret;
- if (ret != TW9900_CHIP_ID) {
- dev_err(dev, "Unexpected decoder id %#x\n", ret);
+ id = FIELD_GET(TW9900_REG_CHIP_ID_ID_MASK, ret);
+ rev = FIELD_GET(TW9900_REG_CHIP_ID_REV_MASK, ret);
+
+ if (id != TW9900_CHIP_ID && id != TW9910_CHIP_ID) {
+ dev_err(dev, "Unexpected decoder id %#x (rev %u)\n", id, rev);
return -ENODEV;
}
+ dev_dbg(dev, "Found %s revision %u\n",
+ id == TW9910_CHIP_ID ? "TW9910" : "TW9900", rev);
+
return 0;
}
--
2.47.3
next prev parent reply other threads:[~2026-11-18 20:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 20:42 [PATCH v6 0/8] Add driver for StarTech USB3HDCAP capture device Matthew Laux
2026-11-18 20:42 ` [PATCH v6 1/8] media: tw9900: Disable regulator on runtime resume failure Matthew Laux
2026-11-18 20:42 ` Matthew Laux [this message]
2026-11-18 20:43 ` [PATCH v6 3/8] media: tw9900: add saturation, hue and sharpness controls Matthew Laux
2026-11-18 20:43 ` [PATCH v6 4/8] media: tw9900: use runtime PM autosuspend and power down on suspend Matthew Laux
2026-11-18 20:43 ` [PATCH v6 5/8] media: tw9900: allow board-specific register tables via platform data Matthew Laux
2026-11-18 20:43 ` [PATCH v6 6/8] media: tw9900: add S-Video input and progressive source detection Matthew Laux
2026-11-18 20:43 ` [PATCH v6 7/8] media: Add subdevice driver for the Mstar MST3367 HDMI receiver Matthew Laux
2026-11-18 20:43 ` [PATCH v6 8/8] media: add driver for StarTech USB3HDCAP Matthew Laux
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=20261118204305.28268-3-matthew.laux@gmail.com \
--to=matthew.laux@gmail.com \
--cc=hverkuil@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mehdi.djait@bootlin.com \
/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
all inboxes | Powered by JetHome®