1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Intel Baytrail SST IPC Support
4  * Copyright (c) 2014, Intel Corporation.
5  */
6 
7 #ifndef __SST_BYT_IPC_H
8 #define __SST_BYT_IPC_H
9 
10 #include <linux/types.h>
11 
12 struct sst_byt;
13 struct sst_byt_stream;
14 struct sst_pdata;
15 extern struct sst_ops sst_byt_ops;
16 
17 
18 #define SST_BYT_MAILBOX_OFFSET		0x144000
19 #define SST_BYT_TIMESTAMP_OFFSET	(SST_BYT_MAILBOX_OFFSET + 0x800)
20 
21 /**
22  * Upfront defined maximum message size that is
23  * expected by the in/out communication pipes in FW.
24  */
25 #define SST_BYT_IPC_MAX_PAYLOAD_SIZE	200
26 
27 /* stream API */
28 struct sst_byt_stream *sst_byt_stream_new(struct sst_byt *byt, int id,
29 	uint32_t (*get_write_position)(struct sst_byt_stream *stream,
30 				       void *data),
31 	void *data);
32 
33 /* stream configuration */
34 int sst_byt_stream_set_bits(struct sst_byt *byt, struct sst_byt_stream *stream,
35 			    int bits);
36 int sst_byt_stream_set_channels(struct sst_byt *byt,
37 				struct sst_byt_stream *stream, u8 channels);
38 int sst_byt_stream_set_rate(struct sst_byt *byt, struct sst_byt_stream *stream,
39 			    unsigned int rate);
40 int sst_byt_stream_type(struct sst_byt *byt, struct sst_byt_stream *stream,
41 			int codec_type, int stream_type, int operation);
42 int sst_byt_stream_buffer(struct sst_byt *byt, struct sst_byt_stream *stream,
43 			  uint32_t buffer_addr, uint32_t buffer_size);
44 int sst_byt_stream_commit(struct sst_byt *byt, struct sst_byt_stream *stream);
45 int sst_byt_stream_free(struct sst_byt *byt, struct sst_byt_stream *stream);
46 
47 /* stream ALSA trigger operations */
48 int sst_byt_stream_start(struct sst_byt *byt, struct sst_byt_stream *stream,
49 			 u32 start_offset);
50 int sst_byt_stream_stop(struct sst_byt *byt, struct sst_byt_stream *stream);
51 int sst_byt_stream_pause(struct sst_byt *byt, struct sst_byt_stream *stream);
52 int sst_byt_stream_resume(struct sst_byt *byt, struct sst_byt_stream *stream);
53 
54 int sst_byt_get_dsp_position(struct sst_byt *byt,
55 			     struct sst_byt_stream *stream, int buffer_size);
56 
57 /* init */
58 int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata);
59 void sst_byt_dsp_free(struct device *dev, struct sst_pdata *pdata);
60 struct sst_dsp *sst_byt_get_dsp(struct sst_byt *byt);
61 int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata);
62 int sst_byt_dsp_boot(struct device *dev, struct sst_pdata *pdata);
63 int sst_byt_dsp_wait_for_ready(struct device *dev, struct sst_pdata *pdata);
64 
65 #endif
66