Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | ********************************************************************** |
| 3 | * ecard.h |
| 4 | * Copyright 1999, 2000 Creative Labs, Inc. |
| 5 | * |
| 6 | ********************************************************************** |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public |
| 19 | * License along with this program; if not, write to the Free |
| 20 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, |
| 21 | * USA. |
| 22 | * |
| 23 | ********************************************************************** |
| 24 | */ |
| 25 | |
| 26 | #ifndef _ECARD_H |
| 27 | #define _ECARD_H |
| 28 | |
| 29 | #include "8010.h" |
| 30 | #include "hwaccess.h" |
| 31 | #include <linux/init.h> |
| 32 | |
| 33 | /* In A1 Silicon, these bits are in the HC register */ |
| 34 | #define HOOKN_BIT (1L << 12) |
| 35 | #define HANDN_BIT (1L << 11) |
| 36 | #define PULSEN_BIT (1L << 10) |
| 37 | |
| 38 | #define EC_GDI1 (1 << 13) |
| 39 | #define EC_GDI0 (1 << 14) |
| 40 | |
| 41 | #define EC_NUM_CONTROL_BITS 20 |
| 42 | |
| 43 | #define EC_AC3_DATA_SELN 0x0001L |
| 44 | #define EC_EE_DATA_SEL 0x0002L |
| 45 | #define EC_EE_CNTRL_SELN 0x0004L |
| 46 | #define EC_EECLK 0x0008L |
| 47 | #define EC_EECS 0x0010L |
| 48 | #define EC_EESDO 0x0020L |
| 49 | #define EC_TRIM_CSN 0x0040L |
| 50 | #define EC_TRIM_SCLK 0x0080L |
| 51 | #define EC_TRIM_SDATA 0x0100L |
| 52 | #define EC_TRIM_MUTEN 0x0200L |
| 53 | #define EC_ADCCAL 0x0400L |
| 54 | #define EC_ADCRSTN 0x0800L |
| 55 | #define EC_DACCAL 0x1000L |
| 56 | #define EC_DACMUTEN 0x2000L |
| 57 | #define EC_LEDN 0x4000L |
| 58 | |
| 59 | #define EC_SPDIF0_SEL_SHIFT 15 |
| 60 | #define EC_SPDIF1_SEL_SHIFT 17 |
| 61 | #define EC_SPDIF0_SEL_MASK (0x3L << EC_SPDIF0_SEL_SHIFT) |
| 62 | #define EC_SPDIF1_SEL_MASK (0x7L << EC_SPDIF1_SEL_SHIFT) |
| 63 | #define EC_SPDIF0_SELECT(_x) (((_x) << EC_SPDIF0_SEL_SHIFT) & EC_SPDIF0_SEL_MASK) |
| 64 | #define EC_SPDIF1_SELECT(_x) (((_x) << EC_SPDIF1_SEL_SHIFT) & EC_SPDIF1_SEL_MASK) |
| 65 | #define EC_CURRENT_PROM_VERSION 0x01 /* Self-explanatory. This should |
| 66 | * be incremented any time the EEPROM's |
| 67 | * format is changed. */ |
| 68 | |
| 69 | #define EC_EEPROM_SIZE 0x40 /* ECARD EEPROM has 64 16-bit words */ |
| 70 | |
| 71 | /* Addresses for special values stored in to EEPROM */ |
| 72 | #define EC_PROM_VERSION_ADDR 0x20 /* Address of the current prom version */ |
| 73 | #define EC_BOARDREV0_ADDR 0x21 /* LSW of board rev */ |
| 74 | #define EC_BOARDREV1_ADDR 0x22 /* MSW of board rev */ |
| 75 | |
| 76 | #define EC_LAST_PROMFILE_ADDR 0x2f |
| 77 | |
| 78 | #define EC_SERIALNUM_ADD 0x30 /* First word of serial number. The number |
| 79 | * can be up to 30 characters in length |
| 80 | * and is stored as a NULL-terminated |
| 81 | * ASCII string. Any unused bytes must be |
| 82 | * filled with zeros */ |
| 83 | #define EC_CHECKSUM_ADDR 0x3f /* Location at which checksum is stored */ |
| 84 | |
| 85 | |
| 86 | |
| 87 | /* Most of this stuff is pretty self-evident. According to the hardware |
| 88 | * dudes, we need to leave the ADCCAL bit low in order to avoid a DC |
| 89 | * offset problem. Weird. |
| 90 | */ |
| 91 | #define EC_RAW_RUN_MODE (EC_DACMUTEN | EC_ADCRSTN | EC_TRIM_MUTEN | EC_TRIM_CSN) |
| 92 | |
| 93 | |
| 94 | #define EC_DEFAULT_ADC_GAIN 0xC4C4 |
| 95 | #define EC_DEFAULT_SPDIF0_SEL 0x0 |
| 96 | #define EC_DEFAULT_SPDIF1_SEL 0x4 |
| 97 | |
| 98 | #define HC_EA 0x01L |
| 99 | |
| 100 | /* ECARD state structure. This structure maintains the state |
| 101 | * for various portions of the ECARD's onboard hardware. |
| 102 | */ |
| 103 | struct ecard_state { |
| 104 | u32 control_bits; |
| 105 | u16 adc_gain; |
| 106 | u16 mux0_setting; |
| 107 | u16 mux1_setting; |
| 108 | u16 mux2_setting; |
| 109 | }; |
| 110 | |
| 111 | void emu10k1_ecard_init(struct emu10k1_card *) __devinit; |
| 112 | |
| 113 | #endif /* _ECARD_H */ |