diff options
Diffstat (limited to 'firmware/drivers/tlv320.c')
-rw-r--r-- | firmware/drivers/tlv320.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/firmware/drivers/tlv320.c b/firmware/drivers/tlv320.c index 7c4bbbd1ee..c9ab094ef3 100644 --- a/firmware/drivers/tlv320.c +++ b/firmware/drivers/tlv320.c | |||
@@ -67,7 +67,7 @@ void tlv320_write_reg(unsigned reg, unsigned value) | |||
67 | /** | 67 | /** |
68 | * Init our tlv with default values | 68 | * Init our tlv with default values |
69 | */ | 69 | */ |
70 | void tlv320_init(void) | 70 | void audiohw_init(void) |
71 | { | 71 | { |
72 | memset(tlv320_regs, 0, sizeof(tlv320_regs)); | 72 | memset(tlv320_regs, 0, sizeof(tlv320_regs)); |
73 | 73 | ||
@@ -75,14 +75,14 @@ void tlv320_init(void) | |||
75 | 75 | ||
76 | /* All ON except OUT, ADC, MIC and LINE */ | 76 | /* All ON except OUT, ADC, MIC and LINE */ |
77 | tlv320_write_reg(REG_PC, PC_OUT | PC_ADC | PC_MIC | PC_LINE); | 77 | tlv320_write_reg(REG_PC, PC_OUT | PC_ADC | PC_MIC | PC_LINE); |
78 | tlv320_set_recvol(0, 0, AUDIO_GAIN_MIC); | 78 | audiohw_set_recvol(0, 0, AUDIO_GAIN_MIC); |
79 | tlv320_set_recvol(0, 0, AUDIO_GAIN_LINEIN); | 79 | audiohw_set_recvol(0, 0, AUDIO_GAIN_LINEIN); |
80 | tlv320_mute(true); | 80 | audiohw_mute(true); |
81 | tlv320_write_reg(REG_AAP, AAP_DAC | AAP_MICM); | 81 | tlv320_write_reg(REG_AAP, AAP_DAC | AAP_MICM); |
82 | tlv320_write_reg(REG_DAP, 0x00); /* No deemphasis */ | 82 | tlv320_write_reg(REG_DAP, 0x00); /* No deemphasis */ |
83 | tlv320_write_reg(REG_DAIF, DAIF_IWL_16 | DAIF_FOR_I2S); | 83 | tlv320_write_reg(REG_DAIF, DAIF_IWL_16 | DAIF_FOR_I2S); |
84 | tlv320_write_reg(REG_DIA, DIA_ACT); | 84 | tlv320_write_reg(REG_DIA, DIA_ACT); |
85 | tlv320_set_frequency(-1); /* default */ | 85 | audiohw_set_frequency(-1); /* default */ |
86 | /* All ON except ADC, MIC and LINE */ | 86 | /* All ON except ADC, MIC and LINE */ |
87 | tlv320_write_reg(REG_PC, PC_ADC | PC_MIC | PC_LINE); | 87 | tlv320_write_reg(REG_PC, PC_ADC | PC_MIC | PC_LINE); |
88 | } | 88 | } |
@@ -90,7 +90,7 @@ void tlv320_init(void) | |||
90 | /** | 90 | /** |
91 | * Resets tlv320 to default values | 91 | * Resets tlv320 to default values |
92 | */ | 92 | */ |
93 | void tlv320_reset(void) | 93 | void audiohw_reset(void) |
94 | { | 94 | { |
95 | tlv320_write_reg(REG_RR, RR_RESET); | 95 | tlv320_write_reg(REG_RR, RR_RESET); |
96 | } | 96 | } |
@@ -104,7 +104,7 @@ void tlv320_reset(void) | |||
104 | * 44100: 1 = MCLK MCLK SCLK, LRCK: Audio Clk / 4 (default) | 104 | * 44100: 1 = MCLK MCLK SCLK, LRCK: Audio Clk / 4 (default) |
105 | * 88200: 2 = MCLK*2 MCLK SCLK, LRCK: Audio Clk / 2 | 105 | * 88200: 2 = MCLK*2 MCLK SCLK, LRCK: Audio Clk / 2 |
106 | */ | 106 | */ |
107 | void tlv320_set_frequency(unsigned fsel) | 107 | void audiohw_set_frequency(unsigned fsel) |
108 | { | 108 | { |
109 | /* All rates available for 11.2896MHz besides 8.021 */ | 109 | /* All rates available for 11.2896MHz besides 8.021 */ |
110 | unsigned char values_src[3] = | 110 | unsigned char values_src[3] = |
@@ -126,7 +126,7 @@ void tlv320_set_frequency(unsigned fsel) | |||
126 | * | 126 | * |
127 | * Left & Right: 48 .. 121 .. 127 => Volume -73dB (mute) .. +0 dB .. +6 dB | 127 | * Left & Right: 48 .. 121 .. 127 => Volume -73dB (mute) .. +0 dB .. +6 dB |
128 | */ | 128 | */ |
129 | void tlv320_set_headphone_vol(int vol_l, int vol_r) | 129 | void audiohw_set_headphone_vol(int vol_l, int vol_r) |
130 | { | 130 | { |
131 | unsigned value_dap = tlv320_regs[REG_DAP]; | 131 | unsigned value_dap = tlv320_regs[REG_DAP]; |
132 | unsigned value_dap_last = value_dap; | 132 | unsigned value_dap_last = value_dap; |
@@ -156,7 +156,7 @@ void tlv320_set_headphone_vol(int vol_l, int vol_r) | |||
156 | * Mic (left): 0 .. 1 => Volume +0, +20 dB | 156 | * Mic (left): 0 .. 1 => Volume +0, +20 dB |
157 | * | 157 | * |
158 | */ | 158 | */ |
159 | void tlv320_set_recvol(int left, int right, int type) | 159 | void audiohw_set_recvol(int left, int right, int type) |
160 | { | 160 | { |
161 | if (type == AUDIO_GAIN_MIC) | 161 | if (type == AUDIO_GAIN_MIC) |
162 | { | 162 | { |
@@ -180,7 +180,7 @@ void tlv320_set_recvol(int left, int right, int type) | |||
180 | * Mute (mute=true) or enable sound (mute=false) | 180 | * Mute (mute=true) or enable sound (mute=false) |
181 | * | 181 | * |
182 | */ | 182 | */ |
183 | void tlv320_mute(bool mute) | 183 | void audiohw_mute(bool mute) |
184 | { | 184 | { |
185 | unsigned value_dap = tlv320_regs[REG_DAP]; | 185 | unsigned value_dap = tlv320_regs[REG_DAP]; |
186 | unsigned value_l, value_r; | 186 | unsigned value_l, value_r; |
@@ -205,16 +205,16 @@ void tlv320_mute(bool mute) | |||
205 | } | 205 | } |
206 | 206 | ||
207 | /* Nice shutdown of TLV320 codec */ | 207 | /* Nice shutdown of TLV320 codec */ |
208 | void tlv320_close(void) | 208 | void audiohw_close(void) |
209 | { | 209 | { |
210 | tlv320_mute(true); | 210 | audiohw_mute(true); |
211 | sleep(HZ/8); | 211 | sleep(HZ/8); |
212 | 212 | ||
213 | tlv320_write_reg(REG_PC, PC_OFF | PC_CLK | PC_OSC | PC_OUT | | 213 | tlv320_write_reg(REG_PC, PC_OFF | PC_CLK | PC_OSC | PC_OUT | |
214 | PC_DAC | PC_ADC | PC_MIC | PC_LINE); /* All OFF */ | 214 | PC_DAC | PC_ADC | PC_MIC | PC_LINE); /* All OFF */ |
215 | } | 215 | } |
216 | 216 | ||
217 | void tlv320_enable_recording(bool source_mic) | 217 | void audiohw_enable_recording(bool source_mic) |
218 | { | 218 | { |
219 | unsigned value_aap, value_pc; | 219 | unsigned value_aap, value_pc; |
220 | 220 | ||
@@ -234,7 +234,7 @@ void tlv320_enable_recording(bool source_mic) | |||
234 | tlv320_write_reg(REG_AAP, value_aap); | 234 | tlv320_write_reg(REG_AAP, value_aap); |
235 | } | 235 | } |
236 | 236 | ||
237 | void tlv320_disable_recording(void) | 237 | void audiohw_disable_recording(void) |
238 | { | 238 | { |
239 | unsigned value_pc = tlv320_regs[REG_PC]; | 239 | unsigned value_pc = tlv320_regs[REG_PC]; |
240 | unsigned value_aap = tlv320_regs[REG_AAP]; | 240 | unsigned value_aap = tlv320_regs[REG_AAP]; |
@@ -246,7 +246,7 @@ void tlv320_disable_recording(void) | |||
246 | tlv320_write_reg(REG_PC, value_pc); | 246 | tlv320_write_reg(REG_PC, value_pc); |
247 | } | 247 | } |
248 | 248 | ||
249 | void tlv320_set_monitor(bool enable) | 249 | void audiohw_set_monitor(bool enable) |
250 | { | 250 | { |
251 | unsigned value_aap, value_pc; | 251 | unsigned value_aap, value_pc; |
252 | 252 | ||