summaryrefslogtreecommitdiff
path: root/firmware/target/mips/ingenic_x1000
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
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')
-rw-r--r--firmware/target/mips/ingenic_x1000/erosqnative/audiohw-erosqnative.c38
-rw-r--r--firmware/target/mips/ingenic_x1000/erosqnative/button-erosqnative.c4
-rw-r--r--firmware/target/mips/ingenic_x1000/erosqnative/gpio-target.h26
3 files changed, 35 insertions, 33 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)
diff --git a/firmware/target/mips/ingenic_x1000/erosqnative/button-erosqnative.c b/firmware/target/mips/ingenic_x1000/erosqnative/button-erosqnative.c
index 6c50021ce1..d82cb5b5dc 100644
--- a/firmware/target/mips/ingenic_x1000/erosqnative/button-erosqnative.c
+++ b/firmware/target/mips/ingenic_x1000/erosqnative/button-erosqnative.c
@@ -127,7 +127,7 @@ bool headphones_inserted(void)
127 { 127 {
128 hp_detect_reg_old = hp_detect_reg; 128 hp_detect_reg_old = hp_detect_reg;
129#if !defined(BOOTLOADER) 129#if !defined(BOOTLOADER)
130 pcm5102_set_outputs(); 130 dac_set_outputs();
131#endif 131#endif
132 } 132 }
133 return hp_detect_reg & 0x10 ? false : true; 133 return hp_detect_reg & 0x10 ? false : true;
@@ -140,7 +140,7 @@ bool lineout_inserted(void)
140 { 140 {
141 hp_detect_reg_old = hp_detect_reg; 141 hp_detect_reg_old = hp_detect_reg;
142#if !defined(BOOTLOADER) 142#if !defined(BOOTLOADER)
143 pcm5102_set_outputs(); 143 dac_set_outputs();
144#endif 144#endif
145 } 145 }
146 return hp_detect_reg & 0x20 ? false : true; 146 return hp_detect_reg & 0x20 ? false : true;
diff --git a/firmware/target/mips/ingenic_x1000/erosqnative/gpio-target.h b/firmware/target/mips/ingenic_x1000/erosqnative/gpio-target.h
index 376eae136e..3318a39786 100644
--- a/firmware/target/mips/ingenic_x1000/erosqnative/gpio-target.h
+++ b/firmware/target/mips/ingenic_x1000/erosqnative/gpio-target.h
@@ -24,26 +24,26 @@ DEFINE_PINGROUP(I2S, GPIO_B, 0x1f << 0, GPIOF_DEVICE(1))
24DEFINE_PINGROUP(I2C2, GPIO_D, 3 << 0, GPIOF_DEVICE(1)) 24DEFINE_PINGROUP(I2C2, GPIO_D, 3 << 0, GPIOF_DEVICE(1))
25 25
26/* Name Pin Function */ 26/* Name Pin Function */
27/* mute DAC - 0 - mute, 1 - play. Affects both HP and LO. */ 27/* mute DAC: 0 - mute, 1 - play */
28DEFINE_GPIO(PCM5102A_XMIT, GPIO_PB(12), GPIOF_OUTPUT(0)) 28DEFINE_GPIO(DAC_XMIT, GPIO_PB(12), GPIOF_OUTPUT(0))
29 29
30/* mute HP amp, no effect on LO. 0 - mute, 1 - play */ 30/* mute HP amp: 0 - mute, 1 - play */
31DEFINE_GPIO(MAX97220_SHDN, GPIO_PB(8), GPIOF_OUTPUT(0)) 31DEFINE_GPIO(HPAMP_SHDN, GPIO_PB(8), GPIOF_OUTPUT(0))
32 32
33/* mute audio mux, only affects Headphone out. 33/* mute audio mux: 0 - play, 1 - mute */
34 * 0 - play, 1 - mute */ 34DEFINE_GPIO(STEREOSW_MUTE, GPIO_PB(15), GPIOF_OUTPUT(1))
35DEFINE_GPIO(ISL54405_MUTE, GPIO_PB(15), GPIOF_OUTPUT(1))
36 35
37/* switches HP on/off - 0 HP on, 1 hp off, has no effect on LO. 36/*
38 * As best I can tell, it switches HP Out sources between HP amp and something 37 * Original devices: switches HP on/off - 0 HP on, 1 HP off, no effect on LO.
39 * not implemented - there seem to be resistors missing. */ 38 * Newer devices: switches between HP and LO - 0 HP, 1 LO.
40DEFINE_GPIO(ISL54405_SEL, GPIO_PB(5), GPIOF_OUTPUT(0)) 39 */
40DEFINE_GPIO(STEREOSW_SEL, GPIO_PB(5), GPIOF_OUTPUT(0))
41 41
42/* DAC AVDD */ 42/* DAC AVDD */
43DEFINE_GPIO(PCM5102A_ANALOG_PWR, GPIO_PB(9), GPIOF_OUTPUT(0)) 43DEFINE_GPIO(DAC_ANALOG_PWR, GPIO_PB(9), GPIOF_OUTPUT(0))
44 44
45/* Headphone Amp power */ 45/* Headphone Amp power */
46DEFINE_GPIO(MAX97220_POWER, GPIO_PB(6), GPIOF_OUTPUT(0)) 46DEFINE_GPIO(HPAMP_POWER, GPIO_PB(6), GPIOF_OUTPUT(0))
47 47
48/* SD card */ 48/* SD card */
49DEFINE_GPIO(MSC0_CD, GPIO_PB(11), GPIOF_INPUT) 49DEFINE_GPIO(MSC0_CD, GPIO_PB(11), GPIOF_INPUT)