alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] ALSA: hda - add Intel DG1 support
@ 2020-09-21 14:17 Kai Vehmanen
  2020-09-21 14:17 ` [PATCH 1/4] ALSA: hda - add Intel DG1 PCI and HDMI ids Kai Vehmanen
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Kai Vehmanen @ 2020-09-21 14:17 UTC (permalink / raw)
  To: alsa-devel, tiwai; +Cc: kai.vehmanen

Series adding support for HDMI/DP audio for Intel DG1.

Kai Vehmanen (4):
  ALSA: hda - add Intel DG1 PCI and HDMI ids
  ALSA: hda - controller is in GPU on the DG1
  ALSA: hda - handle multiple i915 device instances
  ALSA: hda - fix CONTROLLER_IN_GPU macro name

 sound/hda/hdac_i915.c      | 48 ++++++++++++++++++++++++++++++++++----
 sound/pci/hda/hda_intel.c  |  6 ++++-
 sound/pci/hda/patch_hdmi.c |  1 +
 3 files changed, 50 insertions(+), 5 deletions(-)

-- 
2.27.0


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

* [PATCH 1/4] ALSA: hda - add Intel DG1 PCI and HDMI ids
  2020-09-21 14:17 [PATCH 0/4] ALSA: hda - add Intel DG1 support Kai Vehmanen
@ 2020-09-21 14:17 ` Kai Vehmanen
  2020-09-21 14:17 ` [PATCH 2/4] ALSA: hda - controller is in GPU on the DG1 Kai Vehmanen
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kai Vehmanen @ 2020-09-21 14:17 UTC (permalink / raw)
  To: alsa-devel, tiwai; +Cc: kai.vehmanen

Add Intel DG1 PCI id to list of supported HDA controllers and
add its HDMI id as well.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/pci/hda/hda_intel.c  | 3 +++
 sound/pci/hda/patch_hdmi.c | 1 +
 2 files changed, 4 insertions(+)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 36a9dbc33aa0..904d3af5b99e 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2493,6 +2493,9 @@ static const struct pci_device_id azx_ids[] = {
 	/* Tigerlake-H */
 	{ PCI_DEVICE(0x8086, 0x43c8),
 	  .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
+	/* DG1 */
+	{ PCI_DEVICE(0x8086, 0x490d),
+	  .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
 	/* Elkhart Lake */
 	{ PCI_DEVICE(0x8086, 0x4b55),
 	  .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 402050088090..055440740184 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -4269,6 +4269,7 @@ HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI",	patch_i915_glk_hdmi),
 HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI",	patch_i915_glk_hdmi),
 HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI",	patch_i915_icl_hdmi),
 HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI",	patch_i915_tgl_hdmi),
+HDA_CODEC_ENTRY(0x80862814, "DG1 HDMI",	patch_i915_tgl_hdmi),
 HDA_CODEC_ENTRY(0x80862816, "Rocketlake HDMI",	patch_i915_tgl_hdmi),
 HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI",	patch_i915_icl_hdmi),
 HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI",	patch_i915_icl_hdmi),
-- 
2.27.0


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

* [PATCH 2/4] ALSA: hda - controller is in GPU on the DG1
  2020-09-21 14:17 [PATCH 0/4] ALSA: hda - add Intel DG1 support Kai Vehmanen
  2020-09-21 14:17 ` [PATCH 1/4] ALSA: hda - add Intel DG1 PCI and HDMI ids Kai Vehmanen
@ 2020-09-21 14:17 ` Kai Vehmanen
  2020-09-21 14:17 ` [PATCH 3/4] ALSA: hda - handle multiple i915 device instances Kai Vehmanen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kai Vehmanen @ 2020-09-21 14:17 UTC (permalink / raw)
  To: alsa-devel, tiwai; +Cc: kai.vehmanen

