ASoC: Intel: Sample Baytrail DSP DMA pointer only after each period
[firefly-linux-kernel-4.4.55.git] / sound / soc / intel / sst-mfld-dsp.h
1 #ifndef __SST_MFLD_DSP_H__
2 #define __SST_MFLD_DSP_H__
3 /*
4  *  sst_mfld_dsp.h - Intel SST Driver for audio engine
5  *
6  *  Copyright (C) 2008-12 Intel Corporation
7  *  Authors:    Vinod Koul <vinod.koul@linux.intel.com>
8  *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; version 2 of the License.
13  *
14  *  This program is distributed in the hope that it will be useful, but
15  *  WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  *  General Public License for more details.
18  *
19  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20  */
21
22 enum sst_codec_types {
23         /*  AUDIO/MUSIC CODEC Type Definitions */
24         SST_CODEC_TYPE_UNKNOWN = 0,
25         SST_CODEC_TYPE_PCM,     /* Pass through Audio codec */
26         SST_CODEC_TYPE_MP3,
27         SST_CODEC_TYPE_MP24,
28         SST_CODEC_TYPE_AAC,
29         SST_CODEC_TYPE_AACP,
30         SST_CODEC_TYPE_eAACP,
31 };
32
33 enum stream_type {
34         SST_STREAM_TYPE_NONE = 0,
35         SST_STREAM_TYPE_MUSIC = 1,
36 };
37
38 struct snd_pcm_params {
39         u16 codec;      /* codec type */
40         u8 num_chan;    /* 1=Mono, 2=Stereo */
41         u8 pcm_wd_sz;   /* 16/24 - bit*/
42         u32 reserved;   /* Bitrate in bits per second */
43         u32 sfreq;      /* Sampling rate in Hz */
44         u8 use_offload_path;
45         u8 reserved2;
46         u16 reserved3;
47         u8 channel_map[8];
48 } __packed;
49
50 /* MP3 Music Parameters Message */
51 struct snd_mp3_params {
52         u16 codec;
53         u8  num_chan;   /* 1=Mono, 2=Stereo     */
54         u8  pcm_wd_sz; /* 16/24 - bit*/
55         u8  crc_check; /* crc_check - disable (0) or enable (1) */
56         u8  reserved1; /* unused*/
57         u16 reserved2;  /* Unused */
58 } __packed;
59
60 #define AAC_BIT_STREAM_ADTS             0
61 #define AAC_BIT_STREAM_ADIF             1
62 #define AAC_BIT_STREAM_RAW              2
63
64 /* AAC Music Parameters Message */
65 struct snd_aac_params {
66         u16 codec;
67         u8 num_chan; /* 1=Mono, 2=Stereo*/
68         u8 pcm_wd_sz; /* 16/24 - bit*/
69         u8 bdownsample; /*SBR downsampling 0 - disable 1 -enabled AAC+ only */
70         u8 bs_format; /* input bit stream format adts=0, adif=1, raw=2 */
71         u16  reser2;
72         u32 externalsr; /*sampling rate of basic AAC raw bit stream*/
73         u8 sbr_signalling;/*disable/enable/set automode the SBR tool.AAC+*/
74         u8 reser1;
75         u16  reser3;
76 } __packed;
77
78 /* WMA Music Parameters Message */
79 struct snd_wma_params {
80         u16 codec;
81         u8  num_chan;   /* 1=Mono, 2=Stereo */
82         u8  pcm_wd_sz;  /* 16/24 - bit*/
83         u32 brate;      /* Use the hard coded value. */
84         u32 sfreq;      /* Sampling freq eg. 8000, 441000, 48000 */
85         u32 channel_mask;  /* Channel Mask */
86         u16 format_tag; /* Format Tag */
87         u16 block_align;        /* packet size */
88         u16 wma_encode_opt;/* Encoder option */
89         u8 op_align;    /* op align 0- 16 bit, 1- MSB, 2 LSB */
90         u8 reserved;    /* reserved */
91 } __packed;
92
93 /* Codec params struture */
94 union  snd_sst_codec_params {
95         struct snd_pcm_params pcm_params;
96         struct snd_mp3_params mp3_params;
97         struct snd_aac_params aac_params;
98         struct snd_wma_params wma_params;
99 } __packed;
100
101 /* Address and size info of a frame buffer */
102 struct sst_address_info {
103         u32 addr; /* Address at IA */
104         u32 size; /* Size of the buffer */
105 };
106
107 struct snd_sst_alloc_params_ext {
108         struct sst_address_info  ring_buf_info[8];
109         u8 sg_count;
110         u8 reserved;
111         u16 reserved2;
112         u32 frag_size;  /*Number of samples after which period elapsed
113                                   message is sent valid only if path  = 0*/
114 } __packed;
115
116 struct snd_sst_stream_params {
117         union snd_sst_codec_params uc;
118 } __packed;
119
120 struct snd_sst_params {
121         u32 stream_id;
122         u8 codec;
123         u8 ops;
124         u8 stream_type;
125         u8 device_type;
126         struct snd_sst_stream_params sparams;
127         struct snd_sst_alloc_params_ext aparams;
128 };
129
130 #endif /* __SST_MFLD_DSP_H__ */