summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2018-09-05 11:27:27 -0400
committerSolomon Peachy <pizza@shaftnet.org>2018-09-20 18:59:19 -0400
commit8edf4052c78992a269e00d78a2cb82ed73f38358 (patch)
treedef866c77ae3c8b654426f342c27458b95cbca9b
parent10208977947aa1471b065789b5eb08313ccae1d4 (diff)
downloadrockbox-8edf4052c78992a269e00d78a2cb82ed73f38358.tar.gz
rockbox-8edf4052c78992a269e00d78a2cb82ed73f38358.zip
jz7460: Silence codec when changing playback frequency/mode
Silences some annoying clicks. Change-Id: I3d32d4b33c0ccc61877e10f5af97fe05084d66e5
-rw-r--r--firmware/target/mips/ingenic_jz47xx/codec-jz4760.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c b/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c
index f25dc70eb4..09d4858b34 100644
--- a/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c
+++ b/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c
@@ -142,8 +142,11 @@ static int vol_tenthdb2hw(const int tdb)
142 142
143void audiohw_set_volume(int vol_l, int vol_r) 143void audiohw_set_volume(int vol_l, int vol_r)
144{ 144{
145 uint8_t val = cs4398_read_reg(CS4398_REG_MISC) &~ CS4398_FREEZE;
146 cs4398_write_reg(CS4398_REG_MISC, val | CS4398_FREEZE);
145 cs4398_write_reg(CS4398_REG_VOL_A, vol_tenthdb2hw(vol_l)); 147 cs4398_write_reg(CS4398_REG_VOL_A, vol_tenthdb2hw(vol_l));
146 cs4398_write_reg(CS4398_REG_VOL_B, vol_tenthdb2hw(vol_r)); 148 cs4398_write_reg(CS4398_REG_VOL_B, vol_tenthdb2hw(vol_r));
149 cs4398_write_reg(CS4398_REG_MISC, val);
147} 150}
148 151
149void audiohw_set_lineout_volume(int vol_l, int vol_r) 152void audiohw_set_lineout_volume(int vol_l, int vol_r)
@@ -159,8 +162,6 @@ void audiohw_set_lineout_volume(int vol_l, int vol_r)
159 162
160void audiohw_set_filter_roll_off(int value) 163void audiohw_set_filter_roll_off(int value)
161{ 164{
162 /* 0 = fast (sharp);
163 1 = slow */
164 if (value == 0) { 165 if (value == 0) {
165 cs4398_write_reg(CS4398_REG_RAMPFILT, cs4398_read_reg(CS4398_REG_RAMPFILT) & ~CS4398_FILT_SEL); 166 cs4398_write_reg(CS4398_REG_RAMPFILT, cs4398_read_reg(CS4398_REG_RAMPFILT) & ~CS4398_FILT_SEL);
166 } else { 167 } else {
@@ -252,6 +253,7 @@ void audiohw_set_frequency(int fsel)
252 return; 253 return;
253 } 254 }
254 255
256 ap_mute(true);
255 __i2s_stop_bitclk(); 257 __i2s_stop_bitclk();
256 258
257 /* 0 = Single-Speed Mode (<50KHz); 259 /* 0 = Single-Speed Mode (<50KHz);
@@ -268,6 +270,8 @@ void audiohw_set_frequency(int fsel)
268 __cpm_set_i2sdiv(mclk_div-1); 270 __cpm_set_i2sdiv(mclk_div-1);
269 __i2s_set_i2sdiv(bclk_div-1); 271 __i2s_set_i2sdiv(bclk_div-1);
270 __i2s_start_bitclk(); 272 __i2s_start_bitclk();
273 mdelay(20);
274 ap_mute(false);
271} 275}
272 276
273void audiohw_postinit(void) 277void audiohw_postinit(void)