Skip to content

Commit bedad0c

Browse files
cgpe-abroonie
authored andcommitted
ASoC: davinci: fixes for multi-component
Multi-component commit f0fba2a broke a few things which this patch should fix. Tested on the DM355 EVM. I've been as careful as I can, but it would be good if those with access to other Davinci boards could test. -- The multi-component commit put the initialisation of snd_soc_dai.[capture|playback]_dma_data into snd_soc_dai_ops.hw_params of the McBSP, McASP & VCIF drivers (davinci-i2s.c, davinci-mcasp.c & davinci-vcif.c). The initialisation had to be moved from the probe function in these drivers because davinci_*_dai changed from snd_soc_dai to snd_soc_dai_driver. Unfortunately, the DMA params pointer is needed by davinci_pcm_open (in davinci-pcm.c) before hw_params is called. I have moved the initialisation to a new snd_soc_dai_ops.startup function in each of these drivers. This fix indicates that all platforms that use davinci-pcm must have been broken and need to test with this fix. -- The multi-component commit also changed the McBSP driver name from "davinci-asp" to "davinci-i2s" in davinci-i2s.c without updating the board level references to the driver name. This change is understandable, as there is a similarly named "davinci-mcasp" driver in davinci-mcasp.c. There is probably no 'correct' name for this driver. The DM6446 datasheet calls it the "ASP" and describes it as a "specialised McBSP". The DM355 datasheet calls it the "ASP" and describes it as a "specialised ASP". The DM365 datasheet calls it the "McBSP". Rather than fix this problem by reverting to "davinci-asp", I've elected to avoid future confusion with the "davinci-mcasp" driver by changing it to "davinci-mcbsp", which is also consistent with the names of the functions in the driver. There are other fixes required, so it was never going to be as simple as a revert anyway. -- The DM365 only has one McBSP port (of the McBSP platforms, only the DM355 has 2 ports), so I've changed the the id of the platform_device from 0 to -1. -- In davinci-evm.c, the DM6446 EVM can no longer share a snd_soc_dai_link structure with the DM355 EVM as they use different cpu DAI names (the DM355 has 2 ports and the EVM uses the second port, but the DM6446 only has 1 port). This also means that the 2 boards need different snd_soc_card structures. -- The codec_name entries in davinci-evm.c didn't match the i2c ids in the board files. I have only checked and fixed the details of the names used for the McBSP based platforms. Someone with a McASP based platform (eg DA8xx) should check the others. Signed-off-by: Chris Paulson-Ellis <[email protected]> Acked-by: Liam Girdwood <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 11e713a commit bedad0c

File tree

8 files changed

+69
-30
lines changed

8 files changed

+69
-30
lines changed

