* [PATCH v2 0/2] media: i2c: it6625: fix MCU reset and host control timing
@ 2026-10-07 10:31 Hermes Wu via B4 Relay
2026-10-07 10:31 ` [PATCH v2 1/2] media: i2c: it6625: wait 1s after reset release Hermes Wu via B4 Relay
2026-10-07 10:31 ` [PATCH v2 2/2] media: i2c: it6625: allow 250 ms for host control requests to complete Hermes Wu via B4 Relay
0 siblings, 2 replies; 3+ messages in thread
From: Hermes Wu via B4 Relay @ 2026-10-07 10:31 UTC (permalink / raw)
To: Hermes Wu, Mauro Carvalho Chehab, Hans Verkuil
Cc: linux-media, linux-kernel, Hermes Wu
The IT6625/IT6626 are driven through an on-chip MCU. The driver does not
give the MCU enough time in two places: after releasing reset in probe,
and when waiting for the MCU to acknowledge a host control request.
Both can cause spurious failures.
Patch 1 waits 1s after reset release before the chip-ID read.
Patch 2 raises the host control request timeout from 25 ms to 250 ms.
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
Changes in v2:
- Patch 1: increase the post-reset wait from 700 ms to 1s.
- Patch 2: new, raise the host control request timeout to 250 ms.
- Link to v1: https://lore.kernel.org/r/20261006-upstream-it6625-reset-delay-v1-1-e4cb3c74e6d3@ite.com.tw
---
Hermes Wu (2):
media: i2c: it6625: wait 1s after reset release
media: i2c: it6625: allow 250 ms for host control requests to complete
drivers/media/i2c/it6625.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
---
base-commit: 89a3d2a2237e017cdbefcb036db71ce74e67faf5
change-id: 20261006-upstream-it6625-reset-delay-3239507c5f09
Best regards,
--
Hermes Wu <Hermes.wu@ite.com.tw>
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v2 1/2] media: i2c: it6625: wait 1s after reset release 2026-10-07 10:31 [PATCH v2 0/2] media: i2c: it6625: fix MCU reset and host control timing Hermes Wu via B4 Relay @ 2026-10-07 10:31 ` Hermes Wu via B4 Relay 2026-10-07 10:31 ` [PATCH v2 2/2] media: i2c: it6625: allow 250 ms for host control requests to complete Hermes Wu via B4 Relay 1 sibling, 0 replies; 3+ messages in thread From: Hermes Wu via B4 Relay @ 2026-10-07 10:31 UTC (permalink / raw) To: Hermes Wu, Mauro Carvalho Chehab, Hans Verkuil Cc: linux-media, linux-kernel, Hermes Wu From: Hermes Wu <Hermes.wu@ite.com.tw> The IT6625/IT6626 are controlled through an on-chip MCU, which needs up to 1s after the reset line is released before it boots and answers on the I2C interface. The probe path only waits 10 ms before reading the chip ID, so the read can happen before the MCU is up and probe then fails. Wait 1s after releasing reset. Fixes: 142e5f00bd57 ("media: i2c: add driver for ITE IT6625/IT6626") Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw> --- drivers/media/i2c/it6625.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index b74df9dbf8c2cab7461c69bc0f926141ed7a506c..fc8b22cc1c9ba3612f9c55bea1de61fa9a9c0e84 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -2260,7 +2260,8 @@ static int it6625_probe(struct i2c_client *client) if (it6625->reset_gpio) { usleep_range(1000, 2000); gpiod_set_value_cansleep(it6625->reset_gpio, 0); - usleep_range(10000, 11000); + /* the MCU needs up to 1s to boot after reset release */ + msleep(1000); } err = it6625_regmap_i2c_init(client, it6625); -- 2.34.1 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] media: i2c: it6625: allow 250 ms for host control requests to complete 2026-10-07 10:31 [PATCH v2 0/2] media: i2c: it6625: fix MCU reset and host control timing Hermes Wu via B4 Relay 2026-10-07 10:31 ` [PATCH v2 1/2] media: i2c: it6625: wait 1s after reset release Hermes Wu via B4 Relay @ 2026-10-07 10:31 ` Hermes Wu via B4 Relay 1 sibling, 0 replies; 3+ messages in thread From: Hermes Wu via B4 Relay @ 2026-10-07 10:31 UTC (permalink / raw) To: Hermes Wu, Mauro Carvalho Chehab, Hans Verkuil Cc: linux-media, linux-kernel, Hermes Wu From: Hermes Wu <Hermes.wu@ite.com.tw> Host requests to the on-chip MCU (commands, config updates, info-block bank switches, CEC transmits) are acknowledged by the MCU clearing REG_HOST_CTRL_INT. While the MCU is busy handling the HDMI input, this can take up to 150 ms, but the driver only polls for 25 ms. The request then times out even though the MCU completes it shortly after, and the caller fails or continues with stale state. Raise the timeout for all host control requests to 250 ms, which covers the worst case with some margin, using a single named constant instead of the open-coded value. Fixes: 142e5f00bd57 ("media: i2c: add driver for ITE IT6625/IT6626") Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw> --- drivers/media/i2c/it6625.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index fc8b22cc1c9ba3612f9c55bea1de61fa9a9c0e84..58d58d40035547e85a7f868777b57276a90a9d93 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -212,6 +212,11 @@ MODULE_PARM_DESC(debug, "debug level (0-3)"); #define B_CEC_SEND_DATA BIT(5) #define B_CONFIG_UPDATE BIT(6) #define B_IF_BANK BIT(7) +/* + * The MCU can take up to 150 ms to clear REG_HOST_CTRL_INT while it is + * busy handling the HDMI input; allow 250 ms to leave some margin. + */ +#define IT6625_HOST_CTRL_TIMEOUT_MS 250 #define REG_MCU_INTERRUPT 0xFF #define B_SYS_INT_ACTIVE BIT(0) @@ -530,7 +535,8 @@ static void it6625_write_command(struct it6625 *it6625, u8 *cmds, int cmd_len) { it6625_write_bytes(it6625, REG_CMD_SET, cmds, cmd_len); it6625_write_byte(it6625, REG_HOST_CTRL_INT, B_CMD_SET); - it6625_wait_for_status(it6625, REG_HOST_CTRL_INT, 0x00, 25); + it6625_wait_for_status(it6625, REG_HOST_CTRL_INT, 0x00, + IT6625_HOST_CTRL_TIMEOUT_MS); } static int it6625_update_config(struct it6625 *it6625) @@ -542,7 +548,8 @@ static int it6625_update_config(struct it6625 *it6625) if (err < 0) return err; - return it6625_wait_for_status(it6625, REG_HOST_CTRL_INT, 0x00, 25); + return it6625_wait_for_status(it6625, REG_HOST_CTRL_INT, 0x00, + IT6625_HOST_CTRL_TIMEOUT_MS); } static int it6625_set_bank(struct it6625 *it6625, u8 bank) @@ -557,7 +564,8 @@ static int it6625_set_bank(struct it6625 *it6625, u8 bank) if (err < 0) return err; - return it6625_wait_for_status(it6625, REG_HOST_CTRL_INT, 0x00, 25); + return it6625_wait_for_status(it6625, REG_HOST_CTRL_INT, 0x00, + IT6625_HOST_CTRL_TIMEOUT_MS); } static inline bool is_hdmi(struct it6625 *it6625) @@ -1027,7 +1035,8 @@ static int it6625_initial_setup(struct it6625 *it6625) if (err) return err; - return it6625_wait_for_status(it6625, REG_HOST_CTRL_INT, 0x00, 25); + return it6625_wait_for_status(it6625, REG_HOST_CTRL_INT, 0x00, + IT6625_HOST_CTRL_TIMEOUT_MS); } static int it6625_cec_adap_enable(struct cec_adapter *adap, bool enable) @@ -1084,7 +1093,8 @@ static int it6625_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, it6625_write_bytes(it6625, REG_CEC_TX_DATA, msg->msg, msg->len); it6625_write_byte(it6625, REG_CEC_TX_DATA_LEN, msg->len); it6625_set_bits(it6625, REG_HOST_CTRL_INT, B_CEC_SEND_DATA, B_CEC_SEND_DATA); - it6625_wait_for_status(it6625, REG_HOST_CTRL_INT, 0x00, 25); + it6625_wait_for_status(it6625, REG_HOST_CTRL_INT, 0x00, + IT6625_HOST_CTRL_TIMEOUT_MS); return 0; } -- 2.34.1 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-07 10:31 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-10-07 10:31 [PATCH v2 0/2] media: i2c: it6625: fix MCU reset and host control timing Hermes Wu via B4 Relay 2026-10-07 10:31 ` [PATCH v2 1/2] media: i2c: it6625: wait 1s after reset release Hermes Wu via B4 Relay 2026-10-07 10:31 ` [PATCH v2 2/2] media: i2c: it6625: allow 250 ms for host control requests to complete Hermes Wu via B4 Relay
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®