All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerome Anand <jerome.anand@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: tiwai@suse.de, broonie@opensource.wolfsonmicro.com
Subject: [RFC PATCH v2 4/8] drm/i915: Add support for enabling/disabling hdmi audio interrupts
Date: Sat,  1 Oct 2016 05:52:38 +0530	[thread overview]
Message-ID: <20161001002242.31025-5-jerome.anand@intel.com> (raw)
In-Reply-To: <20161001002242.31025-1-jerome.anand@intel.com>

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);
+		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);
+
+		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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-10-12 16:27 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 ` Jerome Anand [this message]
2016-10-11  9:18   ` [RFC PATCH v2 4/8] drm/i915: Add support for enabling/disabling hdmi audio interrupts Ville Syrjälä
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=20161001002242.31025-5-jerome.anand@intel.com \
    --to=jerome.anand@intel.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.