diff options
Diffstat (limited to 'sound/soc/codecs/tlv320aic326x_mini-dsp.h')
-rw-r--r-- | sound/soc/codecs/tlv320aic326x_mini-dsp.h | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/sound/soc/codecs/tlv320aic326x_mini-dsp.h b/sound/soc/codecs/tlv320aic326x_mini-dsp.h new file mode 100644 index 00000000000..bebb12fa680 --- /dev/null +++ b/sound/soc/codecs/tlv320aic326x_mini-dsp.h | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | * linux/sound/soc/codecs/tlv320aic3262_mini-dsp.h | ||
3 | * | ||
4 | * | ||
5 | * Copyright (C) 2011 Texas Instruments, Inc. | ||
6 | * | ||
7 | * | ||
8 | * This package is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | ||
13 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | ||
14 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
15 | * | ||
16 | * History: | ||
17 | * Rev 0.1 Added the multiconfig support 17-08-2011 | ||
18 | * | ||
19 | * Rev 0.2 Migrated for aic3262 nVidia | ||
20 | * 21-10-2011 | ||
21 | */ | ||
22 | |||
23 | #ifndef _TLV320AIC3262_MINI_DSP_H | ||
24 | #define _TLV320AIC3262_MINI_DSP_H | ||
25 | |||
26 | /* defines */ | ||
27 | |||
28 | #define MAXCONFIG 4 | ||
29 | |||
30 | //#define DEBUG_MINIDSP_LOADING | ||
31 | |||
32 | /* Select the functionalities to be used in mini dsp module */ | ||
33 | #define PROGRAM_MINI_DSP_first | ||
34 | //#define PROGRAM_MINI_DSP_second | ||
35 | #define PROGRAM_CODEC_REG_SECTIONS | ||
36 | #define ADD_MINI_DSP_CONTROLS | ||
37 | |||
38 | /* use the following macros to select between burst and byte mode of i2c | ||
39 | * Byte mode uses standard read & write as provides debugging information if enabled | ||
40 | * if enabled. | ||
41 | * Multibyte should be used for production codes where performance is priority | ||
42 | */ | ||
43 | //#define MULTIBYTE_I2C | ||
44 | #undef MULTIBYTE_I2C | ||
45 | |||
46 | typedef struct { | ||
47 | u8 reg_off; | ||
48 | u8 reg_val; | ||
49 | } reg_value; | ||
50 | |||
51 | /*CONTROL LOCATIONS*/ | ||
52 | typedef struct { | ||
53 | u8 control_book; /*coefficient book location*/ | ||
54 | u8 control_page; /*coefficient page location*/ | ||
55 | u8 control_base; /*coefficient base address within page*/ | ||
56 | u8 control_mute_flag; /*non-zero means muting required*/ | ||
57 | u8 control_string_index; /*string table index*/ | ||
58 | } control; | ||
59 | |||
60 | /* volume ranges from -110db to 6db | ||
61 | * amixer controls does not accept negative values | ||
62 | * Therefore we are normalizing values to start from value 0 | ||
63 | * value 0 corresponds to -110db and 116 to 6db | ||
64 | */ | ||
65 | #define MAX_VOLUME_CONTROLS 2 | ||
66 | #define MIN_VOLUME 0 | ||
67 | #define MAX_VOLUME 116 | ||
68 | #define VOLUME_REG_SIZE 3 /* 3 bytes */ | ||
69 | #define VOLUME_KCONTROL_NAME "(0=-110dB, 116=+6dB)" | ||
70 | |||
71 | #define FILT_CTL_NAME_ADC "ADC adaptive filter(0=Disable, 1=Enable)" | ||
72 | #define FILT_CTL_NAME_DAC "DAC adaptive filter(0=Disable, 1=Enable)" | ||
73 | #define COEFF_CTL_NAME_ADC "ADC coeff Buffer(0=Buffer A, 1=Buffer B)" | ||
74 | #define COEFF_CTL_NAME_DAC "DAC coeff Buffer(0=Buffer A, 1=Buffer B)" | ||
75 | |||
76 | #define BUFFER_PAGE_ADC 0x8 | ||
77 | #define BUFFER_PAGE_DAC 0x2c | ||
78 | |||
79 | #define ADAPTIVE_MAX_CONTROLS 4 | ||
80 | |||
81 | /* | ||
82 | * MUX controls, 3 bytes of control data. | ||
83 | */ | ||
84 | #define MAX_MUX_CONTROLS 2 | ||
85 | #define MIN_MUX_CTRL 0 | ||
86 | #define MAX_MUX_CTRL 2 | ||
87 | #define MUX_CTRL_REG_SIZE 3 /* 3 bytes */ | ||
88 | |||
89 | #define MINIDSP_PARSING_START 0 | ||
90 | #define MINIDSP_PARSING_END (-1) | ||
91 | |||
92 | #define CODEC_REG_DONT_IGNORE 0 | ||
93 | #define CODEC_REG_IGNORE 1 | ||
94 | |||
95 | #define CODEC_REG_PRE_INIT 0 | ||
96 | #define CODEC_REG_POST_INIT 1 | ||
97 | #define INIT_SEQ_DELIMITER 255 /* Delimiter register */ | ||
98 | #define DELIMITER_COUNT 2 /* 2 delimiter entries */ | ||
99 | |||
100 | /* Parser info structure */ | ||
101 | typedef struct { | ||
102 | char page_num; | ||
103 | char burst_array[129]; | ||
104 | int burst_size; | ||
105 | int current_loc; | ||
106 | int book_change;CONFIG_MINI_DSP | ||
107 | u8 book_no; | ||
108 | } minidsp_parser_data; | ||
109 | |||
110 | /* I2c Page Change Structure */ | ||
111 | typedef struct { | ||
112 | char burst_array[4]; | ||
113 | } minidsp_i2c_page; | ||
114 | |||
115 | /* This macro defines the total size of the miniDSP parser arrays | ||
116 | * that the driver will maintain as a data backup. | ||
117 | * The total memory requirement will be around | ||
118 | * sizeof(minidsp_parser_data) * 48 = 138 * 32 = 4416 bytes | ||
119 | */ | ||
120 | #define MINIDSP_PARSER_ARRAY_SIZE 200 | ||
121 | |||
122 | extern int | ||
123 | minidsp_i2c_multibyte_transfer(struct snd_soc_codec *, reg_value *, int); | ||
124 | extern int byte_i2c_array_transfer(struct snd_soc_codec *, reg_value *, int); | ||
125 | extern void minidsp_multiconfig(struct snd_soc_codec *,reg_value *, int ,reg_value *, int ); | ||
126 | extern int reg_def_conf(struct snd_soc_codec *); | ||
127 | |||
128 | #endif | ||