Skip to contentSkip to conversation

drm/i915/cnl: Enable Audio Pin Buffer.

PATCH In review Rodrigo Vivi 4 participants 6 messages Jul 6, 2017 – Aug 17, 2017

Subsystems (2)
lore
Share & tools
lore

Rodrigo Vivi

author maintainer
#0 lore raw

PATCH 1/1 drm/i915/cnl: Enable Audio Pin Buffer.

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 <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sanyog Kale <[email protected]>
---
 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(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 64cc674..aab38da 100644
@@ -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)
drivers/gpu/drm/i915/intel_audio.c +16 -0
index d805b6e..0c83254 100644
@@ -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,
include/drm/i915_component.h +6 -0
index 545c6e0..b8875d4 100644
@@ -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);
 };
 
 /**
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for drm/i915/cnl: Enable Audio Pin Buffer.

== Series Details ==

== Series Details ==

Series: drm/i915/cnl: Enable Audio Pin Buffer.
URL : https://patchwork.freedesktop.org/series/26954/
State : success

== Summary ==

Series 26954v1 drm/i915/cnl: Enable Audio Pin Buffer.
https://patchwork.freedesktop.org/api/1.0/series/26954/revisions/1/mbox/

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7560u) fdo#100125 +1
Test kms_force_connector_basic:
        Subgroup force-connector-state:
                skip       -> PASS       (fi-ivb-3520m) fdo#101048 +3
Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-a:
                dmesg-warn -> PASS       (fi-pnv-d510) fdo#101597 +1
        Subgroup suspend-read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-byt-j1900) fdo#101705

fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fdo#101048 https://bugs.freedesktop.org/show_bug.cgi?id=101048
fdo#101597 https://bugs.freedesktop.org/show_bug.cgi?id=101597
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:450s
fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:427s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:352s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:523s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:513s
fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:489s
fi-byt-n2820     total:279  pass:250  dwarn:1   dfail:0   fail:0   skip:28  time:487s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:590s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:437s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:416s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:421s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:489s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:481s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:459s
fi-kbl-7560u     total:279  pass:268  dwarn:1   dfail:0   fail:0   skip:10  time:576s
fi-kbl-r         total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:582s
fi-pnv-d510      total:279  pass:223  dwarn:1   dfail:0   fail:0   skip:55  time:562s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:456s
fi-skl-6700hq    total:279  pass:262  dwarn:0   dfail:0   fail:0   skip:17  time:582s
fi-skl-6700k     total:279  pass:257  dwarn:4   dfail:0   fail:0   skip:18  time:468s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:482s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:437s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:540s
fi-snb-2600      total:279  pass:250  dwarn:0   dfail:0   fail:0   skip:29  time:404s

2132c198e6afd4ed75e89eee86c40c7def49c1dc drm-tip: 2017y-07m-06d-20h-24m-04s UTC integration manifest 35df82f4 drm/i915/cnl: Enable Audio Pin Buffer.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_5134/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Rodrigo Vivi
Quoted 3 lines · Rodrigo Vivi

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

By the spec it seems that this is part of audio programming,

I am not very clear where the pin buffer enabling/disabling step falls in the audio programming sequence. From what I understand, audio codec enable/disable is controlled by i915, if pin buffer enable/disable is part of that, then we don't need a call back. It's difficult to know where this function is going to be used without seeing the audio driver patch that makes of use of this.

Quoted 1 line

so let's give them the hability to set/unset this as needed.

typo s/hability/ability

Quoted 33 lines

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

Cc Dhinakaran Pandiyan <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sanyog Kale <[email protected]>
---
 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(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 64cc674..aab38da 100644
@@ -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)
drivers/gpu/drm/i915/intel_audio.c +0 -0
index d805b6e..0c83254 100644

drivers/gpu/drm/i915/intel_audio.c static int i915_audio_component_get_eld(struct device *kdev, int port, · line 869

Quoted 5 lines
drivers/gpu/drm/i915/intel_audio.c +2 -0
@@ -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)
+{

Does it matter whether the audio codec is enabled or disabled when this call comes in? i.e., do we need some sort of check here? Or do we assume the audio driver knows exactly when to enable or disable pin buffer?

drivers/gpu/drm/i915/intel_audio.c static int i915_audio_component_get_eld(struct device *kdev, int port, · line 872

Quoted 3 lines
drivers/gpu/drm/i915/intel_audio.c +3 -0
+	struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
+
+	if (!IS_CANNONLAKE(dev_priv))

Should this be a INTEL_GEN() < 10 since the register is gen10+? I am not particular about either of the options.

Quoted 28 lines
drivers/gpu/drm/i915/intel_audio.c +11 -0
+		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,
include/drm/i915_component.h +0 -0
index 545c6e0..b8875d4 100644
@@ -79,6 +79,12 @@ struct i915_audio_component_ops {
 	 */
 	int (*get_eld)(struct device *, int port, int pipe, bool *enabled,

include/drm/i915_component.h struct i915_audio_component_ops { · line 90

Quoted 10 lines
include/drm/i915_component.h +6 -0
 		       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);
 };
 
 /**

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 12 lines · Dhinakaran
Quoted 3 lines · Rodrigo Vivi

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

By the spec it seems that this is part of audio programming,

I am not very clear where the pin buffer enabling/disabling step falls in the audio programming sequence. From what I understand, audio codec enable/disable is controlled by i915, if pin buffer enable/disable is part of that, then we don't need a call back. It's difficult to know where this function is going to be used without seeing the audio driver patch that makes of use of this.

From audio point of view, we are working on correct sequence where this ops will be called. However during CNL Power-ON we enabled the pin buf using ops as part of azx_reset.

Quoted 93 lines
Quoted 1 line

so let's give them the hability to set/unset this as needed.

typo s/hability/ability

Quoted 33 lines

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

Cc Dhinakaran Pandiyan <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sanyog Kale <[email protected]>
---
 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(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 64cc674..aab38da 100644
@@ -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)
drivers/gpu/drm/i915/intel_audio.c +0 -0
index d805b6e..0c83254 100644

drivers/gpu/drm/i915/intel_audio.c static int i915_audio_component_get_eld(struct device *kdev, int port, · line 869

Quoted 5 lines
drivers/gpu/drm/i915/intel_audio.c +2 -0
@@ -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)
+{

Does it matter whether the audio codec is enabled or disabled when this call comes in? i.e., do we need some sort of check here? Or do we assume the audio driver knows exactly when to enable or disable pin buffer?

drivers/gpu/drm/i915/intel_audio.c static int i915_audio_component_get_eld(struct device *kdev, int port, · line 872

Quoted 3 lines
drivers/gpu/drm/i915/intel_audio.c +3 -0
+	struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
+
+	if (!IS_CANNONLAKE(dev_priv))

Should this be a INTEL_GEN() < 10 since the register is gen10+? I am not particular about either of the options.

Quoted 38 lines
drivers/gpu/drm/i915/intel_audio.c +11 -0
+		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,
include/drm/i915_component.h +6 -0
index 545c6e0..b8875d4 100644
@@ -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);
 };
 
 /**
Signature · 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#4 lore raw
Quoted 4 lines · Sanyog Kale
Quoted 3 lines · Dhinakaran
Quoted 2 lines · Rodrigo Vivi

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

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

By the spec it seems that this is part of audio programming,

I am not very clear where the pin buffer enabling/disabling step falls in the audio programming sequence. From what I understand, audio codec enable/disable is controlled by i915, if pin buffer enable/disable is part of that, then we don't need a call back. It's difficult to know where this function is going to be used without seeing the audio driver patch that makes of use of this.

Sanyog, I couldn't find all the old emails with spec pointing out the time that we needed to set this bit. Do you still have? Anything you could share when publishing the patches?

Quoted 5 lines
Quoted 1 line

From audio point of view, we are working on correct sequence where this ops will be called. However during CNL Power-ON we enabled the pin buf using ops as part of azx_reset.

Ok, so let's put this on hold while audio drivers are not ready. It will be on internal branch anyways.
When audio driver gets ready we re-submit all together.

Quoted 93 lines
Quoted 93 lines
Quoted 2 lines

so let's give them the hability to set/unset this as needed.

typo s/hability/ability

Quoted 33 lines

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

Cc Dhinakaran Pandiyan <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sanyog Kale <[email protected]>
---
 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(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 64cc674..aab38da 100644
@@ -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)
drivers/gpu/drm/i915/intel_audio.c +0 -0
index d805b6e..0c83254 100644

drivers/gpu/drm/i915/intel_audio.c static int i915_audio_component_get_eld(struct device *kdev, int port, · line 869

Quoted 5 lines
drivers/gpu/drm/i915/intel_audio.c +2 -0
@@ -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)
+{

Does it matter whether the audio codec is enabled or disabled when this call comes in? i.e., do we need some sort of check here? Or do we assume the audio driver knows exactly when to enable or disable pin buffer?

drivers/gpu/drm/i915/intel_audio.c static int i915_audio_component_get_eld(struct device *kdev, int port, · line 872

Quoted 3 lines
drivers/gpu/drm/i915/intel_audio.c +3 -0
+	struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
+
+	if (!IS_CANNONLAKE(dev_priv))

Should this be a INTEL_GEN() < 10 since the register is gen10+? I am not particular about either of the options.

Quoted 37 lines
drivers/gpu/drm/i915/intel_audio.c +11 -0
+		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,
include/drm/i915_component.h +6 -0
index 545c6e0..b8875d4 100644
@@ -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);
 };
 
Quoted 2 lines
Quoted 1 line

include/drm/i915_component.h struct i915_audio_component_ops { · line 90

Quoted 1 line
include/drm/i915_component.h +0 -0
 /**

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 20 lines · Rodrigo
Quoted 4 lines · Sanyog Kale
Quoted 3 lines · Dhinakaran
Quoted 2 lines · Rodrigo Vivi

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

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

By the spec it seems that this is part of audio programming,

I am not very clear where the pin buffer enabling/disabling step falls in the audio programming sequence. From what I understand, audio codec enable/disable is controlled by i915, if pin buffer enable/disable is part of that, then we don't need a call back. It's difficult to know where this function is going to be used without seeing the audio driver patch that makes of use of this.

Sanyog, I couldn't find all the old emails with spec pointing out the time that we needed to set this bit. Do you still have? Anything you could share when publishing the patches?

Quoted 2 lines
Quoted 1 line
Quoted 8 lines
Quoted 3 lines

From audio point of view, we are working on correct sequence where this ops will be called. However during CNL Power-ON we enabled the pin buf using ops as part of azx_reset.

Ok, so let's put this on hold while audio drivers are not ready. It will be on internal branch anyways.
When audio driver gets ready we re-submit all together.

That makes a lot of sense to me.

Quoted 93 lines
Quoted 93 lines
Quoted 93 lines
Quoted 2 lines

so let's give them the hability to set/unset this as needed.

typo s/hability/ability

Quoted 33 lines

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

Cc Dhinakaran Pandiyan <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sanyog Kale <[email protected]>
---
 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(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 64cc674..aab38da 100644
@@ -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)
drivers/gpu/drm/i915/intel_audio.c +0 -0
index d805b6e..0c83254 100644

drivers/gpu/drm/i915/intel_audio.c static int i915_audio_component_get_eld(struct device *kdev, int port, · line 869

Quoted 5 lines
drivers/gpu/drm/i915/intel_audio.c +2 -0
@@ -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)
+{

Does it matter whether the audio codec is enabled or disabled when this call comes in? i.e., do we need some sort of check here? Or do we assume the audio driver knows exactly when to enable or disable pin buffer?

drivers/gpu/drm/i915/intel_audio.c static int i915_audio_component_get_eld(struct device *kdev, int port, · line 872

Quoted 3 lines
drivers/gpu/drm/i915/intel_audio.c +3 -0
+	struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
+
+	if (!IS_CANNONLAKE(dev_priv))

Should this be a INTEL_GEN() < 10 since the register is gen10+? I am not particular about either of the options.

Quoted 37 lines
drivers/gpu/drm/i915/intel_audio.c +11 -0
+		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,
include/drm/i915_component.h +6 -0
index 545c6e0..b8875d4 100644
@@ -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);
 };
 
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

include/drm/i915_component.h struct i915_audio_component_ops { · line 90

Quoted 1 line
include/drm/i915_component.h +0 -0
 /**

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx