diff options
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r-- | sound/soc/davinci/Kconfig | 4 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-evm.c | 7 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-i2s.c | 2 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 17 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-pcm.c | 21 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-pcm.h | 1 |
6 files changed, 34 insertions, 18 deletions
diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig index 4dfd4ad9d90..047ee39418c 100644 --- a/sound/soc/davinci/Kconfig +++ b/sound/soc/davinci/Kconfig | |||
@@ -13,9 +13,9 @@ config SND_DAVINCI_SOC_MCASP | |||
13 | tristate | 13 | tristate |
14 | 14 | ||
15 | config SND_DAVINCI_SOC_EVM | 15 | config SND_DAVINCI_SOC_EVM |
16 | tristate "SoC Audio support for DaVinci DM6446 or DM355 EVM" | 16 | tristate "SoC Audio support for DaVinci DM6446, DM355 or DM365 EVM" |
17 | depends on SND_DAVINCI_SOC | 17 | depends on SND_DAVINCI_SOC |
18 | depends on MACH_DAVINCI_EVM || MACH_DAVINCI_DM355_EVM | 18 | depends on MACH_DAVINCI_EVM || MACH_DAVINCI_DM355_EVM || MACH_DAVINCI_DM365_EVM |
19 | select SND_DAVINCI_SOC_I2S | 19 | select SND_DAVINCI_SOC_I2S |
20 | select SND_SOC_TLV320AIC3X | 20 | select SND_SOC_TLV320AIC3X |
21 | help | 21 | help |
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 67414f65940..7ccbe6684fc 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c | |||
@@ -45,7 +45,8 @@ static int evm_hw_params(struct snd_pcm_substream *substream, | |||
45 | unsigned sysclk; | 45 | unsigned sysclk; |
46 | 46 | ||
47 | /* ASP1 on DM355 EVM is clocked by an external oscillator */ | 47 | /* ASP1 on DM355 EVM is clocked by an external oscillator */ |
48 | if (machine_is_davinci_dm355_evm() || machine_is_davinci_dm6467_evm()) | 48 | if (machine_is_davinci_dm355_evm() || machine_is_davinci_dm6467_evm() || |
49 | machine_is_davinci_dm365_evm()) | ||
49 | sysclk = 27000000; | 50 | sysclk = 27000000; |
50 | 51 | ||
51 | /* ASP0 in DM6446 EVM is clocked by U55, as configured by | 52 | /* ASP0 in DM6446 EVM is clocked by U55, as configured by |
@@ -176,7 +177,7 @@ static struct snd_soc_dai_link da8xx_evm_dai = { | |||
176 | .ops = &evm_ops, | 177 | .ops = &evm_ops, |
177 | }; | 178 | }; |
178 | 179 | ||
179 | /* davinci-evm audio machine driver */ | 180 | /* davinci dm6446, dm355 or dm365 evm audio machine driver */ |
180 | static struct snd_soc_card snd_soc_card_evm = { | 181 | static struct snd_soc_card snd_soc_card_evm = { |
181 | .name = "DaVinci EVM", | 182 | .name = "DaVinci EVM", |
182 | .platform = &davinci_soc_platform, | 183 | .platform = &davinci_soc_platform, |
@@ -243,7 +244,7 @@ static int __init evm_init(void) | |||
243 | int index; | 244 | int index; |
244 | int ret; | 245 | int ret; |
245 | 246 | ||
246 | if (machine_is_davinci_evm()) { | 247 | if (machine_is_davinci_evm() || machine_is_davinci_dm365_evm()) { |
247 | evm_snd_dev_data = &evm_snd_devdata; | 248 | evm_snd_dev_data = &evm_snd_devdata; |
248 | index = 0; | 249 | index = 0; |
249 | } else if (machine_is_davinci_dm355_evm()) { | 250 | } else if (machine_is_davinci_dm355_evm()) { |
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index 4ae70704802..2ab809359c0 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c | |||
@@ -397,6 +397,8 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | |||
397 | } | 397 | } |
398 | 398 | ||
399 | dma_params->acnt = dma_params->data_type; | 399 | dma_params->acnt = dma_params->data_type; |
400 | dma_params->fifo_level = 0; | ||
401 | |||
400 | rcr |= DAVINCI_MCBSP_RCR_RFRLEN1(1); | 402 | rcr |= DAVINCI_MCBSP_RCR_RFRLEN1(1); |
401 | xcr |= DAVINCI_MCBSP_XCR_XFRLEN1(1); | 403 | xcr |= DAVINCI_MCBSP_XCR_XFRLEN1(1); |
402 | 404 | ||
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 5d1f98a4c97..50ad0519a8f 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -714,16 +714,13 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
714 | struct davinci_pcm_dma_params *dma_params = | 714 | struct davinci_pcm_dma_params *dma_params = |
715 | &dev->dma_params[substream->stream]; | 715 | &dev->dma_params[substream->stream]; |
716 | int word_length; | 716 | int word_length; |
717 | u8 numevt; | 717 | u8 fifo_level; |
718 | 718 | ||
719 | davinci_hw_common_param(dev, substream->stream); | 719 | davinci_hw_common_param(dev, substream->stream); |
720 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 720 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
721 | numevt = dev->txnumevt; | 721 | fifo_level = dev->txnumevt; |
722 | else | 722 | else |
723 | numevt = dev->rxnumevt; | 723 | fifo_level = dev->rxnumevt; |
724 | |||
725 | if (!numevt) | ||
726 | numevt = 1; | ||
727 | 724 | ||
728 | if (dev->op_mode == DAVINCI_MCASP_DIT_MODE) | 725 | if (dev->op_mode == DAVINCI_MCASP_DIT_MODE) |
729 | davinci_hw_dit_param(dev); | 726 | davinci_hw_dit_param(dev); |
@@ -751,12 +748,12 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
751 | return -EINVAL; | 748 | return -EINVAL; |
752 | } | 749 | } |
753 | 750 | ||
754 | if (dev->version == MCASP_VERSION_2) { | 751 | if (dev->version == MCASP_VERSION_2 && !fifo_level) |
755 | dma_params->data_type *= numevt; | 752 | dma_params->acnt = 4; |
756 | dma_params->acnt = 4 * numevt; | 753 | else |
757 | } else | ||
758 | dma_params->acnt = dma_params->data_type; | 754 | dma_params->acnt = dma_params->data_type; |
759 | 755 | ||
756 | dma_params->fifo_level = fifo_level; | ||
760 | davinci_config_channel_size(dev, word_length); | 757 | davinci_config_channel_size(dev, word_length); |
761 | 758 | ||
762 | return 0; | 759 | return 0; |
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index c73a915f233..fb10f1d63fd 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c | |||
@@ -66,38 +66,53 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream) | |||
66 | dma_addr_t dma_pos; | 66 | dma_addr_t dma_pos; |
67 | dma_addr_t src, dst; | 67 | dma_addr_t src, dst; |
68 | unsigned short src_bidx, dst_bidx; | 68 | unsigned short src_bidx, dst_bidx; |
69 | unsigned short src_cidx, dst_cidx; | ||
69 | unsigned int data_type; | 70 | unsigned int data_type; |
70 | unsigned short acnt; | 71 | unsigned short acnt; |
71 | unsigned int count; | 72 | unsigned int count; |
73 | unsigned int fifo_level; | ||
72 | 74 | ||
73 | period_size = snd_pcm_lib_period_bytes(substream); | 75 | period_size = snd_pcm_lib_period_bytes(substream); |
74 | dma_offset = prtd->period * period_size; | 76 | dma_offset = prtd->period * period_size; |
75 | dma_pos = runtime->dma_addr + dma_offset; | 77 | dma_pos = runtime->dma_addr + dma_offset; |
78 | fifo_level = prtd->params->fifo_level; | ||
76 | 79 | ||
77 | pr_debug("davinci_pcm: audio_set_dma_params_play channel = %d " | 80 | pr_debug("davinci_pcm: audio_set_dma_params_play channel = %d " |
78 | "dma_ptr = %x period_size=%x\n", lch, dma_pos, period_size); | 81 | "dma_ptr = %x period_size=%x\n", lch, dma_pos, period_size); |
79 | 82 | ||
80 | data_type = prtd->params->data_type; | 83 | data_type = prtd->params->data_type; |
81 | count = period_size / data_type; | 84 | count = period_size / data_type; |
85 | if (fifo_level) | ||
86 | count /= fifo_level; | ||
82 | 87 | ||
83 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 88 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
84 | src = dma_pos; | 89 | src = dma_pos; |
85 | dst = prtd->params->dma_addr; | 90 | dst = prtd->params->dma_addr; |
86 | src_bidx = data_type; | 91 | src_bidx = data_type; |
87 | dst_bidx = 0; | 92 | dst_bidx = 0; |
93 | src_cidx = data_type * fifo_level; | ||
94 | dst_cidx = 0; | ||
88 | } else { | 95 | } else { |
89 | src = prtd->params->dma_addr; | 96 | src = prtd->params->dma_addr; |
90 | dst = dma_pos; | 97 | dst = dma_pos; |
91 | src_bidx = 0; | 98 | src_bidx = 0; |
92 | dst_bidx = data_type; | 99 | dst_bidx = data_type; |
100 | src_cidx = 0; | ||
101 | dst_cidx = data_type * fifo_level; | ||
93 | } | 102 | } |
94 | 103 | ||
95 | acnt = prtd->params->acnt; | 104 | acnt = prtd->params->acnt; |
96 | edma_set_src(lch, src, INCR, W8BIT); | 105 | edma_set_src(lch, src, INCR, W8BIT); |
97 | edma_set_dest(lch, dst, INCR, W8BIT); | 106 | edma_set_dest(lch, dst, INCR, W8BIT); |
98 | edma_set_src_index(lch, src_bidx, 0); | 107 | |
99 | edma_set_dest_index(lch, dst_bidx, 0); | 108 | edma_set_src_index(lch, src_bidx, src_cidx); |
100 | edma_set_transfer_params(lch, acnt, count, 1, 0, ASYNC); | 109 | edma_set_dest_index(lch, dst_bidx, dst_cidx); |
110 | |||
111 | if (!fifo_level) | ||
112 | edma_set_transfer_params(lch, acnt, count, 1, 0, ASYNC); | ||
113 | else | ||
114 | edma_set_transfer_params(lch, acnt, fifo_level, count, | ||
115 | fifo_level, ABSYNC); | ||
101 | 116 | ||
102 | prtd->period++; | 117 | prtd->period++; |
103 | if (unlikely(prtd->period >= runtime->periods)) | 118 | if (unlikely(prtd->period >= runtime->periods)) |
diff --git a/sound/soc/davinci/davinci-pcm.h b/sound/soc/davinci/davinci-pcm.h index 8746606efc8..c8b0d2baf05 100644 --- a/sound/soc/davinci/davinci-pcm.h +++ b/sound/soc/davinci/davinci-pcm.h | |||
@@ -23,6 +23,7 @@ struct davinci_pcm_dma_params { | |||
23 | enum dma_event_q eventq_no; /* event queue number */ | 23 | enum dma_event_q eventq_no; /* event queue number */ |
24 | unsigned char data_type; /* xfer data type */ | 24 | unsigned char data_type; /* xfer data type */ |
25 | unsigned char convert_mono_stereo; | 25 | unsigned char convert_mono_stereo; |
26 | unsigned int fifo_level; | ||
26 | }; | 27 | }; |
27 | 28 | ||
28 | 29 | ||