From 778a17c31fc1c0ecc22c9012747d5249ed6db80f Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Thu, 15 Mar 2012 12:20:32 +0200 Subject: ASoC: omap-mcbsp: Use DMA packet mode for non mono streams on OMAP3+ Take the DMA packet mode into use when the McBSP is configured in element dma_op_mode if the stream is not mono. In this way we transfer one sample from/to McBSP FIFO upon DMA request. This change only affects OMAP3+ versions, where the McBSP ports have FIFO. Signed-off-by: Peter Ujfalusi Acked-by: Mark Brown Acked-by: Jarkko Nikula Signed-off-by: Liam Girdwood --- sound/soc/omap/omap-mcbsp.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 6912ac7cb62..418dc3cebde 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c @@ -71,18 +71,17 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream) dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); - /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ - if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) - /* - * Configure McBSP threshold based on either: - * packet_size, when the sDMA is in packet mode, or - * based on the period size. - */ - if (dma_data->packet_size) - words = dma_data->packet_size; - else - words = snd_pcm_lib_period_bytes(substream) / - (mcbsp->wlen / 8); + /* + * Configure McBSP threshold based on either: + * packet_size, when the sDMA is in packet mode, or based on the + * period size in THRESHOLD mode, otherwise use McBSP threshold = 1 + * for mono streams. + */ + if (dma_data->packet_size) + words = dma_data->packet_size; + else if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) + words = snd_pcm_lib_period_bytes(substream) / + (mcbsp->wlen / 8); else words = 1; @@ -230,6 +229,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, unsigned int format, div, framesize, master; dma_data = &mcbsp->dma_data[substream->stream]; + channels = params_channels(params); switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: @@ -283,6 +283,10 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, } else { sync_mode = OMAP_DMA_SYNC_FRAME; } + } else if (channels > 1) { + /* Use packet mode for non mono streams */ + pkt_size = channels; + sync_mode = OMAP_DMA_SYNC_PACKET; } } @@ -301,7 +305,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, regs->rcr1 &= ~(RFRLEN1(0x7f) | RWDLEN1(7)); regs->xcr1 &= ~(XFRLEN1(0x7f) | XWDLEN1(7)); format = mcbsp->fmt & SND_SOC_DAIFMT_FORMAT_MASK; - wpf = channels = params_channels(params); + wpf = channels; if (channels == 2 && (format == SND_SOC_DAIFMT_I2S || format == SND_SOC_DAIFMT_LEFT_J)) { /* Use dual-phase frames */ -- cgit v1.2.3 From 09fa37ac8f8be7cf57f24cfd5291c591b79957f1 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Thu, 15 Mar 2012 12:29:49 +0200 Subject: ASoC: omap-mcbsp: Remove unused FRAME dma_op_mode The frame dma_op_mode has never been used, and it is just creating confusion for users/developers. Signed-off-by: Peter Ujfalusi Acked-by: Mark Brown Acked-by: Jarkko Nikula Signed-off-by: Liam Girdwood --- sound/soc/omap/mcbsp.c | 2 +- sound/soc/omap/mcbsp.h | 1 - sound/soc/omap/omap-mcbsp.c | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c index e5f44440d1b..ec6832cc296 100644 --- a/sound/soc/omap/mcbsp.c +++ b/sound/soc/omap/mcbsp.c @@ -754,7 +754,7 @@ THRESHOLD_PROP_BUILDER(max_tx_thres); THRESHOLD_PROP_BUILDER(max_rx_thres); static const char *dma_op_modes[] = { - "element", "threshold", "frame", + "element", "threshold", }; static ssize_t dma_op_mode_show(struct device *dev, diff --git a/sound/soc/omap/mcbsp.h b/sound/soc/omap/mcbsp.h index a944fcc9073..179a822c723 100644 --- a/sound/soc/omap/mcbsp.h +++ b/sound/soc/omap/mcbsp.h @@ -217,7 +217,6 @@ enum { /********************** McBSP DMA operating modes **************************/ #define MCBSP_DMA_MODE_ELEMENT 0 #define MCBSP_DMA_MODE_THRESHOLD 1 -#define MCBSP_DMA_MODE_FRAME 2 /********************** McBSP WAKEUPEN bit definitions *********************/ #define RSYNCERREN BIT(0) diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 418dc3cebde..27144a67e5e 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c @@ -245,7 +245,6 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, } if (mcbsp->pdata->buffer_size) { dma_data->set_threshold = omap_mcbsp_set_threshold; - /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) { int period_words, max_thrsh; -- cgit v1.2.3 From 35d210faa17e46897771fcf0d78df7f952b0f9b0 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Mon, 19 Mar 2012 17:05:39 +0200 Subject: ASoC: omap-mcbsp: Use the common interrupt line if supported by the SoC With the common irq the driver only needs to use one interrupt line, and it provides better debugging possibilites compared to the legacy TX/RX interrupt lines. Signed-off-by: Peter Ujfalusi Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- sound/soc/omap/mcbsp.c | 113 ++++++++++++++++++++++++++++++++++++++----------- sound/soc/omap/mcbsp.h | 7 ++- 2 files changed, 95 insertions(+), 25 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c index ec6832cc296..34835e8a916 100644 --- a/sound/soc/omap/mcbsp.c +++ b/sound/soc/omap/mcbsp.c @@ -109,6 +109,47 @@ static void omap_mcbsp_dump_reg(struct omap_mcbsp *mcbsp) dev_dbg(mcbsp->dev, "***********************\n"); } +static irqreturn_t omap_mcbsp_irq_handler(int irq, void *dev_id) +{ + struct omap_mcbsp *mcbsp = dev_id; + u16 irqst; + + irqst = MCBSP_READ(mcbsp, IRQST); + dev_dbg(mcbsp->dev, "IRQ callback : 0x%x\n", irqst); + + if (irqst & RSYNCERREN) + dev_err(mcbsp->dev, "RX Frame Sync Error!\n"); + if (irqst & RFSREN) + dev_dbg(mcbsp->dev, "RX Frame Sync\n"); + if (irqst & REOFEN) + dev_dbg(mcbsp->dev, "RX End Of Frame\n"); + if (irqst & RRDYEN) + dev_dbg(mcbsp->dev, "RX Buffer Threshold Reached\n"); + if (irqst & RUNDFLEN) + dev_err(mcbsp->dev, "RX Buffer Underflow!\n"); + if (irqst & ROVFLEN) + dev_err(mcbsp->dev, "RX Buffer Overflow!\n"); + + if (irqst & XSYNCERREN) + dev_err(mcbsp->dev, "TX Frame Sync Error!\n"); + if (irqst & XFSXEN) + dev_dbg(mcbsp->dev, "TX Frame Sync\n"); + if (irqst & XEOFEN) + dev_dbg(mcbsp->dev, "TX End Of Frame\n"); + if (irqst & XRDYEN) + dev_dbg(mcbsp->dev, "TX Buffer threshold Reached\n"); + if (irqst & XUNDFLEN) + dev_err(mcbsp->dev, "TX Buffer Underflow!\n"); + if (irqst & XOVFLEN) + dev_err(mcbsp->dev, "TX Buffer Overflow!\n"); + if (irqst & XEMPTYEOFEN) + dev_dbg(mcbsp->dev, "TX Buffer empty at end of frame\n"); + + MCBSP_WRITE(mcbsp, IRQST, irqst); + + return IRQ_HANDLED; +} + static irqreturn_t omap_mcbsp_tx_irq_handler(int irq, void *dev_id) { struct omap_mcbsp *mcbsp_tx = dev_id; @@ -176,6 +217,10 @@ void omap_mcbsp_config(struct omap_mcbsp *mcbsp, /* Enable wakeup behavior */ if (mcbsp->pdata->has_wakeup) MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN); + + /* Enable TX/RX sync error interrupts by default */ + if (mcbsp->irq) + MCBSP_WRITE(mcbsp, IRQEN, RSYNCERREN | XSYNCERREN); } /** @@ -489,23 +534,25 @@ int omap_mcbsp_request(struct omap_mcbsp *mcbsp) MCBSP_WRITE(mcbsp, SPCR1, 0); MCBSP_WRITE(mcbsp, SPCR2, 0); - err = request_irq(mcbsp->tx_irq, omap_mcbsp_tx_irq_handler, - 0, "McBSP", (void *)mcbsp); - if (err != 0) { - dev_err(mcbsp->dev, "Unable to request TX IRQ %d " - "for McBSP%d\n", mcbsp->tx_irq, - mcbsp->id); - goto err_clk_disable; - } + if (mcbsp->irq) { + err = request_irq(mcbsp->irq, omap_mcbsp_irq_handler, 0, + "McBSP", (void *)mcbsp); + if (err != 0) { + dev_err(mcbsp->dev, "Unable to request IRQ\n"); + goto err_clk_disable; + } + } else { + err = request_irq(mcbsp->tx_irq, omap_mcbsp_tx_irq_handler, 0, + "McBSP TX", (void *)mcbsp); + if (err != 0) { + dev_err(mcbsp->dev, "Unable to request TX IRQ\n"); + goto err_clk_disable; + } - if (mcbsp->rx_irq) { - err = request_irq(mcbsp->rx_irq, - omap_mcbsp_rx_irq_handler, - 0, "McBSP", (void *)mcbsp); + err = request_irq(mcbsp->rx_irq, omap_mcbsp_rx_irq_handler, 0, + "McBSP RX", (void *)mcbsp); if (err != 0) { - dev_err(mcbsp->dev, "Unable to request RX IRQ %d " - "for McBSP%d\n", mcbsp->rx_irq, - mcbsp->id); + dev_err(mcbsp->dev, "Unable to request RX IRQ\n"); goto err_free_irq; } } @@ -542,9 +589,16 @@ void omap_mcbsp_free(struct omap_mcbsp *mcbsp) if (mcbsp->pdata->has_wakeup) MCBSP_WRITE(mcbsp, WAKEUPEN, 0); - if (mcbsp->rx_irq) + /* Disable interrupt requests */ + if (mcbsp->irq) + MCBSP_WRITE(mcbsp, IRQEN, 0); + + if (mcbsp->irq) { + free_irq(mcbsp->irq, (void *)mcbsp); + } else { free_irq(mcbsp->rx_irq, (void *)mcbsp); - free_irq(mcbsp->tx_irq, (void *)mcbsp); + free_irq(mcbsp->tx_irq, (void *)mcbsp); + } reg_cache = mcbsp->reg_cache; @@ -949,13 +1003,24 @@ int __devinit omap_mcbsp_init(struct platform_device *pdev) else mcbsp->phys_dma_base = res->start; - mcbsp->tx_irq = platform_get_irq_byname(pdev, "tx"); - mcbsp->rx_irq = platform_get_irq_byname(pdev, "rx"); - - /* From OMAP4 there will be a single irq line */ - if (mcbsp->tx_irq == -ENXIO) { - mcbsp->tx_irq = platform_get_irq(pdev, 0); - mcbsp->rx_irq = 0; + /* + * OMAP1, 2 uses two interrupt lines: TX, RX + * OMAP2430, OMAP3 SoC have combined IRQ line as well. + * OMAP4 and newer SoC only have the combined IRQ line. + * Use the combined IRQ if available since it gives better debugging + * possibilities. + */ + mcbsp->irq = platform_get_irq_byname(pdev, "common"); + if (mcbsp->irq == -ENXIO) { + mcbsp->tx_irq = platform_get_irq_byname(pdev, "tx"); + + if (mcbsp->tx_irq == -ENXIO) { + mcbsp->irq = platform_get_irq(pdev, 0); + mcbsp->tx_irq = 0; + } else { + mcbsp->rx_irq = platform_get_irq_byname(pdev, "rx"); + mcbsp->irq = 0; + } } res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); diff --git a/sound/soc/omap/mcbsp.h b/sound/soc/omap/mcbsp.h index 179a822c723..262a6152111 100644 --- a/sound/soc/omap/mcbsp.h +++ b/sound/soc/omap/mcbsp.h @@ -218,15 +218,19 @@ enum { #define MCBSP_DMA_MODE_ELEMENT 0 #define MCBSP_DMA_MODE_THRESHOLD 1 -/********************** McBSP WAKEUPEN bit definitions *********************/ +/********************** McBSP WAKEUPEN/IRQST/IRQEN bit definitions *********/ #define RSYNCERREN BIT(0) #define RFSREN BIT(1) #define REOFEN BIT(2) #define RRDYEN BIT(3) +#define RUNDFLEN BIT(4) +#define ROVFLEN BIT(5) #define XSYNCERREN BIT(7) #define XFSXEN BIT(8) #define XEOFEN BIT(9) #define XRDYEN BIT(10) +#define XUNDFLEN BIT(11) +#define XOVFLEN BIT(12) #define XEMPTYEOFEN BIT(14) /* Clock signal muxing options */ @@ -294,6 +298,7 @@ struct omap_mcbsp { int configured; u8 free; + int irq; int rx_irq; int tx_irq; -- cgit v1.2.3 From ce37f5ea4b77171952aacd829e8f346b78191a7b Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Tue, 20 Mar 2012 11:47:36 +0200 Subject: ASoC: omap-mcbsp: buffer size constraint only applies to playback stream In capture stream the buffer size does not need to be constrained to be bigger then the McBSP FIFO. In capture the FIFO content is taken out in period length burst, this enusres that the FIFO is not going to overflow. Signed-off-by: Peter Ujfalusi Acked-by: Mark Brown Acked-by: Jarkko Nikula Signed-off-by: Liam Girdwood --- sound/soc/omap/omap-mcbsp.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 27144a67e5e..1046083e90a 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c @@ -138,13 +138,15 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, if (mcbsp->pdata->buffer_size) { /* * Rule for the buffer size. We should not allow - * smaller buffer than the FIFO size to avoid underruns + * smaller buffer than the FIFO size to avoid underruns. + * This applies only for the playback stream. */ - snd_pcm_hw_rule_add(substream->runtime, 0, - SNDRV_PCM_HW_PARAM_BUFFER_SIZE, - omap_mcbsp_hwrule_min_buffersize, - mcbsp, - SNDRV_PCM_HW_PARAM_CHANNELS, -1); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + snd_pcm_hw_rule_add(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + omap_mcbsp_hwrule_min_buffersize, + mcbsp, + SNDRV_PCM_HW_PARAM_CHANNELS, -1); /* Make sure, that the period size is always even */ snd_pcm_hw_constraint_step(substream->runtime, 0, -- cgit v1.2.3 From 7cb8a1b5bae163c7aa746ffc02a641df6ed32f73 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Tue, 15 Nov 2011 11:32:14 +0200 Subject: ASoC: omap-mcpdm: Add device tree bindings Device tree support for OMAP4+ McPDM cpu dai driver. Signed-off-by: Peter Ujfalusi Reviewed-by: Mark Brown Signed-off-by: Liam Girdwood --- sound/soc/omap/omap-mcpdm.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sound/soc') diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index 39705561131..59d47ab5b15 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -507,10 +508,17 @@ static int __devexit asoc_mcpdm_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id omap_mcpdm_of_match[] = { + { .compatible = "ti,omap4-mcpdm", }, + { } +}; +MODULE_DEVICE_TABLE(of, omap_mcpdm_of_match); + static struct platform_driver asoc_mcpdm_driver = { .driver = { .name = "omap-mcpdm", .owner = THIS_MODULE, + .of_match_table = omap_mcpdm_of_match, }, .probe = asoc_mcpdm_probe, -- cgit v1.2.3 From 2ec1be372139328b1aa3203eb1fd61d613b2d7fb Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Fri, 18 Nov 2011 16:39:26 +0200 Subject: ASoC: omap-dmic: Add device tree bindings Device tree support for OMAP4+ dmic cpu dai driver. Signed-off-by: Peter Ujfalusi Reviewed-by: Mark Brown Signed-off-by: Liam Girdwood --- sound/soc/omap/omap-dmic.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sound/soc') diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index 4dcb5a7e40e..75f5dca0e8d 100644 --- a/sound/soc/omap/omap-dmic.c +++ b/sound/soc/omap/omap-dmic.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -528,10 +529,17 @@ static int __devexit asoc_dmic_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id omap_dmic_of_match[] = { + { .compatible = "ti,omap4-dmic", }, + { } +}; +MODULE_DEVICE_TABLE(of, omap_dmic_of_match); + static struct platform_driver asoc_dmic_driver = { .driver = { .name = "omap-dmic", .owner = THIS_MODULE, + .of_match_table = omap_dmic_of_match, }, .probe = asoc_dmic_probe, .remove = __devexit_p(asoc_dmic_remove), -- cgit v1.2.3 From c2f98956e3635a897737cc08a60539752aa00dd7 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Tue, 24 Apr 2012 12:36:25 +0300 Subject: ASoC: omap-abe-twl6040: Keep only one snd_soc_dai_link structure There is no need to have two snd_soc_dai_link structure for the two setup the machine driver supports. We can just tell core to register only the first link if the DMIC link is not in use on the device. Signed-off-by: Peter Ujfalusi Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- sound/soc/omap/omap-abe-twl6040.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c index 93bb8eee22b..31ab6fee894 100644 --- a/sound/soc/omap/omap-abe-twl6040.c +++ b/sound/soc/omap/omap-abe-twl6040.c @@ -235,7 +235,7 @@ static int omap_abe_dmic_init(struct snd_soc_pcm_runtime *rtd) } /* Digital audio interface glue - connects codec <--> CPU */ -static struct snd_soc_dai_link twl6040_dmic_dai[] = { +static struct snd_soc_dai_link abe_twl6040_dai_links[] = { { .name = "TWL6040", .stream_name = "TWL6040", @@ -258,19 +258,6 @@ static struct snd_soc_dai_link twl6040_dmic_dai[] = { }, }; -static struct snd_soc_dai_link twl6040_only_dai[] = { - { - .name = "TWL6040", - .stream_name = "TWL6040", - .cpu_dai_name = "omap-mcpdm", - .codec_dai_name = "twl6040-legacy", - .platform_name = "omap-pcm-audio", - .codec_name = "twl6040-codec", - .init = omap_abe_twl6040_init, - .ops = &omap_abe_ops, - }, -}; - /* Audio machine driver */ static struct snd_soc_card omap_abe_card = { .owner = THIS_MODULE, @@ -285,6 +272,7 @@ static __devinit int omap_abe_probe(struct platform_device *pdev) { struct omap_abe_twl6040_data *pdata = dev_get_platdata(&pdev->dev); struct snd_soc_card *card = &omap_abe_card; + int num_links = 0; int ret; card->dev = &pdev->dev; @@ -306,13 +294,13 @@ static __devinit int omap_abe_probe(struct platform_device *pdev) return -ENODEV; } - if (pdata->has_dmic) { - card->dai_link = twl6040_dmic_dai; - card->num_links = ARRAY_SIZE(twl6040_dmic_dai); - } else { - card->dai_link = twl6040_only_dai; - card->num_links = ARRAY_SIZE(twl6040_only_dai); - } + if (pdata->has_dmic) + num_links = 2; + else + num_links = 1; + + card->dai_link = abe_twl6040_dai_links; + card->num_links = num_links; ret = snd_soc_register_card(card); if (ret) -- cgit v1.2.3 From 7d09f9e98956b29755f20d830252dec9300e7044 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Tue, 24 Apr 2012 12:41:32 +0300 Subject: ASoC: omap-abe-twl6040: Move Digital Mic widget into dapm table The needed change in routing will be done runtime for the non twl6040 connected widgets, like the Digital microphone. Signed-off-by: Peter Ujfalusi Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- sound/soc/omap/omap-abe-twl6040.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c index 31ab6fee894..4388de9b81f 100644 --- a/sound/soc/omap/omap-abe-twl6040.c +++ b/sound/soc/omap/omap-abe-twl6040.c @@ -128,6 +128,9 @@ static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = { SND_SOC_DAPM_MIC("Main Handset Mic", NULL), SND_SOC_DAPM_MIC("Sub Handset Mic", NULL), SND_SOC_DAPM_LINE("Line In", NULL), + + /* Digital microphones */ + SND_SOC_DAPM_MIC("Digital Mic", NULL), }; static const struct snd_soc_dapm_route audio_map[] = { @@ -210,10 +213,6 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) return ret; } -static const struct snd_soc_dapm_widget dmic_dapm_widgets[] = { - SND_SOC_DAPM_MIC("Digital Mic", NULL), -}; - static const struct snd_soc_dapm_route dmic_audio_map[] = { {"DMic", NULL, "Digital Mic"}, {"Digital Mic", NULL, "Digital Mic1 Bias"}, @@ -223,12 +222,6 @@ static int omap_abe_dmic_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; - int ret; - - ret = snd_soc_dapm_new_controls(dapm, dmic_dapm_widgets, - ARRAY_SIZE(dmic_dapm_widgets)); - if (ret) - return ret; return snd_soc_dapm_add_routes(dapm, dmic_audio_map, ARRAY_SIZE(dmic_audio_map)); -- cgit v1.2.3 From 356bccbea17988bd32a016ada867dd6a53ba2796 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Tue, 24 Apr 2012 12:52:53 +0300 Subject: ASoC: omap-abe-twl6040: Introduce driver data for runtime parameters In preparation to Device Tree support. With DT booted kernel we can not rely on pdata which used to hold information needed for the driver at runtime. Use the card's driver data to hold these informations from now on. Signed-off-by: Peter Ujfalusi Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- sound/soc/omap/omap-abe-twl6040.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c index 4388de9b81f..9d93793d307 100644 --- a/sound/soc/omap/omap-abe-twl6040.c +++ b/sound/soc/omap/omap-abe-twl6040.c @@ -40,6 +40,11 @@ #include "omap-pcm.h" #include "../codecs/twl6040.h" +struct abe_twl6040 { + int jack_detection; /* board can detect jack events */ + int mclk_freq; /* MCLK frequency speed for twl6040 */ +}; + static int omap_abe_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -47,13 +52,13 @@ static int omap_abe_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_codec *codec = rtd->codec; struct snd_soc_card *card = codec->card; - struct omap_abe_twl6040_data *pdata = dev_get_platdata(card->dev); + struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card); int clk_id, freq; int ret; clk_id = twl6040_get_clk_id(rtd->codec); if (clk_id == TWL6040_SYSCLK_SEL_HPPLL) - freq = pdata->mclk_freq; + freq = priv->mclk_freq; else if (clk_id == TWL6040_SYSCLK_SEL_LPPLL) freq = 32768; else @@ -176,6 +181,7 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_card *card = codec->card; struct snd_soc_dapm_context *dapm = &codec->dapm; struct omap_abe_twl6040_data *pdata = dev_get_platdata(card->dev); + struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card); int hs_trim; int ret = 0; @@ -199,7 +205,7 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) TWL6040_HSF_TRIM_RIGHT(hs_trim)); /* Headset jack detection only if it is supported */ - if (pdata->jack_detection) { + if (priv->jack_detection) { ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, &hs_jack); if (ret) @@ -265,6 +271,7 @@ static __devinit int omap_abe_probe(struct platform_device *pdev) { struct omap_abe_twl6040_data *pdata = dev_get_platdata(&pdev->dev); struct snd_soc_card *card = &omap_abe_card; + struct abe_twl6040 *priv; int num_links = 0; int ret; @@ -275,6 +282,10 @@ static __devinit int omap_abe_probe(struct platform_device *pdev) return -ENODEV; } + priv = devm_kzalloc(&pdev->dev, sizeof(struct abe_twl6040), GFP_KERNEL); + if (priv == NULL) + return -ENOMEM; + if (pdata->card_name) { card->name = pdata->card_name; } else { @@ -282,7 +293,11 @@ static __devinit int omap_abe_probe(struct platform_device *pdev) return -ENODEV; } - if (!pdata->mclk_freq) { + priv->jack_detection = pdata->jack_detection; + priv->mclk_freq = pdata->mclk_freq; + + + if (!priv->mclk_freq) { dev_err(&pdev->dev, "MCLK frequency missing\n"); return -ENODEV; } @@ -295,6 +310,8 @@ static __devinit int omap_abe_probe(struct platform_device *pdev) card->dai_link = abe_twl6040_dai_links; card->num_links = num_links; + snd_soc_card_set_drvdata(card, priv); + ret = snd_soc_register_card(card); if (ret) dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", -- cgit v1.2.3 From e412ec64bd598d7c41edc00aed8de67b2fa19754 Mon Sep 17 00:00:00 2001 From: Ricardo Neri Date: Fri, 18 May 2012 01:42:34 -0500 Subject: ASoC: OMAP: HDMI: Update the platform device names In order to utilize the new OMAP HDMI codec and the updated name of the device of the CPU DAI, update the names at the drivers accordingly. While there, also update the name of the machine driver to be more generic and encompass more OMAP processors featuring HDMI and not only OMAP4. Signed-off-by: Ricardo Neri Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- sound/soc/omap/omap-hdmi.c | 2 +- sound/soc/omap/omap4-hdmi-card.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'sound/soc') diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index 38e0defa707..0925a46f9f4 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c @@ -35,7 +35,7 @@ #include "omap-pcm.h" #include "omap-hdmi.h" -#define DRV_NAME "hdmi-audio-dai" +#define DRV_NAME "omap-hdmi-audio-dai" static struct omap_pcm_dma_data omap_hdmi_dai_dma_params = { .name = "HDMI playback", diff --git a/sound/soc/omap/omap4-hdmi-card.c b/sound/soc/omap/omap4-hdmi-card.c index 28d689b2714..99e96c6221a 100644 --- a/sound/soc/omap/omap4-hdmi-card.c +++ b/sound/soc/omap/omap4-hdmi-card.c @@ -27,7 +27,7 @@ #include #include