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. 5 * 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. 14 * 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. 26 * 27 * $FreeBSD$ 28 */ 29 30 /* supported CODECs */ 31 #define SPICDS_TYPE_AK4524 0 32 #define SPICDS_TYPE_AK4528 1 33 #define SPICDS_TYPE_WM8770 2 34 #define SPICDS_TYPE_AK4358 3 35 #define SPICDS_TYPE_AK4381 4 36 #define SPICDS_TYPE_AK4396 5 37 38 /* AK4524/AK4528 control registers */ 39 #define AK4524_POWER 0x00 40 #define AK4528_POWER 0x00 41 #define AK452X_POWER_PWDA 0x01 42 #define AK452X_POWER_PWAD 0x02 43 #define AK452X_POWER_PWVR 0x04 44 #define AK4524_RESET 0x01 45 #define AK4528_RESET 0x01 46 #define AK452X_RESET_RSDA 0x01 47 #define AK452X_RESET_RSAD 0x02 48 #define AK4524_FORMAT 0x02 49 #define AK4528_FORMAT 0x02 50 #define AK452X_FORMAT_1X 0x00 51 #define AK452X_FORMAT_2X 0x01 52 #define AK452X_FORMAT_4X1 0x02 53 #define AK452X_FORMAT_4X2 0x03 54 #define AK452X_FORMAT_256FSN 0x00 55 #define AK452X_FORMAT_512FSN 0x04 56 #define AK452X_FORMAT_1024FSN 0x08 57 #define AK452X_FORMAT_384FSN 0x10 58 #define AK452X_FORMAT_768FSN 0x14 59 #define AK452X_FORMAT_OM24IL16 0x00 60 #define AK452X_FORMAT_OM24IL20 0x20 61 #define AK452X_FORMAT_OM24IM24 0x40 62 #define AK452X_FORMAT_I2S 0x60 63 #define AK452X_FORMAT_OM24IL24 0x80 64 #define AK4524_DVC 0x03 65 #define AK452X_DVC_DEM441 0x00 66 #define AK452X_DVC_DEMOFF 0x01 67 #define AK452X_DVC_DEM48 0x02 68 #define AK452X_DVC_DEM32 0x03 69 #define AK452X_DVC_ZTM256 0x00 70 #define AK452X_DVC_ZTM512 0x04 71 #define AK452X_DVC_ZTM1024 0x08 72 #define AK452X_DVC_ZTM2048 0x0c 73 #define AK452X_DVC_ZCE 0x10 74 #define AK452X_DVC_HPFL 0x04 75 #define AK452X_DVC_HPFR 0x08 76 #define AK452X_DVC_SMUTE 0x80 77 #define AK4524_LIPGA 0x04 78 #define AK4524_RIPGA 0x05 79 #define AK4524_LOATT 0x06 80 #define AK4524_ROATT 0x07 81 #define AK4528_LOATT 0x04 82 #define AK4528_ROATT 0x05 83 84 /* WM8770 control registers */ 85 #define WM8770_AOATT_L1 0x00 86 #define WM8770_AOATT_R1 0x01 87 #define WM8770_AOATT_L2 0x02 88 #define WM8770_AOATT_R2 0x03 89 #define WM8770_AOATT_L3 0x04 90 #define WM8770_AOATT_R3 0x05 91 #define WM8770_AOATT_L4 0x06 92 #define WM8770_AOATT_R4 0x07 93 #define WM8770_AOATT_MAST 0x08 94 #define WM8770_AOATT_UPDATE 0x100 95 96 /* AK4358 control registers */ 97 #define AK4358_LO1ATT 0x04 98 #define AK4358_RO1ATT 0x05 99 #define AK4358_OATT_ENABLE 0x80 100 101 /* AK4381 control registers */ 102 #define AK4381_LOATT 0x03 103 #define AK4381_ROATT 0x04 104 105 /* AK4396 control registers */ 106 #define AK4396_LOATT 0x03 107 #define AK4396_ROATT 0x04 108 109 struct spicds_info; 110 111 typedef void (*spicds_ctrl)(void *, unsigned int, unsigned int, unsigned int); 112 113 struct spicds_info *spicds_create(device_t dev, void *devinfo, int num, spicds_ctrl); 114 void spicds_destroy(struct spicds_info *codec); 115 void spicds_settype(struct spicds_info *codec, unsigned int type); 116 void spicds_setcif(struct spicds_info *codec, unsigned int cif); 117 void spicds_setformat(struct spicds_info *codec, unsigned int format); 118 void spicds_setdvc(struct spicds_info *codec, unsigned int dvc); 119 void spicds_init(struct spicds_info *codec); 120 void spicds_reinit(struct spicds_info *codec); 121 void spicds_set(struct spicds_info *codec, int dir, unsigned int left, unsigned int right); 122