linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ALSA: hda: Glenfly: add HD Audio PCI IDs and HDMI Codec Vendor IDs.
@ 2023-04-25 10:15 Reaper Li
  2023-04-25 14:17 ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Reaper Li @ 2023-04-25 10:15 UTC (permalink / raw)
  To: tiwai, perex; +Cc: linux-kernel, alsa-devel, jasontao, Reaper Li

From: jasontao <jasontao@glenfly.com>

Add a set of HD Audio PCI IDS, and the HDMI codec vendor IDs for
Glenfly Gpus.

- In default_bdl_pos_adj, set bdl to 128 as Glenfly Gpus have hardware
limitation, need to increase hdac interrupt interval.
- In azx_first_init, enable polling mode for Glenfly Gpu. When the codec
complete the command, it sends interrupt and writes response entries to
memory, howerver, the write requests sometimes are not actually
synchronized to memory when driver handle hdac interrupt on Glenfly Gpus.
If the RIRB status is not updated in the interrupt handler,
azx_rirb_get_response keeps trying to recevie a response from rirb until
1s timeout. Enabling polling mode for Glenfly Gpu can fix the issue.
- In patch_gf_hdmi, set Glenlfy Gpu Codec's no_sticky_stream as it need
driver to do actual clean-ups for the linked codec when switch from one
codec to another.

