xref: /linux/include/linux/platform_data/davinci_asp.h (revision 33e02dc69afbd8f1b85a51d74d72f139ba4ca623)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * TI DaVinci Audio Serial Port support
4  *
5  * Copyright (C) 2012 Texas Instruments Incorporated - https://www.ti.com/
6  */
7 
8 #ifndef __DAVINCI_ASP_H
9 #define __DAVINCI_ASP_H
10 
11 #include <linux/genalloc.h>
12 
13 struct davinci_mcasp_pdata {
14 	u32 tx_dma_offset;
15 	u32 rx_dma_offset;
16 	int asp_chan_q;	/* event queue number for ASP channel */
17 	int ram_chan_q;	/* event queue number for RAM channel */
18 	/*
19 	 * Allowing this is more efficient and eliminates left and right swaps
20 	 * caused by underruns, but will swap the left and right channels
21 	 * when compared to previous behavior.
22 	 */
23 	unsigned enable_channel_combine:1;
24 	unsigned sram_size_playback;
25 	unsigned sram_size_capture;
26 	struct gen_pool *sram_pool;
27 
28 	/*
29 	 * This flag works when both clock and FS are outputs for the cpu
30 	 * and makes clock more accurate (FS is not symmetrical and the
31 	 * clock is very fast.
32 	 * The clock becoming faster is named
33 	 * i2s continuous serial clock (I2S_SCK) and it is an externally
34 	 * visible bit clock.
35 	 *
36 	 * first line : WordSelect
37 	 * second line : ContinuousSerialClock
38 	 * third line: SerialData
39 	 *
40 	 * SYMMETRICAL APPROACH:
41 	 *   _______________________          LEFT
42 	 * _|         RIGHT         |______________________|
43 	 *     _   _         _   _   _   _         _   _
44 	 *   _| |_| |_ x16 _| |_| |_| |_| |_ x16 _| |_| |_
45 	 *     _   _         _   _   _   _         _   _
46 	 *   _/ \_/ \_ ... _/ \_/ \_/ \_/ \_ ... _/ \_/ \_
47 	 *    \_/ \_/       \_/ \_/ \_/ \_/       \_/ \_/
48 	 *
49 	 * ACCURATE CLOCK APPROACH:
50 	 *   ______________          LEFT
51 	 * _|     RIGHT    |_______________________________|
52 	 *     _         _   _         _   _   _   _   _   _
53 	 *   _| |_ x16 _| |_| |_ x16 _| |_| |_| |_| |_| |_| |
54 	 *     _         _   _          _      dummy cycles
55 	 *   _/ \_ ... _/ \_/ \_  ... _/ \__________________
56 	 *    \_/       \_/ \_/        \_/
57 	 *
58 	 */
59 	bool i2s_accurate_sck;
60 
61 	/* McASP specific fields */
62 	int tdm_slots;
63 	u8 op_mode;
64 	u8 dismod;
65 	u8 num_serializer;
66 	u8 *serial_dir;
67 	u8 version;
68 	u8 txnumevt;
69 	u8 rxnumevt;
70 	int tx_dma_channel;
71 	int rx_dma_channel;
72 };
73 /* TODO: Fix arch/arm/mach-davinci/ users and remove this define */
74 #define snd_platform_data davinci_mcasp_pdata
75 
76 enum {
77 	MCASP_VERSION_1 = 0,	/* DM646x */
78 	MCASP_VERSION_2,	/* DA8xx/OMAPL1x */
79 	MCASP_VERSION_3,        /* TI81xx/AM33xx */
80 	MCASP_VERSION_4,	/* DRA7xxx */
81 	MCASP_VERSION_OMAP,	/* OMAP4/5 */
82 };
83 
84 #define INACTIVE_MODE	0
85 #define TX_MODE		1
86 #define RX_MODE		2
87 
88 #define DAVINCI_MCASP_IIS_MODE	0
89 #define DAVINCI_MCASP_DIT_MODE	1
90 
91 #endif
92