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