1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright 2011 Broadcom Corporation.  All rights reserved. */
3 
4 #ifndef _VC_AUDIO_DEFS_H_
5 #define _VC_AUDIO_DEFS_H_
6 
7 #define VC_AUDIOSERV_MIN_VER 1
8 #define VC_AUDIOSERV_VER 2
9 
10 /* FourCC codes used for VCHI communication */
11 #define VC_AUDIO_WRITE_COOKIE1 VCHIQ_MAKE_FOURCC('B', 'C', 'M', 'A')
12 #define VC_AUDIO_WRITE_COOKIE2 VCHIQ_MAKE_FOURCC('D', 'A', 'T', 'A')
13 
14 /*
15  *  List of screens that are currently supported
16  *  All message types supported for HOST->VC direction
17  */
18 
19 enum vc_audio_msg_type {
20 	VC_AUDIO_MSG_TYPE_RESULT, // Generic result
21 	VC_AUDIO_MSG_TYPE_COMPLETE, // Generic result
22 	VC_AUDIO_MSG_TYPE_CONFIG, // Configure audio
23 	VC_AUDIO_MSG_TYPE_CONTROL, // Configure audio
24 	VC_AUDIO_MSG_TYPE_OPEN, // Configure audio
25 	VC_AUDIO_MSG_TYPE_CLOSE, // Configure audio
26 	VC_AUDIO_MSG_TYPE_START, // Configure audio
27 	VC_AUDIO_MSG_TYPE_STOP, // Configure audio
28 	VC_AUDIO_MSG_TYPE_WRITE, // Configure audio
29 	VC_AUDIO_MSG_TYPE_MAX
30 };
31 
32 /* configure the audio */
33 
34 struct vc_audio_config {
35 	u32 channels;
36 	u32 samplerate;
37 	u32 bps;
38 };
39 
40 struct vc_audio_control {
41 	u32 volume;
42 	u32 dest;
43 };
44 
45 struct vc_audio_open {
46 	u32 dummy;
47 };
48 
49 struct vc_audio_close {
50 	u32 dummy;
51 };
52 
53 struct vc_audio_start {
54 	u32 dummy;
55 };
56 
57 struct vc_audio_stop {
58 	u32 draining;
59 };
60 
61 /* configure the write audio samples */
62 struct vc_audio_write {
63 	u32 count; // in bytes
64 	u32 cookie1;
65 	u32 cookie2;
66 	s16 silence;
67 	s16 max_packet;
68 };
69 
70 /* Generic result for a request (VC->HOST) */
71 struct vc_audio_result {
72 	s32 success; // Success value
73 };
74 
75 /* Generic result for a request (VC->HOST) */
76 struct vc_audio_complete {
77 	s32 count; // Success value
78 	u32 cookie1;
79 	u32 cookie2;
80 };
81 
82 /* Message header for all messages in HOST->VC direction */
83 struct vc_audio_msg {
84 	s32 type; /* Message type (VC_AUDIO_MSG_TYPE) */
85 	union {
86 		struct vc_audio_config config;
87 		struct vc_audio_control control;
88 		struct vc_audio_open open;
89 		struct vc_audio_close close;
90 		struct vc_audio_start start;
91 		struct vc_audio_stop stop;
92 		struct vc_audio_write write;
93 		struct vc_audio_result result;
94 		struct vc_audio_complete complete;
95 	};
96 };
97 
98 #endif /* _VC_AUDIO_DEFS_H_ */
99