History

ASoC: ti: davinci-mcasp: Add asynchronous mode support

McASP has dedicated clock & frame sync registers for both transmit and receive. Currently McASP driver only supports synchronous behavior and couples both TX & RX settings. Add logic that enables asynchronous mode via ti,async-mode property. In async mode, playback & record can be done simultaneously with different audio configurations (tdm slots, tdm width, audio bit depth). Note the ability to have different tx/rx DSP formats (i2s, dsp_a, etc.), while possible in hardware, remains to be a gap as it require changes to the corresponding machine driver interface. Existing IIS (sync mode) and DIT mode logic remains mostly unchanged. Exceptions are IIS mode logic that previously assumed sync mode, which has now been made aware of the distinction. And shared logic across all modes also now checks for McASP tx/rx-specific driver attributes. Those attributes have been populated according to the original extent, ensuring no divergence in functionality. Constraints no longer applicable for async mode are skipped. Clock selection options have also been added to include rx/tx-only clk_ids, exposing independent configuration via the machine driver as well. Note that asynchronous mode is not applicable for McASP in DIT mode, which is a transmitter-only mode to interface w/ self-clocking formats.

Sen Wang committed 9 months ago

Commit 9db32701 parent 016efca3 files · +401 −101Browse files

Unified · Split

3 files
  1. include/linux/platform_data/davinci_asp.h +2 −1
  2. sound/soc/ti/davinci-mcasp.c +389 −100
  3. sound/soc/ti/davinci-mcasp.h +10 −0
