1*cc5bdd41Skn /* $OpenBSD: am7930var.h,v 1.6 2022/10/26 20:19:07 kn Exp $ */ 2d98f46d7Smiod /* $NetBSD: am7930var.h,v 1.10 2005/01/15 15:19:52 kent Exp $ */ 3d98f46d7Smiod 4d98f46d7Smiod /* 5d98f46d7Smiod * Copyright (c) 1992, 1993 6d98f46d7Smiod * The Regents of the University of California. All rights reserved. 7d98f46d7Smiod * 8d98f46d7Smiod * This software was developed by the Computer Systems Engineering group 9d98f46d7Smiod * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 10d98f46d7Smiod * contributed to Berkeley. 11d98f46d7Smiod * 12d98f46d7Smiod * All advertising materials mentioning features or use of this software 13d98f46d7Smiod * must display the following acknowledgement: 14d98f46d7Smiod * This product includes software developed by the University of 15d98f46d7Smiod * California, Lawrence Berkeley Laboratory. 16d98f46d7Smiod * 17d98f46d7Smiod * Redistribution and use in source and binary forms, with or without 18d98f46d7Smiod * modification, are permitted provided that the following conditions 19d98f46d7Smiod * are met: 20d98f46d7Smiod * 1. Redistributions of source code must retain the above copyright 21d98f46d7Smiod * notice, this list of conditions and the following disclaimer. 22d98f46d7Smiod * 2. Redistributions in binary form must reproduce the above copyright 23d98f46d7Smiod * notice, this list of conditions and the following disclaimer in the 24d98f46d7Smiod * documentation and/or other materials provided with the distribution. 25d98f46d7Smiod * 3. Neither the name of the University nor the names of its contributors 26d98f46d7Smiod * may be used to endorse or promote products derived from this software 27d98f46d7Smiod * without specific prior written permission. 28d98f46d7Smiod * 29d98f46d7Smiod * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 30d98f46d7Smiod * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 31d98f46d7Smiod * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32d98f46d7Smiod * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 33d98f46d7Smiod * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 34d98f46d7Smiod * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35d98f46d7Smiod * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36d98f46d7Smiod * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37d98f46d7Smiod * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38d98f46d7Smiod * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39d98f46d7Smiod * SUCH DAMAGE. 40d98f46d7Smiod * 41d98f46d7Smiod * @(#)bsd_audiovar.h 8.1 (Berkeley) 6/11/93 42d98f46d7Smiod */ 43d98f46d7Smiod 44d98f46d7Smiod struct am7930_softc; 45d98f46d7Smiod 46d98f46d7Smiod struct am7930_glue { 47d98f46d7Smiod uint8_t (*codec_iread)(struct am7930_softc *sc, int); 48d98f46d7Smiod void (*codec_iwrite)(struct am7930_softc *sc, int, uint8_t); 49d98f46d7Smiod uint16_t (*codec_iread16)(struct am7930_softc *sc, int); 50d98f46d7Smiod void (*codec_iwrite16)(struct am7930_softc *sc, int, uint16_t); 51d98f46d7Smiod void (*onopen)(struct am7930_softc *sc); 52d98f46d7Smiod void (*onclose)(struct am7930_softc *sc); 53ac2bb4f3Sratchov int precision; 54d98f46d7Smiod }; 55d98f46d7Smiod 56d98f46d7Smiod struct am7930_softc { 57d98f46d7Smiod struct device sc_dev; /* base device */ 58d98f46d7Smiod int sc_open; 59d98f46d7Smiod int sc_locked; 60d98f46d7Smiod 61d98f46d7Smiod uint8_t sc_rlevel; /* record level */ 62d98f46d7Smiod uint8_t sc_plevel; /* play level */ 63d98f46d7Smiod uint8_t sc_mlevel; /* monitor level */ 64d98f46d7Smiod uint8_t sc_out_port; /* output port */ 65d98f46d7Smiod uint8_t sc_mic_mute; 66d98f46d7Smiod 67d98f46d7Smiod struct am7930_glue *sc_glue; 68d98f46d7Smiod }; 69d98f46d7Smiod 70d98f46d7Smiod extern int am7930debug; 71d98f46d7Smiod 72d98f46d7Smiod void am7930_init(struct am7930_softc *, int); 73d98f46d7Smiod 74d98f46d7Smiod #define AM7930_IWRITE(x,y,z) (*(x)->sc_glue->codec_iwrite)((x),(y),(z)) 75d98f46d7Smiod #define AM7930_IREAD(x,y) (*(x)->sc_glue->codec_iread)((x),(y)) 76d98f46d7Smiod #define AM7930_IWRITE16(x,y,z) (*(x)->sc_glue->codec_iwrite16)((x),(y),(z)) 77d98f46d7Smiod #define AM7930_IREAD16(x,y) (*(x)->sc_glue->codec_iread16)((x),(y)) 78d98f46d7Smiod 79d98f46d7Smiod #define AUDIOAMD_POLL_MODE 0 80d98f46d7Smiod #define AUDIOAMD_DMA_MODE 1 81d98f46d7Smiod 82d98f46d7Smiod /* 83d98f46d7Smiod * audio channel definitions. 84d98f46d7Smiod */ 85d98f46d7Smiod 86d98f46d7Smiod #define AUDIOAMD_SPEAKER_VOL 0 /* speaker volume */ 87d98f46d7Smiod #define AUDIOAMD_HEADPHONES_VOL 1 /* headphones volume */ 88d98f46d7Smiod #define AUDIOAMD_OUTPUT_CLASS 2 89d98f46d7Smiod 90d98f46d7Smiod #define AUDIOAMD_MONITOR_VOL 3 /* monitor input volume */ 91d98f46d7Smiod #define AUDIOAMD_MONITOR_OUTPUT 4 /* output selector */ 92d98f46d7Smiod #define AUDIOAMD_MONITOR_CLASS 5 93d98f46d7Smiod 94d98f46d7Smiod #define AUDIOAMD_MIC_VOL 6 /* microphone volume */ 95d98f46d7Smiod #define AUDIOAMD_MIC_MUTE 7 96d98f46d7Smiod #define AUDIOAMD_INPUT_CLASS 8 97d98f46d7Smiod 98d98f46d7Smiod #define AUDIOAMD_RECORD_SOURCE 9 /* source selector */ 99d98f46d7Smiod #define AUDIOAMD_RECORD_CLASS 10 100d98f46d7Smiod 101d98f46d7Smiod /* 102d98f46d7Smiod * audio(9) MI callbacks from upper-level audio layer. 103d98f46d7Smiod */ 104d98f46d7Smiod 105d98f46d7Smiod struct audio_params; 106d98f46d7Smiod 107d98f46d7Smiod int am7930_open(void *, int); 108d98f46d7Smiod void am7930_close(void *); 109d98f46d7Smiod int am7930_set_params(void *, int, int, struct audio_params *, 110d98f46d7Smiod struct audio_params *); 111d98f46d7Smiod int am7930_commit_settings(void *); 112d98f46d7Smiod int am7930_round_blocksize(void *, int); 113d98f46d7Smiod int am7930_halt_output(void *); 114d98f46d7Smiod int am7930_halt_input(void *); 115d98f46d7Smiod int am7930_set_port(void *, mixer_ctrl_t *); 116d98f46d7Smiod int am7930_get_port(void *, mixer_ctrl_t *); 117d98f46d7Smiod int am7930_query_devinfo(void *, mixer_devinfo_t *); 118