zaudiovar.h revision 1.2 1 /* $NetBSD: zaudiovar.h,v 1.2 2016/07/07 06:55:40 msaitoh Exp $ */
2 /* $OpenBSD: zaurus_audio.c,v 1.8 2005/08/18 13:23:02 robert Exp $ */
3
4 /*
5 * Copyright (c) 2005 Christopher Pascoe <pascoe (at) openbsd.org>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 /*-
21 * Copyright (C) 2009 NONAKA Kimihiro <nonaka (at) netbsd.org>
22 * All rights reserved.
23 *
24 * Redistribution and use in source and binary forms, with or without
25 * modification, are permitted provided that the following conditions
26 * are met:
27 * 1. Redistributions of source code must retain the above copyright
28 * notice, this list of conditions and the following disclaimer.
29 * 2. Redistributions in binary form must reproduce the above copyright
30 * notice, this list of conditions and the following disclaimer in the
31 * documentation and/or other materials provided with the distribution.
32 *
33 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
34 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
35 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
36 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
37 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
38 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
39 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
40 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
41 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
42 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 */
44
45 #ifndef _ZAURUS_DEV_ZAUDIOVAR_H_
46 #define _ZAURUS_DEV_ZAUDIOVAR_H_
47
48 struct zaudio_volume {
49 uint8_t left;
50 uint8_t right;
51 };
52
53 struct zaudio_softc {
54 device_t sc_dev;
55 kmutex_t sc_lock;
56 kmutex_t sc_intr_lock;
57
58 /* i2s device softc */
59 /* NB: pxa2x0_i2s requires this to be the second struct member */
60 struct pxa2x0_i2s_softc sc_i2s;
61
62 i2c_tag_t sc_i2c;
63
64 int sc_playing;
65 int sc_recording;
66
67 struct zaudio_volume *sc_volume;
68 uint8_t *sc_unmute;
69 uint8_t *sc_unmute_toggle;
70
71 int sc_jack;
72 int sc_state;
73 int sc_icount;
74 callout_t sc_to;
75 };
76
77 #define UNMUTE(sc,op,val) sc->sc_unmute[op] = sc->sc_unmute_toggle[op] = val
78
79 #define ZAUDIO_JACK_STATE_OUT 0
80 #define ZAUDIO_JACK_STATE_IN 1
81 #define ZAUDIO_JACK_STATE_INS 2
82 #define ZAUDIO_JACK_STATE_REM 3
83
84 int zaudio_open(void *, int);
85 void zaudio_close(void *);
86 int zaudio_round_blocksize(void *, int, int, const audio_params_t *);
87 void * zaudio_allocm(void *, int, size_t);
88 void zaudio_freem(void *, void *, size_t);
89 size_t zaudio_round_buffersize(void *, int, size_t);
90 paddr_t zaudio_mappage(void *, void *, off_t, int);
91 int zaudio_get_props(void *);
92 void zaudio_get_locks(void *, kmutex_t **, kmutex_t **);
93
94 #endif /* _ZAURUS_DEV_ZAUDIOVAR_H_ */
95