From cd64aa2b10e81f17b0e62f90c7c473af9f95aee8 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Fri, 9 Apr 2021 15:42:11 -0400 Subject: xduoox3: Global volume_limit now applies to the line output as well The X3's line out is a bit hot, at ~4.3Vpp, so allow it to be backed off. (On my X3, backing it off to -6dB brings Vpp down to ~3.4V) Change-Id: Iea38ef1c6a1b183d0f8fb4eaf2bf9ed6b350a532 --- firmware/target/mips/ingenic_jz47xx/codec-jz4760.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'firmware/target/mips/ingenic_jz47xx/codec-jz4760.c') diff --git a/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c b/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c index 5adc4232af..85a189e6a0 100644 --- a/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c +++ b/firmware/target/mips/ingenic_jz47xx/codec-jz4760.c @@ -27,6 +27,7 @@ #include "cs4398.h" #include "kernel.h" #include "button.h" +#include "settings.h" #define PIN_CS_RST (32*1+10) #define PIN_CODEC_PWRON (32*1+13) @@ -73,6 +74,7 @@ static void audiohw_mute(bool mute) cs4398_write_reg(CS4398_REG_MUTE, cs4398_read_reg(CS4398_REG_MUTE) & ~(CS4398_MUTE_A | CS4398_MUTE_B)); } +/* TODO: Note this is X3-specific! */ void audiohw_preinit(void) { cs4398_write_reg(CS4398_REG_MISC, CS4398_CPEN | CS4398_PDN); @@ -155,6 +157,8 @@ static void jz4760_set_vol(int vol_l, int vol_r) cs4398_write_reg(CS4398_REG_MISC, val); } +/* The xDuoo X3's line out is a bit on the hot side, with about 4.3Vpp + so allow the level to be backed off by using the global volume_limit */ void audiohw_set_volume(int vol_l, int vol_r) { #ifdef HAVE_LINEOUT_DETECTION @@ -162,8 +166,7 @@ void audiohw_set_volume(int vol_l, int vol_r) real_vol_r = vol_r; if (lineout_inserted()) { - vol_l = 0; - vol_r = 0; + vol_l = vol_r = global_settings.volume_limit; } #endif jz4760_set_vol(vol_l, vol_r); @@ -176,7 +179,7 @@ void audiohw_set_lineout_volume(int vol_l, int vol_r) #ifdef HAVE_LINEOUT_DETECTION if (lineout_inserted()) { - jz4760_set_vol(0, 0); + jz4760_set_vol(global_settings.volume_limit, global_settings.volume_limit); } else { jz4760_set_vol(real_vol_l, real_vol_r); } -- cgit v1.2.3