intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: enforce bitbanging for i2c
@ 2012-08-21  8:37 Daniel Vetter
  2012-08-21  9:03 ` Jani Nikula
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Vetter @ 2012-08-21  8:37 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Jani Nikula, Daniel Vetter, stable

Now that we have also have a workaround for crt to fallback to
bitbanging in some cases and then restore gmbus again, we need to
ensure that we don't try to enable gmbus on broken hw (like i830M).
Previously only sdvo had a bit-banging fallback, and sdvo is gen3+
only, so no issue with that.

Enforce this by tracking separately whether gmbus even could work.

This issue has been introduced in

commit f1a2f5b7c5f0941d23eef0a095c0b99bf8d051e6
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Mon Aug 13 13:22:35 2012 +0300

    drm/i915: fall back to bit-banging if GMBUS fails in CRT EDID
    reads

Found by code-inspection, no bug report afaik.

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_drv.h  |    1 +
 drivers/gpu/drm/i915/intel_i2c.c |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index a2382a1..365df4c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -382,6 +382,7 @@ struct intel_fbc_work;
 struct intel_gmbus {
 	struct i2c_adapter adapter;
 	bool force_bit;
+	bool always_bit;
 	u32 reg0;
 	u32 gpio_reg;
 	struct i2c_algo_bit_data bit_algo;
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index b9755f6..e79f316 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -492,7 +492,7 @@ int intel_setup_gmbus(struct drm_device *dev)
 
 		/* gmbus seems to be broken on i830 */
 		if (IS_I830(dev))
-			bus->force_bit = true;
+			bus->always_bit = bus->force_bit = true;
 
 		intel_gpio_setup(bus, port);
 
@@ -533,6 +533,9 @@ void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit)
 {
 	struct intel_gmbus *bus = to_intel_gmbus(adapter);
 
+	if (bus->always_bit)
+		force_bit = true;
+
 	bus->force_bit = force_bit;
 }
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915: enforce bitbanging for i2c
  2012-08-21  8:37 [PATCH] drm/i915: enforce bitbanging for i2c Daniel Vetter
@ 2012-08-21  9:03 ` Jani Nikula
  2012-08-21  9:07   ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Jani Nikula @ 2012-08-21  9:03 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, stable

On Tue, 21 Aug 2012, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Now that we have also have a workaround for crt to fallback to
> bitbanging in some cases and then restore gmbus again, we need to
> ensure that we don't try to enable gmbus on broken hw (like i830M).
> Previously only sdvo had a bit-banging fallback, and sdvo is gen3+
> only, so no issue with that.
>
> Enforce this by tracking separately whether gmbus even could work.
>
> This issue has been introduced in
>
> commit f1a2f5b7c5f0941d23eef0a095c0b99bf8d051e6
> Author: Jani Nikula <jani.nikula@intel.com>
> Date:   Mon Aug 13 13:22:35 2012 +0300
>
>     drm/i915: fall back to bit-banging if GMBUS fails in CRT EDID
>     reads
>
> Found by code-inspection, no bug report afaik.

I don't see how my patch could enable or try GMBUS if force_bit has been
set to true. On i830 the first attempt will be bit-banging, as before,
and there will be no fallback because bit-banging is already enabled.

I don't think this patch is necessary, but by all means prove me
wrong. ;)

BR,
Jani.

>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_drv.h  |    1 +
>  drivers/gpu/drm/i915/intel_i2c.c |    5 ++++-
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index a2382a1..365df4c 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -382,6 +382,7 @@ struct intel_fbc_work;
>  struct intel_gmbus {
>  	struct i2c_adapter adapter;
>  	bool force_bit;
> +	bool always_bit;
>  	u32 reg0;
>  	u32 gpio_reg;
>  	struct i2c_algo_bit_data bit_algo;
> diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
> index b9755f6..e79f316 100644
> --- a/drivers/gpu/drm/i915/intel_i2c.c
> +++ b/drivers/gpu/drm/i915/intel_i2c.c
> @@ -492,7 +492,7 @@ int intel_setup_gmbus(struct drm_device *dev)
>  
>  		/* gmbus seems to be broken on i830 */
>  		if (IS_I830(dev))
> -			bus->force_bit = true;
> +			bus->always_bit = bus->force_bit = true;
>  
>  		intel_gpio_setup(bus, port);
>  
> @@ -533,6 +533,9 @@ void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit)
>  {
>  	struct intel_gmbus *bus = to_intel_gmbus(adapter);
>  
> +	if (bus->always_bit)
> +		force_bit = true;
> +
>  	bus->force_bit = force_bit;
>  }
>  
> -- 
> 1.7.10.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915: enforce bitbanging for i2c
  2012-08-21  9:03 ` Jani Nikula
@ 2012-08-21  9:07   ` Daniel Vetter
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2012-08-21  9:07 UTC (permalink / raw)
  To: Jani Nikula; +Cc: Daniel Vetter, Intel Graphics Development, stable

On Tue, Aug 21, 2012 at 12:03:49PM +0300, Jani Nikula wrote:
> On Tue, 21 Aug 2012, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > Now that we have also have a workaround for crt to fallback to
> > bitbanging in some cases and then restore gmbus again, we need to
> > ensure that we don't try to enable gmbus on broken hw (like i830M).
> > Previously only sdvo had a bit-banging fallback, and sdvo is gen3+
> > only, so no issue with that.
> >
> > Enforce this by tracking separately whether gmbus even could work.
> >
> > This issue has been introduced in
> >
> > commit f1a2f5b7c5f0941d23eef0a095c0b99bf8d051e6
> > Author: Jani Nikula <jani.nikula@intel.com>
> > Date:   Mon Aug 13 13:22:35 2012 +0300
> >
> >     drm/i915: fall back to bit-banging if GMBUS fails in CRT EDID
> >     reads
> >
> > Found by code-inspection, no bug report afaik.
> 
> I don't see how my patch could enable or try GMBUS if force_bit has been
> set to true. On i830 the first attempt will be bit-banging, as before,
> and there will be no fallback because bit-banging is already enabled.
> 
> I don't think this patch is necessary, but by all means prove me
> wrong. ;)

Right, I've missed the is_force_bit check in intel_crt_get_edid, patch is
not required.

/me hides

Cheers, Daniel
-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-21  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-21  8:37 [PATCH] drm/i915: enforce bitbanging for i2c Daniel Vetter
2012-08-21  9:03 ` Jani Nikula
2012-08-21  9:07   ` Daniel Vetter

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).