From 66519000f47cfb5c58be68ab2335b7cbc0bce35b Mon Sep 17 00:00:00 2001 From: Dana Conrad Date: Sun, 22 Jan 2023 12:33:15 -0600 Subject: 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 --- firmware/drivers/audio/eros_qn_codec.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'firmware/drivers/audio/eros_qn_codec.c') 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 @@ static long int vol_l_hw = 0; static long int vol_r_hw = 0; -/* internal: mute the headphone amp. 0 - unmuted, 1 - muted */ -void audiohw_mute_hp(int mute); +/* internal: Switch the output sink. 0 - headphones, 1 - line out */ +void audiohw_switch_output(int select); -void pcm5102_set_outputs(void) +void dac_set_outputs(void) { audiohw_set_volume(vol_l_hw, vol_r_hw); } @@ -56,15 +56,14 @@ void audiohw_set_volume(int vol_l, int vol_r) * blow out our eardrums cranking it to full */ if (lineout_inserted() && !headphones_inserted()) { - l = r = global_settings.volume_limit * 10; + audiohw_switch_output(1); - /* mute the headphone amp if not plugged in */ - audiohw_mute_hp(1); + l = r = global_settings.volume_limit * 10; } else { - /* unmute the headphone amp when plugged in */ - audiohw_mute_hp(0); + audiohw_switch_output(0); + l = vol_l; r = vol_r; } @@ -76,14 +75,14 @@ void audiohw_set_volume(int vol_l, int vol_r) pcm_set_master_volume(l, r); } -void audiohw_mute_hp(int mute) +void audiohw_switch_output(int select) { - if (mute == 0) + if (select == 0) { - gpio_set_level(GPIO_MAX97220_SHDN, 1); + gpio_set_level(GPIO_STEREOSW_SEL, 0); } else { - gpio_set_level(GPIO_MAX97220_SHDN, 0); + gpio_set_level(GPIO_STEREOSW_SEL, 1); } } -- cgit v1.2.3