diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2006-09-26 18:57:31 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2006-09-26 18:57:31 +0000 |
commit | 2dbe428abc87b9e2ffc005f3cd181bf3db581b66 (patch) | |
tree | 74cdb58d07a5e002b3c9b54a7976a0a407e4d5cb /firmware | |
parent | 7d1dcd118d31ecf26870f226d6454a5409c00a8d (diff) |
Fixed tlv320 mute problem at least for digital audio path. Analog bypass muting (during FM Radio listening) will require more drastic measures like powering down of part of the chip afaict.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11065 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/tlv320.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/firmware/drivers/tlv320.c b/firmware/drivers/tlv320.c index 5027d744c9..5be7facdd2 100644 --- a/firmware/drivers/tlv320.c +++ b/firmware/drivers/tlv320.c @@ -102,20 +102,25 @@ void tlv320_reset(void) */ void tlv320_set_headphone_vol(int vol_l, int vol_r) { - unsigned value_l = tlv320_regs[REG_LHV]; - unsigned value_r = tlv320_regs[REG_RHV]; + unsigned value_dap = tlv320_regs[REG_DAP]; + unsigned value_dap_last = value_dap; + unsigned value_l = LHV_LHV(vol_l); + unsigned value_r = RHV_RHV(vol_r); /* keep track of current setting */ tlv320.vol_l = vol_l; tlv320.vol_r = vol_r; - /* set new values in local register holders */ - value_l = LHV_LHV(vol_l); - value_r = RHV_RHV(vol_r); + if (value_l > HEADPHONE_MUTE || value_r > HEADPHONE_MUTE) + value_dap &= ~DAP_DACM; + else + value_dap |= DAP_DACM; /* update */ tlv320_write_reg(REG_LHV, LHV_LZC | value_l); tlv320_write_reg(REG_RHV, RHV_RZC | value_r); + if (value_dap != value_dap_last) + tlv320_write_reg(REG_DAP, value_dap); } /** @@ -152,22 +157,26 @@ void tlv320_set_recvol(int left, int right, int type) */ void tlv320_mute(bool mute) { - unsigned value_l = tlv320_regs[REG_LHV]; - unsigned value_r = tlv320_regs[REG_RHV]; + unsigned value_dap = tlv320_regs[REG_DAP]; + unsigned value_l, value_r; if (mute) { value_l = LHV_LHV(HEADPHONE_MUTE); value_r = RHV_RHV(HEADPHONE_MUTE); + value_dap |= DAP_DACM; } else { value_l = LHV_LHV(tlv320.vol_l); value_r = RHV_RHV(tlv320.vol_r); + if (value_l > HEADPHONE_MUTE || value_r > HEADPHONE_MUTE) + value_dap &= ~DAP_DACM; } tlv320_write_reg(REG_LHV, LHV_LZC | value_l); tlv320_write_reg(REG_RHV, RHV_RZC | value_r); + tlv320_write_reg(REG_DAP, value_dap); } /* Nice shutdown of TLV320 codec */ |