summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/mips/ingenic_jz47xx/codec-jz4760.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c b/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c
index 5adc4232af..85a189e6a0 100644
--- a/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c
+++ b/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c
@@ -27,6 +27,7 @@
27#include "cs4398.h" 27#include "cs4398.h"
28#include "kernel.h" 28#include "kernel.h"
29#include "button.h" 29#include "button.h"
30#include "settings.h"
30 31
31#define PIN_CS_RST (32*1+10) 32#define PIN_CS_RST (32*1+10)
32#define PIN_CODEC_PWRON (32*1+13) 33#define PIN_CODEC_PWRON (32*1+13)
@@ -73,6 +74,7 @@ static void audiohw_mute(bool mute)
73 cs4398_write_reg(CS4398_REG_MUTE, cs4398_read_reg(CS4398_REG_MUTE) & ~(CS4398_MUTE_A | CS4398_MUTE_B)); 74 cs4398_write_reg(CS4398_REG_MUTE, cs4398_read_reg(CS4398_REG_MUTE) & ~(CS4398_MUTE_A | CS4398_MUTE_B));
74} 75}
75 76
77/* TODO: Note this is X3-specific! */
76void audiohw_preinit(void) 78void audiohw_preinit(void)
77{ 79{
78 cs4398_write_reg(CS4398_REG_MISC, CS4398_CPEN | CS4398_PDN); 80 cs4398_write_reg(CS4398_REG_MISC, CS4398_CPEN | CS4398_PDN);
@@ -155,6 +157,8 @@ static void jz4760_set_vol(int vol_l, int vol_r)
155 cs4398_write_reg(CS4398_REG_MISC, val); 157 cs4398_write_reg(CS4398_REG_MISC, val);
156} 158}
157 159
160/* The xDuoo X3's line out is a bit on the hot side, with about 4.3Vpp
161 so allow the level to be backed off by using the global volume_limit */
158void audiohw_set_volume(int vol_l, int vol_r) 162void audiohw_set_volume(int vol_l, int vol_r)
159{ 163{
160#ifdef HAVE_LINEOUT_DETECTION 164#ifdef HAVE_LINEOUT_DETECTION
@@ -162,8 +166,7 @@ void audiohw_set_volume(int vol_l, int vol_r)
162 real_vol_r = vol_r; 166 real_vol_r = vol_r;
163 167
164 if (lineout_inserted()) { 168 if (lineout_inserted()) {
165 vol_l = 0; 169 vol_l = vol_r = global_settings.volume_limit;
166 vol_r = 0;
167 } 170 }
168#endif 171#endif
169 jz4760_set_vol(vol_l, vol_r); 172 jz4760_set_vol(vol_l, vol_r);
@@ -176,7 +179,7 @@ void audiohw_set_lineout_volume(int vol_l, int vol_r)
176 179
177#ifdef HAVE_LINEOUT_DETECTION 180#ifdef HAVE_LINEOUT_DETECTION
178 if (lineout_inserted()) { 181 if (lineout_inserted()) {
179 jz4760_set_vol(0, 0); 182 jz4760_set_vol(global_settings.volume_limit, global_settings.volume_limit);
180 } else { 183 } else {
181 jz4760_set_vol(real_vol_l, real_vol_r); 184 jz4760_set_vol(real_vol_l, real_vol_r);
182 } 185 }