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 v8 03/12] media: tw9900: accept the TW9910 chip ID
Date: Wed, 25 Nov 2026 13:49:42 -0600 [thread overview]
Message-ID: <20261125194951.19072-4-matthew.laux@gmail.com> (raw)
In-Reply-To: <20261125194951.19072-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 e9d384039b50..df8c7b1f3450 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-25 19:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 19:49 [PATCH v8 00/12] Add driver for StarTech USB3HDCAP capture device Matthew Laux
2026-11-25 19:49 ` [PATCH v8 01/12] media: tw9900: Disable regulator on runtime resume failure Matthew Laux
2026-11-25 19:49 ` [PATCH v8 02/12] media: tw9900: release the device when stopping the stream fails Matthew Laux
2026-11-25 19:49 ` Matthew Laux [this message]
2026-11-25 19:49 ` [PATCH v8 04/12] media: tw9900: add saturation, hue and sharpness controls Matthew Laux
2026-11-25 19:49 ` [PATCH v8 05/12] media: tw9900: program all mode registers in the PAL table Matthew Laux
2026-11-25 19:49 ` [PATCH v8 06/12] media: tw9900: power off the device on remove if still active Matthew Laux
2026-11-25 19:49 ` [PATCH v8 07/12] media: tw9900: power down analog blocks in runtime suspend Matthew Laux
2026-11-25 19:49 ` [PATCH v8 08/12] media: tw9900: use runtime PM autosuspend Matthew Laux
2026-11-25 19:49 ` [PATCH v8 09/12] media: tw9900: allow board-specific register tables via platform data Matthew Laux
2026-11-25 19:49 ` [PATCH v8 10/12] media: tw9900: add S-Video input and progressive source detection Matthew Laux
2026-11-25 19:49 ` [PATCH v8 11/12] media: Add subdevice driver for the Mstar MST3367 HDMI receiver Matthew Laux
2026-11-25 19:49 ` [PATCH v8 12/12] media: add driver for StarTech USB3HDCAP Matthew Laux
2026-11-26 7:16 ` Markus Elfring
2026-11-26 8:09 ` Markus Elfring
2026-11-25 20:33 ` [PATCH v8 00/12] Add driver for StarTech USB3HDCAP capture device Markus Elfring
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=20261125194951.19072-4-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.