summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/tlv320.c32
-rw-r--r--firmware/export/tlv320.h8
2 files changed, 20 insertions, 20 deletions
diff --git a/firmware/drivers/tlv320.c b/firmware/drivers/tlv320.c
index bafd77cd39..da92028ce1 100644
--- a/firmware/drivers/tlv320.c
+++ b/firmware/drivers/tlv320.c
@@ -60,7 +60,7 @@ unsigned tlv320_regs[0xf];
60 60
61void tlv320_write_reg(unsigned reg, unsigned value) 61void tlv320_write_reg(unsigned reg, unsigned value)
62{ 62{
63 unsigned data[3]; 63 unsigned char data[3];
64 64
65 data[0] = TLV320_ADDR; 65 data[0] = TLV320_ADDR;
66 data[1] = reg << 1; 66 data[1] = reg << 1;
@@ -76,7 +76,7 @@ void tlv320_write_reg(unsigned reg, unsigned value)
76} 76}
77 77
78/* Returns 0 if successful or -1 if some register failed */ 78/* Returns 0 if successful or -1 if some register failed */
79void tlv320_set_regs() 79void tlv320_set_regs(void)
80{ 80{
81 int i; 81 int i;
82 memset(tlv320_regs, 0, sizeof(tlv320_regs)); 82 memset(tlv320_regs, 0, sizeof(tlv320_regs));
@@ -96,7 +96,7 @@ void tlv320_set_regs()
96/** 96/**
97 * Init our tlv with default values 97 * Init our tlv with default values
98 */ 98 */
99void tlv320_init() 99void tlv320_init(void)
100{ 100{
101 tlv320_reset(); 101 tlv320_reset();
102 tlv320_set_regs(); 102 tlv320_set_regs();
@@ -105,14 +105,14 @@ void tlv320_init()
105/** 105/**
106 * Resets tlv320 to default values 106 * Resets tlv320 to default values
107 */ 107 */
108void tlv320_reset() 108void tlv320_reset(void)
109{ 109{
110 tlv320_write_reg(REG_RR, RR_RESET): 110 tlv320_write_reg(REG_RR, RR_RESET);
111} 111}
112 112
113void tlv320_enable_output(bool enable) 113void tlv320_enable_output(bool enable)
114{ 114{
115 unsigned value = tlv320regs[REG_PC]; 115 unsigned value = tlv320_regs[REG_PC];
116 116
117 if (enable) 117 if (enable)
118 value |= PC_OUT; 118 value |= PC_OUT;
@@ -148,11 +148,11 @@ void tlv320_set_headphone_vol(int vol_l, int vol_r)
148 */ 148 */
149void tlv320_set_linein_vol(int vol_l, int vol_r) 149void tlv320_set_linein_vol(int vol_l, int vol_r)
150{ 150{
151 unsigned value_l = tlv320regs[REG_LLIV]; 151 unsigned value_l = tlv320_regs[REG_LLIV];
152 unsigned value_r = tlv320regs[REG_RLIV]; 152 unsigned value_r = tlv320_regs[REG_RLIV];
153 153
154 value_l |= LLIV_LHV(vol_l); 154 value_l |= LLIV_LIV(vol_l);
155 value_r |= RLIV_RHV(vol_r); 155 value_r |= RLIV_RIV(vol_r);
156 156
157 tlv320_write_reg(REG_LLIV, value_l); 157 tlv320_write_reg(REG_LLIV, value_l);
158 tlv320_write_reg(REG_RLIV, value_r); 158 tlv320_write_reg(REG_RLIV, value_r);
@@ -164,8 +164,8 @@ void tlv320_set_linein_vol(int vol_l, int vol_r)
164 */ 164 */
165void tlv320_mute(bool mute) 165void tlv320_mute(bool mute)
166{ 166{
167 unsigned value_l = tlv320regs[REG_LHV]; 167 unsigned value_l = tlv320_regs[REG_LHV];
168 unsigned value_r = tlv320regs[REG_RHV]; 168 unsigned value_r = tlv320_regs[REG_RHV];
169 169
170 if (mute) 170 if (mute)
171 { 171 {
@@ -189,8 +189,8 @@ void tlv320_close()
189 189
190void tlv320_enable_recording(bool source_mic) 190void tlv320_enable_recording(bool source_mic)
191{ 191{
192 unsigned value_pc = tlv320regs[REG_PC]; 192 unsigned value_pc = tlv320_regs[REG_PC];
193 unsigned value_aap = tlv320regs[REG_AAP]; 193 unsigned value_aap = tlv320_regs[REG_AAP];
194 194
195 /* select source*/ 195 /* select source*/
196 if (source_mic) 196 if (source_mic)
@@ -213,11 +213,11 @@ void tlv320_enable_recording(bool source_mic)
213 213
214void tlv320_disable_recording() 214void tlv320_disable_recording()
215{ 215{
216 unsigned value = tlv320regs[REG_PC]; 216 unsigned value = tlv320_regs[REG_PC];
217 217
218 /* powerdown mic, linein and adc */ 218 /* powerdown mic, linein and adc */
219 value &= ~(PC_MIC | PC_LINE | PC_ADC); 219 value &= ~(PC_MIC | PC_LINE | PC_ADC);
220 220
221 /* powerdown mic, linein and adc */ 221 /* powerdown mic, linein and adc */
222 tlv320_write_reg(REG_PC, value); 222 tlv320_write_reg(REG_PC, value);
223} \ No newline at end of file 223}
diff --git a/firmware/export/tlv320.h b/firmware/export/tlv320.h
index d07b0a199c..c4599f02b2 100644
--- a/firmware/export/tlv320.h
+++ b/firmware/export/tlv320.h
@@ -41,25 +41,25 @@ extern void tlv320_disable_recording(void);
41#define REG_LLIV 0x0 41#define REG_LLIV 0x0
42#define LLIV_LRS (0 << 8) /* simultaneous volume/mute update */ 42#define LLIV_LRS (0 << 8) /* simultaneous volume/mute update */
43#define LLIV_LIM (1 << 7) /* Left line input mute */ 43#define LLIV_LIM (1 << 7) /* Left line input mute */
44#define LLIV_LIV ((x) & 0x1f)/* Left line input volume control */ 44#define LLIV_LIV(x) ((x) & 0x1f)/* Left line input volume control */
45 45
46/* REG_RLIV: Right line input channel volume control */ 46/* REG_RLIV: Right line input channel volume control */
47#define REG_RLIV 0x1 47#define REG_RLIV 0x1
48#define RLIV_RLS (0 << 8) /* simultaneous volume/mute update */ 48#define RLIV_RLS (0 << 8) /* simultaneous volume/mute update */
49#define RLIV_RIM (0 << 7) /* Right line input mute */ 49#define RLIV_RIM (0 << 7) /* Right line input mute */
50#define RLIV_LIV ((x) & 0x1f)/* Right line input volume control */ 50#define RLIV_RIV(x) ((x) & 0x1f)/* Right line input volume control */
51 51
52/* REG_LHV: Left Channel Headphone Volume Control */ 52/* REG_LHV: Left Channel Headphone Volume Control */
53#define REG_LHV 0x2 53#define REG_LHV 0x2
54#define LHV_LRS (0 << 8) /* simultaneous volume/mute update */ 54#define LHV_LRS (0 << 8) /* simultaneous volume/mute update */
55#define LHV_LZC (0 << 7) /* Left-channel zero-cross detect */ 55#define LHV_LZC (0 << 7) /* Left-channel zero-cross detect */
56#define LHV_LHV ((x) & 0x7f)/* Left headphone volume control */ 56#define LHV_LHV(x) ((x) & 0x7f)/* Left headphone volume control */
57 57
58/* REG_RHV: Right Channel Headphone Volume Control */ 58/* REG_RHV: Right Channel Headphone Volume Control */
59#define REG_RHV 0x3 59#define REG_RHV 0x3
60#define RHV_LRS (0 << 8) /* simultaneous volume/mute update */ 60#define RHV_LRS (0 << 8) /* simultaneous volume/mute update */
61#define RHV_RZC (0 << 7) /* Right-channel zero-cross detect */ 61#define RHV_RZC (0 << 7) /* Right-channel zero-cross detect */
62#define RHV_LHV ((x) & 0x7f)/* Right headphone volume control */ 62#define RHV_RHV(x) ((x) & 0x7f)/* Right headphone volume control */
63 63
64/* REG_AAP: Analog Audio Path Control */ 64/* REG_AAP: Analog Audio Path Control */
65#define REG_AAP 0x4 65#define REG_AAP 0x4