]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: si2168: Fix i2c command timeout on embedded platforms
authorBradford Love <brad@nextdimension.cc>
Thu, 12 Mar 2026 21:35:27 +0000 (16:35 -0500)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 17 Mar 2026 09:50:19 +0000 (10:50 +0100)
On many embedded platforms i2c responses through USB are not returned
as quickly, plus constantly banging on the i2c master receive essentially
deadlocks the driver. Inserting a 3ms delay between i2c receive calls
and extending the timeout fixes all tested platforms.

Signed-off-by: Bradford Love <brad@nextdimension.cc>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/dvb-frontends/si2168.c

index c4bbcd127caca83016ad148b85330fb8bff1b04c..b973d61c3720170607c4c402b541dbf1fbf682fe 100644 (file)
@@ -40,7 +40,7 @@ static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd)
 
        if (cmd->rlen) {
                /* wait cmd execution terminate */
-               #define TIMEOUT 70
+               #define TIMEOUT 140
                timeout = jiffies + msecs_to_jiffies(TIMEOUT);
                while (!time_after(jiffies, timeout)) {
                        ret = i2c_master_recv(client, cmd->args, cmd->rlen);
@@ -54,6 +54,8 @@ static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd)
                        /* firmware ready? */
                        if ((cmd->args[0] >> 7) & 0x01)
                                break;
+
+                       usleep_range(2500, 3500);
                }
 
                dev_dbg(&client->dev, "cmd execution took %d ms\n",