ALSA: hda/hdmi - Add Nvidia Tegra124 HDMI support
Subsystems (4)
PATCH v3 1/2 ALSA: hda/hdmi - Add Nvidia Tegra124 HDMI support
From: Sumit Bhattacharya <[email protected]>
Add the Tegra 12x HDMI controller id to patch_hdmi.
---
No changes since v1.
--- sound/pci/hda/patch_hdmi.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_hdmi.c +2 -0
@@ -3322,6 +3322,7 @@ static const struct hda_codec_preset snd_hda_preset_hdmi[] = { { .id = 0x10de001a, .name = "GPU 1a HDMI/DP", .patch = patch_nvhdmi }, { .id = 0x10de001b, .name = "GPU 1b HDMI/DP", .patch = patch_nvhdmi }, { .id = 0x10de001c, .name = "GPU 1c HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0028, .name = "Tegra12x HDMI", .patch = patch_nvhdmi }, { .id = 0x10de0040, .name = "GPU 40 HDMI/DP", .patch = patch_nvhdmi }, { .id = 0x10de0041, .name = "GPU 41 HDMI/DP", .patch = patch_nvhdmi }, { .id = 0x10de0042, .name = "GPU 42 HDMI/DP", .patch = patch_nvhdmi },
@@ -3377,6 +3378,7 @@ MODULE_ALIAS("snd-hda-codec-id:10de0019");MODULE_ALIAS ("snd-hda-codec-id:10de001a" );MODULE_ALIAS ("snd-hda-codec-id:10de001b" );MODULE_ALIAS ("snd-hda-codec-id:10de001c" ); +MODULE_ALIAS ("snd-hda-codec-id:10de0028" );MODULE_ALIAS ("snd-hda-codec-id:10de0040" );MODULE_ALIAS ("snd-hda-codec-id:10de0041" );MODULE_ALIAS ("snd-hda-codec-id:10de0042" );
Signature · 6 lines
1.8.1.3.605.g02339dd -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 2/2 ALSA: hda - Add driver for Tegra SoC HDA
This adds a driver for the HDA block in Tegra SoCs. The HDA bus is used to communicate with the HDMI codec on Tegra124.
Most of the code is re-used from the Intel/PCI HDA driver. It brings over only the power_save module parameter.
---
Changes since v2:
Remove runtime PM. The on-chip codec doesn't support D3 stop clock so the pm_runtime code was never run.
---
Changes since v1:
Kconfig depends on OF and ARCH_TEGRA.
Fix warning on 64 bit build.
Integrate a bunch of good suggestions from Thierry, including:
Add resets property to device tree entry.
More consistent/better naming.
Remove probe mask that isn't needed.
Cleaner/more readable handling of dword write restriction.
--- .../bindings/sound/nvidia,tegra30-hda.txt | 27 + sound/pci/hda/Kconfig | 15 + sound/pci/hda/Makefile | 2 + sound/pci/hda/hda_tegra.c | 601 +++++++++++++++++++++ 4 files changed, 645 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.txt create mode 100644 sound/pci/hda/hda_tegra.c
Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.txt new file +27 -0
@@ -0,0 +1,27 @@ +NVIDIA Tegra30 HDA controller + +Required properties: +- compatible : "nvidia,tegra30-hda" +- reg : Should contain the HDA registers location and length. +- interrupts : The interrupt from the hda controller. +- clocks : Must contain an entry for each required entry in clock-names. +- clock-names : Must include the following entries: hda, hdacodec_2x, hda2hdmi +- resets : Must contain an entry for each entry in reset-names. + See ../reset/reset.txt for details. +- reset-names : Must include the following entries: hda, hdacodec_2x, hda2hdmi + +Example: + +hda@70030000 { + compatible = "nvidia,tegra124-hda", "nvidia,tegra30-hda"; + reg = <0x0 0x70030000 0x10000>; + interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&tegra_car TEGRA124_CLK_HDA>, + <&tegra_car TEGRA124_CLK_HDA2HDMI>, + <&tegra_car TEGRA124_CLK_HDA2CODEC_2X>; + clock-names = "hda", "hda2hdmi", "hdacodec_2x"; + resets = <&tegra_car 125>, /* hda */ + <&tegra_car 128>; /* hda2hdmi */ + <&tegra_car 111>, /* hda2codec_2x */ + reset-names = "hda", "hda2hdmi", "hdacodec_2x"; +};
sound/pci/hda/Kconfig +15 -0
@@ -20,6 +20,21 @@ config SND_HDA_INTEL To compile this driver as a module, choose M here: the module will be called snd-hda-intel. +config SND_HDA_TEGRA + tristate "NVIDIA Tegra HD Audio" + depends on OF && ARCH_TEGRA + select SND_HDA + help + Say Y here to support the HDA controller present in NVIDIA + Tegra SoCs + + This options enables support for the HD Audio controller + present in some NVIDIA Tegra SoCs, used to communicate audio + to the HDMI output. + + To compile this driver as a module, choose M here: the module + will be called snd-hda-tegra. + if SND_HDA config SND_HDA_DSP_LOADER
sound/pci/hda/Makefile +2 -0
@@ -1,5 +1,6 @@ snd-hda-intel-objs := hda_intel.o snd-hda-controller-objs := hda_controller.o +snd-hda-tegra-objs := hda_tegra.o # for haswell power well snd-hda-intel-$(CONFIG_SND_HDA_I915) += hda_i915.o
@@ -47,3 +48,4 @@ obj-$(CONFIG_SND_HDA_CODEC_HDMI) += snd-hda-codec-hdmi.o # otherwise the codec patches won't be hooked before the PCI probe # when built in kernel obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o +obj-$(CONFIG_SND_HDA_TEGRA) += snd-hda-tegra.o
sound/pci/hda/hda_tegra.c new file +601 -0
601 lines not on this page · raw message
Signature · 1 line
1.8.1.3.605.g02339dd
Re: [PATCHv3 2/2] ALSA: hda - Add driver for Tegra SoC HDA
At Wed, 16 Apr 2014 14:39:32 -0700,
Quoted 8 lines · Dylan Reid
This adds a driver for the HDA block in Tegra SoCs. The HDA bus is used to communicate with the HDMI codec on Tegra124.
Most of the code is re-used from the Intel/PCI HDA driver. It brings over only the
power_savemodule parameter.Signed-off-by Dylan Reid <[email protected]>
Thanks, this looks better, but a few comments below. Besides, I'd like to have a review in DT part.
Quoted 14 lines
sound/pci/hda/hda_tegra.c new file +14
-0+/* +* Register access ops. Tegra HDA register access is DWORD only. +*/ +static void hda_tegra_writel (u32 value,u32 *addr) +{ +writel (value, addr); +} + +static u32 hda_tegra_readl (u32 *addr) +{ +return readl (addr); +} + +static void hda_tegra_writew (u16 value,u16 *addr)
sound/pci/hda/hda_tegra.c line 136
Quoted 10 lines
sound/pci/hda/hda_tegra.c new file +10
-0+{ +unsigned long shift = ((uintptr_t )(addr) &0x3 ) <<3 ; +void *dword_addr = (void *)((uintptr_t )(addr) & ~0x3 ); +u32 v; + + v =readl (dword_addr); + v &= ~(0xffff << shift); + v |= value << shift; +writel (v, dword_addr); +}
The shift doesn't have to be long at all, and the cast in kernel is usually just unsigned long instead of uintptr_t.
Quoted 10 lines
sound/pci/hda/hda_tegra.c new file +10
-0+#ifdef CONFIG_PM_SLEEP +/* +* power management +*/ +static int hda_tegra_suspend (struct device *dev) +{ +struct snd_card *card =dev_get_drvdata (dev); +struct azx *chip = card->private_data; +struct azx_pcm *p; + struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip);
sound/pci/hda/hda_tegra.c line 257
Quoted 10 lines
sound/pci/hda/hda_tegra.c new file +10
-0+ +snd_power_change_state (card, SNDRV_CTL_POWER_D3hot); +list_for_each_entry (p, &chip->pcm_list, list) +snd_pcm_suspend_all (p->pcm); +if (chip->initialized) +snd_hda_suspend (chip->bus); + +/* enable controller wake up event */ +azx_writew (chip,WAKEEN ,azx_readw (chip,WAKEEN ) | +STATESTS_INT_MASK );
I guess WAKEEN doesn't work for Tegra?
Quoted 20 lines
sound/pci/hda/hda_tegra.c new file +20
-0+ +azx_stop_chip (chip); +azx_enter_link_reset (chip); +hda_tegra_disable_clocks (hda); + +return 0 ; +} + +static int hda_tegra_resume (struct device *dev) +{ +struct snd_card *card =dev_get_drvdata (dev); +struct azx *chip = card->private_data; + struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); +int status; +struct hda_codec *codec; + +hda_tegra_enable_clocks (hda); + +/* Read STATESTS before controller reset */ + status =azx_readw (chip,STATESTS );
sound/pci/hda/hda_tegra.c line 287
Quoted 10 lines
sound/pci/hda/hda_tegra.c new file +10
-0+ +hda_tegra_init (hda); + +if (status && chip->bus) { +list_for_each_entry (codec, &chip->bus->codec_list, list) +if (status & (1 << codec->addr)) +queue_delayed_work (codec->bus->workq, + &codec->jackpoll_work, + codec->jackpoll_interval); + }
This is superfluous for the regular resume. It was some missing call only in the runtime resume.
sound/pci/hda/hda_tegra.c line 290
Quoted 3 lines
sound/pci/hda/hda_tegra.c new file +3
-0+ +/* disable controller Wake Up event*/ +azx_writew (chip,WAKEEN ,azx_readw (chip,WAKEEN ) & ~STATESTS_INT_MASK );
This can be removed like the suspend.
thanks,
Takashi