1*ce099b40Smartin /* $NetBSD: uda1341.h,v 1.3 2008/04/28 20:23:21 martin Exp $ */ 2cf1c37c9Sichiro 3cf1c37c9Sichiro /*- 4cf1c37c9Sichiro * Copyright (c) 2001 The NetBSD Foundation, Inc. All rights reserved. 5cf1c37c9Sichiro * 6cf1c37c9Sichiro * This code is derived from software contributed to The NetBSD Foundation 7cf1c37c9Sichiro * by Ichiro FUKUHARA (ichiro@ichiro.org). 8cf1c37c9Sichiro * 9cf1c37c9Sichiro * Redistribution and use in source and binary forms, with or without 10cf1c37c9Sichiro * modification, are permitted provided that the following conditions 11cf1c37c9Sichiro * are met: 12cf1c37c9Sichiro * 1. Redistributions of source code must retain the above copyright 13cf1c37c9Sichiro * notice, this list of conditions and the following disclaimer. 14cf1c37c9Sichiro * 2. Redistributions in binary form must reproduce the above copyright 15cf1c37c9Sichiro * notice, this list of conditions and the following disclaimer in the 16cf1c37c9Sichiro * documentation and/or other materials provided with the distribution. 17cf1c37c9Sichiro * 18cf1c37c9Sichiro * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19cf1c37c9Sichiro * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20cf1c37c9Sichiro * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21cf1c37c9Sichiro * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22cf1c37c9Sichiro * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23cf1c37c9Sichiro * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24cf1c37c9Sichiro * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25cf1c37c9Sichiro * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26cf1c37c9Sichiro * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27cf1c37c9Sichiro * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28cf1c37c9Sichiro * POSSIBILITY OF SUCH DAMAGE. 29cf1c37c9Sichiro */ 30cf1c37c9Sichiro 31cf1c37c9Sichiro /* 32cf1c37c9Sichiro * Philips UDA1341 L3 type 33cf1c37c9Sichiro */ 34cf1c37c9Sichiro 35cf1c37c9Sichiro /* 36cf1c37c9Sichiro * Microcontroller L3-interface timing (MIN) 37cf1c37c9Sichiro * expressed in micro-second 38cf1c37c9Sichiro */ 39cf1c37c9Sichiro #define L3_DATA_SETUP 1 /* 190 nsec */ 40cf1c37c9Sichiro #define L3_DATA_HOLD 1 /* 30 nsec */ 41cf1c37c9Sichiro #define L3_MODE_SETUP 1 /* 190 nsec */ 42cf1c37c9Sichiro #define L3_MODE_HOLD 1 /* 190 nsec */ 43cf1c37c9Sichiro #define L3_CLK_HIGH 1 /* 250 nsec */ 44cf1c37c9Sichiro #define L3_CLK_LOW 1 /* 250 nsec */ 45cf1c37c9Sichiro #define L3_HALT 1 /* 190 nsec */ 46cf1c37c9Sichiro 47cf1c37c9Sichiro /* 48cf1c37c9Sichiro * Philips UDA1341 L3 address and command types 49cf1c37c9Sichiro */ 50cf1c37c9Sichiro #define L3_ADDRESS_COM 5 51cf1c37c9Sichiro #define L3_ADDRESS_DATA0 0 52cf1c37c9Sichiro #define L3_ADDRESS_DATA1 1 53cf1c37c9Sichiro #define L3_ADDRESS_STATUS 2 54cf1c37c9Sichiro 55cf1c37c9Sichiro /* 56cf1c37c9Sichiro * Philips UDA1341 Status control 57cf1c37c9Sichiro */ 58cf1c37c9Sichiro #define STATUS0_RST (1<<0) /* UDA1341 Reset */ 59cf1c37c9Sichiro #define STATUS0_SC_512 (0<<4) /* System clock freq. 60cf1c37c9Sichiro 512fs */ 61cf1c37c9Sichiro #define STATUS0_SC_384 (1<<4) /* 384fs */ 62cf1c37c9Sichiro #define STATUS0_SC_256 (2<<4) /* 256fs */ 63cf1c37c9Sichiro #define STATUS0_IF_I2S (0<<1) /* Data Input format 64cf1c37c9Sichiro I2C */ 65cf1c37c9Sichiro #define STATUS0_IF_LSB16 (1<<1) /* LSB 16 bits */ 66cf1c37c9Sichiro #define STATUS0_IF_LSB18 (2<<1) /* LSB 18 bits */ 67cf1c37c9Sichiro #define STATUS0_IF_LSB20 (3<<1) /* LSB 20 bits */ 68cf1c37c9Sichiro #define STATUS0_IF_MSB (4<<1) /* MSB */ 69cf1c37c9Sichiro #define STATUS0_IF_MSB16 (5<<1) /* LSB 16 bits and MSB-output */ 70cf1c37c9Sichiro #define STATUS0_IF_MSB18 (6<<1) /* LSB 18 bits and MSB-output */ 71cf1c37c9Sichiro #define STATUS0_IF_MSB20 (7<<1) /* LSB 20 bits and MSB-output */ 72cf1c37c9Sichiro #define STATUS0_DC (1<<0) /* UDA1341 DC-filter ON */ 73cf1c37c9Sichiro 74cf1c37c9Sichiro #define STATUS1_OGS (1<<6) /* UDA1341 DAC Gain switch */ 75cf1c37c9Sichiro #define STATUS1_IGS (1<<5) /* UDA1341 ADC Gain switch */ 76cf1c37c9Sichiro #define STATUS1_PAD (1<<4) /* Polarity of ADC is inverting */ 77cf1c37c9Sichiro #define STATUS1_PDA (1<<3) /* Polarity of DAC is inverting */ 78cf1c37c9Sichiro #define STATUS1_DS (1<<2) /* double speed playback */ 79cf1c37c9Sichiro #define STATUS1_PC_OFF (0<<0) /* ADC:off DAC:off */ 80cf1c37c9Sichiro #define STATUS1_PC_DAC (1<<0) /* ADC:off DAC:on */ 81cf1c37c9Sichiro #define STATUS1_PC_ADC (2<<0) /* ADC:on DAC:off */ 82cf1c37c9Sichiro #define STATUS1_PC_ON (3<<0) /* ADC:on DAC:on */ 83cf1c37c9Sichiro 84cf1c37c9Sichiro /* 85cf1c37c9Sichiro * Philips UDA1341 DATA0 control 86cf1c37c9Sichiro */ 87cf1c37c9Sichiro /* Data0 direct programming registers (8 bits) */ 88cf1c37c9Sichiro #define DATA0_VC(val) (63 - (((val)+1) * 63) / 100) 89cf1c37c9Sichiro /* Volume control val=(0<->100) */ 90cf1c37c9Sichiro #define DATA0_COMMON (0<<6) /* DATA0_0 common bits(6-7) */ 91cf1c37c9Sichiro 92cf1c37c9Sichiro #define DATA1_BB(val) (((((val)+1) * 15) / 100) << 3) 93cf1c37c9Sichiro /* Bass Boost control val=(0<->100) */ 94cf1c37c9Sichiro #define DATA1_TR(val) ((((val)+1) * 3) / 100) 95cf1c37c9Sichiro /* Treble control val=(0<->100) */ 96cf1c37c9Sichiro #define DATA1_COMMON (1<<6) /* DATA0_1 common bits(6-7) */ 97cf1c37c9Sichiro 98cf1c37c9Sichiro #define DATA2_MODE_FLAT (0<<0) /* Mode filter is flat */ 99cf1c37c9Sichiro #define DATA2_MODE_MIN (2<<0) /* Mode filter is minimum */ 100cf1c37c9Sichiro #define DATA2_MODE_MAX (3<<0) /* Mode filter is maximum */ 101cf1c37c9Sichiro #define DATA2_MUTE (1<<2) /* Mute on */ 1025cbb157eSichiro #define DATA2_PP (1<<5) /* Peak Detection */ 103cf1c37c9Sichiro #define DATA2_COMMON (2<<6) /* DATA0_2 common bits(6-7) */ 104cf1c37c9Sichiro 105cf1c37c9Sichiro /* Data0 extended programming registers (16 bits) */ 1065cbb157eSichiro #define EXT_ADDR_COMMON (3<<6) /* Extended Address Common bits */ 1075cbb157eSichiro # define EXT_ADDR_E0 0 /* Extended Address of E0 */ 1085cbb157eSichiro # define EXT_ADDR_E1 1 /* Extended Address of E1 */ 1095cbb157eSichiro # define EXT_ADDR_E2 2 /* Extended Address of E2 */ 1105cbb157eSichiro # define EXT_ADDR_E3 4 /* Extended Address of E3 */ 1115cbb157eSichiro # define EXT_ADDR_E4 5 /* Extended Address of E4 */ 1125cbb157eSichiro # define EXT_ADDR_E5 6 /* Extended Address of E5 */ 113cf1c37c9Sichiro 1145cbb157eSichiro #define EXT_DATA_COMMN (7<<5) /* Extended Data Common bits */ 115cf1c37c9Sichiro #define DATA_E0_MA(val) ((((val) + 1) * 31) / 100) 116cf1c37c9Sichiro /* mixer gain control val=(0<->100) */ 117cf1c37c9Sichiro #define DATA_E1_MB(val) ((((val) + 1) * 31) / 100) 118cf1c37c9Sichiro /* mixer gain control val=(0<->100) */ 119cf1c37c9Sichiro #define DATA_E2_MS(val) (((((val) + 1) * 6) / 100) << 3) 120cf1c37c9Sichiro /* MIC sensitivity control val=(0<->100) */ 121cf1c37c9Sichiro #define DATA_E2_MM0 0 /* Double differential mode */ 122cf1c37c9Sichiro #define DATA_E2_MM1 1 /* input channel 1 select */ 123cf1c37c9Sichiro #define DATA_E2_MM2 2 /* input channel 2 select */ 124cf1c37c9Sichiro #define DATA_E2_MM3 3 /* digital mixer mode */ 125cf1c37c9Sichiro 126cf1c37c9Sichiro #define DATA_E3_AG (1<<4) /* AGC control ON */ 127cf1c37c9Sichiro #define DATA_E3_IG_L(val) (((val * 127) / 100) & 3) 128cf1c37c9Sichiro /* Input AMP-Gain control (low 2 bits) */ 129cf1c37c9Sichiro #define DATA_E4_IG_H(val) (((val * 127) / 100) >> 2) 130cf1c37c9Sichiro /* Input AMP-Gain control (high 5 bits) */ 131cf1c37c9Sichiro #define DATA_E5_AL(val) (((val + 1) * 3) / 100) 132cf1c37c9Sichiro /* AGC output level val=(0<->100) */ 133cf1c37c9Sichiro /* end of uda1341.h */ 134