Skip to contentSkip to conversation

Add support for Legacy HDMI audio drivers

PATCH Superseded Jerome Anand 5 participants 17 messages Jan 20, 2017 – Jan 24, 2017

Subsystems (5)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add support for Legacy HDMI audio drivers

Legacy (CherryTrail/ Baytrail) HDMI audio drivers added Legacy hdmi audio-Gfx interaction/ interfacing is updated to use irq chip framework

This patch series has only been tested on hardware with
a single HDMI connector/pipe and additional work may be needed for newer machines with 2 connectors

Jerome Anand (5):
drm/i915: setup bridge for HDMI LPE audio driver drm/i915: Add support for audio driver notifications
ALSA: add Intel HDMI LPE audio driver for BYT/CHT-T
ALSA: x86: hdmi: Add audio support for BYT and CHT
ALSA: x86: hdmi: continue playback even when display resolution
changes

 Documentation/gpu/i915.rst             |    9 +
 drivers/gpu/drm/i915/Makefile          |    3 +
 drivers/gpu/drm/i915/i915_drv.c        |    8 +-
 drivers/gpu/drm/i915/i915_drv.h        |   17 +
 drivers/gpu/drm/i915/i915_irq.c        |   16 +
 drivers/gpu/drm/i915/i915_reg.h        |    3 +
 drivers/gpu/drm/i915/intel_audio.c     |    8 +
 drivers/gpu/drm/i915/intel_hdmi.c      |    1 +
 drivers/gpu/drm/i915/intel_lpe_audio.c |  388 +++++++
 include/drm/intel_lpe_audio.h          |   46 +
 sound/Kconfig                          |    2 +
 sound/Makefile                         |    2 +-
 sound/x86/Kconfig                      |   15 +
 sound/x86/Makefile                     |    6 +
 sound/x86/intel_hdmi_audio.c           | 1870 ++++++++++++++++++++++++++++++++
 sound/x86/intel_hdmi_audio.h           |  197 ++++
 sound/x86/intel_hdmi_audio_if.c        |  551 ++++++++++
 sound/x86/intel_hdmi_lpe_audio.c       |  617 +++++++++++
 sound/x86/intel_hdmi_lpe_audio.h       |  683 ++++++++++++
 19 files changed, 4439 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_lpe_audio.c
 create mode 100644 include/drm/intel_lpe_audio.h
 create mode 100644 sound/x86/Kconfig
 create mode 100644 sound/x86/Makefile
 create mode 100644 sound/x86/intel_hdmi_audio.c
 create mode 100644 sound/x86/intel_hdmi_audio.h
 create mode 100644 sound/x86/intel_hdmi_audio_if.c
 create mode 100644 sound/x86/intel_hdmi_lpe_audio.c
 create mode 100644 sound/x86/intel_hdmi_lpe_audio.h
Signature · 3 lines
2.9.3

base-commit: eb5c556a1e5eff388e48e4b7cf61e95783019e83
#1 lore raw

PATCH v4 1/5 drm/i915: setup bridge for HDMI LPE audio driver

Enable support for HDMI LPE audio mode on Baytrail and Cherrytrail when HDaudio controller is not detected

Setup minimum required resources during i915_driver_load:
1. Create a platform device to share MMIO/IRQ resources
2. Make the platform device child of i915 device for runtime PM.
3. Create IRQ chip to forward HDMI LPE audio irqs.

HDMI LPE audio driver (a standalone sound driver) probes the LPE audio device and creates a new sound card.

---
 Documentation/gpu/i915.rst             |   9 +
 drivers/gpu/drm/i915/Makefile          |   3 +
 drivers/gpu/drm/i915/i915_drv.c        |   8 +-
 drivers/gpu/drm/i915/i915_drv.h        |  15 ++
 drivers/gpu/drm/i915/i915_irq.c        |  16 ++
 drivers/gpu/drm/i915/i915_reg.h        |   3 +
 drivers/gpu/drm/i915/intel_lpe_audio.c | 339 +++++++++++++++++++++++++++++++++
 include/drm/intel_lpe_audio.h          |  46 +++++
 8 files changed, 437 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_lpe_audio.c
 create mode 100644 include/drm/intel_lpe_audio.h
Documentation/gpu/i915.rst +9 -0
index 104296d..bd9b767 100644
@@ -225,6 +225,15 @@ Display PLLs
 .. kernel-doc:: drivers/gpu/drm/i915/intel_dpll_mgr.h
    :internal:
 
+intel hdmi lpe audio support
+----------------------------
+
+.. kernel-doc:: drivers/gpu/drm/i915/intel_lpe_audio.c
+   :doc:  LPE Audio integration for HDMI or DP playback
+
+.. kernel-doc:: drivers/gpu/drm/i915/intel_lpe_audio.c
+   :internal:
+
 Memory Management and Command Submission
 ========================================
 
drivers/gpu/drm/i915/Makefile +3 -0
index 5196509..2bca239 100644
@@ -127,6 +127,9 @@ i915-y += intel_gvt.o
 include $(src)/gvt/Makefile
 endif
 
+# LPE Audio for VLV and CHT
+i915-y += intel_lpe_audio.o
+
 obj-$(CONFIG_DRM_I915) += i915.o
 
 CFLAGS_i915_trace_points.o := -I$(src)
drivers/gpu/drm/i915/i915_drv.c +6 -2
index 4d22b4b..70d728b 100644
@@ -1131,7 +1131,8 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
 	if (IS_GEN5(dev_priv))
 		intel_gpu_ips_init(dev_priv);
 