Add Intel DG1 to the CONTROLLER_IN_GPU list to ensure audio power is
requested whenever programming the controller.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/pci/hda/hda_intel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 904d3af5b99e..61e495187b1a 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -368,7 +368,8 @@ enum {
 #define CONTROLLER_IN_GPU(pci) (((pci)->device == 0x0a0c) || \
 					((pci)->device == 0x0c0c) || \
 					((pci)->device == 0x0d0c) || \
-					((pci)->device == 0x160c))
+					((pci)->device == 0x160c) || \
+					((pci)->device == 0x490d))
 
 #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
 
-- 
2.27.0


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

* [PATCH 3/4] ALSA: hda - handle multiple i915 device instances
  2020-09-21 14:17 [PATCH 0/4] ALSA: hda - add Intel DG1 support Kai Vehmanen
  2020-09-21 14:17 ` [PATCH 1/4] ALSA: hda - add Intel DG1 PCI and HDMI ids Kai Vehmanen
  2020-09-21 14:17 ` [PATCH 2/4] ALSA: hda - controller is in GPU on the DG1 Kai Vehmanen
@ 2020-09-21 14:17 ` Kai Vehmanen
  2020-09-21 14:17 ` [PATCH 4/4] ALSA: hda - fix CONTROLLER_IN_GPU macro name Kai Vehmanen
  2020-09-21 16:00 ` [PATCH 0/4] ALSA: hda - add Intel DG1 support Takashi Iwai
  4 siblings, 0 replies; 6+ messages in thread
From: Kai Vehmanen @ 2020-09-21 14:17 UTC (permalink / raw)
  To: alsa-devel, tiwai; +Cc: kai.vehmanen

Currently i915_component_master_match() will return the first matching
i915 instance. This does not work in case system has multiple i915
and HDA audio controller instances.

Add a new connectivity check that handles following cases:
 - i915 and HDA controller on same PCI bus
 - discrete GPU with embedded HDA audio controller connected
   via PCI bridge

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/hda/hdac_i915.c | 44 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
index 3c2db3816029..50b2c1db429b 100644
--- a/sound/hda/hdac_i915.c
+++ b/sound/hda/hdac_i915.c
@@ -73,11 +73,51 @@ void snd_hdac_i915_set_bclk(struct hdac_bus *bus)
 }
 EXPORT_SYMBOL_GPL(snd_hdac_i915_set_bclk);
 
+/**
+ * Returns true if the devices can be connected for audio.
+ */
+static bool connectivity_check(struct pci_dev *i915, struct pci_dev *hdac)
+{
+	struct pci_bus *bus_a = i915->bus, *bus_b = hdac->bus;
+
+	/* directly connected on the same bus */
+	if (bus_a == bus_b)
+		return true;
+
+	/*
+	 * on i915 discrete GPUs with embedded HDA audio, the two
+	 * devices are connected via 2nd level PCI bridge
+	 */
+	bus_a = bus_a->parent;
+	bus_b = bus_b->parent;
+	if (!bus_a || !bus_b)
+		return false;
+	bus_a = bus_a->parent;
+	bus_b = bus_b->parent;
+	if (bus_a && bus_a == bus_b)
+		return true;
+
+	return false;
+}
+
 static int i915_component_master_match(struct device *dev, int subcomponent,
 				       void *data)
 {
-	return !strcmp(dev->driver->name, "i915") &&
-	       subcomponent == I915_COMPONENT_AUDIO;
+	struct pci_dev *hdac_pci, *i915_pci;
+	struct hdac_bus *bus = data;
+
+	if (!dev_is_pci(dev))
+		return 0;
+
+	hdac_pci = to_pci_dev(bus->dev);
+	i915_pci = to_pci_dev(dev);
+
+	if (!strcmp(dev->driver->name, "i915") &&
+	    subcomponent == I915_COMPONENT_AUDIO &&
+	    connectivity_check(i915_pci, hdac_pci))
+		return 1;
+
+	return 0;
 }
 
 /* check whether intel graphics is present */
-- 
2.27.0


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

* [PATCH 4/4] ALSA: hda - fix CONTROLLER_IN_GPU macro name
  2020-09-21 14:17 [PATCH 0/4] ALSA: hda - add Intel DG1 support Kai Vehmanen
                   ` (2 preceding siblings ...)
  2020-09-21 14:17 ` [PATCH 3/4] ALSA: hda - handle multiple i915 device instances Kai Vehmanen
@ 2020-09-21 14:17 ` Kai Vehmanen
  2020-09-21 16:00 ` [PATCH 0/4] ALSA: hda - add Intel DG1 support Takashi Iwai
  4 siblings, 0 replies; 6+ messages in thread
From: Kai Vehmanen @ 2020-09-21 14:17 UTC (permalink / raw)
  To: alsa-devel, tiwai; +Cc: kai.vehmanen

The CONTROLLER_IN_GPU() macro has different semantics than
the similarly named macro in hda_intel.c. The name is also
misleading as the macro is used to apply a Intel HSW/BDW
programming logic for HDA controller clock configuration.
Rename macro to reflect the actual implementation.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/hda/hdac_i915.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
index 50b2c1db429b..d236e497435d 100644
--- a/sound/hda/hdac_i915.c
+++ b/sound/hda/hdac_i915.c
@@ -13,7 +13,7 @@
 
 static struct completion bind_complete;
 
-#define CONTROLLER_IN_GPU(pci) (((pci)->device == 0x0a0c) || \
+#define IS_HSW_CONTROLLER(pci) (((pci)->device == 0x0a0c) || \
 				((pci)->device == 0x0c0c) || \
 				((pci)->device == 0x0d0c) || \
 				((pci)->device == 0x160c))
@@ -41,7 +41,7 @@ void snd_hdac_i915_set_bclk(struct hdac_bus *bus)
 
 	if (!acomp || !acomp->ops || !acomp->ops->get_cdclk_freq)
 		return; /* only for i915 binding */
-	if (!CONTROLLER_IN_GPU(pci))
+	if (!IS_HSW_CONTROLLER(pci))
 		return; /* only HSW/BDW */
 
 	cdclk_freq = acomp->ops->get_cdclk_freq(acomp->dev);
-- 
2.27.0


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

* Re: [PATCH 0/4] ALSA: hda - add Intel DG1 support
  2020-09-21 14:17 [PATCH 0/4] ALSA: hda - add Intel DG1 support Kai Vehmanen
                   ` (3 preceding siblings ...)
  2020-09-21 14:17 ` [PATCH 4/4] ALSA: hda - fix CONTROLLER_IN_GPU macro name Kai Vehmanen
@ 2020-09-21 16:00 ` Takashi Iwai
  4 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2020-09-21 16:00 UTC (permalink / raw)
  To: Kai Vehmanen; +Cc: alsa-devel

