1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_USB_MIXER_H
27 #define	_SYS_USB_MIXER_H
28 
29 
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #define	USB_AUDIO_MIXER_REGISTRATION	1
36 
37 /* Valid for the current alternate */
38 typedef struct usb_audio_formats {
39 	uchar_t		fmt_alt;	/* current alternate */
40 	uchar_t		fmt_chns;	/* MONO or STEREO */
41 	uchar_t		fmt_precision;	/* 8 or 16 */
42 	uchar_t		fmt_encoding;	/* AUDIO_ENCODING_LINEAR, etc. */
43 	uchar_t		fmt_termlink;	/* for feature unit */
44 	uint_t		fmt_sr;		/* current sample rate */
45 } usb_audio_formats_t;
46 
47 _NOTE(SCHEME_PROTECTS_DATA("unshared", usb_audio_formats))
48 
49 
50 typedef struct usb_audio_play_req {
51 	int 		up_samples;
52 	audiohdl_t 	up_handle;
53 } usb_audio_play_req_t;
54 
55 #define	USB_AS_N_SRS		20
56 #define	USB_AS_N_FORMATS	20
57 #define	USB_AS_N_COMBINATIONS	USB_AS_N_FORMATS
58 #define	USB_AS_N_CHANNELS	3
59 
60 typedef struct usb_as_registration {
61 	uchar_t			reg_valid;
62 	uchar_t			reg_mode;	/* play or record */
63 	uchar_t			reg_n_formats;
64 	int			reg_ifno;
65 	uint_t			reg_srs[USB_AS_N_SRS];
66 	usb_audio_formats_t	reg_formats[USB_AS_N_FORMATS];
67 	uint_t			reg_channels[USB_AS_N_CHANNELS];
68 	am_ad_cap_comb_t	reg_combinations[USB_AS_N_COMBINATIONS];
69 } usb_as_registration_t;
70 
71 /* MCTLs between usb_ac and usb_as */
72 #define	USB_AUDIO_SETUP			0x0100
73 #define	USB_AUDIO_TEARDOWN		0x0200
74 #define	USB_AUDIO_START_PLAY		0x0300
75 #define	USB_AUDIO_STOP_PLAY		0x0400
76 #define	USB_AUDIO_PAUSE_PLAY		0x0500
77 #define	USB_AUDIO_START_RECORD		0x0600
78 #define	USB_AUDIO_STOP_RECORD		0x0700
79 #define	USB_AUDIO_SET_FORMAT		0x0800
80 #define	USB_AUDIO_SET_SAMPLE_FREQ	0x0900
81 
82 /* MCTLs between usb_ac and usb_ah */
83 #define	USB_AUDIO_VOL_CHANGE		0x1
84 #define	USB_AUDIO_BALANCE		0x2
85 #define	USB_AUDIO_MUTE			0x3
86 #define	USB_AUDIO_BASS			0x4
87 #define	USB_AUDIO_TREBLE		0x5
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 #endif	/* _SYS_USB_MIXER_H */
94