include/linux/platform_data/davinci_asp.h+2−1
@@ -59,7 +59,8 @@ struct davinci_mcasp_pdata { · 58 unmodified lines
5959 bool i2s_accurate_sck;
6060
6161 /* McASP specific fields */
62− int tdm_slots;
62+ int tdm_slots_tx;
63+ int tdm_slots_rx;
6364 u8 op_mode;
6465 u8 dismod;
6566 u8 num_serializer;
sound/soc/ti/davinci-mcasp.c+389−100
@@ -71,6 +71,7 @@ struct davinci_mcasp_context { · 70 unmodified lines
7171 struct davinci_mcasp_ruledata {
7272 struct davinci_mcasp *mcasp;
7373 int serializers;
74+ int stream;
7475 };
7576
7677 struct davinci_mcasp {
@@ -88,21 +89,27 @@ struct davinci_mcasp { · 11 unmodified lines
8889 bool missing_audio_param;
8990
9091 /* McASP specific data */
91− int tdm_slots;
92+ int tdm_slots_tx;
93+ int tdm_slots_rx;
9294 u32 tdm_mask[2];
93− int slot_width;
95+ int slot_width_tx;
96+ int slot_width_rx;
9497 u8 op_mode;
9598 u8 dismod;
9699 u8 num_serializer;
97100 u8 *serial_dir;
98101 u8 version;
99− u8 bclk_div;
102+ u8 bclk_div_tx;
103+ u8 bclk_div_rx;
100104 int streams;
101105 u32 irq_request[2];
102106
103− int sysclk_freq;
107+ unsigned int sysclk_freq_tx;
108+ unsigned int sysclk_freq_rx;
104109 bool bclk_master;
105− u32 auxclk_fs_ratio;
110+ bool async_mode;
111+ u32 auxclk_fs_ratio_tx;
112+ u32 auxclk_fs_ratio_rx;
106113
107114 unsigned long pdir; /* Pin direction bitfield */
108115
@@ -204,6 +211,27 @@ static inline void mcasp_set_clk_pdir(struct davinci_mcasp *mcasp, bool enable) · 95 unmodified lines
204211 }
205212 }
206213
214+static inline void mcasp_set_clk_pdir_stream(struct davinci_mcasp *mcasp,
215+ int stream, bool enable)
216+{
217+ u32 bit, bit_end;
218+
219+ if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
220+ bit = PIN_BIT_ACLKX;
221+ bit_end = PIN_BIT_AFSX + 1;
222+ } else {
223+ bit = PIN_BIT_ACLKR;
224+ bit_end = PIN_BIT_AFSR + 1;
225+ }
226+
227+ for_each_set_bit_from(bit, &mcasp->pdir, bit_end) {
228+ if (enable)
229+ mcasp_set_bits(mcasp, DAVINCI_MCASP_PDIR_REG, BIT(bit));
230+ else
231+ mcasp_clr_bits(mcasp, DAVINCI_MCASP_PDIR_REG, BIT(bit));
232+ }
233+}
234+
207235 static inline void mcasp_set_axr_pdir(struct davinci_mcasp *mcasp, bool enable)
208236 {
209237 u32 bit;
@@ -216,6 +244,36 @@ static inline void mcasp_set_axr_pdir(struct davinci_mcasp *mcasp, bool enable) · 6 unmodified lines
216244 }
217245 }
218246
247+static inline int mcasp_get_tdm_slots(struct davinci_mcasp *mcasp, int stream)
248+{
249+ return (stream == SNDRV_PCM_STREAM_PLAYBACK) ?
250+ mcasp->tdm_slots_tx : mcasp->tdm_slots_rx;
251+}
252+
253+static inline int mcasp_get_slot_width(struct davinci_mcasp *mcasp, int stream)
254+{
255+ return (stream == SNDRV_PCM_STREAM_PLAYBACK) ?
256+ mcasp->slot_width_tx : mcasp->slot_width_rx;
257+}
258+
259+static inline unsigned int mcasp_get_sysclk_freq(struct davinci_mcasp *mcasp, int stream)
260+{
261+ return (stream == SNDRV_PCM_STREAM_PLAYBACK) ?
262+ mcasp->sysclk_freq_tx : mcasp->sysclk_freq_rx;
263+}
264+
265+static inline unsigned int mcasp_get_bclk_div(struct davinci_mcasp *mcasp, int stream)
266+{
267+ return (stream == SNDRV_PCM_STREAM_PLAYBACK) ?
268+ mcasp->bclk_div_tx : mcasp->bclk_div_rx;
269+}
270+
271+static inline unsigned int mcasp_get_auxclk_fs_ratio(struct davinci_mcasp *mcasp, int stream)
272+{
273+ return (stream == SNDRV_PCM_STREAM_PLAYBACK) ?
274+ mcasp->auxclk_fs_ratio_tx : mcasp->auxclk_fs_ratio_rx;
275+}
276+
219277 static void mcasp_start_rx(struct davinci_mcasp *mcasp)
220278 {
221279 if (mcasp->rxnumevt) { /* enable FIFO */
@@ -231,13 +289,17 @@ static void mcasp_start_rx(struct davinci_mcasp *mcasp) · 9 unmodified lines
231289 /*
232290 * When ASYNC == 0 the transmit and receive sections operate
233291 * synchronously from the transmit clock and frame sync. We need to make
234− * sure that the TX signlas are enabled when starting reception.
292+ * sure that the TX signals are enabled when starting reception,
293+ * when the McASP is the producer.
235294 */
236295 if (mcasp_is_frame_producer(mcasp) && mcasp_is_synchronous(mcasp)) {
237296 mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXHCLKRST);
238297 mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXCLKRST);
239298 }
240− mcasp_set_clk_pdir(mcasp, true);
299+ if (mcasp_is_synchronous(mcasp))
300+ mcasp_set_clk_pdir(mcasp, true);
301+ else
302+ mcasp_set_clk_pdir_stream(mcasp, SNDRV_PCM_STREAM_CAPTURE, true);
241303
242304 /* Activate serializer(s) */
243305 mcasp_set_reg(mcasp, DAVINCI_MCASP_RXSTAT_REG, 0xFFFFFFFF);
@@ -268,7 +330,10 @@ static void mcasp_start_tx(struct davinci_mcasp *mcasp) · 24 unmodified lines
268330 /* Start clocks */
269331 mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXHCLKRST);
270332 mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXCLKRST);
271− mcasp_set_clk_pdir(mcasp, true);
333+ if (mcasp_is_synchronous(mcasp))
334+ mcasp_set_clk_pdir(mcasp, true);
335+ else
336+ mcasp_set_clk_pdir_stream(mcasp, SNDRV_PCM_STREAM_PLAYBACK, true);
272337
273338 /* Activate serializer(s) */
274339 mcasp_set_reg(mcasp, DAVINCI_MCASP_TXSTAT_REG, 0xFFFFFFFF);
@@ -311,9 +376,17 @@ static void mcasp_stop_rx(struct davinci_mcasp *mcasp) · 36 unmodified lines
311376 /*
312377 * In synchronous mode stop the TX clocks if no other stream is
313378 * running
379+ * Otherwise in async mode only stop RX clocks
314380 */
315− if (!mcasp->streams)
381+ if (mcasp_is_synchronous(mcasp) && !mcasp->streams)
316382 mcasp_set_clk_pdir(mcasp, false);
383+ else if (!mcasp_is_synchronous(mcasp))
384+ mcasp_set_clk_pdir_stream(mcasp, SNDRV_PCM_STREAM_CAPTURE, false);
385+ /*
386+ * When McASP is the producer and operating in synchronous mode,
387+ * stop the transmit clocks if no other stream is running. As
388+ * tx & rx operate synchronously from the transmit clock.
389+ */
317390 if (mcasp_is_frame_producer(mcasp) && mcasp_is_synchronous(mcasp) && !mcasp->streams)
318391 mcasp_set_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, 0);
319392
@@ -338,11 +411,14 @@ static void mcasp_stop_tx(struct davinci_mcasp *mcasp) · 18 unmodified lines
338411 /*
339412 * In synchronous mode keep TX clocks running if the capture stream is
340413 * still running.
414+ * Otherwise in async mode only stop TX clocks
341415 */
342416 if (mcasp_is_frame_producer(mcasp) && mcasp_is_synchronous(mcasp) && mcasp->streams)
343417 val = TXHCLKRST | TXCLKRST | TXFSRST;
344− if (!mcasp->streams)
418+ if (mcasp_is_synchronous(mcasp) && !mcasp->streams)
345419 mcasp_set_clk_pdir(mcasp, false);
420+ else if (!mcasp_is_synchronous(mcasp))
421+ mcasp_set_clk_pdir_stream(mcasp, SNDRV_PCM_STREAM_PLAYBACK, false);
346422
347423
348424 mcasp_set_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, val);
@@ -626,13 +702,39 @@ static int __davinci_mcasp_set_clkdiv(struct davinci_mcasp *mcasp, int div_id, · 277 unmodified lines
626702 AHCLKRDIV(div - 1), AHCLKRDIV_MASK);
627703 break;
628704
705+ case MCASP_CLKDIV_AUXCLK_TXONLY: /* MCLK divider for TX only */
706+ mcasp_mod_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG,
707+ AHCLKXDIV(div - 1), AHCLKXDIV_MASK);
708+ break;
709+
710+ case MCASP_CLKDIV_AUXCLK_RXONLY: /* MCLK divider for RX only */
711+ mcasp_mod_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG,
712+ AHCLKRDIV(div - 1), AHCLKRDIV_MASK);
713+ break;
714+
629715 case MCASP_CLKDIV_BCLK: /* BCLK divider */
630716 mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG,
631717 ACLKXDIV(div - 1), ACLKXDIV_MASK);
718+ mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG,
719+ ACLKRDIV(div - 1), ACLKRDIV_MASK);
720+ if (explicit) {
721+ mcasp->bclk_div_tx = div;
722+ mcasp->bclk_div_rx = div;
723+ }
724+ break;
725+
726+ case MCASP_CLKDIV_BCLK_TXONLY: /* BCLK divider for TX only */
727+ mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG,
728+ ACLKXDIV(div - 1), ACLKXDIV_MASK);
729+ if (explicit)
730+ mcasp->bclk_div_tx = div;
731+ break;
732+
733+ case MCASP_CLKDIV_BCLK_RXONLY: /* BCLK divider for RX only */
632734 mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG,
633735 ACLKRDIV(div - 1), ACLKRDIV_MASK);
634736 if (explicit)
635− mcasp->bclk_div = div;
737+ mcasp->bclk_div_rx = div;
636738 break;
637739
638740 case MCASP_CLKDIV_BCLK_FS_RATIO:
@@ -646,11 +748,33 @@ static int __davinci_mcasp_set_clkdiv(struct davinci_mcasp *mcasp, int div_id, · 7 unmodified lines
646748 * tdm_slot width by dividing the ratio by the
647749 * number of configured tdm slots.
648750 */
649− mcasp->slot_width = div / mcasp->tdm_slots;
650− if (div % mcasp->tdm_slots)
751+ mcasp->slot_width_tx = div / mcasp->tdm_slots_tx;
752+ if (div % mcasp->tdm_slots_tx)
651753 dev_warn(mcasp->dev,
652− "%s(): BCLK/LRCLK %d is not divisible by %d tdm slots",
653− __func__, div, mcasp->tdm_slots);
754+ "%s(): BCLK/LRCLK %d is not divisible by %d tx tdm slots",
755+ __func__, div, mcasp->tdm_slots_tx);
756+
757+ mcasp->slot_width_rx = div / mcasp->tdm_slots_rx;
758+ if (div % mcasp->tdm_slots_rx)
759+ dev_warn(mcasp->dev,
760+ "%s(): BCLK/LRCLK %d is not divisible by %d rx tdm slots",
761+ __func__, div, mcasp->tdm_slots_rx);
762+ break;
763+
764+ case MCASP_CLKDIV_BCLK_FS_RATIO_TXONLY:
765+ mcasp->slot_width_tx = div / mcasp->tdm_slots_tx;
766+ if (div % mcasp->tdm_slots_tx)
767+ dev_warn(mcasp->dev,
768+ "%s(): BCLK/LRCLK %d is not divisible by %d tx tdm slots",
769+ __func__, div, mcasp->tdm_slots_tx);
770+ break;
771+
772+ case MCASP_CLKDIV_BCLK_FS_RATIO_RXONLY:
773+ mcasp->slot_width_rx = div / mcasp->tdm_slots_rx;
774+ if (div % mcasp->tdm_slots_rx)
775+ dev_warn(mcasp->dev,
776+ "%s(): BCLK/LRCLK %d is not divisible by %d rx tdm slots",
777+ __func__, div, mcasp->tdm_slots_rx);
654778 break;
655779
656780 default:
@@ -684,6 +808,20 @@ static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id, · 27 unmodified lines
684808 mcasp_clr_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG,
685809 AHCLKRE);
686810 clear_bit(PIN_BIT_AHCLKX, &mcasp->pdir);
811+ mcasp->sysclk_freq_tx = freq;
812+ mcasp->sysclk_freq_rx = freq;
813+ break;
814+ case MCASP_CLK_HCLK_AHCLK_TXONLY:
815+ mcasp_clr_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG,
816+ AHCLKXE);
817+ clear_bit(PIN_BIT_AHCLKX, &mcasp->pdir);
818+ mcasp->sysclk_freq_tx = freq;
819+ break;
820+ case MCASP_CLK_HCLK_AHCLK_RXONLY:
821+ mcasp_clr_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG,
822+ AHCLKRE);
823+ clear_bit(PIN_BIT_AHCLKR, &mcasp->pdir);
824+ mcasp->sysclk_freq_rx = freq;
687825 break;
688826 case MCASP_CLK_HCLK_AUXCLK:
689827 mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG,
@@ -691,22 +829,56 @@ static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id, · 1 unmodified line
691829 mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG,
692830 AHCLKRE);
693831 set_bit(PIN_BIT_AHCLKX, &mcasp->pdir);
832+ mcasp->sysclk_freq_tx = freq;
833+ mcasp->sysclk_freq_rx = freq;
834+ break;
835+ case MCASP_CLK_HCLK_AUXCLK_TXONLY:
836+ mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG,
837+ AHCLKXE);
838+ set_bit(PIN_BIT_AHCLKX, &mcasp->pdir);
839+ mcasp->sysclk_freq_tx = freq;
840+ break;
841+ case MCASP_CLK_HCLK_AUXCLK_RXONLY:
842+ mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG,
843+ AHCLKRE);
844+ set_bit(PIN_BIT_AHCLKR, &mcasp->pdir);
845+ mcasp->sysclk_freq_rx = freq;
694846 break;
695847 default:
696848 dev_err(mcasp->dev, "Invalid clk id: %d\n", clk_id);
697849 goto out;
698850 }
699851 } else {
700− /* Select AUXCLK as HCLK */
701− mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE);
702− mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG, AHCLKRE);
703− set_bit(PIN_BIT_AHCLKX, &mcasp->pdir);
852+ /* McASP is clock master, select AUXCLK as HCLK */
853+ switch (clk_id) {
854+ case MCASP_CLK_HCLK_AUXCLK_TXONLY:
855+ mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG,
856+ AHCLKXE);
857+ set_bit(PIN_BIT_AHCLKX, &mcasp->pdir);
858+ mcasp->sysclk_freq_tx = freq;
859+ break;
860+ case MCASP_CLK_HCLK_AUXCLK_RXONLY:
861+ mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG,
862+ AHCLKRE);
863+ set_bit(PIN_BIT_AHCLKR, &mcasp->pdir);
864+ mcasp->sysclk_freq_rx = freq;
865+ break;
866+ default:
867+ mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG,
868+ AHCLKXE);
869+ mcasp_set_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG,
870+ AHCLKRE);
871+ set_bit(PIN_BIT_AHCLKX, &mcasp->pdir);
872+ set_bit(PIN_BIT_AHCLKR, &mcasp->pdir);
873+ mcasp->sysclk_freq_tx = freq;
874+ mcasp->sysclk_freq_rx = freq;
875+ break;
876+ }
704877 }
705878 /*
706879 * When AHCLK X/R is selected to be output it means that the HCLK is
707880 * the same clock - coming via AUXCLK.
708881 */
709− mcasp->sysclk_freq = freq;
710882 out:
711883 pm_runtime_put(mcasp->dev);
712884 return 0;
@@ -718,9 +890,11 @@ static int davinci_mcasp_ch_constraint(struct davinci_mcasp *mcasp, int stream, · 5 unmodified lines
718890 {
719891 struct snd_pcm_hw_constraint_list *cl = &mcasp->chconstr[stream];
720892 unsigned int *list = (unsigned int *) cl->list;
721− int slots = mcasp->tdm_slots;
893+ int slots;
722894 int i, count = 0;
723895
896+ slots = mcasp_get_tdm_slots(mcasp, stream);
897+
724898 if (mcasp->tdm_mask[stream])
725899 slots = hweight32(mcasp->tdm_mask[stream]);
726900
@@ -785,27 +959,42 @@ static int davinci_mcasp_set_tdm_slot(struct snd_soc_dai *dai, · 58 unmodified lines
785959 return -EINVAL;
786960 }
787961
788− mcasp->tdm_slots = slots;
962+ if (mcasp->async_mode) {
963+ if (tx_mask) {
964+ mcasp->tdm_slots_tx = slots;
965+ mcasp->slot_width_tx = slot_width;
966+ }
967+ if (rx_mask) {
968+ mcasp->tdm_slots_rx = slots;
969+ mcasp->slot_width_rx = slot_width;
970+ }
971+ } else {
972+ mcasp->tdm_slots_tx = slots;
973+ mcasp->tdm_slots_rx = slots;
974+ mcasp->slot_width_tx = slot_width;
975+ mcasp->slot_width_rx = slot_width;
976+ }
977+
789978 mcasp->tdm_mask[SNDRV_PCM_STREAM_PLAYBACK] = tx_mask;
790979 mcasp->tdm_mask[SNDRV_PCM_STREAM_CAPTURE] = rx_mask;
791− mcasp->slot_width = slot_width;
792980
793981 return davinci_mcasp_set_ch_constraints(mcasp);
794982 }
795983
796984 static int davinci_config_channel_size(struct davinci_mcasp *mcasp,
797− int sample_width)
985+ int sample_width, int stream)
798986 {
799987 u32 fmt;
800988 u32 tx_rotate, rx_rotate, slot_width;
801989 u32 mask = (1ULL << sample_width) - 1;
802990
803− if (mcasp->slot_width)
804− slot_width = mcasp->slot_width;
805− else if (mcasp->max_format_width)
806− slot_width = mcasp->max_format_width;
807− else
808− slot_width = sample_width;
991+ slot_width = mcasp_get_slot_width(mcasp, stream);
992+ if (!slot_width) {
993+ if (mcasp->max_format_width)
994+ slot_width = mcasp->max_format_width;
995+ else
996+ slot_width = sample_width;
997+ }
809998 /*
810999 * TX rotation:
8111000 * right aligned formats: rotate w/ slot_width
@@ -828,17 +1017,23 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp, · 16 unmodified lines
8281017 fmt = (slot_width >> 1) - 1;
8291018
8301019 if (mcasp->op_mode != DAVINCI_MCASP_DIT_MODE) {
831− mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, RXSSZ(fmt),
832− RXSSZ(0x0F));
833− mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXSSZ(fmt),
834− TXSSZ(0x0F));
835− mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXROT(tx_rotate),
836− TXROT(7));
837− mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, RXROT(rx_rotate),
838− RXROT(7));
839− mcasp_set_reg(mcasp, DAVINCI_MCASP_RXMASK_REG, mask);
1020+ if (!mcasp->async_mode || stream == SNDRV_PCM_STREAM_PLAYBACK) {
1021+ mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXSSZ(fmt),
1022+ TXSSZ(0x0F));
1023+ mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXROT(tx_rotate),
1024+ TXROT(7));
1025+ mcasp_set_reg(mcasp, DAVINCI_MCASP_TXMASK_REG, mask);
1026+ }
1027+ if (!mcasp->async_mode || stream == SNDRV_PCM_STREAM_CAPTURE) {
1028+ mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, RXSSZ(fmt),
1029+ RXSSZ(0x0F));
1030+ mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, RXROT(rx_rotate),
1031+ RXROT(7));
1032+ mcasp_set_reg(mcasp, DAVINCI_MCASP_RXMASK_REG, mask);
1033+ }
8401034 } else {
8411035 /*
1036+ * DIT mode only use TX serializers
8421037 * according to the TRM it should be TXROT=0, this one works:
8431038 * 16 bit to 23-8 (TXROT=6, rotate 24 bits)
8441039 * 24 bit to 23-0 (TXROT=0, rotate 0 bits)
@@ -851,10 +1046,9 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp, · 6 unmodified lines
8511046 TXROT(7));
8521047 mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXSSZ(15),
8531048 TXSSZ(0x0F));
1049+ mcasp_set_reg(mcasp, DAVINCI_MCASP_TXMASK_REG, mask);
8541050 }
8551051
856− mcasp_set_reg(mcasp, DAVINCI_MCASP_TXMASK_REG, mask);
857−
8581052 return 0;
8591053 }
8601054
@@ -865,11 +1059,13 @@ static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream, · 4 unmodified lines
8651059 int i;
8661060 u8 tx_ser = 0;
8671061 u8 rx_ser = 0;
868− u8 slots = mcasp->tdm_slots;
1062+ int slots;
8691063 u8 max_active_serializers, max_rx_serializers, max_tx_serializers;
8701064 int active_serializers, numevt;
8711065 u32 reg;
8721066
1067+ slots = mcasp_get_tdm_slots(mcasp, stream);
1068+
8731069 /* In DIT mode we only allow maximum of one serializers for now */
8741070 if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE)
8751071 max_active_serializers = 1;
@@ -997,7 +1193,7 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream, · 121 unmodified lines
9971193 u32 mask = 0;
9981194 u32 busel = 0;
9991195
1000− total_slots = mcasp->tdm_slots;
1196+ total_slots = mcasp_get_tdm_slots(mcasp, stream);
10011197
10021198 /*
10031199 * If more than one serializer is needed, then use them with
@@ -1028,7 +1224,10 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream, · 24 unmodified lines
10281224 mask |= (1 << i);
10291225 }
10301226
1031− mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC);
1227+ if (mcasp->async_mode)
1228+ mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC);
1229+ else
1230+ mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC);
10321231
10331232 if (!mcasp->dat_port)
10341233 busel = TXSEL;
@@ -1127,16 +1326,33 @@ static int mcasp_dit_hw_param(struct davinci_mcasp *mcasp, · 92 unmodified lines
11271326
11281327 static int davinci_mcasp_calc_clk_div(struct davinci_mcasp *mcasp,
11291328 unsigned int sysclk_freq,
1130− unsigned int bclk_freq, bool set)
1329+ unsigned int bclk_freq,
1330+ int stream,
1331+ bool set)
11311332 {
1132− u32 reg = mcasp_get_reg(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG);
11331333 int div = sysclk_freq / bclk_freq;
11341334 int rem = sysclk_freq % bclk_freq;
11351335 int error_ppm;
11361336 int aux_div = 1;
1337+ int bclk_div_id, auxclk_div_id;
1338+ bool auxclk_enabled;
1339+
1340+ if (mcasp->async_mode && stream == SNDRV_PCM_STREAM_CAPTURE) {
1341+ auxclk_enabled = mcasp_get_reg(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG) & AHCLKRE;
1342+ bclk_div_id = MCASP_CLKDIV_BCLK_RXONLY;
1343+ auxclk_div_id = MCASP_CLKDIV_AUXCLK_RXONLY;
1344+ } else if (mcasp->async_mode && stream == SNDRV_PCM_STREAM_PLAYBACK) {
1345+ auxclk_enabled = mcasp_get_reg(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG) & AHCLKXE;
1346+ bclk_div_id = MCASP_CLKDIV_BCLK_TXONLY;
1347+ auxclk_div_id = MCASP_CLKDIV_AUXCLK_TXONLY;
1348+ } else {
1349+ auxclk_enabled = mcasp_get_reg(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG) & AHCLKXE;
1350+ bclk_div_id = MCASP_CLKDIV_BCLK;
1351+ auxclk_div_id = MCASP_CLKDIV_AUXCLK;
1352+ }
11371353
11381354 if (div > (ACLKXDIV_MASK + 1)) {
1139− if (reg & AHCLKXE) {
1355+ if (auxclk_enabled) {
11401356 aux_div = div / (ACLKXDIV_MASK + 1);
11411357 if (div % (ACLKXDIV_MASK + 1))
11421358 aux_div++;
@@ -1166,10 +1382,10 @@ static int davinci_mcasp_calc_clk_div(struct davinci_mcasp *mcasp, · 23 unmodified lines
11661382 dev_info(mcasp->dev, "Sample-rate is off by %d PPM\n",
11671383 error_ppm);
11681384
1169− __davinci_mcasp_set_clkdiv(mcasp, MCASP_CLKDIV_BCLK, div, 0);
1170− if (reg & AHCLKXE)
1171− __davinci_mcasp_set_clkdiv(mcasp, MCASP_CLKDIV_AUXCLK,
1172− aux_div, 0);
1385+ __davinci_mcasp_set_clkdiv(mcasp, bclk_div_id, div, false);
1386+ if (auxclk_enabled)
1387+ __davinci_mcasp_set_clkdiv(mcasp, auxclk_div_id,
1388+ aux_div, false);
11731389 }
11741390
11751391 return error_ppm;
@@ -1220,6 +1436,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, · 44 unmodified lines
12201436 int channels = params_channels(params);
12211437 int period_size = params_period_size(params);
12221438 int ret;
1439+ unsigned int sysclk_freq = mcasp_get_sysclk_freq(mcasp, substream->stream);
12231440
12241441 switch (params_format(params)) {
12251442 case SNDRV_PCM_FORMAT_U8:
@@ -1260,22 +1477,26 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, · 34 unmodified lines
12601477 * If mcasp is BCLK master, and a BCLK divider was not provided by
12611478 * the machine driver, we need to calculate the ratio.
12621479 */
1263− if (mcasp->bclk_master && mcasp->bclk_div == 0 && mcasp->sysclk_freq) {
1264− int slots = mcasp->tdm_slots;
1480+ if (mcasp->bclk_master && mcasp_get_bclk_div(mcasp, substream->stream) == 0 &&
1481+ sysclk_freq) {
1482+ int slots, slot_width;
12651483 int rate = params_rate(params);
12661484 int sbits = params_width(params);
12671485 unsigned int bclk_target;
12681486
1269− if (mcasp->slot_width)
1270− sbits = mcasp->slot_width;
1487+ slots = mcasp_get_tdm_slots(mcasp, substream->stream);
1488+
1489+ slot_width = mcasp_get_slot_width(mcasp, substream->stream);
1490+ if (slot_width)
1491+ sbits = slot_width;
12711492
12721493 if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE)
12731494 bclk_target = rate * sbits * slots;
12741495 else
12751496 bclk_target = rate * 128;
12761497
1277− davinci_mcasp_calc_clk_div(mcasp, mcasp->sysclk_freq,
1278− bclk_target, true);
1498+ davinci_mcasp_calc_clk_div(mcasp, sysclk_freq,
1499+ bclk_target, substream->stream, true);
12791500 }
12801501
12811502 ret = mcasp_common_hw_param(mcasp, substream->stream,
@@ -1292,9 +1513,10 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, · 10 unmodified lines
12921513 if (ret)
12931514 return ret;
12941515
1295− davinci_config_channel_size(mcasp, word_length);
1516+ davinci_config_channel_size(mcasp, word_length, substream->stream);
12961517
1297− if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE) {
1518+ /* Channel constraints are disabled for async mode */
1519+ if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE && !mcasp->async_mode) {
12981520 mcasp->channels = channels;
12991521 if (!mcasp->max_format_width)
13001522 mcasp->max_format_width = word_length;
@@ -1338,7 +1560,7 @@ static int davinci_mcasp_hw_rule_slot_width(struct snd_pcm_hw_params *params, · 37 unmodified lines
13381560 snd_pcm_format_t i;
13391561
13401562 snd_mask_none(&nfmt);
1341− slot_width = rd->mcasp->slot_width;
1563+ slot_width = mcasp_get_slot_width(rd->mcasp, rd->stream);
13421564
13431565 pcm_for_each_format(i) {
13441566 if (snd_mask_test_format(fmt, i)) {
@@ -1388,12 +1610,15 @@ static int davinci_mcasp_hw_rule_rate(struct snd_pcm_hw_params *params, · 43 unmodified lines
13881610 struct snd_interval *ri =
13891611 hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
13901612 int sbits = params_width(params);
1391− int slots = rd->mcasp->tdm_slots;
1613+ int slots, slot_width;
13921614 struct snd_interval range;
13931615 int i;
13941616
1395− if (rd->mcasp->slot_width)
1396− sbits = rd->mcasp->slot_width;
1617+ slots = mcasp_get_tdm_slots(rd->mcasp, rd->stream);
1618+
1619+ slot_width = mcasp_get_slot_width(rd->mcasp, rd->stream);
1620+ if (slot_width)
1621+ sbits = slot_width;
13971622
13981623 snd_interval_any(&range);
13991624 range.empty = 1;
@@ -1403,16 +1628,17 @@ static int davinci_mcasp_hw_rule_rate(struct snd_pcm_hw_params *params, · 3 unmodified lines
14031628 uint bclk_freq = sbits * slots *
14041629 davinci_mcasp_dai_rates[i];
14051630 unsigned int sysclk_freq;
1631+ unsigned int ratio;
14061632 int ppm;
14071633
1408− if (rd->mcasp->auxclk_fs_ratio)
1409− sysclk_freq = davinci_mcasp_dai_rates[i] *
1410− rd->mcasp->auxclk_fs_ratio;
1634+ ratio = mcasp_get_auxclk_fs_ratio(rd->mcasp, rd->stream);
1635+ if (ratio)
1636+ sysclk_freq = davinci_mcasp_dai_rates[i] * ratio;
14111637 else
1412− sysclk_freq = rd->mcasp->sysclk_freq;
1638+ sysclk_freq = mcasp_get_sysclk_freq(rd->mcasp, rd->stream);
14131639
14141640 ppm = davinci_mcasp_calc_clk_div(rd->mcasp, sysclk_freq,
1415− bclk_freq, false);
1641+ bclk_freq, rd->stream, false);
14161642 if (abs(ppm) < DAVINCI_MAX_RATE_ERROR_PPM) {
14171643 if (range.empty) {
14181644 range.min = davinci_mcasp_dai_rates[i];
@@ -1438,30 +1664,34 @@ static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params, · 19 unmodified lines
14381664 struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
14391665 struct snd_mask nfmt;
14401666 int rate = params_rate(params);
1441− int slots = rd->mcasp->tdm_slots;
1667+ int slots;
14421668 int count = 0;
14431669 snd_pcm_format_t i;
14441670
1671+ slots = mcasp_get_tdm_slots(rd->mcasp, rd->stream);
1672+
14451673 snd_mask_none(&nfmt);
14461674
14471675 pcm_for_each_format(i) {
14481676 if (snd_mask_test_format(fmt, i)) {
14491677 uint sbits = snd_pcm_format_width(i);
14501678 unsigned int sysclk_freq;
1451− int ppm;
1679+ unsigned int ratio;
1680+ int ppm, slot_width;
14521681
1453− if (rd->mcasp->auxclk_fs_ratio)
1454− sysclk_freq = rate *
1455− rd->mcasp->auxclk_fs_ratio;
1682+ ratio = mcasp_get_auxclk_fs_ratio(rd->mcasp, rd->stream);
1683+ if (ratio)
1684+ sysclk_freq = rate * ratio;
14561685 else
1457− sysclk_freq = rd->mcasp->sysclk_freq;
1686+ sysclk_freq = mcasp_get_sysclk_freq(rd->mcasp, rd->stream);
14581687
1459− if (rd->mcasp->slot_width)
1460− sbits = rd->mcasp->slot_width;
1688+ slot_width = mcasp_get_slot_width(rd->mcasp, rd->stream);
1689+ if (slot_width)
1690+ sbits = slot_width;
14611691
14621692 ppm = davinci_mcasp_calc_clk_div(rd->mcasp, sysclk_freq,
14631693 sbits * slots * rate,
1464− false);
1694+ rd->stream, false);
14651695 if (abs(ppm) < DAVINCI_MAX_RATE_ERROR_PPM) {
14661696 snd_mask_set_format(&nfmt, i);
14671697 count++;
@@ -1498,7 +1728,7 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, · 30 unmodified lines
14981728 &mcasp->ruledata[substream->stream];
14991729 u32 max_channels = 0;
15001730 int i, dir, ret;
1501− int tdm_slots = mcasp->tdm_slots;
1731+ int tdm_slots;
15021732 u8 *numevt;
15031733
15041734 /* Do not allow more then one stream per direction */
@@ -1507,6 +1737,8 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, · 2 unmodified lines
15071737
15081738 mcasp->substreams[substream->stream] = substream;
15091739
1740+ tdm_slots = mcasp_get_tdm_slots(mcasp, substream->stream);
1741+
15101742 if (mcasp->tdm_mask[substream->stream])
15111743 tdm_slots = hweight32(mcasp->tdm_mask[substream->stream]);
15121744
@@ -1528,6 +1760,7 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, · 15 unmodified lines
15281760 }
15291761 ruledata->serializers = max_channels;
15301762 ruledata->mcasp = mcasp;
1763+ ruledata->stream = substream->stream;
15311764 max_channels *= tdm_slots;
15321765 /*
15331766 * If the already active stream has less channels than the calculated
@@ -1535,9 +1768,13 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, · 1 unmodified line
15351768 * is in use we need to use that as a constraint for the second stream.
15361769 * Otherwise (first stream or less allowed channels or more than one
15371770 * serializer in use) we use the calculated constraint.
1771+ *
1772+ * However, in async mode, TX and RX have independent clocks and can
1773+ * use different configurations, so don't apply the constraint.
15381774 */
15391775 if (mcasp->channels && mcasp->channels < max_channels &&
1540− ruledata->serializers == 1)
1776+ ruledata->serializers == 1 &&
1777+ !mcasp->async_mode)
15411778 max_channels = mcasp->channels;
15421779 /*
15431780 * But we can always allow channels upto the amount of
@@ -1554,10 +1791,10 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, · 10 unmodified lines
15541791 0, SNDRV_PCM_HW_PARAM_CHANNELS,
15551792 &mcasp->chconstr[substream->stream]);
15561793
1557− if (mcasp->max_format_width) {
1794+ if (mcasp->max_format_width && !mcasp->async_mode) {
15581795 /*
15591796 * Only allow formats which require same amount of bits on the
1560− * bus as the currently running stream
1797+ * bus as the currently running stream to ensure sync mode
15611798 */
15621799 ret = snd_pcm_hw_rule_add(substream->runtime, 0,
15631800 SNDRV_PCM_HW_PARAM_FORMAT,
@@ -1566,8 +1803,7 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, · 2 unmodified lines
15661803 SNDRV_PCM_HW_PARAM_FORMAT, -1);
15671804 if (ret)
15681805 return ret;
1569− }
1570− else if (mcasp->slot_width) {
1806+ } else if (mcasp_get_slot_width(mcasp, substream->stream)) {
15711807 /* Only allow formats require <= slot_width bits on the bus */
15721808 ret = snd_pcm_hw_rule_add(substream->runtime, 0,
15731809 SNDRV_PCM_HW_PARAM_FORMAT,
@@ -1582,7 +1818,8 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, · 8 unmodified lines
15821818 * If we rely on implicit BCLK divider setting we should
15831819 * set constraints based on what we can provide.
15841820 */
1585− if (mcasp->bclk_master && mcasp->bclk_div == 0 && mcasp->sysclk_freq) {
1821+ if (mcasp->bclk_master && mcasp_get_bclk_div(mcasp, substream->stream) == 0 &&
1822+ mcasp_get_sysclk_freq(mcasp, substream->stream)) {
15861823 ret = snd_pcm_hw_rule_add(substream->runtime, 0,
15871824 SNDRV_PCM_HW_PARAM_RATE,
15881825 davinci_mcasp_hw_rule_rate,
@@ -1759,8 +1996,6 @@ static struct snd_soc_dai_driver davinci_mcasp_dai[] = { · 170 unmodified lines
17591996 .formats = DAVINCI_MCASP_PCM_FMTS,
17601997 },
17611998 .ops = &davinci_mcasp_dai_ops,
1762−
1763− .symmetric_rate = 1,
17641999 },
17652000 {
17662001 .name = "davinci-mcasp.1",
@@ -1918,18 +2153,33 @@ static int davinci_mcasp_get_config(struct davinci_mcasp *mcasp, · 151 unmodified lines
19182153 goto out;
19192154 }
19202155
2156+ /* Parse TX-specific TDM slot and use it as default for RX */
19212157 if (of_property_read_u32(np, "tdm-slots", &val) == 0) {
19222158 if (val < 2 || val > 32) {
1923− dev_err(&pdev->dev, "tdm-slots must be in rage [2-32]\n");
2159+ dev_err(&pdev->dev, "tdm-slots must be in range [2-32]\n");
19242160 return -EINVAL;
19252161 }
19262162
1927− pdata->tdm_slots = val;
2163+ pdata->tdm_slots_tx = val;
2164+ pdata->tdm_slots_rx = val;
19282165 } else if (pdata->op_mode == DAVINCI_MCASP_IIS_MODE) {
19292166 mcasp->missing_audio_param = true;
19302167 goto out;
19312168 }
19322169
2170+ /* Parse RX-specific TDM slot count if provided */
2171+ if (of_property_read_u32(np, "tdm-slots-rx", &val) == 0) {
2172+ if (val < 2 || val > 32) {
2173+ dev_err(&pdev->dev, "tdm-slots-rx must be in range [2-32]\n");
2174+ return -EINVAL;
2175+ }
2176+
2177+ pdata->tdm_slots_rx = val;
2178+ }
2179+
2180+ if (pdata->op_mode != DAVINCI_MCASP_DIT_MODE)
2181+ mcasp->async_mode = of_property_read_bool(np, "ti,async-mode");
2182+
19332183 of_serial_dir32 = of_get_property(np, "serial-dir", &val);
19342184 val /= sizeof(u32);
19352185 if (of_serial_dir32) {
@@ -1955,8 +2205,15 @@ static int davinci_mcasp_get_config(struct davinci_mcasp *mcasp, · 19 unmodified lines
19552205 if (of_property_read_u32(np, "rx-num-evt", &val) == 0)
19562206 pdata->rxnumevt = val;
19572207
1958− if (of_property_read_u32(np, "auxclk-fs-ratio", &val) == 0)
1959− mcasp->auxclk_fs_ratio = val;
2208+ /* Parse TX-specific auxclk/fs ratio and use it as default for RX */
2209+ if (of_property_read_u32(np, "auxclk-fs-ratio", &val) == 0) {
2210+ mcasp->auxclk_fs_ratio_tx = val;
2211+ mcasp->auxclk_fs_ratio_rx = val;
2212+ }
2213+
2214+ /* Parse RX-specific auxclk/fs ratio if provided */
2215+ if (of_property_read_u32(np, "auxclk-fs-ratio-rx", &val) == 0)
2216+ mcasp->auxclk_fs_ratio_rx = val;
19602217
19612218 if (of_property_read_u32(np, "dismod", &val) == 0) {
19622219 if (val == 0 || val == 2 || val == 3) {
@@ -1985,19 +2242,51 @@ out: · 22 unmodified lines
19852242 mcasp->op_mode = pdata->op_mode;
19862243 /* sanity check for tdm slots parameter */
19872244 if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE) {
1988− if (pdata->tdm_slots < 2) {
1989− dev_warn(&pdev->dev, "invalid tdm slots: %d\n",
1990− pdata->tdm_slots);
1991− mcasp->tdm_slots = 2;
1992− } else if (pdata->tdm_slots > 32) {
1993− dev_warn(&pdev->dev, "invalid tdm slots: %d\n",
1994− pdata->tdm_slots);
1995− mcasp->tdm_slots = 32;
2245+ if (pdata->tdm_slots_tx < 2) {
2246+ dev_warn(&pdev->dev, "invalid tdm tx slots: %d\n",
2247+ pdata->tdm_slots_tx);
2248+ mcasp->tdm_slots_tx = 2;
2249+ } else if (pdata->tdm_slots_tx > 32) {
2250+ dev_warn(&pdev->dev, "invalid tdm tx slots: %d\n",
2251+ pdata->tdm_slots_tx);
2252+ mcasp->tdm_slots_tx = 32;
2253+ } else {
2254+ mcasp->tdm_slots_tx = pdata->tdm_slots_tx;
2255+ }
2256+
2257+ if (pdata->tdm_slots_rx < 2) {
2258+ dev_warn(&pdev->dev, "invalid tdm rx slots: %d\n",
2259+ pdata->tdm_slots_rx);
2260+ mcasp->tdm_slots_rx = 2;
2261+ } else if (pdata->tdm_slots_rx > 32) {
2262+ dev_warn(&pdev->dev, "invalid tdm rx slots: %d\n",
2263+ pdata->tdm_slots_rx);
2264+ mcasp->tdm_slots_rx = 32;
19962265 } else {
1997− mcasp->tdm_slots = pdata->tdm_slots;
2266+ mcasp->tdm_slots_rx = pdata->tdm_slots_rx;
19982267 }
19992268 } else {
2000− mcasp->tdm_slots = 32;
2269+ mcasp->tdm_slots_tx = 32;
2270+ mcasp->tdm_slots_rx = 32;
2271+ }
2272+
2273+ /* Different TX/RX slot counts require async mode */
2274+ if (pdata->op_mode != DAVINCI_MCASP_DIT_MODE &&
2275+ mcasp->tdm_slots_tx != mcasp->tdm_slots_rx && !mcasp->async_mode) {
2276+ dev_err(&pdev->dev,
2277+ "Different TX (%d) and RX (%d) TDM slots require ti,async-mode\n",
2278+ mcasp->tdm_slots_tx, mcasp->tdm_slots_rx);
2279+ return -EINVAL;
2280+ }
2281+
2282+ /* Different TX/RX auxclk-fs-ratio require async mode */
2283+ if (pdata->op_mode != DAVINCI_MCASP_DIT_MODE &&
2284+ mcasp->auxclk_fs_ratio_tx && mcasp->auxclk_fs_ratio_rx &&
2285+ mcasp->auxclk_fs_ratio_tx != mcasp->auxclk_fs_ratio_rx && !mcasp->async_mode) {
2286+ dev_err(&pdev->dev,
2287+ "Different TX (%d) and RX (%d) auxclk-fs-ratio require ti,async-mode\n",
2288+ mcasp->auxclk_fs_ratio_tx, mcasp->auxclk_fs_ratio_rx);
2289+ return -EINVAL;
20012290 }
20022291
20032292 mcasp->num_serializer = pdata->num_serializer;
sound/soc/ti/davinci-mcasp.h+10−0
@@ -298,10 +298,20 @@ · 297 unmodified lines
298298 /* Source of High-frequency transmit/receive clock */
299299 #define MCASP_CLK_HCLK_AHCLK 0 /* AHCLKX/R */
300300 #define MCASP_CLK_HCLK_AUXCLK 1 /* Internal functional clock */
301+#define MCASP_CLK_HCLK_AHCLK_TXONLY 2 /* AHCLKX for TX only */
302+#define MCASP_CLK_HCLK_AHCLK_RXONLY 3 /* AHCLKR for RX only */
303+#define MCASP_CLK_HCLK_AUXCLK_TXONLY 4 /* AUXCLK for TX only */
304+#define MCASP_CLK_HCLK_AUXCLK_RXONLY 5 /* AUXCLK for RX only */
301305
302306 /* clock divider IDs */
303307 #define MCASP_CLKDIV_AUXCLK 0 /* HCLK divider from AUXCLK */
304308 #define MCASP_CLKDIV_BCLK 1 /* BCLK divider from HCLK */
305309 #define MCASP_CLKDIV_BCLK_FS_RATIO 2 /* to set BCLK FS ration */
310+#define MCASP_CLKDIV_AUXCLK_TXONLY 3 /* AUXCLK divider for TX only */
311+#define MCASP_CLKDIV_AUXCLK_RXONLY 4 /* AUXCLK divider for RX only */
312+#define MCASP_CLKDIV_BCLK_TXONLY 5 /* BCLK divider for TX only */
313+#define MCASP_CLKDIV_BCLK_RXONLY 6 /* BCLK divider for RX only */
314+#define MCASP_CLKDIV_BCLK_FS_RATIO_TXONLY 7 /* BCLK/FS ratio for TX only */
315+#define MCASP_CLKDIV_BCLK_FS_RATIO_RXONLY 8 /* BCLK/FS ratio for RX only*/
306316
307317 #endif /* DAVINCI_MCASP_H */