Tegra AC97 v2
Subsystems (4)
v2 cover Tegra AC97 v2
v2 of the Tegra AC97 series. Unmerged ASoC related patches only.
The machine driver now instantiates the codec driver by itself, without usage of DT. Other fixups for review feedback also included.
I'll post a patch for the AC97 clock once Prashant patches land in a branch.
Lucas Stach (3):
ASoC: tegra: add ac97 host driver
ASoC: tegra: add ac97 host controller to device tree
ASoC: tegra: add tegra machine driver using wm9712 codec
.../bindings/sound/nvidia,tegra-audio-wm9712.txt | 51 +++ .../bindings/sound/nvidia,tegra20-ac97.txt | 22 + arch/arm/boot/dts/tegra20.dtsi | 9 + sound/soc/tegra/Kconfig | 19 + sound/soc/tegra/Makefile | 4 + sound/soc/tegra/tegra20_ac97.c | 480 +++++++++++++++++++++ sound/soc/tegra/tegra20_ac97.h | 95 ++++ sound/soc/tegra/tegra_wm9712.c | 179 ++++++++ 8 files changed, 859 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.txt create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-ac97.txt create mode 100644 sound/soc/tegra/tegra20_ac97.c create mode 100644 sound/soc/tegra/tegra20_ac97.h create mode 100644 sound/soc/tegra/tegra_wm9712.c
Signature · 1 line
1.8.0.1
A message that is not in the archive (sent off-list or not yet received): 1357348725-32139-1-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org
PATCH v2 1/3 ASoC: tegra: add ac97 host driver
This adds the driver for the Tegra 2x AC97 host controller.
---
v2:
- squash DT binding file into this patch
- various small fixups all over
--- .../bindings/sound/nvidia,tegra20-ac97.txt | 22 + sound/soc/tegra/Kconfig | 10 + sound/soc/tegra/Makefile | 2 + sound/soc/tegra/tegra20_ac97.c | 480 +++++++++++++++++++++ sound/soc/tegra/tegra20_ac97.h | 95 ++++ 5 files changed, 609 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-ac97.txt create mode 100644 sound/soc/tegra/tegra20_ac97.c create mode 100644 sound/soc/tegra/tegra20_ac97.h
Documentation/devicetree/bindings/sound/nvidia,tegra20-ac97.txt new file +22 -0
@@ -0,0 +1,22 @@ +NVIDIA Tegra 20 AC97 controller + +Required properties: +- compatible : "nvidia,tegra20-ac97" +- reg : Should contain AC97 controller registers location and length +- interrupts : Should contain AC97 interrupt +- nvidia,dma-request-selector : The Tegra DMA controller's phandle and + request selector for the AC97 controller +- nvidia,codec-reset-gpio : The Tegra GPIO controller's phandle and the number + of the GPIO used to reset the external AC97 codec +- nvidia,codec-sync-gpio : The Tegra GPIO controller's phandle and the number + of the GPIO corresponding with the AC97 DAP _FS line +Example: + +ac97@70002000 { + compatible = "nvidia,tegra20-ac97"; + reg = <0x70002000 0x200>; + interrupts = <0 81 0x04>; + nvidia,dma-request-selector = <&apbdma 12>; + nvidia,codec-reset-gpio = <&gpio 170 0>; + nvidia,codec-sync-gpio = <&gpio 120 0>; +};
sound/soc/tegra/Kconfig +10 -0
@@ -6,6 +6,16 @@ config SND_SOC_TEGRA help Say Y or M here if you want support for SoC audio on Tegra. +config SND_SOC_TEGRA20_AC97 + tristate + depends on SND_SOC_TEGRA && ARCH_TEGRA_2x_SOC + select SND_SOC_AC97_BUS + select SND_SOC_TEGRA20_DAS + help + Say Y or M if you want to add support for codecs attached to the + Tegra20 AC97 interface. You will also need to select the individual + machine drivers to support below. + config SND_SOC_TEGRA20_DAS tristate depends on SND_SOC_TEGRA && ARCH_TEGRA_2x_SOC
sound/soc/tegra/Makefile +2 -0
@@ -1,6 +1,7 @@ # Tegra platform Support snd-soc-tegra-pcm-objs := tegra_pcm.o snd-soc-tegra-utils-objs += tegra_asoc_utils.o +snd-soc-tegra20-ac97-objs := tegra20_ac97.o snd-soc-tegra20-das-objs := tegra20_das.o snd-soc-tegra20-i2s-objs := tegra20_i2s.o snd-soc-tegra20-spdif-objs := tegra20_spdif.o
@@ -9,6 +10,7 @@ snd-soc-tegra30-i2s-objs := tegra30_i2s.o obj-$(CONFIG_SND_SOC_TEGRA) += snd-soc-tegra-pcm.o obj-$(CONFIG_SND_SOC_TEGRA) += snd-soc-tegra-utils.o +obj-$(CONFIG_SND_SOC_TEGRA20_AC97) += snd-soc-tegra20-ac97.o obj-$(CONFIG_SND_SOC_TEGRA20_DAS) += snd-soc-tegra20-das.o obj-$(CONFIG_SND_SOC_TEGRA20_I2S) += snd-soc-tegra20-i2s.o obj-$(CONFIG_SND_SOC_TEGRA20_SPDIF) += snd-soc-tegra20-spdif.o
sound/soc/tegra/tegra20_ac97.c new file +480 -0
480 lines not on this page · raw message
sound/soc/tegra/tegra20_ac97.h new file +95 -0
95 lines not on this page · raw message
Signature · 1 line
1.8.0.1
A message that is not in the archive (sent off-list or not yet received): 1357348725-32139-2-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org
Re: [PATCH v2 1/3] ASoC: tegra: add ac97 host driver
Documentation/devicetree/bindings/sound/nvidia,tegra20-ac97.txt line 13
Quoted 9 lines · Lucas Stach
This adds the driver for the Tegra 2x AC97 host controller.
Signed-off-by Lucas Stach <[email protected]>Documentation/devicetree/bindings/sound/nvidia,tegra20-ac97.txt +3
-0+- nvidia,codec-sync-gpio : The Tegra GPIO controller's phandle and the number + of the GPIO corresponding with the AC97 DAP _FS line +Example:
If you have to repost for any reason, you probably want a blank line before the "Example:" line.
Quoted 5 lines
sound/soc/tegra/tegra20_ac97.c +3
-0+static void tegra20_ac97_codec_warm_reset (struct snd_ac97 *ac97) +{ +u32 readback;
sound/soc/tegra/tegra20_ac97.c line 80
Quoted 10 lines
sound/soc/tegra/tegra20_ac97.c +10
-0+unsigned long timeout; + +/* +* although sync line is driven by the DAC pad group warm reset using +* the controller cmd is not working, have to toggle sync line +* manually. +*/ +gpio_request (workdata->sync_gpio,"codec-sync" ); + +gpio_direction_output (workdata->sync_gpio,1 );
Would it make sense to just request the GPIO during probe()? Or, is the sync signal used as part of the AC'97 protocol at other times?
sound/soc/tegra/tegra20_ac97.c line 163
Quoted 12 lines
sound/soc/tegra/tegra20_ac97.c +12
-0+static inline void tegra20_ac97_start_playback (struct tegra20_ac97 *ac97) +{ +regmap_update_bits (ac97->regmap,TEGRA20_AC97_FIFO1_SCR , +TEGRA20_AC97_FIFO_SCR_PB_QRT_MT_EN , +TEGRA20_AC97_FIFO_SCR_PB_QRT_MT_EN ); + +regmap_update_bits (ac97->regmap,TEGRA20_AC97_CTRL , +TEGRA20_AC97_CTRL_PCM_DAC_EN | +TEGRA20_AC97_CTRL_STM_EN , +TEGRA20_AC97_CTRL_PCM_DAC_EN | +TEGRA20_AC97_CTRL_STM_EN ); +}
That sets both PCM_DAC_EN and STM_EN, but ...
sound/soc/tegra/tegra20_ac97.c line 172
Quoted 8 lines
sound/soc/tegra/tegra20_ac97.c +8
-0+static inline void tegra20_ac97_stop_playback (struct tegra20_ac97 *ac97) +{ +regmap_update_bits (ac97->regmap,TEGRA20_AC97_FIFO1_SCR , +TEGRA20_AC97_FIFO_SCR_PB_QRT_MT_EN ,0 ); + +regmap_update_bits (ac97->regmap,TEGRA20_AC97_CTRL , +TEGRA20_AC97_CTRL_PCM_DAC_EN ,0 ); +}
... that only clears DAC_EN. Should it clear STM_EN too?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 1/3] ASoC: tegra: add ac97 host driver
Am Dienstag, den 08.01.2013, 15:10 -0700 schrieb Stephen Warren:
Quoted 16 lines · Lucas Stach
Documentation/devicetree/bindings/sound/nvidia,tegra20-ac97.txt line 13
Quoted 9 lines
This adds the driver for the Tegra 2x AC97 host controller.
Signed-off-by Lucas Stach <[email protected]>Documentation/devicetree/bindings/sound/nvidia,tegra20-ac97.txt +3
-0+- nvidia,codec-sync-gpio : The Tegra GPIO controller's phandle and the number + of the GPIO corresponding with the AC97 DAP _FS line +Example:If you have to repost for any reason, you probably want a blank line before the "Example:" line.
Quoted 1 line
sound/soc/tegra/tegra20_ac97.c +0
-0
Quoted 16 lines
sound/soc/tegra/tegra20_ac97.c line 80
Quoted 13 lines
sound/soc/tegra/tegra20_ac97.c +13
-0+static void tegra20_ac97_codec_warm_reset (struct snd_ac97 *ac97) +{ +u32 readback; +unsigned long timeout; + +/* +* although sync line is driven by the DAC pad group warm reset using +* the controller cmd is not working, have to toggle sync line +* manually. +*/ +gpio_request (workdata->sync_gpio,"codec-sync" ); + +gpio_direction_output (workdata->sync_gpio,1 );Would it make sense to just request the GPIO during
probe()? Or, is the sync signal used as part of the AC'97 protocol at other times?
Yes, the sync line is used during normal codec operation, that's why it's explicitly requested and freed in the warm reset function. As discussed earlier this is ugly, but unavoidable as the Tegra 2 AC97 controller misbehaves when ordered to do the warm reset. So this is just a software hack to take over the line as a GPIO and do what the hardware is supposed to do in this situation.
Quoted 16 lines
sound/soc/tegra/tegra20_ac97.c line 163
Quoted 13 lines
sound/soc/tegra/tegra20_ac97.c +12
-0+static inline void tegra20_ac97_start_playback (struct tegra20_ac97 *ac97) +{ +regmap_update_bits (ac97->regmap,TEGRA20_AC97_FIFO1_SCR , +TEGRA20_AC97_FIFO_SCR_PB_QRT_MT_EN , +TEGRA20_AC97_FIFO_SCR_PB_QRT_MT_EN ); + +regmap_update_bits (ac97->regmap,TEGRA20_AC97_CTRL , +TEGRA20_AC97_CTRL_PCM_DAC_EN | +TEGRA20_AC97_CTRL_STM_EN , +TEGRA20_AC97_CTRL_PCM_DAC_EN | +TEGRA20_AC97_CTRL_STM_EN ); +}That sets both
PCM_DAC_ENandSTM_EN, but ...
Quoted 11 lines
sound/soc/tegra/tegra20_ac97.c line 172
Quoted 8 lines
sound/soc/tegra/tegra20_ac97.c +8
-0+static inline void tegra20_ac97_stop_playback (struct tegra20_ac97 *ac97) +{ +regmap_update_bits (ac97->regmap,TEGRA20_AC97_FIFO1_SCR , +TEGRA20_AC97_FIFO_SCR_PB_QRT_MT_EN ,0 ); + +regmap_update_bits (ac97->regmap,TEGRA20_AC97_CTRL , +TEGRA20_AC97_CTRL_PCM_DAC_EN ,0 ); +}... that only clears
DAC_EN. Should it clearSTM_ENtoo?
To be honest I have no idea what STM really is, seems to be some form of packed format selection. If not set playback outputs only more or less random noise. Only PCM_EN controls FIFO and DMA operations though, so it's ok to just disable this to stop playback.
Regards,
Lucas
Stephen Warren
Reviewed-byRe: [PATCH v2 1/3] ASoC: tegra: add ac97 host driver
Quoted 32 lines · Lucas Stach
Am Dienstag, den 08.01.2013, 15:10 -0700 schrieb Stephen Warren:
Quoted 20 lines · Lucas Stach
Quoted 6 lines
This adds the driver for the Tegra 2x AC97 host controller.
sound/soc/tegra/tegra20_ac97.c +2
-0+static inline void tegra20_ac97_start_playback (struct tegra20_ac97 *ac97) +{sound/soc/tegra/tegra20_ac97.c line 163
Quoted 10 lines
sound/soc/tegra/tegra20_ac97.c +10
-0+regmap_update_bits (ac97->regmap,TEGRA20_AC97_FIFO1_SCR , +TEGRA20_AC97_FIFO_SCR_PB_QRT_MT_EN , +TEGRA20_AC97_FIFO_SCR_PB_QRT_MT_EN ); + +regmap_update_bits (ac97->regmap,TEGRA20_AC97_CTRL , +TEGRA20_AC97_CTRL_PCM_DAC_EN | +TEGRA20_AC97_CTRL_STM_EN , +TEGRA20_AC97_CTRL_PCM_DAC_EN | +TEGRA20_AC97_CTRL_STM_EN ); +}That sets both
PCM_DAC_ENandSTM_EN, but ...Quoted 11 lines
sound/soc/tegra/tegra20_ac97.c line 172
Quoted 8 lines
sound/soc/tegra/tegra20_ac97.c +8
-0+static inline void tegra20_ac97_stop_playback (struct tegra20_ac97 *ac97) +{ +regmap_update_bits (ac97->regmap,TEGRA20_AC97_FIFO1_SCR , +TEGRA20_AC97_FIFO_SCR_PB_QRT_MT_EN ,0 ); + +regmap_update_bits (ac97->regmap,TEGRA20_AC97_CTRL , +TEGRA20_AC97_CTRL_PCM_DAC_EN ,0 ); +}... that only clears
DAC_EN. Should it clearSTM_ENtoo?
Quoted 4 lines
To be honest I have no idea what STM really is, seems to be some form of packed format selection. If not set playback outputs only more or less random noise. Only
PCM_ENcontrols FIFO and DMA operations though, so it's ok to just disable this to stop playback.
I'd be tempted to just hard-code those bits on in probe() then, but it's not a big deal, so not worth spinning the patch for that.
I guess I meant to say,
Mark Brown
AppliedRe: [PATCH v2 1/3] ASoC: tegra: add ac97 host driver
In reply to a message not in the archiveQuoted 1 line · Lucas Stach
This adds the driver for the Tegra 2x AC97 host controller.
Applied, thanks.
PATCH v2 2/3 ASoC: tegra: add ac97 host controller to device tree
In reply to a message not in the archiveAdd default entry for the AC97 host controller.
---
v2:
- only add .dtsi parts here
--- arch/arm/boot/dts/tegra20.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/boot/dts/tegra20.dtsi +9 -0
@@ -177,6 +177,15 @@ compatible = "nvidia,tegra20-das"; reg = <0x70000c00 0x80>; }; + + tegra_ac97: ac97 { + compatible = "nvidia,tegra20-ac97"; + reg = <0x70002000 0x200>; + interrupts = <0 81 0x04>; + nvidia,dma-request-selector = <&apbdma 12>; + clocks = <&tegra_car 3>; + status = "disabled"; + }; tegra_i2s1: i2s@70002800 { compatible = "nvidia,tegra20-i2s";
Signature · 1 line
1.8.0.1
A message that is not in the archive (sent off-list or not yet received): 1357348725-32139-3-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org
Re: [PATCH v2 2/3] ASoC: tegra: add ac97 host controller to device tree
Quoted 1 line · Lucas Stach
Add default entry for the AC97 host controller.
This looks fine. I assume I'll take this through the Tegra tree.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 2/3] ASoC: tegra: add ac97 host controller to device tree
Quoted 4 lines · Stephen Warren
Quoted 1 line · Lucas Stach
Add default entry for the AC97 host controller.
This looks fine. I assume I'll take this through the Tegra tree.
Makes sense to me.
A message that is not in the archive (sent off-list or not yet received): 20130113232222.GN5041-yzvPICuk2AATkU/[email protected]
Stephen Warren
AppliedRe: [PATCH v2 2/3] ASoC: tegra: add ac97 host controller to device tree
Quoted 7 lines · Mark Brown
Quoted 4 lines · Stephen Warren
Quoted 1 line · Lucas Stach
Add default entry for the AC97 host controller.
This looks fine. I assume I'll take this through the Tegra tree.
Makes sense to me.
Thanks, applied to Tegra's for-3.9/dt branch.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 2/3] ASoC: tegra: add ac97 host controller to device tree
Quoted 10 lines · Stephen Warren
Quoted 7 lines · Mark Brown
Quoted 4 lines · Stephen Warren
Quoted 1 line · Lucas Stach
Add default entry for the AC97 host controller.
This looks fine. I assume I'll take this through the Tegra tree.
Makes sense to me.
Thanks, applied to Tegra's for-3.9/dt branch.
I had to make a small modification to the patch; I commented out the clocks property for now since the CAR node isn't yet present. It will be soon once the common clock framework patches are merged, and then I'll revert the change I made.
PATCH v2 3/3 ASoC: tegra: add tegra machine driver using wm9712 codec
In reply to a message not in the archiveThis adds a very simple machine driver using the Wolfson wm9712 AC97 codec.
---
v2:
- manually probe codec driver without using DT
- fixup Kconfig for select and depends
--- .../bindings/sound/nvidia,tegra-audio-wm9712.txt | 51 ++++++ sound/soc/tegra/Kconfig | 9 ++ sound/soc/tegra/Makefile | 2 + sound/soc/tegra/tegra_wm9712.c | 179 +++++++++++++++++++++ 4 files changed, 241 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.txt create mode 100644 sound/soc/tegra/tegra_wm9712.c
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.txt new file +51 -0
@@ -0,0 +1,51 @@ +NVIDIA Tegra audio complex + +Required properties: +- compatible : "nvidia,tegra-audio-wm9712" +- nvidia,model : The user-visible name of this sound complex. +- nvidia,audio-routing : A list of the connections between audio components. + Each entry is a pair of strings, the first being the connection's sink, + the second being the connection's source. Valid names for sources and + sinks are the WM9712's pins, and the jacks on the board: + + WM9712 pins: + + * MONOOUT + * HPOUTL + * HPOUTR + * LOUT2 + * ROUT2 + * OUT3 + * LINEINL + * LINEINR + * PHONE + * PCBEEP + * MIC1 + * MIC2 + * Mic Bias + + Board connectors: + + * Headphone + * LineIn + * Mic + +- nvidia,ac97-controller : The phandle of the Tegra AC97 controller + + +Example: + +sound { + compatible = "nvidia,tegra-audio-wm9712-colibri_t20", + "nvidia,tegra-audio-wm9712"; + nvidia,model = "Toradex Colibri T20"; + + nvidia,audio-routing = + "Headphone", "HPOUTL", + "Headphone", "HPOUTR", + "LineIn", "LINEINL", + "LineIn", "LINEINR", + "Mic", "MIC1"; + + nvidia,ac97-controller = <&ac97>; +};
sound/soc/tegra/Kconfig +9 -0
@@ -80,6 +80,15 @@ config SND_SOC_TEGRA_WM8903 boards using the WM8093 codec. Currently, the supported boards are Harmony, Ventana, Seaboard, Kaen, and Aebl. +config SND_SOC_TEGRA_WM9712 + tristate "SoC Audio support for Tegra boards using a WM9712 codec" + depends on SND_SOC_TEGRA && ARCH_TEGRA_2x_SOC + select SND_SOC_TEGRA20_AC97 + select SND_SOC_WM9712 + help + Say Y or M here if you want to add support for SoC audio on Tegra + boards using the WM9712 (or compatible) codec. + config SND_SOC_TEGRA_TRIMSLICE tristate "SoC Audio support for TrimSlice board" depends on SND_SOC_TEGRA && I2C
sound/soc/tegra/Makefile +2 -0
@@ -20,10 +20,12 @@ obj-$(CONFIG_SND_SOC_TEGRA30_I2S) += snd-soc-tegra30-i2s.o # Tegra machine Support snd-soc-tegra-wm8753-objs := tegra_wm8753.o snd-soc-tegra-wm8903-objs := tegra_wm8903.o +snd-soc-tegra-wm9712-objs := tegra_wm9712.o snd-soc-tegra-trimslice-objs := trimslice.o snd-soc-tegra-alc5632-objs := tegra_alc5632.o obj-$(CONFIG_SND_SOC_TEGRA_WM8753) += snd-soc-tegra-wm8753.o obj-$(CONFIG_SND_SOC_TEGRA_WM8903) += snd-soc-tegra-wm8903.o +obj-$(CONFIG_SND_SOC_TEGRA_WM9712) += snd-soc-tegra-wm9712.o obj-$(CONFIG_SND_SOC_TEGRA_TRIMSLICE) += snd-soc-tegra-trimslice.o obj-$(CONFIG_SND_SOC_TEGRA_ALC5632) += snd-soc-tegra-alc5632.o
sound/soc/tegra/tegra_wm9712.c new file +179 -0
179 lines not on this page · raw message
Signature · 1 line
1.8.0.1
A message that is not in the archive (sent off-list or not yet received): 1357348725-32139-4-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org
Re: [PATCH v2 3/3] ASoC: tegra: add tegra machine driver using wm9712 codec
sound/soc/tegra/tegra_wm9712.c line 57
Quoted 13 lines · Lucas Stach
This adds a very simple machine driver using the Wolfson wm9712 AC97 codec.
sound/soc/tegra/tegra_wm9712.c +6
-0+static int tegra_wm9712_init (struct snd_soc_pcm_runtime *rtd) + err =snd_soc_dapm_sync (dapm); +if (err) +return err; + +return 0 ;
That block is just "return snd_soc_dapm_sync(dapm);"
sound/soc/tegra/tegra_wm9712.c line 103
Quoted 3 lines
sound/soc/tegra/tegra_wm9712.c +2
-0+static int tegra_wm9712_driver_probe (struct platform_device *pdev) + machine->codec = platform_device_alloc("wm9712-codec", -1);
Hmmm. I thought that could be auto-instantiated based on probing the AC'97 bus for whatever was there?
sound/soc/tegra/tegra_wm9712.c line 111
Quoted 3 lines
sound/soc/tegra/tegra_wm9712.c +3
-0+ ret =platform_device_add (machine->codec); +if (ret) + goto codec_put;
After this point, ...
sound/soc/tegra/tegra_wm9712.c line 115
Quoted 3 lines
sound/soc/tegra/tegra_wm9712.c +3
-0+ ret =snd_soc_of_parse_card_name (card,"nvidia,model" ); +if (ret) + goto codec_put;
don't the error paths need to undo platform_device_add()? Or does platform_device_put() do that automatically?
sound/soc/tegra/tegra_wm9712.c line 153
Quoted 8 lines
sound/soc/tegra/tegra_wm9712.c +6
-0+codec_put: +platform_device_put (machine->codec); +return ret; +} +static int tegra_wm9712_driver_remove(struct platform_device *pdev) + platform_device_put(machine->codec);
Same comment here.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 3/3] ASoC: tegra: add tegra machine driver using wm9712 codec
Am Dienstag, den 08.01.2013, 15:17 -0700 schrieb Stephen Warren:
Quoted 17 lines · Lucas Stach
sound/soc/tegra/tegra_wm9712.c line 57
Quoted 13 lines
This adds a very simple machine driver using the Wolfson wm9712 AC97 codec.
sound/soc/tegra/tegra_wm9712.c +6
-0+static int tegra_wm9712_init (struct snd_soc_pcm_runtime *rtd) + err =snd_soc_dapm_sync (dapm); +if (err) +return err; + +return 0 ;That block is just "return
snd_soc_dapm_sync(dapm);"
Quoted 6 lines
sound/soc/tegra/tegra_wm9712.c line 103
Quoted 3 lines
sound/soc/tegra/tegra_wm9712.c +2
-0+static int tegra_wm9712_driver_probe (struct platform_device *pdev) + machine->codec = platform_device_alloc("wm9712-codec", -1);Hmmm. I thought that could be auto-instantiated based on probing the AC'97 bus for whatever was there?
AC97 is in principle probeable by reading the first regs of the codec, but all the infrastructure to do proper hotplugging on the AC97 bus is missing in the kernel. As I didn't want to be the one to add all this infrastructure to a dying audio platform, I opted to do the same thing as all the other platform using AC97 and instantiate the codec from the machine driver.
This binds machine driver and codec together, but after all the machine driver is already both pretty small and codec specific. So considering the number of Tegra platform out there using AC97 I figured it's not worth the hassle trying to write a generic machine driver.
Quoted 7 lines
sound/soc/tegra/tegra_wm9712.c line 111
Quoted 4 lines
sound/soc/tegra/tegra_wm9712.c +3
-0+ ret =platform_device_add (machine->codec); +if (ret) + goto codec_put;After this point, ...
Quoted 7 lines
sound/soc/tegra/tegra_wm9712.c line 115
Quoted 3 lines
sound/soc/tegra/tegra_wm9712.c +3
-0+ ret =snd_soc_of_parse_card_name (card,"nvidia,model" ); +if (ret) + goto codec_put;don't the error paths need to undo
platform_device_add()? Or doesplatform_device_put()do that automatically?
Yep, I've just gone through the implementation of those platform functions and at some point we reverse the device_add. I'll fix this up.
Quoted 11 lines
sound/soc/tegra/tegra_wm9712.c line 153
Quoted 8 lines
sound/soc/tegra/tegra_wm9712.c +6
-0+codec_put: +platform_device_put (machine->codec); +return ret; +} +static int tegra_wm9712_driver_remove(struct platform_device *pdev) + platform_device_put(machine->codec);Same comment here.
Re: [PATCH v2 3/3] ASoC: tegra: add tegra machine driver using wm9712 codec
Quoted 11 lines · Lucas Stach
Am Dienstag, den 08.01.2013, 15:17 -0700 schrieb Stephen Warren:
Quoted 2 lines
Hmmm. I thought that could be auto-instantiated based on probing the AC'97 bus for whatever was there?
AC97 is in principle probeable by reading the first regs of the codec, but all the infrastructure to do proper hotplugging on the AC97 bus is missing in the kernel. As I didn't want to be the one to add all this infrastructure to a dying audio platform, I opted to do the same thing as all the other platform using AC97 and instantiate the codec from the machine driver.
That's about the size of it, yes. We should write the device tree as though we'd got better infrastructure here since this isn't something that ought to be required but right now this is how you do AC'97 in ASoC. It'd be really nice if someone had the time to work on the AC'97 infrastructure here but I'd not hold my breath given that it's rarely used in new designs.
PATCH v3 1/1 ASoC: tegra: add tegra machine driver using wm9712 codec
In reply to a message not in the archiveThis adds a very simple machine driver using the Wolfson wm9712 AC97 codec.
---
v2:
- manually probe codec driver without using DT
- fixup Kconfig for select and depends
v3:
- correctly tear down codec platform device in error and remove paths
- simplify init function
--- .../bindings/sound/nvidia,tegra-audio-wm9712.txt | 51 ++++++ sound/soc/tegra/Kconfig | 9 ++ sound/soc/tegra/Makefile | 2 + sound/soc/tegra/tegra_wm9712.c | 176 +++++++++++++++++++++ 4 files changed, 238 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.txt create mode 100644 sound/soc/tegra/tegra_wm9712.c
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.txt new file +51 -0
@@ -0,0 +1,51 @@ +NVIDIA Tegra audio complex + +Required properties: +- compatible : "nvidia,tegra-audio-wm9712" +- nvidia,model : The user-visible name of this sound complex. +- nvidia,audio-routing : A list of the connections between audio components. + Each entry is a pair of strings, the first being the connection's sink, + the second being the connection's source. Valid names for sources and + sinks are the WM9712's pins, and the jacks on the board: + + WM9712 pins: + + * MONOOUT + * HPOUTL + * HPOUTR + * LOUT2 + * ROUT2 + * OUT3 + * LINEINL + * LINEINR + * PHONE + * PCBEEP + * MIC1 + * MIC2 + * Mic Bias + + Board connectors: + + * Headphone + * LineIn + * Mic + +- nvidia,ac97-controller : The phandle of the Tegra AC97 controller + + +Example: + +sound { + compatible = "nvidia,tegra-audio-wm9712-colibri_t20", + "nvidia,tegra-audio-wm9712"; + nvidia,model = "Toradex Colibri T20"; + + nvidia,audio-routing = + "Headphone", "HPOUTL", + "Headphone", "HPOUTR", + "LineIn", "LINEINL", + "LineIn", "LINEINR", + "Mic", "MIC1"; + + nvidia,ac97-controller = <&ac97>; +};
sound/soc/tegra/Kconfig +9 -0
@@ -70,6 +70,15 @@ config SND_SOC_TEGRA_WM8903 boards using the WM8093 codec. Currently, the supported boards are Harmony, Ventana, Seaboard, Kaen, and Aebl. +config SND_SOC_TEGRA_WM9712 + tristate "SoC Audio support for Tegra boards using a WM9712 codec" + depends on SND_SOC_TEGRA && ARCH_TEGRA_2x_SOC + select SND_SOC_TEGRA20_AC97 + select SND_SOC_WM9712 + help + Say Y or M here if you want to add support for SoC audio on Tegra + boards using the WM9712 (or compatible) codec. + config SND_SOC_TEGRA_TRIMSLICE tristate "SoC Audio support for TrimSlice board" depends on SND_SOC_TEGRA && I2C
sound/soc/tegra/Makefile +2 -0
@@ -18,10 +18,12 @@ obj-$(CONFIG_SND_SOC_TEGRA30_I2S) += snd-soc-tegra30-i2s.o # Tegra machine Support snd-soc-tegra-wm8753-objs := tegra_wm8753.o snd-soc-tegra-wm8903-objs := tegra_wm8903.o +snd-soc-tegra-wm9712-objs := tegra_wm9712.o snd-soc-tegra-trimslice-objs := trimslice.o snd-soc-tegra-alc5632-objs := tegra_alc5632.o obj-$(CONFIG_SND_SOC_TEGRA_WM8753) += snd-soc-tegra-wm8753.o obj-$(CONFIG_SND_SOC_TEGRA_WM8903) += snd-soc-tegra-wm8903.o +obj-$(CONFIG_SND_SOC_TEGRA_WM9712) += snd-soc-tegra-wm9712.o obj-$(CONFIG_SND_SOC_TEGRA_TRIMSLICE) += snd-soc-tegra-trimslice.o obj-$(CONFIG_SND_SOC_TEGRA_ALC5632) += snd-soc-tegra-alc5632.o
sound/soc/tegra/tegra_wm9712.c new file +176 -0
176 lines not on this page · raw message
Signature · 1 line
1.8.0.2
A message that is not in the archive (sent off-list or not yet received): 1358337912-27673-1-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org
Stephen Warren
Reviewed-byRe: [PATCH v3] ASoC: tegra: add tegra machine driver using wm9712 codec
Quoted 2 lines · Lucas Stach
This adds a very simple machine driver using the Wolfson wm9712 AC97 codec.
Mark Brown
AppliedRe: [PATCH v3] ASoC: tegra: add tegra machine driver using wm9712 codec
In reply to a message not in the archiveQuoted 2 lines · Lucas Stach
This adds a very simple machine driver using the Wolfson wm9712 AC97 codec.
Applied, thanks.