1 | // SPDX-License-Identifier: GPL-2.0 |
2 | |
3 | #ifndef __SPRD_PCM_DMA_H |
4 | #define __SPRD_PCM_DMA_H |
5 | |
6 | #define DRV_NAME "sprd_pcm_dma" |
7 | #define SPRD_PCM_CHANNEL_MAX 2 |
8 | |
9 | extern const struct snd_compress_ops sprd_platform_compress_ops; |
10 | |
11 | struct sprd_pcm_dma_params { |
12 | dma_addr_t dev_phys[SPRD_PCM_CHANNEL_MAX]; |
13 | u32 datawidth[SPRD_PCM_CHANNEL_MAX]; |
14 | u32 fragment_len[SPRD_PCM_CHANNEL_MAX]; |
15 | const char *chan_name[SPRD_PCM_CHANNEL_MAX]; |
16 | }; |
17 | |
18 | struct sprd_compr_playinfo { |
19 | int total_time; |
20 | int current_time; |
21 | int total_data_length; |
22 | int current_data_offset; |
23 | }; |
24 | |
25 | struct sprd_compr_params { |
26 | u32 direction; |
27 | u32 rate; |
28 | u32 sample_rate; |
29 | u32 channels; |
30 | u32 format; |
31 | u32 period; |
32 | u32 periods; |
33 | u32 info_phys; |
34 | u32 info_size; |
35 | }; |
36 | |
37 | struct sprd_compr_callback { |
38 | void (*drain_notify)(void *data); |
39 | void *drain_data; |
40 | }; |
41 | |
42 | struct sprd_compr_ops { |
43 | int (*open)(int str_id, struct sprd_compr_callback *cb); |
44 | int (*close)(int str_id); |
45 | int (*start)(int str_id); |
46 | int (*stop)(int str_id); |
47 | int (*pause)(int str_id); |
48 | int (*pause_release)(int str_id); |
49 | int (*drain)(int received_total); |
50 | int (*set_params)(int str_id, struct sprd_compr_params *params); |
51 | }; |
52 | |
53 | struct sprd_compr_data { |
54 | struct sprd_compr_ops *ops; |
55 | struct sprd_pcm_dma_params *dma_params; |
56 | }; |
57 | |
58 | #endif /* __SPRD_PCM_DMA_H */ |
59 | |