[1/4] drm/i915: Actually retry with bit-banging after GMBUS timeout

Submitted by Ville Syrjala on March 7, 2016, 3:56 p.m.

Details

Message ID 1457366220-29409-2-git-send-email-ville.syrjala@linux.intel.com
State Accepted
Commit 8b1f165a4a8f64c28cf42d10e1f4d3b451dedc51
Headers show
Series "drm/i915: GMBUS fixes and whatnot" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Ville Syrjala March 7, 2016, 3:56 p.m.
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

After the GMBUS transfer times out, we set force_bit=1 and
return -EAGAIN expecting the i2c core to call the .master_xfer
hook again so that we will retry the same transfer via bit-banging.
This is in case the gmbus hardware is somehow faulty.

Unfortunately we left adapter->retries to 0, meaning the i2c core
didn't actually do the retry. Let's tell the core we want one retry
when we return -EAGAIN.

Note that i2c-algo-bit also uses this retry count for some internal
retries, so we'll end up increasing those a bit as well.

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: drm-intel-fixes@lists.freedesktop.org
Fixes: bffce907d640 ("drm/i915: abstract i2c bit banging fallback in gmbus xfer")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_i2c.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index deb8282c26d8..52fbe530fc9e 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -664,6 +664,12 @@  int intel_setup_gmbus(struct drm_device *dev)
 
 		bus->adapter.algo = &gmbus_algorithm;
 
+		/*
+		 * We wish to retry with bit banging
+		 * after a timed out GMBUS attempt.
+		 */
+		bus->adapter.retries = 1;
+
 		/* By default use a conservative clock rate */
 		bus->reg0 = pin | GMBUS_RATE_100KHZ;
 

Comments

On Mon, 07 Mar 2016, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> After the GMBUS transfer times out, we set force_bit=1 and
> return -EAGAIN expecting the i2c core to call the .master_xfer
> hook again so that we will retry the same transfer via bit-banging.
> This is in case the gmbus hardware is somehow faulty.
>
> Unfortunately we left adapter->retries to 0, meaning the i2c core
> didn't actually do the retry. Let's tell the core we want one retry
> when we return -EAGAIN.
>
> Note that i2c-algo-bit also uses this retry count for some internal
> retries, so we'll end up increasing those a bit as well.

I think I must have confused this with the dp aux i2c adapter retries
which does get initialized to 3. Meh.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: drm-intel-fixes@lists.freedesktop.org
> Fixes: bffce907d640 ("drm/i915: abstract i2c bit banging fallback in gmbus xfer")
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_i2c.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
> index deb8282c26d8..52fbe530fc9e 100644
> --- a/drivers/gpu/drm/i915/intel_i2c.c
> +++ b/drivers/gpu/drm/i915/intel_i2c.c
> @@ -664,6 +664,12 @@ int intel_setup_gmbus(struct drm_device *dev)
>  
>  		bus->adapter.algo = &gmbus_algorithm;
>  
> +		/*
> +		 * We wish to retry with bit banging
> +		 * after a timed out GMBUS attempt.
> +		 */
> +		bus->adapter.retries = 1;
> +
>  		/* By default use a conservative clock rate */
>  		bus->reg0 = pin | GMBUS_RATE_100KHZ;
On Mon, Mar 07, 2016 at 07:06:37PM +0200, Jani Nikula wrote:
> On Mon, 07 Mar 2016, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > After the GMBUS transfer times out, we set force_bit=1 and
> > return -EAGAIN expecting the i2c core to call the .master_xfer
> > hook again so that we will retry the same transfer via bit-banging.
> > This is in case the gmbus hardware is somehow faulty.
> >
> > Unfortunately we left adapter->retries to 0, meaning the i2c core
> > didn't actually do the retry. Let's tell the core we want one retry
> > when we return -EAGAIN.
> >
> > Note that i2c-algo-bit also uses this retry count for some internal
> > retries, so we'll end up increasing those a bit as well.
> 
> I think I must have confused this with the dp aux i2c adapter retries
> which does get initialized to 3. Meh.
> 
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>

Patch pushed to dinq. Thanks for the review.

> 
> >
> > Cc: Jani Nikula <jani.nikula@intel.com>
> > Cc: drm-intel-fixes@lists.freedesktop.org
> > Fixes: bffce907d640 ("drm/i915: abstract i2c bit banging fallback in gmbus xfer")
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_i2c.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
> > index deb8282c26d8..52fbe530fc9e 100644
> > --- a/drivers/gpu/drm/i915/intel_i2c.c
> > +++ b/drivers/gpu/drm/i915/intel_i2c.c
> > @@ -664,6 +664,12 @@ int intel_setup_gmbus(struct drm_device *dev)
> >  
> >  		bus->adapter.algo = &gmbus_algorithm;
> >  
> > +		/*
> > +		 * We wish to retry with bit banging
> > +		 * after a timed out GMBUS attempt.
> > +		 */
> > +		bus->adapter.retries = 1;
> > +
> >  		/* By default use a conservative clock rate */
> >  		bus->reg0 = pin | GMBUS_RATE_100KHZ;
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center