2 * Copyright (c) 2001 Katsurajima Naoto <raven@katsurajima.seya.yokohama.jp>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
29 /* supported CODECs */
30 #define AK452X_TYPE_4524 0
31 #define AK452X_TYPE_4528 1
33 /* AK4524/AK4528 control registers */
34 #define AK4524_POWER 0x00
35 #define AK4528_POWER 0x00
36 #define AK452X_POWER_PWDA 0x01
37 #define AK452X_POWER_PWAD 0x02
38 #define AK452X_POWER_PWVR 0x04
39 #define AK4524_RESET 0x01
40 #define AK4528_RESET 0x01
41 #define AK452X_RESET_RSDA 0x01
42 #define AK452X_RESET_RSAD 0x02
43 #define AK4524_FORMAT 0x02
44 #define AK4528_FORMAT 0x02
45 #define AK452X_FORMAT_1X 0x00
46 #define AK452X_FORMAT_2X 0x01
47 #define AK452X_FORMAT_4X1 0x02
48 #define AK452X_FORMAT_4X2 0x03
49 #define AK452X_FORMAT_256FSN 0x00
50 #define AK452X_FORMAT_512FSN 0x04
51 #define AK452X_FORMAT_1024FSN 0x08
52 #define AK452X_FORMAT_384FSN 0x10
53 #define AK452X_FORMAT_768FSN 0x14
54 #define AK452X_FORMAT_OM24IL16 0x00
55 #define AK452X_FORMAT_OM24IL20 0x20
56 #define AK452X_FORMAT_OM24IM24 0x40
57 #define AK452X_FORMAT_I2S 0x60
58 #define AK452X_FORMAT_OM24IL24 0x80
59 #define AK4524_DVC 0x03
60 #define AK452X_DVC_DEM441 0x00
61 #define AK452X_DVC_DEMOFF 0x01
62 #define AK452X_DVC_DEM48 0x02
63 #define AK452X_DVC_DEM32 0x03
64 #define AK452X_DVC_ZTM256 0x00
65 #define AK452X_DVC_ZTM512 0x04
66 #define AK452X_DVC_ZTM1024 0x08
67 #define AK452X_DVC_ZTM2048 0x0c
68 #define AK452X_DVC_ZCE 0x10
69 #define AK452X_DVC_HPFL 0x04
70 #define AK452X_DVC_HPFR 0x08
71 #define AK452X_DVC_SMUTE 0x80
72 #define AK4524_LIPGA 0x04
73 #define AK4524_RIPGA 0x05
74 #define AK4524_LOATT 0x06
75 #define AK4524_ROATT 0x07
76 #define AK4528_LOATT 0x04
77 #define AK4528_ROATT 0x05
81 typedef void (*ak452x_ctrl)(void *, unsigned int, unsigned int, unsigned int);
83 struct ak452x_info *ak452x_create(device_t dev, void *devinfo, int num, ak452x_ctrl);
84 void ak452x_destroy(struct ak452x_info *codec);
85 void ak452x_settype(struct ak452x_info *codec, unsigned int type);
86 void ak452x_setcif(struct ak452x_info *codec, unsigned int cif);
87 void ak452x_setformat(struct ak452x_info *codec, unsigned int format);
88 void ak452x_setdvc(struct ak452x_info *codec, unsigned int dvc);
89 void ak452x_init(struct ak452x_info *codec);
90 void ak452x_reinit(struct ak452x_info *codec);
91 void ak452x_set(struct ak452x_info *codec, int dir, unsigned int left, unsigned int right);