summaryrefslogtreecommitdiff
path: root/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c
diff options
context:
space:
mode:
authorDana Conrad <dconrad@fastmail.com>2023-01-22 12:33:15 -0600
committerAidan MacDonald <amachronic@protonmail.com>2023-01-22 15:11:35 -0500
commit66519000f47cfb5c58be68ab2335b7cbc0bce35b (patch)
tree92701a200a68da3afd6336a3954fe02c840ae82d /firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c
parentc307d98e3fbe5e867cd6e6e3c61f4937021c6b4c (diff)
downloadrockbox-66519000f47cfb5c58be68ab2335b7cbc0bce35b.tar.gz
rockbox-66519000f47cfb5c58be68ab2335b7cbc0bce35b.zip
ErosQNative: Enable Line Out capabilities on new revision players
The newer players have some changed hardware, but most importantly the line out now appears to be routed through the stereo switch instead of being hardwired directly off the DAC. Disable muting the headphone amp, enable switching the stereo switch, and rename some of the GPIOs to be more generic since the DAC, headphone amp, and stereo switch all appear to have changed. Change-Id: I220fe5e37bcbcd959b544183e1fcf70673a83c13
Diffstat (limited to 'firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c')
-rw-r--r--firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c b/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c
index b32a32a3a3..c53da728ff 100644
--- a/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c
+++ b/firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c
@@ -27,20 +27,22 @@
27#include "gpio-x1000.h" 27#include "gpio-x1000.h"
28#include "logf.h" 28#include "logf.h"
29 29
30/* Audio path appears to be: 30/*
31 * DAC --> HP Amp --> Stereo Switch --> HP OUT 31 * Earlier devices audio path appears to be:
32 * \--> LO OUT 32 * DAC \--> HP Amp --> Stereo Switch --> HP OUT
33 * \-> LO OUT
33 * 34 *
34 * The real purpose of the Stereo Switch is not clear. 35 * Recent devices, the audio path seems to have changed to:
35 * It appears to switch sources between the HP amp and something, 36 * DAC --> HP Amp --> Stereo Switch \--> HP OUT
36 * likely something unimplemented. */ 37 * \-> LO OUT
38 */
37 39
38void audiohw_init(void) 40void audiohw_init(void)
39{ 41{
40 /* explicitly mute everything */ 42 /* explicitly mute everything */
41 gpio_set_level(GPIO_MAX97220_SHDN, 0); 43 gpio_set_level(GPIO_HPAMP_SHDN, 0);
42 gpio_set_level(GPIO_ISL54405_MUTE, 1); 44 gpio_set_level(GPIO_STEREOSW_MUTE, 1);
43 gpio_set_level(GPIO_PCM5102A_XMIT, 0); 45 gpio_set_level(GPIO_DAC_XMIT, 0);
44 46
45 aic_set_play_last_sample(true); 47 aic_set_play_last_sample(true);
46 aic_set_external_codec(true); 48 aic_set_external_codec(true);
@@ -53,8 +55,8 @@ void audiohw_init(void)
53 mdelay(10); 55 mdelay(10);
54 56
55 /* power on DAC and HP Amp */ 57 /* power on DAC and HP Amp */
56 gpio_set_level(GPIO_PCM5102A_ANALOG_PWR, 1); 58 gpio_set_level(GPIO_DAC_ANALOG_PWR, 1);
57 gpio_set_level(GPIO_MAX97220_POWER, 1); 59 gpio_set_level(GPIO_HPAMP_POWER, 1);
58} 60}
59 61
60void audiohw_postinit(void) 62void audiohw_postinit(void)
@@ -76,23 +78,23 @@ void audiohw_postinit(void)
76 jz_writef(AIC_CCR, ERPL(0)); 78 jz_writef(AIC_CCR, ERPL(0));
77 79
78 /* unmute - attempt to make power-on pop-free */ 80 /* unmute - attempt to make power-on pop-free */
79 gpio_set_level(GPIO_ISL54405_SEL, 0); 81 gpio_set_level(GPIO_STEREOSW_SEL, 0);
80 gpio_set_level(GPIO_MAX97220_SHDN, 1); 82 gpio_set_level(GPIO_HPAMP_SHDN, 1);
81 mdelay(10); 83 mdelay(10);
82 gpio_set_level(GPIO_PCM5102A_XMIT, 1); 84 gpio_set_level(GPIO_DAC_XMIT, 1);
83 mdelay(10); 85 mdelay(10);
84 gpio_set_level(GPIO_ISL54405_MUTE, 0); 86 gpio_set_level(GPIO_STEREOSW_MUTE, 0);
85} 87}
86 88
87/* TODO: get shutdown just right according to dac datasheet */ 89/* TODO: get shutdown just right according to dac datasheet */
88void audiohw_close(void) 90void audiohw_close(void)
89{ 91{
90 /* mute - attempt to make power-off pop-free */ 92 /* mute - attempt to make power-off pop-free */
91 gpio_set_level(GPIO_ISL54405_MUTE, 1); 93 gpio_set_level(GPIO_STEREOSW_MUTE, 1);
92 mdelay(10); 94 mdelay(10);
93 gpio_set_level(GPIO_PCM5102A_XMIT, 0); 95 gpio_set_level(GPIO_DAC_XMIT, 0);
94 mdelay(10); 96 mdelay(10);
95 gpio_set_level(GPIO_MAX97220_SHDN, 0); 97 gpio_set_level(GPIO_HPAMP_SHDN, 0);
96} 98}
97 99
98void audiohw_set_frequency(int fsel) 100void audiohw_set_frequency(int fsel)