2011-01-04 22:46:32 +08:00
|
|
|
/*
|
2014-03-13 07:04:35 +08:00
|
|
|
* sst_mfld_platform.h - Intel MID Platform driver header file
|
2011-01-04 22:46:32 +08:00
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Intel Corp
|
|
|
|
* Author: Vinod Koul <vinod.koul@intel.com>
|
|
|
|
* Author: Harsha Priya <priya.harsha@intel.com>
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SST_PLATFORMDRV_H__
|
|
|
|
#define __SST_PLATFORMDRV_H__
|
|
|
|
|
2014-03-13 07:04:35 +08:00
|
|
|
#include "sst-mfld-dsp.h"
|
2015-05-07 00:36:41 +08:00
|
|
|
#include "sst-atom-controls.h"
|
2012-08-16 19:40:42 +08:00
|
|
|
|
2014-05-05 16:57:50 +08:00
|
|
|
extern struct sst_device *sst;
|
2017-09-14 02:38:36 +08:00
|
|
|
extern const struct snd_compr_ops sst_platform_compr_ops;
|
2014-05-05 16:57:50 +08:00
|
|
|
|
2011-01-04 22:46:32 +08:00
|
|
|
#define SST_MONO 1
|
|
|
|
#define SST_STEREO 2
|
|
|
|
#define SST_MAX_CAP 5
|
|
|
|
|
|
|
|
#define SST_MAX_BUFFER (800*1024)
|
|
|
|
#define SST_MIN_BUFFER (800*1024)
|
|
|
|
#define SST_MIN_PERIOD_BYTES 32
|
|
|
|
#define SST_MAX_PERIOD_BYTES SST_MAX_BUFFER
|
|
|
|
#define SST_MIN_PERIODS 2
|
|
|
|
#define SST_MAX_PERIODS (1024*2)
|
|
|
|
#define SST_FIFO_SIZE 0
|
|
|
|
|
2011-12-05 21:43:41 +08:00
|
|
|
struct pcm_stream_info {
|
|
|
|
int str_id;
|
2014-06-13 20:33:52 +08:00
|
|
|
void *arg;
|
|
|
|
void (*period_elapsed) (void *arg);
|
2011-12-05 21:43:41 +08:00
|
|
|
unsigned long long buffer_ptr;
|
2014-06-13 20:33:53 +08:00
|
|
|
unsigned long long pcm_delay;
|
2011-12-05 21:43:41 +08:00
|
|
|
int sfreq;
|
2011-01-04 22:46:32 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum sst_drv_status {
|
|
|
|
SST_PLATFORM_INIT = 1,
|
|
|
|
SST_PLATFORM_STARTED,
|
|
|
|
SST_PLATFORM_RUNNING,
|
|
|
|
SST_PLATFORM_PAUSED,
|
|
|
|
SST_PLATFORM_DROPPED,
|
|
|
|
};
|
|
|
|
|
2011-12-05 21:43:41 +08:00
|
|
|
enum sst_stream_ops {
|
|
|
|
STREAM_OPS_PLAYBACK = 0,
|
|
|
|
STREAM_OPS_CAPTURE,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum sst_audio_device_type {
|
|
|
|
SND_SST_DEVICE_HEADSET = 1,
|
|
|
|
SND_SST_DEVICE_IHF,
|
|
|
|
SND_SST_DEVICE_VIBRA,
|
|
|
|
SND_SST_DEVICE_HAPTIC,
|
|
|
|
SND_SST_DEVICE_CAPTURE,
|
2012-08-16 19:40:42 +08:00
|
|
|
SND_SST_DEVICE_COMPRESS,
|
2011-12-05 21:43:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* PCM Parameters */
|
|
|
|
struct sst_pcm_params {
|
|
|
|
u16 codec; /* codec type */
|
|
|
|
u8 num_chan; /* 1=Mono, 2=Stereo */
|
|
|
|
u8 pcm_wd_sz; /* 16/24 - bit*/
|
|
|
|
u32 reserved; /* Bitrate in bits per second */
|
|
|
|
u32 sfreq; /* Sampling rate in Hz */
|
|
|
|
u32 ring_buffer_size;
|
|
|
|
u32 period_count; /* period elapsed in samples*/
|
|
|
|
u32 ring_buffer_addr;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sst_stream_params {
|
|
|
|
u32 result;
|
|
|
|
u32 stream_id;
|
|
|
|
u8 codec;
|
|
|
|
u8 ops;
|
|
|
|
u8 stream_type;
|
|
|
|
u8 device_type;
|
|
|
|
struct sst_pcm_params sparams;
|
|
|
|
};
|
|
|
|
|
2012-08-16 19:40:42 +08:00
|
|
|
struct sst_compress_cb {
|
|
|
|
void *param;
|
|
|
|
void (*compr_cb)(void *param);
|
2014-05-16 00:08:16 +08:00
|
|
|
void *drain_cb_param;
|
|
|
|
void (*drain_notify)(void *param);
|
2012-08-16 19:40:42 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct compress_sst_ops {
|
|
|
|
const char *name;
|
2014-08-21 20:50:49 +08:00
|
|
|
int (*open)(struct device *dev,
|
|
|
|
struct snd_sst_params *str_params, struct sst_compress_cb *cb);
|
|
|
|
int (*stream_start)(struct device *dev, unsigned int str_id);
|
|
|
|
int (*stream_drop)(struct device *dev, unsigned int str_id);
|
|
|
|
int (*stream_drain)(struct device *dev, unsigned int str_id);
|
|
|
|
int (*stream_partial_drain)(struct device *dev, unsigned int str_id);
|
|
|
|
int (*stream_pause)(struct device *dev, unsigned int str_id);
|
|
|
|
int (*stream_pause_release)(struct device *dev, unsigned int str_id);
|
|
|
|
|
|
|
|
int (*tstamp)(struct device *dev, unsigned int str_id,
|
|
|
|
struct snd_compr_tstamp *tstamp);
|
|
|
|
int (*ack)(struct device *dev, unsigned int str_id,
|
|
|
|
unsigned long bytes);
|
|
|
|
int (*close)(struct device *dev, unsigned int str_id);
|
|
|
|
int (*get_caps)(struct snd_compr_caps *caps);
|
|
|
|
int (*get_codec_caps)(struct snd_compr_codec_caps *codec);
|
|
|
|
int (*set_metadata)(struct device *dev, unsigned int str_id,
|
2013-03-30 02:11:42 +08:00
|
|
|
struct snd_compr_metadata *mdata);
|
2014-10-30 18:50:58 +08:00
|
|
|
int (*power)(struct device *dev, bool state);
|
2012-08-16 19:40:42 +08:00
|
|
|
};
|
|
|
|
|
2011-12-05 21:43:41 +08:00
|
|
|
struct sst_ops {
|
2014-09-19 19:16:03 +08:00
|
|
|
int (*open)(struct device *dev, struct snd_sst_params *str_param);
|
|
|
|
int (*stream_init)(struct device *dev, struct pcm_stream_info *str_info);
|
|
|
|
int (*stream_start)(struct device *dev, int str_id);
|
|
|
|
int (*stream_drop)(struct device *dev, int str_id);
|
|
|
|
int (*stream_pause)(struct device *dev, int str_id);
|
|
|
|
int (*stream_pause_release)(struct device *dev, int str_id);
|
|
|
|
int (*stream_read_tstamp)(struct device *dev, struct pcm_stream_info *str_info);
|
2014-08-04 17:34:21 +08:00
|
|
|
int (*send_byte_stream)(struct device *dev, struct snd_sst_bytes_v2 *bytes);
|
2014-09-19 19:16:03 +08:00
|
|
|
int (*close)(struct device *dev, unsigned int str_id);
|
|
|
|
int (*power)(struct device *dev, bool state);
|
2011-12-05 21:43:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct sst_runtime_stream {
|
|
|
|
int stream_status;
|
2012-08-16 19:40:42 +08:00
|
|
|
unsigned int id;
|
|
|
|
size_t bytes_written;
|
2011-12-05 21:43:41 +08:00
|
|
|
struct pcm_stream_info stream_info;
|
|
|
|
struct sst_ops *ops;
|
2012-08-16 19:40:42 +08:00
|
|
|
struct compress_sst_ops *compr_ops;
|
2011-12-05 21:43:41 +08:00
|
|
|
spinlock_t status_lock;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sst_device {
|
|
|
|
char *name;
|
|
|
|
struct device *dev;
|
|
|
|
struct sst_ops *ops;
|
2014-06-13 20:33:56 +08:00
|
|
|
struct platform_device *pdev;
|
2012-08-16 19:40:42 +08:00
|
|
|
struct compress_sst_ops *compr_ops;
|
2011-12-05 21:43:41 +08:00
|
|
|
};
|
|
|
|
|
2014-06-13 20:33:56 +08:00
|
|
|
struct sst_data;
|
2014-08-04 17:45:55 +08:00
|
|
|
|
|
|
|
int sst_dsp_init_v2_dpcm(struct snd_soc_platform *platform);
|
2014-10-15 22:42:58 +08:00
|
|
|
int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute);
|
|
|
|
int send_ssp_cmd(struct snd_soc_dai *dai, const char *id, bool enable);
|
|
|
|
int sst_handle_vb_timer(struct snd_soc_dai *dai, bool enable);
|
|
|
|
|
2014-05-05 16:57:49 +08:00
|
|
|
void sst_set_stream_status(struct sst_runtime_stream *stream, int state);
|
2014-06-13 20:33:57 +08:00
|
|
|
int sst_fill_stream_params(void *substream, const struct sst_data *ctx,
|
|
|
|
struct snd_sst_params *str_params, bool is_compress);
|
|
|
|
|
2014-06-13 20:33:56 +08:00
|
|
|
struct sst_algo_int_control_v2 {
|
|
|
|
struct soc_mixer_control mc;
|
|
|
|
u16 module_id; /* module identifieer */
|
|
|
|
u16 pipe_id; /* location info: pipe_id + instance_id */
|
|
|
|
u16 instance_id;
|
|
|
|
unsigned int value; /* Value received is stored here */
|
|
|
|
};
|
|
|
|
struct sst_data {
|
|
|
|
struct platform_device *pdev;
|
|
|
|
struct sst_platform_data *pdata;
|
2014-09-09 17:41:25 +08:00
|
|
|
struct snd_sst_bytes_v2 *byte_stream;
|
2014-06-13 20:33:56 +08:00
|
|
|
struct mutex lock;
|
2015-02-12 12:29:58 +08:00
|
|
|
struct snd_soc_card *soc_card;
|
2015-05-07 00:36:41 +08:00
|
|
|
struct sst_cmd_sba_hw_set_ssp ssp_cmd;
|
2014-06-13 20:33:56 +08:00
|
|
|
};
|
2011-12-05 21:43:41 +08:00
|
|
|
int sst_register_dsp(struct sst_device *sst);
|
|
|
|
int sst_unregister_dsp(struct sst_device *sst);
|
2011-01-04 22:46:32 +08:00
|
|
|
#endif
|