@@ -2632,6 +2632,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)
@@ -876,6 +876,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,
@@ -884,6 +899,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,
@@ -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);
};
/**
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: 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(+)