FS#8961 - Anti-Aliased Fonts.
[kugel-rb.git] / firmware / export / uda1380.h
blob6858f51e3cb8dabec40d238b21159d1b29b43cc0
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef _UDA1380_H
23 #define _UDA1380_H
25 /* volume/balance/treble/bass interdependency */
26 #define VOLUME_MIN -840
27 #define VOLUME_MAX 0
29 #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP)
31 extern int tenthdb2master(int db);
32 extern int tenthdb2mixer(int db);
34 extern void audiohw_set_master_vol(int vol_l, int vol_r);
35 extern void audiohw_set_mixer_vol(int channel1, int channel2);
37 #define UDA1380_ADDR 0x30
39 /* REG_0: Misc settings */
40 #define REG_0 0x00
41 #define EN_ADC (1 << 11) /* Enable ADC */
42 #define EN_DEC (1 << 10) /* Enable Decimator */
43 #define EN_DAC (1 << 9) /* Enable DAC */
44 #define EN_INT (1 << 8) /* Enable Interpolator */
45 #define ADC_CLK (1 << 5) /* ADC_CLK: WSPLL (1) SYSCLK (0) */
46 #define DAC_CLK (1 << 4) /* DAC_CLK: WSPLL (1) SYSCLK (0) */
48 /* SYSCLK freqency select */
49 #define SYSCLK_256FS (0 << 2)
50 #define SYSCLK_384FS (1 << 2)
51 #define SYSCLK_512FS (2 << 2)
52 #define SYSCLK_768FS (3 << 2)
54 /* WSPLL Input frequency range (kHz) */
55 #define WSPLL_625_125 (0 << 0) /* 6.25 - 12.5 */
56 #define WSPLL_125_25 (1 << 0) /* 12.5 - 25 */
57 #define WSPLL_25_50 (2 << 0) /* 25 - 50 */
58 #define WSPLL_50_100 (3 << 0) /* 50 - 100 */
61 /* REG_I2S: I2S settings */
62 #define REG_I2S 0x01
63 #define I2S_IFMT_IIS (0 << 8)
64 #define I2S_IFMT_LSB16 (1 << 8)
65 #define I2S_IFMT_LSB18 (2 << 8)
66 #define I2S_IFMT_LSB20 (3 << 8)
67 #define I2S_IFMT_MSB (5 << 8)
68 #define I2S_OFMT_IIS (0 << 0)
69 #define I2S_OFMT_LSB16 (1 << 0)
70 #define I2S_OFMT_LSB18 (2 << 0)
71 #define I2S_OFMT_LSB20 (3 << 0)
72 #define I2S_OFMT_LSB24 (4 << 0)
73 #define I2S_OFMT_MSB (5 << 0)
74 #define I2S_MODE_MASTER (1 << 4)
76 /* REG_PWR: Power control */
77 #define REG_PWR 0x02
78 #define PON_PLL (1 << 15) /* Power-on WSPLL */
79 #define PON_HP (1 << 13) /* Power-on Headphone driver */
80 #define PON_DAC (1 << 10) /* Power-on DAC */
81 #define PON_BIAS (1 << 8) /* Power-on BIAS for ADC, AVC, FSDAC */
82 #define EN_AVC (1 << 7) /* Enable analog mixer */
83 #define PON_AVC (1 << 6) /* Power-on analog mixer */
84 #define PON_LNA (1 << 4) /* Power-on LNA & SDC */
85 #define PON_PGAL (1 << 3) /* Power-on PGA left */
86 #define PON_ADCL (1 << 2) /* Power-on ADC left */
87 #define PON_PGAR (1 << 1) /* Power-on PGA right */
88 #define PON_ADCR (1 << 0) /* Power-on ADC right */
91 /* REG_AMIX: Analog mixer */
92 #define REG_AMIX 0x03
93 #define AMIX_LEFT(x) (((x) & 0x3f) << 8)
94 #define AMIX_RIGHT(x) (((x) & 0x3f) << 0)
96 /* REG_HP: Headphone amp */
97 #define REG_HP 0x04
99 /* REG_MV: Master Volume control */
100 #define REG_MASTER_VOL 0x10
102 #define MASTER_VOL_RIGHT(x) (((x) & 0xff) << 8)
103 #define MASTER_VOL_LEFT(x) (((x) & 0xff) << 0)
105 /* REG_MIX: Mixer volume control */
106 /* Channel 1 is from digital data from I2S */
107 /* Channel 2 is from decimation filter */
109 #define REG_MIX_VOL 0x11
110 #define MIX_VOL_CH_1(x) (((x) & 0xff) << 0)
111 #define MIX_VOL_CH_2(x) (((x) & 0xff) << 8)
113 /* REG_EQ: Bass boost and tremble */
114 #define REG_EQ 0x12
115 #define EQ_MODE_FLAT (0 << 14)
116 #define EQ_MODE_MIN (1 << 14)
117 #define EQ_MODE_MAX (3 << 14)
118 #define BASSL(x) (((x) & 0x1E) << 7)
119 #define BASSR(x) (((x) & 0x1E) >> 1)
120 #define TREBLEL(x) (((x) & 0x6) << 11)
121 #define TREBLER(x) (((x) & 0x6) << 3)
122 #define BASS_MASK 0x0F0F
123 #define TREBLE_MASK 0x3030
125 /* REG_MUTE: Master Mute, silence detector and oversampling */
126 #define REG_MUTE 0x13
127 #define MUTE_MASTER (1 << 14) /* Master Mute (soft) */
128 #define MUTE_CH2 (1 << 11) /* Channel 2 mute */
129 #define MUTE_CH1 (1 << 3) /* Channel 1 mute */
130 #define DE_EMPHASIS_NONE (0 << 8) /* no de-emphasis */
131 #define DE_EMPHASIS_32kHz (1 << 8) /* 32 kHz */
132 #define DE_EMPHASIS_44kHz (2 << 8) /* 44.1 kHz */
133 #define DE_EMPHASIS_48kHz (3 << 8) /* 48 kHz */
134 #define DE_EMPHASIS_96kHz (4 << 8) /* 96 kHz */
136 /* REG_MIX_CTL: Mixer, silence detector and oversampling settings */
137 #define REG_MIX_CTL 0x14
138 #define DAC_INVERT (1 << 15) /* invert DAC polarity */
139 #define MIX_CTL_SEL_NS (1 << 14) /* 0 = 3rd, 1 = 5th order */
140 #define MIX_CTL_MIX_POS (1 << 13) /* MIX MODE bit MIX POS */
141 #define MIX_CTL_MIX (1 << 12) /* MIX MODE bit MIX */
142 #define MIX_MODE(x) (((x) & 0x3) << 12) /* Mixer mode: See table 48 */
143 #define SILENCE_MODE (1 << 7) /* force silence output */
144 #define SILENCE_DET_ON (1 << 6) /* enable silence detection */
145 #define SILENCE_DET(x) (((x) & 0x3) << 4) /* silence detection value */
146 #define SILENCE_DET_3200 (0 << 4) /* 3200 samples */
147 #define SILENCE_DET_4800 (1 << 4) /* 4800 samples */
148 #define SILENCE_DET_9600 (2 << 4) /* 9600 samples */
149 #define SILENCE_DET_19200 (3 << 4) /* 19200 samples */
150 #define OVERSAMPLE_MODE(x) (((x) & 0x3) << 0) /* oversampling mode */
152 /* REG_DEC_VOL: Decimator (ADC) volume control */
153 #define REG_DEC_VOL 0x20
154 #define DEC_VOLL(x) (((x) & 0xff) << 8)
155 #define DEC_VOLR(x) (((x) & 0xff) << 0)
157 /* REG_PGA: PGA settings and mute */
158 #define REG_PGA 0x21
159 #define MUTE_ADC (1 << 15) /* Mute ADC */
160 #define PGA_GAINR(x) (((x) & 0xF) << 8)
161 #define PGA_GAINL(x) (((x) & 0xF) << 0)
162 #define PGA_GAIN_MASK 0x0F0F
164 /* REG_ADC: */
165 #define REG_ADC 0x22
166 #define ADC_INVERT (1 << 12) /* invert ADC polarity */
167 #define VGA_GAIN(x) (((x) & 0xF) << 8)
168 #define VGA_GAIN_MASK 0x0F00
169 #define SEL_LNA (1 << 3)
170 #define SEL_MIC (1 << 2)
171 #define SKIP_DCFIL (1 << 1)
172 #define EN_DCFIL (1 << 0)
174 /* REG_AGC: Attack / Gain */
175 #define REG_AGC 0x23
177 #endif /* _UDA_1380_H */