arm/tegra: Device tree support for audio
Subsystems (7)
v2 cover arm/tegra: Device tree support for audio
This patch series shouldn't be considered final until the relevant ASoC changes are accepted, since the documentation and implementation of most of the DT bindings are in those ASoC patches and this series just puts those bindings into use.
Still, I figured I should post them all for early review.
The one binding that's actually defined here is that for the APB DMA engine.
For the record, this series depends on at least the following for context and to merge and compile:
series ending: arm/dt: tegra: Fix SDHCI nodes to match board files arm/tegra: convert tegra20 to GIC devicetree binding arm/tegra: Remove use of TEGRA_GPIO_TO_IRQ
gpio/tegra: Dynamically allocate IRQ base, and support DT
... and all the patches I've posted to the ASoC list in order to actually enable the audio card through DT at run-time.
Stephen Warren (8):
arm/tegra: board-dt: Fix AUXDATA typo
arm/tegra: board-dt: Enable audio-related clocks arm/tegra: Split Seaboard GPIO table to allow for Ventana arm/dt: tegra: Add Tegra APB DMA device tree binding arm/dt: tegra: Clean up I2S and DAS nodes
arm/dt: tegra: Modify I2S nodes to match binding arm/dt: tegra: Add labels for I2S controllers arm/dt: tegra: Enable audio on WM8903 boards, disable others
.../devicetree/bindings/dma/tegra20-apbdma.txt | 29 +++++++++++++ arch/arm/boot/dts/tegra-harmony.dts | 42 +++++++++++++++----- arch/arm/boot/dts/tegra-paz00.dts | 12 +++++ arch/arm/boot/dts/tegra-seaboard.dts | 41 +++++++++++++++++++ arch/arm/boot/dts/tegra-trimslice.dts | 12 +++++ arch/arm/boot/dts/tegra-ventana.dts | 43 ++++++++++++++++++++ arch/arm/boot/dts/tegra20.dtsi | 35 +++++++++++----- arch/arm/mach-tegra/board-dt.c | 7 +++- arch/arm/mach-tegra/board-seaboard-pinmux.c | 16 +++++++- 9 files changed, 215 insertions(+), 22 deletions(-) create mode 100644 Documentation/devicetree/bindings/dma/tegra20-apbdma.txt
A message that is not in the archive (sent off-list or not yet received): 1323296033-28730-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
PATCH v2 1/8 arm/tegra: board-dt: Fix AUXDATA typo
Fix the address of the I2S2 controller in the AUXDATA table.
--- arch/arm/mach-tegra/board-dt.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-tegra/board-dt.c +1 -1
@@ -73,7 +73,7 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {OF_DEV_AUXDATA ("nvidia,tegra20-i2c" ,TEGRA_I2C3_BASE ,"tegra-i2c.2" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-i2c" ,TEGRA_DVC_BASE ,"tegra-i2c.3" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-i2s" ,TEGRA_I2S1_BASE ,"tegra-i2s.0" ,NULL ), -OF_DEV_AUXDATA ("nvidia,tegra20-i2s" ,TEGRA_I2S1_BASE ,"tegra-i2s.1" ,NULL ), +OF_DEV_AUXDATA ("nvidia,tegra20-i2s" ,TEGRA_I2S2_BASE ,"tegra-i2s.1" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-das" ,TEGRA_APB_MISC_DAS_BASE ,"tegra-das" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-ehci" ,TEGRA_USB_BASE ,"tegra-ehci.0" , &tegra_ehci1_device.dev.platform_data),
Signature · 1 line
1.7.0.4
A message that is not in the archive (sent off-list or not yet received): 1323296033-28730-2-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Olof Johansson
AppliedRe: [PATCH v2 1/8] arm/tegra: board-dt: Fix AUXDATA typo
Quoted 13 lines · Stephen Warren
Fix the address of the I2S2 controller in the AUXDATA table.
Signed-off-by Stephen Warren <[email protected]>--- arch/arm/mach-tegra/board-dt.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/arm/mach-tegra/board-dt.c +0
-0
arch/arm/mach-tegra/board-dt.c struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { · line 79
Quoted 8 lines
arch/arm/mach-tegra/board-dt.c +1
-1@@ -73,7 +73,7 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {OF_DEV_AUXDATA ("nvidia,tegra20-i2c" ,TEGRA_I2C3_BASE ,"tegra-i2c.2" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-i2c" ,TEGRA_DVC_BASE ,"tegra-i2c.3" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-i2s" ,TEGRA_I2S1_BASE ,"tegra-i2s.0" ,NULL ), -OF_DEV_AUXDATA ("nvidia,tegra20-i2s" ,TEGRA_I2S1_BASE ,"tegra-i2s.1" ,NULL ), +OF_DEV_AUXDATA ("nvidia,tegra20-i2s" ,TEGRA_I2S2_BASE ,"tegra-i2s.1" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-das" ,TEGRA_APB_MISC_DAS_BASE ,"tegra-das" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-ehci" ,TEGRA_USB_BASE ,"tegra-ehci.0" , &tegra_ehci1_device.dev.platform_data),
Thanks, applied to for-3.3/boards since it's an obvious bug fix that might as well go in.
-Olof
PATCH v2 1/6 ASoC: Allow device tree to specify a card's name
In reply to a message not in the archiveIf a card's device was instantiated from device tree, and the device tree has a "user-visible-name" property, use that as the card's name.
---
v2: New patch implementing new functionality
Re: the binding documentation:
* "SoC" here refers to the fact this is a binding oriented at System-on- chip audio complexes, rather than having to do with "ASoC"; both names were derived from the same root.
* Do we need a compatible property for this "base class" binding at all? I think it's a good idea, even though the code doesn't actually rely on it.
* Should the vendor field in the compatible property be "generic", "linux", or absent? I've tried to make these bindings generic and applicable to other OSs, so "linux," seems wrong.
* Should the property "user-visible-name" have a "generic," prefix or similar?
.../bindings/sound/soc-audio-complex.txt | 14 ++++++++ sound/soc/soc-core.c | 35 ++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/soc-audio-complex.txt
Documentation/devicetree/bindings/sound/soc-audio-complex.txt new file +14 -0
@@ -0,0 +1,14 @@ +SoC Audio Complex + +Required properties: +- compatible : "generic,soc-audio-complex". Other compatible values + indicating the specific HW model will typically be present too. +- user-visible-name : The user-visible name of this sound complex. + +Example: + +sound { + compatible = "nvidia,tegra-audio-wm8903", + "generic,soc-audio-complex"; + user-visible-name = "tegra-wm8903-harmony"; +};
sound/soc/soc-core.c +33 -2
@@ -32,6 +32,7 @@#include <linux/platform_device.h> #include <linux/ctype.h> #include <linux/slab.h> +#include <linux/of.h> #include <sound/ac97_codec.h> #include <sound/core.h> #include <sound/jack.h>
@@ -2809,6 +2810,25 @@ int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute) }EXPORT_SYMBOL_GPL (snd_soc_dai_digital_mute); +/* Retrieve a card's name from device tree */ +static int snd_soc_of_parse_card_name (struct snd_soc_card *card) +{ +struct device_node *np = card->dev->of_node; +int ret; + + ret =of_property_read_string_index (np,"user-visible-name" ,0 , + &card->name); +/* +* EINVAL means the property does not exist. This is fine providing +* card->name was previously set, which is checked later in +* snd_soc_register_card. +*/ +if (ret <0 && ret != -EINVAL ) +return ret; + +return 0 ; +} +/** * snd_soc_register_card - Register a card with the ASoC core *
@@ -2817,11 +2837,22 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_digital_mute);*/ int snd_soc_register_card (struct snd_soc_card *card) { -int i; +int i, ret; -if (!card->name || !card->dev) +if (!card->dev)return -EINVAL ; +if (card->dev->of_node) { + ret =snd_soc_of_parse_card_name (card); +if (ret <0 ) +return ret; + } + +if (!card->name) { +dev_err (card->dev,"Card name is not set\n" ); +return -EINVAL ; + } +dev_set_drvdata (card->dev, card);snd_soc_initialize_card_lists (card);
Signature · 1 line
1.7.0.4
A message that is not in the archive (sent off-list or not yet received): 1323296033-28730-3-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 1/6] ASoC: Allow device tree to specify a card's name
Quoted 7 lines · Stephen Warren
If a card's device was instantiated from device tree, and the device tree has a "user-visible-name" property, use that as the card's name.
Signed-off-by Stephen Warren <[email protected]>---
v2: New patch implementing new functionality
Quoted 10 lines
Re: the binding documentation:
* "SoC" here refers to the fact this is a binding oriented at System-on- chip audio complexes, rather than having to do with "ASoC"; both names were derived from the same root.
* Do we need a compatible property for this "base class" binding at all? I think it's a good idea, even though the code doesn't actually rely on it.
* Should the vendor field in the compatible property be "generic", "linux", or absent? I've tried to make these bindings generic and applicable to other OSs, so "linux," seems wrong.
Just drop "generic," in my opinion. Rob? Grant? Segher?
Quoted 2 lines
* Should the property "user-visible-name" have a "generic," prefix or similar?
The root node uses "model" for the same purpose, to describe the machine model with a user-visible string. Maybe just use that name here?
-Olof
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 1/6] ASoC: Allow device tree to specify a card's name
Quoted 19 lines · Olof Johansson
Quoted 7 lines · Stephen Warren
If a card's device was instantiated from device tree, and the device tree has a "user-visible-name" property, use that as the card's name.
Signed-off-by Stephen Warren <[email protected]>---
v2: New patch implementing new functionalityQuoted 10 lines
Re: the binding documentation:
* "SoC" here refers to the fact this is a binding oriented at System-on- chip audio complexes, rather than having to do with "ASoC"; both names were derived from the same root.
* Do we need a compatible property for this "base class" binding at all? I think it's a good idea, even though the code doesn't actually rely on it.
* Should the vendor field in the compatible property be "generic", "linux", or absent? I've tried to make these bindings generic and applicable to other OSs, so "linux," seems wrong.
Quoted 1 line
Just drop "generic," in my opinion. Rob? Grant? Segher?
I think the whole string should be dropped as it is too generic.
Rob
Quoted 9 lines
Quoted 3 lines
* Should the property "user-visible-name" have a "generic," prefix or similar?
The root node uses "model" for the same purpose, to describe the machine model with a user-visible string. Maybe just use that name here?
-Olof
A message that is not in the archive (sent off-list or not yet received): [email protected]
RE: [PATCH v2 1/6] ASoC: Allow device tree to specify a card's name
Rob Herring wrote at Wednesday, December 07, 2011 5:16 PM:
Quoted 20 lines · Olof Johansson
Quoted 19 lines · Stephen Warren
Quoted 17 lines
If a card's device was instantiated from device tree, and the device tree has a "user-visible-name" property, use that as the card's name.
Signed-off-by Stephen Warren <[email protected]>---
v2: New patch implementing new functionalityRe: the binding documentation:
* "SoC" here refers to the fact this is a binding oriented at System-on- chip audio complexes, rather than having to do with "ASoC"; both names were derived from the same root.
* Do we need a compatible property for this "base class" binding at all? I think it's a good idea, even though the code doesn't actually rely on it.
* Should the vendor field in the compatible property be "generic", "linux", or absent? I've tried to make these bindings generic and applicable to other OSs, so "linux," seems wrong.
Quoted 3 lines
Quoted 1 line
Just drop "generic," in my opinion. Rob? Grant? Segher?
I think the whole string should be dropped as it is too generic.
My idea was to mark the node as being capable of hosting the generic user-visible-name and audio-routes properties, sort of like a C++ base class. Is there no need to do that kind of thing?
Signature · 1 line
nvpublic
PATCH v2 2/8 arm/tegra: board-dt: Enable audio-related clocks
In reply to a message not in the archiveCertain clocks are required for core audio functionality. Set up the appropriate parenting relationships, and enable clocks that must be on permanently.
--- arch/arm/mach-tegra/board-dt.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/mach-tegra/board-dt.c +5 -0
@@ -90,6 +90,11 @@ static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = { { "usbd", "clk_m", 12000000, false }, { "usb2", "clk_m", 12000000, false }, { "usb3", "clk_m", 12000000, false }, + { "pll_a", "pll_p_out1", 56448000, true }, + { "pll_a_out0", "pll_a", 11289600, true }, + { "cdev1", NULL, 0, true }, + { "i2s1", "pll_a_out0", 11289600, false}, + { "i2s2", "pll_a_out0", 11289600, false}, { NULL, NULL, 0, 0}, };
Signature · 1 line
1.7.0.4
A message that is not in the archive (sent off-list or not yet received): 1323296033-28730-4-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Olof Johansson
AppliedRe: [PATCH v2 2/8] arm/tegra: board-dt: Enable audio-related clocks
Quoted 5 lines · Stephen Warren
Certain clocks are required for core audio functionality. Set up the appropriate parenting relationships, and enable clocks that must be on permanently.
Signed-off-by Stephen Warren <[email protected]>
Thanks, applied to for-3.3/boards
-Olof
PATCH v2 2/6 ASoC: Allow the DAPM routes to be stored in device tree
In reply to a message not in the archiveIf a card's device was instantiated from device tree, and card's device did not specify a DAPM route map, and the device tree has an "audio- routing" property, parse this to construct the DAPM route array.
---
v2: New patch; separated this code out of the Tegra+WM8903 machine driver into a generic feature.
Note that this binding does not allow the "control" field of the routes to be specified via device tree. Should the binding be expanded to allow this? Representing this while still keeping the binding generic enough to be useful outside ASoC might be difficult. I'm not sure if this feature is useful at the card level? I quickly checked, and couldn't see any in-tree users of this functionality.
.../bindings/sound/soc-audio-complex.txt | 15 ++++++ sound/soc/soc-core.c | 48 ++++++++++++++++++++ 2 files changed, 63 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/sound/soc-audio-complex.txt +15 -0
@@ -4,6 +4,12 @@ Required properties: - compatible : "generic,soc-audio-complex". Other compatible values indicating the specific HW model will typically be present too. - user-visible-name : The user-visible name of this sound complex. +- 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 determined by the binding for the HW that comprises the + audio complex, e.g. the names of an audio codec's pins, the names of + the user-visible jacks (plugs) on the board, etc. Example:
@@ -11,4 +17,13 @@ sound { compatible = "nvidia,tegra-audio-wm8903", "generic,soc-audio-complex"; user-visible-name = "tegra-wm8903-harmony"; + audio-routing = + "Headphone Jack", "HPOUTR", + "Headphone Jack", "HPOUTL", + "Int Spk", "ROP", + "Int Spk", "RON", + "Int Spk", "LOP", + "Int Spk", "LON", + "Mic Jack", "MICBIAS", + "IN1L", "Mic Jack"; };
sound/soc/soc-core.c +48 -0
60 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v2 3/8 arm/tegra: Split Seaboard GPIO table to allow for Ventana
In reply to a message not in the archiveSeaboard and Ventana share some GPIOs, but others are different. Split the GPIO table into common, seaboard-specific, and ventana-specific tables, so that only the correct ones are enabled for each board. Add a few missing audio-related GPIOs for Ventana.
--- arch/arm/mach-tegra/board-seaboard-pinmux.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)
arch/arm/mach-tegra/board-seaboard-pinmux.c +15 -1
@@ -190,14 +190,26 @@ static struct tegra_gpio_table common_gpio_table[] = { { .gpio = TEGRA_GPIO_SD2_CD, .enable = true }, { .gpio = TEGRA_GPIO_SD2_WP, .enable = true }, { .gpio = TEGRA_GPIO_SD2_POWER, .enable = true }, + { .gpio = TEGRA_GPIO_CDC_IRQ, .enable = true }, +}; + +static struct tegra_gpio_table seaboard_gpio_table[] = { { .gpio =TEGRA_GPIO_LIDSWITCH , .enable = true }, { .gpio =TEGRA_GPIO_POWERKEY , .enable = true }, { .gpio =TEGRA_GPIO_HP_DET , .enable = true }, { .gpio =TEGRA_GPIO_ISL29018_IRQ , .enable = true }, - { .gpio = TEGRA_GPIO_CDC_IRQ, .enable = true }, { .gpio =TEGRA_GPIO_USB1 , .enable = true }, }; +static struct tegra_gpio_table ventana_gpio_table[] = { +/* hp_det */ + { .gpio =TEGRA_GPIO_PW2 , .enable = true }, +/* int_mic_en */ + { .gpio =TEGRA_GPIO_PX0 , .enable = true }, +/* ext_mic_en */ + { .gpio =TEGRA_GPIO_PX1 , .enable = true }, +}; +static void __init update_pinmux (struct tegra_pingroup_config *newtbl,int size) {int i, j;
@@ -235,11 +247,13 @@ void __init seaboard_common_pinmux_init(void)void __init seaboard_pinmux_init (void ) {seaboard_common_pinmux_init (); +tegra_gpio_config (seaboard_gpio_table,ARRAY_SIZE (seaboard_gpio_table)); }void __init ventana_pinmux_init (void ) {update_pinmux (ventana_pinmux,ARRAY_SIZE (ventana_pinmux));seaboard_common_pinmux_init (); +tegra_gpio_config (ventana_gpio_table,ARRAY_SIZE (ventana_gpio_table)); }
Signature · 1 line
1.7.0.4
A message that is not in the archive (sent off-list or not yet received): 1323296033-28730-6-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Re: [PATCH v2 3/8] arm/tegra: Split Seaboard GPIO table to allow for Ventana
Hi,
Quoted 28 lines · Stephen Warren
Seaboard and Ventana share some GPIOs, but others are different. Split the GPIO table into common, seaboard-specific, and ventana-specific tables, so that only the correct ones are enabled for each board. Add a few missing audio-related GPIOs for Ventana.
Signed-off-by Stephen Warren <[email protected]>--- arch/arm/mach-tegra/board-seaboard-pinmux.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)arch/arm/mach-tegra/board-seaboard-pinmux.c +4
-1@@ -190,14 +190,26 @@ static struct tegra_gpio_table common_gpio_table[] = { { .gpio = TEGRA_GPIO_SD2_CD, .enable = true }, { .gpio = TEGRA_GPIO_SD2_WP, .enable = true }, { .gpio = TEGRA_GPIO_SD2_POWER, .enable = true }, + { .gpio = TEGRA_GPIO_CDC_IRQ, .enable = true }, +}; + +static struct tegra_gpio_table seaboard_gpio_table[] = { { .gpio =TEGRA_GPIO_LIDSWITCH , .enable = true }, { .gpio =TEGRA_GPIO_POWERKEY , .enable = true }, { .gpio =TEGRA_GPIO_HP_DET , .enable = true }, { .gpio =TEGRA_GPIO_ISL29018_IRQ , .enable = true }, - { .gpio = TEGRA_GPIO_CDC_IRQ, .enable = true }, { .gpio = TEGRA_GPIO_USB1, .enable = true },
arch/arm/mach-tegra/board-seaboard-pinmux.c static struct tegra_gpio_table common_gpio_table[] = { · line 211
Quoted 10 lines
arch/arm/mach-tegra/board-seaboard-pinmux.c +8
-0}; +static struct tegra_gpio_table ventana_gpio_table[] = { +/* hp_det */ + { .gpio =TEGRA_GPIO_PW2 , .enable = true }, +/* int_mic_en */ + { .gpio =TEGRA_GPIO_PX0 , .enable = true }, +/* ext_mic_en */ + { .gpio =TEGRA_GPIO_PX1 , .enable = true }, +};
These should be given symbolical names instead.
-Olof
A message that is not in the archive (sent off-list or not yet received): [email protected]
RE: [PATCH v2 3/8] arm/tegra: Split Seaboard GPIO table to allow for Ventana
Olof Johansson wrote at Wednesday, December 07, 2011 5:11 PM:
Quoted 5 lines · Stephen Warren
Quoted 4 lines
Seaboard and Ventana share some GPIOs, but others are different. Split the GPIO table into common, seaboard-specific, and ventana-specific tables, so that only the correct ones are enabled for each board. Add a few missing audio-related GPIOs for Ventana.
...
Quoted 10 lines
arch/arm/mach-tegra/board-seaboard-pinmux.c static struct tegra_gpio_table common_gpio_table[] = { · line 211
Quoted 8 lines
arch/arm/mach-tegra/board-seaboard-pinmux.c +8
-0+static struct tegra_gpio_table ventana_gpio_table[] = { +/* hp_det */ + { .gpio =TEGRA_GPIO_PW2 , .enable = true }, +/* int_mic_en */ + { .gpio =TEGRA_GPIO_PX0 , .enable = true }, +/* ext_mic_en */ + { .gpio =TEGRA_GPIO_PX1 , .enable = true }, +};These should be given symbolical names instead.
I only gave the Seaboard GPIOs symbolic names because they all ended up being used in multiple places; in this GPIO table, in platform data, etc. Given that Ventana is a DT-only board, and this is the only place that the GPIOs will ever be named by code rather than *.dts files, does it make sense to require symbolic names? If you do think so, I don't really have any objection to making names.
Signature · 1 line
nvpublic
PATCH v2 3/6 ASoC: Refactor some conditions and loop in soc_bind_dai_link()
In reply to a message not in the archiveTransform some loops from:
for_each(x) {
if (f(x)) {
work_on(x);
}
}to new structure:
for_each(x) {
if (!f(x))
continue;
work_on(x);
}This will allow future modification of f(x) with less impact to the code.
---
v2: New patch
sound/soc/soc-core.c | 52 ++++++++++++++++++++++++++++--------------------- 1 files changed, 30 insertions(+), 22 deletions(-)
sound/soc/soc-core.c +30 -22
@@ -764,10 +764,11 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) }/* no, then find CPU DAI from registered DAIs*/ list_for_each_entry (cpu_dai, &dai_list, list) { -if (!strcmp (cpu_dai->name, dai_link->cpu_dai_name)) { - rtd->cpu_dai = cpu_dai; - goto find_codec; - } +if (strcmp (cpu_dai->name, dai_link->cpu_dai_name)) +continue ; + + rtd->cpu_dai = cpu_dai; + goto find_codec; }dev_dbg (card->dev,"CPU DAI %s not registered\n" , dai_link->cpu_dai_name);
@@ -780,22 +781,28 @@ find_codec:/* no, then find CODEC from registered CODECs*/ list_for_each_entry (codec, &codec_list, list) { -if (!strcmp (codec->name, dai_link->codec_name)) { - rtd->codec = codec; - -/* CODEC found, so find CODEC DAI from registered DAIs from this CODEC*/ -list_for_each_entry (codec_dai, &dai_list, list) { -if (codec->dev == codec_dai->dev && - !strcmp (codec_dai->name, dai_link->codec_dai_name)) { - rtd->codec_dai = codec_dai; - goto find_platform; - } - } -dev_dbg (card->dev,"CODEC DAI %s not registered\n" , - dai_link->codec_dai_name); +if (strcmp (codec->name, dai_link->codec_name)) +continue ; + + rtd->codec = codec; - goto find_platform; +/* +* CODEC found, so find CODEC DAI from registered DAIs from +* this CODEC +*/ +list_for_each_entry (codec_dai, &dai_list, list) { +if (codec->dev == codec_dai->dev && + !strcmp (codec_dai->name, + dai_link->codec_dai_name)) { + + rtd->codec_dai = codec_dai; + goto find_platform; + } } +dev_dbg (card->dev,"CODEC DAI %s not registered\n" , + dai_link->codec_dai_name); + + goto find_platform; }dev_dbg (card->dev,"CODEC %s not registered\n" , dai_link->codec_name);
@@ -812,10 +819,11 @@ find_platform:/* no, then find one from the set of registered platforms */ list_for_each_entry (platform, &platform_list, list) { -if (!strcmp (platform->name, platform_name)) { - rtd->platform = platform; - goto out; - } +if (strcmp (platform->name, platform_name)) +continue ; + + rtd->platform = platform; + goto out; } dev_dbg(card->dev, "platform %s not registered\n",
Signature · 1 line
1.7.0.4
PATCH v2 4/8 arm/dt: tegra: Add Tegra APB DMA device tree binding
In reply to a message not in the archiveDocument binding, and add the node to tegra20.dtsi.
The driver isn't actually instantiated from this node yet, but the I2S binding will rely on being able to refer to the APB DMA node using a phandle.
--- .../devicetree/bindings/dma/tegra20-apbdma.txt | 29 ++++++++++++++++++++ arch/arm/boot/dts/tegra20.dtsi | 21 ++++++++++++++ 2 files changed, 50 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/dma/tegra20-apbdma.txt
Documentation/devicetree/bindings/dma/tegra20-apbdma.txt new file +29 -0
@@ -0,0 +1,29 @@ +* NVIDIA Tegra APB DMA controller + +Required properties: +- compatible: Should be "nvidia,<chip>-apbdma" +- reg: Should contain DMA registers location and length +- interrupts: Should contain DMA interrupt + +Examples: + +apbdma: dma@6000a000 { + compatible = "nvidia,tegra20-apbdma"; + reg = <0x6000a000 0x1000>; + interrupts = < 0 136 0x04 + 0 137 0x04 + 0 138 0x04 + 0 139 0x04 + 0 140 0x04 + 0 141 0x04 + 0 142 0x04 + 0 143 0x04 + 0 144 0x04 + 0 145 0x04 + 0 146 0x04 + 0 147 0x04 + 0 148 0x04 + 0 149 0x04 + 0 150 0x04 + 0 151 0x04 >; +};
arch/arm/boot/dts/tegra20.dtsi +21 -0
@@ -12,6 +12,27 @@ < 0x50040100 0x0100 >; }; + apbdma: dma@6000a000 { + compatible = "nvidia,tegra20-apbdma"; + reg = <0x6000a000 0x1000>; + interrupts = < 0 136 0x04 + 0 137 0x04 + 0 138 0x04 + 0 139 0x04 + 0 140 0x04 + 0 141 0x04 + 0 142 0x04 + 0 143 0x04 + 0 144 0x04 + 0 145 0x04 + 0 146 0x04 + 0 147 0x04 + 0 148 0x04 + 0 149 0x04 + 0 150 0x04 + 0 151 0x04 >; + }; + i2c@7000c000 { #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
1.7.0.4
A message that is not in the archive (sent off-list or not yet received): 1323296033-28730-8-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Olof Johansson
AppliedRe: [PATCH v2 4/8] arm/dt: tegra: Add Tegra APB DMA device tree binding
Quoted 7 lines · Stephen Warren
Document binding, and add the node to
tegra20.dtsi.The driver isn't actually instantiated from this node yet, but the I2S binding will rely on being able to refer to the APB DMA node using a phandle.
Signed-off-by Stephen Warren <[email protected]>
Thanks, applied to for-3.3/soc
-Olof
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 4/8] arm/dt: tegra: Add Tegra APB DMA device tree binding
Quoted 11 lines · Olof Johansson
Quoted 7 lines · Stephen Warren
Document binding, and add the node to
tegra20.dtsi.The driver isn't actually instantiated from this node yet, but the I2S binding will rely on being able to refer to the APB DMA node using a phandle.
Signed-off-by Stephen Warren <[email protected]>Thanks, applied to for-3.3/soc
Based on irc discussion, I dropped it again -- let's wait on the interrupt specification changes to land to keep things consistent, since this uses the new specifications.
-Olof
PATCH v2 4/6 ASoC: Allow DAI links to be specified using device tree nodes
In reply to a message not in the archiveDAI link endpoints and platform (DMA) devices are currently specified by name. When instantiating sound cards from device tree, it may be more convenient to refer to these devices by phandle in the device tree, and for code to describe DAI links using the "struct device_node *" ("of_node") those phandles map to.
This change adds new fields to snd_soc_dai_link which can "name" devices using of_node, enhances soc_bind_dai_link() to allow binding based on of_node, and enhances snd_soc_register_card() to ensure that illegal combinations of name and of_node are not used.
---
v2: New patch implementing a new feature
include/sound/soc.h | 4 +++ sound/soc/soc-core.c | 64 ++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 61 insertions(+), 7 deletions(-)
include/sound/soc.h +4 -0
@@ -231,6 +231,7 @@ enum snd_soc_bias_level { SND_SOC_BIAS_ON = 3, }; +struct device_node ;struct snd_jack ;struct snd_soc_card ;struct snd_soc_pcm_stream ;
@@ -704,8 +705,11 @@ struct snd_soc_dai_link {const char *name;/* Codec name */ const char *stream_name;/* Stream name */ const char *codec_name;/* for multi-codec */ +const struct device_node *codec_of_node;const char *platform_name;/* for multi-platform */ +const struct device_node *platform_of_node;const char *cpu_dai_name; +const struct device_node *cpu_dai_of_node;const char *codec_dai_name;unsigned int dai_fmt;/* format to set on init */
sound/soc/soc-core.c +57 -7
92 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v2 5/8 arm/dt: tegra: Clean up I2S and DAS nodes
In reply to a message not in the archiveThe I2S and DAS nodes don't have children, and hence don't need to set address/size cells.
--- arch/arm/boot/dts/tegra20.dtsi | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +0 -6
@@ -66,8 +66,6 @@ }; i2s@70002800 { - #address-cells = <1>; - #size-cells = <0>; compatible = "nvidia,tegra20-i2s"; reg = <0x70002800 0x200>; interrupts = < 0 13 0x04 >;
@@ -75,8 +73,6 @@ }; i2s@70002a00 { - #address-cells = <1>; - #size-cells = <0>; compatible = "nvidia,tegra20-i2s"; reg = <0x70002a00 0x200>; interrupts = < 0 3 0x04 >;
@@ -84,8 +80,6 @@ }; das@70000c00 { - #address-cells = <1>; - #size-cells = <0>; compatible = "nvidia,tegra20-das"; reg = <0x70000c00 0x80>; };
Signature · 1 line
1.7.0.4
A message that is not in the archive (sent off-list or not yet received): 1323296033-28730-10-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Olof Johansson
AppliedRe: [PATCH v2 5/8] arm/dt: tegra: Clean up I2S and DAS nodes
Quoted 4 lines · Stephen Warren
The I2S and DAS nodes don't have children, and hence don't need to set address/size cells.
Signed-off-by Stephen Warren <[email protected]>
Thanks, applied to for-3.3/soc
PATCH v2 5/6 ASoC: Tegra: Move DAS configuration into DAS driver
In reply to a message not in the archiveMove DAS routing setup into the DAS driver itself. This removes the need to duplicate this in each machine driver, of which we'll soon have three.
An added advantage is that the machine drivers no longer call the Tegra20- specific DAS functions by name, so the machine driver no longer needs to be split up into Tegra20 and Tegra30 versions.
If individual machine drivers need a different routing setup to this default, they can still call the DAS functions to set that up.
Long-term, DAS will be a codec driver, and user-space will be able to control its routing, possibly within constraints that the machine driver sets up. Configuring the DAS routing from the DAS driver is a very slight move in that direction.
---
v2: New patch. Sorry for the churn here. This should avoid the Paz00 (Toshiba AC100) machine driver from having to add the calls to the DAS driver.
sound/soc/tegra/tegra_das.c | 13 +++++++++++++ sound/soc/tegra/tegra_wm8903.c | 13 ------------- sound/soc/tegra/trimslice.c | 23 ----------------------- 3 files changed, 13 insertions(+), 36 deletions(-)
sound/soc/tegra/tegra_das.c +13 -0
@@ -202,6 +202,19 @@ static int __devinit tegra_das_probe(struct platform_device *pdev) goto err; } + ret =tegra_das_connect_dap_to_dac (TEGRA_DAS_DAP_ID_1 , +TEGRA_DAS_DAP_SEL_DAC1 ); +if (ret) { +dev_err (&pdev->dev,"Can't set up DAS DAP connection\n" ); + goto err; + } + ret =tegra_das_connect_dac_to_dap (TEGRA_DAS_DAC_ID_1 , +TEGRA_DAS_DAC_SEL_DAP1 ); +if (ret) { +dev_err (&pdev->dev,"Can't set up DAS DAC connection\n" ); + goto err; + } +tegra_das_debug_add (das);platform_set_drvdata (pdev, das);
sound/soc/tegra/tegra_wm8903.c +0 -13
@@ -249,19 +249,6 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)struct tegra_wm8903_platform_data *pdata = machine->pdata;int ret; - ret =tegra_das_connect_dap_to_dac (TEGRA_DAS_DAP_ID_1 , -TEGRA_DAS_DAP_SEL_DAC1 ); -if (ret) { -dev_err (card->dev,"Can't set up DAS DAP connection\n" ); -return ret; - } - ret =tegra_das_connect_dac_to_dap (TEGRA_DAS_DAC_ID_1 , -TEGRA_DAS_DAC_SEL_DAP1 ); -if (ret) { -dev_err (card->dev,"Can't set up DAS DAC connection\n" ); -return ret; - } -if (gpio_is_valid (pdata->gpio_spkr_en)) { ret =gpio_request (pdata->gpio_spkr_en,"spkr_en" );if (ret) {
sound/soc/tegra/trimslice.c +0 -23
@@ -115,28 +115,6 @@ static const struct snd_soc_dapm_route trimslice_audio_map[] = { {"RLINEIN", NULL, "Line In"}, }; -static int trimslice_asoc_init (struct snd_soc_pcm_runtime *rtd) -{ -struct snd_soc_codec *codec = rtd->codec; -struct snd_soc_card *card = codec->card; -int ret; - - ret =tegra_das_connect_dap_to_dac (TEGRA_DAS_DAP_ID_1 , -TEGRA_DAS_DAP_SEL_DAC1 ); -if (ret) { -dev_err (card->dev,"Can't set up DAS DAP connection\n" ); -return ret; - } - ret =tegra_das_connect_dac_to_dap (TEGRA_DAS_DAC_ID_1 , -TEGRA_DAS_DAC_SEL_DAP1 ); -if (ret) { -dev_err (card->dev,"Can't set up DAS DAC connection\n" ); -return ret; - } - -return 0 ; -} -static struct snd_soc_dai_link trimslice_tlv320aic23_dai = { .name ="TLV320AIC23" , .stream_name = "AIC23",
@@ -144,7 +122,6 @@ static struct snd_soc_dai_link trimslice_tlv320aic23_dai = { .platform_name = "tegra-pcm-audio", .cpu_dai_name = "tegra-i2s.0", .codec_dai_name = "tlv320aic23-hifi", - .init = trimslice_asoc_init, .ops = &trimslice_asoc_ops, };
Signature · 1 line
1.7.0.4
PATCH v2 6/8 arm/dt: tegra: Modify I2S nodes to match binding
In reply to a message not in the archiveAdjust the dma-channel property name to match the binding implemented by the driver. The binding was implemented and documented in a separate change to the ASoC tree.
--- arch/arm/boot/dts/tegra20.dtsi | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +2 -2
@@ -69,14 +69,14 @@ compatible = "nvidia,tegra20-i2s"; reg = <0x70002800 0x200>; interrupts = < 0 13 0x04 >; - dma-channel = < 2 >; + nvidia,dma-request-selector = < &apbdma 2 >; }; i2s@70002a00 { compatible = "nvidia,tegra20-i2s"; reg = <0x70002a00 0x200>; interrupts = < 0 3 0x04 >; - dma-channel = < 1 >; + nvidia,dma-request-selector = < &apbdma 1 >; }; das@70000c00 {
Signature · 1 line
1.7.0.4
PATCH v2 6/6 ASoC: Tegra+WM8903 machine: Add device tree binding
In reply to a message not in the archiveThis driver is parameterized in two ways:
a) Platform data, which supplies the set of GPIOs used by the driver. These GPIOs can now be parsed out of device tree.
b) Machine-specific DAPM route arrays embedded into the ASoC machine driver itself. Historically, the driver picks the appropriate array to use using machine_is_*(). The driver now requires this array to be parsed from device tree when instantiated through device tree, using the core ASoC support for this parsing.
Based on work by John Bonesio, but significantly reworked since then.
---
v2:
* Split DAPM map parsing into a core ASoC feature.
* Updating binding to require codec and I2S controller phandles, use new ASoC core feature to bind DAI links using OF nodes rather than device names.
* Rebase on top of WM8903 MICBIAS supply conversion.
* Other minor cleanups.
.../bindings/sound/tegra-audio-wm8903.txt | 72 +++++++++++++ sound/soc/tegra/tegra_wm8903.c | 106 ++++++++++++++++---- 2 files changed, 156 insertions(+), 22 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/tegra-audio-wm8903.txt
Documentation/devicetree/bindings/sound/tegra-audio-wm8903.txt new file +72 -0
@@ -0,0 +1,72 @@ +NVIDIA Tegra audio complex + +Required properties: +- compatible : "nvidia,tegra-audio-wm8903" (specific HW model) + "generic,soc-audio-complex" (generic audio complex) +- user-visible-name : As defined by soc-audio-complex.txt. +- audio-routing : As defined by soc-audio-complex.txt. + Valid names for sources and sinks are the WM8903's pins, and the jacks + on the board: + + WM8903 pins: + + * IN1L + * IN1R + * IN2L + * IN2R + * IN3L + * IN3R + * DMICDAT + * HPOUTL + * HPOUTR + * LINEOUTL + * LINEOUTR + * LOP + * LON + * ROP + * RON + * MICBIAS + + Board connectors: + + * Headphone Jack + * Int Spk + * Mic Jack + +- nvidia,i2s-controller : The phandle of the Tegra I2S1 controller +- nvidia,audio-codec : The phandle of the WM8903 audio codec + +Optional properties: +- nvidia,spkr-en-gpios : The GPIO that enables the speakers +- nvidia,hp-mute-gpios : The GPIO that mutes the headphones +- nvidia,hp-det-gpios : The GPIO that detect headphones are plugged in +- nvidia,int-mic-en-gpios : The GPIO that enables the internal microphone +- nvidia,ext-mic-en-gpios : The GPIO that enables the external microphone + +Example: + +sound { + compatible = "nvidia,tegra-audio-wm8903-harmony", + "nvidia,tegra-audio-wm8903", + "generic,soc-audio-complex"; + user-visible-name = "tegra-wm8903-harmony"; + + audio-routing = + "Headphone Jack", "HPOUTR", + "Headphone Jack", "HPOUTL", + "Int Spk", "ROP", + "Int Spk", "RON", + "Int Spk", "LOP", + "Int Spk", "LON", + "Mic Jack", "MICBIAS", + "IN1L", "Mic Jack"; + + nvidia,i2s-controller = <&i2s1>; + nvidia,audio-codec = <&wm8903>; + + nvidia,spkr-en-gpios = <&codec 2 0>; + nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ + nvidia,int-mic-en-gpios = <&gpio 184 0>; /*gpio PX0 */ + nvidia,ext-mic-en-gpios = <&gpio 185 0>; /* gpio PX1 */ +}; +
sound/soc/tegra/tegra_wm8903.c +84 -22
192 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v2 7/8 arm/dt: tegra: Add labels for I2S controllers
In reply to a message not in the archiveThis will allow the sound node to refer to the I2S controllers by name when creating phandles.
--- arch/arm/boot/dts/tegra20.dtsi | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +2 -2
@@ -65,14 +65,14 @@ interrupts = < 0 53 0x04 >; }; - i2s@70002800 { + tegra_i2s1: i2s@70002800 { compatible = "nvidia,tegra20-i2s"; reg = <0x70002800 0x200>; interrupts = < 0 13 0x04 >; nvidia,dma-request-selector = < &apbdma 2 >; }; - i2s@70002a00 { + tegra_i2s2: i2s@70002a00 { compatible = "nvidia,tegra20-i2s"; reg = <0x70002a00 0x200>; interrupts = < 0 3 0x04 >;
Signature · 1 line
1.7.0.4
PATCH v2 8/8 arm/dt: tegra: Enable audio on WM8903 boards, disable others
In reply to a message not in the archiveAdd complete bindings to instantiate and configure the codec and top-level audio complex on all currently supported boards using the Tegra+WM8903 audio driver.
On those boards, disable the I2S2 controller since it isn't used.
On boards not using the WM8903 codec, disable all the audio devices; they can be re-enabled once the relevant codec and ASoC machine drivers have been ported to device-tree.
--- arch/arm/boot/dts/tegra-harmony.dts | 42 ++++++++++++++++++++++++------- arch/arm/boot/dts/tegra-paz00.dts | 12 +++++++++ arch/arm/boot/dts/tegra-seaboard.dts | 41 +++++++++++++++++++++++++++++++ arch/arm/boot/dts/tegra-trimslice.dts | 12 +++++++++ arch/arm/boot/dts/tegra-ventana.dts | 43 +++++++++++++++++++++++++++++++++ 5 files changed, 140 insertions(+), 10 deletions(-)
arch/arm/boot/dts/tegra-harmony.dts +32 -10
@@ -13,16 +13,18 @@ i2c@7000c000 { clock-frequency = <400000>; - codec: wm8903@1a { + wm8903: wm8903@1a { compatible = "wlf,wm8903"; reg = <0x1a>; - interrupts = < 347 >; + interrupt-parent = <&gpio>; + interrupts = < 187 0x04 >; gpio-controller; #gpio-cells = <2>; - /* 0x8000 = Not configured */ - gpio-cfg = < 0x8000 0x8000 0 0x8000 0x8000 >; + micdet-cfg = <0>; + micdet-delay = <100>; + gpio-cfg = < 0xffffffff 0xffffffff 0 0xffffffff 0xffffffff >; }; };
@@ -38,13 +40,33 @@ clock-frequency = <400000>; }; - sound { - compatible = "nvidia,harmony-sound", "nvidia,tegra-wm8903"; + i2s@70002a00 { + status = "disable"; + }; - spkr-en-gpios = <&codec 2 0>; - hp-det-gpios = <&gpio 178 0>; - int-mic-en-gpios = <&gpio 184 0>; - ext-mic-en-gpios = <&gpio 185 0>; + sound { + compatible = "nvidia,tegra-audio-wm8903-harmony", + "nvidia,tegra-audio-wm8903", + "generic,soc-audio-complex"; + user-visible-name = "tegra-wm8903-harmony"; + + audio-routing = + "Headphone Jack", "HPOUTR", + "Headphone Jack", "HPOUTL", + "Int Spk", "ROP", + "Int Spk", "RON", + "Int Spk", "LOP", + "Int Spk", "LON", + "Mic Jack", "MICBIAS", + "IN1L", "Mic Jack"; + + nvidia,i2s-controller = <&tegra_i2s1>; + nvidia,audio-codec = <&wm8903>; + + nvidia,spkr-en-gpios = <&wm8903 2 0>; + nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ + nvidia,int-mic-en-gpios = <&gpio 184 0>; /*gpio PX0 */ + nvidia,ext-mic-en-gpios = <&gpio 185 0>; /* gpio PX1 */ }; serial@70006000 {
arch/arm/boot/dts/tegra-paz00.dts +12 -0
@@ -37,6 +37,18 @@ clock-frequency = <400000>; }; + i2s@70002800 { + status = "disable"; + }; + + i2s@70002a00 { + status = "disable"; + }; + + das@70000c00 { + status = "disable"; + }; + serial@70006000 { clock-frequency = <216000000>; };
arch/arm/boot/dts/tegra-seaboard.dts +41 -0
53 lines not on this page · raw message
arch/arm/boot/dts/tegra-trimslice.dts +12 -0
@@ -26,6 +26,18 @@ status = "disable"; }; + i2s@70002800 { + status = "disable"; + }; + + i2s@70002a00 { + status = "disable"; + }; + + das@70000c00 { + status = "disable"; + }; + serial@70006000 { clock-frequency = < 216000000 >; };
arch/arm/boot/dts/tegra-ventana.dts +43 -0
55 lines not on this page · raw message
Signature · 1 line
1.7.0.4