On Mon, 21 Sep 2020 16:17:37 +0200,
Kai Vehmanen wrote:
> 
> Series adding support for HDMI/DP audio for Intel DG1.
> 
> Kai Vehmanen (4):
>   ALSA: hda - add Intel DG1 PCI and HDMI ids
>   ALSA: hda - controller is in GPU on the DG1
>   ALSA: hda - handle multiple i915 device instances
>   ALSA: hda - fix CONTROLLER_IN_GPU macro name

Applied all four patches now to for-next branch.


thanks,

Takashi

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

end of thread, other threads:[~2020-09-21 16:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 14:17 [PATCH 0/4] ALSA: hda - add Intel DG1 support Kai Vehmanen
2020-09-21 14:17 ` [PATCH 1/4] ALSA: hda - add Intel DG1 PCI and HDMI ids Kai Vehmanen
2020-09-21 14:17 ` [PATCH 2/4] ALSA: hda - controller is in GPU on the DG1 Kai Vehmanen
2020-09-21 14:17 ` [PATCH 3/4] ALSA: hda - handle multiple i915 device instances Kai Vehmanen
2020-09-21 14:17 ` [PATCH 4/4] ALSA: hda - fix CONTROLLER_IN_GPU macro name Kai Vehmanen
2020-09-21 16:00 ` [PATCH 0/4] ALSA: hda - add Intel DG1 support Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).