I had a plan to rework I2C handling a lot more,
than log the changes.

I wrote a patch that uses I2C IRQ.
I had a feeling that it worked well (with old single CPU desktop computer):
framerate with HDTV was low, but it was glitchless.

Do you want to have the patch to be sent for you?
I think that I solved in the patch "robust I2C command + exact IRQ response for 
that command",
so that those two will not get out of sync.

I tried to rework the patch to make a bit smaller patch,
but I couldn't test the new one: hardware is too broken.

Regards,
Marko

01.04.2012 18:53, Steinar H. Gunderson kirjoitti:
> From: "Steinar H. Gunderson" <se...@samfundet.no>
> 
> On I2C reads and writes, show if we had any timeouts in the debug output.
> 
> Signed-off-by: Steinar H. Gunderson <se...@samfundet.no>
> ---
>  drivers/media/dvb/mantis/mantis_i2c.c |   26 ++++++++++++++++++++++++--
>  1 file changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/dvb/mantis/mantis_i2c.c 
> b/drivers/media/dvb/mantis/mantis_i2c.c
> index e779451..ddd1922 100644
> --- a/drivers/media/dvb/mantis/mantis_i2c.c
> +++ b/drivers/media/dvb/mantis/mantis_i2c.c
> @@ -38,6 +38,7 @@
>  static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg 
> *msg)
>  {
>       u32 rxd, i, stat, trials;
> +     u32 timeouts = 0;
>  
>       dprintk(MANTIS_INFO, 0, "        %s:  Address=[0x%02x] <R>[ ",
>               __func__, msg->addr);
> @@ -60,6 +61,9 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const 
> struct i2c_msg *msg)
>                       if (stat & MANTIS_INT_I2CDONE)
>                               break;
>               }
> +             if (trials == TRIALS) {
> +                     ++timeouts;
> +             }
>  
>               dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials);
>  
> @@ -69,6 +73,9 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const 
> struct i2c_msg *msg)
>                       if (stat & MANTIS_INT_I2CRACK)
>                               break;
>               }
> +             if (trials == TRIALS) {
> +                     ++timeouts;
> +             }
>  
>               dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials);
>  
> @@ -76,7 +83,11 @@ static int mantis_i2c_read(struct mantis_pci *mantis, 
> const struct i2c_msg *msg)
>               msg->buf[i] = (u8)((rxd >> 8) & 0xFF);
>               dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]);
>       }
> -     dprintk(MANTIS_INFO, 0, "]\n");
> +     if (timeouts) {
> +             dprintk(MANTIS_INFO, 0, "] %d timeouts\n", timeouts);
> +     } else {
> +             dprintk(MANTIS_INFO, 0, "]\n");
> +     }
>  
>       return 0;
>  }
> @@ -85,6 +96,7 @@ static int mantis_i2c_write(struct mantis_pci *mantis, 
> const struct i2c_msg *msg
>  {
>       int i;
>       u32 txd = 0, stat, trials;
> +     u32 timeouts = 0;
>  
>       dprintk(MANTIS_INFO, 0, "        %s: Address=[0x%02x] <W>[ ",
>               __func__, msg->addr);
> @@ -108,6 +120,9 @@ static int mantis_i2c_write(struct mantis_pci *mantis, 
> const struct i2c_msg *msg
>                       if (stat & MANTIS_INT_I2CDONE)
>                               break;
>               }
> +             if (trials == TRIALS) {
> +                     ++timeouts;
> +             }
>  
>               dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials);
>  
> @@ -117,10 +132,17 @@ static int mantis_i2c_write(struct mantis_pci *mantis, 
> const struct i2c_msg *msg
>                       if (stat & MANTIS_INT_I2CRACK)
>                               break;
>               }
> +             if (trials == TRIALS) {
> +                     ++timeouts;
> +             }
>  
>               dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials);
>       }
> -     dprintk(MANTIS_INFO, 0, "]\n");
> +     if (timeouts) {
> +             dprintk(MANTIS_INFO, 0, "] %d timeouts\n", timeouts);
> +     } else {
> +             dprintk(MANTIS_INFO, 0, "]\n");
> +     }
>  
>       return 0;
>  }

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to