arch/arm/mach-davinci/dm355.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,8 @@ static struct clk_lookup dm355_clks[] = {
359359
CLK(NULL, "uart1", &uart1_clk),
360360
CLK(NULL, "uart2", &uart2_clk),
361361
CLK("i2c_davinci.1", NULL, &i2c_clk),
362-
CLK("davinci-asp.0", NULL, &asp0_clk),
363-
CLK("davinci-asp.1", NULL, &asp1_clk),
362+
CLK("davinci-mcbsp.0", NULL, &asp0_clk),
363+
CLK("davinci-mcbsp.1", NULL, &asp1_clk),
364364
CLK("davinci_mmc.0", NULL, &mmcsd0_clk),
365365
CLK("davinci_mmc.1", NULL, &mmcsd1_clk),
366366
CLK("spi_davinci.0", NULL, &spi0_clk),
@@ -664,7 +664,7 @@ static struct resource dm355_asp1_resources[] = {
664664
};
665665

666666
static struct platform_device dm355_asp1_device = {
667-
.name = "davinci-asp",
667+
.name = "davinci-mcbsp",
668668
.id = 1,
669669
.num_resources = ARRAY_SIZE(dm355_asp1_resources),
670670
.resource = dm355_asp1_resources,

arch/arm/mach-davinci/dm365.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ static struct clk_lookup dm365_clks[] = {
459459
CLK(NULL, "usb", &usb_clk),
460460
CLK("davinci_emac.1", NULL, &emac_clk),
461461
CLK("davinci_voicecodec", NULL, &voicecodec_clk),
462-
CLK("davinci-asp.0", NULL, &asp0_clk),
462+
CLK("davinci-mcbsp", NULL, &asp0_clk),
463463
CLK(NULL, "rto", &rto_clk),
464464
CLK(NULL, "mjcp", &mjcp_clk),
465465
CLK(NULL, NULL, NULL),
@@ -922,8 +922,8 @@ static struct resource dm365_asp_resources[] = {
922922
};
923923

924924
static struct platform_device dm365_asp_device = {
925-
.name = "davinci-asp",
926-
.id = 0,
925+
.name = "davinci-mcbsp",
926+
.id = -1,
927927
.num_resources = ARRAY_SIZE(dm365_asp_resources),
928928
.resource = dm365_asp_resources,
929929
};

arch/arm/mach-davinci/dm644x.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ static struct clk_lookup dm644x_clks[] = {
302302
CLK("davinci_emac.1", NULL, &emac_clk),
303303
CLK("i2c_davinci.1", NULL, &i2c_clk),
304304
CLK("palm_bk3710", NULL, &ide_clk),
305-
CLK("davinci-asp", NULL, &asp_clk),
305+
CLK("davinci-mcbsp", NULL, &asp_clk),
306306
CLK("davinci_mmc.0", NULL, &mmcsd_clk),
307307
CLK(NULL, "spi", &spi_clk),
308308
CLK(NULL, "gpio", &gpio_clk),
@@ -580,7 +580,7 @@ static struct resource dm644x_asp_resources[] = {
580580
};
581581

582582
static struct platform_device dm644x_asp_device = {
583-
.name = "davinci-asp",
583+
.name = "davinci-mcbsp",
584584
.id = -1,
585585
.num_resources = ARRAY_SIZE(dm644x_asp_resources),
586586
.resource = dm644x_asp_resources,

sound/soc/davinci/davinci-evm.c

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,23 @@ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd)
157157
}
158158

159159
/* davinci-evm digital audio interface glue - connects codec <--> CPU */
160-
static struct snd_soc_dai_link evm_dai = {
160+
static struct snd_soc_dai_link dm6446_evm_dai = {
161161
.name = "TLV320AIC3X",
162162
.stream_name = "AIC3X",
163-
.cpu_dai_name = "davinci-mcasp.0",
163+
.cpu_dai_name = "davinci-mcbsp",
164164
.codec_dai_name = "tlv320aic3x-hifi",
165-
.codec_name = "tlv320aic3x-codec.0-001a",
165+
.codec_name = "tlv320aic3x-codec.1-001b",
166+
.platform_name = "davinci-pcm-audio",
167+
.init = evm_aic3x_init,
168+
.ops = &evm_ops,
169+
};
170+
171+
static struct snd_soc_dai_link dm355_evm_dai = {
172+
.name = "TLV320AIC3X",
173+
.stream_name = "AIC3X",
174+
.cpu_dai_name = "davinci-mcbsp.1",
175+
.codec_dai_name = "tlv320aic3x-hifi",
176+
.codec_name = "tlv320aic3x-codec.1-001b",
166177
.platform_name = "davinci-pcm-audio",
167178
.init = evm_aic3x_init,
168179
.ops = &evm_ops,
@@ -172,10 +183,10 @@ static struct snd_soc_dai_link dm365_evm_dai = {
172183
#ifdef CONFIG_SND_DM365_AIC3X_CODEC
173184
.name = "TLV320AIC3X",
174185
.stream_name = "AIC3X",
175-
.cpu_dai_name = "davinci-i2s",
186+
.cpu_dai_name = "davinci-mcbsp",
176187
.codec_dai_name = "tlv320aic3x-hifi",
177188
.init = evm_aic3x_init,
178-
.codec_name = "tlv320aic3x-codec.0-001a",
189+
.codec_name = "tlv320aic3x-codec.1-0018",
179190
.ops = &evm_ops,
180191
#elif defined(CONFIG_SND_DM365_VOICE_CODEC)
181192
.name = "Voice Codec - CQ93VC",
@@ -219,10 +230,17 @@ static struct snd_soc_dai_link da8xx_evm_dai = {
219230
.ops = &evm_ops,
220231
};
221232

222-
/* davinci dm6446, dm355 evm audio machine driver */
223-
static struct snd_soc_card snd_soc_card_evm = {
224-
.name = "DaVinci EVM",
225-
.dai_link = &evm_dai,
233+
/* davinci dm6446 evm audio machine driver */
234+
static struct snd_soc_card dm6446_snd_soc_card_evm = {
235+
.name = "DaVinci DM6446 EVM",
236+
.dai_link = &dm6446_evm_dai,
237+
.num_links = 1,
238+
};
239+
240+
/* davinci dm355 evm audio machine driver */
241+
static struct snd_soc_card dm355_snd_soc_card_evm = {
242+
.name = "DaVinci DM355 EVM",
243+
.dai_link = &dm355_evm_dai,
226244
.num_links = 1,
227245
};
228246

@@ -261,10 +279,10 @@ static int __init evm_init(void)
261279
int ret;
262280

263281
if (machine_is_davinci_evm()) {
264-
evm_snd_dev_data = &snd_soc_card_evm;
282+
evm_snd_dev_data = &dm6446_snd_soc_card_evm;
265283
index = 0;
266284
} else if (machine_is_davinci_dm355_evm()) {
267-
evm_snd_dev_data = &snd_soc_card_evm;
285+
evm_snd_dev_data = &dm355_snd_soc_card_evm;
268286
index = 1;
269287
} else if (machine_is_davinci_dm365_evm()) {
270288
evm_snd_dev_data = &dm365_snd_soc_card_evm;

sound/soc/davinci/davinci-i2s.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,6 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
426426
snd_pcm_format_t fmt;
427427
unsigned element_cnt = 1;
428428

429-
dai->capture_dma_data = dev->dma_params;
430-
dai->playback_dma_data = dev->dma_params;
431-
432429
/* general line settings */
433430
spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG);
434431
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
@@ -601,6 +598,15 @@ static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
601598
return ret;
602599
}
603600

601+
static int davinci_i2s_startup(struct snd_pcm_substream *substream,
602+
struct snd_soc_dai *dai)
603+
{
604+
struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai);
605+
606+
snd_soc_dai_set_dma_data(dai, substream, dev->dma_params);
607+
return 0;
608+
}
609+
604610
static void davinci_i2s_shutdown(struct snd_pcm_substream *substream,
605611
struct snd_soc_dai *dai)
606612
{
@@ -612,6 +618,7 @@ static void davinci_i2s_shutdown(struct snd_pcm_substream *substream,
612618
#define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000
613619

614620
static struct snd_soc_dai_ops davinci_i2s_dai_ops = {
621+
.startup = davinci_i2s_startup,
615622
.shutdown = davinci_i2s_shutdown,
616623
.prepare = davinci_i2s_prepare,
617624
.trigger = davinci_i2s_trigger,
@@ -749,7 +756,7 @@ static struct platform_driver davinci_mcbsp_driver = {
749756
.probe = davinci_i2s_probe,
750757
.remove = davinci_i2s_remove,
751758
.driver = {
752-
.name = "davinci-i2s",
759+
.name = "davinci-mcbsp",
753760
.owner = THIS_MODULE,
754761
},
755762
};

sound/soc/davinci/davinci-mcasp.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -715,9 +715,6 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
715715
int word_length;
716716
u8 fifo_level;
717717

718-
cpu_dai->capture_dma_data = dev->dma_params;
719-
cpu_dai->playback_dma_data = dev->dma_params;
720-
721718
davinci_hw_common_param(dev, substream->stream);
722719
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
723720
fifo_level = dev->txnumevt;
@@ -799,7 +796,17 @@ static int davinci_mcasp_trigger(struct snd_pcm_substream *substream,
799796
return ret;
800797
}
801798

799+
static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
800+
struct snd_soc_dai *dai)
801+
{
802+
struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(dai);
803+
804+
snd_soc_dai_set_dma_data(dai, substream, dev->dma_params);
805+
return 0;
806+
}
807+
802808
static struct snd_soc_dai_ops davinci_mcasp_dai_ops = {
809+
.startup = davinci_mcasp_startup,
803810
.trigger = davinci_mcasp_trigger,
804811
.hw_params = davinci_mcasp_hw_params,
805812
.set_fmt = davinci_mcasp_set_dai_fmt,

sound/soc/davinci/davinci-sffsdr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static struct snd_soc_ops sffsdr_ops = {
8484
static struct snd_soc_dai_link sffsdr_dai = {
8585
.name = "PCM3008", /* Codec name */
8686
.stream_name = "PCM3008 HiFi",
87-
.cpu_dai_name = "davinci-asp.0",
87+
.cpu_dai_name = "davinci-mcbsp",
8888
.codec_dai_name = "pcm3008-hifi",
8989
.codec_name = "pcm3008-codec",
9090
.platform_name = "davinci-pcm-audio",

sound/soc/davinci/davinci-vcif.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ static int davinci_vcif_hw_params(struct snd_pcm_substream *substream,
9797
&davinci_vcif_dev->dma_params[substream->stream];
9898
u32 w;
9999

100-
dai->capture_dma_data = davinci_vcif_dev->dma_params;
101-
dai->playback_dma_data = davinci_vcif_dev->dma_params;
102-
103100
/* Restart the codec before setup */
104101
davinci_vcif_stop(substream);
105102
davinci_vcif_start(substream);
@@ -174,9 +171,19 @@ static int davinci_vcif_trigger(struct snd_pcm_substream *substream, int cmd,
174171
return ret;
175172
}
176173

174+
static int davinci_vcif_startup(struct snd_pcm_substream *substream,
175+
struct snd_soc_dai *dai)
176+
{
177+
struct davinci_vcif_dev *dev = snd_soc_dai_get_drvdata(dai);
178+
179+
snd_soc_dai_set_dma_data(dai, substream, dev->dma_params);
180+
return 0;
181+
}
182+
177183
#define DAVINCI_VCIF_RATES SNDRV_PCM_RATE_8000_48000
178184

179185
static struct snd_soc_dai_ops davinci_vcif_dai_ops = {
186+
.startup = davinci_vcif_startup,
180187
.trigger = davinci_vcif_trigger,
181188
.hw_params = davinci_vcif_hw_params,
182189
};

0 commit comments

Comments
 (0)