-	i915_audio_component_init(dev_priv);
+	if (intel_lpe_audio_init(dev_priv) < 0)
+		i915_audio_component_init(dev_priv);
 
 	/*
 	 * Some ports require correctly set-up hpd registers for detection to
@@ -1149,7 +1150,10 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
  */
 static void i915_driver_unregister(struct drm_i915_private *dev_priv)
 {
-	i915_audio_component_cleanup(dev_priv);
+	if (HAS_LPE_AUDIO(dev_priv))
+		intel_lpe_audio_teardown(dev_priv);
+	else
+		i915_audio_component_cleanup(dev_priv);
 
 	intel_gpu_ips_teardown();
 	acpi_video_unregister();
drivers/gpu/drm/i915/i915_drv.h +15 -0
index f66eeede..cc7033a 100644
@@ -2449,6 +2449,12 @@ struct drm_i915_private {
 	/* Used to save the pipe-to-encoder mapping for audio */
 	struct intel_encoder *av_enc_map[I915_MAX_PIPES];
 
+	/* necessary resource sharing with HDMI LPE audio driver. */
+	struct {
+		struct platform_device *platdev;
+		int	irq;
+	} lpe_audio;
+
 	/*
 	 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
 	 * will be rejected. Instead look for a better place.
@@ -2848,6 +2854,8 @@ intel_info(const struct drm_i915_private *dev_priv)
 
 #define HAS_POOLED_EU(dev_priv)	((dev_priv)->info.has_pooled_eu)
 
+#define HAS_LPE_AUDIO(dev_priv) ((dev_priv)->lpe_audio.platdev != NULL)
+
 #define INTEL_PCH_DEVICE_ID_MASK		0xff00
 #define INTEL_PCH_IBX_DEVICE_ID_TYPE		0x3b00
 #define INTEL_PCH_CPT_DEVICE_ID_TYPE		0x1c00
@@ -3609,6 +3617,13 @@ extern int i915_restore_state(struct drm_i915_private *dev_priv);
 void i915_setup_sysfs(struct drm_i915_private *dev_priv);
 void i915_teardown_sysfs(struct drm_i915_private *dev_priv);
 
+/* i915_lpe_audio.c */
+int  intel_lpe_audio_init(struct drm_i915_private *dev_priv);
+int  intel_lpe_audio_setup(struct drm_i915_private *dev_priv);
+void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv);
+void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv);
+bool intel_lpe_audio_detect(struct drm_i915_private *dev_priv);
+
 /* intel_i2c.c */
 extern int intel_setup_gmbus(struct drm_i915_private *dev_priv);
 extern void intel_teardown_gmbus(struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/i915_irq.c +16 -0
index a0e70f5..d9393d6a 100644
@@ -1893,6 +1893,10 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)
 		 * signalled in iir */
 		valleyview_pipestat_irq_ack(dev_priv, iir, pipe_stats);
 
+		if (iir & (I915_LPE_PIPE_A_INTERRUPT |
+			   I915_LPE_PIPE_B_INTERRUPT))
+			intel_lpe_audio_irq_handler(dev_priv);
+
 		/*
 		 * VLV_IIR is single buffered, and reflects the level
 		 * from PIPESTAT/PORT_HOTPLUG_STAT, hence clear it last.
@@ -1973,6 +1977,11 @@ static irqreturn_t cherryview_irq_handler(int irq, void *arg)
 		 * signalled in iir */
 		valleyview_pipestat_irq_ack(dev_priv, iir, pipe_stats);
 
