diff options
author | Dana Conrad <dconrad@fastmail.com> | 2023-01-22 12:33:15 -0600 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2023-01-22 15:11:35 -0500 |
commit | 66519000f47cfb5c58be68ab2335b7cbc0bce35b (patch) | |
tree | 92701a200a68da3afd6336a3954fe02c840ae82d /firmware/drivers/audio/eros_qn_codec.c | |
parent | c307d98e3fbe5e867cd6e6e3c61f4937021c6b4c (diff) | |
download | rockbox-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/drivers/audio/eros_qn_codec.c')
-rw-r--r-- | firmware/drivers/audio/eros_qn_codec.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/firmware/drivers/audio/eros_qn_codec.c b/firmware/drivers/audio/eros_qn_codec.c index da50d62fe5..39a421ee92 100644 --- a/firmware/drivers/audio/eros_qn_codec.c +++ b/firmware/drivers/audio/eros_qn_codec.c | |||
@@ -31,10 +31,10 @@ | |||
31 | static long int vol_l_hw = 0; | 31 | static long int vol_l_hw = 0; |
32 | static long int vol_r_hw = 0; | 32 | static long int vol_r_hw = 0; |
33 | 33 | ||
34 | /* internal: mute the headphone amp. 0 - unmuted, 1 - muted */ | 34 | /* internal: Switch the output sink. 0 - headphones, 1 - line out */ |
35 | void audiohw_mute_hp(int mute); | 35 | void audiohw_switch_output(int select); |
36 | 36 | ||
37 | void pcm5102_set_outputs(void) | 37 | void dac_set_outputs(void) |
38 | { | 38 | { |
39 | audiohw_set_volume(vol_l_hw, vol_r_hw); | 39 | audiohw_set_volume(vol_l_hw, vol_r_hw); |
40 | } | 40 | } |
@@ -56,15 +56,14 @@ void audiohw_set_volume(int vol_l, int vol_r) | |||
56 | * blow out our eardrums cranking it to full */ | 56 | * blow out our eardrums cranking it to full */ |
57 | if (lineout_inserted() && !headphones_inserted()) | 57 | if (lineout_inserted() && !headphones_inserted()) |
58 | { | 58 | { |
59 | l = r = global_settings.volume_limit * 10; | 59 | audiohw_switch_output(1); |
60 | 60 | ||
61 | /* mute the headphone amp if not plugged in */ | 61 | l = r = global_settings.volume_limit * 10; |
62 | audiohw_mute_hp(1); | ||
63 | } | 62 | } |
64 | else | 63 | else |
65 | { | 64 | { |
66 | /* unmute the headphone amp when plugged in */ | 65 | audiohw_switch_output(0); |
67 | audiohw_mute_hp(0); | 66 | |
68 | l = vol_l; | 67 | l = vol_l; |
69 | r = vol_r; | 68 | r = vol_r; |
70 | } | 69 | } |
@@ -76,14 +75,14 @@ void audiohw_set_volume(int vol_l, int vol_r) | |||
76 | pcm_set_master_volume(l, r); | 75 | pcm_set_master_volume(l, r); |
77 | } | 76 | } |
78 | 77 | ||
79 | void audiohw_mute_hp(int mute) | 78 | void audiohw_switch_output(int select) |
80 | { | 79 | { |
81 | if (mute == 0) | 80 | if (select == 0) |
82 | { | 81 | { |
83 | gpio_set_level(GPIO_MAX97220_SHDN, 1); | 82 | gpio_set_level(GPIO_STEREOSW_SEL, 0); |
84 | } | 83 | } |
85 | else | 84 | else |
86 | { | 85 | { |
87 | gpio_set_level(GPIO_MAX97220_SHDN, 0); | 86 | gpio_set_level(GPIO_STEREOSW_SEL, 1); |
88 | } | 87 | } |
89 | } | 88 | } |