Home | History | Annotate | Line # | Download | only in ic
uda1341var.h revision 1.1.6.2
      1 /*-
      2  * Copyright (c) 2012 The NetBSD Foundation, Inc.
      3  * All rights reserved.
      4  *
      5  * This code is derived from software contributed to The NetBSD Foundation
      6  * by Paul Fleischer <paul (at) xpg.dk>
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  *
     17  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     20  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     21  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     27  * POSSIBILITY OF SUCH DAMAGE.
     28  */
     29 #ifndef _DEV_IC_UDA1341VAR_H_
     30 #define _DEV_IC_UDA1341VAR_H_
     31 
     32 #include <sys/device.h>
     33 #include <sys/audioio.h>
     34 
     35 #include <dev/auconv.h>
     36 
     37 #define UDA1341_NFORMATS 4
     38 extern const struct audio_format uda1341_formats[UDA1341_NFORMATS];
     39 
     40 struct uda1341_softc {
     41 	/* Pointer to the driver that holds this sc */
     42 	void		*parent;
     43 
     44 	/* Pointer to L3 write function */
     45 	void		(*sc_l3_write)(void *,int,int);
     46 
     47 	/* Approximate sample rate at which the codec is currently running */
     48 	int		sc_sample_rate_approx;
     49 
     50 	int		sc_system_clock;
     51 #define UDA1341_CLOCK_NA  3
     52 #define UDA1341_CLOCK_256 2
     53 #define UDA1341_CLOCK_384 1
     54 #define UDA1341_CLOCK_512 0
     55 
     56 	int		sc_bus_format;
     57 #define UDA1341_BUS_I2S		0
     58 #define UDA1341_BUS_LSB16	1
     59 #define UDA1341_BUS_LSB18	2
     60 #define UDA1341_BUS_LSB20	3
     61 #define UDA1341_BUS_MSB		4
     62 #define UDA1341_BUS_LSB16_MSB	5
     63 #define UDA1341_BUS_LSB18_MSB	6
     64 #define UDA1341_BUS_LSB20_MSB	7
     65 
     66 	uint8_t		sc_volume;
     67 	uint8_t		sc_bass;
     68 	uint8_t		sc_treble;
     69 	uint8_t		sc_mode;
     70 	uint8_t		sc_mute;
     71 	uint8_t		sc_ogain;
     72 	uint8_t		sc_dac_power;
     73 	uint8_t		sc_adc_power;
     74 	uint8_t		sc_inmix1;
     75 	uint8_t		sc_inmix2;
     76 	uint8_t		sc_micvol;
     77 	uint8_t		sc_inmode;
     78 	uint8_t		sc_agc;
     79 	uint8_t		sc_agc_lvl;
     80 	uint8_t		sc_ch2_gain;
     81 
     82 #define UDA1341_DEEMPHASIS_AUTO	4
     83 	uint8_t		sc_deemphasis;
     84 
     85 };
     86 
     87 int uda1341_attach(struct uda1341_softc *);
     88 int uda1341_query_encodings(void *, audio_encoding_t *);
     89 int uda1341_open(void *, int );
     90 void uda1341_close(void *);
     91 int uda1341_set_params(void *, int, int, audio_params_t*, audio_params_t*, stream_filter_list_t *, stream_filter_list_t*);
     92 int uda1341_query_devinfo(void *, mixer_devinfo_t *);
     93 int uda1341_get_port(void *, mixer_ctrl_t *);
     94 int uda1341_set_port(void *, mixer_ctrl_t *);
     95 #endif
     96