Home | History | Annotate | Line # | Download | only in ic
tms320av110.c revision 1.8.20.3
      1  1.8.20.3   nathanw /*	$NetBSD: tms320av110.c,v 1.8.20.3 2002/01/08 00:30:07 nathanw Exp $	*/
      2       1.1        is 
      3       1.1        is /*-
      4       1.8        is  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5       1.7        is  * All rights reserved.
      6       1.7        is  *
      7       1.7        is  * This code is derived from software contributed to The NetBSD Foundation
      8       1.7        is  * by Ignatios Souvatzis.
      9       1.1        is  *
     10       1.1        is  * Redistribution and use in source and binary forms, with or without
     11       1.1        is  * modification, are permitted provided that the following conditions
     12       1.1        is  * are met:
     13       1.1        is  * 1. Redistributions of source code must retain the above copyright
     14       1.1        is  *    notice, this list of conditions and the following disclaimer.
     15       1.1        is  * 2. Redistributions in binary form must reproduce the above copyright
     16       1.1        is  *    notice, this list of conditions and the following disclaimer in the
     17       1.1        is  *    documentation and/or other materials provided with the distribution.
     18       1.7        is  * 3. All advertising materials mentioning features or use of this software
     19       1.7        is  *    must display the following acknowledgement:
     20       1.7        is  *        This product includes software developed by the NetBSD
     21       1.7        is  *        Foundation, Inc. and its contributors.
     22       1.7        is  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23       1.7        is  *    contributors may be used to endorse or promote products derived
     24       1.7        is  *    from this software without specific prior written permission.
     25       1.1        is  *
     26       1.7        is  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27       1.7        is  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28       1.7        is  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29       1.7        is  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30       1.7        is  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31       1.7        is  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32       1.7        is  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33       1.7        is  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34       1.7        is  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35       1.7        is  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36       1.7        is  * POSSIBILITY OF SUCH DAMAGE.
     37       1.1        is  */
     38       1.1        is 
     39       1.1        is /*
     40       1.1        is  * Machine independent part of TMS320AV110 driver.
     41       1.1        is  *
     42       1.1        is  * Currently, only minimum support for audio output. For audio/video
     43       1.1        is  * synchronization, more is needed.
     44       1.1        is  */
     45  1.8.20.2   nathanw 
     46  1.8.20.2   nathanw #include <sys/cdefs.h>
     47  1.8.20.3   nathanw __KERNEL_RCSID(0, "$NetBSD: tms320av110.c,v 1.8.20.3 2002/01/08 00:30:07 nathanw Exp $");
     48       1.1        is 
     49       1.1        is #include <sys/param.h>
     50       1.1        is #include <sys/systm.h>
     51       1.1        is #include <sys/kernel.h>
     52       1.1        is #include <sys/device.h>
     53       1.1        is #include <sys/proc.h>
     54       1.1        is 
     55       1.1        is #include <sys/audioio.h>
     56       1.1        is #include <dev/audio_if.h>
     57       1.1        is 
     58       1.1        is #include <dev/ic/tms320av110reg.h>
     59       1.1        is #include <dev/ic/tms320av110var.h>
     60       1.1        is 
     61       1.1        is #include <machine/bus.h>
     62       1.1        is 
     63       1.1        is int tav_open __P((void*, int));
     64       1.1        is void tav_close __P((void *));
     65       1.1        is int tav_drain __P((void *));
     66       1.1        is int tav_query_encoding __P((void *, struct audio_encoding *));
     67       1.1        is int tav_set_params __P((void *, int, int, struct audio_params *,
     68       1.1        is     struct audio_params *));
     69       1.1        is int tav_round_blocksize __P((void *, int));
     70       1.1        is int tav_init_output __P((void *, void *, int));
     71       1.1        is int tav_start_output __P((void *, void *, int, void (*)(void *), void *));
     72       1.1        is int tav_start_input __P((void *, void *, int, void (*)(void *), void *));
     73       1.1        is int tav_halt_output __P((void *));
     74       1.1        is int tav_halt_input __P((void *));
     75       1.1        is int tav_speaker_ctl __P((void *, int));
     76       1.1        is int tav_getdev __P((void *, struct audio_device *));
     77       1.1        is int tav_setfd __P((void *, int));
     78       1.1        is int tav_set_port __P((void *, mixer_ctrl_t *));
     79       1.1        is int tav_get_port __P((void *, mixer_ctrl_t *));
     80       1.1        is int tav_query_devinfo __P((void *, mixer_devinfo_t *));
     81       1.1        is int tav_get_props __P((void *));
     82       1.1        is 
     83       1.1        is struct audio_hw_if tav_audio_if = {
     84       1.1        is 	tav_open,
     85       1.1        is 	tav_close,
     86       1.1        is 	0 /* tav_drain*/,		/* optional */
     87       1.1        is 	tav_query_encoding,
     88       1.1        is 	tav_set_params,
     89       1.1        is 	tav_round_blocksize,
     90       1.1        is 	0 /* commit_settings */,	/* optional */
     91       1.1        is 	tav_init_output,		/* optional */
     92       1.1        is 	0 /* tav_init_input */,		/* optional */
     93       1.1        is 	tav_start_output,
     94       1.1        is 	tav_start_input,
     95       1.1        is 	tav_halt_output,
     96       1.1        is 	tav_halt_input,
     97       1.1        is 	tav_speaker_ctl,		/* optional */
     98       1.1        is 	tav_getdev,
     99       1.1        is 	0 /* setfd */,			/* optional */
    100       1.1        is 	tav_set_port,
    101       1.1        is 	tav_get_port,
    102       1.1        is 	tav_query_devinfo,
    103       1.1        is 	0 /* alloc */,			/* optional */
    104       1.1        is 	0 /* free */,			/* optional */
    105       1.1        is 	0 /* round_buffersize */,	/* optional */
    106       1.1        is 	0 /* mappage */,		/* optional */
    107  1.8.20.1   nathanw 	tav_get_props,
    108  1.8.20.1   nathanw 	0 /* dev_ioctl */		/* optional */
    109       1.1        is };
    110       1.1        is 
    111       1.1        is void
    112       1.1        is tms320av110_attach_mi(sc)
    113       1.1        is 	struct tav_softc *sc;
    114       1.1        is {
    115       1.1        is 	bus_space_tag_t iot = sc->sc_iot;
    116       1.1        is 	bus_space_handle_t ioh = sc->sc_ioh;
    117       1.1        is 
    118       1.1        is 	tav_write_byte(iot, ioh, TAV_RESET, 1);
    119       1.1        is 	while (tav_read_byte(iot, ioh, TAV_RESET))
    120       1.1        is 		delay(250);
    121       1.1        is 
    122       1.1        is 	tav_write_byte(iot, ioh, TAV_PCM_ORD, sc->sc_pcm_ord);
    123       1.1        is 	tav_write_byte(iot, ioh, TAV_PCM_18, sc->sc_pcm_18);
    124       1.1        is 	tav_write_byte(iot, ioh, TAV_DIF, sc->sc_dif);
    125       1.1        is 	tav_write_byte(iot, ioh, TAV_PCM_DIV, sc->sc_pcm_div);
    126       1.1        is 
    127       1.1        is 	printf(": chip rev. %d, %d bytes buffer\n",
    128       1.1        is 	    tav_read_byte(iot, ioh, TAV_VERSION),
    129       1.1        is 	    TAV_DRAM_SIZE(tav_read_byte(iot, ioh, TAV_DRAM_EXT)));
    130       1.1        is 
    131       1.1        is 	tav_write_byte(iot, ioh, TAV_AUD_ID_EN, 0);
    132       1.1        is 	tav_write_byte(iot, ioh, TAV_SKIP, 0);
    133       1.1        is 	tav_write_byte(iot, ioh, TAV_REPEAT, 0);
    134       1.1        is 	tav_write_byte(iot, ioh, TAV_MUTE, 0);
    135       1.1        is 	tav_write_byte(iot, ioh, TAV_PLAY, 1);
    136       1.1        is 	tav_write_byte(iot, ioh, TAV_SYNC_ECM, 0);
    137       1.1        is 	tav_write_byte(iot, ioh, TAV_CRC_ECM, 0);
    138       1.1        is 	tav_write_byte(iot, ioh, TAV_ATTEN_L, 0);
    139       1.1        is 	tav_write_byte(iot, ioh, TAV_ATTEN_R, 0);
    140       1.3        is 	tav_write_short(iot, ioh, TAV_FREE_FORM, 0);
    141       1.1        is 	tav_write_byte(iot, ioh, TAV_SIN_EN, 0);
    142       1.1        is 	tav_write_byte(iot, ioh, TAV_SYNC_ECM, TAV_ECM_REPEAT);
    143       1.1        is 	tav_write_byte(iot, ioh, TAV_CRC_ECM, TAV_ECM_REPEAT);
    144       1.1        is 
    145       1.6  augustss 	audio_attach_mi(&tav_audio_if, sc, &sc->sc_dev);
    146       1.1        is }
    147       1.1        is 
    148       1.1        is int
    149       1.1        is tms320av110_intr(p)
    150       1.1        is 	void *p;
    151       1.1        is {
    152       1.1        is         struct tav_softc *sc = p;
    153       1.1        is 	u_int16_t intlist;
    154       1.1        is 
    155       1.1        is 	intlist = tav_read_short(sc->sc_iot, sc->sc_ioh, TAV_INTR)
    156       1.1        is 	    /* & tav_read_short(sc->sc_iot, sc->sc_ioh, TAV_INTR_EN)*/;
    157       1.1        is 
    158       1.1        is 	if (!intlist)
    159       1.1        is 		return 0;
    160       1.1        is 
    161       1.1        is 	/* ack now, so that we don't miss later interupts */
    162       1.1        is 	if (sc->sc_intack)
    163       1.1        is 		(sc->sc_intack)(sc);
    164       1.1        is 
    165       1.1        is 	if (intlist & TAV_INTR_LOWWATER) {
    166       1.1        is 		(*sc->sc_intr)(sc->sc_intrarg);
    167       1.1        is 	}
    168       1.1        is 
    169       1.1        is 	if (intlist & TAV_INTR_PCM_OUTPUT_UNDERFLOW) {
    170       1.1        is 		 wakeup(sc);
    171       1.1        is 	}
    172       1.1        is 
    173       1.1        is 	return 1;
    174       1.1        is }
    175       1.1        is 
    176       1.1        is struct audio_encoding tav_encodings[] = {
    177       1.2  augustss 	{0, AudioEmpeg_l2_stream, AUDIO_ENCODING_MPEG_L2_STREAM, 1, 0,},
    178       1.2  augustss 	{1, AudioEmpeg_l2_packets, AUDIO_ENCODING_MPEG_L2_PACKETS, 1, 0,},
    179       1.4        is 	{2, AudioEmpeg_l2_system, AUDIO_ENCODING_MPEG_L2_SYSTEM, 1, 0,},
    180       1.2  augustss 	{3, AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16, 0,},
    181       1.1        is };
    182       1.1        is 
    183       1.1        is int
    184       1.1        is tav_open(hdl, flags)
    185       1.1        is 	void *hdl;
    186       1.1        is 	int flags;
    187       1.1        is {
    188       1.1        is         struct tav_softc *sc;
    189       1.1        is 
    190       1.1        is 	sc = hdl;
    191       1.1        is 
    192       1.1        is 	/* dummy */
    193       1.1        is 	return 0;
    194       1.1        is }
    195       1.1        is 
    196       1.1        is void
    197       1.1        is tav_close(hdl)
    198       1.1        is         void *hdl;
    199       1.1        is {
    200       1.1        is         struct tav_softc *sc;
    201       1.1        is 	bus_space_tag_t iot;
    202       1.1        is 	bus_space_handle_t ioh;
    203       1.1        is 
    204       1.1        is 	sc = hdl;
    205       1.1        is 	iot = sc->sc_iot;
    206       1.1        is 	ioh = sc->sc_ioh;
    207       1.1        is 
    208       1.1        is 	/* re"start" chip, also clears interupts and interupt enable */
    209       1.1        is 	tav_write_short(iot, ioh, TAV_INTR_EN, 0);
    210       1.1        is 	if (sc->sc_intack)
    211       1.1        is 		(*sc->sc_intack)(sc);
    212       1.1        is }
    213       1.1        is 
    214       1.1        is int
    215       1.1        is tav_drain(hdl)
    216       1.1        is         void *hdl;
    217       1.1        is {
    218       1.1        is         struct tav_softc *sc;
    219       1.1        is 	bus_space_tag_t iot;
    220       1.1        is 	bus_space_handle_t ioh;
    221       1.1        is 	u_int16_t mask;
    222       1.1        is 
    223       1.1        is         sc = hdl;
    224       1.1        is 	iot = sc->sc_iot;
    225       1.1        is 	ioh = sc->sc_ioh;
    226       1.1        is 
    227       1.1        is 	/*
    228       1.1        is 	 * tsleep waiting for underflow interupt.
    229       1.1        is 	 */
    230       1.1        is 	if (tav_read_short(iot, ioh, TAV_BUFF)) {
    231       1.1        is 		mask = tav_read_short(iot, ioh, TAV_INTR_EN);
    232       1.1        is 		tav_write_short(iot, ioh, TAV_INTR_EN,
    233       1.1        is 		    mask|TAV_INTR_PCM_OUTPUT_UNDERFLOW);
    234       1.1        is 
    235       1.1        is 		/* still more than zero? */
    236       1.1        is 		if (tav_read_short(iot, ioh, TAV_BUFF))
    237       1.1        is 			(void)tsleep(sc, PCATCH, "tavdrain", 32*hz);
    238       1.1        is 
    239       1.1        is 		/* can be really that long for mpeg */
    240       1.1        is 
    241       1.1        is 		mask = tav_read_short(iot, ioh, TAV_INTR_EN);
    242       1.1        is 		tav_write_short(iot, ioh, TAV_INTR_EN,
    243       1.1        is 		    mask & ~TAV_INTR_PCM_OUTPUT_UNDERFLOW);
    244       1.1        is 	}
    245       1.1        is 
    246       1.1        is 	return 0;
    247       1.1        is }
    248       1.1        is 
    249       1.1        is int
    250       1.1        is tav_query_encoding(hdl, ae)
    251       1.1        is         void *hdl;
    252       1.1        is 	struct audio_encoding *ae;
    253       1.1        is {
    254       1.1        is         struct tav_softc *sc;
    255       1.1        is 
    256       1.1        is 	sc = hdl;
    257       1.1        is 	if (ae->index >= sizeof(tav_encodings)/sizeof(*ae))
    258       1.1        is 		return EINVAL;
    259       1.1        is 
    260       1.1        is 	*ae = tav_encodings[ae->index];
    261       1.1        is 
    262       1.1        is 	return 0;
    263       1.1        is }
    264       1.1        is 
    265       1.1        is int
    266       1.1        is tav_start_input(hdl, block, bsize, intr, intrarg)
    267       1.1        is 	void *hdl;
    268       1.1        is 	void *block;
    269       1.1        is 	int bsize;
    270       1.1        is 	void (*intr) __P((void *));
    271       1.1        is 	void *intrarg;
    272       1.1        is {
    273       1.1        is 	return ENOTTY;
    274       1.1        is }
    275       1.1        is 
    276       1.1        is int
    277       1.1        is tav_halt_input(hdl)
    278       1.1        is 	void *hdl;
    279       1.1        is {
    280       1.1        is 	return ENOTTY;
    281       1.1        is }
    282       1.1        is 
    283       1.1        is int
    284       1.1        is tav_start_output(hdl, block, bsize, intr, intrarg)
    285       1.1        is 	void *hdl;
    286       1.1        is 	void *block;
    287       1.1        is 	int bsize;
    288       1.1        is 	void (*intr) __P((void *));
    289       1.1        is 	void *intrarg;
    290       1.1        is {
    291       1.1        is         struct tav_softc *sc;
    292       1.1        is 	bus_space_tag_t iot;
    293       1.1        is 	bus_space_handle_t ioh;
    294       1.1        is 	u_int8_t *ptr;
    295       1.1        is 	int count;
    296       1.1        is 
    297       1.1        is 
    298       1.1        is         sc = hdl;
    299       1.1        is 	iot = sc->sc_iot;
    300       1.1        is 	ioh = sc->sc_ioh;
    301       1.1        is 	ptr = block;
    302       1.1        is 	count = bsize;
    303       1.1        is 
    304       1.1        is 	sc->sc_intr = intr;
    305       1.1        is 	sc->sc_intrarg = intrarg;
    306       1.1        is 
    307       1.5        is 	bus_space_write_multi_1(iot, ioh, TAV_DATAIN, ptr, count);
    308       1.1        is 	tav_write_short(iot, ioh, TAV_INTR_EN, TAV_INTR_LOWWATER);
    309       1.1        is 
    310       1.1        is 	return 0;
    311       1.1        is }
    312       1.1        is 
    313       1.1        is int
    314       1.1        is tav_init_output(hdl, buffer, size)
    315       1.1        is 	void *hdl;
    316       1.1        is 	void *buffer;
    317       1.1        is 	int size;
    318       1.1        is {
    319       1.1        is         struct tav_softc *sc;
    320       1.1        is 	bus_space_tag_t iot;
    321       1.1        is 	bus_space_handle_t ioh;
    322       1.1        is 
    323       1.1        is         sc = hdl;
    324       1.1        is 	iot = sc->sc_iot;
    325       1.1        is 	ioh = sc->sc_ioh;
    326       1.1        is 
    327       1.1        is 	tav_write_byte(iot, ioh, TAV_PLAY, 1);
    328       1.1        is 	tav_write_byte(iot, ioh, TAV_MUTE, 0);
    329       1.1        is 
    330       1.1        is 	return 0;
    331       1.1        is }
    332       1.1        is 
    333       1.1        is int
    334       1.1        is tav_halt_output(hdl)
    335       1.1        is 	void *hdl;
    336       1.1        is {
    337       1.1        is         struct tav_softc *sc;
    338       1.1        is 	bus_space_tag_t iot;
    339       1.1        is 	bus_space_handle_t ioh;
    340       1.1        is 
    341       1.1        is         sc = hdl;
    342       1.1        is 	iot = sc->sc_iot;
    343       1.1        is 	ioh = sc->sc_ioh;
    344       1.1        is 
    345       1.1        is 	tav_write_byte(iot, ioh, TAV_PLAY, 0);
    346       1.1        is 
    347       1.1        is 	return 0;
    348       1.1        is }
    349       1.1        is 
    350       1.1        is int
    351       1.1        is tav_getdev(hdl, ret)
    352       1.1        is 	void *hdl;
    353       1.1        is 	struct audio_device *ret;
    354       1.1        is {
    355       1.1        is         struct tav_softc *sc;
    356       1.1        is 	bus_space_tag_t iot;
    357       1.1        is 	bus_space_handle_t ioh;
    358       1.1        is 
    359       1.1        is         sc = hdl;
    360       1.1        is 	iot = sc->sc_iot;
    361       1.1        is 	ioh = sc->sc_ioh;
    362       1.1        is 
    363       1.1        is 	strncpy(ret->name, "tms320av110", MAX_AUDIO_DEV_LEN);
    364       1.1        is 	sprintf(ret->version, "%u", /* guaranteed to be <= 4 in length */
    365       1.1        is 	    tav_read_byte(iot, ioh, TAV_VERSION));
    366       1.1        is 	strncpy(ret->config, sc->sc_dev.dv_xname, MAX_AUDIO_DEV_LEN);
    367       1.1        is 
    368       1.1        is 	return 0;
    369       1.1        is }
    370       1.1        is 
    371       1.1        is int
    372       1.1        is tav_round_blocksize(hdl, size)
    373       1.1        is 	void *hdl;
    374       1.1        is 	int size;
    375       1.1        is {
    376       1.1        is         struct tav_softc *sc;
    377       1.1        is 	bus_space_tag_t iot;
    378       1.1        is 	bus_space_handle_t ioh;
    379       1.1        is 	int maxhalf;
    380       1.1        is 
    381       1.1        is         sc = hdl;
    382       1.1        is 	iot = sc->sc_iot;
    383       1.1        is 	ioh = sc->sc_ioh;
    384       1.1        is 
    385       1.1        is 	maxhalf = TAV_DRAM_HSIZE(tav_read_byte(iot, ioh, TAV_DRAM_EXT));
    386       1.1        is 	if (size > maxhalf)
    387       1.1        is 		size = maxhalf;
    388       1.1        is 
    389       1.1        is 	/* XXX should round to 128 bytes limits for audio bypass */
    390       1.1        is 	size &= ~3;
    391       1.1        is 
    392       1.1        is 	tav_write_short(iot, ioh, TAV_BALE_LIM, size/8);
    393       1.1        is 
    394       1.1        is 	/* the buffer limits are in units of 4 bytes */
    395       1.1        is 	return (size);
    396       1.1        is }
    397       1.1        is 
    398       1.1        is int
    399       1.1        is tav_get_props(hdl)
    400       1.1        is         void *hdl;
    401       1.1        is {
    402       1.1        is 	return 0;
    403       1.1        is }
    404       1.1        is 
    405       1.1        is int
    406       1.1        is tav_set_params(hdl, setmode, usemode, p, r)
    407       1.1        is 	void *hdl;
    408       1.1        is         int setmode, usemode;
    409       1.1        is         struct  audio_params *p, *r;
    410       1.1        is {
    411       1.1        is         struct tav_softc *sc;
    412       1.1        is 	bus_space_tag_t iot;
    413       1.1        is 	bus_space_handle_t ioh;
    414       1.1        is 
    415       1.1        is         sc = hdl;
    416       1.1        is 	iot = sc->sc_iot;
    417       1.1        is 	ioh = sc->sc_ioh;
    418       1.1        is 
    419       1.1        is 	if (!(setmode & AUMODE_PLAY))
    420       1.1        is 		return 0;
    421       1.1        is 
    422       1.1        is 	if (p->encoding == AUDIO_ENCODING_ULAW)
    423       1.1        is 		p->encoding = AUDIO_ENCODING_MPEG_L2_STREAM;
    424       1.1        is 
    425       1.1        is 	switch(p->encoding) {
    426       1.1        is 	default:
    427       1.1        is 		return EINVAL;
    428       1.1        is 
    429       1.1        is 	case AUDIO_ENCODING_SLINEAR_BE:
    430       1.1        is 
    431       1.1        is 		/* XXX: todo: add 8bit and mono using software */
    432       1.1        is 		p->precision = 16;
    433       1.1        is 		p->channels = 2;
    434       1.1        is 
    435       1.1        is 		/* XXX: this might depend on the specific board.
    436       1.1        is 		   should be handled by the backend */
    437       1.1        is 
    438       1.1        is 		p->sample_rate = 44100;
    439       1.1        is 
    440       1.1        is 		bus_space_write_1(iot, ioh, TAV_STR_SEL,
    441       1.1        is 		    TAV_STR_SEL_AUDIO_BYPASS);
    442       1.1        is 		break;
    443       1.1        is 
    444       1.1        is 	/* XXX: later: add ULINEAR, and LE using software encoding */
    445       1.1        is 
    446       1.1        is 	case AUDIO_ENCODING_MPEG_L1_STREAM:
    447       1.1        is 		/* FALLTHROUGH */
    448       1.1        is 	case AUDIO_ENCODING_MPEG_L2_STREAM:
    449       1.1        is 		bus_space_write_1(iot, ioh, TAV_STR_SEL,
    450       1.1        is 		    TAV_STR_SEL_MPEG_AUDIO_STREAM);
    451       1.1        is 		p->sample_rate = 44100;
    452       1.1        is 		p->precision = 1;
    453       1.1        is 		break;
    454       1.1        is 
    455       1.1        is 	case AUDIO_ENCODING_MPEG_L1_PACKETS:
    456       1.1        is 		/* FALLTHROUGH */
    457       1.1        is 	case AUDIO_ENCODING_MPEG_L2_PACKETS:
    458       1.1        is 		bus_space_write_1(iot, ioh, TAV_STR_SEL,
    459       1.1        is 		    TAV_STR_SEL_MPEG_AUDIO_PACKETS);
    460       1.1        is 		p->sample_rate = 44100;
    461       1.1        is 		p->precision = 1;
    462       1.1        is 		break;
    463       1.1        is 
    464       1.1        is 	case AUDIO_ENCODING_MPEG_L1_SYSTEM:
    465       1.1        is 		/* FALLTHROUGH */
    466       1.1        is 	case AUDIO_ENCODING_MPEG_L2_SYSTEM:
    467       1.1        is 		bus_space_write_1(iot, ioh, TAV_STR_SEL,
    468       1.1        is 		    TAV_STR_SEL_MPEG_SYSTEM_STREAM);
    469       1.1        is 		p->sample_rate = 44100;
    470       1.1        is 		p->precision = 1;
    471       1.1        is 		break;
    472       1.1        is 	}
    473       1.1        is 	tav_write_byte(iot, ioh, TAV_RESTART, 1);
    474       1.1        is 	do {
    475       1.1        is 		delay(10);
    476       1.1        is 	} while (tav_read_byte(iot, ioh, TAV_RESTART));
    477       1.1        is 
    478       1.1        is 	return 0;
    479       1.1        is }
    480       1.1        is 
    481       1.1        is int
    482       1.1        is tav_set_port(hdl, mc)
    483       1.1        is         void *hdl;
    484       1.1        is 	mixer_ctrl_t *mc;
    485       1.1        is {
    486       1.1        is         struct tav_softc *sc;
    487       1.1        is 
    488       1.1        is 	sc = hdl;
    489       1.1        is 	/* dummy */
    490       1.1        is 	return 0;
    491       1.1        is }
    492       1.1        is 
    493       1.1        is int
    494       1.1        is tav_get_port(hdl, mc)
    495       1.1        is         void *hdl;
    496       1.1        is 	mixer_ctrl_t *mc;
    497       1.1        is {
    498       1.1        is         struct tav_softc *sc;
    499       1.1        is 
    500       1.1        is 	sc = hdl;
    501       1.1        is 	/* dummy */
    502       1.1        is 	return 0;
    503       1.1        is }
    504       1.1        is 
    505       1.1        is int
    506       1.1        is tav_query_devinfo(hdl, di)
    507       1.1        is 	void *hdl;
    508       1.1        is 	mixer_devinfo_t *di;
    509       1.1        is {
    510       1.2  augustss 	return ENXIO;
    511       1.1        is }
    512       1.1        is 
    513       1.1        is int
    514       1.1        is tav_speaker_ctl(hdl, value)
    515       1.1        is 	void *hdl;
    516       1.1        is 	int value;
    517       1.1        is {
    518       1.1        is         struct tav_softc *sc;
    519       1.1        is 	bus_space_tag_t iot;
    520       1.1        is 	bus_space_handle_t ioh;
    521       1.1        is 
    522       1.1        is 	sc = hdl;
    523       1.1        is 	iot = sc->sc_iot;
    524       1.1        is 	ioh = sc->sc_ioh;
    525       1.1        is 
    526       1.1        is 	tav_write_byte(iot, ioh, TAV_MUTE, !value);
    527       1.1        is 
    528       1.1        is 	return 0;
    529       1.1        is }
    530