1/* 2 * Intel Baytrail SST IPC Support 3 * Copyright (c) 2014, Intel Corporation. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms and conditions of the GNU General Public License, 7 * version 2, as published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 * more details. 13 */ 14 15#ifndef __SST_BYT_IPC_H 16#define __SST_BYT_IPC_H 17 18#include <linux/types.h> 19 20struct sst_byt; 21struct sst_byt_stream; 22struct sst_pdata; 23extern struct sst_ops sst_byt_ops; 24 25 26#define SST_BYT_MAILBOX_OFFSET 0x144000 27#define SST_BYT_TIMESTAMP_OFFSET (SST_BYT_MAILBOX_OFFSET + 0x800) 28 29/** 30 * Upfront defined maximum message size that is 31 * expected by the in/out communication pipes in FW. 32 */ 33#define SST_BYT_IPC_MAX_PAYLOAD_SIZE 200 34 35/* stream API */ 36struct sst_byt_stream *sst_byt_stream_new(struct sst_byt *byt, int id, 37 uint32_t (*get_write_position)(struct sst_byt_stream *stream, 38 void *data), 39 void *data); 40 41/* stream configuration */ 42int sst_byt_stream_set_bits(struct sst_byt *byt, struct sst_byt_stream *stream, 43 int bits); 44int sst_byt_stream_set_channels(struct sst_byt *byt, 45 struct sst_byt_stream *stream, u8 channels); 46int sst_byt_stream_set_rate(struct sst_byt *byt, struct sst_byt_stream *stream, 47 unsigned int rate); 48int sst_byt_stream_type(struct sst_byt *byt, struct sst_byt_stream *stream, 49 int codec_type, int stream_type, int operation); 50int sst_byt_stream_buffer(struct sst_byt *byt, struct sst_byt_stream *stream, 51 uint32_t buffer_addr, uint32_t buffer_size); 52int sst_byt_stream_commit(struct sst_byt *byt, struct sst_byt_stream *stream); 53int sst_byt_stream_free(struct sst_byt *byt, struct sst_byt_stream *stream); 54 55/* stream ALSA trigger operations */ 56int sst_byt_stream_start(struct sst_byt *byt, struct sst_byt_stream *stream, 57 u32 start_offset); 58int sst_byt_stream_stop(struct sst_byt *byt, struct sst_byt_stream *stream); 59int sst_byt_stream_pause(struct sst_byt *byt, struct sst_byt_stream *stream); 60int sst_byt_stream_resume(struct sst_byt *byt, struct sst_byt_stream *stream); 61 62int sst_byt_get_dsp_position(struct sst_byt *byt, 63 struct sst_byt_stream *stream, int buffer_size); 64 65/* init */ 66int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata); 67void sst_byt_dsp_free(struct device *dev, struct sst_pdata *pdata); 68struct sst_dsp *sst_byt_get_dsp(struct sst_byt *byt); 69int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata); 70int sst_byt_dsp_boot(struct device *dev, struct sst_pdata *pdata); 71int sst_byt_dsp_wait_for_ready(struct device *dev, struct sst_pdata *pdata); 72 73#endif 74