+		if (iir & (I915_LPE_PIPE_A_INTERRUPT |
+			   I915_LPE_PIPE_B_INTERRUPT |
+			   I915_LPE_PIPE_C_INTERRUPT))
+			intel_lpe_audio_irq_handler(dev_priv);
+
 		/*
 		 * VLV_IIR is single buffered, and reflects the level
 		 * from PIPESTAT/PORT_HOTPLUG_STAT, hence clear it last.
@@ -2914,6 +2923,7 @@ static void vlv_display_irq_postinstall(struct drm_i915_private *dev_priv)
 	u32 pipestat_mask;
 	u32 enable_mask;
 	enum pipe pipe;
+	u32 val;
 
 	pipestat_mask = PLANE_FLIP_DONE_INT_STATUS_VLV |
 			PIPE_CRC_DONE_INTERRUPT_STATUS;
@@ -2930,6 +2940,12 @@ static void vlv_display_irq_postinstall(struct drm_i915_private *dev_priv)
 
 	WARN_ON(dev_priv->irq_mask != ~0);
 
+	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);
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 00970aa..643bc6e 100644
@@ -2428,6 +2428,9 @@ enum skl_disp_power_wells {
 #define I915_ASLE_INTERRUPT				(1<<0)
 #define I915_BSD_USER_INTERRUPT				(1<<25)
 
+#define I915_HDMI_LPE_AUDIO_BASE	(VLV_DISPLAY_BASE + 0x65000)
+#define I915_HDMI_LPE_AUDIO_SIZE	0x1000
+
 #define GEN6_BSD_RNCID			_MMIO(0x12198)
 
 #define GEN7_FF_THREAD_MODE		_MMIO(0x20a0)
drivers/gpu/drm/i915/intel_lpe_audio.c new file +339 -0

339 lines not on this page · raw message

include/drm/intel_lpe_audio.h new file +46 -0

46 lines not on this page · raw message

Signature · 6 lines
2.9.3

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

Re: [PATCH v4 1/5] drm/i915: setup bridge for HDMI LPE audio driver

Quoted 8 lines · Jerome Anand

Enable support for HDMI LPE audio mode on Baytrail and Cherrytrail when HDaudio controller is not detected

Setup minimum required resources during i915_driver_load:
1. Create a platform device to share MMIO/IRQ resources
2. Make the platform device child of i915 device for runtime PM.
3. Create IRQ chip to forward HDMI LPE audio irqs.

Quoted 5 lines

HDMI LPE audio driver (a standalone sound driver) probes the LPE audio device and creates a new sound card.

Some comments inline. This is not a detailed technical review, more a high level glance at interfacing with the rest of i915.

drivers/gpu/drm/i915/i915_drv.c static void i915_driver_register(struct drm_i915_private *dev_priv) · line 1135

Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.c +2 -1
index 4d22b4b..70d728b 100644
@@ -1131,7 +1131,8 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
 	if (IS_GEN5(dev_priv))
 		intel_gpu_ips_init(dev_priv);
 
-	i915_audio_component_init(dev_priv);
+	if (intel_lpe_audio_init(dev_priv) < 0)
+		i915_audio_component_init(dev_priv);

I'd like this abstracted behind a single intel_audio_init() in intel_audio.c, which would do the right thing.

drivers/gpu/drm/i915/i915_drv.c static void i915_driver_register(struct drm_i915_private *dev_priv) · line 1156

Quoted 12 lines
drivers/gpu/drm/i915/i915_drv.c +4 -1
 	/*
 	 * Some ports require correctly set-up hpd registers for detection to
@@ -1149,7 +1150,10 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
  */
 static void i915_driver_unregister(struct drm_i915_private *dev_priv)
 {
-	i915_audio_component_cleanup(dev_priv);
+	if (HAS_LPE_AUDIO(dev_priv))
+		intel_lpe_audio_teardown(dev_priv);
+	else
+		i915_audio_component_cleanup(dev_priv);

Same here for cleanup.

Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.c +0 -0
 	intel_gpu_ips_teardown();
 	acpi_video_unregister();
drivers/gpu/drm/i915/i915_drv.h +0 -0
index f66eeede..cc7033a 100644

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 2457

Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.h +6 -0
@@ -2449,6 +2449,12 @@ struct drm_i915_private {
 	/* Used to save the pipe-to-encoder mapping for audio */
 	struct intel_encoder *av_enc_map[I915_MAX_PIPES];
 
+	/* necessary resource sharing with HDMI LPE audio driver. */
+	struct {
+		struct platform_device *platdev;
+		int	irq;
+	} lpe_audio;
+

I think the av_enc_map array is misplaced within dev_priv, and these should really be closer to the audio_component etc. members. But could be cleaned up later too.

drivers/gpu/drm/i915/i915_drv.h intel_info(const struct drm_i915_private *dev_priv) · line 2857

Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.h +1 -0
 	/*
 	 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
 	 * will be rejected. Instead look for a better place.
@@ -2848,6 +2854,8 @@ intel_info(const struct drm_i915_private *dev_priv)
 
 #define HAS_POOLED_EU(dev_priv)	((dev_priv)->info.has_pooled_eu)
 
+#define HAS_LPE_AUDIO(dev_priv) ((dev_priv)->lpe_audio.platdev != NULL)

Please note that *all* of our HAS_ macros check for static features of the hardware, not dynamic state of the driver. Let's keep it that way.

If you abstract the init/cleanup in intel_audio.c like I suggested, I think you can just check for dev_priv->lpe_audio.platdev directly, and get rid of HAS_LPE_AUDIO() altogether. Then it'll all be within intel_audio.c or intel_lpe_audio.c, and it's pretty obvious what it means.

drivers/gpu/drm/i915/i915_drv.h intel_info(const struct drm_i915_private *dev_priv)

Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.h +9 -0
+/**
+ * intel_lpe_audio_detect() - check & setup lpe audio if present
+ * @dev_priv: the i915 drm device private data
+ *
+ * Detect if lpe audio is present
+ *
+ * Return: true if lpe audio present else Return = false
+ */
+bool intel_lpe_audio_detect(struct drm_i915_private *dev_priv)

Could this not be static?

drivers/gpu/drm/i915/i915_drv.h

Quoted 12 lines
drivers/gpu/drm/i915/i915_drv.h +12 -0
+/**
+ * intel_lpe_audio_setup() - setup the bridge between HDMI LPE Audio
+ * driver and i915
+ * @dev_priv: the i915 drm device private data
+ *
+ * set up the minimum required resources for the bridge: irq chip,
+ * platform resource and platform device. i915 device is set as parent
+ * of the new platform device.
+ *
+ * Return: 0 if successful. non-zero if allocation/initialization fails
+ */
+int intel_lpe_audio_setup(struct drm_i915_private *dev_priv)

Could this not be static?

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH v4 1/5] drm/i915: setup bridge for HDMI LPE audio driver

Quoted 24 lines

-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Monday, January 23, 2017 4:24 PM
To: Anand, Jerome <[email protected]>; intel- [email protected]; [email protected]
Cc: [email protected]; [email protected]; Ughreja, Rakesh A <[email protected]>
Subject: Re: [Intel-gfx] [PATCH v4 1/5] drm/i915: setup bridge for HDMI LPE audio driver

Quoted 11 lines · Jerome Anand

Enable support for HDMI LPE audio mode on Baytrail and Cherrytrail when HDaudio controller is not detected

Setup minimum required resources during i915_driver_load:
1. Create a platform device to share MMIO/IRQ resources 2. Make the platform device child of i915 device for runtime PM.
3. Create IRQ chip to forward HDMI LPE audio irqs.

HDMI LPE audio driver (a standalone sound driver) probes the LPE audio device and creates a new sound card.

Quoted 7 lines
Quoted 3 lines

Signed-off-by: Pierre-Louis Bossart
<[email protected]>

Some comments inline. This is not a detailed technical review, more a high level glance at interfacing with the rest of i915.

Sure - thanks for the quick review Jani

Quoted 9 lines

drivers/gpu/drm/i915/i915_drv.c static void i915_driver_register(struct

Quoted 5 lines
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_drv.c index 4d22b4b..70d728b 100644

drivers/gpu/drm/i915/i915_drv.c +0 -0
@@ -1131,7 +1131,8 @@ static void i915_driver_register(struct

drm_i915_private *dev_priv)

Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.c +0 -0
 	if (IS_GEN5(dev_priv))
 		intel_gpu_ips_init(dev_priv);
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_drv.c static void i915_driver_register(struct drm_i915_private *dev_priv) · line 1135

Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.c +2 -1
-	i915_audio_component_init(dev_priv);
+	if (intel_lpe_audio_init(dev_priv) < 0)
+		i915_audio_component_init(dev_priv);

I'd like this abstracted behind a single intel_audio_init() in intel_audio.c, which would do the right thing.

Ok - I'll create two new API's in intel_audio.c

Quoted 5 lines
Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.c +0 -0
 	/*
 	 * Some ports require correctly set-up hpd registers for detection

to @@ -1149,7 +1150,10 @@ static void i915_driver_register(struct

drm_i915_private *dev_priv)

Quoted 11 lines

drivers/gpu/drm/i915/i915_drv.c static void i915_driver_register(struct drm_i915_private *dev_priv) · line 1156

Quoted 8 lines

*/
static void i915_driver_unregister(struct drm_i915_private *dev_priv)
{

drivers/gpu/drm/i915/i915_drv.c +4 -1
-	i915_audio_component_cleanup(dev_priv);
+	if (HAS_LPE_AUDIO(dev_priv))
+		intel_lpe_audio_teardown(dev_priv);
+	else
+		i915_audio_component_cleanup(dev_priv);

Same here for cleanup.

OK

Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.c +0 -0
 	intel_gpu_ips_teardown();
 	acpi_video_unregister();
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_drv.h index f66eeede..cc7033a 100644

drivers/gpu/drm/i915/i915_drv.h +0 -0
@@ -2449,6 +2449,12 @@ struct drm_i915_private {
 	/* Used to save the pipe-to-encoder mapping for audio */
 	struct intel_encoder *av_enc_map[I915_MAX_PIPES];
 
Quoted 11 lines

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 2457

Quoted 6 lines
drivers/gpu/drm/i915/i915_drv.h +6 -0
+	/* necessary resource sharing with HDMI LPE audio driver. */
+	struct {
+		struct platform_device *platdev;
+		int	irq;
+	} lpe_audio;
+

I think the av_enc_map array is misplaced within dev_priv, and these should really be closer to the audio_component etc. members. But could be cleaned up later too.

Will cleanup later.

Quoted 7 lines

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 2459

Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.h +0 -0
 	/*
 	 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your

patch

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h +0 -0
 	 * will be rejected. Instead look for a better place.
@@ -2848,6 +2854,8 @@ intel_info(const struct drm_i915_private
 *dev_priv)
 
Quoted 8 lines

drivers/gpu/drm/i915/i915_drv.h intel_info(const struct drm_i915_private *dev_priv)

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h +2 -0
 #define HAS_POOLED_EU(dev_priv)	((dev_priv)->info.has_pooled_eu)
 
+#define HAS_LPE_AUDIO(dev_priv) ((dev_priv)->lpe_audio.platdev !=
+NULL)

Please note that *all* of our HAS_ macros check for static features of the hardware, not dynamic state of the driver. Let's keep it that way.

OK - will remove it from here.

Quoted 5 lines

If you abstract the init/cleanup in intel_audio.c like I suggested, I think you can just check for dev_priv->lpe_audio.platdev directly, and get rid of HAS_LPE_AUDIO() altogether. Then it'll all be within intel_audio.c or intel_lpe_audio.c, and it's pretty obvious what it means.

OK

Quoted 11 lines

drivers/gpu/drm/i915/i915_drv.h intel_info(const struct drm_i915_private

Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.h +8 -0
+/**
+ * intel_lpe_audio_detect() - check & setup lpe audio if present
+ * @dev_priv: the i915 drm device private data
+ *
+ * Detect if lpe audio is present
+ *
+ * Return: true if lpe audio present else Return = false  */ bool
+intel_lpe_audio_detect(struct drm_i915_private *dev_priv)

Could this not be static?

OK - wanted it to be as part of the interface. Not used anywhere now, so will make it static

Quoted 7 lines
Quoted 7 lines

+/**
+ * intel_lpe_audio_setup() - setup the bridge between HDMI LPE Audio
+ * driver and i915
+ * @dev_priv: the i915 drm device private data
+ *
+ * set up the minimum required resources for the bridge: irq chip,
+ * platform resource and platform device. i915 device is set as

Quoted 9 lines

drivers/gpu/drm/i915/i915_drv.h

Quoted 6 lines
drivers/gpu/drm/i915/i915_drv.h +6 -0
+parent
+ * of the new platform device.
+ *
+ * Return: 0 if successful. non-zero if allocation/initialization
+fails  */ int intel_lpe_audio_setup(struct drm_i915_private
+*dev_priv)

Could this not be static?

OK

Quoted 6 lines

BR,
Jani.

--
Jani Nikula, Intel Open Source Technology Center

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

#4 lore raw

PATCH v4 2/5 drm/i915: Add support for audio driver notifications

In reply to Jerome Anand

Notifiations like mode change, hot plug and edid to the audio driver are added. This is inturn used by the audio driver for its functionality.

A new interface file capturing the notifications needed by the audio driver is added

---
 drivers/gpu/drm/i915/i915_drv.h        |  2 ++
 drivers/gpu/drm/i915/intel_audio.c     |  8 ++++++
 drivers/gpu/drm/i915/intel_hdmi.c      |  1 +
 drivers/gpu/drm/i915/intel_lpe_audio.c | 49 ++++++++++++++++++++++++++++++++++
 4 files changed, 60 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index cc7033a..601c8ad 100644
@@ -3623,6 +3623,8 @@ int  intel_lpe_audio_setup(struct drm_i915_private *dev_priv);
 void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv);
 void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv);
 bool intel_lpe_audio_detect(struct drm_i915_private *dev_priv);
+void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
+			void *eld, int port, int tmds_clk_speed);
 
 /* intel_i2c.c */
 extern int intel_setup_gmbus(struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_audio.c +8 -0
index 16c2027..00a485e 100644
@@ -24,6 +24,7 @@
 #include <linux/kernel.h>
 #include <linux/component.h>
 #include <drm/i915_component.h>
+#include <drm/intel_lpe_audio.h>
 #include "intel_drv.h"
 
 #include <drm/drmP.h>
@@ -630,6 +631,10 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
 						 (int) port, (int) pipe);
+
+	if (HAS_LPE_AUDIO(dev_priv))
+		intel_lpe_audio_notify(dev_priv, connector->eld, port,
+			crtc_state->port_clock);
 }
 
 /**
@@ -663,6 +668,9 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
 						 (int) port, (int) pipe);
+
+	if (HAS_LPE_AUDIO(dev_priv))
+		intel_lpe_audio_notify(dev_priv, NULL, port, 0);
 }
 
 /**
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
index 0bcfead..377584e1 100644
@@ -36,6 +36,7 @@
 #include <drm/drm_edid.h>
 #include "intel_drv.h"
 #include <drm/i915_drm.h>
+#include <drm/intel_lpe_audio.h>
 #include "i915_drv.h"
 
 static struct drm_device *intel_hdmi_to_dev(struct intel_hdmi *intel_hdmi)
drivers/gpu/drm/i915/intel_lpe_audio.c +49 -0

52 lines not on this page · raw message

Signature · 1 line
2.9.3
maintainer Acked-by on v4 2/5
#5 lore raw

Re: [PATCH v4 2/5] drm/i915: Add support for audio driver notifications

Quoted 9 lines · Jerome Anand

Notifiations like mode change, hot plug and edid to the audio driver are added. This is inturn used by the audio driver for its functionality.

A new interface file capturing the notifications needed by the audio driver is added

Not a detailed technical review, but

One nitpick below, up to you if you care to change.

Quoted 33 lines
---
 drivers/gpu/drm/i915/i915_drv.h        |  2 ++
 drivers/gpu/drm/i915/intel_audio.c     |  8 ++++++
 drivers/gpu/drm/i915/intel_hdmi.c      |  1 +
 drivers/gpu/drm/i915/intel_lpe_audio.c | 49 ++++++++++++++++++++++++++++++++++
 4 files changed, 60 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index cc7033a..601c8ad 100644
@@ -3623,6 +3623,8 @@ int  intel_lpe_audio_setup(struct drm_i915_private *dev_priv);
 void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv);
 void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv);
 bool intel_lpe_audio_detect(struct drm_i915_private *dev_priv);
+void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
+			void *eld, int port, int tmds_clk_speed);
 
 /* intel_i2c.c */
 extern int intel_setup_gmbus(struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_audio.c +1 -0
index 16c2027..00a485e 100644
@@ -24,6 +24,7 @@
 #include <linux/kernel.h>
 #include <linux/component.h>
 #include <drm/i915_component.h>
+#include <drm/intel_lpe_audio.h>
 #include "intel_drv.h"
 
 #include <drm/drmP.h>

drivers/gpu/drm/i915/intel_audio.c void intel_audio_codec_enable(struct intel_encoder *intel_encoder, · line 637

Quoted 7 lines
drivers/gpu/drm/i915/intel_audio.c +4 -0
@@ -630,6 +631,10 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
 						 (int) port, (int) pipe);
+
+	if (HAS_LPE_AUDIO(dev_priv))
+		intel_lpe_audio_notify(dev_priv, connector->eld, port,
+			crtc_state->port_clock);

Seems unnecessary to check for HAS_LPE_AUDIO (which you'll change to dev_priv->lpe_audio.platdev, right ;) both in the caller and callee. Pick one.

Quoted 82 lines
drivers/gpu/drm/i915/intel_audio.c +3 -0
 }
 
 /**
@@ -663,6 +668,9 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
 						 (int) port, (int) pipe);
+
+	if (HAS_LPE_AUDIO(dev_priv))
+		intel_lpe_audio_notify(dev_priv, NULL, port, 0);
 }
 
 /**
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
index 0bcfead..377584e1 100644
@@ -36,6 +36,7 @@
 #include <drm/drm_edid.h>
 #include "intel_drv.h"
 #include <drm/i915_drm.h>
+#include <drm/intel_lpe_audio.h>
 #include "i915_drv.h"
 
 static struct drm_device *intel_hdmi_to_dev(struct intel_hdmi *intel_hdmi)
drivers/gpu/drm/i915/intel_lpe_audio.c +49 -0
index 099732c..293084d 100644
@@ -337,3 +337,52 @@ void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv)
 
 	irq_free_desc(dev_priv->lpe_audio.irq);
 }
+
+
+/**
+ * intel_lpe_audio_notify() - notify lpe audio event
+ * audio driver and i915
+ * @dev_priv: the i915 drm device private data
+ * @eld : ELD data
+ * @port: port id
+ * @tmds_clk_speed: tmds clock frequency in Hz
+ *
+ * Notify lpe audio driver of eld change.
+ */
+void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
+			void *eld, int port, int tmds_clk_speed)
+{
+	unsigned long irq_flags;
+	struct intel_hdmi_lpe_audio_pdata *pdata = NULL;
+
+	if (!HAS_LPE_AUDIO(dev_priv))
+		return;
+
+	pdata = dev_get_platdata(
+		&(dev_priv->lpe_audio.platdev->dev));
+
+	spin_lock_irqsave(&pdata->lpe_audio_slock, irq_flags);
+
+	if (eld != NULL) {
+		memcpy(pdata->eld.eld_data, eld,
+			HDMI_MAX_ELD_BYTES);
+		pdata->eld.port_id = port;
+		pdata->hdmi_connected = true;
+
+		if (tmds_clk_speed)
+			pdata->tmds_clock_speed = tmds_clk_speed;
+	} else {
+		memset(pdata->eld.eld_data, 0,
+			HDMI_MAX_ELD_BYTES);
+		pdata->hdmi_connected = false;
+	}
+
+	if (pdata->notify_audio_lpe)
+		pdata->notify_audio_lpe(
+			(eld != NULL) ? &pdata->eld : NULL);
+	else
+		pdata->notify_pending = true;
+
+	spin_unlock_irqrestore(&pdata->lpe_audio_slock,
+			irq_flags);
+}
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH v4 2/5] drm/i915: Add support for audio driver notifications

