diff options
author | Dana Conrad <dconrad@fastmail.com> | 2021-10-05 10:59:33 -0500 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-10-06 17:31:30 -0400 |
commit | 67d4da5342d9ac654d9c5f4f0f3c35856a3b4a57 (patch) | |
tree | dc2b535eeaca1bafd006ebb1e7c7a5a0b4076653 /firmware/target/mips | |
parent | 465c216636ffb8ec97d6b41d58bcc59e67b303f1 (diff) | |
download | rockbox-67d4da5342d9ac654d9c5f4f0f3c35856a3b4a57.tar.gz rockbox-67d4da5342d9ac654d9c5f4f0f3c35856a3b4a57.zip |
ErosQNative: Initialize AIC FIFO to -1
Write -1 to AIC_DR to initialize the "last sample"
to -1 in order to prevent power-on clicks.
It appears necessary to completely fill the FIFO,
otherwise I was able to get a click out of it, however
uncommon it was.
Not only does this prevent a click when first
playing a song after power-on, but it also seems to prevent
any click at all when powering on - previously, a small
click may have been heard when first booting.
Change-Id: I2b81c2fa6af9809ef1c354d7a08ca8f9893a7690
Diffstat (limited to 'firmware/target/mips')
-rw-r--r-- | firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c b/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c index 52265c9580..caecf493f0 100644 --- a/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c +++ b/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c | |||
@@ -47,6 +47,7 @@ void audiohw_init(void) | |||
47 | aic_set_i2s_mode(AIC_I2S_MASTER_MODE); | 47 | aic_set_i2s_mode(AIC_I2S_MASTER_MODE); |
48 | audiohw_set_frequency(HW_FREQ_48); | 48 | audiohw_set_frequency(HW_FREQ_48); |
49 | 49 | ||
50 | aic_set_play_last_sample(true); | ||
50 | aic_enable_i2s_master_clock(true); | 51 | aic_enable_i2s_master_clock(true); |
51 | aic_enable_i2s_bit_clock(true); | 52 | aic_enable_i2s_bit_clock(true); |
52 | 53 | ||
@@ -59,6 +60,22 @@ void audiohw_init(void) | |||
59 | 60 | ||
60 | void audiohw_postinit(void) | 61 | void audiohw_postinit(void) |
61 | { | 62 | { |
63 | /* | ||
64 | * enable playback, fill FIFO buffer with -1 to prevent | ||
65 | * the DAC from auto-muting, wait, and then stop playback. | ||
66 | * This seems to completely prevent power-on or first-track | ||
67 | * clicking. | ||
68 | */ | ||
69 | jz_writef(AIC_CCR, ERPL(1)); | ||
70 | for (int i = 0; i < 32; i++) | ||
71 | { | ||
72 | jz_write(AIC_DR, 0xFFFFFF); | ||
73 | } | ||
74 | /* Wait until all samples are through the FIFO. */ | ||
75 | while(jz_readf(AIC_SR, TFL) != 0); | ||
76 | mdelay(20); /* This seems to silence the power-on click */ | ||
77 | jz_writef(AIC_CCR, ERPL(0)); | ||
78 | |||
62 | /* unmute - attempt to make power-on pop-free */ | 79 | /* unmute - attempt to make power-on pop-free */ |
63 | gpio_set_level(GPIO_ISL54405_SEL, 0); | 80 | gpio_set_level(GPIO_ISL54405_SEL, 0); |
64 | gpio_set_level(GPIO_MAX97220_SHDN, 1); | 81 | gpio_set_level(GPIO_MAX97220_SHDN, 1); |