]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - sound/soc/intel/sst_platform.h
Merge tag 'for-linus-20140127' of git://git.infradead.org/linux-mtd
[mirror_ubuntu-zesty-kernel.git] / sound / soc / intel / sst_platform.h
1 /*
2 * sst_platform.h - Intel MID Platform driver header file
3 *
4 * Copyright (C) 2010 Intel Corp
5 * Author: Vinod Koul <vinod.koul@intel.com>
6 * Author: Harsha Priya <priya.harsha@intel.com>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 *
24 *
25 */
26
27 #ifndef __SST_PLATFORMDRV_H__
28 #define __SST_PLATFORMDRV_H__
29
30 #include "sst_dsp.h"
31
32 #define SST_MONO 1
33 #define SST_STEREO 2
34 #define SST_MAX_CAP 5
35
36 #define SST_MAX_BUFFER (800*1024)
37 #define SST_MIN_BUFFER (800*1024)
38 #define SST_MIN_PERIOD_BYTES 32
39 #define SST_MAX_PERIOD_BYTES SST_MAX_BUFFER
40 #define SST_MIN_PERIODS 2
41 #define SST_MAX_PERIODS (1024*2)
42 #define SST_FIFO_SIZE 0
43
44 struct pcm_stream_info {
45 int str_id;
46 void *mad_substream;
47 void (*period_elapsed) (void *mad_substream);
48 unsigned long long buffer_ptr;
49 int sfreq;
50 };
51
52 enum sst_drv_status {
53 SST_PLATFORM_INIT = 1,
54 SST_PLATFORM_STARTED,
55 SST_PLATFORM_RUNNING,
56 SST_PLATFORM_PAUSED,
57 SST_PLATFORM_DROPPED,
58 };
59
60 enum sst_controls {
61 SST_SND_ALLOC = 0x00,
62 SST_SND_PAUSE = 0x01,
63 SST_SND_RESUME = 0x02,
64 SST_SND_DROP = 0x03,
65 SST_SND_FREE = 0x04,
66 SST_SND_BUFFER_POINTER = 0x05,
67 SST_SND_STREAM_INIT = 0x06,
68 SST_SND_START = 0x07,
69 SST_MAX_CONTROLS = 0x07,
70 };
71
72 enum sst_stream_ops {
73 STREAM_OPS_PLAYBACK = 0,
74 STREAM_OPS_CAPTURE,
75 };
76
77 enum sst_audio_device_type {
78 SND_SST_DEVICE_HEADSET = 1,
79 SND_SST_DEVICE_IHF,
80 SND_SST_DEVICE_VIBRA,
81 SND_SST_DEVICE_HAPTIC,
82 SND_SST_DEVICE_CAPTURE,
83 SND_SST_DEVICE_COMPRESS,
84 };
85
86 /* PCM Parameters */
87 struct sst_pcm_params {
88 u16 codec; /* codec type */
89 u8 num_chan; /* 1=Mono, 2=Stereo */
90 u8 pcm_wd_sz; /* 16/24 - bit*/
91 u32 reserved; /* Bitrate in bits per second */
92 u32 sfreq; /* Sampling rate in Hz */
93 u32 ring_buffer_size;
94 u32 period_count; /* period elapsed in samples*/
95 u32 ring_buffer_addr;
96 };
97
98 struct sst_stream_params {
99 u32 result;
100 u32 stream_id;
101 u8 codec;
102 u8 ops;
103 u8 stream_type;
104 u8 device_type;
105 struct sst_pcm_params sparams;
106 };
107
108 struct sst_compress_cb {
109 void *param;
110 void (*compr_cb)(void *param);
111 };
112
113 struct compress_sst_ops {
114 const char *name;
115 int (*open) (struct snd_sst_params *str_params,
116 struct sst_compress_cb *cb);
117 int (*control) (unsigned int cmd, unsigned int str_id);
118 int (*tstamp) (unsigned int str_id, struct snd_compr_tstamp *tstamp);
119 int (*ack) (unsigned int str_id, unsigned long bytes);
120 int (*close) (unsigned int str_id);
121 int (*get_caps) (struct snd_compr_caps *caps);
122 int (*get_codec_caps) (struct snd_compr_codec_caps *codec);
123 int (*set_metadata) (unsigned int str_id,
124 struct snd_compr_metadata *mdata);
125
126 };
127
128 struct sst_ops {
129 int (*open) (struct sst_stream_params *str_param);
130 int (*device_control) (int cmd, void *arg);
131 int (*close) (unsigned int str_id);
132 };
133
134 struct sst_runtime_stream {
135 int stream_status;
136 unsigned int id;
137 size_t bytes_written;
138 struct pcm_stream_info stream_info;
139 struct sst_ops *ops;
140 struct compress_sst_ops *compr_ops;
141 spinlock_t status_lock;
142 };
143
144 struct sst_device {
145 char *name;
146 struct device *dev;
147 struct sst_ops *ops;
148 struct compress_sst_ops *compr_ops;
149 };
150
151 int sst_register_dsp(struct sst_device *sst);
152 int sst_unregister_dsp(struct sst_device *sst);
153 #endif