1
2
3
4
5
6
7
8
9
10
11#ifndef SYNC_SERIAL_H
12#define SYNC_SERIAL_H
13
14#include <linux/ioctl.h>
15
16#define SSP_SPEED _IOR('S', 0, unsigned int)
17#define SSP_MODE _IOR('S', 1, unsigned int)
18#define SSP_FRAME_SYNC _IOR('S', 2, unsigned int)
19#define SSP_IPOLARITY _IOR('S', 3, unsigned int)
20#define SSP_OPOLARITY _IOR('S', 4, unsigned int)
21#define SSP_SPI _IOR('S', 5, unsigned int)
22#define SSP_INBUFCHUNK _IOR('S', 6, unsigned int)
23#define SSP_INPUT _IOR('S', 7, unsigned int)
24
25
26#define SSP150 0
27#define SSP300 1
28#define SSP600 2
29#define SSP1200 3
30#define SSP2400 4
31#define SSP4800 5
32#define SSP9600 6
33#define SSP19200 7
34#define SSP28800 8
35#define SSP57600 9
36#define SSP115200 10
37#define SSP230400 11
38#define SSP460800 12
39#define SSP921600 13
40#define SSP3125000 14
41#define CODEC 15
42#define CODEC_f32768 16
43
44#define FREQ_4MHz 0
45#define FREQ_2MHz 1
46#define FREQ_1MHz 2
47#define FREQ_512kHz 3
48#define FREQ_256kHz 4
49#define FREQ_128kHz 5
50#define FREQ_64kHz 6
51#define FREQ_32kHz 7
52
53
54#define FREQ_4096kHz 16
55
56
57#define CODEC_VAL(freq, clk_per_sync, sync_per_frame) \
58 ((CODEC + ((freq & 0x10) >> 4)) | (freq << 8) | \
59 (clk_per_sync << 16) | (sync_per_frame << 28))
60
61
62#define GET_SPEED(x) (x & 0xff)
63#define GET_FREQ(x) ((x & 0xff00) >> 8)
64#define GET_WORD_RATE(x) (((x & 0x0fff0000) >> 16) - 1)
65#define GET_FRAME_RATE(x) (((x & 0xf0000000) >> 28) - 1)
66
67
68#define MASTER_OUTPUT 0
69#define SLAVE_OUTPUT 1
70#define MASTER_INPUT 2
71#define SLAVE_INPUT 3
72#define MASTER_BIDIR 4
73#define SLAVE_BIDIR 5
74
75
76#define NORMAL_SYNC 1
77#define EARLY_SYNC 2
78#define SECOND_WORD_SYNC 0x40000
79#define LATE_SYNC 0x80000
80
81#define BIT_SYNC 4
82#define WORD_SYNC 8
83#define EXTENDED_SYNC 0x10
84
85#define SYNC_OFF 0x20
86#define SYNC_ON 0x40
87#define WORD_SIZE_8 0x80
88#define WORD_SIZE_12 0x100
89#define WORD_SIZE_16 0x200
90#define WORD_SIZE_24 0x400
91#define WORD_SIZE_32 0x800
92#define BIT_ORDER_LSB 0x1000
93#define BIT_ORDER_MSB 0x2000
94#define FLOW_CONTROL_ENABLE 0x4000
95#define FLOW_CONTROL_DISABLE 0x8000
96#define CLOCK_GATED 0x10000
97#define CLOCK_NOT_GATED 0x20000
98
99
100#define CLOCK_NORMAL 1
101#define CLOCK_INVERT 2
102#define CLOCK_INEGEDGE CLOCK_NORMAL
103#define CLOCK_IPOSEDGE CLOCK_INVERT
104#define FRAME_NORMAL 4
105#define FRAME_INVERT 8
106#define STATUS_NORMAL 0x10
107#define STATUS_INVERT 0x20
108
109
110#define SPI_MASTER 0
111#define SPI_SLAVE 1
112
113
114
115
116
117
118
119
120
121#define SSP_INPUT_CHUNK_SIZE 256
122
123
124
125
126struct ssp_request {
127 char __user *buf;
128 size_t len;
129
130 struct timespec ts;
131};
132
133#endif
134