[alsa-devel] [PATCH v2 00/11] Fix AM335x-evm analog audio support
From: Jyri Sarha jsarha@ti.com
The first version of patches can been found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066178.h...
Changes for v2 - Dropped our "ASoC: davinci-mcasp: Add pinctrl support" since driver core is taking care of this now. - Cleanup am33xx audio build - Add regulators to tlv320aic3x DT binding document - Remove dm365-voice-codec-audio DT support as it has never been tested an probably does not work - Add output pins and Line In connector to davinci-evm-audio DT binding doc - Remove asp_chan_q and ram_chan_q properties from mcasp DT node in DT mode mcasp is hardcoded to event queue 0 (highest priority) - Add pins to tlv320aic3x DT bindings document. If I misunderstood Marks comment and this patch is not needed, then just leave it out Changes based on TI internal discussions - Move system clock rate logic away from from evm_hw_params soc-op - Remove unnecesary #if defined(CONFIG_OF) from davinci-evm.c - Make dma property DT binding document more exact - Add only "dma" reg location instead of separate "dma-tx" and "dma-rx" - Primarily look for "mpu" reg property, but fall back to index 0 if not found - Remove interrupt property from mcasp DT node as it is not used - Remove #address-cells and #size-cells mcasp properties as they are not needed
This set of patches fixes the basic audio support for am335x-evm. It should also be relatively simple to add the necessary nodes to relevant dts files to get BeagleBone + AudioCape and am335x-evmsk working too.
The patch set depends on following patches:
[PATCH v11 4/8] ARM: dts: add AM33XX EDMA support https://lkml.org/lkml/2013/6/18/49
[PATCH v11 5/8] ARM: dts: add AM33XX SPI DMA support https://lkml.org/lkml/2013/6/18/55
[PATCH v2] ARM: EDMA: Fix clearing of unused list for DT DMA resources https://lkml.org/lkml/2013/7/22/441
I have tried my best not to break the existing support for older davinci boards, but since I do not have those boards I can not be sure.
Some commit comments refer to a dmaengine based davinci audio implementation which is planned for but nothing has been done yet.
Best regards, Jyri
Darren Etheridge (1): ARM/dts: am335x-evm: Add audio support for am335x-evm.dts
Hebbar, Gururaja (2): ASoC: davinci-evm: Add device tree binding ASoC: davinci: Add support for AM33xx SoC Audio
Jyri Sarha (7): ASoC: davinci-evm: Move sysclk logic away from evm_hw_params ASoC: davinci-mcasp: Add DMA register locations to DT ASoC: davinci-mcasp: Extract DMA channels directly from DT ASoC: davinci-mcasp: Remove interrupt property from DT bindings doc ASoC: tlv320aic3x: Add regulators to DT bindings document ASoC: tlv320aic3x: Add codec pins to DT bindings document ARM/dts: am33xx: mcasp: Add new dma register location to reg-property
Pantelis Antoniou (1): ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries
.../bindings/sound/davinci-evm-audio.txt | 58 ++++++ .../bindings/sound/davinci-mcasp-audio.txt | 15 +- .../devicetree/bindings/sound/tlv320aic3x.txt | 26 +++ arch/arm/boot/dts/am335x-evm.dts | 56 ++++++ arch/arm/boot/dts/am33xx.dtsi | 25 +++ include/linux/platform_data/davinci_asp.h | 2 + sound/soc/davinci/Kconfig | 18 +- sound/soc/davinci/Makefile | 1 + sound/soc/davinci/davinci-evm.c | 184 +++++++++++++++++--- sound/soc/davinci/davinci-mcasp.c | 106 +++++++---- 10 files changed, 428 insertions(+), 63 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
From: Jyri Sarha jsarha@ti.com
The sysclk rate does not change runtime so it should be initialized at init time.
Signed-off-by: Jyri Sarha jsarha@ti.com --- sound/soc/davinci/davinci-evm.c | 64 +++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 20 deletions(-)
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index fd7c45b..2f8161c 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -27,6 +27,10 @@ #include "davinci-i2s.h" #include "davinci-mcasp.h"
+struct snd_soc_card_drvdata_davinci { + unsigned sysclk; +}; + #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) static int evm_hw_params(struct snd_pcm_substream *substream, @@ -35,27 +39,11 @@ static int evm_hw_params(struct snd_pcm_substream *substream, struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_card *soc_card = codec->card; int ret = 0; - unsigned sysclk; - - /* ASP1 on DM355 EVM is clocked by an external oscillator */ - if (machine_is_davinci_dm355_evm() || machine_is_davinci_dm6467_evm() || - machine_is_davinci_dm365_evm()) - sysclk = 27000000; - - /* ASP0 in DM6446 EVM is clocked by U55, as configured by - * board-dm644x-evm.c using GPIOs from U18. There are six - * options; here we "know" we use a 48 KHz sample rate. - */ - else if (machine_is_davinci_evm()) - sysclk = 12288000; - - else if (machine_is_davinci_da830_evm() || - machine_is_davinci_da850_evm()) - sysclk = 24576000; - - else - return -EINVAL; + unsigned sysclk = ((struct snd_soc_card_drvdata_davinci *) + snd_soc_card_get_drvdata(soc_card))->sysclk;
/* set codec DAI configuration */ ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT); @@ -243,35 +231,65 @@ static struct snd_soc_dai_link da850_evm_dai = { };
/* davinci dm6446 evm audio machine driver */ +/* + * ASP0 in DM6446 EVM is clocked by U55, as configured by + * board-dm644x-evm.c using GPIOs from U18. There are six + * options; here we "know" we use a 48 KHz sample rate. + */ +static struct snd_soc_card_drvdata_davinci dm6446_snd_soc_card_drvdata = { + .sysclk = 12288000, +}; + static struct snd_soc_card dm6446_snd_soc_card_evm = { .name = "DaVinci DM6446 EVM", .owner = THIS_MODULE, .dai_link = &dm6446_evm_dai, .num_links = 1, + .drvdata = &dm6446_snd_soc_card_drvdata, };
/* davinci dm355 evm audio machine driver */ +/* ASP1 on DM355 EVM is clocked by an external oscillator */ +static struct snd_soc_card_drvdata_davinci dm355_snd_soc_card_drvdata = { + .sysclk = 27000000, +}; + static struct snd_soc_card dm355_snd_soc_card_evm = { .name = "DaVinci DM355 EVM", .owner = THIS_MODULE, .dai_link = &dm355_evm_dai, .num_links = 1, + .drvdata = &dm355_snd_soc_card_drvdata, };
/* davinci dm365 evm audio machine driver */ +static struct snd_soc_card_drvdata_davinci dm365_snd_soc_card_drvdata = { + .sysclk = 27000000, +}; + static struct snd_soc_card dm365_snd_soc_card_evm = { .name = "DaVinci DM365 EVM", .owner = THIS_MODULE, .dai_link = &dm365_evm_dai, .num_links = 1, + .drvdata = &dm365_snd_soc_card_drvdata, };
/* davinci dm6467 evm audio machine driver */ +static struct snd_soc_card_drvdata_davinci dm6467_snd_soc_card_drvdata = { + .sysclk = 27000000, +}; + static struct snd_soc_card dm6467_snd_soc_card_evm = { .name = "DaVinci DM6467 EVM", .owner = THIS_MODULE, .dai_link = dm6467_evm_dai, .num_links = ARRAY_SIZE(dm6467_evm_dai), + .drvdata = &dm6467_snd_soc_card_drvdata, +}; + +static struct snd_soc_card_drvdata_davinci da830_snd_soc_card_drvdata = { + .sysclk = 24576000, };
static struct snd_soc_card da830_snd_soc_card = { @@ -279,6 +297,11 @@ static struct snd_soc_card da830_snd_soc_card = { .owner = THIS_MODULE, .dai_link = &da830_evm_dai, .num_links = 1, + .drvdata = &da830_snd_soc_card_drvdata, +}; + +static struct snd_soc_card_drvdata_davinci da850_snd_soc_card_drvdata = { + .sysclk = 24576000, };
static struct snd_soc_card da850_snd_soc_card = { @@ -286,6 +309,7 @@ static struct snd_soc_card da850_snd_soc_card = { .owner = THIS_MODULE, .dai_link = &da850_evm_dai, .num_links = 1, + .drvdata = &da850_snd_soc_card_drvdata, };
static struct platform_device *evm_snd_device;
On Tue, Sep 17, 2013 at 12:26:00PM +0300, jsarha@ti.com wrote:
From: Jyri Sarha jsarha@ti.com
The sysclk rate does not change runtime so it should be initialized at init time.
Applied, thanks.
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
Device tree support for Davinci Machine driver
When the board boots with device tree, the driver will receive card, codec, dai interface details (like the card name, DAPM routing map, phandle for the audio components described in the dts file, codec mclk speed). The card will be set up based on this information. Since the routing is provided via DT we can mark the card fully routed so core can take care of disconnecting the unused pins.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-evm-audio.txt | 58 ++++++++++ sound/soc/davinci/davinci-evm.c | 120 +++++++++++++++++++- 2 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
diff --git a/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt new file mode 100644 index 0000000..e6b61ff --- /dev/null +++ b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt @@ -0,0 +1,58 @@ +* Texas Instruments SoC audio setups with TLV320AIC3X Codec + +Required properties: +- compatible : "ti,da830-evm-audio" : forDM365/DA8xx/OMAPL1x/AM33xx +- ti,model : The user-visible name of this sound complex. +- ti,audio-codec : The phandle of the TLV320AIC3x audio codec +- ti,mcasp-controller : The phandle of the McASP controller +- ti,codec-clock-rate : The Codec Clock rate (in Hz) applied to the Codec +- ti,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 codec's pins, and the jacks on the board: + + TLV320AIC3X pins: + + * LLOUT + * RLOUT + * MONO_LOUT + * HPLOUT + * HPROUT + * HPLCOM + * HPRCOM + * MIC3L + * MIC3R + * LINE1L + * LINE2L + * LINE1R + * LINE2R + + Board connectors: + + * Headphone Jack + * Line Out + * Mic Jack + * Line In + + +Example: + +sound { + compatible = "ti,da830-evm-audio"; + ti,model = "DA830 EVM"; + ti,audio-codec = <&tlv320aic3x>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <12000000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT", + "Line Out", "LLOUT", + "Line Out", "RLOUT", + "MIC3L", "Mic Bias 2V", + "MIC3R", "Mic Bias 2V", + "Mic Bias 2V", "Mic Jack", + "LINE1L", "Line In", + "LINE2L", "Line In", + "LINE1R", "Line In", + "LINE2R", "Line In"; +}; diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 2f8161c..340a68d 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -16,6 +16,7 @@ #include <linux/platform_device.h> #include <linux/platform_data/edma.h> #include <linux/i2c.h> +#include <linux/of_platform.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/soc.h> @@ -23,6 +24,8 @@ #include <asm/dma.h> #include <asm/mach-types.h>
+#include <linux/edma.h> + #include "davinci-pcm.h" #include "davinci-i2s.h" #include "davinci-mcasp.h" @@ -121,13 +124,22 @@ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; + struct device_node *np = codec->card->dev->of_node; + int ret;
/* Add davinci-evm specific widgets */ snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets, ARRAY_SIZE(aic3x_dapm_widgets));
- /* Set up davinci-evm specific audio path audio_map */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); + if (np) { + ret = snd_soc_of_parse_audio_routing(codec->card, + "ti,audio-routing"); + if (ret) + return ret; + } else { + /* Set up davinci-evm specific audio path audio_map */ + snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); + }
/* not connected */ snd_soc_dapm_disable_pin(dapm, "MONO_LOUT"); @@ -312,6 +324,98 @@ static struct snd_soc_card da850_snd_soc_card = { .drvdata = &da850_snd_soc_card_drvdata, };
+#if defined(CONFIG_OF) + +/* + * The struct is used as place holder. It will be completely + * filled with data from dt node. + */ +static struct snd_soc_dai_link evm_dai_tlv320aic3x = { + .name = "TLV320AIC3X", + .stream_name = "AIC3X", + .codec_dai_name = "tlv320aic3x-hifi", + .ops = &evm_ops, + .init = evm_aic3x_init, +}; + +static const struct of_device_id davinci_evm_dt_ids[] = { + { + .compatible = "ti,da830-evm-audio", + .data = (void *) &evm_dai_tlv320aic3x, + }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, davinci_evm_dt_ids); + +/* davinci evm audio machine driver */ +static struct snd_soc_card evm_soc_card = { + .owner = THIS_MODULE, + .num_links = 1, +}; + +static int davinci_evm_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match = + of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev); + struct snd_soc_dai_link *dai = (struct snd_soc_dai_link *) match->data; + struct snd_soc_card_drvdata_davinci *drvdata = NULL; + int ret = 0; + + evm_soc_card.dai_link = dai; + + dai->codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0); + if (!dai->codec_of_node) + return -EINVAL; + + dai->cpu_of_node = of_parse_phandle(np, "ti,mcasp-controller", 0); + if (!dai->cpu_of_node) + return -EINVAL; + + dai->platform_of_node = dai->cpu_of_node; + + evm_soc_card.dev = &pdev->dev; + ret = snd_soc_of_parse_card_name(&evm_soc_card, "ti,model"); + if (ret) + return ret; + + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + ret = of_property_read_u32(np, "ti,codec-clock-rate", &drvdata->sysclk); + if (ret < 0) + return -EINVAL; + + snd_soc_card_set_drvdata(&evm_soc_card, drvdata); + ret = snd_soc_register_card(&evm_soc_card); + + if (ret) + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); + + return ret; +} + +static int davinci_evm_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + + return 0; +} + +static struct platform_driver davinci_evm_driver = { + .probe = davinci_evm_probe, + .remove = davinci_evm_remove, + .driver = { + .name = "davinci_evm", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(davinci_evm_dt_ids), + }, +}; +#endif + static struct platform_device *evm_snd_device;
static int __init evm_init(void) @@ -320,6 +424,13 @@ static int __init evm_init(void) int index; int ret;
+ /* + * If dtb is there, the devices will be created dynamically. + * Only register platfrom driver structure. + */ + if (of_have_populated_dt()) + return platform_driver_register(&davinci_evm_driver); + if (machine_is_davinci_evm()) { evm_snd_dev_data = &dm6446_snd_soc_card_evm; index = 0; @@ -355,6 +466,11 @@ static int __init evm_init(void)
static void __exit evm_exit(void) { + if (of_have_populated_dt()) { + platform_driver_unregister(&davinci_evm_driver); + return; + } + platform_device_unregister(evm_snd_device); }
On Tue, Sep 17, 2013 at 12:26:01PM +0300, jsarha@ti.com wrote:
- TLV320AIC3X pins:
- LLOUT
- RLOUT
- MONO_LOUT
- HPLOUT
- HPROUT
- HPLCOM
- HPRCOM
- MIC3L
- MIC3R
- LINE1L
- LINE2L
- LINE1R
- LINE2R
These should be in the CODEC DT bindings. You should also be CCing the DT maintainers directly, they're a bit overloaded so tend not to read things that only go to the list :/
Otherwise this looks good.
From: Jyri Sarha jsarha@ti.com
This patch adds DMA register location to mcasp DT bindings. On am33xx SoCs the McASP registers are mapped trough L4 interconnect, which is not accessible by the DMA controller, so McASP data port is mapped trough L3 to a different location.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 8 ++- sound/soc/davinci/davinci-mcasp.c | 59 +++++++++++++------- 2 files changed, 46 insertions(+), 21 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 374e145..63b67ae 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -6,7 +6,11 @@ Required properties: "ti,da830-mcasp-audio" : for both DA830 & DA850 platforms "ti,omap2-mcasp-audio" : for OMAP2 platforms (TI81xx, AM33xx)
-- reg : Should contain McASP registers offset and length +- reg : Should contain McASP registers address and length for mpu and + optionally for dma controller access. +- reg-names : The mandatory reg-range must be named "mpu" and the optional DMA + reg-range must be named "dma". For backward compatibility it is + good to keep "mpu" first in the list. - interrupts : Interrupt number for McASP - op-mode : I2S/DIT ops mode. - tdm-slots : Slots for TDM operation. @@ -15,7 +19,6 @@ Required properties: to "num-serializer" parameter. Each entry is a number indication serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX)
- Optional properties:
- ti,hwmods : Must be "mcasp<n>", n is controller instance starting 0 @@ -31,6 +34,7 @@ mcasp0: mcasp0@1d00000 { #address-cells = <1>; #size-cells = <0>; reg = <0x100000 0x3000>; + reg-names "mpu"; interrupts = <82 83>; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>; diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 32ddb7f..a056fc5 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1001,18 +1001,40 @@ static const struct snd_soc_component_driver davinci_mcasp_component = { .name = "davinci-mcasp", };
+/* Some HW specific values and defaults. The rest is filled in from DT. */ +static struct snd_platform_data dm646x_mcasp_pdata = { + .tx_dma_offset = 0x400, + .rx_dma_offset = 0x400, + .asp_chan_q = EVENTQ_0, + .version = MCASP_VERSION_1, +}; + +static struct snd_platform_data da830_mcasp_pdata = { + .tx_dma_offset = 0x2000, + .rx_dma_offset = 0x2000, + .asp_chan_q = EVENTQ_0, + .version = MCASP_VERSION_2, +}; + +static struct snd_platform_data omap2_mcasp_pdata = { + .tx_dma_offset = 0, + .rx_dma_offset = 0, + .asp_chan_q = EVENTQ_0, + .version = MCASP_VERSION_3, +}; + static const struct of_device_id mcasp_dt_ids[] = { { .compatible = "ti,dm646x-mcasp-audio", - .data = (void *)MCASP_VERSION_1, + .data = &dm646x_mcasp_pdata, }, { .compatible = "ti,da830-mcasp-audio", - .data = (void *)MCASP_VERSION_2, + .data = &da830_mcasp_pdata, }, { .compatible = "ti,omap2-mcasp-audio", - .data = (void *)MCASP_VERSION_3, + .data = &omap2_mcasp_pdata, }, { /* sentinel */ } }; @@ -1035,20 +1057,13 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( pdata = pdev->dev.platform_data; return pdata; } else if (match) { - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) { - ret = -ENOMEM; - goto nodata; - } + pdata = (struct snd_platform_data *) match->data; } else { /* control shouldn't reach here. something is wrong */ ret = -EINVAL; goto nodata; }
- if (match->data) - pdata->version = (u8)((int)match->data); - ret = of_property_read_u32(np, "op-mode", &val); if (ret >= 0) pdata->op_mode = val; @@ -1145,10 +1160,15 @@ static int davinci_mcasp_probe(struct platform_device *pdev) return -EINVAL; }
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); if (!mem) { - dev_err(&pdev->dev, "no mem resource?\n"); - return -ENODEV; + dev_warn(dev->dev, + ""mpu" mem resource not found, using index 0\n"); + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!mem) { + dev_err(&pdev->dev, "no mem resource?\n"); + return -ENODEV; + } }
ioarea = devm_request_mem_region(&pdev->dev, mem->start, @@ -1182,13 +1202,16 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dev->rxnumevt = pdata->rxnumevt; dev->dev = &pdev->dev;
+ dma = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma"); + if (!dma) + dma = mem; + dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; dma_data->asp_chan_q = pdata->asp_chan_q; dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->sram_pool = pdata->sram_pool; dma_data->sram_size = pdata->sram_size_playback; - dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset + - mem->start); + dma_data->dma_addr = dma->start + pdata->tx_dma_offset;
/* first TX, then RX */ res = platform_get_resource(pdev, IORESOURCE_DMA, 0); @@ -1205,8 +1228,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->sram_pool = pdata->sram_pool; dma_data->sram_size = pdata->sram_size_capture; - dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + - mem->start); + dma_data->dma_addr = dma->start + pdata->rx_dma_offset;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!res) { @@ -1266,4 +1288,3 @@ module_platform_driver(davinci_mcasp_driver); MODULE_AUTHOR("Steve Chen"); MODULE_DESCRIPTION("TI DAVINCI McASP SoC Interface"); MODULE_LICENSE("GPL"); -
On Tue, Sep 17, 2013 at 12:26:02PM +0300, jsarha@ti.com wrote:
From: Jyri Sarha jsarha@ti.com
This patch adds DMA register location to mcasp DT bindings. On am33xx SoCs the McASP registers are mapped trough L4 interconnect, which is not accessible by the DMA controller, so McASP data port is mapped trough L3 to a different location.
Looks good to me but again you ought to CC the DT maintainers directly.
From: Jyri Sarha jsarha@ti.com
Extract DMA channels directly from DT as they can not be found from platform resources anymore. This is a work-around until davinci audio driver is updated to use dmaengine.
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 5 +++ include/linux/platform_data/davinci_asp.h | 2 + sound/soc/davinci/davinci-mcasp.c | 47 +++++++++++++------- 3 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 63b67ae..68e0f47 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -18,6 +18,11 @@ Required properties: - serial-dir : A list of serializer pin mode. The list number should be equal to "num-serializer" parameter. Each entry is a number indication serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX) +- dmas: two element list of DMA controller phandles and DMA request line + ordered pairs. +- dma-names: identifier string for each DMA request line in the dmas property. + These strings correspond 1:1 with the ordered pairs in dmas. The dma + identifiers must be "rx" and "tx".
Optional properties:
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h index 8db5ae0..689a856 100644 --- a/include/linux/platform_data/davinci_asp.h +++ b/include/linux/platform_data/davinci_asp.h @@ -84,6 +84,8 @@ struct snd_platform_data { u8 version; u8 txnumevt; u8 rxnumevt; + int tx_dma_channel; + int rx_dma_channel; };
enum { diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index a056fc5..acbf5f8 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1047,6 +1047,7 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( struct snd_platform_data *pdata = NULL; const struct of_device_id *match = of_match_device(mcasp_dt_ids, &pdev->dev); + struct of_phandle_args dma_spec;
const u32 *of_serial_dir32; u8 *of_serial_dir; @@ -1109,6 +1110,28 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( pdata->serial_dir = of_serial_dir; }
+ ret = of_property_match_string(np, "dma-names", "tx"); + if (ret < 0) + goto nodata; + + ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret, + &dma_spec); + if (ret < 0) + goto nodata; + + pdata->tx_dma_channel = dma_spec.args[0]; + + ret = of_property_match_string(np, "dma-names", "rx"); + if (ret < 0) + goto nodata; + + ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret, + &dma_spec); + if (ret < 0) + goto nodata; + + pdata->rx_dma_channel = dma_spec.args[0]; + ret = of_property_read_u32(np, "tx-num-evt", &val); if (ret >= 0) pdata->txnumevt = val; @@ -1139,7 +1162,7 @@ nodata: static int davinci_mcasp_probe(struct platform_device *pdev) { struct davinci_pcm_dma_params *dma_data; - struct resource *mem, *ioarea, *res; + struct resource *mem, *ioarea, *res, *dma; struct snd_platform_data *pdata; struct davinci_audio_dev *dev; int ret; @@ -1213,15 +1236,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->sram_size = pdata->sram_size_playback; dma_data->dma_addr = dma->start + pdata->tx_dma_offset;
- /* first TX, then RX */ res = platform_get_resource(pdev, IORESOURCE_DMA, 0); - if (!res) { - dev_err(&pdev->dev, "no DMA resource\n"); - ret = -ENODEV; - goto err_release_clk; - } - - dma_data->channel = res->start; + if (res) + dma_data->channel = res->start; + else + dma_data->channel = pdata->tx_dma_channel;
dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]; dma_data->asp_chan_q = pdata->asp_chan_q; @@ -1231,13 +1250,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->dma_addr = dma->start + pdata->rx_dma_offset;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1); - if (!res) { - dev_err(&pdev->dev, "no DMA resource\n"); - ret = -ENODEV; - goto err_release_clk; - } + if (res) + dma_data->channel = res->start; + else + dma_data->channel = pdata->rx_dma_channel;
- dma_data->channel = res->start; dev_set_drvdata(&pdev->dev, dev); ret = snd_soc_register_component(&pdev->dev, &davinci_mcasp_component, &davinci_mcasp_dai[pdata->op_mode], 1);
On Tue, Sep 17, 2013 at 12:26:03PM +0300, jsarha@ti.com wrote:
From: Jyri Sarha jsarha@ti.com
Extract DMA channels directly from DT as they can not be found from platform resources anymore. This is a work-around until davinci audio driver is updated to use dmaengine.
Looks good to me but again should get the DT maintainers to check out this lot.
From: Jyri Sarha jsarha@ti.com
Davinci McASP driver does use interrupts for anything ATM.
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 2 -- 1 file changed, 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 68e0f47..b5e7b78 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -11,7 +11,6 @@ Required properties: - reg-names : The mandatory reg-range must be named "mpu" and the optional DMA reg-range must be named "dma". For backward compatibility it is good to keep "mpu" first in the list. -- interrupts : Interrupt number for McASP - op-mode : I2S/DIT ops mode. - tdm-slots : Slots for TDM operation. - num-serializer : Serializers used by McASP. @@ -40,7 +39,6 @@ mcasp0: mcasp0@1d00000 { #size-cells = <0>; reg = <0x100000 0x3000>; reg-names "mpu"; - interrupts = <82 83>; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>; num-serializer = <16>;
On Tuesday 17 September 2013 02:56 PM, jsarha@ti.com wrote:
From: Jyri Sarha jsarha@ti.com
Davinci McASP driver does use interrupts for anything ATM.
s/does use/does not use
Signed-off-by: Jyri Sarha jsarha@ti.com
.../bindings/sound/davinci-mcasp-audio.txt | 2 -- 1 file changed, 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 68e0f47..b5e7b78 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -11,7 +11,6 @@ Required properties:
- reg-names : The mandatory reg-range must be named "mpu" and the optional DMA reg-range must be named "dma". For backward compatibility it is good to keep "mpu" first in the list.
-- interrupts : Interrupt number for McASP
- op-mode : I2S/DIT ops mode.
- tdm-slots : Slots for TDM operation.
- num-serializer : Serializers used by McASP.
@@ -40,7 +39,6 @@ mcasp0: mcasp0@1d00000 { #size-cells = <0>; reg = <0x100000 0x3000>; reg-names "mpu";
- interrupts = <82 83>; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>; num-serializer = <16>;
On 09/18/2013 08:50 AM, Gururaja Hebbar wrote:
On Tuesday 17 September 2013 02:56 PM, jsarha@ti.com wrote:
From: Jyri Sarha jsarha@ti.com
Davinci McASP driver does use interrupts for anything ATM.
s/does use/does not use
I'll fix that.
Thanks, Jyri
On Tue, Sep 17, 2013 at 12:26:04PM +0300, jsarha@ti.com wrote:
From: Jyri Sarha jsarha@ti.com
Davinci McASP driver does use interrupts for anything ATM.
How about moving these to optional instead of removing them completely (or just leaving them alone)? That way if the driver does want to start using them people will have hooked them up already so no updates will be required.
On 09/17/2013 12:26 PM, jsarha@ti.com wrote:
From: Jyri Sarha jsarha@ti.com
Davinci McASP driver does use interrupts for anything ATM.
Signed-off-by: Jyri Sarha jsarha@ti.com
Do not remove the interrupts. Even if they are not used they need to be described in DT so in the future if we want we can use them. The DT describes the HW and not the Linux implementation for the HW...
.../bindings/sound/davinci-mcasp-audio.txt | 2 -- 1 file changed, 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 68e0f47..b5e7b78 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -11,7 +11,6 @@ Required properties:
- reg-names : The mandatory reg-range must be named "mpu" and the optional DMA reg-range must be named "dma". For backward compatibility it is good to keep "mpu" first in the list.
-- interrupts : Interrupt number for McASP
- op-mode : I2S/DIT ops mode.
- tdm-slots : Slots for TDM operation.
- num-serializer : Serializers used by McASP.
@@ -40,7 +39,6 @@ mcasp0: mcasp0@1d00000 { #size-cells = <0>; reg = <0x100000 0x3000>; reg-names "mpu";
- interrupts = <82 83>; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>; num-serializer = <16>;
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
AM33xx uses same McASP IP as the Davinci Platform. This patch updates Kconfig and makefile to enable build for McASP, PCM & Codec drivers.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- sound/soc/davinci/Kconfig | 18 +++++++++++++++--- sound/soc/davinci/Makefile | 1 + 2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig index c82f89c..6c8e687 100644 --- a/sound/soc/davinci/Kconfig +++ b/sound/soc/davinci/Kconfig @@ -1,9 +1,10 @@ config SND_DAVINCI_SOC - tristate "SoC Audio for the TI DAVINCI chip" - depends on ARCH_DAVINCI + tristate "SoC Audio for the TI DAVINCI or AM33XX chip" + depends on ARCH_DAVINCI || SOC_AM33XX help + Machine driver for DAVINCI audio. Say Y or M if you want to add support for codecs attached to - the DAVINCI AC97 or I2S interface. You will also need + the DAVINCI AC97, I2S, or McASP interface. You will also need to select the audio interfaces to support below.
config SND_DAVINCI_SOC_I2S @@ -15,6 +16,17 @@ config SND_DAVINCI_SOC_MCASP config SND_DAVINCI_SOC_VCIF tristate
+config SND_AM33XX_SOC_EVM + tristate "SoC Audio for the AM33XX chip based boards" + select SND_DAVINCI_SOC + select SND_SOC_TLV320AIC3X + select SND_DAVINCI_SOC_MCASP + help + Say Y or M if you want to add support for SoC audio on AM33XX + boards using McASP and TLV320AIC3X codec. For example AM335X-EVM, + AM335X-EVMSK, and BeagelBone with AudioCape boards have this + setup. + config SND_DAVINCI_SOC_EVM tristate "SoC Audio support for DaVinci DM6446, DM355 or DM365 EVM" depends on SND_DAVINCI_SOC diff --git a/sound/soc/davinci/Makefile b/sound/soc/davinci/Makefile index a396ab6..bc81e79 100644 --- a/sound/soc/davinci/Makefile +++ b/sound/soc/davinci/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_SND_DAVINCI_SOC_VCIF) += snd-soc-davinci-vcif.o snd-soc-evm-objs := davinci-evm.o
obj-$(CONFIG_SND_DAVINCI_SOC_EVM) += snd-soc-evm.o +obj-$(CONFIG_SND_AM33XX_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DM6467_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DA830_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DA850_SOC_EVM) += snd-soc-evm.o
On Tue, Sep 17, 2013 at 12:26:05PM +0300, jsarha@ti.com wrote:
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
AM33xx uses same McASP IP as the Davinci Platform. This patch updates Kconfig and makefile to enable build for McASP, PCM & Codec drivers.
Applied, thanks.
On Wed, Sep 18, 2013 at 03:47:23PM +0100, Mark Brown wrote:
On Tue, Sep 17, 2013 at 12:26:05PM +0300, jsarha@ti.com wrote:
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
AM33xx uses same McASP IP as the Davinci Platform. This patch updates Kconfig and makefile to enable build for McASP, PCM & Codec drivers.
Applied, thanks.
Dropped since this breaks x86 builds due to dma_alloc_writecombine() not being defined (our DMA APIs really aren't wonderful...).
On 09/18/2013 09:09 PM, Mark Brown wrote:
On Wed, Sep 18, 2013 at 03:47:23PM +0100, Mark Brown wrote:
On Tue, Sep 17, 2013 at 12:26:05PM +0300, jsarha@ti.com wrote:
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
AM33xx uses same McASP IP as the Davinci Platform. This patch updates Kconfig and makefile to enable build for McASP, PCM & Codec drivers.
Applied, thanks.
Dropped since this breaks x86 builds due to dma_alloc_writecombine() not being defined (our DMA APIs really aren't wonderful...).
I added SOC_AM33XX-dependency to SND_AM33XX_SOC_EVM config and it appears to fix at least the "warning: (SND_AM33XX_SOC_EVM) selects ..."-problem. I'll send an updated patch series (this time with maintainers in CC) shortly after/if my
% make ARCH=x86_64 allmodconfig && make -j 4
finishes without errors. Sorry for not testing that myself first time around.
Best regards, Jyri
On 09/17/2013 12:26 PM, jsarha@ti.com wrote:
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
AM33xx uses same McASP IP as the Davinci Platform. This patch updates Kconfig and makefile to enable build for McASP, PCM & Codec drivers.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com
sound/soc/davinci/Kconfig | 18 +++++++++++++++--- sound/soc/davinci/Makefile | 1 + 2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig index c82f89c..6c8e687 100644 --- a/sound/soc/davinci/Kconfig +++ b/sound/soc/davinci/Kconfig @@ -1,9 +1,10 @@ config SND_DAVINCI_SOC
- tristate "SoC Audio for the TI DAVINCI chip"
- depends on ARCH_DAVINCI
- tristate "SoC Audio for the TI DAVINCI or AM33XX chip"
- depends on ARCH_DAVINCI || SOC_AM33XX help
Machine driver for DAVINCI audio.
Should be: + Platform driver for daVinci or AM33xx
But I would just remove the help section as such, the prompt gives enough information what is this.
Say Y or M if you want to add support for codecs attached to
the DAVINCI AC97 or I2S interface. You will also need
to select the audio interfaces to support below.the DAVINCI AC97, I2S, or McASP interface. You will also need
config SND_DAVINCI_SOC_I2S @@ -15,6 +16,17 @@ config SND_DAVINCI_SOC_MCASP config SND_DAVINCI_SOC_VCIF tristate
+config SND_AM33XX_SOC_EVM
- tristate "SoC Audio for the AM33XX chip based boards"
+ depneds on SND_DAVINCI_SOC && SOC_AM33XX
- select SND_DAVINCI_SOC
Do not select the platform support from here.
- select SND_SOC_TLV320AIC3X
- select SND_DAVINCI_SOC_MCASP
- help
Say Y or M if you want to add support for SoC audio on AM33XX
boards using McASP and TLV320AIC3X codec. For example AM335X-EVM,
AM335X-EVMSK, and BeagelBone with AudioCape boards have this
setup.
config SND_DAVINCI_SOC_EVM tristate "SoC Audio support for DaVinci DM6446, DM355 or DM365 EVM" depends on SND_DAVINCI_SOC diff --git a/sound/soc/davinci/Makefile b/sound/soc/davinci/Makefile index a396ab6..bc81e79 100644 --- a/sound/soc/davinci/Makefile +++ b/sound/soc/davinci/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_SND_DAVINCI_SOC_VCIF) += snd-soc-davinci-vcif.o snd-soc-evm-objs := davinci-evm.o
obj-$(CONFIG_SND_DAVINCI_SOC_EVM) += snd-soc-evm.o +obj-$(CONFIG_SND_AM33XX_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DM6467_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DA830_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DA850_SOC_EVM) += snd-soc-evm.o
From: Jyri Sarha jsarha@ti.com
Add regulator properties to tlv320aic3x DT bindings document.
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../devicetree/bindings/sound/tlv320aic3x.txt | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt index f47c3f5..11e24b2 100644 --- a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt +++ b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt @@ -17,10 +17,17 @@ Optional properties: 3 - MICBIAS output is connected to AVDD, If this node is not mentioned or if the value is incorrect, then MicBias is powered down. +- AVDD-supply, IOVDD-supply, DRVDD-supply, DVDD-supply : power supplies for the + device as covered in Documentation/devicetree/bindings/regulator/regulator.txt
Example:
tlv320aic3x: tlv320aic3x@1b { compatible = "ti,tlv320aic3x"; reg = <0x1b>; + + AVDD-supply = <®ulator>; + IOVDD-supply = <®ulator>; + DRVDD-supply = <®ulator>; + DVDD-supply = <®ulator>; };
On Tue, Sep 17, 2013 at 12:26:06PM +0300, jsarha@ti.com wrote:
From: Jyri Sarha jsarha@ti.com
Add regulator properties to tlv320aic3x DT bindings document.
Applied, thanks.
From: Jyri Sarha jsarha@ti.com
Add list of codec pins to tlv320aic3x DT bindings document.
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../devicetree/bindings/sound/tlv320aic3x.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt index 11e24b2..2b76c81 100644 --- a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt +++ b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt @@ -20,6 +20,25 @@ Optional properties: - AVDD-supply, IOVDD-supply, DRVDD-supply, DVDD-supply : power supplies for the device as covered in Documentation/devicetree/bindings/regulator/regulator.txt
+CODEC output pins: + * LLOUT + * RLOUT + * MONO_LOUT + * HPLOUT + * HPROUT + * HPLCOM + * HPRCOM + +CODEC input pins: + * MIC3L + * MIC3R + * LINE1L + * LINE2L + * LINE1R + * LINE2R + +The pins can be used in referring sound node's audio-routing property. + Example:
tlv320aic3x: tlv320aic3x@1b {
On Tue, Sep 17, 2013 at 12:26:07PM +0300, jsarha@ti.com wrote:
From: Jyri Sarha jsarha@ti.com
Add list of codec pins to tlv320aic3x DT bindings document.
Applied, thanks.
From: Pantelis Antoniou panto@antoniou-consulting.com
Add missing mcasp entries in the am33xx.dtsi include file.
Signed-off-by: Pantelis Antoniou panto@antoniou-consulting.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am33xx.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 0fdb949..bba302a 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -552,5 +552,20 @@ #size-cells = <1>; status = "disabled"; }; + + mcasp0: mcasp@48038000 { + compatible = "ti,omap2-mcasp-audio"; + ti,hwmods = "mcasp0"; + reg = <0x48038000 0x2000>; + status = "disabled"; + }; + + mcasp1: mcasp@4803C000 { + compatible = "ti,omap2-mcasp-audio"; + ti,hwmods = "mcasp1"; + reg = <0x4803C000 0x2000>; + status = "disabled"; + }; + }; };
From: Jyri Sarha jsarha@ti.com
This patch adds an optional address range to reg property. The range describes the register location for DMA controller on am33xx. The both address ranges are named accordingly in the reg-names property.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am33xx.dtsi | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index bba302a..07e69e8 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -556,15 +556,25 @@ mcasp0: mcasp@48038000 { compatible = "ti,omap2-mcasp-audio"; ti,hwmods = "mcasp0"; - reg = <0x48038000 0x2000>; + reg = <0x48038000 0x2000>, + <0x46400000 0x400000>; + reg-names = "mpu", "dma"; status = "disabled"; + dmas = <&edma 8 + &edma 9>; + dma-names = "tx", "rx"; };
mcasp1: mcasp@4803C000 { compatible = "ti,omap2-mcasp-audio"; ti,hwmods = "mcasp1"; - reg = <0x4803C000 0x2000>; + reg = <0x4803C000 0x2000>, + <0x46400000 0x400000>; + reg-names = "mpu", "dma"; status = "disabled"; + dmas = <&edma 10 + &edma 11>; + dma-names = "tx", "rx"; };
};
From: Darren Etheridge detheridge@ti.com
Adds sound, tlv320aic3x, mcasp1, and am335x_evm_audio_pin nodes.
Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am335x-evm.dts | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index 3aee1a4..4a49229 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts @@ -149,6 +149,16 @@ 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7) >; }; + + am335x_evm_audio_pins: am335x_evm_audio_pins { + pinctrl-single,pins = < + 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rx_dv.mcasp1_aclkx */ + 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_txd3.mcasp1_fsx */ + 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */ + 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */ + >; + }; + };
ocp { @@ -215,6 +225,19 @@ compatible = "ti,tmp275"; reg = <0x48>; }; + + tlv320aic3x: tlv320aic3x@1b { + compatible = "ti,tlv320aic3x"; + reg = <0x1b>; + status = "okay"; + + /* Regulators */ + AVDD-supply = <&vaux2_reg>; + IOVDD-supply = <&vaux2_reg>; + DRVDD-supply = <&vaux2_reg>; + DVDD-supply = <&vbat>; + }; + };
elm: elm@48080000 { @@ -311,6 +334,20 @@ }; }; }; + + sound { + compatible = "ti,da830-evm-audio"; + ti,model = "DA830 EVM"; + ti,audio-codec = <&tlv320aic3x>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <12000000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT", + "LINE1L", "Line In", + "LINE1R", "Line In"; + }; + };
vbat: fixedregulator@0 { @@ -378,6 +415,25 @@
#include "tps65910.dtsi"
+&mcasp1 { + pinctrl-names = "default"; + pinctrl-0 = <&am335x_evm_audio_pins>; + + status = "okay"; + + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + num-serializer = <16>; + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 0 0 1 2 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + >; + tx-num-evt = <1>; + rx-num-evt = <1>; +}; + &tps { vcc1-supply = <&vbat>; vcc2-supply = <&vbat>;
On Tue, Sep 17, 2013 at 12:25:59PM +0300, jsarha@ti.com wrote:
From: Jyri Sarha jsarha@ti.com
The first version of patches can been found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066178.h...
Please remember to always CC maintainers on patches.
On 09/18/2013 12:42 PM, Mark Brown wrote:
Please remember to always CC maintainers on patches.
Oops, sorry. Too long CC-list to handle.
So far I've received one typo fix comment. Guess I could fix that, rebase to v3.12-rc1 and push v3 patch set. This time putting you in CC too.
Best regards, Jyri
On Wed, Sep 18, 2013 at 12:56:07PM +0300, Jyri Sarha wrote:
So far I've received one typo fix comment. Guess I could fix that, rebase to v3.12-rc1 and push v3 patch set. This time putting you in CC too.
Well, I also applied one of the patches. I was going to go through this set but if you want to rebase onto v3.12-rc1 that'd be good.
On 09/18/2013 01:18 PM, Mark Brown wrote:
On Wed, Sep 18, 2013 at 12:56:07PM +0300, Jyri Sarha wrote:
So far I've received one typo fix comment. Guess I could fix that, rebase to v3.12-rc1 and push v3 patch set. This time putting you in CC too.
Well, I also applied one of the patches. I was going to go through this set but if you want to rebase onto v3.12-rc1 that'd be good.
There were no conflicts and everything worked out of the box, so rebasing does not make much difference. If you are ready to check the patches v2 now, please do so. I'll wait for your comments before pushing v3 set of patches out.
On Wed, Sep 18, 2013 at 01:27:26PM +0300, Jyri Sarha wrote:
There were no conflicts and everything worked out of the box, so rebasing does not make much difference. If you are ready to check the patches v2 now, please do so. I'll wait for your comments before pushing v3 set of patches out.
OK, it'll be later today or perhaps tomorrow before I'm able to do this.
On 09/18/2013 01:40 PM, Mark Brown wrote:
On Wed, Sep 18, 2013 at 01:27:26PM +0300, Jyri Sarha wrote:
There were no conflicts and everything worked out of the box, so rebasing does not make much difference. If you are ready to check the patches v2 now, please do so. I'll wait for your comments before pushing v3 set of patches out.
OK, it'll be later today or perhaps tomorrow before I'm able to do this.
That would be great!
Best regards, Jyri
The RFC version of patches can been found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066178.h... The v2 version of patches can be found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066379.h...
Changes since v2 [PATCH v2 01/11] ASoC: davinci-evm: Move sysclk logic away from evm_hw_params - no change [PATCH v2 02/11] ASoC: davinci-evm: Add device tree binding - no change [PATCH v2 03/11] ASoC: davinci-mcasp: Add DMA register locations to DT - no change [PATCH v2 04/11] ASoC: davinci-mcasp: Extract DMA channels directly from DT - no change [PATCH v2 05/11] ASoC: davinci-mcasp: Remove interrupt property from DT bindin - restore binding but make it optional and add interrupt-names property [PATCH v2 06/11] ASoC: davinci: Add support for AM33xx SoC Audio - SND_DAVINCI_SOC help "Machine driver for ..." -> "Platform driver for ..." - SND_AM33XX_SOC_EVM depends on SND_DAVINCI_SOC && SOC_AM33XX - SND_AM33XX_SOC_EVM does not selcet SND_DAVINCI_SOC [PATCH v2 07/11] ASoC: tlv320aic3x: Add regulators to DT bindings document - no change [PATCH v2 08/11] ASoC: tlv320aic3x: Add codec pins to DT bindings document - no change [PATCH v2 09/11] ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries - restore interrupt property and add interrupt-names property [PATCH v2 10/11] ARM/dts: am33xx: mcasp: Add new dma register location to reg-property - no change [PATCH v2 11/11] ARM/dts: am335x-evm: Add audio support for am335x-evm.dts - no change
Changes from RFC to v2 - Dropped out "ASoC: davinci-mcasp: Add pinctrl support" since driver core is taking care of this now. - Cleanup am33xx audio build - Add regulators to tlv320aic3x DT binding document - Remove dm365-voice-codec-audio DT support as it has never been tested an probably does not work - Add output pins and Line In connector to davinci-evm-audio DT binding doc - Remove asp_chan_q and ram_chan_q properties from mcasp DT node in DT mode mcasp is hardcoded to event queue 0 (highest priority) - Add pins to tlv320aic3x DT bindings document. If I misunderstood Marks comment and this patch is not needed, then just leave it out Changes based on TI internal discussions - Move system clock rate logic away from from evm_hw_params soc-op - Remove unnecesary #if defined(CONFIG_OF) from davinci-evm.c - Make dma property DT binding document more exact - Add only "dma" reg location instead of separate "dma-tx" and "dma-rx" - Primarily look for "mpu" reg property, but fall back to index 0 if not found - Remove interrupt property from mcasp DT node as it is not used - Remove #address-cells and #size-cells mcasp properties as they are not needed
This set of patches fixes the basic audio support for am335x-evm. It should also be relatively simple to add the necessary nodes to relevant dts files to get BeagleBone + AudioCape and am335x-evmsk working too.
The patch set depends on following patches:
[PATCH v11 4/8] ARM: dts: add AM33XX EDMA support https://lkml.org/lkml/2013/6/18/49
[PATCH v11 5/8] ARM: dts: add AM33XX SPI DMA support https://lkml.org/lkml/2013/6/18/55
[PATCH v2] ARM: EDMA: Fix clearing of unused list for DT DMA resources https://lkml.org/lkml/2013/7/22/441
I have tried my best not to break the existing support for older davinci boards, but since I do not have those boards I can not be sure.
Some commit comments refer to a dmaengine based davinci audio implementation which is planned for but nothing has been done yet.
Best regards, Jyri
Darren Etheridge (1): ARM/dts: am335x-evm: Add audio support for am335x-evm.dts
Hebbar, Gururaja (2): ASoC: davinci-evm: Add device tree binding ASoC: davinci: Add support for AM33xx SoC Audio
Jyri Sarha (7): ASoC: davinci-evm: Move sysclk logic away from evm_hw_params ASoC: davinci-mcasp: Add DMA register locations to DT ASoC: davinci-mcasp: Extract DMA channels directly from DT ASoC: davinci-mcasp: Interrupts property to optional and add interrupt-names ASoC: tlv320aic3x: Add regulators to DT bindings document ASoC: tlv320aic3x: Add codec pins to DT bindings document ARM/dts: am33xx: mcasp: Add new dma register location to reg-property
Pantelis Antoniou (1): ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries
.../bindings/sound/davinci-evm-audio.txt | 58 ++++++ .../bindings/sound/davinci-mcasp-audio.txt | 17 +- .../devicetree/bindings/sound/tlv320aic3x.txt | 26 +++ arch/arm/boot/dts/am335x-evm.dts | 56 ++++++ arch/arm/boot/dts/am33xx.dtsi | 29 +++ include/linux/platform_data/davinci_asp.h | 2 + sound/soc/davinci/Kconfig | 18 +- sound/soc/davinci/Makefile | 1 + sound/soc/davinci/davinci-evm.c | 184 +++++++++++++++++--- sound/soc/davinci/davinci-mcasp.c | 106 +++++++---- 10 files changed, 435 insertions(+), 62 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
The sysclk rate does not change runtime so it should be initialized at init time.
Signed-off-by: Jyri Sarha jsarha@ti.com --- sound/soc/davinci/davinci-evm.c | 64 +++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 20 deletions(-)
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index fd7c45b..2f8161c 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -27,6 +27,10 @@ #include "davinci-i2s.h" #include "davinci-mcasp.h"
+struct snd_soc_card_drvdata_davinci { + unsigned sysclk; +}; + #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) static int evm_hw_params(struct snd_pcm_substream *substream, @@ -35,27 +39,11 @@ static int evm_hw_params(struct snd_pcm_substream *substream, struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_card *soc_card = codec->card; int ret = 0; - unsigned sysclk; - - /* ASP1 on DM355 EVM is clocked by an external oscillator */ - if (machine_is_davinci_dm355_evm() || machine_is_davinci_dm6467_evm() || - machine_is_davinci_dm365_evm()) - sysclk = 27000000; - - /* ASP0 in DM6446 EVM is clocked by U55, as configured by - * board-dm644x-evm.c using GPIOs from U18. There are six - * options; here we "know" we use a 48 KHz sample rate. - */ - else if (machine_is_davinci_evm()) - sysclk = 12288000; - - else if (machine_is_davinci_da830_evm() || - machine_is_davinci_da850_evm()) - sysclk = 24576000; - - else - return -EINVAL; + unsigned sysclk = ((struct snd_soc_card_drvdata_davinci *) + snd_soc_card_get_drvdata(soc_card))->sysclk;
/* set codec DAI configuration */ ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT); @@ -243,35 +231,65 @@ static struct snd_soc_dai_link da850_evm_dai = { };
/* davinci dm6446 evm audio machine driver */ +/* + * ASP0 in DM6446 EVM is clocked by U55, as configured by + * board-dm644x-evm.c using GPIOs from U18. There are six + * options; here we "know" we use a 48 KHz sample rate. + */ +static struct snd_soc_card_drvdata_davinci dm6446_snd_soc_card_drvdata = { + .sysclk = 12288000, +}; + static struct snd_soc_card dm6446_snd_soc_card_evm = { .name = "DaVinci DM6446 EVM", .owner = THIS_MODULE, .dai_link = &dm6446_evm_dai, .num_links = 1, + .drvdata = &dm6446_snd_soc_card_drvdata, };
/* davinci dm355 evm audio machine driver */ +/* ASP1 on DM355 EVM is clocked by an external oscillator */ +static struct snd_soc_card_drvdata_davinci dm355_snd_soc_card_drvdata = { + .sysclk = 27000000, +}; + static struct snd_soc_card dm355_snd_soc_card_evm = { .name = "DaVinci DM355 EVM", .owner = THIS_MODULE, .dai_link = &dm355_evm_dai, .num_links = 1, + .drvdata = &dm355_snd_soc_card_drvdata, };
/* davinci dm365 evm audio machine driver */ +static struct snd_soc_card_drvdata_davinci dm365_snd_soc_card_drvdata = { + .sysclk = 27000000, +}; + static struct snd_soc_card dm365_snd_soc_card_evm = { .name = "DaVinci DM365 EVM", .owner = THIS_MODULE, .dai_link = &dm365_evm_dai, .num_links = 1, + .drvdata = &dm365_snd_soc_card_drvdata, };
/* davinci dm6467 evm audio machine driver */ +static struct snd_soc_card_drvdata_davinci dm6467_snd_soc_card_drvdata = { + .sysclk = 27000000, +}; + static struct snd_soc_card dm6467_snd_soc_card_evm = { .name = "DaVinci DM6467 EVM", .owner = THIS_MODULE, .dai_link = dm6467_evm_dai, .num_links = ARRAY_SIZE(dm6467_evm_dai), + .drvdata = &dm6467_snd_soc_card_drvdata, +}; + +static struct snd_soc_card_drvdata_davinci da830_snd_soc_card_drvdata = { + .sysclk = 24576000, };
static struct snd_soc_card da830_snd_soc_card = { @@ -279,6 +297,11 @@ static struct snd_soc_card da830_snd_soc_card = { .owner = THIS_MODULE, .dai_link = &da830_evm_dai, .num_links = 1, + .drvdata = &da830_snd_soc_card_drvdata, +}; + +static struct snd_soc_card_drvdata_davinci da850_snd_soc_card_drvdata = { + .sysclk = 24576000, };
static struct snd_soc_card da850_snd_soc_card = { @@ -286,6 +309,7 @@ static struct snd_soc_card da850_snd_soc_card = { .owner = THIS_MODULE, .dai_link = &da850_evm_dai, .num_links = 1, + .drvdata = &da850_snd_soc_card_drvdata, };
static struct platform_device *evm_snd_device;
On Thu, Sep 19, 2013 at 02:29:34PM +0300, Jyri Sarha wrote:
The sysclk rate does not change runtime so it should be initialized at init time.
Are there any updates from the version already applied (I only dropped the patch to allow the extra builds, not this one).
As I described in cover letter on these patches did change:
[PATCH v2 05/11] ASoC: davinci-mcasp: Remove interrupt property from DT bindin - restore binding but make it optional and add interrupt-names property [PATCH v2 06/11] ASoC: davinci: Add support for AM33xx SoC Audio - SND_DAVINCI_SOC help "Machine driver for ..." -> "Platform driver for ..." - SND_AM33XX_SOC_EVM depends on SND_DAVINCI_SOC && SOC_AM33XX - SND_AM33XX_SOC_EVM does not selcet SND_DAVINCI_SOC [PATCH v2 09/11] ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries - restore interrupt property and add interrupt-names property----
Best regards, Jyri
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
________________________________________ From: Mark Brown [broonie@kernel.org] Sent: Thursday, September 19, 2013 4:23 PM To: Sarha, Jyri Cc: alsa-devel@alsa-project.org; devicetree@vger.kernel.org; linux-omap@vger.kernel.org; Ujfalusi, Peter; liam.r.girdwood@linux.intel.com; grant.likely@linaro.org; rob.herring@calxeda.com; Fernandes, Joel Subject: Re: [PATCH v3 01/11] ASoC: davinci-evm: Move sysclk logic away from evm_hw_params
On Thu, Sep 19, 2013 at 02:29:34PM +0300, Jyri Sarha wrote:
The sysclk rate does not change runtime so it should be initialized at init time.
Are there any updates from the version already applied (I only dropped the patch to allow the extra builds, not this one).
On Thu, Sep 26, 2013 at 10:18:26PM +0300, Jyri Sarha wrote:
The sysclk rate does not change runtime so it should be initialized at init time.
If you want the DT maintainers to review this stuff you probably need to send it to them rather than spam the ASoC maintainers again.
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
Device tree support for Davinci Machine driver
When the board boots with device tree, the driver will receive card, codec, dai interface details (like the card name, DAPM routing map, phandle for the audio components described in the dts file, codec mclk speed). The card will be set up based on this information. Since the routing is provided via DT we can mark the card fully routed so core can take care of disconnecting the unused pins.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-evm-audio.txt | 58 ++++++++++ sound/soc/davinci/davinci-evm.c | 120 +++++++++++++++++++- 2 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
diff --git a/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt new file mode 100644 index 0000000..e6b61ff --- /dev/null +++ b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt @@ -0,0 +1,58 @@ +* Texas Instruments SoC audio setups with TLV320AIC3X Codec + +Required properties: +- compatible : "ti,da830-evm-audio" : forDM365/DA8xx/OMAPL1x/AM33xx +- ti,model : The user-visible name of this sound complex. +- ti,audio-codec : The phandle of the TLV320AIC3x audio codec +- ti,mcasp-controller : The phandle of the McASP controller +- ti,codec-clock-rate : The Codec Clock rate (in Hz) applied to the Codec +- ti,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 codec's pins, and the jacks on the board: + + TLV320AIC3X pins: + + * LLOUT + * RLOUT + * MONO_LOUT + * HPLOUT + * HPROUT + * HPLCOM + * HPRCOM + * MIC3L + * MIC3R + * LINE1L + * LINE2L + * LINE1R + * LINE2R + + Board connectors: + + * Headphone Jack + * Line Out + * Mic Jack + * Line In + + +Example: + +sound { + compatible = "ti,da830-evm-audio"; + ti,model = "DA830 EVM"; + ti,audio-codec = <&tlv320aic3x>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <12000000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT", + "Line Out", "LLOUT", + "Line Out", "RLOUT", + "MIC3L", "Mic Bias 2V", + "MIC3R", "Mic Bias 2V", + "Mic Bias 2V", "Mic Jack", + "LINE1L", "Line In", + "LINE2L", "Line In", + "LINE1R", "Line In", + "LINE2R", "Line In"; +}; diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 2f8161c..340a68d 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -16,6 +16,7 @@ #include <linux/platform_device.h> #include <linux/platform_data/edma.h> #include <linux/i2c.h> +#include <linux/of_platform.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/soc.h> @@ -23,6 +24,8 @@ #include <asm/dma.h> #include <asm/mach-types.h>
+#include <linux/edma.h> + #include "davinci-pcm.h" #include "davinci-i2s.h" #include "davinci-mcasp.h" @@ -121,13 +124,22 @@ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; + struct device_node *np = codec->card->dev->of_node; + int ret;
/* Add davinci-evm specific widgets */ snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets, ARRAY_SIZE(aic3x_dapm_widgets));
- /* Set up davinci-evm specific audio path audio_map */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); + if (np) { + ret = snd_soc_of_parse_audio_routing(codec->card, + "ti,audio-routing"); + if (ret) + return ret; + } else { + /* Set up davinci-evm specific audio path audio_map */ + snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); + }
/* not connected */ snd_soc_dapm_disable_pin(dapm, "MONO_LOUT"); @@ -312,6 +324,98 @@ static struct snd_soc_card da850_snd_soc_card = { .drvdata = &da850_snd_soc_card_drvdata, };
+#if defined(CONFIG_OF) + +/* + * The struct is used as place holder. It will be completely + * filled with data from dt node. + */ +static struct snd_soc_dai_link evm_dai_tlv320aic3x = { + .name = "TLV320AIC3X", + .stream_name = "AIC3X", + .codec_dai_name = "tlv320aic3x-hifi", + .ops = &evm_ops, + .init = evm_aic3x_init, +}; + +static const struct of_device_id davinci_evm_dt_ids[] = { + { + .compatible = "ti,da830-evm-audio", + .data = (void *) &evm_dai_tlv320aic3x, + }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, davinci_evm_dt_ids); + +/* davinci evm audio machine driver */ +static struct snd_soc_card evm_soc_card = { + .owner = THIS_MODULE, + .num_links = 1, +}; + +static int davinci_evm_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match = + of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev); + struct snd_soc_dai_link *dai = (struct snd_soc_dai_link *) match->data; + struct snd_soc_card_drvdata_davinci *drvdata = NULL; + int ret = 0; + + evm_soc_card.dai_link = dai; + + dai->codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0); + if (!dai->codec_of_node) + return -EINVAL; + + dai->cpu_of_node = of_parse_phandle(np, "ti,mcasp-controller", 0); + if (!dai->cpu_of_node) + return -EINVAL; + + dai->platform_of_node = dai->cpu_of_node; + + evm_soc_card.dev = &pdev->dev; + ret = snd_soc_of_parse_card_name(&evm_soc_card, "ti,model"); + if (ret) + return ret; + + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + ret = of_property_read_u32(np, "ti,codec-clock-rate", &drvdata->sysclk); + if (ret < 0) + return -EINVAL; + + snd_soc_card_set_drvdata(&evm_soc_card, drvdata); + ret = snd_soc_register_card(&evm_soc_card); + + if (ret) + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); + + return ret; +} + +static int davinci_evm_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + + return 0; +} + +static struct platform_driver davinci_evm_driver = { + .probe = davinci_evm_probe, + .remove = davinci_evm_remove, + .driver = { + .name = "davinci_evm", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(davinci_evm_dt_ids), + }, +}; +#endif + static struct platform_device *evm_snd_device;
static int __init evm_init(void) @@ -320,6 +424,13 @@ static int __init evm_init(void) int index; int ret;
+ /* + * If dtb is there, the devices will be created dynamically. + * Only register platfrom driver structure. + */ + if (of_have_populated_dt()) + return platform_driver_register(&davinci_evm_driver); + if (machine_is_davinci_evm()) { evm_snd_dev_data = &dm6446_snd_soc_card_evm; index = 0; @@ -355,6 +466,11 @@ static int __init evm_init(void)
static void __exit evm_exit(void) { + if (of_have_populated_dt()) { + platform_driver_unregister(&davinci_evm_driver); + return; + } + platform_device_unregister(evm_snd_device); }
This patch adds DMA register location to mcasp DT bindings. On am33xx SoCs the McASP registers are mapped trough L4 interconnect, which is not accessible by the DMA controller, so McASP data port is mapped trough L3 to a different location.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 8 ++- sound/soc/davinci/davinci-mcasp.c | 59 +++++++++++++------- 2 files changed, 46 insertions(+), 21 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 374e145..63b67ae 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -6,7 +6,11 @@ Required properties: "ti,da830-mcasp-audio" : for both DA830 & DA850 platforms "ti,omap2-mcasp-audio" : for OMAP2 platforms (TI81xx, AM33xx)
-- reg : Should contain McASP registers offset and length +- reg : Should contain McASP registers address and length for mpu and + optionally for dma controller access. +- reg-names : The mandatory reg-range must be named "mpu" and the optional DMA + reg-range must be named "dma". For backward compatibility it is + good to keep "mpu" first in the list. - interrupts : Interrupt number for McASP - op-mode : I2S/DIT ops mode. - tdm-slots : Slots for TDM operation. @@ -15,7 +19,6 @@ Required properties: to "num-serializer" parameter. Each entry is a number indication serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX)
- Optional properties:
- ti,hwmods : Must be "mcasp<n>", n is controller instance starting 0 @@ -31,6 +34,7 @@ mcasp0: mcasp0@1d00000 { #address-cells = <1>; #size-cells = <0>; reg = <0x100000 0x3000>; + reg-names "mpu"; interrupts = <82 83>; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>; diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 32ddb7f..a056fc5 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1001,18 +1001,40 @@ static const struct snd_soc_component_driver davinci_mcasp_component = { .name = "davinci-mcasp", };
+/* Some HW specific values and defaults. The rest is filled in from DT. */ +static struct snd_platform_data dm646x_mcasp_pdata = { + .tx_dma_offset = 0x400, + .rx_dma_offset = 0x400, + .asp_chan_q = EVENTQ_0, + .version = MCASP_VERSION_1, +}; + +static struct snd_platform_data da830_mcasp_pdata = { + .tx_dma_offset = 0x2000, + .rx_dma_offset = 0x2000, + .asp_chan_q = EVENTQ_0, + .version = MCASP_VERSION_2, +}; + +static struct snd_platform_data omap2_mcasp_pdata = { + .tx_dma_offset = 0, + .rx_dma_offset = 0, + .asp_chan_q = EVENTQ_0, + .version = MCASP_VERSION_3, +}; + static const struct of_device_id mcasp_dt_ids[] = { { .compatible = "ti,dm646x-mcasp-audio", - .data = (void *)MCASP_VERSION_1, + .data = &dm646x_mcasp_pdata, }, { .compatible = "ti,da830-mcasp-audio", - .data = (void *)MCASP_VERSION_2, + .data = &da830_mcasp_pdata, }, { .compatible = "ti,omap2-mcasp-audio", - .data = (void *)MCASP_VERSION_3, + .data = &omap2_mcasp_pdata, }, { /* sentinel */ } }; @@ -1035,20 +1057,13 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( pdata = pdev->dev.platform_data; return pdata; } else if (match) { - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) { - ret = -ENOMEM; - goto nodata; - } + pdata = (struct snd_platform_data *) match->data; } else { /* control shouldn't reach here. something is wrong */ ret = -EINVAL; goto nodata; }
- if (match->data) - pdata->version = (u8)((int)match->data); - ret = of_property_read_u32(np, "op-mode", &val); if (ret >= 0) pdata->op_mode = val; @@ -1145,10 +1160,15 @@ static int davinci_mcasp_probe(struct platform_device *pdev) return -EINVAL; }
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); if (!mem) { - dev_err(&pdev->dev, "no mem resource?\n"); - return -ENODEV; + dev_warn(dev->dev, + ""mpu" mem resource not found, using index 0\n"); + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!mem) { + dev_err(&pdev->dev, "no mem resource?\n"); + return -ENODEV; + } }
ioarea = devm_request_mem_region(&pdev->dev, mem->start, @@ -1182,13 +1202,16 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dev->rxnumevt = pdata->rxnumevt; dev->dev = &pdev->dev;
+ dma = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma"); + if (!dma) + dma = mem; + dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; dma_data->asp_chan_q = pdata->asp_chan_q; dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->sram_pool = pdata->sram_pool; dma_data->sram_size = pdata->sram_size_playback; - dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset + - mem->start); + dma_data->dma_addr = dma->start + pdata->tx_dma_offset;
/* first TX, then RX */ res = platform_get_resource(pdev, IORESOURCE_DMA, 0); @@ -1205,8 +1228,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->sram_pool = pdata->sram_pool; dma_data->sram_size = pdata->sram_size_capture; - dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + - mem->start); + dma_data->dma_addr = dma->start + pdata->rx_dma_offset;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!res) { @@ -1266,4 +1288,3 @@ module_platform_driver(davinci_mcasp_driver); MODULE_AUTHOR("Steve Chen"); MODULE_DESCRIPTION("TI DAVINCI McASP SoC Interface"); MODULE_LICENSE("GPL"); -
Hello,
On Thu, Sep 26, 2013 at 08:18:28PM +0100, Jyri Sarha wrote:
This patch adds DMA register location to mcasp DT bindings. On am33xx SoCs the McASP registers are mapped trough L4 interconnect, which is not accessible by the DMA controller, so McASP data port is mapped trough L3 to a different location.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com
.../bindings/sound/davinci-mcasp-audio.txt | 8 ++- sound/soc/davinci/davinci-mcasp.c | 59 +++++++++++++------- 2 files changed, 46 insertions(+), 21 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 374e145..63b67ae 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -6,7 +6,11 @@ Required properties: "ti,da830-mcasp-audio" : for both DA830 & DA850 platforms "ti,omap2-mcasp-audio" : for OMAP2 platforms (TI81xx, AM33xx)
-- reg : Should contain McASP registers offset and length +- reg : Should contain McASP registers address and length for mpu and
- optionally for dma controller access.
+- reg-names : The mandatory reg-range must be named "mpu" and the optional DMA
reg-range must be named "dma". For backward compatibility it is
good to keep "mpu" first in the list.
I've never heard the term "reg-range" before. The should probably be something like "reg entry". How about something like the following instead:
- reg: Should contain reg specifiers for the entries in the reg-names property.
- reg-names: Should contain: * "mpu" for the main registers (required). For compatibility with existing software, it is recommended this is the first entry. * "dma" for the DMA registers (optional).
That way we don't end up describing each reg entry twice.
I have some questions however. I took a look at the McASP (TMS320C6000) reference guide, and the registers appeared to all be in one contiguous bank, and "mpu" and "dma" don't appear to be names of particular registers or names of banks of particular registers. Am I looking in the wrong place? Is there up-to-date documentation I can look at?
Why are these split across two reg entries, and which particular registers do they actually cover?
I have some concern about the description of other properties too. If we're going to amend the binding, they should be fixed up too.
- interrupts : Interrupt number for McASP
The device also seems to be able to generate multiple interrupts -- which interrupt does this actually cover?
The driver doesn't seem to use it (by a grep of irq|interrupt). Have I missed something?
- op-mode : I2S/DIT ops mode.
What type is this?
What are valid values?
- tdm-slots : Slots for TDM operation.
Here too. This description is completely opaque.
Taking a look at the version in kernel sources this appears to be a list of values, in groups of four?
What is the format of this property?
@@ -15,7 +19,6 @@ Required properties: to "num-serializer" parameter. Each entry is a number indication serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX)
Optional properties:
- ti,hwmods : Must be "mcasp<n>", n is controller instance starting 0
@@ -31,6 +34,7 @@ mcasp0: mcasp0@1d00000 { #address-cells = <1>; #size-cells = <0>;
Why does this have #address-cells and #size-cells? There are no children in the example.
reg = <0x100000 0x3000>;
- reg-names "mpu"; interrupts = <82 83>; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>;
A few questions from a brief skim of the documentation:
There seem to be external clocks (AHCLKR and ACLKR), but they aren't described. Are we always able to use an internal clock instead? Is no external reference clock needed?
The err_release_clk label in the error path confuses me -- which clock(s) does the preceding pm_runtime_get ensure remains active? One internal to the McASP?
It looks like some pins can be used as GPIO -- is there not a need for something like pinctrl for configuring this?
Cheers, Mark.
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 32ddb7f..a056fc5 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1001,18 +1001,40 @@ static const struct snd_soc_component_driver davinci_mcasp_component = { .name = "davinci-mcasp", };
+/* Some HW specific values and defaults. The rest is filled in from DT. */ +static struct snd_platform_data dm646x_mcasp_pdata = {
- .tx_dma_offset = 0x400,
- .rx_dma_offset = 0x400,
- .asp_chan_q = EVENTQ_0,
- .version = MCASP_VERSION_1,
+};
+static struct snd_platform_data da830_mcasp_pdata = {
- .tx_dma_offset = 0x2000,
- .rx_dma_offset = 0x2000,
- .asp_chan_q = EVENTQ_0,
- .version = MCASP_VERSION_2,
+};
+static struct snd_platform_data omap2_mcasp_pdata = {
- .tx_dma_offset = 0,
- .rx_dma_offset = 0,
- .asp_chan_q = EVENTQ_0,
- .version = MCASP_VERSION_3,
+};
static const struct of_device_id mcasp_dt_ids[] = { { .compatible = "ti,dm646x-mcasp-audio",
.data = (void *)MCASP_VERSION_1,
}, { .compatible = "ti,da830-mcasp-audio",.data = &dm646x_mcasp_pdata,
.data = (void *)MCASP_VERSION_2,
}, { .compatible = "ti,omap2-mcasp-audio",.data = &da830_mcasp_pdata,
.data = (void *)MCASP_VERSION_3,
}, { /* sentinel */ }.data = &omap2_mcasp_pdata,
}; @@ -1035,20 +1057,13 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( pdata = pdev->dev.platform_data; return pdata; } else if (match) {
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) {
ret = -ENOMEM;
goto nodata;
}
} else { /* control shouldn't reach here. something is wrong */ ret = -EINVAL; goto nodata; }pdata = (struct snd_platform_data *) match->data;
- if (match->data)
pdata->version = (u8)((int)match->data);
- ret = of_property_read_u32(np, "op-mode", &val); if (ret >= 0) pdata->op_mode = val;
@@ -1145,10 +1160,15 @@ static int davinci_mcasp_probe(struct platform_device *pdev) return -EINVAL; }
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); if (!mem) {
dev_err(&pdev->dev, "no mem resource?\n");
return -ENODEV;
dev_warn(dev->dev,
"\"mpu\" mem resource not found, using index 0\n");
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem) {
dev_err(&pdev->dev, "no mem resource?\n");
return -ENODEV;
}
}
ioarea = devm_request_mem_region(&pdev->dev, mem->start,
@@ -1182,13 +1202,16 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dev->rxnumevt = pdata->rxnumevt; dev->dev = &pdev->dev;
- dma = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
- if (!dma)
dma = mem;
- dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; dma_data->asp_chan_q = pdata->asp_chan_q; dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->sram_pool = pdata->sram_pool; dma_data->sram_size = pdata->sram_size_playback;
- dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
mem->start);
dma_data->dma_addr = dma->start + pdata->tx_dma_offset;
/* first TX, then RX */ res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
@@ -1205,8 +1228,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->sram_pool = pdata->sram_pool; dma_data->sram_size = pdata->sram_size_capture;
- dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
mem->start);
dma_data->dma_addr = dma->start + pdata->rx_dma_offset;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!res) {
@@ -1266,4 +1288,3 @@ module_platform_driver(davinci_mcasp_driver); MODULE_AUTHOR("Steve Chen"); MODULE_DESCRIPTION("TI DAVINCI McASP SoC Interface"); MODULE_LICENSE("GPL");
-- 1.7.9.5
-- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Oct 07, 2013 at 10:47:18PM +0100, Mark Rutland wrote:
On Thu, Sep 26, 2013 at 08:18:28PM +0100, Jyri Sarha wrote:
- interrupts : Interrupt number for McASP
The device also seems to be able to generate multiple interrupts -- which interrupt does this actually cover?
The driver doesn't seem to use it (by a grep of irq|interrupt). Have I missed something?
No, they're not actually of much practical use to us at the minute but it was generally felt better to include the information and not use it so that if someone does come up with a use for them then the trees for deployed systems already have the information.
On Tue, Oct 08, 2013 at 01:46:41AM +0100, Mark Brown wrote:
On Mon, Oct 07, 2013 at 10:47:18PM +0100, Mark Rutland wrote:
On Thu, Sep 26, 2013 at 08:18:28PM +0100, Jyri Sarha wrote:
- interrupts : Interrupt number for McASP
The device also seems to be able to generate multiple interrupts -- which interrupt does this actually cover?
The driver doesn't seem to use it (by a grep of irq|interrupt). Have I missed something?
No, they're not actually of much practical use to us at the minute but it was generally felt better to include the information and not use it so that if someone does come up with a use for them then the trees for deployed systems already have the information.
Sure, but if this device can generate multiple interrupts, we should make it possible to describe all of them, unambiguously.
Thanks, Mark.
On 10/10/2013 07:59 PM, Mark Rutland wrote:
No, they're not actually of much practical use to us at the minute but it was generally felt better to include the information and not use it so that if someone does come up with a use for them then the trees for deployed systems already have the information.
Sure, but if this device can generate multiple interrupts, we should make it possible to describe all of them, unambiguously.
This is why Jyri added them to the DT. They are not used by the Linux driver, but the HW have interrupt lines (two of them: TX and RX).
On Thu, Oct 10, 2013 at 06:29:59PM +0100, Peter Ujfalusi wrote:
On 10/10/2013 07:59 PM, Mark Rutland wrote:
No, they're not actually of much practical use to us at the minute but it was generally felt better to include the information and not use it so that if someone does come up with a use for them then the trees for deployed systems already have the information.
Sure, but if this device can generate multiple interrupts, we should make it possible to describe all of them, unambiguously.
This is why Jyri added them to the DT. They are not used by the Linux driver, but the HW have interrupt lines (two of them: TX and RX).
The binding only describes a single interrupt, and even if multiple interrupts were listed, there's no way to disambiguate them (e.g. interrupt-names).
It would be nice to remedy this.
Cheers, Mark.
On 10/16/2013 06:04 PM, Mark Rutland wrote:
On Thu, Oct 10, 2013 at 06:29:59PM +0100, Peter Ujfalusi wrote:
On 10/10/2013 07:59 PM, Mark Rutland wrote:
No, they're not actually of much practical use to us at the minute but it was generally felt better to include the information and not use it so that if someone does come up with a use for them then the trees for deployed systems already have the information.
Sure, but if this device can generate multiple interrupts, we should make it possible to describe all of them, unambiguously.
This is why Jyri added them to the DT. They are not used by the Linux driver, but the HW have interrupt lines (two of them: TX and RX).
The binding only describes a single interrupt, and even if multiple interrupts were listed, there's no way to disambiguate them (e.g. interrupt-names).
It would be nice to remedy this.
This has been fixed in a later patch in the same series here:
[RESEND PATCH v3 05/11] ASoC: davinci-mcasp: Interrupts property to optional and add interrupt-names http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066732.h...
However the v3 series is already obsolete. The latest posted series is v4. There the patch patch bellow inculdes interrupt names, plus some other improvements based on your comments earlier:
[PATCH v4 05/10] ASoC: davinci-mcasp: Improve DT bindings document http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067100.htm...
There is already couple of updates even to v4 series of the patches, here:
[PATCH v4.1 08/10] ARM/dts: am33xx: mcasp: Add location for data port registers to reg-property http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067125.htm...
[PATCH v4.2 09/10] ARM/dts: am335x-evm: Add audio support for am335x-evm.dts http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067133.htm...
[PATCH v4.2 10/10] ARM/dts: am335x-evmsk: Audio support http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067140.htm...
Best regards, Jyri
On 10/08/2013 12:47 AM, Mark Rutland wrote:
Hello,
Hi! I am not the author of this driver so my knowledge may have gaps, when it comes to details I have not touched yet. Anyway, I do my best to address your comments.
...
-- reg : Should contain McASP registers offset and length +- reg : Should contain McASP registers address and length for mpu and
- optionally for dma controller access.
+- reg-names : The mandatory reg-range must be named "mpu" and the optional DMA
reg-range must be named "dma". For backward compatibility it is
good to keep "mpu" first in the list.
I've never heard the term "reg-range" before. The should probably be something like "reg entry". How about something like the following instead:
Well, an address and length describes a "range", but if it is not commonly used term, there is no need to use it here either.
reg: Should contain reg specifiers for the entries in the reg-names property.
reg-names: Should contain: * "mpu" for the main registers (required). For compatibility with existing software, it is recommended this is the first entry. * "dma" for the DMA registers (optional).
That way we don't end up describing each reg entry twice.
The both contain the same information, but your version is certainly easier to read. I'll take it. Thanks!
I have some questions however. I took a look at the McASP (TMS320C6000) reference guide, and the registers appeared to all be in one contiguous bank, and "mpu" and "dma" don't appear to be names of particular registers or names of banks of particular registers. Am I looking in the wrong place? Is there up-to-date documentation I can look at?
Why are these split across two reg entries, and which particular registers do they actually cover?
The need for two different register properties does not come from McASP IP, but from SoC design. On AM33XX the McASP registers are mapped for MPU through L4 bus, which is no accessible to the DMA controller. The McASP data port registers are mapped trough L3 buss to a different address for DMA controller. Maybe the second register property could be called to "dat" instead of "dma" since only data port registers are mapped trough that address.
I have some concern about the description of other properties too. If we're going to amend the binding, they should be fixed up too.
- interrupts : Interrupt number for McASP
The device also seems to be able to generate multiple interrupts -- which interrupt does this actually cover?
The driver doesn't seem to use it (by a grep of irq|interrupt). Have I missed something?
No you have not. A later patch in this set make the interrupt property optional and adds "tx" and "rx" interrupt-names: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066732.h...
- op-mode : I2S/DIT ops mode.
What type is this?
That property selects whether McASP is working in I2S mode or in Integrated Digital audio interface Transmitter (DIT) mode for S/PDIF, IEC60958-1, AES-3 formats.
What are valid values?
0 and 1. I'll document those. Thanks.
- tdm-slots : Slots for TDM operation.
Here too. This description is completely opaque.
I am not absolutely sure here. I'll check the details and try to come up with a better description.
Talking about num-serializer and serial-dir property here...
Taking a look at the version in kernel sources this appears to be a list of values, in groups of four?
What is the format of this property?
@@ -15,7 +19,6 @@ Required properties: to "num-serializer" parameter. Each entry is a number indication serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX)
The McASP can have up to 16 serializers for selecting data pin usage. The numbers have been grouped into 4x4 matrix only for better readability. BTW, the num-serializers property is redundant and it will be removed in the next version of the patch series.
Optional properties:
- ti,hwmods : Must be "mcasp<n>", n is controller instance starting 0
@@ -31,6 +34,7 @@ mcasp0: mcasp0@1d00000 { #address-cells = <1>; #size-cells = <0>;
Why does this have #address-cells and #size-cells? There are no children in the example.
I removed those from the actual dts file, but forgot to do so here. I'll fix that. Thanks!
reg = <0x100000 0x3000>;
- reg-names "mpu"; interrupts = <82 83>; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>;
A few questions from a brief skim of the documentation:
There seem to be external clocks (AHCLKR and ACLKR), but they aren't described. Are we always able to use an internal clock instead? Is no external reference clock needed?
As far as I understand the choice is to use either McASP internal clock or codec provided clock. The selection is made by the machine/platform driver by calling snd_soc_dai_set_fmt() and applying the required bits in SND_SOC_DAIFMT_MASTER_MASK. I guess the choice may not always be HW specific.
The err_release_clk label in the error path confuses me -- which clock(s) does the preceding pm_runtime_get ensure remains active? One internal to the McASP?
I guess that is really up to machine/platform driver that configures dapm.
It looks like some pins can be used as GPIO -- is there not a need for something like pinctrl for configuring this?
That is true, but since driver does not support it and there is no example of GPIO usage, no guess work has been done about the required DT properties.
Cheers, Mark.
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 32ddb7f..a056fc5 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1001,18 +1001,40 @@ static const struct snd_soc_component_driver davinci_mcasp_component = { .name = "davinci-mcasp", };
+/* Some HW specific values and defaults. The rest is filled in from DT. */ +static struct snd_platform_data dm646x_mcasp_pdata = {
- .tx_dma_offset = 0x400,
- .rx_dma_offset = 0x400,
- .asp_chan_q = EVENTQ_0,
- .version = MCASP_VERSION_1,
+};
+static struct snd_platform_data da830_mcasp_pdata = {
- .tx_dma_offset = 0x2000,
- .rx_dma_offset = 0x2000,
- .asp_chan_q = EVENTQ_0,
- .version = MCASP_VERSION_2,
+};
+static struct snd_platform_data omap2_mcasp_pdata = {
- .tx_dma_offset = 0,
- .rx_dma_offset = 0,
- .asp_chan_q = EVENTQ_0,
- .version = MCASP_VERSION_3,
+};
- static const struct of_device_id mcasp_dt_ids[] = { { .compatible = "ti,dm646x-mcasp-audio",
.data = (void *)MCASP_VERSION_1,
}, { .compatible = "ti,da830-mcasp-audio",.data = &dm646x_mcasp_pdata,
.data = (void *)MCASP_VERSION_2,
}, { .compatible = "ti,omap2-mcasp-audio",.data = &da830_mcasp_pdata,
.data = (void *)MCASP_VERSION_3,
}, { /* sentinel */ } };.data = &omap2_mcasp_pdata,
@@ -1035,20 +1057,13 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( pdata = pdev->dev.platform_data; return pdata; } else if (match) {
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) {
ret = -ENOMEM;
goto nodata;
}
} else { /* control shouldn't reach here. something is wrong */ ret = -EINVAL; goto nodata; }pdata = (struct snd_platform_data *) match->data;
- if (match->data)
pdata->version = (u8)((int)match->data);
- ret = of_property_read_u32(np, "op-mode", &val); if (ret >= 0) pdata->op_mode = val;
@@ -1145,10 +1160,15 @@ static int davinci_mcasp_probe(struct platform_device *pdev) return -EINVAL; }
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); if (!mem) {
dev_err(&pdev->dev, "no mem resource?\n");
return -ENODEV;
dev_warn(dev->dev,
"\"mpu\" mem resource not found, using index 0\n");
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem) {
dev_err(&pdev->dev, "no mem resource?\n");
return -ENODEV;
}
}
ioarea = devm_request_mem_region(&pdev->dev, mem->start,
@@ -1182,13 +1202,16 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dev->rxnumevt = pdata->rxnumevt; dev->dev = &pdev->dev;
- dma = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
- if (!dma)
dma = mem;
- dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; dma_data->asp_chan_q = pdata->asp_chan_q; dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->sram_pool = pdata->sram_pool; dma_data->sram_size = pdata->sram_size_playback;
- dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
mem->start);
dma_data->dma_addr = dma->start + pdata->tx_dma_offset;
/* first TX, then RX */ res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
@@ -1205,8 +1228,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->sram_pool = pdata->sram_pool; dma_data->sram_size = pdata->sram_size_capture;
- dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
mem->start);
dma_data->dma_addr = dma->start + pdata->rx_dma_offset;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!res) {
@@ -1266,4 +1288,3 @@ module_platform_driver(davinci_mcasp_driver); MODULE_AUTHOR("Steve Chen"); MODULE_DESCRIPTION("TI DAVINCI McASP SoC Interface"); MODULE_LICENSE("GPL");
-- 1.7.9.5
-- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
On 10/08/2013 12:13 PM, Jyri Sarha wrote:
I have some questions however. I took a look at the McASP (TMS320C6000) reference guide, and the registers appeared to all be in one contiguous bank, and "mpu" and "dma" don't appear to be names of particular registers or names of banks of particular registers. Am I looking in the wrong place? Is there up-to-date documentation I can look at?
Why are these split across two reg entries, and which particular registers do they actually cover?
The need for two different register properties does not come from McASP IP, but from SoC design. On AM33XX the McASP registers are mapped for MPU through L4 bus, which is no accessible to the DMA controller. The McASP data port registers are mapped trough L3 buss to a different address for DMA controller. Maybe the second register property could be called to "dat" instead of "dma" since only data port registers are mapped trough that address.
We have discussed this with Jyri and we are going to use 'dat' for the data port address. The driver can configure the IP via the 'mpu' area but it is preferred to use the 'dat' or data port of McASP when it comes to data. It is possible to use the transmit/receive buffer registers in the 'mpu' area but it get's complicated when more than one serializer is used.
- op-mode : I2S/DIT ops mode.
What type is this?
That property selects whether McASP is working in I2S mode or in Integrated Digital audio interface Transmitter (DIT) mode for S/PDIF, IEC60958-1, AES-3 formats.
Not sure but we might be able to handle this via standard ASoC way, via the da_fmt so the machine driver will tell the mcasp driver what is the format it needs to send the data. Adding SND_SOC_DAIFMT_SPDIF/IEC60958/AES3 to core will be needed.
What are valid values?
0 and 1. I'll document those. Thanks.
- tdm-slots : Slots for TDM operation.
Here too. This description is completely opaque.
I am not absolutely sure here. I'll check the details and try to come up with a better description.
Not sure about this either, my interpretation of what it means: number of channels to be sent via one serializer. as an example: We have 3 stereo codecs in the design all of them are connected to the same McASP instance but to be fed via different serializer: AXR0 - codec0 AXR1 - codec1 AXR2 - codec2
Since the codecs are stereo -> tdm-slots = <2>; two channels/serializer
If the stream is stereo we only ouput to codec0 via AXR0. If the stream is 4 channel, the first 2 channels will be via AXR0 to codec0 the next 2 channles will be sent to codec1 via AXR1. and so on.
I think it would be possible to extract this information from the serial-dir property + machine driver configured DAI_FMT and from the coming stream. I2S, L/R justified is stereo, in DSP modes we can have more channels. In the serial-dir array we could count the AXR directions. Basically all the information which is needed to make this redundant are there. But we have the legacy davinci users at the same time and we do not want to break eisting users.
I think Daniel Mack (CCd) can clarify my understanding of the tdm-slots.
It looks like some pins can be used as GPIO -- is there not a need for something like pinctrl for configuring this?
That is true, but since driver does not support it and there is no example of GPIO usage, no guess work has been done about the required DT properties.
This is kind of complicated issue. Any of the McASP pins (CLK, FS, AXR, etc) can be configured to be used as McASP pins or GPIO pins. This configuration is McASP IP specific, need to be done within McASP. pinctrl is overkill for this IMHO but we would need a gpio driver for McASP. If some driver requests a gpio in McASP we can just switch that pin to GPIO mode, however this brings up quite a bit of questions: - embedd the gpio driver into the dai driver? - if the system does not have audio -> no GPIO driver for the rest? - separate driver for gpio functionality? - Sanity cheks all over the place on which pin is GPIO or McASP.
and so forth.
Extract DMA channels directly from DT as they can not be found from platform resources anymore. This is a work-around until davinci audio driver is updated to use dmaengine.
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 5 +++ include/linux/platform_data/davinci_asp.h | 2 + sound/soc/davinci/davinci-mcasp.c | 47 +++++++++++++------- 3 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 63b67ae..68e0f47 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -18,6 +18,11 @@ Required properties: - serial-dir : A list of serializer pin mode. The list number should be equal to "num-serializer" parameter. Each entry is a number indication serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX) +- dmas: two element list of DMA controller phandles and DMA request line + ordered pairs. +- dma-names: identifier string for each DMA request line in the dmas property. + These strings correspond 1:1 with the ordered pairs in dmas. The dma + identifiers must be "rx" and "tx".
Optional properties:
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h index 8db5ae0..689a856 100644 --- a/include/linux/platform_data/davinci_asp.h +++ b/include/linux/platform_data/davinci_asp.h @@ -84,6 +84,8 @@ struct snd_platform_data { u8 version; u8 txnumevt; u8 rxnumevt; + int tx_dma_channel; + int rx_dma_channel; };
enum { diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index a056fc5..acbf5f8 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1047,6 +1047,7 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( struct snd_platform_data *pdata = NULL; const struct of_device_id *match = of_match_device(mcasp_dt_ids, &pdev->dev); + struct of_phandle_args dma_spec;
const u32 *of_serial_dir32; u8 *of_serial_dir; @@ -1109,6 +1110,28 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( pdata->serial_dir = of_serial_dir; }
+ ret = of_property_match_string(np, "dma-names", "tx"); + if (ret < 0) + goto nodata; + + ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret, + &dma_spec); + if (ret < 0) + goto nodata; + + pdata->tx_dma_channel = dma_spec.args[0]; + + ret = of_property_match_string(np, "dma-names", "rx"); + if (ret < 0) + goto nodata; + + ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret, + &dma_spec); + if (ret < 0) + goto nodata; + + pdata->rx_dma_channel = dma_spec.args[0]; + ret = of_property_read_u32(np, "tx-num-evt", &val); if (ret >= 0) pdata->txnumevt = val; @@ -1139,7 +1162,7 @@ nodata: static int davinci_mcasp_probe(struct platform_device *pdev) { struct davinci_pcm_dma_params *dma_data; - struct resource *mem, *ioarea, *res; + struct resource *mem, *ioarea, *res, *dma; struct snd_platform_data *pdata; struct davinci_audio_dev *dev; int ret; @@ -1213,15 +1236,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->sram_size = pdata->sram_size_playback; dma_data->dma_addr = dma->start + pdata->tx_dma_offset;
- /* first TX, then RX */ res = platform_get_resource(pdev, IORESOURCE_DMA, 0); - if (!res) { - dev_err(&pdev->dev, "no DMA resource\n"); - ret = -ENODEV; - goto err_release_clk; - } - - dma_data->channel = res->start; + if (res) + dma_data->channel = res->start; + else + dma_data->channel = pdata->tx_dma_channel;
dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]; dma_data->asp_chan_q = pdata->asp_chan_q; @@ -1231,13 +1250,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->dma_addr = dma->start + pdata->rx_dma_offset;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1); - if (!res) { - dev_err(&pdev->dev, "no DMA resource\n"); - ret = -ENODEV; - goto err_release_clk; - } + if (res) + dma_data->channel = res->start; + else + dma_data->channel = pdata->rx_dma_channel;
- dma_data->channel = res->start; dev_set_drvdata(&pdev->dev, dev); ret = snd_soc_register_component(&pdev->dev, &davinci_mcasp_component, &davinci_mcasp_dai[pdata->op_mode], 1);
On Thu, Sep 26, 2013 at 08:18:29PM +0100, Jyri Sarha wrote:
Extract DMA channels directly from DT as they can not be found from platform resources anymore. This is a work-around until davinci audio driver is updated to use dmaengine.
How long will this conversion take?
Signed-off-by: Jyri Sarha jsarha@ti.com
.../bindings/sound/davinci-mcasp-audio.txt | 5 +++ include/linux/platform_data/davinci_asp.h | 2 + sound/soc/davinci/davinci-mcasp.c | 47 +++++++++++++------- 3 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 63b67ae..68e0f47 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -18,6 +18,11 @@ Required properties:
- serial-dir : A list of serializer pin mode. The list number should be equal to "num-serializer" parameter. Each entry is a number indication serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX)
+- dmas: two element list of DMA controller phandles and DMA request line
ordered pairs.
Please describe this in terms of dma-names. That makes it clear that elements cannot be retrieved consistently by index, and prevents duplicate descriptions.
I'd prefer for the sake of consistent terminology that these were referred to as phandles + dma-specifiers rather than phandles and DMA request lines -- #dma-cells may be an arbitrary number of cells and encode arbitrary information for some abstract DMA engine.
+- dma-names: identifier string for each DMA request line in the dmas property.
These strings correspond 1:1 with the ordered pairs in dmas. The dma
identifiers must be "rx" and "tx".
For consistency and future expandability:
s/must be/should contain/
Cheers, Mark.
Optional properties:
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h index 8db5ae0..689a856 100644 --- a/include/linux/platform_data/davinci_asp.h +++ b/include/linux/platform_data/davinci_asp.h @@ -84,6 +84,8 @@ struct snd_platform_data { u8 version; u8 txnumevt; u8 rxnumevt;
- int tx_dma_channel;
- int rx_dma_channel;
};
enum { diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index a056fc5..acbf5f8 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1047,6 +1047,7 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( struct snd_platform_data *pdata = NULL; const struct of_device_id *match = of_match_device(mcasp_dt_ids, &pdev->dev);
struct of_phandle_args dma_spec;
const u32 *of_serial_dir32; u8 *of_serial_dir;
@@ -1109,6 +1110,28 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( pdata->serial_dir = of_serial_dir; }
- ret = of_property_match_string(np, "dma-names", "tx");
- if (ret < 0)
goto nodata;
- ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret,
&dma_spec);
- if (ret < 0)
goto nodata;
- pdata->tx_dma_channel = dma_spec.args[0];
- ret = of_property_match_string(np, "dma-names", "rx");
- if (ret < 0)
goto nodata;
- ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret,
&dma_spec);
- if (ret < 0)
goto nodata;
- pdata->rx_dma_channel = dma_spec.args[0];
- ret = of_property_read_u32(np, "tx-num-evt", &val); if (ret >= 0) pdata->txnumevt = val;
@@ -1139,7 +1162,7 @@ nodata: static int davinci_mcasp_probe(struct platform_device *pdev) { struct davinci_pcm_dma_params *dma_data;
- struct resource *mem, *ioarea, *res;
- struct resource *mem, *ioarea, *res, *dma; struct snd_platform_data *pdata; struct davinci_audio_dev *dev; int ret;
@@ -1213,15 +1236,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->sram_size = pdata->sram_size_playback; dma_data->dma_addr = dma->start + pdata->tx_dma_offset;
- /* first TX, then RX */ res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!res) {
dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENODEV;
goto err_release_clk;
- }
- dma_data->channel = res->start;
if (res)
dma_data->channel = res->start;
else
dma_data->channel = pdata->tx_dma_channel;
dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]; dma_data->asp_chan_q = pdata->asp_chan_q;
@@ -1231,13 +1250,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->dma_addr = dma->start + pdata->rx_dma_offset;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (!res) {
dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENODEV;
goto err_release_clk;
- }
- if (res)
dma_data->channel = res->start;
- else
dma_data->channel = pdata->rx_dma_channel;
- dma_data->channel = res->start; dev_set_drvdata(&pdev->dev, dev); ret = snd_soc_register_component(&pdev->dev, &davinci_mcasp_component, &davinci_mcasp_dai[pdata->op_mode], 1);
-- 1.7.9.5
-- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 10/08/2013 12:53 AM, Mark Rutland wrote:
On Thu, Sep 26, 2013 at 08:18:29PM +0100, Jyri Sarha wrote:
Extract DMA channels directly from DT as they can not be found from platform resources anymore. This is a work-around until davinci audio driver is updated to use dmaengine.
How long will this conversion take?
That is uncertain, definitely not in time for v3.13.
Best regards, Jyri
Makes interrupts property optional as the interrupts are not currently used by the driver and adds interrupt-names property to name listed interrupts. Currently know interrupt names are "tx" and "rx".
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 68e0f47..2fd0bf2 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -11,7 +11,6 @@ Required properties: - reg-names : The mandatory reg-range must be named "mpu" and the optional DMA reg-range must be named "dma". For backward compatibility it is good to keep "mpu" first in the list. -- interrupts : Interrupt number for McASP - op-mode : I2S/DIT ops mode. - tdm-slots : Slots for TDM operation. - num-serializer : Serializers used by McASP. @@ -31,6 +30,8 @@ Optional properties: - rx-num-evt : FIFO levels. - sram-size-playback : size of sram to be allocated during playback - sram-size-capture : size of sram to be allocated during capture +- interrupts : Interrupt numbers for McASP, currently not used by the driver +- interrupt-names : Known interrupt names are "tx" and "rx"
Example:
@@ -41,6 +42,7 @@ mcasp0: mcasp0@1d00000 { reg = <0x100000 0x3000>; reg-names "mpu"; interrupts = <82 83>; + interrupts-names = "tx", "rx"; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>; num-serializer = <16>;
On Thu, Sep 26, 2013 at 08:18:30PM +0100, Jyri Sarha wrote:
Makes interrupts property optional as the interrupts are not currently used by the driver and adds interrupt-names property to name listed interrupts. Currently know interrupt names are "tx" and "rx".
Signed-off-by: Jyri Sarha jsarha@ti.com
.../bindings/sound/davinci-mcasp-audio.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 68e0f47..2fd0bf2 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -11,7 +11,6 @@ Required properties:
- reg-names : The mandatory reg-range must be named "mpu" and the optional DMA reg-range must be named "dma". For backward compatibility it is good to keep "mpu" first in the list.
-- interrupts : Interrupt number for McASP
- op-mode : I2S/DIT ops mode.
- tdm-slots : Slots for TDM operation.
- num-serializer : Serializers used by McASP.
@@ -31,6 +30,8 @@ Optional properties:
- rx-num-evt : FIFO levels.
- sram-size-playback : size of sram to be allocated during playback
- sram-size-capture : size of sram to be allocated during capture
+- interrupts : Interrupt numbers for McASP, currently not used by the driver +- interrupt-names : Known interrupt names are "tx" and "rx"
Are these _all_ the interrupts the McASP may generate? I was under the impression there were also separate interrupts for errors.
Cheers, Mark.
Example:
@@ -41,6 +42,7 @@ mcasp0: mcasp0@1d00000 { reg = <0x100000 0x3000>; reg-names "mpu"; interrupts = <82 83>;
- interrupts-names = "tx", "rx"; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>; num-serializer = <16>;
-- 1.7.9.5
-- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 10/08/2013 12:56 AM, Mark Rutland wrote:
On Thu, Sep 26, 2013 at 08:18:30PM +0100, Jyri Sarha wrote:
+- interrupts : Interrupt numbers for McASP, currently not used by the driver
+- interrupt-names : Known interrupt names are "tx" and "rx"
Are these_all_ the interrupts the McASP may generate? I was under the impression there were also separate interrupts for errors.
Those were all I could find from AM335X TRM.
Cheers, Jyri
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
AM33xx uses same McASP IP as the Davinci Platform. This patch updates Kconfig and makefile to enable build for McASP, PCM & Codec drivers.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- sound/soc/davinci/Kconfig | 18 +++++++++++++++--- sound/soc/davinci/Makefile | 1 + 2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig index c82f89c..95970f5 100644 --- a/sound/soc/davinci/Kconfig +++ b/sound/soc/davinci/Kconfig @@ -1,9 +1,10 @@ config SND_DAVINCI_SOC - tristate "SoC Audio for the TI DAVINCI chip" - depends on ARCH_DAVINCI + tristate "SoC Audio for the TI DAVINCI or AM33XX chip" + depends on ARCH_DAVINCI || SOC_AM33XX help + Platform driver for daVinci or AM33xx Say Y or M if you want to add support for codecs attached to - the DAVINCI AC97 or I2S interface. You will also need + the DAVINCI AC97, I2S, or McASP interface. You will also need to select the audio interfaces to support below.
config SND_DAVINCI_SOC_I2S @@ -15,6 +16,17 @@ config SND_DAVINCI_SOC_MCASP config SND_DAVINCI_SOC_VCIF tristate
+config SND_AM33XX_SOC_EVM + tristate "SoC Audio for the AM33XX chip based boards" + depends on SND_DAVINCI_SOC && SOC_AM33XX + select SND_SOC_TLV320AIC3X + select SND_DAVINCI_SOC_MCASP + help + Say Y or M if you want to add support for SoC audio on AM33XX + boards using McASP and TLV320AIC3X codec. For example AM335X-EVM, + AM335X-EVMSK, and BeagelBone with AudioCape boards have this + setup. + config SND_DAVINCI_SOC_EVM tristate "SoC Audio support for DaVinci DM6446, DM355 or DM365 EVM" depends on SND_DAVINCI_SOC diff --git a/sound/soc/davinci/Makefile b/sound/soc/davinci/Makefile index a396ab6..bc81e79 100644 --- a/sound/soc/davinci/Makefile +++ b/sound/soc/davinci/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_SND_DAVINCI_SOC_VCIF) += snd-soc-davinci-vcif.o snd-soc-evm-objs := davinci-evm.o
obj-$(CONFIG_SND_DAVINCI_SOC_EVM) += snd-soc-evm.o +obj-$(CONFIG_SND_AM33XX_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DM6467_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DA830_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DA850_SOC_EVM) += snd-soc-evm.o
Add regulator properties to tlv320aic3x DT bindings document.
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../devicetree/bindings/sound/tlv320aic3x.txt | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt index f47c3f5..11e24b2 100644 --- a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt +++ b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt @@ -17,10 +17,17 @@ Optional properties: 3 - MICBIAS output is connected to AVDD, If this node is not mentioned or if the value is incorrect, then MicBias is powered down. +- AVDD-supply, IOVDD-supply, DRVDD-supply, DVDD-supply : power supplies for the + device as covered in Documentation/devicetree/bindings/regulator/regulator.txt
Example:
tlv320aic3x: tlv320aic3x@1b { compatible = "ti,tlv320aic3x"; reg = <0x1b>; + + AVDD-supply = <®ulator>; + IOVDD-supply = <®ulator>; + DRVDD-supply = <®ulator>; + DVDD-supply = <®ulator>; };
On Thu, Sep 19, 2013 at 02:29:40PM +0300, Jyri Sarha wrote:
Add regulator properties to tlv320aic3x DT bindings document.
Similarly for this and the other CODEC patch, are these changed?
No change here either.
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
________________________________________ From: devicetree-owner@vger.kernel.org [devicetree-owner@vger.kernel.org] on behalf of Mark Brown [broonie@kernel.org] Sent: Thursday, September 19, 2013 4:29 PM To: Sarha, Jyri Cc: alsa-devel@alsa-project.org; devicetree@vger.kernel.org; linux-omap@vger.kernel.org; Ujfalusi, Peter; liam.r.girdwood@linux.intel.com; grant.likely@linaro.org; rob.herring@calxeda.com; Fernandes, Joel Subject: Re: [PATCH v3 07/11] ASoC: tlv320aic3x: Add regulators to DT bindings document
On Thu, Sep 19, 2013 at 02:29:40PM +0300, Jyri Sarha wrote:
Add regulator properties to tlv320aic3x DT bindings document.
Similarly for this and the other CODEC patch, are these changed?
Add list of codec pins to tlv320aic3x DT bindings document.
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../devicetree/bindings/sound/tlv320aic3x.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt index 11e24b2..2b76c81 100644 --- a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt +++ b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt @@ -20,6 +20,25 @@ Optional properties: - AVDD-supply, IOVDD-supply, DRVDD-supply, DVDD-supply : power supplies for the device as covered in Documentation/devicetree/bindings/regulator/regulator.txt
+CODEC output pins: + * LLOUT + * RLOUT + * MONO_LOUT + * HPLOUT + * HPROUT + * HPLCOM + * HPRCOM + +CODEC input pins: + * MIC3L + * MIC3R + * LINE1L + * LINE2L + * LINE1R + * LINE2R + +The pins can be used in referring sound node's audio-routing property. + Example:
tlv320aic3x: tlv320aic3x@1b {
From: Pantelis Antoniou panto@antoniou-consulting.com
Add missing mcasp entries in the am33xx.dtsi include file.
Signed-off-by: Pantelis Antoniou panto@antoniou-consulting.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am33xx.dtsi | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 0fdb949..fe53ce0 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -552,5 +552,24 @@ #size-cells = <1>; status = "disabled"; }; + + mcasp0: mcasp@48038000 { + compatible = "ti,omap2-mcasp-audio"; + ti,hwmods = "mcasp0"; + reg = <0x48038000 0x2000>; + interrupts = <80 81>; + interrupts-names = "tx", "rx"; + status = "disabled"; + }; + + mcasp1: mcasp@4803C000 { + compatible = "ti,omap2-mcasp-audio"; + ti,hwmods = "mcasp1"; + reg = <0x4803C000 0x2000>; + interrupts = <82 83>; + interrupts-names = "tx", "rx"; + status = "disabled"; + }; + }; };
This patch adds an optional address range to reg property. The range describes the register location for DMA controller on am33xx. The both address ranges are named accordingly in the reg-names property.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am33xx.dtsi | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index fe53ce0..4dc388a 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -556,19 +556,29 @@ mcasp0: mcasp@48038000 { compatible = "ti,omap2-mcasp-audio"; ti,hwmods = "mcasp0"; - reg = <0x48038000 0x2000>; + reg = <0x48038000 0x2000>, + <0x46400000 0x400000>; + reg-names = "mpu", "dma"; interrupts = <80 81>; interrupts-names = "tx", "rx"; status = "disabled"; + dmas = <&edma 8 + &edma 9>; + dma-names = "tx", "rx"; };
mcasp1: mcasp@4803C000 { compatible = "ti,omap2-mcasp-audio"; ti,hwmods = "mcasp1"; - reg = <0x4803C000 0x2000>; + reg = <0x4803C000 0x2000>, + <0x46400000 0x400000>; + reg-names = "mpu", "dma"; interrupts = <82 83>; interrupts-names = "tx", "rx"; status = "disabled"; + dmas = <&edma 10 + &edma 11>; + dma-names = "tx", "rx"; };
};
On Thu, Sep 26, 2013 at 08:18:35PM +0100, Jyri Sarha wrote:
This patch adds an optional address range to reg property. The range describes the register location for DMA controller on am33xx. The both address ranges are named accordingly in the reg-names property.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com
arch/arm/boot/dts/am33xx.dtsi | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index fe53ce0..4dc388a 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -556,19 +556,29 @@ mcasp0: mcasp@48038000 { compatible = "ti,omap2-mcasp-audio"; ti,hwmods = "mcasp0";
reg = <0x48038000 0x2000>;
reg = <0x48038000 0x2000>,
<0x46400000 0x400000>;
reg-names = "mpu", "dma"; interrupts = <80 81>; interrupts-names = "tx", "rx"; status = "disabled";
dmas = <&edma 8
&edma 9>;
For consistency with reg and other composite value properties, I'd prefer that each entry in the list were individually bracketed:
dmas = <&edma 8>, <&edma 9>;
It would also be nice if interrupts were written this way.
dma-names = "tx", "rx";
};
mcasp1: mcasp@4803C000 { compatible = "ti,omap2-mcasp-audio"; ti,hwmods = "mcasp1";
reg = <0x4803C000 0x2000>;
reg = <0x4803C000 0x2000>,
<0x46400000 0x400000>;
reg-names = "mpu", "dma"; interrupts = <82 83>; interrupts-names = "tx", "rx"; status = "disabled";
dmas = <&edma 10
&edma 11>;
Similarly here.
Cheers, Mark.
On 10/08/2013 01:00 AM, Mark Rutland wrote:
For consistency with reg and other composite value properties, I'd prefer that each entry in the list were individually bracketed:
dmas = <&edma 8>, <&edma 9>;
Makes sense. I'll do that. Thanks!
It would also be nice if interrupts were written this way.
I'll change that too.
Cheers, Jyri
From: Darren Etheridge detheridge@ti.com
Adds sound, tlv320aic3x, mcasp1, and am335x_evm_audio_pin nodes.
Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am335x-evm.dts | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index 3aee1a4..4a49229 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts @@ -149,6 +149,16 @@ 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7) >; }; + + am335x_evm_audio_pins: am335x_evm_audio_pins { + pinctrl-single,pins = < + 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rx_dv.mcasp1_aclkx */ + 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_txd3.mcasp1_fsx */ + 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */ + 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */ + >; + }; + };
ocp { @@ -215,6 +225,19 @@ compatible = "ti,tmp275"; reg = <0x48>; }; + + tlv320aic3x: tlv320aic3x@1b { + compatible = "ti,tlv320aic3x"; + reg = <0x1b>; + status = "okay"; + + /* Regulators */ + AVDD-supply = <&vaux2_reg>; + IOVDD-supply = <&vaux2_reg>; + DRVDD-supply = <&vaux2_reg>; + DVDD-supply = <&vbat>; + }; + };
elm: elm@48080000 { @@ -311,6 +334,20 @@ }; }; }; + + sound { + compatible = "ti,da830-evm-audio"; + ti,model = "DA830 EVM"; + ti,audio-codec = <&tlv320aic3x>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <12000000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT", + "LINE1L", "Line In", + "LINE1R", "Line In"; + }; + };
vbat: fixedregulator@0 { @@ -378,6 +415,25 @@
#include "tps65910.dtsi"
+&mcasp1 { + pinctrl-names = "default"; + pinctrl-0 = <&am335x_evm_audio_pins>; + + status = "okay"; + + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + num-serializer = <16>; + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 0 0 1 2 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + >; + tx-num-evt = <1>; + rx-num-evt = <1>; +}; + &tps { vcc1-supply = <&vbat>; vcc2-supply = <&vbat>;
On Thu, Sep 26, 2013 at 08:18:36PM +0100, Jyri Sarha wrote:
From: Darren Etheridge detheridge@ti.com
Adds sound, tlv320aic3x, mcasp1, and am335x_evm_audio_pin nodes.
Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com
arch/arm/boot/dts/am335x-evm.dts | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index 3aee1a4..4a49229 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts @@ -149,6 +149,16 @@ 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7) >; };
am335x_evm_audio_pins: am335x_evm_audio_pins {
pinctrl-single,pins = <
0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rx_dv.mcasp1_aclkx */
0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_txd3.mcasp1_fsx */
0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */
0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */
>;
};
};
ocp {
@@ -215,6 +225,19 @@ compatible = "ti,tmp275"; reg = <0x48>; };
tlv320aic3x: tlv320aic3x@1b {
compatible = "ti,tlv320aic3x";
reg = <0x1b>;
status = "okay";
/* Regulators */
AVDD-supply = <&vaux2_reg>;
IOVDD-supply = <&vaux2_reg>;
DRVDD-supply = <&vaux2_reg>;
DVDD-supply = <&vbat>;
};
};
elm: elm@48080000 {
@@ -311,6 +334,20 @@ }; }; };
sound {
compatible = "ti,da830-evm-audio";
ti,model = "DA830 EVM";
ti,audio-codec = <&tlv320aic3x>;
ti,mcasp-controller = <&mcasp1>;
ti,codec-clock-rate = <12000000>;
ti,audio-routing =
"Headphone Jack", "HPLOUT",
"Headphone Jack", "HPROUT",
"LINE1L", "Line In",
"LINE1R", "Line In";
};
};
vbat: fixedregulator@0 {
@@ -378,6 +415,25 @@
#include "tps65910.dtsi"
+&mcasp1 {
pinctrl-names = "default";
pinctrl-0 = <&am335x_evm_audio_pins>;
I didn't see mention of pinctrl added to the binding. It should be.
Thanks, Mark.
status = "okay";
op-mode = <0>; /* MCASP_IIS_MODE */
tdm-slots = <2>;
num-serializer = <16>;
serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
0 0 1 2
0 0 0 0
0 0 0 0
0 0 0 0
>;
tx-num-evt = <1>;
rx-num-evt = <1>;
+};
&tps { vcc1-supply = <&vbat>; vcc2-supply = <&vbat>; -- 1.7.9.5
-- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 10/08/2013 01:02 AM, Mark Rutland wrote:
+&mcasp1 {
pinctrl-names = "default";
pinctrl-0 = <&am335x_evm_audio_pins>;
I didn't see mention of pinctrl added to the binding. It should be.
I'll add that. Thanks!
Cheers, Jyri
On Thu, Sep 19, 2013 at 02:29:33PM +0300, Jyri Sarha wrote:
The RFC version of patches can been found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066178.h...
This all looks fine to me, I'd like some review from the DT guys though.
The v3 version of patches can be found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066728.h... The v2 version of patches can be found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066379.h... The RFC version of patches can been found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066178.h...
Changes since v3 - Rebased on top of v3.12-rc4 - Drop already applied patches: - [PATCH v2 01/11] ASoC: davinci-evm: Move sysclk logic away from evm_hw_params - [PATCH v2 06/11] ASoC: davinci: Add support for AM33xx SoC Audio - [PATCH v2 07/11] ASoC: tlv320aic3x: Add regulators to DT bindings document - [PATCH v2 08/11] ASoC: tlv320aic3x: Add codec pins to DT bindings document - Add: ASoC: davinci: Fix AM33xx SoC Audio support - Contains the fixes from Peter: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066448.h... - Contents of this patch were squashed to "[PATCH v3 06/11] ASoC: davinci: Add support for AM33xx SoC Audio", but since the patch v2 was already applied the changes are here as a separate patch. - Add: ASoC: davinci-mcasp: Remove redundant num-serializer DT parameter - Change: ASoC: davinci-mcasp: Add DMA register locations to DT to: ASoC: davinci-mcasp: Add location for data port registers to DT - Use more accurate name for data port register location - Improve commit message - Change: ASoC: davinci-mcasp: Interrupts property to optional and add interrupt-names to: ASoC: davinci-mcasp: Improve DT bindings document - Remove #address-cells and #size-cells - Bracket named interrupts tuples - Add missing "for" to serial-dir description - Improve tdm-slots description - Improve op-mode description - Add pinctrl-names and pinctrl-0 descriptions - Change: ARM/dts: am335x-evm: Add audio support for am335x-evm.dts - Use board specific name 'AM335x-EVM' for the soundcard. - Use the board specific tlv320aic3106 codec. Use this name instead of generic tlv320aic3x. - Remove num-serializer property from mcasp node - Remove blank lines - Change: ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries - Bracket all named property tuples - Add: ARM/dts: am335x-evmsk: Audio support - The other patches in the set not mentioned here are identical to their earlier version
Changes since v2 [PATCH v2 01/11] ASoC: davinci-evm: Move sysclk logic away from evm_hw_params - no change [PATCH v2 02/11] ASoC: davinci-evm: Add device tree binding - no change [PATCH v2 03/11] ASoC: davinci-mcasp: Add DMA register locations to DT - no change [PATCH v2 04/11] ASoC: davinci-mcasp: Extract DMA channels directly from DT - no change [PATCH v2 05/11] ASoC: davinci-mcasp: Remove interrupt property from DT bindin - restore binding but make it optional and add interrupt-names property [PATCH v2 06/11] ASoC: davinci: Add support for AM33xx SoC Audio - SND_DAVINCI_SOC help "Machine driver for ..." -> "Platform driver for ..." - SND_AM33XX_SOC_EVM depends on SND_DAVINCI_SOC && SOC_AM33XX - SND_AM33XX_SOC_EVM does not selcet SND_DAVINCI_SOC [PATCH v2 07/11] ASoC: tlv320aic3x: Add regulators to DT bindings document - no change [PATCH v2 08/11] ASoC: tlv320aic3x: Add codec pins to DT bindings document - no change [PATCH v2 09/11] ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries - restore interrupt property and add interrupt-names property [PATCH v2 10/11] ARM/dts: am33xx: mcasp: Add new dma register location to reg-property - no change [PATCH v2 11/11] ARM/dts: am335x-evm: Add audio support for am335x-evm.dts - no change
Changes from RFC to v2 - Dropped out "ASoC: davinci-mcasp: Add pinctrl support" since driver core is taking care of this now. - Cleanup am33xx audio build - Add regulators to tlv320aic3x DT binding document - Remove dm365-voice-codec-audio DT support as it has never been tested an probably does not work - Add output pins and Line In connector to davinci-evm-audio DT binding doc - Remove asp_chan_q and ram_chan_q properties from mcasp DT node in DT mode mcasp is hardcoded to event queue 0 (highest priority) - Add pins to tlv320aic3x DT bindings document. If I misunderstood Marks comment and this patch is not needed, then just leave it out Changes based on TI internal discussions - Move system clock rate logic away from from evm_hw_params soc-op - Remove unnecesary #if defined(CONFIG_OF) from davinci-evm.c - Make dma property DT binding document more exact - Add only "dma" reg location instead of separate "dma-tx" and "dma-rx" - Primarily look for "mpu" reg property, but fall back to index 0 if not found - Remove interrupt property from mcasp DT node as it is not used - Remove #address-cells and #size-cells mcasp properties as they are not needed
The patch set depends on following patches:
[PATCH v11 4/8] ARM: dts: add AM33XX EDMA support https://lkml.org/lkml/2013/6/18/49
[PATCH v11 5/8] ARM: dts: add AM33XX SPI DMA support https://lkml.org/lkml/2013/6/18/55
[PATCH v2 01/11] ASoC: davinci-evm: Move sysclk logic away from evm_hw_params http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066381.h...
[PATCH v2 06/11] ASoC: davinci: Add support for AM33xx SoC Audio http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066385.h...
This set of patches fixes the basic audio support for am335x-evm and am335x-evmsk. It should be relatively simple to add the necessary nodes to relevant dts files to get BeagleBone + AudioCape working too.
I have tried my best not to break the existing support for older davinci boards, but since I do not have those boards I can not be sure.
Some commit comments refer to a dmaengine based davinci audio implementation which is planned for but nothing has been done yet.
Best regards, Jyri
Darren Etheridge (1): ARM/dts: am335x-evm: Add audio support for am335x-evm.dts
Hebbar, Gururaja (1): ASoC: davinci-evm: Add device tree binding
Jyri Sarha (5): ASoC: davinci: Fix AM33xx SoC Audio support ASoC: davinci-mcasp: Add location for data port registers to DT ASoC: davinci-mcasp: Extract DMA channels directly from DT ASoC: davinci-mcasp: Improve DT bindings document ARM/dts: am33xx: mcasp: Add location for data port registers to reg-property
Pantelis Antoniou (1): ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries
Peter Ujfalusi (2): ASoC: davinci-mcasp: Remove redundant num-serializer DT parameter ARM/dts: am335x-evmsk: Audio support
.../bindings/sound/davinci-evm-audio.txt | 58 +++++++++ .../bindings/sound/davinci-mcasp-audio.txt | 38 ++++-- arch/arm/boot/dts/am335x-evm.dts | 54 +++++++++ arch/arm/boot/dts/am335x-evmsk.dts | 51 ++++++++ arch/arm/boot/dts/am33xx.dtsi | 29 +++++ include/linux/platform_data/davinci_asp.h | 2 + sound/soc/davinci/Kconfig | 4 +- sound/soc/davinci/davinci-evm.c | 120 +++++++++++++++++- sound/soc/davinci/davinci-mcasp.c | 128 ++++++++++++-------- 9 files changed, 417 insertions(+), 67 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
SND_DAVINCI_SOC is a platform driver for Davinci and AM33XX SoCs, not a machine driver. Make SND_AM33XX_SOC_EVM dependent of SND_DAVINCI_SOC instead of selecting it and add dependecy to SOC_AM33XX.
Signed-off-by: Jyri Sarha jsarha@ti.com --- sound/soc/davinci/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig index 6c8e687..95970f5 100644 --- a/sound/soc/davinci/Kconfig +++ b/sound/soc/davinci/Kconfig @@ -2,7 +2,7 @@ config SND_DAVINCI_SOC tristate "SoC Audio for the TI DAVINCI or AM33XX chip" depends on ARCH_DAVINCI || SOC_AM33XX help - Machine driver for DAVINCI audio. + Platform driver for daVinci or AM33xx Say Y or M if you want to add support for codecs attached to the DAVINCI AC97, I2S, or McASP interface. You will also need to select the audio interfaces to support below. @@ -18,7 +18,7 @@ config SND_DAVINCI_SOC_VCIF
config SND_AM33XX_SOC_EVM tristate "SoC Audio for the AM33XX chip based boards" - select SND_DAVINCI_SOC + depends on SND_DAVINCI_SOC && SOC_AM33XX select SND_SOC_TLV320AIC3X select SND_DAVINCI_SOC_MCASP help
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
Device tree support for Davinci Machine driver
When the board boots with device tree, the driver will receive card, codec, dai interface details (like the card name, DAPM routing map, phandle for the audio components described in the dts file, codec mclk speed). The card will be set up based on this information. Since the routing is provided via DT we can mark the card fully routed so core can take care of disconnecting the unused pins.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-evm-audio.txt | 58 ++++++++++ sound/soc/davinci/davinci-evm.c | 120 +++++++++++++++++++- 2 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
diff --git a/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt new file mode 100644 index 0000000..e6b61ff --- /dev/null +++ b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt @@ -0,0 +1,58 @@ +* Texas Instruments SoC audio setups with TLV320AIC3X Codec + +Required properties: +- compatible : "ti,da830-evm-audio" : forDM365/DA8xx/OMAPL1x/AM33xx +- ti,model : The user-visible name of this sound complex. +- ti,audio-codec : The phandle of the TLV320AIC3x audio codec +- ti,mcasp-controller : The phandle of the McASP controller +- ti,codec-clock-rate : The Codec Clock rate (in Hz) applied to the Codec +- ti,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 codec's pins, and the jacks on the board: + + TLV320AIC3X pins: + + * LLOUT + * RLOUT + * MONO_LOUT + * HPLOUT + * HPROUT + * HPLCOM + * HPRCOM + * MIC3L + * MIC3R + * LINE1L + * LINE2L + * LINE1R + * LINE2R + + Board connectors: + + * Headphone Jack + * Line Out + * Mic Jack + * Line In + + +Example: + +sound { + compatible = "ti,da830-evm-audio"; + ti,model = "DA830 EVM"; + ti,audio-codec = <&tlv320aic3x>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <12000000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT", + "Line Out", "LLOUT", + "Line Out", "RLOUT", + "MIC3L", "Mic Bias 2V", + "MIC3R", "Mic Bias 2V", + "Mic Bias 2V", "Mic Jack", + "LINE1L", "Line In", + "LINE2L", "Line In", + "LINE1R", "Line In", + "LINE2R", "Line In"; +}; diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 2f8161c..340a68d 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -16,6 +16,7 @@ #include <linux/platform_device.h> #include <linux/platform_data/edma.h> #include <linux/i2c.h> +#include <linux/of_platform.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/soc.h> @@ -23,6 +24,8 @@ #include <asm/dma.h> #include <asm/mach-types.h>
+#include <linux/edma.h> + #include "davinci-pcm.h" #include "davinci-i2s.h" #include "davinci-mcasp.h" @@ -121,13 +124,22 @@ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; + struct device_node *np = codec->card->dev->of_node; + int ret;
/* Add davinci-evm specific widgets */ snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets, ARRAY_SIZE(aic3x_dapm_widgets));
- /* Set up davinci-evm specific audio path audio_map */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); + if (np) { + ret = snd_soc_of_parse_audio_routing(codec->card, + "ti,audio-routing"); + if (ret) + return ret; + } else { + /* Set up davinci-evm specific audio path audio_map */ + snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); + }
/* not connected */ snd_soc_dapm_disable_pin(dapm, "MONO_LOUT"); @@ -312,6 +324,98 @@ static struct snd_soc_card da850_snd_soc_card = { .drvdata = &da850_snd_soc_card_drvdata, };
+#if defined(CONFIG_OF) + +/* + * The struct is used as place holder. It will be completely + * filled with data from dt node. + */ +static struct snd_soc_dai_link evm_dai_tlv320aic3x = { + .name = "TLV320AIC3X", + .stream_name = "AIC3X", + .codec_dai_name = "tlv320aic3x-hifi", + .ops = &evm_ops, + .init = evm_aic3x_init, +}; + +static const struct of_device_id davinci_evm_dt_ids[] = { + { + .compatible = "ti,da830-evm-audio", + .data = (void *) &evm_dai_tlv320aic3x, + }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, davinci_evm_dt_ids); + +/* davinci evm audio machine driver */ +static struct snd_soc_card evm_soc_card = { + .owner = THIS_MODULE, + .num_links = 1, +}; + +static int davinci_evm_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match = + of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev); + struct snd_soc_dai_link *dai = (struct snd_soc_dai_link *) match->data; + struct snd_soc_card_drvdata_davinci *drvdata = NULL; + int ret = 0; + + evm_soc_card.dai_link = dai; + + dai->codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0); + if (!dai->codec_of_node) + return -EINVAL; + + dai->cpu_of_node = of_parse_phandle(np, "ti,mcasp-controller", 0); + if (!dai->cpu_of_node) + return -EINVAL; + + dai->platform_of_node = dai->cpu_of_node; + + evm_soc_card.dev = &pdev->dev; + ret = snd_soc_of_parse_card_name(&evm_soc_card, "ti,model"); + if (ret) + return ret; + + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + ret = of_property_read_u32(np, "ti,codec-clock-rate", &drvdata->sysclk); + if (ret < 0) + return -EINVAL; + + snd_soc_card_set_drvdata(&evm_soc_card, drvdata); + ret = snd_soc_register_card(&evm_soc_card); + + if (ret) + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); + + return ret; +} + +static int davinci_evm_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + + return 0; +} + +static struct platform_driver davinci_evm_driver = { + .probe = davinci_evm_probe, + .remove = davinci_evm_remove, + .driver = { + .name = "davinci_evm", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(davinci_evm_dt_ids), + }, +}; +#endif + static struct platform_device *evm_snd_device;
static int __init evm_init(void) @@ -320,6 +424,13 @@ static int __init evm_init(void) int index; int ret;
+ /* + * If dtb is there, the devices will be created dynamically. + * Only register platfrom driver structure. + */ + if (of_have_populated_dt()) + return platform_driver_register(&davinci_evm_driver); + if (machine_is_davinci_evm()) { evm_snd_dev_data = &dm6446_snd_soc_card_evm; index = 0; @@ -355,6 +466,11 @@ static int __init evm_init(void)
static void __exit evm_exit(void) { + if (of_have_populated_dt()) { + platform_driver_unregister(&davinci_evm_driver); + return; + } + platform_device_unregister(evm_snd_device); }
This patch adds a separate register location for data port registers to mcasp DT bindings. On am33xx SoCs the McASP registers are mapped trough L4 interconnect, but data port registers are also mapped trough L3 bus to a different memory location.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 8 ++- sound/soc/davinci/davinci-mcasp.c | 61 +++++++++++++------- 2 files changed, 47 insertions(+), 22 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 374e145..c2ab869 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -6,7 +6,11 @@ Required properties: "ti,da830-mcasp-audio" : for both DA830 & DA850 platforms "ti,omap2-mcasp-audio" : for OMAP2 platforms (TI81xx, AM33xx)
-- reg : Should contain McASP registers offset and length +- reg : Should contain reg specifiers for the entries in the reg-names property. +- reg-names : Should contain: + * "mpu" for the main registers (required). For compatibility with + existing software, it is recommended this is the first entry. + * "dat" for separate data port register access (optional). - interrupts : Interrupt number for McASP - op-mode : I2S/DIT ops mode. - tdm-slots : Slots for TDM operation. @@ -15,7 +19,6 @@ Required properties: to "num-serializer" parameter. Each entry is a number indication serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX)
- Optional properties:
- ti,hwmods : Must be "mcasp<n>", n is controller instance starting 0 @@ -31,6 +34,7 @@ mcasp0: mcasp0@1d00000 { #address-cells = <1>; #size-cells = <0>; reg = <0x100000 0x3000>; + reg-names "mpu"; interrupts = <82 83>; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>; diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 32ddb7f..7fd37ff 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1001,18 +1001,40 @@ static const struct snd_soc_component_driver davinci_mcasp_component = { .name = "davinci-mcasp", };
+/* Some HW specific values and defaults. The rest is filled in from DT. */ +static struct snd_platform_data dm646x_mcasp_pdata = { + .tx_dma_offset = 0x400, + .rx_dma_offset = 0x400, + .asp_chan_q = EVENTQ_0, + .version = MCASP_VERSION_1, +}; + +static struct snd_platform_data da830_mcasp_pdata = { + .tx_dma_offset = 0x2000, + .rx_dma_offset = 0x2000, + .asp_chan_q = EVENTQ_0, + .version = MCASP_VERSION_2, +}; + +static struct snd_platform_data omap2_mcasp_pdata = { + .tx_dma_offset = 0, + .rx_dma_offset = 0, + .asp_chan_q = EVENTQ_0, + .version = MCASP_VERSION_3, +}; + static const struct of_device_id mcasp_dt_ids[] = { { .compatible = "ti,dm646x-mcasp-audio", - .data = (void *)MCASP_VERSION_1, + .data = &dm646x_mcasp_pdata, }, { .compatible = "ti,da830-mcasp-audio", - .data = (void *)MCASP_VERSION_2, + .data = &da830_mcasp_pdata, }, { .compatible = "ti,omap2-mcasp-audio", - .data = (void *)MCASP_VERSION_3, + .data = &omap2_mcasp_pdata, }, { /* sentinel */ } }; @@ -1035,20 +1057,13 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( pdata = pdev->dev.platform_data; return pdata; } else if (match) { - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) { - ret = -ENOMEM; - goto nodata; - } + pdata = (struct snd_platform_data *) match->data; } else { /* control shouldn't reach here. something is wrong */ ret = -EINVAL; goto nodata; }
- if (match->data) - pdata->version = (u8)((int)match->data); - ret = of_property_read_u32(np, "op-mode", &val); if (ret >= 0) pdata->op_mode = val; @@ -1124,7 +1139,7 @@ nodata: static int davinci_mcasp_probe(struct platform_device *pdev) { struct davinci_pcm_dma_params *dma_data; - struct resource *mem, *ioarea, *res; + struct resource *mem, *ioarea, *res, *dat; struct snd_platform_data *pdata; struct davinci_audio_dev *dev; int ret; @@ -1145,10 +1160,15 @@ static int davinci_mcasp_probe(struct platform_device *pdev) return -EINVAL; }
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); if (!mem) { - dev_err(&pdev->dev, "no mem resource?\n"); - return -ENODEV; + dev_warn(dev->dev, + ""mpu" mem resource not found, using index 0\n"); + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!mem) { + dev_err(&pdev->dev, "no mem resource?\n"); + return -ENODEV; + } }
ioarea = devm_request_mem_region(&pdev->dev, mem->start, @@ -1182,13 +1202,16 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dev->rxnumevt = pdata->rxnumevt; dev->dev = &pdev->dev;
+ dat = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dat"); + if (!dat) + dat = mem; + dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; dma_data->asp_chan_q = pdata->asp_chan_q; dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->sram_pool = pdata->sram_pool; dma_data->sram_size = pdata->sram_size_playback; - dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset + - mem->start); + dma_data->dma_addr = dat->start + pdata->tx_dma_offset;
/* first TX, then RX */ res = platform_get_resource(pdev, IORESOURCE_DMA, 0); @@ -1205,8 +1228,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->sram_pool = pdata->sram_pool; dma_data->sram_size = pdata->sram_size_capture; - dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + - mem->start); + dma_data->dma_addr = dat->start + pdata->rx_dma_offset;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!res) { @@ -1266,4 +1288,3 @@ module_platform_driver(davinci_mcasp_driver); MODULE_AUTHOR("Steve Chen"); MODULE_DESCRIPTION("TI DAVINCI McASP SoC Interface"); MODULE_LICENSE("GPL"); -
Extract DMA channels directly from DT as they can not be found from platform resources anymore. This is a work-around until davinci audio driver is updated to use dmaengine.
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 5 +++ include/linux/platform_data/davinci_asp.h | 2 + sound/soc/davinci/davinci-mcasp.c | 45 ++++++++++++++------ 3 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index c2ab869..c3ccde7 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -18,6 +18,11 @@ Required properties: - serial-dir : A list of serializer pin mode. The list number should be equal to "num-serializer" parameter. Each entry is a number indication serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX) +- dmas: two element list of DMA controller phandles and DMA request line + ordered pairs. +- dma-names: identifier string for each DMA request line in the dmas property. + These strings correspond 1:1 with the ordered pairs in dmas. The dma + identifiers must be "rx" and "tx".
Optional properties:
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h index 8db5ae0..689a856 100644 --- a/include/linux/platform_data/davinci_asp.h +++ b/include/linux/platform_data/davinci_asp.h @@ -84,6 +84,8 @@ struct snd_platform_data { u8 version; u8 txnumevt; u8 rxnumevt; + int tx_dma_channel; + int rx_dma_channel; };
enum { diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 7fd37ff..2583802 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1047,6 +1047,7 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( struct snd_platform_data *pdata = NULL; const struct of_device_id *match = of_match_device(mcasp_dt_ids, &pdev->dev); + struct of_phandle_args dma_spec;
const u32 *of_serial_dir32; u8 *of_serial_dir; @@ -1109,6 +1110,28 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( pdata->serial_dir = of_serial_dir; }
+ ret = of_property_match_string(np, "dma-names", "tx"); + if (ret < 0) + goto nodata; + + ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret, + &dma_spec); + if (ret < 0) + goto nodata; + + pdata->tx_dma_channel = dma_spec.args[0]; + + ret = of_property_match_string(np, "dma-names", "rx"); + if (ret < 0) + goto nodata; + + ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret, + &dma_spec); + if (ret < 0) + goto nodata; + + pdata->rx_dma_channel = dma_spec.args[0]; + ret = of_property_read_u32(np, "tx-num-evt", &val); if (ret >= 0) pdata->txnumevt = val; @@ -1213,15 +1236,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->sram_size = pdata->sram_size_playback; dma_data->dma_addr = dat->start + pdata->tx_dma_offset;
- /* first TX, then RX */ res = platform_get_resource(pdev, IORESOURCE_DMA, 0); - if (!res) { - dev_err(&pdev->dev, "no DMA resource\n"); - ret = -ENODEV; - goto err_release_clk; - } - - dma_data->channel = res->start; + if (res) + dma_data->channel = res->start; + else + dma_data->channel = pdata->tx_dma_channel;
dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]; dma_data->asp_chan_q = pdata->asp_chan_q; @@ -1231,13 +1250,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->dma_addr = dat->start + pdata->rx_dma_offset;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1); - if (!res) { - dev_err(&pdev->dev, "no DMA resource\n"); - ret = -ENODEV; - goto err_release_clk; - } + if (res) + dma_data->channel = res->start; + else + dma_data->channel = pdata->rx_dma_channel;
- dma_data->channel = res->start; dev_set_drvdata(&pdev->dev, dev); ret = snd_soc_register_component(&pdev->dev, &davinci_mcasp_component, &davinci_mcasp_dai[pdata->op_mode], 1);
Makes interrupts property optional as the interrupts are not currently used by the driver and adds interrupt-names property to name listed interrupts. Currently know interrupt names are "tx" and "rx".
- Improve tdm-slots propery description
- Improve op-mode property description
- Add pinctrl-names and pinctrl-0 properties
- Remove #address-cells and #size-cells as they are not needed.
- Bracket named interrupts property tuples for uniformity.
- Add missing "for" to serial-dir prop in DT bindings doc.
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 24 ++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index c3ccde7..ab2af66 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -11,13 +11,14 @@ Required properties: * "mpu" for the main registers (required). For compatibility with existing software, it is recommended this is the first entry. * "dat" for separate data port register access (optional). -- interrupts : Interrupt number for McASP -- op-mode : I2S/DIT ops mode. -- tdm-slots : Slots for TDM operation. +- op-mode : I2S/DIT ops mode. 0 for I2S mode. 1 for DIT mode used for S/PDIF, + IEC60958-1, and AES-3 formats. +- tdm-slots : Slots for TDM operation. Indicates number of channels transmitted + or received over one serializer. - num-serializer : Serializers used by McASP. -- serial-dir : A list of serializer pin mode. The list number should be equal - to "num-serializer" parameter. Each entry is a number indication - serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX) +- serial-dir : A list of serializer configuration. Each entry is a number + indication for serializer pin direction. + (0 - INACTIVE, 1 - TX, 2 - RX) - dmas: two element list of DMA controller phandles and DMA request line ordered pairs. - dma-names: identifier string for each DMA request line in the dmas property. @@ -31,16 +32,21 @@ Optional properties: - rx-num-evt : FIFO levels. - sram-size-playback : size of sram to be allocated during playback - sram-size-capture : size of sram to be allocated during capture +- interrupts : Interrupt numbers for McASP, currently not used by the driver +- interrupt-names : Known interrupt names are "tx" and "rx" +- pinctrl-0: Should specify pin control group used for this controller. +- pinctrl-names: Should contain only one value - "default", for more details + please refer to pinctrl-bindings.txt +
Example:
mcasp0: mcasp0@1d00000 { compatible = "ti,da830-mcasp-audio"; - #address-cells = <1>; - #size-cells = <0>; reg = <0x100000 0x3000>; reg-names "mpu"; - interrupts = <82 83>; + interrupts = <82>, <83>; + interrupts-names = "tx", "rx"; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>; num-serializer = <16>;
From: Peter Ujfalusi peter.ujfalusi@ti.com
The serial-dir array gives this information so there is no need to have the num-serializer property in DT description. Just ignore the property in the driver the DTS files can be updated separately without regression. Update the documentation at the same time for davinci-mcasp
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 1 - sound/soc/davinci/davinci-mcasp.c | 22 +++++--------------- 2 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index ab2af66..b350cd9 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -49,7 +49,6 @@ mcasp0: mcasp0@1d00000 { interrupts-names = "tx", "rx"; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>; - num-serializer = <16>; serial-dir = < 0 0 0 0 /* 0: INACTIVE, 1: TX, 2: RX */ 0 0 0 0 diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 2583802..03a1199 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1050,7 +1050,6 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( struct of_phandle_args dma_spec;
const u32 *of_serial_dir32; - u8 *of_serial_dir; u32 val; int i, ret = 0;
@@ -1081,32 +1080,21 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( pdata->tdm_slots = val; }
- ret = of_property_read_u32(np, "num-serializer", &val); - if (ret >= 0) - pdata->num_serializer = val; - of_serial_dir32 = of_get_property(np, "serial-dir", &val); val /= sizeof(u32); - if (val != pdata->num_serializer) { - dev_err(&pdev->dev, - "num-serializer(%d) != serial-dir size(%d)\n", - pdata->num_serializer, val); - ret = -EINVAL; - goto nodata; - } - if (of_serial_dir32) { - of_serial_dir = devm_kzalloc(&pdev->dev, - (sizeof(*of_serial_dir) * val), - GFP_KERNEL); + u8 *of_serial_dir = devm_kzalloc(&pdev->dev, + (sizeof(*of_serial_dir) * val), + GFP_KERNEL); if (!of_serial_dir) { ret = -ENOMEM; goto nodata; }
- for (i = 0; i < pdata->num_serializer; i++) + for (i = 0; i < val; i++) of_serial_dir[i] = be32_to_cpup(&of_serial_dir32[i]);
+ pdata->num_serializer = val; pdata->serial_dir = of_serial_dir; }
From: Pantelis Antoniou panto@antoniou-consulting.com
Add missing mcasp entries in the am33xx.dtsi include file.
Signed-off-by: Pantelis Antoniou panto@antoniou-consulting.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am33xx.dtsi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 9ce85e5..22659e7 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -667,5 +667,30 @@ #size-cells = <1>; status = "disabled"; }; + + mcasp0: mcasp@48038000 { + compatible = "ti,omap2-mcasp-audio"; + ti,hwmods = "mcasp0"; + reg = <0x48038000 0x2000>; + interrupts = <80>, <81>; + interrupts-names = "tx", "rx"; + status = "disabled"; + dmas = <&edma 8>, + <&edma 9>; + dma-names = "tx", "rx"; + }; + + mcasp1: mcasp@4803C000 { + compatible = "ti,omap2-mcasp-audio"; + ti,hwmods = "mcasp1"; + reg = <0x4803C000 0x2000>; + interrupts = <82>, <83>; + interrupts-names = "tx", "rx"; + status = "disabled"; + dmas = <&edma 10>, + <&edma 11>; + dma-names = "tx", "rx"; + }; + }; };
This patch adds a second tuple to reg property. The new property tuple describes the memory location for data port registers mapped trough L3 bus on am33xx. The both property tuples are named accordingly in the reg-names property.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am33xx.dtsi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 22659e7..c8ba19e 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -671,7 +671,9 @@ mcasp0: mcasp@48038000 { compatible = "ti,omap2-mcasp-audio"; ti,hwmods = "mcasp0"; - reg = <0x48038000 0x2000>; + reg = <0x48038000 0x2000>, + <0x46400000 0x400000>; + reg-names = "mpu", "dat"; interrupts = <80>, <81>; interrupts-names = "tx", "rx"; status = "disabled"; @@ -683,7 +685,9 @@ mcasp1: mcasp@4803C000 { compatible = "ti,omap2-mcasp-audio"; ti,hwmods = "mcasp1"; - reg = <0x4803C000 0x2000>; + reg = <0x4803C000 0x2000>, + <0x46400000 0x400000>; + reg-names = "mpu", "dat"; interrupts = <82>, <83>; interrupts-names = "tx", "rx"; status = "disabled";
On 10/08/2013 10:36 PM, Jyri Sarha wrote:
This patch adds a second tuple to reg property. The new property tuple describes the memory location for data port registers mapped trough L3 bus on am33xx. The both property tuples are named accordingly in the reg-names property.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com
arch/arm/boot/dts/am33xx.dtsi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 22659e7..c8ba19e 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -671,7 +671,9 @@ mcasp0: mcasp@48038000 { compatible = "ti,omap2-mcasp-audio"; ti,hwmods = "mcasp0";
reg = <0x48038000 0x2000>;
reg = <0x48038000 0x2000>,
<0x46400000 0x400000>;
mcasp0 data port is at 0x46000000. 0x46400000 is for mcasp1.
reg-names = "mpu", "dat"; interrupts = <80>, <81>; interrupts-names = "tx", "rx"; status = "disabled";
@@ -683,7 +685,9 @@ mcasp1: mcasp@4803C000 { compatible = "ti,omap2-mcasp-audio"; ti,hwmods = "mcasp1";
reg = <0x4803C000 0x2000>;
reg = <0x4803C000 0x2000>,
<0x46400000 0x400000>;
reg-names = "mpu", "dat"; interrupts = <82>, <83>; interrupts-names = "tx", "rx"; status = "disabled";
From: Jyri Sarha jsarha@ti.com
This patch adds a second tuple to reg property. The new property tuple describes the memory location for data port registers mapped trough L3 bus on am33xx. The both property tuples are named accordingly in the reg-names property.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am33xx.dtsi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 22659e7..4a86762 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -671,7 +671,9 @@ mcasp0: mcasp@48038000 { compatible = "ti,omap2-mcasp-audio"; ti,hwmods = "mcasp0"; - reg = <0x48038000 0x2000>; + reg = <0x48038000 0x2000>, + <0x46000000 0x400000>; + reg-names = "mpu", "dat"; interrupts = <80>, <81>; interrupts-names = "tx", "rx"; status = "disabled"; @@ -683,7 +685,9 @@ mcasp1: mcasp@4803C000 { compatible = "ti,omap2-mcasp-audio"; ti,hwmods = "mcasp1"; - reg = <0x4803C000 0x2000>; + reg = <0x4803C000 0x2000>, + <0x46400000 0x400000>; + reg-names = "mpu", "dat"; interrupts = <82>, <83>; interrupts-names = "tx", "rx"; status = "disabled";
From: Darren Etheridge detheridge@ti.com
Adds sound, tlv320aic3106, mcasp1, and am335x_evm_audio_pin nodes.
Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am335x-evm.dts | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index e8ec875..1fbae4c 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts @@ -149,6 +149,16 @@ 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7) >; }; + + am335x_evm_audio_pins: am335x_evm_audio_pins { + pinctrl-single,pins = < + 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rx_dv.mcasp1_aclkx */ + 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_txd3.mcasp1_fsx */ + 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */ + 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */ + >; + }; + };
ocp { @@ -244,6 +254,18 @@ compatible = "ti,tmp275"; reg = <0x48>; }; + + tlv320aic3106: tlv320aic3106@1b { + compatible = "ti,tlv320aic3106"; + reg = <0x1b>; + status = "okay"; + + /* Regulators */ + AVDD-supply = <&vaux2_reg>; + IOVDD-supply = <&vaux2_reg>; + DRVDD-supply = <&vaux2_reg>; + DVDD-supply = <&vbat>; + }; };
elm: elm@48080000 { @@ -340,6 +362,19 @@ }; }; }; + + sound { + compatible = "ti,da830-evm-audio"; + ti,model = "AM335x-EVM"; + ti,audio-codec = <&tlv320aic3106>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <12000000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT", + "LINE1L", "Line In", + "LINE1R", "Line In"; + }; };
vbat: fixedregulator@0 { @@ -407,6 +442,25 @@
#include "tps65910.dtsi"
+&mcasp1 { + pinctrl-names = "default"; + pinctrl-0 = <&am335x_evm_audio_pins>; + + status = "okay"; + + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + /* 16 serializer */ + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 0 0 1 2 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + >; + tx-num-evt = <1>; + rx-num-evt = <1>; +}; + &tps { vcc1-supply = <&vbat>; vcc2-supply = <&vbat>;
Hi Jyri,
On 10/08/2013 10:36 PM, Jyri Sarha wrote:
@@ -407,6 +442,25 @@
#include "tps65910.dtsi"
+&mcasp1 {
pinctrl-names = "default";
pinctrl-0 = <&am335x_evm_audio_pins>;
status = "okay";
op-mode = <0>; /* MCASP_IIS_MODE */
tdm-slots = <2>;
/* 16 serializer */
serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
0 0 1 2
0 0 0 0
0 0 0 0
0 0 0 0
>;
The McASP on AM335x have only 4 serializers.
tx-num-evt = <1>;
rx-num-evt = <1>;
+};
&tps { vcc1-supply = <&vbat>; vcc2-supply = <&vbat>;
From: Darren Etheridge detheridge@ti.com
Adds sound, tlv320aic3106, mcasp1, and am335x_evm_audio_pin nodes.
Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am335x-evm.dts | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index e8ec875..0057d89 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts @@ -149,6 +149,16 @@ 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7) >; }; + + am335x_evm_audio_pins: am335x_evm_audio_pins { + pinctrl-single,pins = < + 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rx_dv.mcasp1_aclkx */ + 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_txd3.mcasp1_fsx */ + 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */ + 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */ + >; + }; + };
ocp { @@ -244,6 +254,18 @@ compatible = "ti,tmp275"; reg = <0x48>; }; + + tlv320aic3106: tlv320aic3106@1b { + compatible = "ti,tlv320aic3106"; + reg = <0x1b>; + status = "okay"; + + /* Regulators */ + AVDD-supply = <&vaux2_reg>; + IOVDD-supply = <&vaux2_reg>; + DRVDD-supply = <&vaux2_reg>; + DVDD-supply = <&vbat>; + }; };
elm: elm@48080000 { @@ -340,6 +362,19 @@ }; }; }; + + sound { + compatible = "ti,da830-evm-audio"; + ti,model = "AM335x-EVM"; + ti,audio-codec = <&tlv320aic3106>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <12000000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT", + "LINE1L", "Line In", + "LINE1R", "Line In"; + }; };
vbat: fixedregulator@0 { @@ -407,6 +442,22 @@
#include "tps65910.dtsi"
+&mcasp1 { + pinctrl-names = "default"; + pinctrl-0 = <&am335x_evm_audio_pins>; + + status = "okay"; + + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + /* 16 serializer */ + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 0 0 1 2 + >; + tx-num-evt = <1>; + rx-num-evt = <1>; +}; + &tps { vcc1-supply = <&vbat>; vcc2-supply = <&vbat>;
From: Darren Etheridge detheridge@ti.com
Adds sound, tlv320aic3106, mcasp1, and am335x_evm_audio_pin nodes.
Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am335x-evm.dts | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index e8ec875..814b3e9 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts @@ -149,6 +149,16 @@ 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7) >; }; + + am335x_evm_audio_pins: am335x_evm_audio_pins { + pinctrl-single,pins = < + 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rx_dv.mcasp1_aclkx */ + 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_txd3.mcasp1_fsx */ + 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */ + 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */ + >; + }; + };
ocp { @@ -244,6 +254,18 @@ compatible = "ti,tmp275"; reg = <0x48>; }; + + tlv320aic3106: tlv320aic3106@1b { + compatible = "ti,tlv320aic3106"; + reg = <0x1b>; + status = "okay"; + + /* Regulators */ + AVDD-supply = <&vaux2_reg>; + IOVDD-supply = <&vaux2_reg>; + DRVDD-supply = <&vaux2_reg>; + DVDD-supply = <&vbat>; + }; };
elm: elm@48080000 { @@ -340,6 +362,19 @@ }; }; }; + + sound { + compatible = "ti,da830-evm-audio"; + ti,model = "AM335x-EVM"; + ti,audio-codec = <&tlv320aic3106>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <12000000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT", + "LINE1L", "Line In", + "LINE1R", "Line In"; + }; };
vbat: fixedregulator@0 { @@ -407,6 +442,22 @@
#include "tps65910.dtsi"
+&mcasp1 { + pinctrl-names = "default"; + pinctrl-0 = <&am335x_evm_audio_pins>; + + status = "okay"; + + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + /* 4 serializers */ + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 0 0 1 2 + >; + tx-num-evt = <1>; + rx-num-evt = <1>; +}; + &tps { vcc1-supply = <&vbat>; vcc2-supply = <&vbat>;
The v4 version of patches can be found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067098.htm... The v3 version of patches can be found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066728.h... The v2 version of patches can be found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066379.h... The RFC version of patches can been found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066178.h...
Changes since v4 - Rebased on top of Lunux 3.12-rc5 - Fix mcasp0 dat address in reg propery. - Comment: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067116.htm... - Changes: - [PATCH v4 08/10] ARM/dts: am33xx: mcasp: Add location for data port registers to reg-property - Fix number of serializers for am335x based boards - Comment: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067113.htm... - Changes: - [PATCH v4 09/10] ARM/dts: am335x-evm: Add audio support for am335x-evm.dts - [PATCH v4 10/10] ARM/dts: am335x-evmsk: Audio support - Change davinci-mcasp compatible property model to a more accurate one - Add: [PATCH v5 05/12] arm: omap2plus_defconfig: enable AM33xx SOC EVM audio - Changes: - [PATCH v4 07/10] ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries - Enable AM33xx SOC EVM audio in omap2plus_defconfig - Add: [PATCH v5 12/12] arm: omap2plus_defconfig: enable AM33xx SOC EVM audio - The patch numbers 5-10 have been shifted to 6-11
Changes since v3 - Rebased on top of v3.12-rc4 - Drop already applied patches: - [PATCH v2 01/11] ASoC: davinci-evm: Move sysclk logic away from evm_hw_params - [PATCH v2 06/11] ASoC: davinci: Add support for AM33xx SoC Audio - [PATCH v2 07/11] ASoC: tlv320aic3x: Add regulators to DT bindings document - [PATCH v2 08/11] ASoC: tlv320aic3x: Add codec pins to DT bindings document - Add: ASoC: davinci: Fix AM33xx SoC Audio support - Contains the fixes from Peter: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066448.h... - Contents of this patch were squashed to "[PATCH v3 06/11] ASoC: davinci: Add support for AM33xx SoC Audio", but since the patch v2 was already applied the changes are here as a separate patch. - Add: ASoC: davinci-mcasp: Remove redundant num-serializer DT parameter - Change: ASoC: davinci-mcasp: Add DMA register locations to DT to: ASoC: davinci-mcasp: Add location for data port registers to DT - Use more accurate name for data port register location - Improve commit message - Change: ASoC: davinci-mcasp: Interrupts property to optional and add interrupt-names to: ASoC: davinci-mcasp: Improve DT bindings document - Remove #address-cells and #size-cells - Bracket named interrupts tuples - Add missing "for" to serial-dir description - Improve tdm-slots description - Improve op-mode description - Add pinctrl-names and pinctrl-0 descriptions - Change: ARM/dts: am335x-evm: Add audio support for am335x-evm.dts - Use board specific name 'AM335x-EVM' for the soundcard. - Use the board specific tlv320aic3106 codec. Use this name instead of generic tlv320aic3x. - Remove num-serializer property from mcasp node - Remove blank lines - Change: ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries - Bracket all named property tuples - Add: ARM/dts: am335x-evmsk: Audio support - The other patches in the set not mentioned here are identical to their earlier version
Changes since v2 [PATCH v2 01/11] ASoC: davinci-evm: Move sysclk logic away from evm_hw_params - no change [PATCH v2 02/11] ASoC: davinci-evm: Add device tree binding - no change [PATCH v2 03/11] ASoC: davinci-mcasp: Add DMA register locations to DT - no change [PATCH v2 04/11] ASoC: davinci-mcasp: Extract DMA channels directly from DT - no change [PATCH v2 05/11] ASoC: davinci-mcasp: Remove interrupt property from DT bindin - restore binding but make it optional and add interrupt-names property [PATCH v2 06/11] ASoC: davinci: Add support for AM33xx SoC Audio - SND_DAVINCI_SOC help "Machine driver for ..." -> "Platform driver for ..." - SND_AM33XX_SOC_EVM depends on SND_DAVINCI_SOC && SOC_AM33XX - SND_AM33XX_SOC_EVM does not selcet SND_DAVINCI_SOC [PATCH v2 07/11] ASoC: tlv320aic3x: Add regulators to DT bindings document - no change [PATCH v2 08/11] ASoC: tlv320aic3x: Add codec pins to DT bindings document - no change [PATCH v2 09/11] ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries - restore interrupt property and add interrupt-names property [PATCH v2 10/11] ARM/dts: am33xx: mcasp: Add new dma register location to reg-property - no change [PATCH v2 11/11] ARM/dts: am335x-evm: Add audio support for am335x-evm.dts - no change
Changes from RFC to v2 - Dropped out "ASoC: davinci-mcasp: Add pinctrl support" since driver core is taking care of this now. - Cleanup am33xx audio build - Add regulators to tlv320aic3x DT binding document - Remove dm365-voice-codec-audio DT support as it has never been tested an probably does not work - Add output pins and Line In connector to davinci-evm-audio DT binding doc - Remove asp_chan_q and ram_chan_q properties from mcasp DT node in DT mode mcasp is hardcoded to event queue 0 (highest priority) - Add pins to tlv320aic3x DT bindings document. If I misunderstood Marks comment and this patch is not needed, then just leave it out Changes based on TI internal discussions - Move system clock rate logic away from from evm_hw_params soc-op - Remove unnecesary #if defined(CONFIG_OF) from davinci-evm.c - Make dma property DT binding document more exact - Add only "dma" reg location instead of separate "dma-tx" and "dma-rx" - Primarily look for "mpu" reg property, but fall back to index 0 if not found - Remove interrupt property from mcasp DT node as it is not used - Remove #address-cells and #size-cells mcasp properties as they are not needed
The patch set depends on following patches:
[PATCH v11 4/8] ARM: dts: add AM33XX EDMA support https://lkml.org/lkml/2013/6/18/49
[PATCH v11 5/8] ARM: dts: add AM33XX SPI DMA support https://lkml.org/lkml/2013/6/18/55
[PATCH v2 01/11] ASoC: davinci-evm: Move sysclk logic away from evm_hw_params http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066381.h...
[PATCH v2 06/11] ASoC: davinci: Add support for AM33xx SoC Audio http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066385.h...
This set of patches fixes the basic audio support for am335x-evm and am335x-evmsk. It should be relatively simple to add the necessary nodes to relevant dts files to get BeagleBone + AudioCape working too.
I have tried my best not to break the existing support for older davinci boards, but since I do not have those boards I can not be sure.
Some commit comments refer to a dmaengine based davinci audio implementation which is planned for but nothing has been done yet.
Best regards, Jyri
Darren Etheridge (1): ARM/dts: am335x-evm: Add audio support for am335x-evm.dts
Hebbar, Gururaja (1): ASoC: davinci-evm: Add device tree binding
Jyri Sarha (7): ASoC: davinci: Fix AM33xx SoC Audio support ASoC: davinci-mcasp: Add location for data port registers to DT ASoC: davinci-mcasp: Extract DMA channels directly from DT ASoC: davinci-mcasp: Change compatible property model to more accurate ASoC: davinci-mcasp: Improve DT bindings document ARM/dts: am33xx: mcasp: Add location for data port registers to reg-property arm: omap2plus_defconfig: enable AM33xx SOC EVM audio
Pantelis Antoniou (1): ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries
Peter Ujfalusi (2): ASoC: davinci-mcasp: Remove redundant num-serializer DT parameter ARM/dts: am335x-evmsk: Audio support
.../bindings/sound/davinci-evm-audio.txt | 58 +++++++++ .../bindings/sound/davinci-mcasp-audio.txt | 40 ++++-- arch/arm/boot/dts/am335x-evm.dts | 51 ++++++++ arch/arm/boot/dts/am335x-evmsk.dts | 48 ++++++++ arch/arm/boot/dts/am33xx.dtsi | 29 +++++ arch/arm/configs/omap2plus_defconfig | 2 + include/linux/platform_data/davinci_asp.h | 2 + sound/soc/davinci/Kconfig | 4 +- sound/soc/davinci/davinci-evm.c | 120 +++++++++++++++++- sound/soc/davinci/davinci-mcasp.c | 130 ++++++++++++-------- 10 files changed, 415 insertions(+), 69 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
SND_DAVINCI_SOC is a platform driver for Davinci and AM33XX SoCs, not a machine driver. Make SND_AM33XX_SOC_EVM dependent of SND_DAVINCI_SOC instead of selecting it and add dependecy to SOC_AM33XX.
Signed-off-by: Jyri Sarha jsarha@ti.com --- sound/soc/davinci/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig index 6c8e687..95970f5 100644 --- a/sound/soc/davinci/Kconfig +++ b/sound/soc/davinci/Kconfig @@ -2,7 +2,7 @@ config SND_DAVINCI_SOC tristate "SoC Audio for the TI DAVINCI or AM33XX chip" depends on ARCH_DAVINCI || SOC_AM33XX help - Machine driver for DAVINCI audio. + Platform driver for daVinci or AM33xx Say Y or M if you want to add support for codecs attached to the DAVINCI AC97, I2S, or McASP interface. You will also need to select the audio interfaces to support below. @@ -18,7 +18,7 @@ config SND_DAVINCI_SOC_VCIF
config SND_AM33XX_SOC_EVM tristate "SoC Audio for the AM33XX chip based boards" - select SND_DAVINCI_SOC + depends on SND_DAVINCI_SOC && SOC_AM33XX select SND_SOC_TLV320AIC3X select SND_DAVINCI_SOC_MCASP help
On Fri, Oct 18, 2013 at 06:37:40PM +0300, Jyri Sarha wrote:
SND_DAVINCI_SOC is a platform driver for Davinci and AM33XX SoCs, not a machine driver. Make SND_AM33XX_SOC_EVM dependent of SND_DAVINCI_SOC instead of selecting it and add dependecy to SOC_AM33XX.
This doesn't apply against topic/davinci or -next - can you please check?
On 10/22/2013 03:24 PM, Mark Brown wrote:
On Fri, Oct 18, 2013 at 06:37:40PM +0300, Jyri Sarha wrote:
SND_DAVINCI_SOC is a platform driver for Davinci and AM33XX SoCs, not a machine driver. Make SND_AM33XX_SOC_EVM dependent of SND_DAVINCI_SOC instead of selecting it and add dependecy to SOC_AM33XX.
This doesn't apply against topic/davinci or -next - can you please check?
It seems the "ASoC: davinci: Add support for AM33xx SoC Audio"-patch is missing from the tree. I dropped it from the set because I tought you merged it earlier.
I'll restore the "ASoC: davinci: Add support for AM33xx SoC Audio" -patch to next version of the set and squash this one in to it.
Best regards, Jyri
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
Device tree support for Davinci Machine driver
When the board boots with device tree, the driver will receive card, codec, dai interface details (like the card name, DAPM routing map, phandle for the audio components described in the dts file, codec mclk speed). The card will be set up based on this information. Since the routing is provided via DT we can mark the card fully routed so core can take care of disconnecting the unused pins.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-evm-audio.txt | 58 ++++++++++ sound/soc/davinci/davinci-evm.c | 120 +++++++++++++++++++- 2 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
diff --git a/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt new file mode 100644 index 0000000..e6b61ff --- /dev/null +++ b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt @@ -0,0 +1,58 @@ +* Texas Instruments SoC audio setups with TLV320AIC3X Codec + +Required properties: +- compatible : "ti,da830-evm-audio" : forDM365/DA8xx/OMAPL1x/AM33xx +- ti,model : The user-visible name of this sound complex. +- ti,audio-codec : The phandle of the TLV320AIC3x audio codec +- ti,mcasp-controller : The phandle of the McASP controller +- ti,codec-clock-rate : The Codec Clock rate (in Hz) applied to the Codec +- ti,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 codec's pins, and the jacks on the board: + + TLV320AIC3X pins: + + * LLOUT + * RLOUT + * MONO_LOUT + * HPLOUT + * HPROUT + * HPLCOM + * HPRCOM + * MIC3L + * MIC3R + * LINE1L + * LINE2L + * LINE1R + * LINE2R + + Board connectors: + + * Headphone Jack + * Line Out + * Mic Jack + * Line In + + +Example: + +sound { + compatible = "ti,da830-evm-audio"; + ti,model = "DA830 EVM"; + ti,audio-codec = <&tlv320aic3x>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <12000000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT", + "Line Out", "LLOUT", + "Line Out", "RLOUT", + "MIC3L", "Mic Bias 2V", + "MIC3R", "Mic Bias 2V", + "Mic Bias 2V", "Mic Jack", + "LINE1L", "Line In", + "LINE2L", "Line In", + "LINE1R", "Line In", + "LINE2R", "Line In"; +}; diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 2f8161c..340a68d 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -16,6 +16,7 @@ #include <linux/platform_device.h> #include <linux/platform_data/edma.h> #include <linux/i2c.h> +#include <linux/of_platform.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/soc.h> @@ -23,6 +24,8 @@ #include <asm/dma.h> #include <asm/mach-types.h>
+#include <linux/edma.h> + #include "davinci-pcm.h" #include "davinci-i2s.h" #include "davinci-mcasp.h" @@ -121,13 +124,22 @@ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; + struct device_node *np = codec->card->dev->of_node; + int ret;
/* Add davinci-evm specific widgets */ snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets, ARRAY_SIZE(aic3x_dapm_widgets));
- /* Set up davinci-evm specific audio path audio_map */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); + if (np) { + ret = snd_soc_of_parse_audio_routing(codec->card, + "ti,audio-routing"); + if (ret) + return ret; + } else { + /* Set up davinci-evm specific audio path audio_map */ + snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); + }
/* not connected */ snd_soc_dapm_disable_pin(dapm, "MONO_LOUT"); @@ -312,6 +324,98 @@ static struct snd_soc_card da850_snd_soc_card = { .drvdata = &da850_snd_soc_card_drvdata, };
+#if defined(CONFIG_OF) + +/* + * The struct is used as place holder. It will be completely + * filled with data from dt node. + */ +static struct snd_soc_dai_link evm_dai_tlv320aic3x = { + .name = "TLV320AIC3X", + .stream_name = "AIC3X", + .codec_dai_name = "tlv320aic3x-hifi", + .ops = &evm_ops, + .init = evm_aic3x_init, +}; + +static const struct of_device_id davinci_evm_dt_ids[] = { + { + .compatible = "ti,da830-evm-audio", + .data = (void *) &evm_dai_tlv320aic3x, + }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, davinci_evm_dt_ids); + +/* davinci evm audio machine driver */ +static struct snd_soc_card evm_soc_card = { + .owner = THIS_MODULE, + .num_links = 1, +}; + +static int davinci_evm_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match = + of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev); + struct snd_soc_dai_link *dai = (struct snd_soc_dai_link *) match->data; + struct snd_soc_card_drvdata_davinci *drvdata = NULL; + int ret = 0; + + evm_soc_card.dai_link = dai; + + dai->codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0); + if (!dai->codec_of_node) + return -EINVAL; + + dai->cpu_of_node = of_parse_phandle(np, "ti,mcasp-controller", 0); + if (!dai->cpu_of_node) + return -EINVAL; + + dai->platform_of_node = dai->cpu_of_node; + + evm_soc_card.dev = &pdev->dev; + ret = snd_soc_of_parse_card_name(&evm_soc_card, "ti,model"); + if (ret) + return ret; + + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + ret = of_property_read_u32(np, "ti,codec-clock-rate", &drvdata->sysclk); + if (ret < 0) + return -EINVAL; + + snd_soc_card_set_drvdata(&evm_soc_card, drvdata); + ret = snd_soc_register_card(&evm_soc_card); + + if (ret) + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); + + return ret; +} + +static int davinci_evm_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + + return 0; +} + +static struct platform_driver davinci_evm_driver = { + .probe = davinci_evm_probe, + .remove = davinci_evm_remove, + .driver = { + .name = "davinci_evm", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(davinci_evm_dt_ids), + }, +}; +#endif + static struct platform_device *evm_snd_device;
static int __init evm_init(void) @@ -320,6 +424,13 @@ static int __init evm_init(void) int index; int ret;
+ /* + * If dtb is there, the devices will be created dynamically. + * Only register platfrom driver structure. + */ + if (of_have_populated_dt()) + return platform_driver_register(&davinci_evm_driver); + if (machine_is_davinci_evm()) { evm_snd_dev_data = &dm6446_snd_soc_card_evm; index = 0; @@ -355,6 +466,11 @@ static int __init evm_init(void)
static void __exit evm_exit(void) { + if (of_have_populated_dt()) { + platform_driver_unregister(&davinci_evm_driver); + return; + } + platform_device_unregister(evm_snd_device); }
On Fri, Oct 18, 2013 at 06:37:41PM +0300, Jyri Sarha wrote:
- TLV320AIC3X pins:
- LLOUT
- RLOUT
- MONO_LOUT
- HPLOUT
- HPROUT
- HPLCOM
- HPRCOM
- MIC3L
- MIC3R
- LINE1L
- LINE2L
- LINE1R
- LINE2R
These should be documented in the CODEC binding and not in the card driver, that way this doesn't need to be replicated in every machine and any future software compatible devices can just work with the existing binding.
- ret = snd_soc_register_card(&evm_soc_card);
This should be using devm_snd_soc_register_card().
- /*
* If dtb is there, the devices will be created dynamically.
* Only register platfrom driver structure.
*/
- if (of_have_populated_dt())
return platform_driver_register(&davinci_evm_driver);
Why not register the driver unconditionally?
On 10/22/2013 02:01 PM, Mark Brown wrote:
On Fri, Oct 18, 2013 at 06:37:41PM +0300, Jyri Sarha wrote:
- TLV320AIC3X pins:
...
These should be documented in the CODEC binding and not in the card driver, that way this doesn't need to be replicated in every machine and any future software compatible devices can just work with the existing binding.
Ok, I'll remove the codec pins.
- ret = snd_soc_register_card(&evm_soc_card);
This should be using devm_snd_soc_register_card().
Ok, I'll move on top of your for-next branch and change it.
- /*
* If dtb is there, the devices will be created dynamically.
* Only register platfrom driver structure.
*/
- if (of_have_populated_dt())
return platform_driver_register(&davinci_evm_driver);
Why not register the driver unconditionally?
I am just trying touch the legacy davinci audio support as little as possible. Would registering the driver in non DT mode do some good?
Best regards, Jyri
On Tue, Oct 22, 2013 at 03:26:11PM +0300, Jyri Sarha wrote:
On 10/22/2013 02:01 PM, Mark Brown wrote:
- /*
* If dtb is there, the devices will be created dynamically.
* Only register platfrom driver structure.
*/
- if (of_have_populated_dt())
return platform_driver_register(&davinci_evm_driver);
Why not register the driver unconditionally?
I am just trying touch the legacy davinci audio support as little as possible. Would registering the driver in non DT mode do some good?
It would look a good deal less odd which is useful in itself; the best thing would be if they could both use the same driver which uses both platform and DT data.
On 10/22/2013 03:39 PM, Mark Brown wrote:
It would look a good deal less odd which is useful in itself; the best thing would be if they could both use the same driver which uses both platform and DT data.
I see. To be honest the whole non DT part looks pretty hairy to me too, but I can not clean it up because I do not have access to the relevant HW.
Would it look better to you if I would use module_platform_driver() macro inside #ifdef CONFIG_OF and put the module_init() and module_exit() into #else branch?
Best regards, Jyri
This patch adds a separate register location for data port registers to mcasp DT bindings. On am33xx SoCs the McASP registers are mapped trough L4 interconnect, but data port registers are also mapped trough L3 bus to a different memory location.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 8 ++- sound/soc/davinci/davinci-mcasp.c | 61 +++++++++++++------- 2 files changed, 47 insertions(+), 22 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 374e145..c2ab869 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -6,7 +6,11 @@ Required properties: "ti,da830-mcasp-audio" : for both DA830 & DA850 platforms "ti,omap2-mcasp-audio" : for OMAP2 platforms (TI81xx, AM33xx)
-- reg : Should contain McASP registers offset and length +- reg : Should contain reg specifiers for the entries in the reg-names property. +- reg-names : Should contain: + * "mpu" for the main registers (required). For compatibility with + existing software, it is recommended this is the first entry. + * "dat" for separate data port register access (optional). - interrupts : Interrupt number for McASP - op-mode : I2S/DIT ops mode. - tdm-slots : Slots for TDM operation. @@ -15,7 +19,6 @@ Required properties: to "num-serializer" parameter. Each entry is a number indication serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX)
- Optional properties:
- ti,hwmods : Must be "mcasp<n>", n is controller instance starting 0 @@ -31,6 +34,7 @@ mcasp0: mcasp0@1d00000 { #address-cells = <1>; #size-cells = <0>; reg = <0x100000 0x3000>; + reg-names "mpu"; interrupts = <82 83>; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>; diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 32ddb7f..7fd37ff 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1001,18 +1001,40 @@ static const struct snd_soc_component_driver davinci_mcasp_component = { .name = "davinci-mcasp", };
+/* Some HW specific values and defaults. The rest is filled in from DT. */ +static struct snd_platform_data dm646x_mcasp_pdata = { + .tx_dma_offset = 0x400, + .rx_dma_offset = 0x400, + .asp_chan_q = EVENTQ_0, + .version = MCASP_VERSION_1, +}; + +static struct snd_platform_data da830_mcasp_pdata = { + .tx_dma_offset = 0x2000, + .rx_dma_offset = 0x2000, + .asp_chan_q = EVENTQ_0, + .version = MCASP_VERSION_2, +}; + +static struct snd_platform_data omap2_mcasp_pdata = { + .tx_dma_offset = 0, + .rx_dma_offset = 0, + .asp_chan_q = EVENTQ_0, + .version = MCASP_VERSION_3, +}; + static const struct of_device_id mcasp_dt_ids[] = { { .compatible = "ti,dm646x-mcasp-audio", - .data = (void *)MCASP_VERSION_1, + .data = &dm646x_mcasp_pdata, }, { .compatible = "ti,da830-mcasp-audio", - .data = (void *)MCASP_VERSION_2, + .data = &da830_mcasp_pdata, }, { .compatible = "ti,omap2-mcasp-audio", - .data = (void *)MCASP_VERSION_3, + .data = &omap2_mcasp_pdata, }, { /* sentinel */ } }; @@ -1035,20 +1057,13 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( pdata = pdev->dev.platform_data; return pdata; } else if (match) { - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) { - ret = -ENOMEM; - goto nodata; - } + pdata = (struct snd_platform_data *) match->data; } else { /* control shouldn't reach here. something is wrong */ ret = -EINVAL; goto nodata; }
- if (match->data) - pdata->version = (u8)((int)match->data); - ret = of_property_read_u32(np, "op-mode", &val); if (ret >= 0) pdata->op_mode = val; @@ -1124,7 +1139,7 @@ nodata: static int davinci_mcasp_probe(struct platform_device *pdev) { struct davinci_pcm_dma_params *dma_data; - struct resource *mem, *ioarea, *res; + struct resource *mem, *ioarea, *res, *dat; struct snd_platform_data *pdata; struct davinci_audio_dev *dev; int ret; @@ -1145,10 +1160,15 @@ static int davinci_mcasp_probe(struct platform_device *pdev) return -EINVAL; }
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); if (!mem) { - dev_err(&pdev->dev, "no mem resource?\n"); - return -ENODEV; + dev_warn(dev->dev, + ""mpu" mem resource not found, using index 0\n"); + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!mem) { + dev_err(&pdev->dev, "no mem resource?\n"); + return -ENODEV; + } }
ioarea = devm_request_mem_region(&pdev->dev, mem->start, @@ -1182,13 +1202,16 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dev->rxnumevt = pdata->rxnumevt; dev->dev = &pdev->dev;
+ dat = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dat"); + if (!dat) + dat = mem; + dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; dma_data->asp_chan_q = pdata->asp_chan_q; dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->sram_pool = pdata->sram_pool; dma_data->sram_size = pdata->sram_size_playback; - dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset + - mem->start); + dma_data->dma_addr = dat->start + pdata->tx_dma_offset;
/* first TX, then RX */ res = platform_get_resource(pdev, IORESOURCE_DMA, 0); @@ -1205,8 +1228,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->sram_pool = pdata->sram_pool; dma_data->sram_size = pdata->sram_size_capture; - dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + - mem->start); + dma_data->dma_addr = dat->start + pdata->rx_dma_offset;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!res) { @@ -1266,4 +1288,3 @@ module_platform_driver(davinci_mcasp_driver); MODULE_AUTHOR("Steve Chen"); MODULE_DESCRIPTION("TI DAVINCI McASP SoC Interface"); MODULE_LICENSE("GPL"); -
On Fri, Oct 18, 2013 at 06:37:42PM +0300, Jyri Sarha wrote:
This patch adds a separate register location for data port registers to mcasp DT bindings. On am33xx SoCs the McASP registers are mapped trough L4 interconnect, but data port registers are also mapped trough L3 bus to a different memory location.
Applied, thanks.
Extract DMA channels directly from DT as they can not be found from platform resources anymore. This is a work-around until davinci audio driver is updated to use dmaengine.
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 5 +++ include/linux/platform_data/davinci_asp.h | 2 + sound/soc/davinci/davinci-mcasp.c | 45 ++++++++++++++------ 3 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index c2ab869..c3ccde7 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -18,6 +18,11 @@ Required properties: - serial-dir : A list of serializer pin mode. The list number should be equal to "num-serializer" parameter. Each entry is a number indication serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX) +- dmas: two element list of DMA controller phandles and DMA request line + ordered pairs. +- dma-names: identifier string for each DMA request line in the dmas property. + These strings correspond 1:1 with the ordered pairs in dmas. The dma + identifiers must be "rx" and "tx".
Optional properties:
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h index 8db5ae0..689a856 100644 --- a/include/linux/platform_data/davinci_asp.h +++ b/include/linux/platform_data/davinci_asp.h @@ -84,6 +84,8 @@ struct snd_platform_data { u8 version; u8 txnumevt; u8 rxnumevt; + int tx_dma_channel; + int rx_dma_channel; };
enum { diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 7fd37ff..2583802 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1047,6 +1047,7 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( struct snd_platform_data *pdata = NULL; const struct of_device_id *match = of_match_device(mcasp_dt_ids, &pdev->dev); + struct of_phandle_args dma_spec;
const u32 *of_serial_dir32; u8 *of_serial_dir; @@ -1109,6 +1110,28 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( pdata->serial_dir = of_serial_dir; }
+ ret = of_property_match_string(np, "dma-names", "tx"); + if (ret < 0) + goto nodata; + + ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret, + &dma_spec); + if (ret < 0) + goto nodata; + + pdata->tx_dma_channel = dma_spec.args[0]; + + ret = of_property_match_string(np, "dma-names", "rx"); + if (ret < 0) + goto nodata; + + ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", ret, + &dma_spec); + if (ret < 0) + goto nodata; + + pdata->rx_dma_channel = dma_spec.args[0]; + ret = of_property_read_u32(np, "tx-num-evt", &val); if (ret >= 0) pdata->txnumevt = val; @@ -1213,15 +1236,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->sram_size = pdata->sram_size_playback; dma_data->dma_addr = dat->start + pdata->tx_dma_offset;
- /* first TX, then RX */ res = platform_get_resource(pdev, IORESOURCE_DMA, 0); - if (!res) { - dev_err(&pdev->dev, "no DMA resource\n"); - ret = -ENODEV; - goto err_release_clk; - } - - dma_data->channel = res->start; + if (res) + dma_data->channel = res->start; + else + dma_data->channel = pdata->tx_dma_channel;
dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]; dma_data->asp_chan_q = pdata->asp_chan_q; @@ -1231,13 +1250,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dma_data->dma_addr = dat->start + pdata->rx_dma_offset;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1); - if (!res) { - dev_err(&pdev->dev, "no DMA resource\n"); - ret = -ENODEV; - goto err_release_clk; - } + if (res) + dma_data->channel = res->start; + else + dma_data->channel = pdata->rx_dma_channel;
- dma_data->channel = res->start; dev_set_drvdata(&pdev->dev, dev); ret = snd_soc_register_component(&pdev->dev, &davinci_mcasp_component, &davinci_mcasp_dai[pdata->op_mode], 1);
On Fri, Oct 18, 2013 at 06:37:43PM +0300, Jyri Sarha wrote:
Extract DMA channels directly from DT as they can not be found from platform resources anymore. This is a work-around until davinci audio driver is updated to use dmaengine.
Applied, thanks.
Change the model omap2-mcasp-audio in compatible property to am33xx-mcasp-audio as omap2 does not have mcasp.
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 2 +- sound/soc/davinci/davinci-mcasp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index c3ccde7..1945aec 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -4,7 +4,7 @@ Required properties: - compatible : "ti,dm646x-mcasp-audio" : for DM646x platforms "ti,da830-mcasp-audio" : for both DA830 & DA850 platforms - "ti,omap2-mcasp-audio" : for OMAP2 platforms (TI81xx, AM33xx) + "ti,am33xx-mcasp-audio" : for AM33xx platforms (AM33xx, TI81xx)
- reg : Should contain reg specifiers for the entries in the reg-names property. - reg-names : Should contain: diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 2583802..08cceaf 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1033,7 +1033,7 @@ static const struct of_device_id mcasp_dt_ids[] = { .data = &da830_mcasp_pdata, }, { - .compatible = "ti,omap2-mcasp-audio", + .compatible = "ti,am33xx-mcasp-audio", .data = &omap2_mcasp_pdata, }, { /* sentinel */ }
On Fri, Oct 18, 2013 at 06:37:44PM +0300, Jyri Sarha wrote:
Change the model omap2-mcasp-audio in compatible property to am33xx-mcasp-audio as omap2 does not have mcasp.
Applied, thanks.
Makes interrupts property optional as the interrupts are not currently used by the driver and adds interrupt-names property to name listed interrupts. Currently know interrupt names are "tx" and "rx".
- Improve tdm-slots propery description
- Improve op-mode property description
- Add pinctrl-names and pinctrl-0 properties
- Remove #address-cells and #size-cells as they are not needed.
- Bracket named interrupts property tuples for uniformity.
- Add missing "for" to serial-dir prop in DT bindings doc.
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 24 ++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 1945aec..b925bf9 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -11,13 +11,14 @@ Required properties: * "mpu" for the main registers (required). For compatibility with existing software, it is recommended this is the first entry. * "dat" for separate data port register access (optional). -- interrupts : Interrupt number for McASP -- op-mode : I2S/DIT ops mode. -- tdm-slots : Slots for TDM operation. +- op-mode : I2S/DIT ops mode. 0 for I2S mode. 1 for DIT mode used for S/PDIF, + IEC60958-1, and AES-3 formats. +- tdm-slots : Slots for TDM operation. Indicates number of channels transmitted + or received over one serializer. - num-serializer : Serializers used by McASP. -- serial-dir : A list of serializer pin mode. The list number should be equal - to "num-serializer" parameter. Each entry is a number indication - serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX) +- serial-dir : A list of serializer configuration. Each entry is a number + indication for serializer pin direction. + (0 - INACTIVE, 1 - TX, 2 - RX) - dmas: two element list of DMA controller phandles and DMA request line ordered pairs. - dma-names: identifier string for each DMA request line in the dmas property. @@ -31,16 +32,21 @@ Optional properties: - rx-num-evt : FIFO levels. - sram-size-playback : size of sram to be allocated during playback - sram-size-capture : size of sram to be allocated during capture +- interrupts : Interrupt numbers for McASP, currently not used by the driver +- interrupt-names : Known interrupt names are "tx" and "rx" +- pinctrl-0: Should specify pin control group used for this controller. +- pinctrl-names: Should contain only one value - "default", for more details + please refer to pinctrl-bindings.txt +
Example:
mcasp0: mcasp0@1d00000 { compatible = "ti,da830-mcasp-audio"; - #address-cells = <1>; - #size-cells = <0>; reg = <0x100000 0x3000>; reg-names "mpu"; - interrupts = <82 83>; + interrupts = <82>, <83>; + interrupts-names = "tx", "rx"; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>; num-serializer = <16>;
On Fri, Oct 18, 2013 at 06:37:45PM +0300, Jyri Sarha wrote:
Makes interrupts property optional as the interrupts are not currently used by the driver and adds interrupt-names property to name listed interrupts. Currently know interrupt names are "tx" and "rx".
Applied, thanks.
From: Peter Ujfalusi peter.ujfalusi@ti.com
The serial-dir array gives this information so there is no need to have the num-serializer property in DT description. Just ignore the property in the driver the DTS files can be updated separately without regression. Update the documentation at the same time for davinci-mcasp
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 1 - sound/soc/davinci/davinci-mcasp.c | 22 +++++--------------- 2 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index b925bf9..0aa416b 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -49,7 +49,6 @@ mcasp0: mcasp0@1d00000 { interrupts-names = "tx", "rx"; op-mode = <0>; /* MCASP_IIS_MODE */ tdm-slots = <2>; - num-serializer = <16>; serial-dir = < 0 0 0 0 /* 0: INACTIVE, 1: TX, 2: RX */ 0 0 0 0 diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 08cceaf..8869cac 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1050,7 +1050,6 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( struct of_phandle_args dma_spec;
const u32 *of_serial_dir32; - u8 *of_serial_dir; u32 val; int i, ret = 0;
@@ -1081,32 +1080,21 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of( pdata->tdm_slots = val; }
- ret = of_property_read_u32(np, "num-serializer", &val); - if (ret >= 0) - pdata->num_serializer = val; - of_serial_dir32 = of_get_property(np, "serial-dir", &val); val /= sizeof(u32); - if (val != pdata->num_serializer) { - dev_err(&pdev->dev, - "num-serializer(%d) != serial-dir size(%d)\n", - pdata->num_serializer, val); - ret = -EINVAL; - goto nodata; - } - if (of_serial_dir32) { - of_serial_dir = devm_kzalloc(&pdev->dev, - (sizeof(*of_serial_dir) * val), - GFP_KERNEL); + u8 *of_serial_dir = devm_kzalloc(&pdev->dev, + (sizeof(*of_serial_dir) * val), + GFP_KERNEL); if (!of_serial_dir) { ret = -ENOMEM; goto nodata; }
- for (i = 0; i < pdata->num_serializer; i++) + for (i = 0; i < val; i++) of_serial_dir[i] = be32_to_cpup(&of_serial_dir32[i]);
+ pdata->num_serializer = val; pdata->serial_dir = of_serial_dir; }
On Fri, Oct 18, 2013 at 06:37:46PM +0300, Jyri Sarha wrote:
From: Peter Ujfalusi peter.ujfalusi@ti.com
The serial-dir array gives this information so there is no need to have the num-serializer property in DT description. Just ignore the property in the driver the DTS files can be updated separately without regression. Update the documentation at the same time for davinci-mcasp
Applied, thanks.
From: Pantelis Antoniou panto@antoniou-consulting.com
Add missing mcasp entries in the am33xx.dtsi include file.
Signed-off-by: Pantelis Antoniou panto@antoniou-consulting.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am33xx.dtsi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 9ce85e5..72c416d 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -667,5 +667,30 @@ #size-cells = <1>; status = "disabled"; }; + + mcasp0: mcasp@48038000 { + compatible = "ti,am33xx-mcasp-audio"; + ti,hwmods = "mcasp0"; + reg = <0x48038000 0x2000>; + interrupts = <80>, <81>; + interrupts-names = "tx", "rx"; + status = "disabled"; + dmas = <&edma 8>, + <&edma 9>; + dma-names = "tx", "rx"; + }; + + mcasp1: mcasp@4803C000 { + compatible = "ti,am33xx-mcasp-audio"; + ti,hwmods = "mcasp1"; + reg = <0x4803C000 0x2000>; + interrupts = <82>, <83>; + interrupts-names = "tx", "rx"; + status = "disabled"; + dmas = <&edma 10>, + <&edma 11>; + dma-names = "tx", "rx"; + }; + }; };
This patch adds a second tuple to reg property. The new property tuple describes the memory location for data port registers mapped trough L3 bus on am33xx. The both property tuples are named accordingly in the reg-names property.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am33xx.dtsi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 72c416d..b1d2d3f 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -671,7 +671,9 @@ mcasp0: mcasp@48038000 { compatible = "ti,am33xx-mcasp-audio"; ti,hwmods = "mcasp0"; - reg = <0x48038000 0x2000>; + reg = <0x48038000 0x2000>, + <0x46000000 0x400000>; + reg-names = "mpu", "dat"; interrupts = <80>, <81>; interrupts-names = "tx", "rx"; status = "disabled"; @@ -683,7 +685,9 @@ mcasp1: mcasp@4803C000 { compatible = "ti,am33xx-mcasp-audio"; ti,hwmods = "mcasp1"; - reg = <0x4803C000 0x2000>; + reg = <0x4803C000 0x2000>, + <0x46400000 0x400000>; + reg-names = "mpu", "dat"; interrupts = <82>, <83>; interrupts-names = "tx", "rx"; status = "disabled";
From: Darren Etheridge detheridge@ti.com
Adds sound, tlv320aic3106, mcasp1, and am335x_evm_audio_pin nodes.
Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am335x-evm.dts | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index e8ec875..814b3e9 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts @@ -149,6 +149,16 @@ 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7) >; }; + + am335x_evm_audio_pins: am335x_evm_audio_pins { + pinctrl-single,pins = < + 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rx_dv.mcasp1_aclkx */ + 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_txd3.mcasp1_fsx */ + 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */ + 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */ + >; + }; + };
ocp { @@ -244,6 +254,18 @@ compatible = "ti,tmp275"; reg = <0x48>; }; + + tlv320aic3106: tlv320aic3106@1b { + compatible = "ti,tlv320aic3106"; + reg = <0x1b>; + status = "okay"; + + /* Regulators */ + AVDD-supply = <&vaux2_reg>; + IOVDD-supply = <&vaux2_reg>; + DRVDD-supply = <&vaux2_reg>; + DVDD-supply = <&vbat>; + }; };
elm: elm@48080000 { @@ -340,6 +362,19 @@ }; }; }; + + sound { + compatible = "ti,da830-evm-audio"; + ti,model = "AM335x-EVM"; + ti,audio-codec = <&tlv320aic3106>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <12000000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT", + "LINE1L", "Line In", + "LINE1R", "Line In"; + }; };
vbat: fixedregulator@0 { @@ -407,6 +442,22 @@
#include "tps65910.dtsi"
+&mcasp1 { + pinctrl-names = "default"; + pinctrl-0 = <&am335x_evm_audio_pins>; + + status = "okay"; + + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + /* 4 serializers */ + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 0 0 1 2 + >; + tx-num-evt = <1>; + rx-num-evt = <1>; +}; + &tps { vcc1-supply = <&vbat>; vcc2-supply = <&vbat>;
From: Peter Ujfalusi peter.ujfalusi@ti.com
AM335x EVM-SK have only support for audio playback (stereo jack on the board) via tlv320aic3106 codec connected to McASP1. Enable the support for audio playback on the board: - McASP1 configuration - tlv320aic3106 configuration - Machine driver.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am335x-evmsk.dts | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts index 4f339fa..9e570fb 100644 --- a/arch/arm/boot/dts/am335x-evmsk.dts +++ b/arch/arm/boot/dts/am335x-evmsk.dts @@ -158,6 +158,15 @@ 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7) >; }; + + mcasp1_pins: mcasp1_pins { + pinctrl-single,pins = < + 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_crs.mcasp1_aclkx */ + 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rxerr.mcasp1_fsx */ + 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */ + 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */ + >; + }; };
ocp { @@ -206,6 +215,18 @@ st,max-limit-y = <550>; st,max-limit-z = <750>; }; + + tlv320aic3106: tlv320aic3106@1b { + compatible = "ti,tlv320aic3106"; + reg = <0x1b>; + status = "okay"; + + /* Regulators */ + AVDD-supply = <&vaux2_reg>; + IOVDD-supply = <&vaux2_reg>; + DRVDD-supply = <&vaux2_reg>; + DVDD-supply = <&vbat>; + }; };
musb: usb@47400000 { @@ -233,6 +254,17 @@ pinctrl-0 = <&ecap2_pins>; }; }; + + sound { + compatible = "ti,da830-evm-audio"; + ti,model = "AM335x-EVMSK"; + ti,audio-codec = <&tlv320aic3106>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <24576000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT"; + }; };
vbat: fixedregulator@0 { @@ -419,3 +451,19 @@ phy_id = <&davinci_mdio>, <1>; phy-mode = "rgmii-txid"; }; + +&mcasp1 { + pinctrl-names = "default"; + pinctrl-0 = <&mcasp1_pins>; + + status = "okay"; + + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + /* 4 serializers */ + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 0 0 1 2 + >; + tx-num-evt = <1>; + rx-num-evt = <1>; +};
Modifying the omap2plus_defconfig to enable the audio support for AM335x EVM and other AM33xx based devices with TLV320AIC3X connected to McASP.
Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/configs/omap2plus_defconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index 254cf05..4443b92 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig @@ -210,6 +210,8 @@ CONFIG_SND_DEBUG=y CONFIG_SND_USB_AUDIO=m CONFIG_SND_SOC=m CONFIG_SND_OMAP_SOC=m +CONFIG_SND_AM33XX_SOC_EVM=m +CONFIG_SND_DAVINCI_SOC=m CONFIG_SND_OMAP_SOC_OMAP_TWL4030=m CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=m CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m
+ Tony
Hi Jyri,
The DTS part looks fine to me, but does not apply at all on my branch,
Could you rebase it and repost it without the driver part to avoid any issue during the driver merge?
Thanks, Benoit
On 18/10/2013 17:37, Jyri Sarha wrote:
The v4 version of patches can be found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067098.htm... The v3 version of patches can be found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066728.h... The v2 version of patches can be found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066379.h... The RFC version of patches can been found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066178.h...
Changes since v4 - Rebased on top of Lunux 3.12-rc5 - Fix mcasp0 dat address in reg propery. - Comment: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067116.htm... - Changes: - [PATCH v4 08/10] ARM/dts: am33xx: mcasp: Add location for data port registers to reg-property - Fix number of serializers for am335x based boards - Comment: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067113.htm... - Changes: - [PATCH v4 09/10] ARM/dts: am335x-evm: Add audio support for am335x-evm.dts - [PATCH v4 10/10] ARM/dts: am335x-evmsk: Audio support - Change davinci-mcasp compatible property model to a more accurate one - Add: [PATCH v5 05/12] arm: omap2plus_defconfig: enable AM33xx SOC EVM audio - Changes: - [PATCH v4 07/10] ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries - Enable AM33xx SOC EVM audio in omap2plus_defconfig - Add: [PATCH v5 12/12] arm: omap2plus_defconfig: enable AM33xx SOC EVM audio - The patch numbers 5-10 have been shifted to 6-11
Changes since v3
- Rebased on top of v3.12-rc4
- Drop already applied patches:
- [PATCH v2 01/11] ASoC: davinci-evm: Move sysclk logic away from evm_hw_params
- [PATCH v2 06/11] ASoC: davinci: Add support for AM33xx SoC Audio
- [PATCH v2 07/11] ASoC: tlv320aic3x: Add regulators to DT bindings document
- [PATCH v2 08/11] ASoC: tlv320aic3x: Add codec pins to DT bindings document
- Add: ASoC: davinci: Fix AM33xx SoC Audio support
- Contains the fixes from Peter: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066448.h...
- Contents of this patch were squashed to "[PATCH v3 06/11] ASoC: davinci: Add support for AM33xx SoC Audio", but since the patch v2 was already applied the changes are here as a separate patch.
- Add: ASoC: davinci-mcasp: Remove redundant num-serializer DT parameter
- Change: ASoC: davinci-mcasp: Add DMA register locations to DT to: ASoC: davinci-mcasp: Add location for data port registers to DT
- Use more accurate name for data port register location
- Improve commit message
- Change: ASoC: davinci-mcasp: Interrupts property to optional and add interrupt-names to: ASoC: davinci-mcasp: Improve DT bindings document
- Remove #address-cells and #size-cells
- Bracket named interrupts tuples
- Add missing "for" to serial-dir description
- Improve tdm-slots description
- Improve op-mode description
- Add pinctrl-names and pinctrl-0 descriptions
- Change: ARM/dts: am335x-evm: Add audio support for am335x-evm.dts
- Use board specific name 'AM335x-EVM' for the soundcard.
- Use the board specific tlv320aic3106 codec. Use this name instead of generic tlv320aic3x.
- Remove num-serializer property from mcasp node
- Remove blank lines
- Change: ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries
- Bracket all named property tuples
- Add: ARM/dts: am335x-evmsk: Audio support
- The other patches in the set not mentioned here are identical to their earlier version
Changes since v2 [PATCH v2 01/11] ASoC: davinci-evm: Move sysclk logic away from evm_hw_params - no change [PATCH v2 02/11] ASoC: davinci-evm: Add device tree binding - no change [PATCH v2 03/11] ASoC: davinci-mcasp: Add DMA register locations to DT - no change [PATCH v2 04/11] ASoC: davinci-mcasp: Extract DMA channels directly from DT - no change [PATCH v2 05/11] ASoC: davinci-mcasp: Remove interrupt property from DT bindin - restore binding but make it optional and add interrupt-names property [PATCH v2 06/11] ASoC: davinci: Add support for AM33xx SoC Audio - SND_DAVINCI_SOC help "Machine driver for ..." -> "Platform driver for ..." - SND_AM33XX_SOC_EVM depends on SND_DAVINCI_SOC && SOC_AM33XX - SND_AM33XX_SOC_EVM does not selcet SND_DAVINCI_SOC [PATCH v2 07/11] ASoC: tlv320aic3x: Add regulators to DT bindings document - no change [PATCH v2 08/11] ASoC: tlv320aic3x: Add codec pins to DT bindings document - no change [PATCH v2 09/11] ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries - restore interrupt property and add interrupt-names property [PATCH v2 10/11] ARM/dts: am33xx: mcasp: Add new dma register location to reg-property - no change [PATCH v2 11/11] ARM/dts: am335x-evm: Add audio support for am335x-evm.dts - no change
Changes from RFC to v2
- Dropped out "ASoC: davinci-mcasp: Add pinctrl support" since driver core is taking care of this now.
- Cleanup am33xx audio build
- Add regulators to tlv320aic3x DT binding document
- Remove dm365-voice-codec-audio DT support as it has never been tested an probably does not work
- Add output pins and Line In connector to davinci-evm-audio DT binding doc
- Remove asp_chan_q and ram_chan_q properties from mcasp DT node in DT mode mcasp is hardcoded to event queue 0 (highest priority)
- Add pins to tlv320aic3x DT bindings document. If I misunderstood Marks comment and this patch is not needed, then just leave it out
Changes based on TI internal discussions
- Move system clock rate logic away from from evm_hw_params soc-op
- Remove unnecesary #if defined(CONFIG_OF) from davinci-evm.c
- Make dma property DT binding document more exact
- Add only "dma" reg location instead of separate "dma-tx" and "dma-rx"
- Primarily look for "mpu" reg property, but fall back to index 0 if not found
- Remove interrupt property from mcasp DT node as it is not used
- Remove #address-cells and #size-cells mcasp properties as they are not needed
The patch set depends on following patches:
[PATCH v11 4/8] ARM: dts: add AM33XX EDMA support https://lkml.org/lkml/2013/6/18/49
[PATCH v11 5/8] ARM: dts: add AM33XX SPI DMA support https://lkml.org/lkml/2013/6/18/55
[PATCH v2 01/11] ASoC: davinci-evm: Move sysclk logic away from evm_hw_params http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066381.h...
[PATCH v2 06/11] ASoC: davinci: Add support for AM33xx SoC Audio http://mailman.alsa-project.org/pipermail/alsa-devel/2013-September/066385.h...
This set of patches fixes the basic audio support for am335x-evm and am335x-evmsk. It should be relatively simple to add the necessary nodes to relevant dts files to get BeagleBone + AudioCape working too.
I have tried my best not to break the existing support for older davinci boards, but since I do not have those boards I can not be sure.
Some commit comments refer to a dmaengine based davinci audio implementation which is planned for but nothing has been done yet.
Best regards, Jyri
Darren Etheridge (1): ARM/dts: am335x-evm: Add audio support for am335x-evm.dts
Hebbar, Gururaja (1): ASoC: davinci-evm: Add device tree binding
Jyri Sarha (7): ASoC: davinci: Fix AM33xx SoC Audio support ASoC: davinci-mcasp: Add location for data port registers to DT ASoC: davinci-mcasp: Extract DMA channels directly from DT ASoC: davinci-mcasp: Change compatible property model to more accurate ASoC: davinci-mcasp: Improve DT bindings document ARM/dts: am33xx: mcasp: Add location for data port registers to reg-property arm: omap2plus_defconfig: enable AM33xx SOC EVM audio
Pantelis Antoniou (1): ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries
Peter Ujfalusi (2): ASoC: davinci-mcasp: Remove redundant num-serializer DT parameter ARM/dts: am335x-evmsk: Audio support
.../bindings/sound/davinci-evm-audio.txt | 58 +++++++++ .../bindings/sound/davinci-mcasp-audio.txt | 40 ++++-- arch/arm/boot/dts/am335x-evm.dts | 51 ++++++++ arch/arm/boot/dts/am335x-evmsk.dts | 48 ++++++++ arch/arm/boot/dts/am33xx.dtsi | 29 +++++ arch/arm/configs/omap2plus_defconfig | 2 + include/linux/platform_data/davinci_asp.h | 2 + sound/soc/davinci/Kconfig | 4 +- sound/soc/davinci/davinci-evm.c | 120 +++++++++++++++++- sound/soc/davinci/davinci-mcasp.c | 130 ++++++++++++-------- 10 files changed, 415 insertions(+), 69 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
Hi Benoit, I rebased the DTS patches on top of git://git.kernel.org/pub/scm/linux/kernel/git/bcousson/linux-omap-dt.git for_3.13/dts -branch and tested the result. Hope that was the right branch.
The DTS patches can also be pulled from: git://git.ti.com/~jyrisarha/ti-linux-kernel/jyrisarhas-audio-video-linux-feature-tree.git for_bcousson/for_3.13/dts -branch
The non DTS patches rebased on top of v3.12-rc5 can be pulled from here: git://git.ti.com/~jyrisarha/ti-linux-kernel/jyrisarhas-audio-video-linux-feature-tree.git v3.12-rc5-am33xx-audio-patch-v5-no-dts -branch
The the full patch series can be found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067443.htm...
Best regards, Jyri
Darren Etheridge (1): ARM/dts: am335x-evm: Add audio support for am335x-evm.dts
Jyri Sarha (1): ARM/dts: am33xx: mcasp: Add location for data port registers to reg-property
Pantelis Antoniou (1): ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries
Peter Ujfalusi (1): ARM/dts: am335x-evmsk: Audio support
arch/arm/boot/dts/am335x-evm.dts | 50 ++++++++++++++++++++++++++++++++++++ arch/arm/boot/dts/am335x-evmsk.dts | 48 ++++++++++++++++++++++++++++++++++ arch/arm/boot/dts/am33xx.dtsi | 28 ++++++++++++++++++++ 3 files changed, 126 insertions(+)
From: Pantelis Antoniou panto@antoniou-consulting.com
Add missing mcasp entries in the am33xx.dtsi include file.
Signed-off-by: Pantelis Antoniou panto@antoniou-consulting.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am33xx.dtsi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 58cf5b9..861382f 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -742,5 +742,29 @@ <&edma 5>; dma-names = "tx", "rx"; }; + + mcasp0: mcasp@48038000 { + compatible = "ti,am33xx-mcasp-audio"; + ti,hwmods = "mcasp0"; + reg = <0x48038000 0x2000>; + interrupts = <80>, <81>; + interrupts-names = "tx", "rx"; + status = "disabled"; + dmas = <&edma 8>, + <&edma 9>; + dma-names = "tx", "rx"; + }; + + mcasp1: mcasp@4803C000 { + compatible = "ti,am33xx-mcasp-audio"; + ti,hwmods = "mcasp1"; + reg = <0x4803C000 0x2000>; + interrupts = <82>, <83>; + interrupts-names = "tx", "rx"; + status = "disabled"; + dmas = <&edma 10>, + <&edma 11>; + dma-names = "tx", "rx"; + }; }; };
This patch adds a second tuple to reg property. The new property tuple describes the memory location for data port registers mapped trough L3 bus on am33xx. The both property tuples are named accordingly in the reg-names property.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am33xx.dtsi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 861382f..3465d4b 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -746,7 +746,9 @@ mcasp0: mcasp@48038000 { compatible = "ti,am33xx-mcasp-audio"; ti,hwmods = "mcasp0"; - reg = <0x48038000 0x2000>; + reg = <0x48038000 0x2000>, + <0x46000000 0x400000>; + reg-names = "mpu", "dat"; interrupts = <80>, <81>; interrupts-names = "tx", "rx"; status = "disabled"; @@ -758,7 +760,9 @@ mcasp1: mcasp@4803C000 { compatible = "ti,am33xx-mcasp-audio"; ti,hwmods = "mcasp1"; - reg = <0x4803C000 0x2000>; + reg = <0x4803C000 0x2000>, + <0x46400000 0x400000>; + reg-names = "mpu", "dat"; interrupts = <82>, <83>; interrupts-names = "tx", "rx"; status = "disabled";
From: Darren Etheridge detheridge@ti.com
Adds sound, tlv320aic3106, mcasp1, and am335x_evm_audio_pin nodes.
Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am335x-evm.dts | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index eabacf9..9874294 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts @@ -119,6 +119,19 @@ }; }; }; + + sound { + compatible = "ti,da830-evm-audio"; + ti,model = "AM335x-EVM"; + ti,audio-codec = <&tlv320aic3106>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <12000000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT", + "LINE1L", "Line In", + "LINE1R", "Line In"; + }; };
&am33xx_pinmux { @@ -279,6 +292,15 @@ 0xec 0x00 /* lcd_ac_bias_en.lcd_ac_bias_en, OUTPUT | MODE0 */ >; }; + + am335x_evm_audio_pins: am335x_evm_audio_pins { + pinctrl-single,pins = < + 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rx_dv.mcasp1_aclkx */ + 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_txd3.mcasp1_fsx */ + 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */ + 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */ + >; + }; };
&uart0 { @@ -373,6 +395,18 @@ compatible = "ti,tmp275"; reg = <0x48>; }; + + tlv320aic3106: tlv320aic3106@1b { + compatible = "ti,tlv320aic3106"; + reg = <0x1b>; + status = "okay"; + + /* Regulators */ + AVDD-supply = <&vaux2_reg>; + IOVDD-supply = <&vaux2_reg>; + DRVDD-supply = <&vaux2_reg>; + DVDD-supply = <&vbat>; + }; };
&lcdc { @@ -476,6 +510,22 @@
#include "tps65910.dtsi"
+&mcasp1 { + pinctrl-names = "default"; + pinctrl-0 = <&am335x_evm_audio_pins>; + + status = "okay"; + + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + /* 4 serializers */ + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 0 0 1 2 + >; + tx-num-evt = <1>; + rx-num-evt = <1>; +}; + &tps { vcc1-supply = <&vbat>; vcc2-supply = <&vbat>;
From: Peter Ujfalusi peter.ujfalusi@ti.com
AM335x EVM-SK have only support for audio playback (stereo jack on the board) via tlv320aic3106 codec connected to McASP1. Enable the support for audio playback on the board: - McASP1 configuration - tlv320aic3106 configuration - Machine driver.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am335x-evmsk.dts | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts index 1a7e0d9..03febf8 100644 --- a/arch/arm/boot/dts/am335x-evmsk.dts +++ b/arch/arm/boot/dts/am335x-evmsk.dts @@ -115,6 +115,17 @@ brightness-levels = <0 58 61 66 75 90 125 170 255>; default-brightness-level = <8>; }; + + sound { + compatible = "ti,da830-evm-audio"; + ti,model = "AM335x-EVMSK"; + ti,audio-codec = <&tlv320aic3106>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <24576000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT"; + }; };
&am33xx_pinmux { @@ -244,6 +255,15 @@ 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7) >; }; + + mcasp1_pins: mcasp1_pins { + pinctrl-single,pins = < + 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_crs.mcasp1_aclkx */ + 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rxerr.mcasp1_fsx */ + 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */ + 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */ + >; + }; };
&uart0 { @@ -291,6 +311,18 @@ st,max-limit-y = <550>; st,max-limit-z = <750>; }; + + tlv320aic3106: tlv320aic3106@1b { + compatible = "ti,tlv320aic3106"; + reg = <0x1b>; + status = "okay"; + + /* Regulators */ + AVDD-supply = <&vaux2_reg>; + IOVDD-supply = <&vaux2_reg>; + DRVDD-supply = <&vaux2_reg>; + DVDD-supply = <&vbat>; + }; };
&usb { @@ -437,3 +469,19 @@ &gpio0 { ti,no-reset-on-init; }; + +&mcasp1 { + pinctrl-names = "default"; + pinctrl-0 = <&mcasp1_pins>; + + status = "okay"; + + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + /* 4 serializers */ + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 0 0 1 2 + >; + tx-num-evt = <1>; + rx-num-evt = <1>; +};
Hi Jyri,
On 20/10/2013 19:04, Jyri Sarha wrote:
Hi Benoit, I rebased the DTS patches on top of git://git.kernel.org/pub/scm/linux/kernel/git/bcousson/linux-omap-dt.git for_3.13/dts -branch and tested the result. Hope that was the right branch.
Yes, thanks for the update.
I've just applied the patches.
Regards, Benoit
The DTS patches can also be pulled from: git://git.ti.com/~jyrisarha/ti-linux-kernel/jyrisarhas-audio-video-linux-feature-tree.git for_bcousson/for_3.13/dts -branch
The non DTS patches rebased on top of v3.12-rc5 can be pulled from here: git://git.ti.com/~jyrisarha/ti-linux-kernel/jyrisarhas-audio-video-linux-feature-tree.git v3.12-rc5-am33xx-audio-patch-v5-no-dts -branch
The the full patch series can be found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067443.htm...
Best regards, Jyri
Darren Etheridge (1): ARM/dts: am335x-evm: Add audio support for am335x-evm.dts
Jyri Sarha (1): ARM/dts: am33xx: mcasp: Add location for data port registers to reg-property
Pantelis Antoniou (1): ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree entries
Peter Ujfalusi (1): ARM/dts: am335x-evmsk: Audio support
arch/arm/boot/dts/am335x-evm.dts | 50 ++++++++++++++++++++++++++++++++++++ arch/arm/boot/dts/am335x-evmsk.dts | 48 ++++++++++++++++++++++++++++++++++ arch/arm/boot/dts/am33xx.dtsi | 28 ++++++++++++++++++++ 3 files changed, 126 insertions(+)
From: Peter Ujfalusi peter.ujfalusi@ti.com
AM335x EVM-SK have only support for audio playback (stereo jack on the board) via tlv320aic3106 codec connected to McASP1. Enable the support for audio playback on the board: - McASP1 configuration - tlv320aic3106 configuration - Machine driver.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am335x-evmsk.dts | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts index 4f339fa..27aa42f 100644 --- a/arch/arm/boot/dts/am335x-evmsk.dts +++ b/arch/arm/boot/dts/am335x-evmsk.dts @@ -158,6 +158,15 @@ 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7) >; }; + + mcasp1_pins: mcasp1_pins { + pinctrl-single,pins = < + 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_crs.mcasp1_aclkx */ + 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rxerr.mcasp1_fsx */ + 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */ + 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */ + >; + }; };
ocp { @@ -206,6 +215,18 @@ st,max-limit-y = <550>; st,max-limit-z = <750>; }; + + tlv320aic3106: tlv320aic3106@1b { + compatible = "ti,tlv320aic3106"; + reg = <0x1b>; + status = "okay"; + + /* Regulators */ + AVDD-supply = <&vaux2_reg>; + IOVDD-supply = <&vaux2_reg>; + DRVDD-supply = <&vaux2_reg>; + DVDD-supply = <&vbat>; + }; };
musb: usb@47400000 { @@ -233,6 +254,17 @@ pinctrl-0 = <&ecap2_pins>; }; }; + + sound { + compatible = "ti,da830-evm-audio"; + ti,model = "AM335x-EVMSK"; + ti,audio-codec = <&tlv320aic3106>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <24576000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT"; + }; };
vbat: fixedregulator@0 { @@ -419,3 +451,22 @@ phy_id = <&davinci_mdio>, <1>; phy-mode = "rgmii-txid"; }; + +&mcasp1 { + pinctrl-names = "default"; + pinctrl-0 = <&mcasp1_pins>; + + status = "okay"; + + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + /* 16 serializer */ + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 0 0 1 2 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + >; + tx-num-evt = <1>; + rx-num-evt = <1>; +};
From: Peter Ujfalusi peter.ujfalusi@ti.com
AM335x EVM-SK have only support for audio playback (stereo jack on the board) via tlv320aic3106 codec connected to McASP1. Enable the support for audio playback on the board: - McASP1 configuration - tlv320aic3106 configuration - Machine driver.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/boot/dts/am335x-evmsk.dts | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts index 4f339fa..9e570fb 100644 --- a/arch/arm/boot/dts/am335x-evmsk.dts +++ b/arch/arm/boot/dts/am335x-evmsk.dts @@ -158,6 +158,15 @@ 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7) >; }; + + mcasp1_pins: mcasp1_pins { + pinctrl-single,pins = < + 0x10c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_crs.mcasp1_aclkx */ + 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rxerr.mcasp1_fsx */ + 0x108 (PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */ + 0x144 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */ + >; + }; };
ocp { @@ -206,6 +215,18 @@ st,max-limit-y = <550>; st,max-limit-z = <750>; }; + + tlv320aic3106: tlv320aic3106@1b { + compatible = "ti,tlv320aic3106"; + reg = <0x1b>; + status = "okay"; + + /* Regulators */ + AVDD-supply = <&vaux2_reg>; + IOVDD-supply = <&vaux2_reg>; + DRVDD-supply = <&vaux2_reg>; + DVDD-supply = <&vbat>; + }; };
musb: usb@47400000 { @@ -233,6 +254,17 @@ pinctrl-0 = <&ecap2_pins>; }; }; + + sound { + compatible = "ti,da830-evm-audio"; + ti,model = "AM335x-EVMSK"; + ti,audio-codec = <&tlv320aic3106>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <24576000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT"; + }; };
vbat: fixedregulator@0 { @@ -419,3 +451,19 @@ phy_id = <&davinci_mdio>, <1>; phy-mode = "rgmii-txid"; }; + +&mcasp1 { + pinctrl-names = "default"; + pinctrl-0 = <&mcasp1_pins>; + + status = "okay"; + + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + /* 4 serializers */ + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 0 0 1 2 + >; + tx-num-evt = <1>; + rx-num-evt = <1>; +};
The v5 version of patches can be found here: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-October/067443.htm...
Changes since v5 - Rebase on top of 3685646e from: - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound topic/davinci - Drop patches already applied to Benoit Cousson's for_3.13/dts branch: - [PATCH v5 08/12] ARM/dts: am33xx: Add mcasp0 and mcasp1 device tree - [PATCH v5 09/12] ARM/dts: am33xx: mcasp: Add location for data port - [PATCH v5 10/12] ARM/dts: am335x-evm: Add audio support for - [PATCH v5 11/12] ARM/dts: am335x-evmsk: Audio support - Drop patches already applied to Mark Brown's topic/davinci branch: - [PATCH v5 03/12] ASoC: davinci-mcasp: Add location for data port - [PATCH v5 04/12] ASoC: davinci-mcasp: Extract DMA channels directly - [PATCH v5 05/12] ASoC: davinci-mcasp: Change compatible property - [PATCH v5 06/12] ASoC: davinci-mcasp: Improve DT bindings document - [PATCH v5 07/12] ASoC: davinci-mcasp: Remove redundant num-serializer DT - Restore patch [PATCH v3 03/11] and squash [PATCH v5 01/12] into it - Adds: ASoC: davinci-mcasp: Add DMA register locations to DT - Drops: [PATCH v5 01/12] ASoC: davinci: Fix AM33xx SoC Audio support - Change: [PATCH v5 02/12] ASoC: davinci-evm: Add device tree binding - Remove TLV320AIC3X pins from davinci-evm-audio binding document - Use devm_snd_soc_register_card in davinci-evm.c - Restore if defined(CONFIG_OF) #endif inside evm_init() and evm_exit() in davinci-evm.c to prevent compile failure if building without CONFIG_OF - Add: ASoC: davinci-mcasp: Remove last reference to num-serializer in DT doc
The patches were tested by merging the topic/davinci branch and patches on top of for-next branch. The patches do not compile on topic/davinci because of devm_snd_soc_register_card() usage.
Best regards, Jyri
Hebbar, Gururaja (2): ASoC: davinci: Add support for AM33xx SoC Audio ASoC: davinci-evm: Add device tree binding
Jyri Sarha (2): ASoC: davinci-mcasp: Remove last reference to num-serializer in DT doc arm: omap2plus_defconfig: enable AM33xx SOC EVM audio
.../bindings/sound/davinci-evm-audio.txt | 42 +++++++ .../bindings/sound/davinci-mcasp-audio.txt | 1 - arch/arm/configs/omap2plus_defconfig | 2 + sound/soc/davinci/Kconfig | 18 ++- sound/soc/davinci/Makefile | 1 + sound/soc/davinci/davinci-evm.c | 124 +++++++++++++++++++- 6 files changed, 182 insertions(+), 6 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
AM33xx uses same McASP IP as the Davinci Platform. This patch updates Kconfig and makefile to enable build for McASP, PCM & Codec drivers.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- sound/soc/davinci/Kconfig | 18 +++++++++++++++--- sound/soc/davinci/Makefile | 1 + 2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig index c82f89c..95970f5 100644 --- a/sound/soc/davinci/Kconfig +++ b/sound/soc/davinci/Kconfig @@ -1,9 +1,10 @@ config SND_DAVINCI_SOC - tristate "SoC Audio for the TI DAVINCI chip" - depends on ARCH_DAVINCI + tristate "SoC Audio for the TI DAVINCI or AM33XX chip" + depends on ARCH_DAVINCI || SOC_AM33XX help + Platform driver for daVinci or AM33xx Say Y or M if you want to add support for codecs attached to - the DAVINCI AC97 or I2S interface. You will also need + the DAVINCI AC97, I2S, or McASP interface. You will also need to select the audio interfaces to support below.
config SND_DAVINCI_SOC_I2S @@ -15,6 +16,17 @@ config SND_DAVINCI_SOC_MCASP config SND_DAVINCI_SOC_VCIF tristate
+config SND_AM33XX_SOC_EVM + tristate "SoC Audio for the AM33XX chip based boards" + depends on SND_DAVINCI_SOC && SOC_AM33XX + select SND_SOC_TLV320AIC3X + select SND_DAVINCI_SOC_MCASP + help + Say Y or M if you want to add support for SoC audio on AM33XX + boards using McASP and TLV320AIC3X codec. For example AM335X-EVM, + AM335X-EVMSK, and BeagelBone with AudioCape boards have this + setup. + config SND_DAVINCI_SOC_EVM tristate "SoC Audio support for DaVinci DM6446, DM355 or DM365 EVM" depends on SND_DAVINCI_SOC diff --git a/sound/soc/davinci/Makefile b/sound/soc/davinci/Makefile index a396ab6..bc81e79 100644 --- a/sound/soc/davinci/Makefile +++ b/sound/soc/davinci/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_SND_DAVINCI_SOC_VCIF) += snd-soc-davinci-vcif.o snd-soc-evm-objs := davinci-evm.o
obj-$(CONFIG_SND_DAVINCI_SOC_EVM) += snd-soc-evm.o +obj-$(CONFIG_SND_AM33XX_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DM6467_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DA830_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DA850_SOC_EVM) += snd-soc-evm.o
On Wed, Oct 23, 2013 at 03:30:13PM +0300, Jyri Sarha wrote:
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
AM33xx uses same McASP IP as the Davinci Platform. This patch updates Kconfig and makefile to enable build for McASP, PCM & Codec drivers.
Applied, thanks.
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
Device tree support for Davinci Machine driver
When the board boots with device tree, the driver will receive card, codec, dai interface details (like the card name, DAPM routing map, phandle for the audio components described in the dts file, codec mclk speed). The card will be set up based on this information. Since the routing is provided via DT we can mark the card fully routed so core can take care of disconnecting the unused pins.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com Signed-off-by: Darren Etheridge detheridge@ti.com Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-evm-audio.txt | 42 +++++++ sound/soc/davinci/davinci-evm.c | 124 +++++++++++++++++++- 2 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
diff --git a/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt new file mode 100644 index 0000000..865178d --- /dev/null +++ b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt @@ -0,0 +1,42 @@ +* Texas Instruments SoC audio setups with TLV320AIC3X Codec + +Required properties: +- compatible : "ti,da830-evm-audio" : forDM365/DA8xx/OMAPL1x/AM33xx +- ti,model : The user-visible name of this sound complex. +- ti,audio-codec : The phandle of the TLV320AIC3x audio codec +- ti,mcasp-controller : The phandle of the McASP controller +- ti,codec-clock-rate : The Codec Clock rate (in Hz) applied to the Codec +- ti,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 codec's pins, and the jacks on the board: + + Board connectors: + + * Headphone Jack + * Line Out + * Mic Jack + * Line In + + +Example: + +sound { + compatible = "ti,da830-evm-audio"; + ti,model = "DA830 EVM"; + ti,audio-codec = <&tlv320aic3x>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <12000000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT", + "Line Out", "LLOUT", + "Line Out", "RLOUT", + "MIC3L", "Mic Bias 2V", + "MIC3R", "Mic Bias 2V", + "Mic Bias 2V", "Mic Jack", + "LINE1L", "Line In", + "LINE2L", "Line In", + "LINE1R", "Line In", + "LINE2R", "Line In"; +}; diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 2f8161c..623eb5e 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -16,6 +16,7 @@ #include <linux/platform_device.h> #include <linux/platform_data/edma.h> #include <linux/i2c.h> +#include <linux/of_platform.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/soc.h> @@ -23,6 +24,8 @@ #include <asm/dma.h> #include <asm/mach-types.h>
+#include <linux/edma.h> + #include "davinci-pcm.h" #include "davinci-i2s.h" #include "davinci-mcasp.h" @@ -121,13 +124,22 @@ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; + struct device_node *np = codec->card->dev->of_node; + int ret;
/* Add davinci-evm specific widgets */ snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets, ARRAY_SIZE(aic3x_dapm_widgets));
- /* Set up davinci-evm specific audio path audio_map */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); + if (np) { + ret = snd_soc_of_parse_audio_routing(codec->card, + "ti,audio-routing"); + if (ret) + return ret; + } else { + /* Set up davinci-evm specific audio path audio_map */ + snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); + }
/* not connected */ snd_soc_dapm_disable_pin(dapm, "MONO_LOUT"); @@ -312,6 +324,98 @@ static struct snd_soc_card da850_snd_soc_card = { .drvdata = &da850_snd_soc_card_drvdata, };
+#if defined(CONFIG_OF) + +/* + * The struct is used as place holder. It will be completely + * filled with data from dt node. + */ +static struct snd_soc_dai_link evm_dai_tlv320aic3x = { + .name = "TLV320AIC3X", + .stream_name = "AIC3X", + .codec_dai_name = "tlv320aic3x-hifi", + .ops = &evm_ops, + .init = evm_aic3x_init, +}; + +static const struct of_device_id davinci_evm_dt_ids[] = { + { + .compatible = "ti,da830-evm-audio", + .data = (void *) &evm_dai_tlv320aic3x, + }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, davinci_evm_dt_ids); + +/* davinci evm audio machine driver */ +static struct snd_soc_card evm_soc_card = { + .owner = THIS_MODULE, + .num_links = 1, +}; + +static int davinci_evm_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match = + of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev); + struct snd_soc_dai_link *dai = (struct snd_soc_dai_link *) match->data; + struct snd_soc_card_drvdata_davinci *drvdata = NULL; + int ret = 0; + + evm_soc_card.dai_link = dai; + + dai->codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0); + if (!dai->codec_of_node) + return -EINVAL; + + dai->cpu_of_node = of_parse_phandle(np, "ti,mcasp-controller", 0); + if (!dai->cpu_of_node) + return -EINVAL; + + dai->platform_of_node = dai->cpu_of_node; + + evm_soc_card.dev = &pdev->dev; + ret = snd_soc_of_parse_card_name(&evm_soc_card, "ti,model"); + if (ret) + return ret; + + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + ret = of_property_read_u32(np, "ti,codec-clock-rate", &drvdata->sysclk); + if (ret < 0) + return -EINVAL; + + snd_soc_card_set_drvdata(&evm_soc_card, drvdata); + ret = devm_snd_soc_register_card(&pdev->dev, &evm_soc_card); + + if (ret) + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); + + return ret; +} + +static int davinci_evm_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + + return 0; +} + +static struct platform_driver davinci_evm_driver = { + .probe = davinci_evm_probe, + .remove = davinci_evm_remove, + .driver = { + .name = "davinci_evm", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(davinci_evm_dt_ids), + }, +}; +#endif + static struct platform_device *evm_snd_device;
static int __init evm_init(void) @@ -320,6 +424,15 @@ static int __init evm_init(void) int index; int ret;
+ /* + * If dtb is there, the devices will be created dynamically. + * Only register platfrom driver structure. + */ +#if defined(CONFIG_OF) + if (of_have_populated_dt()) + return platform_driver_register(&davinci_evm_driver); +#endif + if (machine_is_davinci_evm()) { evm_snd_dev_data = &dm6446_snd_soc_card_evm; index = 0; @@ -355,6 +468,13 @@ static int __init evm_init(void)
static void __exit evm_exit(void) { +#if defined(CONFIG_OF) + if (of_have_populated_dt()) { + platform_driver_unregister(&davinci_evm_driver); + return; + } +#endif + platform_device_unregister(evm_snd_device); }
On Wed, Oct 23, 2013 at 03:30:14PM +0300, Jyri Sarha wrote:
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
Device tree support for Davinci Machine driver
Applied, thanks.
Remove last reference to num-serializer in davinci-mcasp devicetree binding document.
Signed-off-by: Jyri Sarha jsarha@ti.com --- .../bindings/sound/davinci-mcasp-audio.txt | 1 - 1 file changed, 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 0aa416b..ed785b3 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt @@ -15,7 +15,6 @@ Required properties: IEC60958-1, and AES-3 formats. - tdm-slots : Slots for TDM operation. Indicates number of channels transmitted or received over one serializer. -- num-serializer : Serializers used by McASP. - serial-dir : A list of serializer configuration. Each entry is a number indication for serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX)
Modifying the omap2plus_defconfig to enable the audio support for AM335x EVM and other AM33xx based devices with TLV320AIC3X connected to McASP.
Signed-off-by: Jyri Sarha jsarha@ti.com --- arch/arm/configs/omap2plus_defconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index 254cf05..4443b92 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig @@ -210,6 +210,8 @@ CONFIG_SND_DEBUG=y CONFIG_SND_USB_AUDIO=m CONFIG_SND_SOC=m CONFIG_SND_OMAP_SOC=m +CONFIG_SND_AM33XX_SOC_EVM=m +CONFIG_SND_DAVINCI_SOC=m CONFIG_SND_OMAP_SOC_OMAP_TWL4030=m CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=m CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m
participants (9)
-
Benoit Cousson
-
Gururaja Hebbar
-
jsarha@ti.com
-
Jyri Sarha
-
Mark Brown
-
Mark Rutland
-
Peter Ujfalusi
-
Sarha, Jyri
-
y@dflp33.itg.ti.com