All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/cnl: Enable Audio Pin Buffer.
@ 2018-02-08  0:31 Rodrigo Vivi
  2018-02-08  0:37 ` Rodrigo Vivi
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Rodrigo Vivi @ 2018-02-08  0:31 UTC (permalink / raw)
  To: intel-gfx; +Cc: Jani Nikula, Sanyog Kale, Guneshwor Singh, Rodrigo Vivi

Starting on CNL, we need to enable Audio Pin Buffer.

v4: Throw the exclusive hook and everything else away
    and add set/unset bit along with codec awake.

Based on few spec links that I was checking recently
I now believe that on CNL we also need to keep the codec
awake chicken bit along with PG2 enable and also add
this extra pin buffer enable.

BSpec: 18057
BSpec: 21352
BSpec: 19621

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Sanyog Kale <sanyog.r.kale@intel.com>
Cc: Guneshwor Singh <guneshwor.o.singh@intel.com>
Cc: Abhay Kumar <abhay.kumar@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_reg.h    |  3 +++
 drivers/gpu/drm/i915/intel_audio.c | 11 ++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 65ba10ad1fe5..768e784ea241 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -8424,6 +8424,9 @@ enum {
 #define HSW_AUD_CHICKENBIT			_MMIO(0x65f10)
 #define   SKL_AUD_CODEC_WAKE_SIGNAL		(1 << 15)
 
+#define AUDIO_PIN_BUF_CTL			_MMIO(0x48414)
+#define  AUDIO_PIN_BUF_ENABLE			(1 << 31)
+
 /* HSW Power Wells */
 #define _HSW_PWR_WELL_CTL1			0x45400
 #define _HSW_PWR_WELL_CTL2			0x45404
diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
index 522d54fecb53..34f18322c9bd 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -729,11 +729,20 @@ static void i915_audio_component_codec_wake_override(struct device *kdev,
 	struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
 	u32 tmp;
 
-	if (!IS_GEN9_BC(dev_priv))
+	if (!IS_GEN9_BC(dev_priv) && !IS_CANNONLAKE(dev_priv))
 		return;
 
 	i915_audio_component_get_power(kdev);
 
+	if (IS_CANNONLAKE(dev_priv)) {
+		tmp = I915_READ(AUDIO_PIN_BUF_CTL);
+		if (enable)
+			tmp |= AUDIO_PIN_BUF_ENABLE;
+		else
+			tmp &= ~AUDIO_PIN_BUF_ENABLE;
+		I915_WRITE(AUDIO_PIN_BUF_CTL, tmp);
+	}
+
 	/*
 	 * Enable/disable generating the codec wake signal, overriding the
 	 * internal logic to generate the codec wake to controller.
-- 
2.13.6

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] drm/i915/cnl: Enable Audio Pin Buffer.
@ 2017-07-06 21:03 Rodrigo Vivi
  2017-08-16 23:46 ` Pandiyan, Dhinakaran
  0 siblings, 1 reply; 10+ messages in thread
From: Rodrigo Vivi @ 2017-07-06 21:03 UTC (permalink / raw)
  To: intel-gfx; +Cc: Jani Nikula, Sanyog Kale, Dhinakaran Pandiyan, Rodrigo Vivi

Starting on CNL, we need to enable Audio Pin Buffer.

By the spec it seems that this is part of audio programming,
so let's give them the hability to set/unset this as needed.

v2: With a hook so audio driver can control it.
v3: Put back reg definition lost on v2.

Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Sanyog Kale <sanyog.r.kale@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_reg.h    |  3 +++
 drivers/gpu/drm/i915/intel_audio.c | 16 ++++++++++++++++
 include/drm/i915_component.h       |  6 ++++++
 3 files changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 64cc674..aab38da 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2643,6 +2643,9 @@ enum skl_disp_power_wells {
 #define I915_HDMI_LPE_AUDIO_BASE	(VLV_DISPLAY_BASE + 0x65000)
 #define I915_HDMI_LPE_AUDIO_SIZE	0x1000
 
+#define AUDIO_PIN_BUF_CTL		_MMIO(0x48414)
+#define AUDIO_PIN_BUF_ENABLE		(1 << 31)
+
 /* DisplayPort Audio w/ LPE */
 #define VLV_AUD_CHICKEN_BIT_REG		_MMIO(VLV_DISPLAY_BASE + 0x62F38)
 #define VLV_CHICKEN_BIT_DBG_ENABLE	(1 << 0)
diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
index d805b6e..0c83254 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -865,6 +865,21 @@ static int i915_audio_component_get_eld(struct device *kdev, int port,
 	return ret;
 }
 
+static void i915_audio_component_pin_buf(struct device *kdev, bool enable)
+{
+	struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
+
+	if (!IS_CANNONLAKE(dev_priv))
+		return;
+
+	if (enable)
+		I915_WRITE(AUDIO_PIN_BUF_CTL, I915_READ(AUDIO_PIN_BUF_CTL) |
+			   AUDIO_PIN_BUF_ENABLE);
+	else
+		I915_WRITE(AUDIO_PIN_BUF_CTL, I915_READ(AUDIO_PIN_BUF_CTL) &
+			   ~AUDIO_PIN_BUF_ENABLE);
+}
+
 static const struct i915_audio_component_ops i915_audio_component_ops = {
 	.owner		= THIS_MODULE,
 	.get_power	= i915_audio_component_get_power,
@@ -873,6 +888,7 @@ static int i915_audio_component_get_eld(struct device *kdev, int port,
 	.get_cdclk_freq	= i915_audio_component_get_cdclk_freq,
 	.sync_audio_rate = i915_audio_component_sync_audio_rate,
 	.get_eld	= i915_audio_component_get_eld,
+	.pin_buf	= i915_audio_component_pin_buf,
 };
 
 static int i915_audio_component_bind(struct device *i915_kdev,
diff --git a/include/drm/i915_component.h b/include/drm/i915_component.h
index 545c6e0..b8875d4 100644
--- a/include/drm/i915_component.h
+++ b/include/drm/i915_component.h
@@ -79,6 +79,12 @@ struct i915_audio_component_ops {
 	 */
 	int (*get_eld)(struct device *, int port, int pipe, bool *enabled,
 		       unsigned char *buf, int max_bytes);
+	/**
+	 * @pin_buf: Enable or disable pin buffer.
+	 *
+	 * Allow audio driver the toggle pin buffer.
+	 */
+	void (*pin_buf)(struct device *, bool enable);
 };
 
 /**
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2018-02-08  7:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-08  0:31 [PATCH] drm/i915/cnl: Enable Audio Pin Buffer Rodrigo Vivi
2018-02-08  0:37 ` Rodrigo Vivi
2018-02-08  4:55   ` Guneshwor Singh
2018-02-08  0:51 ` ✓ Fi.CI.BAT: success for drm/i915/cnl: Enable Audio Pin Buffer. (rev2) Patchwork
2018-02-08  7:46 ` ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2017-07-06 21:03 [PATCH] drm/i915/cnl: Enable Audio Pin Buffer Rodrigo Vivi
2017-08-16 23:46 ` Pandiyan, Dhinakaran
2017-08-17  3:56   ` Sanyog Kale
2017-08-17 18:55     ` Vivi, Rodrigo
2017-08-17 19:08       ` Pandiyan, Dhinakaran

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.