ALSA: hda - Add new driver for HDA controllers listed via ACPI
PATCH 1/1 ALSA: hda - Add new driver for HDA controllers listed via ACPI
Some systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI _CRS object, for example, as listed in this ACPI table dump excerpt:
Device (HDA0)
{
Name (_HID, "NVDA2014") // _HID: Hardware ID
...
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
Memory32Fixed (ReadWrite,
0x36078000, // Address Base
0x00008000, // Address Length
)
Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, )
{
0x0000021E,
}
})
}Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from _CRS objects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.
Although this driver is in the sound/pci/hda/ directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been used for PCI-based devices.
--- sound/pci/hda/Kconfig | 11 ++ sound/pci/hda/Makefile | 2 + sound/pci/hda/hda_acpi.c | 316 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 329 insertions(+) create mode 100644 sound/pci/hda/hda_acpi.c
sound/pci/hda/Kconfig +11 -0
@@ -42,6 +42,17 @@ config SND_HDA_TEGRA To compile this driver as a module, choose M here: the module will be called snd-hda-tegra. +config SND_HDA_ACPI + tristate "HD Audio ACPI" + depends on ACPI + select SND_HDA + help + Say Y here to include support for Azalia-compatible HDA controllers + which are advertised via ACPI objects. + + To compile this driver as a module, choose M here: the module + will be called snd-hda-acpi. + if SND_HDA config SND_HDA_HWDEP
sound/pci/hda/Makefile +2 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 snd-hda-intel-y := hda_intel.o snd-hda-tegra-y := hda_tegra.o +snd-hda-acpi-y := hda_acpi.o snd-hda-codec-y := hda_bind.o hda_codec.o hda_jack.o hda_auto_parser.o hda_sysfs.o snd-hda-codec-y += hda_controller.o
@@ -80,3 +81,4 @@ obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_SPI) += snd-hda-scodec-tas2781-spi.o # when built in kernel obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o obj-$(CONFIG_SND_HDA_TEGRA) += snd-hda-tegra.o +obj-$(CONFIG_SND_HDA_ACPI) += snd-hda-acpi.o
sound/pci/hda/hda_acpi.c new file +316 -0
316 lines not on this page · raw message
Signature · 1 line
2.39.5
Quoted 30 lines · Daniel Dadap
Some systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI
_CRSobject, for example, as listed in this ACPI table dump excerpt:Device (HDA0) { Name (_HID, "NVDA2014") // _HID: Hardware ID ... Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { Memory32Fixed (ReadWrite, 0x36078000, // Address Base 0x00008000, // Address Length ) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) { 0x0000021E, } }) }Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from
_CRSobjects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.
Quoted 6 lines
Although this driver is in the
sound/pci/hda/directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been used for PCI-based devices.Signed-off-by Daniel Dadap <[email protected]>
Thanks for the patch.
The code looks fine. Just a nitpicking:
Quoted 1 line
+static int
__maybe_unusedhda_acpi_suspend(struct device *dev)
....
Quoted 1 line
+static int
__maybe_unusedhda_acpi_resume(struct device *dev)
The __maybe_unused is superfluous when you set upSYSTEM_SLEEP_PM_OPS() macro instead in the below:
sound/pci/hda/hda_acpi.c line 287
Quoted 2 lines
sound/pci/hda/hda_acpi.c new file +2
-0+static const struct dev_pm_ops hda_acpi_pm = { +SET_SYSTEM_SLEEP_PM_OPS (hda_acpi_suspend, hda_acpi_resume)
thanks,
Takashi
Quoted 44 lines · Takashi Iwai
Quoted 30 lines · Daniel Dadap
Some systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI
_CRSobject, for example, as listed in this ACPI table dump excerpt:Device (HDA0) { Name (_HID, "NVDA2014") // _HID: Hardware ID ... Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { Memory32Fixed (ReadWrite, 0x36078000, // Address Base 0x00008000, // Address Length ) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) { 0x0000021E, } }) }Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from
_CRSobjects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.Quoted 6 lines
Although this driver is in the
sound/pci/hda/directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been used for PCI-based devices.Signed-off-by Daniel Dadap <[email protected]>Thanks for the patch.
The code looks fine. Just a nitpicking:Quoted 1 line
+static int
__maybe_unusedhda_acpi_suspend(struct device *dev)
Quoted 8 lines
....
Quoted 1 line
+static int
__maybe_unusedhda_acpi_resume(struct device *dev)The
__maybe_unusedis superfluous when you set upSYSTEM_SLEEP_PM_OPS()macro instead in the below:sound/pci/hda/hda_acpi.c line 287
Quoted 2 lines
sound/pci/hda/hda_acpi.c new file +2
-0+static const struct dev_pm_ops hda_acpi_pm = { +SET_SYSTEM_SLEEP_PM_OPS (hda_acpi_suspend, hda_acpi_resume)
Also, at the next time, please put the maintainer (me) to Cc.
thanks,
Takashi
Quoted 49 lines · Takashi Iwai
Quoted 47 lines · Takashi Iwai
Quoted 30 lines · Daniel Dadap
Some systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI
_CRSobject, for example, as listed in this ACPI table dump excerpt:Device (HDA0) { Name (_HID, "NVDA2014") // _HID: Hardware ID ... Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { Memory32Fixed (ReadWrite, 0x36078000, // Address Base 0x00008000, // Address Length ) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) { 0x0000021E, } }) }Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from
_CRSobjects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.Quoted 6 lines
Although this driver is in the
sound/pci/hda/directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been used for PCI-based devices.Signed-off-by Daniel Dadap <[email protected]>Thanks for the patch.
The code looks fine. Just a nitpicking:Quoted 1 line
+static int
__maybe_unusedhda_acpi_suspend(struct device *dev)....
Quoted 1 line
+static int
__maybe_unusedhda_acpi_resume(struct device *dev)
Quoted 8 lines
Quoted 5 lines
The
__maybe_unusedis superfluous when you set upSYSTEM_SLEEP_PM_OPS()macro instead in the below:sound/pci/hda/hda_acpi.c line 287
Quoted 2 lines
sound/pci/hda/hda_acpi.c new file +2
-0+static const struct dev_pm_ops hda_acpi_pm = { +SET_SYSTEM_SLEEP_PM_OPS (hda_acpi_suspend, hda_acpi_resume)Also, at the next time, please put the maintainer (me) to Cc.
Sure, already sent it with you on To: as a reply to the last message. I was wrong about hda_tegra having __maybe_unused, you already cleaned that up.
Quoted 4 lines
thanks,
Takashi
Quoted 53 lines · Daniel Dadap
Quoted 52 lines · Takashi Iwai
Quoted 50 lines · Takashi Iwai
Quoted 30 lines · Daniel Dadap
Some systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI
_CRSobject, for example, as listed in this ACPI table dump excerpt:Device (HDA0) { Name (_HID, "NVDA2014") // _HID: Hardware ID ... Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { Memory32Fixed (ReadWrite, 0x36078000, // Address Base 0x00008000, // Address Length ) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) { 0x0000021E, } }) }Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from
_CRSobjects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.Quoted 6 lines
Although this driver is in the
sound/pci/hda/directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been used for PCI-based devices.Signed-off-by Daniel Dadap <[email protected]>Thanks for the patch.
The code looks fine. Just a nitpicking:Quoted 1 line
+static int
__maybe_unusedhda_acpi_suspend(struct device *dev)....
Quoted 1 line
+static int
__maybe_unusedhda_acpi_resume(struct device *dev)The
__maybe_unusedis superfluous when you set upSYSTEM_SLEEP_PM_OPS()macro instead in the below:
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
sound/pci/hda/hda_acpi.c line 287
Quoted 2 lines
sound/pci/hda/hda_acpi.c new file +2
-0+static const struct dev_pm_ops hda_acpi_pm = { +SET_SYSTEM_SLEEP_PM_OPS (hda_acpi_suspend, hda_acpi_resume)Also, at the next time, please put the maintainer (me) to Cc.
Sure, already sent it with you on To: as a reply to the last message. I was wrong about
hda_tegrahaving__maybe_unused, you already cleaned that up.
Oops, sorry for the churn, I did not notice the difference between the SYSTEM_SLEEP_PM_OPS() and SET_SYSTEM_SLEEP_PM_OPS() macros. I think I got it right, now.
Quoted 5 lines
Quoted 5 lines
thanks,
Takashi
Quoted 43 lines · Takashi Iwai
Quoted 30 lines · Daniel Dadap
Some systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI
_CRSobject, for example, as listed in this ACPI table dump excerpt:Device (HDA0) { Name (_HID, "NVDA2014") // _HID: Hardware ID ... Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { Memory32Fixed (ReadWrite, 0x36078000, // Address Base 0x00008000, // Address Length ) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) { 0x0000021E, } }) }Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from
_CRSobjects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.Quoted 6 lines
Although this driver is in the
sound/pci/hda/directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been used for PCI-based devices.Signed-off-by Daniel Dadap <[email protected]>Thanks for the patch.
The code looks fine. Just a nitpicking:Quoted 1 line
+static int
__maybe_unusedhda_acpi_suspend(struct device *dev)
Quoted 9 lines
....
Quoted 1 line
+static int
__maybe_unusedhda_acpi_resume(struct device *dev)The
__maybe_unusedis superfluous when you set upSYSTEM_SLEEP_PM_OPS()macro instead in the below:sound/pci/hda/hda_acpi.c line 287
Quoted 2 lines
sound/pci/hda/hda_acpi.c new file +2
-0+static const struct dev_pm_ops hda_acpi_pm = { +SET_SYSTEM_SLEEP_PM_OPS (hda_acpi_suspend, hda_acpi_resume)
Thanks, I'll send an updated patch. The hda_tegra driver has these as well so I presume it can be cleaned up from that driver as well?
Quoted 4 lines
thanks,
Takashi
Quoted 51 lines · Daniel Dadap
Quoted 49 lines · Takashi Iwai
Quoted 30 lines · Daniel Dadap
Some systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI
_CRSobject, for example, as listed in this ACPI table dump excerpt:Device (HDA0) { Name (_HID, "NVDA2014") // _HID: Hardware ID ... Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { Memory32Fixed (ReadWrite, 0x36078000, // Address Base 0x00008000, // Address Length ) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) { 0x0000021E, } }) }Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from
_CRSobjects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.Quoted 6 lines
Although this driver is in the
sound/pci/hda/directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been used for PCI-based devices.Signed-off-by Daniel Dadap <[email protected]>Thanks for the patch.
The code looks fine. Just a nitpicking:Quoted 1 line
+static int
__maybe_unusedhda_acpi_suspend(struct device *dev)....
Quoted 1 line
+static int
__maybe_unusedhda_acpi_resume(struct device *dev)The
__maybe_unusedis superfluous when you set upSYSTEM_SLEEP_PM_OPS()macro instead in the below:
Quoted 6 lines
Quoted 3 lines
sound/pci/hda/hda_acpi.c line 287
Quoted 2 lines
sound/pci/hda/hda_acpi.c new file +2
-0+static const struct dev_pm_ops hda_acpi_pm = { +SET_SYSTEM_SLEEP_PM_OPS (hda_acpi_suspend, hda_acpi_resume)Thanks, I'll send an updated patch. The
hda_tegradriver has these as well so I presume it can be cleaned up from that driver as well?
It's been already cleaned up on 6.15-rc1 :)
Takashi
PATCH v2 1/1 ALSA: hda - Add new driver for HDA controllers listed via ACPI
In reply to Takashi IwaiSome systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI _CRS object, for example, as listed in this ACPI table dump excerpt:
Device (HDA0)
{
Name (_HID, "NVDA2014") // _HID: Hardware ID
...
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
Memory32Fixed (ReadWrite,
0x36078000, // Address Base
0x00008000, // Address Length
)
Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, )
{
0x0000021E,
}
})
}Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from _CRS objects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.
Although this driver is in the sound/pci/hda/ directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been used for PCI-based devices.
--- sound/pci/hda/Kconfig | 11 ++ sound/pci/hda/Makefile | 2 + sound/pci/hda/hda_acpi.c | 316 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 329 insertions(+) create mode 100644 sound/pci/hda/hda_acpi.c
sound/pci/hda/Kconfig +11 -0
@@ -42,6 +42,17 @@ config SND_HDA_TEGRA To compile this driver as a module, choose M here: the module will be called snd-hda-tegra. +config SND_HDA_ACPI + tristate "HD Audio ACPI" + depends on ACPI + select SND_HDA + help + Say Y here to include support for Azalia-compatible HDA controllers + which are advertised via ACPI objects. + + To compile this driver as a module, choose M here: the module + will be called snd-hda-acpi. + if SND_HDA config SND_HDA_HWDEP
sound/pci/hda/Makefile +2 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 snd-hda-intel-y := hda_intel.o snd-hda-tegra-y := hda_tegra.o +snd-hda-acpi-y := hda_acpi.o snd-hda-codec-y := hda_bind.o hda_codec.o hda_jack.o hda_auto_parser.o hda_sysfs.o snd-hda-codec-y += hda_controller.o
@@ -80,3 +81,4 @@ obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_SPI) += snd-hda-scodec-tas2781-spi.o # when built in kernel obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o obj-$(CONFIG_SND_HDA_TEGRA) += snd-hda-tegra.o +obj-$(CONFIG_SND_HDA_ACPI) += snd-hda-acpi.o
sound/pci/hda/hda_acpi.c new file +316 -0
316 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v3 1/1 ALSA: hda - Add new driver for HDA controllers listed via ACPI
Some systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI _CRS object, for example, as listed in this ACPI table dump excerpt:
Device (HDA0)
{
Name (_HID, "NVDA2014") // _HID: Hardware ID
...
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
Memory32Fixed (ReadWrite,
0x36078000, // Address Base
0x00008000, // Address Length
)
Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, )
{
0x0000021E,
}
})
}Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from _CRS objects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.
Although this driver is in the sound/pci/hda/ directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been used for PCI-based devices.
--- sound/pci/hda/Kconfig | 11 ++ sound/pci/hda/Makefile | 2 + sound/pci/hda/hda_acpi.c | 316 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 329 insertions(+) create mode 100644 sound/pci/hda/hda_acpi.c
sound/pci/hda/Kconfig +11 -0
@@ -42,6 +42,17 @@ config SND_HDA_TEGRA To compile this driver as a module, choose M here: the module will be called snd-hda-tegra. +config SND_HDA_ACPI + tristate "HD Audio ACPI" + depends on ACPI + select SND_HDA + help + Say Y here to include support for Azalia-compatible HDA controllers + which are advertised via ACPI objects. + + To compile this driver as a module, choose M here: the module + will be called snd-hda-acpi. + if SND_HDA config SND_HDA_HWDEP
sound/pci/hda/Makefile +2 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 snd-hda-intel-y := hda_intel.o snd-hda-tegra-y := hda_tegra.o +snd-hda-acpi-y := hda_acpi.o snd-hda-codec-y := hda_bind.o hda_codec.o hda_jack.o hda_auto_parser.o hda_sysfs.o snd-hda-codec-y += hda_controller.o
@@ -80,3 +81,4 @@ obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_SPI) += snd-hda-scodec-tas2781-spi.o # when built in kernel obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o obj-$(CONFIG_SND_HDA_TEGRA) += snd-hda-tegra.o +obj-$(CONFIG_SND_HDA_ACPI) += snd-hda-acpi.o
sound/pci/hda/hda_acpi.c new file +316 -0
316 lines not on this page · raw message
Signature · 1 line
2.39.5
Quoted 30 lines · Daniel Dadap
Some systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI
_CRSobject, for example, as listed in this ACPI table dump excerpt:Device (HDA0) { Name (_HID, "NVDA2014") // _HID: Hardware ID ... Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { Memory32Fixed (ReadWrite, 0x36078000, // Address Base 0x00008000, // Address Length ) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) { 0x0000021E, } }) }Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from
_CRSobjects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.
Quoted 6 lines
Although this driver is in the
sound/pci/hda/directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been used for PCI-based devices.Signed-off-by Daniel Dadap <[email protected]>
Thanks. Now I checked with checkpatch, and it complained a few things:
WARNING: Block comments use a trailing */ on a separate line #168: FILE: sound/pci/hda/hda_acpi.c:79:
+ * devm_platform_get_and_ioremap_resource() */
ERROR: code indent should use tabs where possible
#182: FILE: sound/pci/hda/hda_acpi.c:93:
+^I IRQF_SHARED, KBUILD_MODNAME, azx);$
ERROR: code indent should use tabs where possible
#308: FILE: sound/pci/hda/hda_acpi.c:219:
+^I THIS_MODULE, 0, &hda->card);$
WARNING: Prefer "GPL" over "GPL v2" - see commit bf7fbeeae6db ("module: Cure th) #405: FILE: sound/pci/hda/hda_acpi.c:316:
+MODULE_LICENSE("GPL v2");
Care to address those and resubmit?
thanks,
Takashi
Quoted 37 lines · Takashi Iwai
Quoted 35 lines · Daniel Dadap
Some systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI
_CRSobject, for example, as listed in this ACPI table dump excerpt:Device (HDA0) { Name (_HID, "NVDA2014") // _HID: Hardware ID ... Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { Memory32Fixed (ReadWrite, 0x36078000, // Address Base 0x00008000, // Address Length ) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) { 0x0000021E, } }) }Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from
_CRSobjects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.Although this driver is in the
sound/pci/hda/directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been used for PCI-based devices.
Quoted 5 lines
Quoted 1 line
Signed-off-by Daniel Dadap <[email protected]>Thanks. Now I checked with checkpatch, and it complained a few things:
Thanks, Takashi. I forgot to ran checkpatch. I addressed the ones you called out, and a few more that you ignored (I think on purpose), except for this:
Quoted 1 line
WARNING: added, moved or deleted file(s), does
MAINTAINERSneed updating?
I can add myself as maintainer for this file if you like, but figured it could also just fall into the default maintainership of the directory (you). Let me know if you think it's worth changing it.
Quoted 11 lines
WARNING: Block comments use a trailing */ on a separate line #168: FILE:
sound/pci/hda/hda_acpi.c:79:sound/pci/hda/hda_acpi.c new file +1
-0+* devm_platform_get_and_ioremap_resource() */ ERROR: code indent should use tabs where possible
#182: FILE:sound/pci/hda/hda_acpi.c:93:
+^IIRQF_SHARED,KBUILD_MODNAME, azx);$ERROR: code indent should use tabs where possible
#308: FILE:sound/pci/hda/hda_acpi.c:219:
+^ITHIS_MODULE, 0, &hda->card);$
I disagree with the above two, but I changed it anyway because it's easier to do that than to argue with checkpatch. These are both continuations of long lines, and the single hard tab matches the actual indentation level of the code itself, with the subsequent spaces serving to aesthetically align the continuation. If someone is viewing the file with the tabstop set to anything other than 8, using hard tabs for the alignment portion will break the intended alignment, whereas using spaces will keep things aligned well regardless of the tabstop size, since the single initial tab will resize consistently with the tabstop.
Perhaps this style point has been discussed before, and the policy that is enforced by checkpatch is intentional for reasons I don't understand (I did not check), but if this behavior is unintentional, and using spaces for aligning continuations of long lines is supposed to be okay, I can look at updating checkpatch to allow it. But for now I'll go with the recommended indentation since that seems to be the style followed by other files here.
Quoted 7 lines
WARNING: Prefer "GPL" over "GPL v2" - see commit
bf7fbeeae6db("module: Cure th) #405: FILE:sound/pci/hda/hda_acpi.c:316:
+MODULE_LICENSE("GPL v2");Care to address those and resubmit?
Sure, I'll send a v4 shortly. I also took the opportunity to address an issue I noticed while cleaning up, by adding the following:
hda->data = acpi_device_get_match_data(&pdev->dev);
+
+ /* Fall back to defaults if the table didn't have a *struct hda_data */
+ if (!hda->data)
+ hda->data = devm_kzalloc(&pdev->dev, sizeof(*hda->data),
+ GFP_KERNEL);
+ if (!hda->data)
+ return -ENOMEM;
+
err = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
My intention was to allow entries in the match table to omit supplying the pointer to a struct hda_data if they were fine with the defaults (hence use of the language "may be stored" in the comment describing the struct), but without the above the driver will dereference NULL if this is actually done.
Quoted 4 lines
thanks,
Takashi
Quoted 87 lines · Daniel Dadap
Quoted 37 lines · Takashi Iwai
Quoted 35 lines · Daniel Dadap
Some systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI
_CRSobject, for example, as listed in this ACPI table dump excerpt:Device (HDA0) { Name (_HID, "NVDA2014") // _HID: Hardware ID ... Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { Memory32Fixed (ReadWrite, 0x36078000, // Address Base 0x00008000, // Address Length ) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) { 0x0000021E, } }) }Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from
_CRSobjects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.Although this driver is in the
sound/pci/hda/directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been used for PCI-based devices.Quoted 5 lines
Quoted 1 line
Signed-off-by Daniel Dadap <[email protected]>Thanks. Now I checked with checkpatch, and it complained a few things:
Thanks, Takashi. I forgot to ran checkpatch. I addressed the ones you called out, and a few more that you ignored (I think on purpose), except for this:
Quoted 1 line
WARNING: added, moved or deleted file(s), does
MAINTAINERSneed updating?I can add myself as maintainer for this file if you like, but figured it could also just fall into the default maintainership of the directory (you). Let me know if you think it's worth changing it.
Quoted 11 lines
WARNING: Block comments use a trailing */ on a separate line #168: FILE:
sound/pci/hda/hda_acpi.c:79:sound/pci/hda/hda_acpi.c new file +1
-0+* devm_platform_get_and_ioremap_resource() */ ERROR: code indent should use tabs where possible
#182: FILE:sound/pci/hda/hda_acpi.c:93:
+^IIRQF_SHARED,KBUILD_MODNAME, azx);$ERROR: code indent should use tabs where possible
#308: FILE:sound/pci/hda/hda_acpi.c:219:
+^ITHIS_MODULE, 0, &hda->card);$I disagree with the above two, but I changed it anyway because it's easier to do that than to argue with checkpatch. These are both continuations of long lines, and the single hard tab matches the actual indentation level of the code itself, with the subsequent spaces serving to aesthetically align the continuation. If someone is viewing the file with the tabstop set to anything other than 8, using hard tabs for the alignment portion will break the intended alignment, whereas using spaces will keep things aligned well regardless of the tabstop size, since the single initial tab will resize consistently with the tabstop.
Perhaps this style point has been discussed before, and the policy that is enforced by checkpatch is intentional for reasons I don't understand (I did not check), but if this behavior is unintentional, and using spaces for aligning continuations of long lines is supposed to be okay, I can look at updating checkpatch to allow it. But for now I'll go with the recommended indentation since that seems to be the style followed by other files here.
Quoted 5 lines
WARNING: Prefer "GPL" over "GPL v2" - see commit
bf7fbeeae6db("module: Cure th) #405: FILE:sound/pci/hda/hda_acpi.c:316:
+MODULE_LICENSE("GPL v2");
Quoted 5 lines
Quoted 2 lines
Care to address those and resubmit?
Sure, I'll send a v4 shortly. I also took the opportunity to address an issue I noticed while cleaning up, by adding the following:
Hi Takashi,
In the meantime I noticed the recent commits in the sound tree to convert some string copies to use strscpy() with two arguments, so I sent a patch v5 to also use the two-argument variant in the new driver. I also sent a separate patch to update hda_tegra to use the new signature.
Quoted 21 lines
hda->data = acpi_device_get_match_data(&pdev->dev);(quoted diff) +8
-0+ + /* Fall back to defaults if the table didn't have a *struct hda_data */ + if (!hda->data) + hda->data = devm_kzalloc(&pdev->dev, sizeof(*hda->data), + GFP_KERNEL); + if (!hda->data) + return -ENOMEM; + err = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,My intention was to allow entries in the match table to omit supplying the pointer to a struct
hda_dataif they were fine with the defaults (hence use of the language "may be stored" in the comment describing the struct), but without the above the driver will dereference NULL if this is actually done.Quoted 4 lines
thanks,
Takashi
PATCH v4 1/1 ALSA: hda - Add new driver for HDA controllers listed via ACPI
In reply to Takashi IwaiSome systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI _CRS object, for example, as listed in this ACPI table dump excerpt:
Device (HDA0)
{
Name (_HID, "NVDA2014") // _HID: Hardware ID
...
Name (_CRS, ResourceTemplate ()
// _CRS: Current Resource Settings
{
Memory32Fixed (ReadWrite,
0x36078000, // Address Base
0x00008000, // Address Length
)
Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive,
,, )
{
0x0000021E,
}
})
}Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from _CRS objects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.
Although this driver is in the sound/pci/hda/ directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been usedvfor PCI-based devices.
---
Patch history:
v2,3: Remove __maybe_unused, use SYSTEM_SLEEP_PM_OPS (Takashi Iwai)
v4: Address checkpatch issues (Takashi Iwai), allow NULL match data
sound/pci/hda/Kconfig | 11 ++ sound/pci/hda/Makefile | 2 + sound/pci/hda/hda_acpi.c | 325 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 338 insertions(+) create mode 100644 sound/pci/hda/hda_acpi.c
sound/pci/hda/Kconfig +11 -0
@@ -42,6 +42,17 @@ config SND_HDA_TEGRA To compile this driver as a module, choose M here: the module will be called snd-hda-tegra. +config SND_HDA_ACPI + tristate "HD Audio ACPI" + depends on ACPI + select SND_HDA + help + Say Y here to include support for Azalia-compatible HDA controllers + which are advertised via ACPI objects. + + To compile this driver as a module, choose M here: the module + will be called snd-hda-acpi. + if SND_HDA config SND_HDA_HWDEP
sound/pci/hda/Makefile +2 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 snd-hda-intel-y := hda_intel.o snd-hda-tegra-y := hda_tegra.o +snd-hda-acpi-y := hda_acpi.o snd-hda-codec-y := hda_bind.o hda_codec.o hda_jack.o hda_auto_parser.o hda_sysfs.o snd-hda-codec-y += hda_controller.o
@@ -80,3 +81,4 @@ obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_SPI) += snd-hda-scodec-tas2781-spi.o # when built in kernel obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o obj-$(CONFIG_SND_HDA_TEGRA) += snd-hda-tegra.o +obj-$(CONFIG_SND_HDA_ACPI) += snd-hda-acpi.o
sound/pci/hda/hda_acpi.c new file +325 -0
325 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v5 1/1 ALSA: hda - Add new driver for HDA controllers listed via ACPI
In reply to Takashi IwaiSome systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI _CRS object, for example, as listed in this ACPI table dump excerpt:
Device (HDA0)
{
Name (_HID, "NVDA2014") // _HID: Hardware ID
...
Name (_CRS, ResourceTemplate ()
// _CRS: Current Resource Settings
{
Memory32Fixed (ReadWrite,
0x36078000, // Address Base
0x00008000, // Address Length
)
Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive,
,, )
{
0x0000021E,
}
})
}Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from _CRS objects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.
Although this driver is in the sound/pci/hda/ directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been usedvfor PCI-based devices.
---
Patch history:
v2,3: Remove __maybe_unused, use SYSTEM_SLEEP_PM_OPS (Takashi Iwai)
v4: Address checkpatch issues (Takashi Iwai), allow NULL match data v5: Use two-argument strscpy()
sound/pci/hda/Kconfig | 11 ++ sound/pci/hda/Makefile | 2 + sound/pci/hda/hda_acpi.c | 325 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 338 insertions(+) create mode 100644 sound/pci/hda/hda_acpi.c
sound/pci/hda/Kconfig +11 -0
@@ -42,6 +42,17 @@ config SND_HDA_TEGRA To compile this driver as a module, choose M here: the module will be called snd-hda-tegra. +config SND_HDA_ACPI + tristate "HD Audio ACPI" + depends on ACPI + select SND_HDA + help + Say Y here to include support for Azalia-compatible HDA controllers + which are advertised via ACPI objects. + + To compile this driver as a module, choose M here: the module + will be called snd-hda-acpi. + if SND_HDA config SND_HDA_HWDEP
sound/pci/hda/Makefile +2 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 snd-hda-intel-y := hda_intel.o snd-hda-tegra-y := hda_tegra.o +snd-hda-acpi-y := hda_acpi.o snd-hda-codec-y := hda_bind.o hda_codec.o hda_jack.o hda_auto_parser.o hda_sysfs.o snd-hda-codec-y += hda_controller.o
@@ -80,3 +81,4 @@ obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_SPI) += snd-hda-scodec-tas2781-spi.o # when built in kernel obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o obj-$(CONFIG_SND_HDA_TEGRA) += snd-hda-tegra.o +obj-$(CONFIG_SND_HDA_ACPI) += snd-hda-acpi.o
sound/pci/hda/hda_acpi.c new file +325 -0
325 lines not on this page · raw message
Signature · 1 line
2.39.5
Quoted 37 lines · Daniel Dadap
Some systems expose HD-Audio controllers via objects in the ACPI tables which encapsulate the controller's interrupt and the base address for the HDA registers in an ACPI
_CRSobject, for example, as listed in this ACPI table dump excerpt:Device (HDA0) { Name (_HID, "NVDA2014") // _HID: Hardware ID ... Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { Memory32Fixed (ReadWrite, 0x36078000, // Address Base 0x00008000, // Address Length ) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) { 0x0000021E, } }) }Add support for HDA controllers discovered through ACPI, including support for some platforms which expose such HDA controllers on NVIDIA SoCs. This is done with a new driver which uses existing infrastructure for extracting resource information from
_CRSobjects and plumbs the parsed resource information through to the existing HDA infrastructure to enable HD-Audio functionality on such devices.Although this driver is in the
sound/pci/hda/directory, it targets devices which are not actually enumerated on the PCI bus. This is because it depends upon the Intel "Azalia" infrastructure which has traditionally been usedvfor PCI-based devices.
Quoted 7 lines
Signed-off-by Daniel Dadap <[email protected]>---
Patch history:
v2,3: Remove__maybe_unused, useSYSTEM_SLEEP_PM_OPS(Takashi Iwai)v4: Address checkpatch issues (Takashi Iwai), allow NULL match data v5: Use two-argument strscpy()
Applied now to for-next branch. Thanks.
Takashi