linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marko Ristola <marko.ristola@kolumbus.fi>
To: "Steinar H. Gunderson" <sgunderson@bigfoot.com>
Cc: linux-media@vger.kernel.org, "Steinar H. Gunderson" <sesse@samfundet.no>
Subject: Re: [PATCH 04/11] Show timeouts on I2C transfers.
Date: Wed, 04 Apr 2012 18:43:11 +0300	[thread overview]
Message-ID: <4F7C6C0F.3010803@kolumbus.fi> (raw)
In-Reply-To: <1333295631-31866-4-git-send-email-sgunderson@bigfoot.com>


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" <sesse@samfundet.no>
> 
> On I2C reads and writes, show if we had any timeouts in the debug output.
> 
> Signed-off-by: Steinar H. Gunderson <sesse@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;
>  }


  reply	other threads:[~2012-04-04 15:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-01 15:53 [PATCH] Various fixes, hacks and patches for Mantis CA support Steinar H. Gunderson
2012-04-01 15:53 ` [PATCH 01/11] Don't reset IRQ0 if it's not already set Steinar H. Gunderson
2012-04-01 15:53 ` [PATCH 02/11] Clear out MANTIS_INT_RISCSTAT when printing status bits Steinar H. Gunderson
2012-04-01 15:53 ` [PATCH 03/11] Hack to fix a mutex issue in the DVB layer Steinar H. Gunderson
2012-04-11  2:17   ` Mauro Carvalho Chehab
2012-04-01 15:53 ` [PATCH 04/11] Show timeouts on I2C transfers Steinar H. Gunderson
2012-04-04 15:43   ` Marko Ristola [this message]
2012-04-04 16:32     ` Steinar H. Gunderson
2012-04-01 15:53 ` [PATCH 05/11] Slightly more friendly debugging output Steinar H. Gunderson
2012-04-01 15:53 ` [PATCH 06/11] Replace ca_lock by a slightly more general int_stat_lock Steinar H. Gunderson
2012-04-01 15:53 ` [PATCH 07/11] Fix a ton of SMP-unsafe accesses Steinar H. Gunderson
2012-04-01 15:53 ` [PATCH 08/11] Remove some unused structure members Steinar H. Gunderson
2012-04-01 15:53 ` [PATCH 09/11] Correct wait_event_timeout error return check Steinar H. Gunderson
2012-04-01 15:53 ` [PATCH 10/11] Ignore timeouts waiting for the IRQ0 flag Steinar H. Gunderson
2012-04-01 15:53 ` [PATCH 11/11] Enable Mantis CA support Steinar H. Gunderson
2012-04-18 18:38 ` [PATCH] Various fixes, hacks and patches for " Ninja
2012-04-18 18:53   ` Steinar H. Gunderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F7C6C0F.3010803@kolumbus.fi \
    --to=marko.ristola@kolumbus.fi \
    --cc=linux-media@vger.kernel.org \
    --cc=sesse@samfundet.no \
    --cc=sgunderson@bigfoot.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).