* [PATCH v2 0/4] drm/bridge: ite-it66121: use bulk read, improve probe logging
@ 2026-11-27 11:20 Luca Ceresoli
2026-11-27 11:20 ` [PATCH v2 1/4] drm/bridge: ite-it66121: check for read errors reading IDs Luca Ceresoli
` (3 more replies)
0 siblings, 4 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
This small series improves it66121_probe() in various ways:
* use a bulk read for reading the vendor and device ID registers
* log errors in ID reading and matching instead of failing silently
* on successful probe be quiet on !DEBUG, more informative on DEBUG
Note there is a separate series fixing probing on the BeagleBone Black
rev.D [0]. That is orthogonal and they overall improve probing of this
chip.
[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:
- Split patch 1 in two parts
- Use just a u8[4] array for the bulk read
- Link to v1: https://patch.msgid.link/20261015-drm-ite-it66121-log-probe-errors-v1-0-7fd6994e0be0@bootlin.com
---
Luca Ceresoli (4):
drm/bridge: ite-it66121: check for read errors reading IDs
drm/bridge: ite-it66121: simplify getting the chip IDs
drm/bridge: ite-it66121: log an error if the IDs do not match
drm/bridge: ite-it66121: make successful probe quiet
drivers/gpu/drm/bridge/ite-it66121.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
---
base-commit: f210da5b4aace6919f2723586d22126b73c0e31a
change-id: 20261015-drm-ite-it66121-log-probe-errors-9c8cfef8a7f7
Best regards,
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [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
end of thread, other threads:[~2026-11-27 11:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [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
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®