Quoted 14 lines

drivers/gpu/drm/i915/intel_audio.c void intel_audio_codec_enable(struct intel_encoder *intel_encoder, · line 637

Quoted 10 lines

#include <drm/drmP.h>

drivers/gpu/drm/i915/intel_audio.c +4 -0
@@ -630,6 +631,10 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
 						 (int) port, (int) pipe);
+
+	if (HAS_LPE_AUDIO(dev_priv))
+		intel_lpe_audio_notify(dev_priv, connector->eld, port,
+			crtc_state->port_clock);

Seems unnecessary to check for HAS_LPE_AUDIO (which you'll change to dev_priv->lpe_audio.platdev, right ;) both in the caller and callee. Pick one.

If we test inside of the function, it'd mean an unconditional jump to test a feature that exists on only two platforms out of the dozen or so that this i915 driver handles. No objection to do the change but is this really desired?

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

maintainer
#7 lore raw

Re: [PATCH v4 2/5] drm/i915: Add support for audio driver notifications

Quoted 14 lines · Pierre-Louis Bossart
Quoted 5 lines
Quoted 5 lines

#include <drm/drmP.h>

drivers/gpu/drm/i915/intel_audio.c +0 -0
@@ -630,6 +631,10 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
 						 (int) port, (int) pipe);
