Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>
Subject: Re: [PATCH 2/2] drm/i915/sdvo: restore i2c adapter config on intel_sdvo_init() failures
Date: Tue, 23 Oct 2012 13:01:41 +0300	[thread overview]
Message-ID: <87fw55wlq2.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <51e603fa921dec2b137d759a86c6169d26b461be.1350911444.git.jani.nikula@intel.com>

On Mon, 22 Oct 2012 16:12:18 +0300, Jani Nikula <jani.nikula@intel.com> wrote:
> SDVOB may be multiplexed with HDMIB. If it's not SDVOB, the same i2c
> adapter may be used for HDMIB, with the adjusted config (i.e. with GPIO
> bit-banging instead of gmbus). Restore i2c adapter config before error
> return from intel_sdvo_init(), letting HDMIB enjoy the joys of gmbus.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_sdvo.c |   15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index eab1277..6103cf6 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -2053,6 +2053,13 @@ intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv,
>  	intel_gmbus_force_bit(sdvo->i2c, true);
>  }
>  
> +/* undo any changes intel_sdvo_select_i2c_bus() did to sdvo->i2c */
> +static void
> +intel_sdvo_unselect_i2c_bus(struct intel_sdvo *sdvo)
> +{
> +	intel_gmbus_force_bit(sdvo->i2c, false);
> +}
> +
>  static bool
>  intel_sdvo_is_hdmi_connector(struct intel_sdvo *intel_sdvo, int device)
>  {
> @@ -2628,10 +2635,8 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
>  	intel_sdvo->is_sdvob = is_sdvob;
>  	intel_sdvo->slave_addr = intel_sdvo_get_slave_addr(dev, intel_sdvo) >> 1;
>  	intel_sdvo_select_i2c_bus(dev_priv, intel_sdvo, sdvo_reg);
> -	if (!intel_sdvo_init_ddc_proxy(intel_sdvo, dev)) {
> -		kfree(intel_sdvo);
> -		return false;
> -	}
> +	if (!intel_sdvo_init_ddc_proxy(intel_sdvo, dev))
> +		goto err_i2c_bus;
>  
>  	/* encoder type will be decided later */
>  	intel_encoder = &intel_sdvo->base;
> @@ -2716,6 +2721,8 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
>  err:
>  	drm_encoder_cleanup(&intel_encoder->base);
>  	i2c_del_adapter(&intel_sdvo->ddc);
> +err_i2c_bus:
> +	intel_sdvo_unselect_i2c_bus(intel_sdvo);
>  	kfree(intel_sdvo);
>  
>  	return false;
> -- 

Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>

      parent reply	other threads:[~2012-10-23 10:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 13:12 [PATCH 1/2] drm/i915/sdvo: force GPIO bit-banging also on default pin Jani Nikula
2012-10-22 13:12 ` [PATCH 2/2] drm/i915/sdvo: restore i2c adapter config on intel_sdvo_init() failures Jani Nikula
2012-10-23  9:40   ` Chris Wilson
2012-10-26  6:21     ` Jani Nikula
2012-10-26  8:27       ` Daniel Vetter
2012-10-23 10:01   ` Mika Kuoppala [this message]

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=87fw55wlq2.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.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