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