2 * sst_mfld_platform.h - Intel MID Platform driver header file
4 * Copyright (C) 2010 Intel Corp
5 * Author: Vinod Koul <vinod.koul@intel.com>
6 * Author: Harsha Priya <priya.harsha@intel.com>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
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.
18 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 #ifndef __SST_PLATFORMDRV_H__
22 #define __SST_PLATFORMDRV_H__
24 #include "sst-mfld-dsp.h"
26 extern struct sst_device
*sst
;
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
40 struct pcm_stream_info
{
43 void (*period_elapsed
) (void *arg
);
44 unsigned long long buffer_ptr
;
45 unsigned long long pcm_delay
;
50 SST_PLATFORM_INIT
= 1,
58 STREAM_OPS_PLAYBACK
= 0,
62 enum sst_audio_device_type
{
63 SND_SST_DEVICE_HEADSET
= 1,
66 SND_SST_DEVICE_HAPTIC
,
67 SND_SST_DEVICE_CAPTURE
,
68 SND_SST_DEVICE_COMPRESS
,
72 struct 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 */
79 u32 period_count
; /* period elapsed in samples*/
83 struct sst_stream_params
{
90 struct sst_pcm_params sparams
;
93 struct sst_compress_cb
{
95 void (*compr_cb
)(void *param
);
97 void (*drain_notify
)(void *param
);
100 struct compress_sst_ops
{
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
);
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
,
119 struct snd_compr_metadata
*mdata
);
120 int (*power
)(struct device
*dev
, bool state
);
124 int (*open
)(struct device
*dev
, struct snd_sst_params
*str_param
);
125 int (*stream_init
)(struct device
*dev
, struct pcm_stream_info
*str_info
);
126 int (*stream_start
)(struct device
*dev
, int str_id
);
127 int (*stream_drop
)(struct device
*dev
, int str_id
);
128 int (*stream_pause
)(struct device
*dev
, int str_id
);
129 int (*stream_pause_release
)(struct device
*dev
, int str_id
);
130 int (*stream_read_tstamp
)(struct device
*dev
, struct pcm_stream_info
*str_info
);
131 int (*send_byte_stream
)(struct device
*dev
, struct snd_sst_bytes_v2
*bytes
);
132 int (*close
)(struct device
*dev
, unsigned int str_id
);
133 int (*power
)(struct device
*dev
, bool state
);
136 struct sst_runtime_stream
{
139 size_t bytes_written
;
140 struct pcm_stream_info stream_info
;
142 struct compress_sst_ops
*compr_ops
;
143 spinlock_t status_lock
;
150 struct platform_device
*pdev
;
151 struct compress_sst_ops
*compr_ops
;
156 int sst_dsp_init_v2_dpcm(struct snd_soc_platform
*platform
);
157 int sst_send_pipe_gains(struct snd_soc_dai
*dai
, int stream
, int mute
);
158 int send_ssp_cmd(struct snd_soc_dai
*dai
, const char *id
, bool enable
);
159 int sst_handle_vb_timer(struct snd_soc_dai
*dai
, bool enable
);
161 void sst_set_stream_status(struct sst_runtime_stream
*stream
, int state
);
162 int sst_fill_stream_params(void *substream
, const struct sst_data
*ctx
,
163 struct snd_sst_params
*str_params
, bool is_compress
);
165 struct sst_algo_int_control_v2
{
166 struct soc_mixer_control mc
;
167 u16 module_id
; /* module identifieer */
168 u16 pipe_id
; /* location info: pipe_id + instance_id */
170 unsigned int value
; /* Value received is stored here */
173 struct platform_device
*pdev
;
174 struct sst_platform_data
*pdata
;
175 struct snd_sst_bytes_v2
*byte_stream
;
178 int sst_register_dsp(struct sst_device
*sst
);
179 int sst_unregister_dsp(struct sst_device
*sst
);