Signed-off-by: jasontao <jasontao@glenfly.com>
Signed-off-by: Reaper Li <reaperlioc@glenfly.com>
---
v2: add some comments for code and details in the commit log.

 sound/pci/hda/hda_intel.c  | 17 +++++++++++++++++
 sound/pci/hda/patch_hdmi.c | 20 ++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 77a592f21..0d6bf3ac6 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -227,6 +227,7 @@ enum {
 	AZX_DRIVER_ATI,
 	AZX_DRIVER_ATIHDMI,
 	AZX_DRIVER_ATIHDMI_NS,
+	AZX_DRIVER_GFHDMI,
 	AZX_DRIVER_VIA,
 	AZX_DRIVER_SIS,
 	AZX_DRIVER_ULI,
@@ -349,6 +350,7 @@ static const char * const driver_short_names[] = {
 	[AZX_DRIVER_ATI] = "HDA ATI SB",
 	[AZX_DRIVER_ATIHDMI] = "HDA ATI HDMI",
 	[AZX_DRIVER_ATIHDMI_NS] = "HDA ATI HDMI",
+	[AZX_DRIVER_GFHDMI] = "HDA GF HDMI",
 	[AZX_DRIVER_VIA] = "HDA VIA VT82xx",
 	[AZX_DRIVER_SIS] = "HDA SIS966",
 	[AZX_DRIVER_ULI] = "HDA ULI M5461",
@@ -1743,6 +1745,10 @@ static int default_bdl_pos_adj(struct azx *chip)
 	}
 
 	switch (chip->driver_type) {
+	/* increase the bdl size for Glenfly Gpus for hardware
+	 * limitation on hdac interrupt interval */
+	case AZX_DRIVER_GFHDMI:
+		return 128;
 	case AZX_DRIVER_ICH:
 	case AZX_DRIVER_PCH:
 		return 1;
@@ -1858,6 +1864,10 @@ static int azx_first_init(struct azx *chip)
 		pci_write_config_dword(pci, PCI_BASE_ADDRESS_1, 0);
 	}
 #endif
+	/* Fix reponse write request not synced to memory when handle
+	 * hdac interrupt on Glenfly Gpus */
+	if (chip->driver_type == AZX_DRIVER_GFHDMI)
+		bus->polling_mode = 1;
 
 	err = pcim_iomap_regions(pci, 1 << 0, "ICH HD audio");
 	if (err < 0)
@@ -1959,6 +1969,7 @@ static int azx_first_init(struct azx *chip)
 			chip->playback_streams = ATIHDMI_NUM_PLAYBACK;
 			chip->capture_streams = ATIHDMI_NUM_CAPTURE;
 			break;
+		case AZX_DRIVER_GFHDMI:
 		case AZX_DRIVER_GENERIC:
 		default:
 			chip->playback_streams = ICH6_NUM_PLAYBACK;
@@ -2724,6 +2735,12 @@ static const struct pci_device_id azx_ids[] = {
 	{ PCI_DEVICE(0x1002, 0xab38),
 	  .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS |
 	  AZX_DCAPS_PM_RUNTIME },
+	/* GLENFLY */
+	{ PCI_DEVICE(0x6766, PCI_ANY_ID),
+	  .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8,
+	  .class_mask = 0xffffff,
+	  .driver_data = AZX_DRIVER_GFHDMI | AZX_DCAPS_POSFIX_LPIB |
+	  AZX_DCAPS_NO_MSI | AZX_DCAPS_NO_64BIT },
 	/* VIA VT8251/VT8237A */
 	{ PCI_DEVICE(0x1106, 0x3288), .driver_data = AZX_DRIVER_VIA },
 	/* VIA GFX VT7122/VX900 */
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 4ffa3a59f..03197abda 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -4489,6 +4489,20 @@ static int patch_via_hdmi(struct hda_codec *codec)
 	return patch_simple_hdmi(codec, VIAHDMI_CVT_NID, VIAHDMI_PIN_NID);
 }
 
+static int patch_gf_hdmi(struct hda_codec *codec)
+{
+	int err;
+
+	err = patch_generic_hdmi(codec);
+	if (err)
+		return err;
+
+	/* Glenfly GPUs have two codecs, stream switches from one codec to
+	 * another, need to do actual clean-ups in codec_cleanup_stream */
+	codec->no_sticky_stream = 1;
+	return 0;
+}
+
 /*
  * patch entries
  */
@@ -4579,6 +4593,12 @@ HDA_CODEC_ENTRY(0x10de009f, "GPU 9f HDMI/DP",	patch_nvhdmi),
 HDA_CODEC_ENTRY(0x10de00a0, "GPU a0 HDMI/DP",	patch_nvhdmi),
 HDA_CODEC_ENTRY(0x10de8001, "MCP73 HDMI",	patch_nvhdmi_2ch),
 HDA_CODEC_ENTRY(0x10de8067, "MCP67/68 HDMI",	patch_nvhdmi_2ch),
+HDA_CODEC_ENTRY(0x67663d82, "Arise 82 HDMI/DP",	patch_gf_hdmi),
+HDA_CODEC_ENTRY(0x67663d83, "Arise 83 HDMI/DP",	patch_gf_hdmi),
+HDA_CODEC_ENTRY(0x67663d84, "Arise 84 HDMI/DP",	patch_gf_hdmi),
+HDA_CODEC_ENTRY(0x67663d85, "Arise 85 HDMI/DP",	patch_gf_hdmi),
+HDA_CODEC_ENTRY(0x67663d86, "Arise 86 HDMI/DP",	patch_gf_hdmi),
+HDA_CODEC_ENTRY(0x67663d87, "Arise 87 HDMI/DP",	patch_gf_hdmi),
 HDA_CODEC_ENTRY(0x11069f80, "VX900 HDMI/DP",	patch_via_hdmi),
 HDA_CODEC_ENTRY(0x11069f81, "VX900 HDMI/DP",	patch_via_hdmi),
 HDA_CODEC_ENTRY(0x11069f84, "VX11 HDMI/DP",	patch_generic_hdmi),
-- 
2.20.1


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

* Re: [PATCH v2] ALSA: hda: Glenfly: add HD Audio PCI IDs and HDMI Codec Vendor IDs.
  2023-04-25 10:15 [PATCH v2] ALSA: hda: Glenfly: add HD Audio PCI IDs and HDMI Codec Vendor IDs Reaper Li
@ 2023-04-25 14:17 ` Takashi Iwai
  2023-04-26  3:30   ` Reaper Li_OC
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2023-04-25 14:17 UTC (permalink / raw)
  To: Reaper Li; +Cc: tiwai, perex, linux-kernel, alsa-devel, jasontao

On Tue, 25 Apr 2023 12:15:24 +0200,
Reaper Li wrote:
> 
> From: jasontao <jasontao@glenfly.com>
> 
> Add a set of HD Audio PCI IDS, and the HDMI codec vendor IDs for
> Glenfly Gpus.
> 
> - In default_bdl_pos_adj, set bdl to 128 as Glenfly Gpus have hardware
> limitation, need to increase hdac interrupt interval.
> - In azx_first_init, enable polling mode for Glenfly Gpu. When the codec
> complete the command, it sends interrupt and writes response entries to
> memory, howerver, the write requests sometimes are not actually
> synchronized to memory when driver handle hdac interrupt on Glenfly Gpus.
> If the RIRB status is not updated in the interrupt handler,
> azx_rirb_get_response keeps trying to recevie a response from rirb until
> 1s timeout. Enabling polling mode for Glenfly Gpu can fix the issue.
> - In patch_gf_hdmi, set Glenlfy Gpu Codec's no_sticky_stream as it need
> driver to do actual clean-ups for the linked codec when switch from one
> codec to another.
> 
> Signed-off-by: jasontao <jasontao@glenfly.com>
> Signed-off-by: Reaper Li <reaperlioc@glenfly.com>
> ---
> v2: add some comments for code and details in the commit log.

This is almost fine, but could just correct minor warnings
scripts/checkpatch.pl complains?


thanks,

Takashi

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

* Re: [PATCH v2] ALSA: hda: Glenfly: add HD Audio PCI IDs and HDMI Codec Vendor IDs.
  2023-04-25 14:17 ` Takashi Iwai
@ 2023-04-26  3:30   ` Reaper Li_OC
  0 siblings, 0 replies; 5+ messages in thread
From: Reaper Li_OC @ 2023-04-26  3:30 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: perex, Jason Tao(SH-RD), linux-kernel, alsa-devel


> This is almost fine, but could just correct minor warnings
> scripts/checkpatch.pl complains?

Appreciate for your help, have fixed the warnings and resend the v3
patch.

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

* Re: [PATCH v2] ALSA: hda: Glenfly: add HD Audio PCI IDs and HDMI Codec Vendor IDs.
  2023-04-14 10:29 ReaperLi
@ 2023-04-14 12:17 ` Takashi Iwai
  0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2023-04-14 12:17 UTC (permalink / raw)
  To: ReaperLi; +Cc: perex, tiwai, linux-kernel, jasontao

On Fri, 14 Apr 2023 12:29:12 +0200,
ReaperLi wrote:
> 
> From: jasontao <jasontao@glenfly.com>
> 
> Add a set of HD Audio PCI IDS, and the HDMI codec vendor IDs for
> Glenfly Arise.
> 
> Signed-off-by: jasontao <jasontao@glenfly.com>
> Signed-off-by: ReaperLi <ReaperLi@glenfly.com>
> ---
> Changes in v2:
>   - use tab instead of space.

The patch still can't be applied, and it's likely the problem of your
mailer.  Try git-send-email.


Takashi

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

* [PATCH v2] ALSA: hda: Glenfly: add HD Audio PCI IDs and HDMI Codec Vendor IDs.
@ 2023-04-14 10:29 ReaperLi
  2023-04-14 12:17 ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: ReaperLi @ 2023-04-14 10:29 UTC (permalink / raw)
  To: perex, tiwai; +Cc: linux-kernel, jasontao, ReaperLi

From: jasontao <jasontao@glenfly.com>

Add a set of HD Audio PCI IDS, and the HDMI codec vendor IDs for
Glenfly Arise.

Signed-off-by: jasontao <jasontao@glenfly.com>
Signed-off-by: ReaperLi <ReaperLi@glenfly.com>
---
Changes in v2:
  - use tab instead of space.
  - change the codec name.

 sound/pci/hda/hda_intel.c  | 14 ++++++++++++++
 sound/pci/hda/patch_hdmi.c | 18 ++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 77a592f21..6c4a559d9 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -227,6 +227,7 @@ enum {
        AZX_DRIVER_ATI,
        AZX_DRIVER_ATIHDMI,
        AZX_DRIVER_ATIHDMI_NS,
+       AZX_DRIVER_GFHDMI,
        AZX_DRIVER_VIA,
        AZX_DRIVER_SIS,
        AZX_DRIVER_ULI,
@@ -349,6 +350,7 @@ static const char * const driver_short_names[] = {
        [AZX_DRIVER_ATI] = "HDA ATI SB",
        [AZX_DRIVER_ATIHDMI] = "HDA ATI HDMI",
        [AZX_DRIVER_ATIHDMI_NS] = "HDA ATI HDMI",
+       [AZX_DRIVER_GFHDMI] = "HDA GF HDMI",
        [AZX_DRIVER_VIA] = "HDA VIA VT82xx",
        [AZX_DRIVER_SIS] = "HDA SIS966",
        [AZX_DRIVER_ULI] = "HDA ULI M5461",
@@ -1743,6 +1745,8 @@ static int default_bdl_pos_adj(struct azx *chip)
        }

        switch (chip->driver_type) {
+       case AZX_DRIVER_GFHDMI:
+               return 128;
        case AZX_DRIVER_ICH:
        case AZX_DRIVER_PCH:
                return 1;
@@ -1859,6 +1863,9 @@ static int azx_first_init(struct azx *chip)
        }
 #endif

+       if (chip->driver_type == AZX_DRIVER_GFHDMI)
+               bus->polling_mode = 1;
+
        err = pcim_iomap_regions(pci, 1 << 0, "ICH HD audio");
        if (err < 0)
                return err;
@@ -1959,6 +1966,7 @@ static int azx_first_init(struct azx *chip)
                        chip->playback_streams = ATIHDMI_NUM_PLAYBACK;
                        chip->capture_streams = ATIHDMI_NUM_CAPTURE;
                        break;
+               case AZX_DRIVER_GFHDMI:
                case AZX_DRIVER_GENERIC:
                default:
                        chip->playback_streams = ICH6_NUM_PLAYBACK;
@@ -2724,6 +2732,12 @@ static const struct pci_device_id azx_ids[] = {
        { PCI_DEVICE(0x1002, 0xab38),
          .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS |
          AZX_DCAPS_PM_RUNTIME },
+       /* GLENFLY */
+       { PCI_DEVICE(0x6766, PCI_ANY_ID),
+         .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8,
+         .class_mask = 0xffffff,
+         .driver_data = AZX_DRIVER_GFHDMI | AZX_DCAPS_POSFIX_LPIB |
+         AZX_DCAPS_NO_MSI | AZX_DCAPS_NO_64BIT },
        /* VIA VT8251/VT8237A */
        { PCI_DEVICE(0x1106, 0x3288), .driver_data = AZX_DRIVER_VIA },
        /* VIA GFX VT7122/VX900 */
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 4ffa3a59f..e51c610a2 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -4489,6 +4489,18 @@ static int patch_via_hdmi(struct hda_codec *codec)
        return patch_simple_hdmi(codec, VIAHDMI_CVT_NID, VIAHDMI_PIN_NID);
 }

+static int patch_gf_hdmi(struct hda_codec *codec)
+{
+       int err;
+
+       err = patch_generic_hdmi(codec);
+       if (err)
+               return err;
+
+       codec->no_sticky_stream = 1;
+       return 0;
+}
+
 /*
  * patch entries
  */
@@ -4579,6 +4591,12 @@ HDA_CODEC_ENTRY(0x10de009f, "GPU 9f HDMI/DP",    patch_nvhdmi),
 HDA_CODEC_ENTRY(0x10de00a0, "GPU a0 HDMI/DP",  patch_nvhdmi),
 HDA_CODEC_ENTRY(0x10de8001, "MCP73 HDMI",      patch_nvhdmi_2ch),
 HDA_CODEC_ENTRY(0x10de8067, "MCP67/68 HDMI",   patch_nvhdmi_2ch),
+HDA_CODEC_ENTRY(0x67663d82, "Arise 82 HDMI/DP",        patch_gf_hdmi),
+HDA_CODEC_ENTRY(0x67663d83, "Arise 83 HDMI/DP",        patch_gf_hdmi),
+HDA_CODEC_ENTRY(0x67663d84, "Arise 84 HDMI/DP",        patch_gf_hdmi),
+HDA_CODEC_ENTRY(0x67663d85, "Arise 85 HDMI/DP",        patch_gf_hdmi),
+HDA_CODEC_ENTRY(0x67663d86, "Arise 86 HDMI/DP",        patch_gf_hdmi),
+HDA_CODEC_ENTRY(0x67663d87, "Arise 87 HDMI/DP",        patch_gf_hdmi),
 HDA_CODEC_ENTRY(0x11069f80, "VX900 HDMI/DP",   patch_via_hdmi),
 HDA_CODEC_ENTRY(0x11069f81, "VX900 HDMI/DP",   patch_via_hdmi),
 HDA_CODEC_ENTRY(0x11069f84, "VX11 HDMI/DP",    patch_generic_hdmi),
--
2.20.1



±£ÃÜÉùÃ÷£º
±¾Óʼþº¬Óб£ÃÜ»òרÓÐÐÅÏ¢£¬½ö¹©Ö¸¶¨ÊÕ¼þÈËʹÓá£ÑϽû¶Ô±¾Óʼþ»òÆäÄÚÈÝ×öÈκÎδ¾­ÊÚȨµÄ²éÔÄ¡¢Ê¹Óᢸ´ÖÆ»òת·¢¡£
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for the sole use of its intended recipient. Any unauthorized review, use, copying or forwarding of this email or the content of this email is strictly prohibited.

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

end of thread, other threads:[~2023-04-26  3:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-25 10:15 [PATCH v2] ALSA: hda: Glenfly: add HD Audio PCI IDs and HDMI Codec Vendor IDs Reaper Li
2023-04-25 14:17 ` Takashi Iwai
2023-04-26  3:30   ` Reaper Li_OC
  -- strict thread matches above, loose matches on Subject: below --
2023-04-14 10:29 ReaperLi
2023-04-14 12:17 ` 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).