xref: /netbsd-src/sys/dev/ic/am7930var.h (revision 8b0f9554ff8762542c4defc4f70e1eb76fb508fa)
1 /*	$NetBSD: am7930var.h,v 1.11 2005/12/11 12:21:25 christos Exp $	*/
2 
3 struct am7930_softc;
4 
5 struct am7930_glue {
6 	uint8_t	(*codec_iread)(struct am7930_softc *sc, int);
7 	void	(*codec_iwrite)(struct am7930_softc *sc, int, uint8_t);
8 	uint16_t	(*codec_iread16)(struct am7930_softc *sc, int);
9 	void	(*codec_iwrite16)(struct am7930_softc *sc, int, uint16_t);
10 	void	(*onopen)(struct am7930_softc *sc);
11 	void	(*onclose)(struct am7930_softc *sc);
12 	int	factor;
13 	stream_filter_factory_t *input_conv;
14 	stream_filter_factory_t *output_conv;
15 };
16 
17 struct am7930_softc {
18 	struct	device sc_dev;		/* base device */
19 
20 	uint8_t	sc_rlevel;	/* record level */
21 	uint8_t	sc_plevel;	/* play level */
22 	uint8_t	sc_mlevel;	/* monitor level */
23 	uint8_t	sc_out_port;	/* output port */
24 	uint8_t	sc_mic_mute;
25 
26 	struct am7930_glue *sc_glue;
27 };
28 
29 extern int     am7930debug;
30 
31 void	am7930_init(struct am7930_softc *, int);
32 
33 #define AM7930_IWRITE(x,y,z)	(*(x)->sc_glue->codec_iwrite)((x),(y),(z))
34 #define AM7930_IREAD(x,y)	(*(x)->sc_glue->codec_iread)((x),(y))
35 #define AM7930_IWRITE16(x,y,z)	(*(x)->sc_glue->codec_iwrite16)((x),(y),(z))
36 #define AM7930_IREAD16(x,y)	(*(x)->sc_glue->codec_iread16)((x),(y))
37 
38 #define AUDIOAMD_POLL_MODE	0
39 #define AUDIOAMD_DMA_MODE	1
40 
41 /*
42  * audio channel definitions.
43  */
44 
45 #define AUDIOAMD_SPEAKER_VOL	0	/* speaker volume */
46 #define AUDIOAMD_HEADPHONES_VOL	1	/* headphones volume */
47 #define AUDIOAMD_OUTPUT_CLASS	2
48 
49 #define AUDIOAMD_MONITOR_VOL	3	/* monitor input volume */
50 #define AUDIOAMD_MONITOR_OUTPUT	4	/* output selector */
51 #define AUDIOAMD_MONITOR_CLASS	5
52 
53 #define AUDIOAMD_MIC_VOL	6	/* microphone volume */
54 #define AUDIOAMD_MIC_MUTE	7
55 #define AUDIOAMD_INPUT_CLASS	8
56 
57 #define AUDIOAMD_RECORD_SOURCE	9	/* source selector */
58 #define AUDIOAMD_RECORD_CLASS	10
59 
60 /*
61  * audio(9) MI callbacks from upper-level audio layer.
62  */
63 
64 struct audio_device;
65 struct audio_encoding;
66 struct audio_params;
67 
68 int	am7930_open(void *, int);
69 void	am7930_close(void *);
70 int	am7930_query_encoding(void *, struct audio_encoding *);
71 int	am7930_set_params(void *, int, int, audio_params_t *,
72 	    audio_params_t *, stream_filter_list_t *, stream_filter_list_t *);
73 int	am7930_commit_settings(void *);
74 int	am7930_round_blocksize(void *, int, int, const audio_params_t *);
75 int	am7930_halt_output(void *);
76 int	am7930_halt_input(void *);
77 int	am7930_getdev(void *, struct audio_device *);
78 int	am7930_get_props(void *);
79 int	am7930_set_port(void *, mixer_ctrl_t *);
80 int	am7930_get_port(void *, mixer_ctrl_t *);
81 int	am7930_query_devinfo(void *, mixer_devinfo_t *);
82