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,
60 SST_SND_RESUME
= 0x02,
63 SST_SND_BUFFER_POINTER
= 0x05,
64 SST_SND_STREAM_INIT
= 0x06,
66 SST_SET_BYTE_STREAM
= 0x100A,
67 SST_GET_BYTE_STREAM
= 0x100B,
68 SST_MAX_CONTROLS
= SST_GET_BYTE_STREAM
,
72 STREAM_OPS_PLAYBACK
= 0,
76 enum sst_audio_device_type
{
77 SND_SST_DEVICE_HEADSET
= 1,
80 SND_SST_DEVICE_HAPTIC
,
81 SND_SST_DEVICE_CAPTURE
,
82 SND_SST_DEVICE_COMPRESS
,
86 struct sst_pcm_params
{
87 u16 codec
; /* codec type */
88 u8 num_chan
; /* 1=Mono, 2=Stereo */
89 u8 pcm_wd_sz
; /* 16/24 - bit*/
90 u32 reserved
; /* Bitrate in bits per second */
91 u32 sfreq
; /* Sampling rate in Hz */
93 u32 period_count
; /* period elapsed in samples*/
97 struct sst_stream_params
{
104 struct sst_pcm_params sparams
;
107 struct sst_compress_cb
{
109 void (*compr_cb
)(void *param
);
110 void *drain_cb_param
;
111 void (*drain_notify
)(void *param
);
114 struct compress_sst_ops
{
116 int (*open
) (struct snd_sst_params
*str_params
,
117 struct sst_compress_cb
*cb
);
118 int (*control
) (unsigned int cmd
, unsigned int str_id
);
119 int (*tstamp
) (unsigned int str_id
, struct snd_compr_tstamp
*tstamp
);
120 int (*ack
) (unsigned int str_id
, unsigned long bytes
);
121 int (*close
) (unsigned int str_id
);
122 int (*get_caps
) (struct snd_compr_caps
*caps
);
123 int (*get_codec_caps
) (struct snd_compr_codec_caps
*codec
);
124 int (*set_metadata
) (unsigned int str_id
,
125 struct snd_compr_metadata
*mdata
);
130 int (*open
) (struct snd_sst_params
*str_param
);
131 int (*device_control
) (int cmd
, void *arg
);
132 int (*set_generic_params
)(enum sst_controls cmd
, void *arg
);
133 int (*close
) (unsigned int str_id
);
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
;
155 void sst_set_stream_status(struct sst_runtime_stream
*stream
, int state
);
156 int sst_fill_stream_params(void *substream
, const struct sst_data
*ctx
,
157 struct snd_sst_params
*str_params
, bool is_compress
);
159 struct 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 */
164 unsigned int value
; /* Value received is stored here */
167 struct platform_device
*pdev
;
168 struct sst_platform_data
*pdata
;
171 int sst_register_dsp(struct sst_device
*sst
);
172 int sst_unregister_dsp(struct sst_device
*sst
);