1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #ifndef _ATMEL_SSC_DAI_H
18 #define _ATMEL_SSC_DAI_H
19
20 #include <linux/types.h>
21 #include <linux/atmel-ssc.h>
22
23 #include "atmel-pcm.h"
24
25
26 #define ATMEL_SYSCLK_MCK 0
27
28
29 #define ATMEL_SSC_CMR_DIV 0
30 #define ATMEL_SSC_TCMR_PERIOD 1
31 #define ATMEL_SSC_RCMR_PERIOD 2
32
33
34
35 #define SSC_DIR_MASK_UNUSED 0
36 #define SSC_DIR_MASK_PLAYBACK 1
37 #define SSC_DIR_MASK_CAPTURE 2
38
39
40
41
42
43
44 #define SSC_START_CONTINUOUS 0
45 #define SSC_START_TX_RX 1
46 #define SSC_START_LOW_RF 2
47 #define SSC_START_HIGH_RF 3
48 #define SSC_START_FALLING_RF 4
49 #define SSC_START_RISING_RF 5
50 #define SSC_START_LEVEL_RF 6
51 #define SSC_START_EDGE_RF 7
52 #define SSS_START_COMPARE_0 8
53
54
55 #define SSC_CKI_FALLING 0
56 #define SSC_CKI_RISING 1
57
58
59 #define SSC_CKO_NONE 0
60 #define SSC_CKO_CONTINUOUS 1
61 #define SSC_CKO_TRANSFER 2
62
63
64 #define SSC_CKS_DIV 0
65 #define SSC_CKS_CLOCK 1
66 #define SSC_CKS_PIN 2
67
68
69 #define SSC_FSEDGE_POSITIVE 0
70 #define SSC_FSEDGE_NEGATIVE 1
71
72
73 #define SSC_FSOS_NONE 0
74 #define SSC_FSOS_NEGATIVE 1
75 #define SSC_FSOS_POSITIVE 2
76 #define SSC_FSOS_LOW 3
77 #define SSC_FSOS_HIGH 4
78 #define SSC_FSOS_TOGGLE 5
79
80 #define START_DELAY 1
81
82 struct atmel_ssc_state {
83 u32 ssc_cmr;
84 u32 ssc_rcmr;
85 u32 ssc_rfmr;
86 u32 ssc_tcmr;
87 u32 ssc_tfmr;
88 u32 ssc_sr;
89 u32 ssc_imr;
90 };
91
92
93 struct atmel_ssc_info {
94 char *name;
95 struct ssc_device *ssc;
96 unsigned short dir_mask;
97 unsigned short initialized;
98 unsigned short daifmt;
99 unsigned short cmr_div;
100 unsigned short tcmr_period;
101 unsigned short rcmr_period;
102 unsigned int forced_divider;
103 struct atmel_pcm_dma_params *dma_params[2];
104 struct atmel_ssc_state ssc_state;
105 unsigned long mck_rate;
106 };
107
108 int atmel_ssc_set_audio(int ssc_id);
109 void atmel_ssc_put_audio(int ssc_id);
110
111 #endif