Angel Pons | ae59387 | 2020-04-04 18:50:57 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 3 | |
Furquan Shaikh | 91a7abf | 2020-04-27 18:48:48 -0700 | [diff] [blame] | 4 | #include <arch/acpigen.h> |
| 5 | #include <amdblocks/hda.h> |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 6 | #include <device/device.h> |
| 7 | #include <device/pci.h> |
| 8 | #include <device/pci_ids.h> |
Marshall Dawson | e1a59dc | 2019-08-20 18:17:54 -0600 | [diff] [blame] | 9 | #include <device/pci_ops.h> |
| 10 | #include <device/azalia_device.h> |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 11 | |
| 12 | static const unsigned short pci_device_ids[] = { |
| 13 | PCI_DEVICE_ID_AMD_SB900_HDA, |
| 14 | PCI_DEVICE_ID_AMD_CZ_HDA, |
Furquan Shaikh | a1cd7eb | 2020-04-15 23:58:22 -0700 | [diff] [blame] | 15 | PCI_DEVICE_ID_AMD_FAM17H_HDA1, |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 16 | 0 |
| 17 | }; |
| 18 | |
Furquan Shaikh | edfc5a9 | 2020-04-27 18:04:46 -0700 | [diff] [blame] | 19 | static const char *hda_acpi_name(const struct device *dev) |
| 20 | { |
| 21 | return "AZHD"; |
| 22 | } |
| 23 | |
Furquan Shaikh | 91a7abf | 2020-04-27 18:48:48 -0700 | [diff] [blame] | 24 | __weak void hda_soc_ssdt_quirks(const struct device *dev) |
| 25 | { |
| 26 | } |
| 27 | |
| 28 | static void hda_fill_ssdt(const struct device *dev) |
| 29 | { |
| 30 | acpi_device_write_pci_dev(dev); |
| 31 | hda_soc_ssdt_quirks(dev); |
| 32 | } |
| 33 | |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 34 | static struct device_operations hda_audio_ops = { |
Furquan Shaikh | 45f06c5 | 2020-04-27 18:02:21 -0700 | [diff] [blame] | 35 | .read_resources = pci_dev_read_resources, |
| 36 | .set_resources = pci_dev_set_resources, |
| 37 | .enable_resources = pci_dev_enable_resources, |
| 38 | .ops_pci = &pci_dev_ops_pci, |
Furquan Shaikh | edfc5a9 | 2020-04-27 18:04:46 -0700 | [diff] [blame] | 39 | .acpi_name = hda_acpi_name, |
Furquan Shaikh | 91a7abf | 2020-04-27 18:48:48 -0700 | [diff] [blame] | 40 | .acpi_fill_ssdt = hda_fill_ssdt, |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | static const struct pci_driver hdaaudio_driver __pci_driver = { |
Furquan Shaikh | 45f06c5 | 2020-04-27 18:02:21 -0700 | [diff] [blame] | 44 | .ops = CONFIG(AZALIA_PLUGIN_SUPPORT) ? |
| 45 | &default_azalia_audio_ops : &hda_audio_ops, |
| 46 | .vendor = PCI_VENDOR_ID_AMD, |
| 47 | .devices = pci_device_ids, |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 48 | }; |