public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jerome Anand <jerome.anand@intel.com>
Cc: tiwai@suse.de, intel-gfx@lists.freedesktop.org,
	broonie@opensource.wolfsonmicro.com
Subject: Re: [RFC PATCH v2 4/8] drm/i915: Add support for enabling/disabling hdmi audio interrupts
Date: Tue, 11 Oct 2016 12:18:32 +0300	[thread overview]
Message-ID: <20161011091832.GO4329@intel.com> (raw)
In-Reply-To: <20161001002242.31025-5-jerome.anand@intel.com>

On Sat, Oct 01, 2016 at 05:52:38AM +0530, Jerome Anand wrote:
> API definitions for enabling/disabling hdmi audio interrupts in
> different hdmi pipes are implemented.
> 
> Signed-off-by: Jerome Anand <jerome.anand@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_irq.c  | 69 ++++++++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/intel_drv.h |  2 ++
>  2 files changed, 71 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index d8f515f..1e3663f 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -2867,6 +2867,67 @@ static void gen8_disable_vblank(struct drm_device *dev, unsigned int pipe)
>  	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
>  }
>  
> +/* Added for HDMI Audio */
> +int i915_enable_hdmi_audio_int(struct drm_i915_private *dev_priv)
> +{
> +	unsigned long irqflags;
> +	u32 imr, int_bit;
> +	int pipe = -1;
> +
> +	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
> +
> +	imr = I915_READ(VLV_IMR);
> +
> +	if (IS_CHERRYVIEW(&dev_priv->drm)) {
> +		pipe = PIPE_C;
> +		int_bit = (pipe ? (I915_LPE_PIPE_B_INTERRUPT >>
> +					((pipe - 1) * 9)) :
> +					I915_LPE_PIPE_A_INTERRUPT);

Either parametrize the I915_LPE_PIPE_INTERRUPT macro, or just have eg. a
switch here.

But the bigger issue here is the mess with selecting the right bit. I
assume it should either depend on the pipe or port. I can't figure out
what is going on here.

And actually I don't understand why we even need this function. The
irqchip should take care to unmask all the interrupts when the audio
device does its request_irq.

> +		imr &= ~int_bit;
> +	} else {
> +		/* Audio is on Stream A but uses HDMI PIPE B */
> +		pipe = PIPE_B;
> +		imr &= ~I915_LPE_PIPE_B_INTERRUPT;
> +	}
> +
> +	I915_WRITE(VLV_IMR, imr);
> +	I915_WRITE(VLV_IER, ~imr);
> +	POSTING_READ(VLV_IER);
> +	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
> +
> +	return 0;
> +}
> +
> +/* Added for HDMI Audio */
> +int i915_disable_hdmi_audio_int(struct drm_i915_private *dev_priv)
> +{
> +	unsigned long irqflags;
> +	u32 imr, int_bit;
> +	int pipe = -1;
> +
> +	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
> +	imr = I915_READ(VLV_IMR);
> +
> +	if (IS_CHERRYVIEW(&dev_priv->drm)) {
> +		pipe = PIPE_C;
> +		int_bit = (pipe ? (I915_LPE_PIPE_B_INTERRUPT >>
> +					((pipe - 1) * 9)) :
> +					I915_LPE_PIPE_A_INTERRUPT);
> +		imr |= int_bit;
> +	} else {
> +		pipe = PIPE_B;
> +		imr |= I915_LPE_PIPE_B_INTERRUPT;
> +	}
> +
> +	I915_WRITE(VLV_IER, ~imr);
> +	I915_WRITE(VLV_IMR, imr);
> +	POSTING_READ(VLV_IMR);
> +
> +	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
> +
> +	return 0;
> +}
> +
>  static bool
>  ipehr_is_semaphore_wait(struct intel_engine_cs *engine, u32 ipehr)
>  {
> @@ -3364,6 +3425,14 @@ static void vlv_display_irq_postinstall(struct drm_i915_private *dev_priv)
>  
>  	WARN_ON(dev_priv->irq_mask != ~0);
>  
> +	if (IS_LPE_AUDIO_ENABLED(dev_priv)) {
> +		u32 val = (I915_LPE_PIPE_A_INTERRUPT |
> +			I915_LPE_PIPE_B_INTERRUPT |
> +			I915_LPE_PIPE_C_INTERRUPT);

'val' seems like a rather pointless local variable.

> +
> +		enable_mask |= val;
> +	}
> +
>  	dev_priv->irq_mask = ~enable_mask;
>  
>  	GEN5_IRQ_INIT(VLV_, dev_priv->irq_mask, enable_mask);
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 30e3f49..e6504ea 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1116,6 +1116,8 @@ void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv);
>  u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask);
>  void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv);
>  void intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv);
> +int i915_enable_hdmi_audio_int(struct drm_i915_private *dev_priv);
> +int i915_disable_hdmi_audio_int(struct drm_i915_private *dev_priv);
>  static inline bool intel_irqs_enabled(struct drm_i915_private *dev_priv)
>  {
>  	/*
> -- 
> 2.9.3

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-10-11  9:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-01  0:22 [RFC PATCH v2 0/8] Add support for Legacy Hdmi audio Jerome Anand
2016-10-01  0:22 ` [RFC PATCH v2 1/8] drm/i915: setup bridge for HDMI LPE audio driver Jerome Anand
2016-10-11  9:15   ` Ville Syrjälä
2016-10-13 19:38     ` Pierre-Louis Bossart
2016-10-14  9:10       ` Ville Syrjälä
2016-10-14 13:50         ` Jani Nikula
2016-10-17  6:46   ` Daniel Vetter
2016-10-01  0:22 ` [RFC PATCH v2 2/8] ALSA: add shell for Intel " Jerome Anand
2016-10-01  0:22 ` [RFC PATCH v2 3/8] ALSA: Add support for hdmi " Jerome Anand
2016-10-01  0:22 ` [RFC PATCH v2 4/8] drm/i915: Add support for enabling/disabling hdmi audio interrupts Jerome Anand
2016-10-11  9:18   ` Ville Syrjälä [this message]
2016-10-13 19:41     ` Pierre-Louis Bossart
2016-10-01  0:22 ` [RFC PATCH v2 5/8] drm/i915: Add support for audio driver notifications Jerome Anand
2016-10-01  0:22 ` [RFC PATCH v2 6/8] hdmi_audio: Improve position reporting Using a hw register to calculate sub-period position reports Jerome Anand
2016-10-01  0:22 ` [RFC PATCH v2 7/8] hdmi_audio: Fixup some monitor Jerome Anand
2016-10-01  0:22 ` [RFC PATCH v2 8/8] hdmi_audio: continue audio playback even when display resolution changes Jerome Anand
2016-10-12 18:49 ` ✗ Fi.CI.BAT: warning for Add support for Legacy Hdmi audio Patchwork
2016-10-12 18:59   ` Saarinen, Jani
2016-11-03 23:01 ` [RFC PATCH v2 0/8] " Daniel Vetter
2016-11-07  6:42   ` Pierre-Louis Bossart
2016-11-09 13:19     ` Mark Brown
2016-11-10 16:35       ` Pierre-Louis Bossart
2016-11-11 15:14         ` Mark Brown

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=20161011091832.GO4329@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jerome.anand@intel.com \
    --cc=tiwai@suse.de \
    /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