modules: correct dependencies / version declarations
[dragonfly.git] / sys / dev / sound / pci / spicds.h
blob208c60d9106db71272739bc8e659caf2c07709b1
1 /*
2 * Copyright (c) 2006 Konstantin Dimitrov <kosio.dimitrov@gmail.com>
3 * Copyright (c) 2001 Katsurajima Naoto <raven@katsurajima.seya.yokohama.jp>
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
25 * SUCH DAMAGE.
27 * $FreeBSD: src/sys/dev/sound/pci/spicds.h,v 1.3.2.2 2007/06/11 19:33:28 ariff Exp $
28 * $DragonFly: src/sys/dev/sound/pci/spicds.h,v 1.1 2007/06/16 19:48:05 hasso Exp $
31 /* supported CODECs */
32 #define SPICDS_TYPE_AK4524 0
33 #define SPICDS_TYPE_AK4528 1
34 #define SPICDS_TYPE_WM8770 2
35 #define SPICDS_TYPE_AK4358 3
36 #define SPICDS_TYPE_AK4381 4
37 #define SPICDS_TYPE_AK4396 5
39 /* AK4524/AK4528 control registers */
40 #define AK4524_POWER 0x00
41 #define AK4528_POWER 0x00
42 #define AK452X_POWER_PWDA 0x01
43 #define AK452X_POWER_PWAD 0x02
44 #define AK452X_POWER_PWVR 0x04
45 #define AK4524_RESET 0x01
46 #define AK4528_RESET 0x01
47 #define AK452X_RESET_RSDA 0x01
48 #define AK452X_RESET_RSAD 0x02
49 #define AK4524_FORMAT 0x02
50 #define AK4528_FORMAT 0x02
51 #define AK452X_FORMAT_1X 0x00
52 #define AK452X_FORMAT_2X 0x01
53 #define AK452X_FORMAT_4X1 0x02
54 #define AK452X_FORMAT_4X2 0x03
55 #define AK452X_FORMAT_256FSN 0x00
56 #define AK452X_FORMAT_512FSN 0x04
57 #define AK452X_FORMAT_1024FSN 0x08
58 #define AK452X_FORMAT_384FSN 0x10
59 #define AK452X_FORMAT_768FSN 0x14
60 #define AK452X_FORMAT_OM24IL16 0x00
61 #define AK452X_FORMAT_OM24IL20 0x20
62 #define AK452X_FORMAT_OM24IM24 0x40
63 #define AK452X_FORMAT_I2S 0x60
64 #define AK452X_FORMAT_OM24IL24 0x80
65 #define AK4524_DVC 0x03
66 #define AK452X_DVC_DEM441 0x00
67 #define AK452X_DVC_DEMOFF 0x01
68 #define AK452X_DVC_DEM48 0x02
69 #define AK452X_DVC_DEM32 0x03
70 #define AK452X_DVC_ZTM256 0x00
71 #define AK452X_DVC_ZTM512 0x04
72 #define AK452X_DVC_ZTM1024 0x08
73 #define AK452X_DVC_ZTM2048 0x0c
74 #define AK452X_DVC_ZCE 0x10
75 #define AK452X_DVC_HPFL 0x04
76 #define AK452X_DVC_HPFR 0x08
77 #define AK452X_DVC_SMUTE 0x80
78 #define AK4524_LIPGA 0x04
79 #define AK4524_RIPGA 0x05
80 #define AK4524_LOATT 0x06
81 #define AK4524_ROATT 0x07
82 #define AK4528_LOATT 0x04
83 #define AK4528_ROATT 0x05
85 /* WM8770 control registers */
86 #define WM8770_AOATT_L1 0x00
87 #define WM8770_AOATT_R1 0x01
88 #define WM8770_AOATT_L2 0x02
89 #define WM8770_AOATT_R2 0x03
90 #define WM8770_AOATT_L3 0x04
91 #define WM8770_AOATT_R3 0x05
92 #define WM8770_AOATT_L4 0x06
93 #define WM8770_AOATT_R4 0x07
94 #define WM8770_AOATT_MAST 0x08
95 #define WM8770_AOATT_UPDATE 0x100
97 /* AK4358 control registers */
98 #define AK4358_LO1ATT 0x04
99 #define AK4358_RO1ATT 0x05
100 #define AK4358_OATT_ENABLE 0x80
102 /* AK4381 control registers */
103 #define AK4381_LOATT 0x03
104 #define AK4381_ROATT 0x04
106 /* AK4396 control registers */
107 #define AK4396_LOATT 0x03
108 #define AK4396_ROATT 0x04
110 struct spicds_info;
112 typedef void (*spicds_ctrl)(void *, unsigned int, unsigned int, unsigned int);
114 struct spicds_info *spicds_create(device_t dev, void *devinfo, int num, spicds_ctrl);
115 void spicds_destroy(struct spicds_info *codec);
116 void spicds_settype(struct spicds_info *codec, unsigned int type);
117 void spicds_setcif(struct spicds_info *codec, unsigned int cif);
118 void spicds_setformat(struct spicds_info *codec, unsigned int format);
119 void spicds_setdvc(struct spicds_info *codec, unsigned int dvc);
120 void spicds_init(struct spicds_info *codec);
121 void spicds_reinit(struct spicds_info *codec);
122 void spicds_set(struct spicds_info *codec, int dir, unsigned int left, unsigned int right);