* [PATCH v2 1/4] drm/bridge: ite-it66121: check for read errors reading IDs
2026-11-27 11:20 [PATCH v2 0/4] drm/bridge: ite-it66121: use bulk read, improve probe logging Luca Ceresoli
@ 2026-11-27 11:20 ` Luca Ceresoli
2026-11-27 11:20 ` [PATCH v2 2/4] drm/bridge: ite-it66121: simplify getting the chip IDs Luca Ceresoli
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Luca Ceresoli @ 2026-11-27 11:20 UTC (permalink / raw)
To: Phong LE, Neil Armstrong, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Javier Martinez Canillas,
Julien Chauveau
Cc: Paul Cercueil, Nishanth Menon, Thomas Petazzoni, dri-devel,
linux-kernel, Luca Ceresoli
it66121_probe() calls regmap_read() four times to read the vendor and
device ID registers, without error checking. This leads to silently
continuing using invalid ID values when any of the reads fail (which has
happened and is being fixed [0]).
Adding error checking on all 4 regmap_read()s would be annoying, so switch
to regmap_bulk_read().
[0] https://lore.kernel.org/lkml/20261105-drm-ite-it66121-fix-reset-v2-1-02039d66af29@bootlin.com/
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v2:
- Use just a u8 array (Javier)
- Split v1 patch 1 in two parts (Javier)
---
drivers/gpu/drm/bridge/ite-it66121.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index 34302db25a8e..8bc96ef006f8 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -1572,7 +1572,8 @@ static const struct it66121_chip_info it66xx_chip_info[] = {
static int it66121_probe(struct i2c_client *client)
{
- u32 revision_id, vendor_ids[2] = { 0 }, device_ids[2] = { 0 };
+ __u8 chip_id_regs[4];
+ u32 revision_id;
struct device_node *ep;
int ret, i;
struct it66121_ctx *ctx;
@@ -1636,19 +1637,19 @@ static int it66121_probe(struct i2c_client *client)
if (IS_ERR(ctx->regmap))
return PTR_ERR(ctx->regmap);
- regmap_read(ctx->regmap, IT66121_VENDOR_ID0_REG, &vendor_ids[0]);
- regmap_read(ctx->regmap, IT66121_VENDOR_ID1_REG, &vendor_ids[1]);
- regmap_read(ctx->regmap, IT66121_DEVICE_ID0_REG, &device_ids[0]);
- regmap_read(ctx->regmap, IT66121_DEVICE_ID1_REG, &device_ids[1]);
+ ret = regmap_bulk_read(ctx->regmap, IT66121_VENDOR_ID0_REG,
+ &chip_id_regs, sizeof(chip_id_regs));
+ if (ret)
+ return dev_err_probe(dev, ret, "Error reading device IDs\n");
/* Revision is shared with DEVICE_ID1 */
- revision_id = FIELD_GET(IT66121_REVISION_MASK, device_ids[1]);
- device_ids[1] &= IT66121_DEVICE_ID1_MASK;
+ revision_id = FIELD_GET(IT66121_REVISION_MASK, chip_id_regs[3]);
+ chip_id_regs[3] &= IT66121_DEVICE_ID1_MASK;
for (i = 0; i < ARRAY_SIZE(it66xx_chip_info); i++) {
chip_info = &it66xx_chip_info[i];
- if ((vendor_ids[1] << 8 | vendor_ids[0]) == chip_info->vid &&
- (device_ids[1] << 8 | device_ids[0]) == chip_info->pid) {
+ if ((chip_id_regs[1] << 8 | chip_id_regs[0]) == chip_info->vid &&
+ (chip_id_regs[3] << 8 | chip_id_regs[2]) == chip_info->pid) {
ctx->id = chip_info->id;
break;
}
--
2.56.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v2 2/4] drm/bridge: ite-it66121: simplify getting the chip IDs
2026-11-27 11:20 [PATCH v2 0/4] drm/bridge: ite-it66121: use bulk read, improve probe logging Luca Ceresoli
2026-11-27 11:20 ` [PATCH v2 1/4] drm/bridge: ite-it66121: check for read errors reading IDs Luca Ceresoli
@ 2026-11-27 11:20 ` Luca Ceresoli
2026-11-27 11:20 ` [PATCH v2 3/4] drm/bridge: ite-it66121: log an error if the IDs do not match Luca Ceresoli
2026-11-27 11:20 ` [PATCH v2 4/4] drm/bridge: ite-it66121: make successful probe quiet Luca Ceresoli
3 siblings, 0 replies; 5+ messages in thread
From: Luca Ceresoli @ 2026-11-27 11:20 UTC (permalink / raw)
To: Phong LE, Neil Armstrong, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Javier Martinez Canillas,
Julien Chauveau
Cc: Paul Cercueil, Nishanth Menon, Thomas Petazzoni, dri-devel,
linux-kernel, Luca Ceresoli
Simplify how the vendor and device ID are computed by using
get_unaligned_le16 instead of open-coded bit operations.
While there, also store the IDs into variables and log them for debugging.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v2:
- new patch, split out of v1 patch 1 (Javier)
---
drivers/gpu/drm/bridge/ite-it66121.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index 8bc96ef006f8..4642a32f1bd0 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -1573,6 +1573,7 @@ static const struct it66121_chip_info it66xx_chip_info[] = {
static int it66121_probe(struct i2c_client *client)
{
__u8 chip_id_regs[4];
+ u16 vendor_id, device_id;
u32 revision_id;
struct device_node *ep;
int ret, i;
@@ -1646,10 +1647,14 @@ static int it66121_probe(struct i2c_client *client)
revision_id = FIELD_GET(IT66121_REVISION_MASK, chip_id_regs[3]);
chip_id_regs[3] &= IT66121_DEVICE_ID1_MASK;
+ vendor_id = get_unaligned_le16(&chip_id_regs[0]);
+ device_id = get_unaligned_le16(&chip_id_regs[2]);
+ dev_dbg(dev, "vendor %04x device %04x (rev %01x)\n", vendor_id, device_id, revision_id);
+
for (i = 0; i < ARRAY_SIZE(it66xx_chip_info); i++) {
chip_info = &it66xx_chip_info[i];
- if ((chip_id_regs[1] << 8 | chip_id_regs[0]) == chip_info->vid &&
- (chip_id_regs[3] << 8 | chip_id_regs[2]) == chip_info->pid) {
+ if (vendor_id == chip_info->vid &&
+ device_id == chip_info->pid) {
ctx->id = chip_info->id;
break;
}
--
2.56.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v2 3/4] drm/bridge: ite-it66121: log an error if the IDs do not match
2026-11-27 11:20 [PATCH v2 0/4] drm/bridge: ite-it66121: use bulk read, improve probe logging Luca Ceresoli
2026-11-27 11:20 ` [PATCH v2 1/4] drm/bridge: ite-it66121: check for read errors reading IDs Luca Ceresoli
2026-11-27 11:20 ` [PATCH v2 2/4] drm/bridge: ite-it66121: simplify getting the chip IDs Luca Ceresoli
@ 2026-11-27 11:20 ` Luca Ceresoli
2026-11-27 11:20 ` [PATCH v2 4/4] drm/bridge: ite-it66121: make successful probe quiet Luca Ceresoli
3 siblings, 0 replies; 5+ messages in thread
From: Luca Ceresoli @ 2026-11-27 11:20 UTC (permalink / raw)
To: Phong LE, Neil Armstrong, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Javier Martinez Canillas,
Julien Chauveau
Cc: Paul Cercueil, Nishanth Menon, Thomas Petazzoni, dri-devel,
linux-kernel, Luca Ceresoli
If the IDs read from the chip do not match any of the known models,
it66121_probe() fails silently, making troubleshooting unnecessarily
difficult. Log an error to clarify the failure reason, showing the IDs read
from the hardware.
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/ite-it66121.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index 4642a32f1bd0..596c31f3d5a9 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -1661,7 +1661,8 @@ static int it66121_probe(struct i2c_client *client)
}
if (i == ARRAY_SIZE(it66xx_chip_info))
- return -ENODEV;
+ return dev_err_probe(dev, -ENODEV, "Unknown vendor %04x device %04x (rev %01x)\n",
+ vendor_id, device_id, revision_id);
ctx->bridge.of_node = dev->of_node;
ctx->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
--
2.56.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 4/4] drm/bridge: ite-it66121: make successful probe quiet
2026-11-27 11:20 [PATCH v2 0/4] drm/bridge: ite-it66121: use bulk read, improve probe logging Luca Ceresoli
` (2 preceding siblings ...)
2026-11-27 11:20 ` [PATCH v2 3/4] drm/bridge: ite-it66121: log an error if the IDs do not match Luca Ceresoli
@ 2026-11-27 11:20 ` Luca Ceresoli
3 siblings, 0 replies; 5+ messages in thread
From: Luca Ceresoli @ 2026-11-27 11:20 UTC (permalink / raw)
To: Phong LE, Neil Armstrong, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Javier Martinez Canillas,
Julien Chauveau
Cc: Paul Cercueil, Nishanth Menon, Thomas Petazzoni, dri-devel,
linux-kernel, Luca Ceresoli
When drivers are working properly they should be quiet. Turn the dev_info()
into a dev_dbg(). While there, also make it more informative.
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/ite-it66121.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index 596c31f3d5a9..d11f947e33b2 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -1698,7 +1698,8 @@ static int it66121_probe(struct i2c_client *client)
drm_bridge_add(&ctx->bridge);
- dev_info(ctx->dev, "IT66121 revision %d probed\n", revision_id);
+ dev_dbg(ctx->dev, "IT66121 vendor %04x device %04x revision %d probed\n",
+ vendor_id, device_id, revision_id);
return 0;
}
--
2.56.1
^ permalink raw reply [flat|nested] 5+ messages in thread