Quoted 8 lines

drivers/gpu/drm/i915/intel_audio.c void intel_audio_codec_enable(struct intel_encoder *intel_encoder, · line 637

Quoted 4 lines
drivers/gpu/drm/i915/intel_audio.c +4 -0
+
+	if (HAS_LPE_AUDIO(dev_priv))
+		intel_lpe_audio_notify(dev_priv, connector->eld, port,
+			crtc_state->port_clock);

Seems unnecessary to check for HAS_LPE_AUDIO (which you'll change to dev_priv->lpe_audio.platdev, right ;) both in the caller and callee. Pick one.

Quoted 4 lines

If we test inside of the function, it'd mean an unconditional jump to test a feature that exists on only two platforms out of the dozen or so that this i915 driver handles. No objection to do the change but is this really desired?

*shrug* no big deal to check in both.

BR,
Jani.

Quoted 2 lines
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

Re: [PATCH v4 2/5] drm/i915: Add support for audio driver notifications

Quoted 32 lines

-----Original Message-----
From: Jani Nikula [mailto:[email protected]]
Sent: Tuesday, January 24, 2017 12:31 PM
To: Pierre-Louis Bossart <[email protected]>; Anand, Jerome <[email protected]>; [email protected]; alsa- [email protected]
Cc: [email protected]; [email protected]; Ughreja, Rakesh A <[email protected]>
Subject: Re: [Intel-gfx] [PATCH v4 2/5] drm/i915: Add support for audio driver notifications

Quoted 2 lines · Pierre-Louis Bossart
Quoted 2 lines

Review void intel_audio_codec_enable(struct

Quoted 2 lines

#include <drm/drmP.h>

(quoted diff) +0 -0
@@ -630,6 +631,10 @@ void intel_audio_codec_enable(struct

intel_encoder *intel_encoder,

Quoted 14 lines
Quoted 1 line

Review void intel_audio_codec_enable(struct · line 631

Quoted 1 line
(quoted diff) +0 -0
 	if (acomp && acomp->audio_ops && acomp->audio_ops-

pin_eld_notify)

Quoted 1 line

Review void intel_audio_codec_enable(struct · line 632

Quoted 1 line
(quoted diff) +0 -0
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops-

audio_ptr,

Quoted 9 lines

drivers/gpu/drm/i915/intel_audio.c void intel_audio_codec_enable(struct intel_encoder *intel_encoder, · line 637

Quoted 5 lines
drivers/gpu/drm/i915/intel_audio.c +4 -0
 						 (int) port, (int) pipe);
+
+	if (HAS_LPE_AUDIO(dev_priv))
+		intel_lpe_audio_notify(dev_priv, connector->eld, port,
+			crtc_state->port_clock);

Seems unnecessary to check for HAS_LPE_AUDIO (which you'll change to dev_priv->lpe_audio.platdev, right ;) both in the caller and callee. Pick one.

Quoted 7 lines
Quoted 4 lines

If we test inside of the function, it'd mean an unconditional jump to test a feature that exists on only two platforms out of the dozen or so that this i915 driver handles. No objection to do the change but is this really desired?

*shrug* no big deal to check in both.

Thanks for the ack Jani.
It was added based on one review comment. I'll remove it here and have the check only inside the API

Quoted 8 lines

BR,
Jani.

Quoted 2 lines

--
Jani Nikula, Intel Open Source Technology Center

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

#9 lore raw

PATCH v4 3/5 ALSA: add Intel HDMI LPE audio driver for BYT/CHT-T

In reply to Jerome Anand

On Baytrail and Cherrytrail, HDaudio may be fused out or disabled by the BIOS. This driver enables an alternate path to the i915 display registers and DMA.

Although there is no hardware path between i915 display and LPE/SST audio clusters, this HDMI capability is referred to in the documentation as "HDMI LPE Audio" so we keep the name for consistency. There is no hardware path or control dependencies with the LPE/SST DSP functionality.

The hdmi-lpe-audio driver will be probed when the i915 driver creates a child platform device.

Since this driver is neither SoC nor PCI, a new x86 folder is added Additional indirections in the code will be cleaned up in the next series to aid smoother DP integration

---
 sound/Kconfig                    |   2 +
 sound/Makefile                   |   2 +-
 sound/x86/Kconfig                |  15 +
 sound/x86/Makefile               |   4 +
 sound/x86/intel_hdmi_lpe_audio.c | 614 +++++++++++++++++++++++++++++++++++
 sound/x86/intel_hdmi_lpe_audio.h | 683 +++++++++++++++++++++++++++++++++++++++
 6 files changed, 1319 insertions(+), 1 deletion(-)
 create mode 100644 sound/x86/Kconfig
 create mode 100644 sound/x86/Makefile
 create mode 100644 sound/x86/intel_hdmi_lpe_audio.c
 create mode 100644 sound/x86/intel_hdmi_lpe_audio.h
sound/Kconfig +2 -0
index 5a240e0..ee2e69a 100644
@@ -108,6 +108,8 @@ source "sound/parisc/Kconfig"
 
 source "sound/soc/Kconfig"
 
+source "sound/x86/Kconfig"
+
 endif # SND
 
 menuconfig SOUND_PRIME
sound/Makefile +1 -1
index c41bdf5..6de45d2 100644
@@ -5,7 +5,7 @@ obj-$(CONFIG_SOUND) += soundcore.o
 obj-$(CONFIG_SOUND_PRIME) += oss/
 obj-$(CONFIG_DMASOUND) += oss/
 obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \
-	firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ hda/
+	firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ hda/ x86/
 obj-$(CONFIG_SND_AOA) += aoa/
 
 # This one must be compilable even if sound is configured out
sound/x86/Kconfig new file +15 -0
new file mode 100644
index 0000000..30d066e
@@ -0,0 +1,15 @@
+menuconfig SND_X86
+	tristate "X86 sound devices"
+	depends on X86
+	---help---
+	  X86 sound devices that don't fall under SoC or PCI categories
+
+if SND_X86
+
+config HDMI_LPE_AUDIO
+	tristate "HDMI audio without HDaudio on Intel Atom platforms"
+	depends on DRM_I915
+	help
+	 Choose this option to support HDMI LPE Audio mode
+
+endif	# SND_X86
sound/x86/Makefile new file +4 -0
new file mode 100644
index 0000000..9b87384
@@ -0,0 +1,4 @@
+snd-hdmi-lpe-audio-objs += \
+	intel_hdmi_lpe_audio.o
+
+obj-$(CONFIG_HDMI_LPE_AUDIO) += snd-hdmi-lpe-audio.o
sound/x86/intel_hdmi_lpe_audio.c new file +614 -0

614 lines not on this page · raw message

sound/x86/intel_hdmi_lpe_audio.h new file +683 -0

683 lines not on this page · raw message

Signature · 6 lines
2.9.3

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

PATCH v4 4/5 ALSA: x86: hdmi: Add audio support for BYT and CHT

In reply to Jerome Anand

Hdmi audio driver based on the child platform device created by gfx driver is implemented.
This audio driver is derived from legacy intel hdmi audio driver.

The interfaces for interaction between gfx and audio are updated and the driver implementation updated to derive interrupts in its own address space based on irq chip framework

The changes to calculate sub-period positions was triggered by David Henningsson <[email protected]> and is accomodated in this patch

---
 sound/x86/Makefile               |    2 +
 sound/x86/intel_hdmi_audio.c     | 1855 ++++++++++++++++++++++++++++++++++++++
 sound/x86/intel_hdmi_audio.h     |  197 ++++
 sound/x86/intel_hdmi_audio_if.c  |  551 +++++++++++
 sound/x86/intel_hdmi_lpe_audio.c |   15 +-
 5 files changed, 2614 insertions(+), 6 deletions(-)
 create mode 100644 sound/x86/intel_hdmi_audio.c
 create mode 100644 sound/x86/intel_hdmi_audio.h
 create mode 100644 sound/x86/intel_hdmi_audio_if.c
sound/x86/Makefile +2 -0
index 9b87384..85ea22a 100644
@@ -1,4 +1,6 @@
 snd-hdmi-lpe-audio-objs += \
+	intel_hdmi_audio.o \
+	intel_hdmi_audio_if.o \
 	intel_hdmi_lpe_audio.o
 
 obj-$(CONFIG_HDMI_LPE_AUDIO) += snd-hdmi-lpe-audio.o
sound/x86/intel_hdmi_audio.c new file +1855 -0

1,855 lines not on this page · raw message

sound/x86/intel_hdmi_audio.h new file +197 -0

197 lines not on this page · raw message

sound/x86/intel_hdmi_audio_if.c new file +551 -0

551 lines not on this page · raw message

sound/x86/intel_hdmi_lpe_audio.c +9 -6
index a9fd2d3..ce24ef1 100644
@@ -34,6 +34,7 @@
 #include <sound/initval.h>
 #include <drm/intel_lpe_audio.h>
 #include "intel_hdmi_lpe_audio.h"
+#include "intel_hdmi_audio.h"
 
 /* globals*/
 static struct platform_device *hlpe_pdev;
@@ -450,9 +451,9 @@ static void notify_audio_lpe(void *audio_ptr)
 /**
  * hdmi_lpe_audio_probe - start bridge with i915
  *
- * This function is called when the i915 driver creates the hdmi-lpe-audio
- * platform device. Card creation is deferred until a hot plug event is
- * received
+ * This function is called when the i915 driver creates the
+ * hdmi-lpe-audio platform device. Card creation is deferred until a
+ * hot plug event is received
  */
 static int hdmi_lpe_audio_probe(struct platform_device *pdev)
 {
@@ -495,8 +496,8 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
 		(unsigned int)res_mmio->end);
 
 	mmio_start = ioremap_nocache(res_mmio->start,
-				(size_t)((res_mmio->end - res_mmio->start)
-						+ 1));
+				(size_t)((res_mmio->end -
+					res_mmio->start) + 1));
 	if (!mmio_start) {
 		dev_err(&hlpe_pdev->dev, "Could not get ioremap\n");
 		return -EACCES;
@@ -548,11 +549,11 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, ctx);
 
+	ret = hdmi_audio_probe((void *)pdev);
 	dev_dbg(&hlpe_pdev->dev, "hdmi lpe audio: setting pin eld notify callback\n");
 
 	spin_lock_irqsave(&pdata->lpe_audio_slock, flag_irq);
 	pdata->notify_audio_lpe = notify_audio_lpe;
-
 	if (pdata->notify_pending) {
 
 		dev_dbg(&hlpe_pdev->dev, "%s: handle pending notification\n", __func__);
@@ -576,6 +577,8 @@ static int hdmi_lpe_audio_remove(struct platform_device *pdev)
 
 	dev_dbg(&hlpe_pdev->dev, "Enter %s\n", __func__);
 
+	hdmi_audio_remove(pdev);
+
 	/* get context, release resources */
 	ctx = platform_get_drvdata(pdev);
 	iounmap(ctx->mmio_start);
Signature · 1 line
2.9.3
#11 lore raw

Re: [PATCH v4 4/5] ALSA: x86: hdmi: Add audio support for BYT and CHT

sound/x86/intel_hdmi_audio.c line 1801

Quoted 2 lines · Jerome Anand
sound/x86/intel_hdmi_audio.c new file +1 -0
+	had_ops_v1 = had_ops_v1;	/* unused */

Until now I didn't realize that the whole v1 stuff is never used in the current patchset. Will it be ever used in future? If not, can't we clean it up? It's a bunch of codes, including the messy union definitions. If there is no v3 or whatever, we can even get rid of the whole indirect calls.

And if v1 (and the indirect ops calls) should be kept, actually what is the difference between v1 and v2, why both implementations do exist? Please elaborate in comments.

thanks,

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

#12 lore raw

Re: [alsa-devel] [PATCH v4 4/5] ALSA: x86: hdmi: Add audio support for BYT and CHT

Quoted 11 lines · Takashi Iwai

sound/x86/intel_hdmi_audio.c line 1801

Quoted 2 lines · Jerome Anand
sound/x86/intel_hdmi_audio.c new file +1 -0
+	had_ops_v1 = had_ops_v1;	/* unused */

Until now I didn't realize that the whole v1 stuff is never used in the current patchset. Will it be ever used in future? If not, can't we clean it up? It's a bunch of codes, including the messy union definitions. If there is no v3 or whatever, we can even get rid of the whole indirect calls.

Quoted 3 lines

And if v1 (and the indirect ops calls) should be kept, actually what is the difference between v1 and v2, why both implementations do exist? Please elaborate in comments.

v1 refers to Medfield/Clovertrail, v2 to Baytrail/CHT. The differences are minor and centered on different register definitions or additional features/bug corrections. We left the v1 code in so far but we could probably remove it since it's not tested anyway. The question is if we remove this v1 code and indirect calls now or later, I was planning to add DP audio support and making more changes would make the integration more difficult.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw

Re: [alsa-devel] [PATCH v4 4/5] ALSA: x86: hdmi: Add audio support for BYT and CHT

Quoted 17 lines · Pierre-Louis Bossart
Quoted 11 lines · Takashi Iwai

sound/x86/intel_hdmi_audio.c line 1801

Quoted 2 lines · Jerome Anand
sound/x86/intel_hdmi_audio.c new file +1 -0
+	had_ops_v1 = had_ops_v1;	/* unused */

Until now I didn't realize that the whole v1 stuff is never used in the current patchset. Will it be ever used in future? If not, can't we clean it up? It's a bunch of codes, including the messy union definitions. If there is no v3 or whatever, we can even get rid of the whole indirect calls.

Quoted 3 lines

And if v1 (and the indirect ops calls) should be kept, actually what is the difference between v1 and v2, why both implementations do exist? Please elaborate in comments.

Quoted 7 lines

v1 refers to Medfield/Clovertrail, v2 to Baytrail/CHT. The differences are minor and centered on different register definitions or additional features/bug corrections. We left the v1 code in so far but we could probably remove it since it's not tested anyway. The question is if we remove this v1 code and indirect calls now or later, I was planning to add DP audio support and making more changes would make the integration more difficult.

It's up to you. I prefer the DP implementation sooner so that I can test the driver by myself, which makes me easier working on a later cleanup of the driver code after the merge.

My previous question was about the general question, to determine how far we can reduce things.

thanks,

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

#14 lore raw

PATCH v4 5/5 ALSA: x86: hdmi: continue playback even when display resolution changes

In reply to Jerome Anand

When the display resolution changes, the drm disables the display pipes due to which audio rendering stops. At this time, we need to ensure the existing audio pointers and buffers are cleared out so that the playback can restarted once the display pipe is enabled with a different N/CTS values

---
 sound/x86/intel_hdmi_audio.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
sound/x86/intel_hdmi_audio.c +18 -3
index b69521a..f301554 100644
@@ -43,6 +43,7 @@ static DEFINE_MUTEX(had_mutex);
 static int hdmi_card_index = SNDRV_DEFAULT_IDX1;
 static char *hdmi_card_id = SNDRV_DEFAULT_STR1;
 static struct snd_intelhad *had_data;
+static int underrun_count;
 
 module_param_named(index, hdmi_card_index, int, 0444);
 MODULE_PARM_DESC(index,
@@ -1052,6 +1053,7 @@ static int snd_intelhad_open(struct snd_pcm_substream *substream)
 	intelhaddata = snd_pcm_substream_chip(substream);
 	had_stream = intelhaddata->private_data;
 	runtime = substream->runtime;
+	underrun_count = 0;
 
 	pm_runtime_get(intelhaddata->dev);
 
@@ -1445,10 +1447,23 @@ static snd_pcm_uframes_t snd_intelhad_pcm_pointer(
 
 	buf_id = intelhaddata->curr_buf % 4;
 	had_read_register(AUD_BUF_A_LENGTH + (buf_id * HAD_REG_WIDTH), &t);
-	if (t == 0) {
-		pr_debug("discovered buffer done for buf %d\n", buf_id);
-		/* had_process_buffer_done(intelhaddata); */
+
+	if ((t == 0) || (t == ((u32)-1L))) {
+		underrun_count++;
+		pr_debug("discovered buffer done for buf %d, count = %d\n",
+			buf_id, underrun_count);
+
+		if (underrun_count > (HAD_MIN_PERIODS/2)) {
+			pr_debug("assume audio_codec_reset, underrun = %d - do xrun\n",
+				underrun_count);
+			underrun_count = 0;
+			return SNDRV_PCM_POS_XRUN;
+		}
+	} else {
+		/* Reset Counter */
+		underrun_count = 0;
 	}
+
 	t = intelhaddata->buf_info[buf_id].buf_size - t;
 
 	if (intelhaddata->stream_info.buffer_rendered)
Signature · 1 line
2.9.3
#15 lore raw

✗ Fi.CI.BAT: failure for Add support for Legacy HDMI audio drivers (rev5)

In reply to Jerome Anand
== Series Details ==

== Series Details ==

Series: Add support for Legacy HDMI audio drivers (rev5)
URL : https://patchwork.freedesktop.org/series/16254/
State : failure

== Summary ==

Series 16254v5 Add support for Legacy HDMI audio drivers
https://patchwork.freedesktop.org/api/1.0/series/16254/revisions/5/mbox/

Test gem_busy:

        Subgroup basic-busy-default:
                pass       -> FAIL       (fi-ivb-3520m)
fi-bdw-5557u     total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050     total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700     total:79   pass:66   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r     total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m     total:246  pass:224  dwarn:0   dfail:0   fail:1   skip:21 
fi-ivb-3770      total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u     total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6260u     total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hq    total:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:246  pass:222  dwarn:3   dfail:0   fail:0   skip:21 
fi-snb-2520m     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600      total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

aa012aa081f6a6d2dd5a1df0f3c3736017df0d56 drm-tip: 2017y-01m-20d-09h-33m-30s UTC integration manifest 3050fb0 ALSA: x86: hdmi: continue playback even when display resolution changes b69ee35 ALSA: x86: hdmi: Add audio support for BYT and CHT
61c22bb ALSA: add Intel HDMI LPE audio driver for BYT/CHT-T
5d57199 drm/i915: Add support for audio driver notifications
6d9458c drm/i915: setup bridge for HDMI LPE audio driver

== Logs ==

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

#16 lore raw
In reply to Jerome Anand
Quoted 9 lines · Jerome Anand

Legacy (CherryTrail/ Baytrail) HDMI audio drivers added Legacy hdmi audio-Gfx interaction/ interfacing is updated to use irq chip framework

This patch series has only been tested on hardware with
a single HDMI connector/pipe and additional work may be needed for newer machines with 2 connectors

Quoted 7 lines

Jerome Anand (5):
drm/i915: setup bridge for HDMI LPE audio driver drm/i915: Add support for audio driver notifications
ALSA: add Intel HDMI LPE audio driver for BYT/CHT-T
ALSA: x86: hdmi: Add audio support for BYT and CHT
ALSA: x86: hdmi: continue playback even when display resolution
changes

I can merge the audio part and do cleanups later. This would be better than spinning forever in ML. It's a stand-alone driver, and people can test it out at least more easily. But still I need ACKs for the changes in drm/i915.

Daniel, Jani, could you guys take a look at the first two patches?

I know it's no ideal solution, and I'd love to avoid the double standards for audio-video communication, too. OTOH, it's a small portion and the API usage is pretty limited, hence we may unify / cleanup the interface later, too.

thanks,

Takashi

Quoted 22 lines
 Documentation/gpu/i915.rst             |    9 +
 drivers/gpu/drm/i915/Makefile          |    3 +
 drivers/gpu/drm/i915/i915_drv.c        |    8 +-
 drivers/gpu/drm/i915/i915_drv.h        |   17 +
 drivers/gpu/drm/i915/i915_irq.c        |   16 +
 drivers/gpu/drm/i915/i915_reg.h        |    3 +
 drivers/gpu/drm/i915/intel_audio.c     |    8 +
 drivers/gpu/drm/i915/intel_hdmi.c      |    1 +
 drivers/gpu/drm/i915/intel_lpe_audio.c |  388 +++++++
 include/drm/intel_lpe_audio.h          |   46 +
 sound/Kconfig                          |    2 +
 sound/Makefile                         |    2 +-
 sound/x86/Kconfig                      |   15 +
 sound/x86/Makefile                     |    6 +
 sound/x86/intel_hdmi_audio.c           | 1870 ++++++++++++++++++++++++++++++++
 sound/x86/intel_hdmi_audio.h           |  197 ++++
 sound/x86/intel_hdmi_audio_if.c        |  551 ++++++++++
 sound/x86/intel_hdmi_lpe_audio.c       |  617 +++++++++++
 sound/x86/intel_hdmi_lpe_audio.h       |  683 ++++++++++++
 19 files changed, 4439 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_lpe_audio.c
Quoted 14 lines
 create mode 100644 include/drm/intel_lpe_audio.h
 create mode 100644 sound/x86/Kconfig
 create mode 100644 sound/x86/Makefile
 create mode 100644 sound/x86/intel_hdmi_audio.c
 create mode 100644 sound/x86/intel_hdmi_audio.h
 create mode 100644 sound/x86/intel_hdmi_audio_if.c
 create mode 100644 sound/x86/intel_hdmi_lpe_audio.c
 create mode 100644 sound/x86/intel_hdmi_lpe_audio.h
Signature · 3 lines
2.9.3

base-commit: eb5c556a1e5eff388e48e4b7cf61e95783019e83

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