diff mbox series

PCI: Add function 0 DMA alias quirk for Glenfly arise chip

Message ID DB918DA5CBA08DE8+20240802161109.240191-1-wangyuli@uniontech.com (mailing list archive)
State Superseded
Headers show
Series PCI: Add function 0 DMA alias quirk for Glenfly arise chip | expand

Commit Message

WangYuli Aug. 2, 2024, 4:11 p.m. UTC
Add DMA support for audio function of Glenfly arise chip,
which uses request id of function 0.

Signed-off-by: SiyuLi <siyuli@glenfly.com>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
---
 drivers/pci/quirks.c    | 6 ++++++
 include/linux/pci_ids.h | 4 ++++
 2 files changed, 10 insertions(+)

Comments

Bjorn Helgaas Aug. 22, 2024, 6:56 p.m. UTC | #1
On Sat, Aug 03, 2024 at 12:11:09AM +0800, WangYuli wrote:
> Add DMA support for audio function of Glenfly arise chip,
> which uses request id of function 0.
> 
> Signed-off-by: SiyuLi <siyuli@glenfly.com>
> Signed-off-by: WangYuli <wangyuli@uniontech.com>
> ---
>  drivers/pci/quirks.c    | 6 ++++++
>  include/linux/pci_ids.h | 4 ++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index a2ce4e08edf5..a6cb8b314fae 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -4246,6 +4246,12 @@ static void quirk_dma_func0_alias(struct pci_dev *dev)
>  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
>  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe476, quirk_dma_func0_alias);
>  
> +/*
> + * Some Glenfly chips use function 0 as the PCIe requester ID for DMA too.
> + */
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_GLENFLY, PCI_DEVICE_ID_GLENFLY_ARISE10C0_AUDIO, quirk_dma_func0_alias);
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_GLENFLY, PCI_DEVICE_ID_GLENFLY_ARISE1020_AUDIO, quirk_dma_func0_alias);
> +
>  static void quirk_dma_func1_alias(struct pci_dev *dev)
>  {
>  	if (PCI_FUNC(dev->devfn) != 1)
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index e388c8b1cbc2..35d2314cc433 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -1654,6 +1654,10 @@
>  #define PCI_DEVICE_ID_RICOH_R5C832	0x0832
>  #define PCI_DEVICE_ID_RICOH_R5C843	0x0843
>  
> +#define PCI_VENDOR_ID_GLENFLY	    0x6766

From include/linux/pci_ids.h:

 *      Please keep sorted by numeric Vendor ID and Device ID.
 *
 *      Do not add new entries to this file unless the definitions
 *      are shared between multiple drivers.

The Vendor ID definition is OK, but needs to be moved so the file
stays sorted.

> +#define PCI_DEVICE_ID_GLENFLY_ARISE10C0_AUDIO	 0x3D40
> +#define PCI_DEVICE_ID_GLENFLY_ARISE1020_AUDIO	 0x3D41

Use the bare hex values in the quirk instead.

If/when there are more uses for them, we can add #defines here.

I see this in sound/pci/hda/hda_intel.c:

        /* 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 },

Since you're adding PCI_VENDOR_ID_GLENFLY here, it would be nice to
update hda_intel.c to use the definition.

>  #define PCI_VENDOR_ID_DLINK		0x1186
>  #define PCI_DEVICE_ID_DLINK_DGE510T	0x4c00
>  
> -- 
> 2.43.4
>
diff mbox series

Patch

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index a2ce4e08edf5..a6cb8b314fae 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -4246,6 +4246,12 @@  static void quirk_dma_func0_alias(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe476, quirk_dma_func0_alias);
 
+/*
+ * Some Glenfly chips use function 0 as the PCIe requester ID for DMA too.
+ */
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_GLENFLY, PCI_DEVICE_ID_GLENFLY_ARISE10C0_AUDIO, quirk_dma_func0_alias);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_GLENFLY, PCI_DEVICE_ID_GLENFLY_ARISE1020_AUDIO, quirk_dma_func0_alias);
+
 static void quirk_dma_func1_alias(struct pci_dev *dev)
 {
 	if (PCI_FUNC(dev->devfn) != 1)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index e388c8b1cbc2..35d2314cc433 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1654,6 +1654,10 @@ 
 #define PCI_DEVICE_ID_RICOH_R5C832	0x0832
 #define PCI_DEVICE_ID_RICOH_R5C843	0x0843
 
+#define PCI_VENDOR_ID_GLENFLY	    0x6766
+#define PCI_DEVICE_ID_GLENFLY_ARISE10C0_AUDIO	 0x3D40
+#define PCI_DEVICE_ID_GLENFLY_ARISE1020_AUDIO	 0x3D41
+
 #define PCI_VENDOR_ID_DLINK		0x1186
 #define PCI_DEVICE_ID_DLINK_DGE510T	0x4c00