summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio/tlv320.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/audio/tlv320.c')
-rw-r--r--firmware/drivers/audio/tlv320.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/firmware/drivers/audio/tlv320.c b/firmware/drivers/audio/tlv320.c
index 6b96ed212f..23d2fea3a1 100644
--- a/firmware/drivers/audio/tlv320.c
+++ b/firmware/drivers/audio/tlv320.c
@@ -46,8 +46,8 @@ const struct sound_settings_info audiohw_settings[] = {
46#endif 46#endif
47}; 47};
48 48
49/* convert tenth of dB volume (-840..0) to master volume register value */ 49/* convert tenth of dB volume (-73..6) to master volume register value */
50int tenthdb2master(int db) 50static int vol_tenthdb2hw(int db)
51{ 51{
52 /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ 52 /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */
53 /* 1111111 == +6dB (0x7f) */ 53 /* 1111111 == +6dB (0x7f) */
@@ -210,8 +210,11 @@ void audiohw_set_frequency(int fsel)
210 * 210 *
211 * Left & Right: 48 .. 121 .. 127 => Volume -73dB (mute) .. +0 dB .. +6 dB 211 * Left & Right: 48 .. 121 .. 127 => Volume -73dB (mute) .. +0 dB .. +6 dB
212 */ 212 */
213void audiohw_set_headphone_vol(int vol_l, int vol_r) 213void audiohw_set_volume(int vol_l, int vol_r)
214{ 214{
215 vol_l = vol_tenthdb2hw(vol_l);
216 vol_r = vol_tenthdb2hw(vol_r);
217
215 unsigned value_dap = tlv320_regs[REG_DAP]; 218 unsigned value_dap = tlv320_regs[REG_DAP];
216 unsigned value_dap_last = value_dap; 219 unsigned value_dap_last = value_dap;
217 unsigned value_l = LHV_LHV(vol_l); 220 unsigned value_l = LHV_LHV(vol_l);