ASoC: Intel: mfld-pcm: don't call trigger ops to DSP for internal streams
[deliverable/linux.git] / sound / soc / intel / sst-mfld-platform.h
CommitLineData
d927fdae 1/*
a4b12990 2 * sst_mfld_platform.h - Intel MID Platform driver header file
d927fdae
VK
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 *
d927fdae 18 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
d927fdae
VK
19 */
20
21#ifndef __SST_PLATFORMDRV_H__
22#define __SST_PLATFORMDRV_H__
23
a4b12990 24#include "sst-mfld-dsp.h"
c514a911 25
4b68b4e1
VK
26extern struct sst_device *sst;
27
d927fdae
VK
28#define SST_MONO 1
29#define SST_STEREO 2
30#define SST_MAX_CAP 5
31
d927fdae
VK
32#define SST_MAX_BUFFER (800*1024)
33#define SST_MIN_BUFFER (800*1024)
34#define SST_MIN_PERIOD_BYTES 32
35#define SST_MAX_PERIOD_BYTES SST_MAX_BUFFER
36#define SST_MIN_PERIODS 2
37#define SST_MAX_PERIODS (1024*2)
38#define SST_FIFO_SIZE 0
d927fdae 39
03c33042
VK
40struct pcm_stream_info {
41 int str_id;
9daa5bd3
VK
42 void *arg;
43 void (*period_elapsed) (void *arg);
03c33042 44 unsigned long long buffer_ptr;
2a635825 45 unsigned long long pcm_delay;
03c33042 46 int sfreq;
d927fdae
VK
47};
48
49enum sst_drv_status {
50 SST_PLATFORM_INIT = 1,
51 SST_PLATFORM_STARTED,
52 SST_PLATFORM_RUNNING,
53 SST_PLATFORM_PAUSED,
54 SST_PLATFORM_DROPPED,
55};
56
03c33042
VK
57enum sst_stream_ops {
58 STREAM_OPS_PLAYBACK = 0,
59 STREAM_OPS_CAPTURE,
60};
61
62enum sst_audio_device_type {
63 SND_SST_DEVICE_HEADSET = 1,
64 SND_SST_DEVICE_IHF,
65 SND_SST_DEVICE_VIBRA,
66 SND_SST_DEVICE_HAPTIC,
67 SND_SST_DEVICE_CAPTURE,
c514a911 68 SND_SST_DEVICE_COMPRESS,
03c33042
VK
69};
70
71/* PCM Parameters */
72struct sst_pcm_params {
73 u16 codec; /* codec type */
74 u8 num_chan; /* 1=Mono, 2=Stereo */
75 u8 pcm_wd_sz; /* 16/24 - bit*/
76 u32 reserved; /* Bitrate in bits per second */
77 u32 sfreq; /* Sampling rate in Hz */
78 u32 ring_buffer_size;
79 u32 period_count; /* period elapsed in samples*/
80 u32 ring_buffer_addr;
81};
82
83struct sst_stream_params {
84 u32 result;
85 u32 stream_id;
86 u8 codec;
87 u8 ops;
88 u8 stream_type;
89 u8 device_type;
90 struct sst_pcm_params sparams;
91};
92
c514a911
VK
93struct sst_compress_cb {
94 void *param;
95 void (*compr_cb)(void *param);
bd17aa45
VK
96 void *drain_cb_param;
97 void (*drain_notify)(void *param);
c514a911
VK
98};
99
100struct compress_sst_ops {
101 const char *name;
06cb1eb3
SP
102 int (*open)(struct device *dev,
103 struct snd_sst_params *str_params, struct sst_compress_cb *cb);
104 int (*stream_start)(struct device *dev, unsigned int str_id);
105 int (*stream_drop)(struct device *dev, unsigned int str_id);
106 int (*stream_drain)(struct device *dev, unsigned int str_id);
107 int (*stream_partial_drain)(struct device *dev, unsigned int str_id);
108 int (*stream_pause)(struct device *dev, unsigned int str_id);
109 int (*stream_pause_release)(struct device *dev, unsigned int str_id);
110
111 int (*tstamp)(struct device *dev, unsigned int str_id,
112 struct snd_compr_tstamp *tstamp);
113 int (*ack)(struct device *dev, unsigned int str_id,
114 unsigned long bytes);
115 int (*close)(struct device *dev, unsigned int str_id);
116 int (*get_caps)(struct snd_compr_caps *caps);
117 int (*get_codec_caps)(struct snd_compr_codec_caps *codec);
118 int (*set_metadata)(struct device *dev, unsigned int str_id,
0cd5751a 119 struct snd_compr_metadata *mdata);
c514a911
VK
120};
121
03c33042 122struct sst_ops {
b12b087c
SP
123 int (*open) (struct device *dev, struct snd_sst_params *str_param);
124 int (*stream_init) (struct device *dev, struct pcm_stream_info *str_info);
125 int (*stream_start) (struct device *dev, int str_id);
126 int (*stream_drop) (struct device *dev, int str_id);
127 int (*stream_pause) (struct device *dev, int str_id);
128 int (*stream_pause_release) (struct device *dev, int str_id);
129 int (*stream_read_tstamp) (struct device *dev, struct pcm_stream_info *str_info);
130 int (*send_byte_stream)(struct device *dev, struct snd_sst_bytes_v2 *bytes);
131 int (*close) (struct device *dev, unsigned int str_id);
03c33042
VK
132};
133
134struct sst_runtime_stream {
135 int stream_status;
c514a911
VK
136 unsigned int id;
137 size_t bytes_written;
03c33042
VK
138 struct pcm_stream_info stream_info;
139 struct sst_ops *ops;
c514a911 140 struct compress_sst_ops *compr_ops;
03c33042
VK
141 spinlock_t status_lock;
142};
143
144struct sst_device {
145 char *name;
146 struct device *dev;
147 struct sst_ops *ops;
61b165ca 148 struct platform_device *pdev;
c514a911 149 struct compress_sst_ops *compr_ops;
03c33042
VK
150};
151
61b165ca 152struct sst_data;
d8499c9b
VK
153
154int sst_dsp_init_v2_dpcm(struct snd_soc_platform *platform);
4496ffab 155void sst_set_stream_status(struct sst_runtime_stream *stream, int state);
0ec66fed
VK
156int sst_fill_stream_params(void *substream, const struct sst_data *ctx,
157 struct snd_sst_params *str_params, bool is_compress);
158
61b165ca
VK
159struct sst_algo_int_control_v2 {
160 struct soc_mixer_control mc;
161 u16 module_id; /* module identifieer */
162 u16 pipe_id; /* location info: pipe_id + instance_id */
163 u16 instance_id;
164 unsigned int value; /* Value received is stored here */
165};
61b165ca
VK
166struct sst_data {
167 struct platform_device *pdev;
168 struct sst_platform_data *pdata;
d8499c9b 169 char *byte_stream;
61b165ca
VK
170 struct mutex lock;
171};
03c33042
VK
172int sst_register_dsp(struct sst_device *sst);
173int sst_unregister_dsp(struct sst_device *sst);
d927fdae 174#endif
This page took 0.196479 seconds and 5 git commands to generate.