summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/audio/wm8751.c46
1 files changed, 13 insertions, 33 deletions
diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c
index d2d7f8f761..cbc65d63ef 100644
--- a/firmware/drivers/audio/wm8751.c
+++ b/firmware/drivers/audio/wm8751.c
@@ -39,16 +39,16 @@ const struct sound_settings_info audiohw_settings[] = {
39 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 39 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
40 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 40 [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100},
41#ifdef HAVE_RECORDING 41#ifdef HAVE_RECORDING
42 /* -97.0dB to 30.0dB in 0.5dB increments */ 42 /* -17.25dB to 30.0dB in 0.75dB increments 64 steps*/
43 [SOUND_LEFT_GAIN] = {"dB", 1, 1,-194, 60, 0}, 43 [SOUND_LEFT_GAIN] = {"dB", 2, 75, -1725, 3000, 0},
44 [SOUND_RIGHT_GAIN] = {"dB", 1, 1,-194, 60, 0}, 44 [SOUND_RIGHT_GAIN] = {"dB", 2, 75, -1725, 3000, 0},
45 [SOUND_MIC_GAIN] = {"dB", 1, 1,-194, 60, 60}, 45 [SOUND_MIC_GAIN] = {"dB", 2, 75, -1725, 3000, 3000},
46#endif 46#endif
47#ifdef AUDIOHW_HAVE_BASS_CUTOFF 47#ifdef AUDIOHW_HAVE_BASS_CUTOFF
48 [SOUND_BASS_CUTOFF] = {"Hz", 0, 70, 130, 200, 200}, 48 [SOUND_BASS_CUTOFF] = {"Hz", 0, 70, 130, 200, 200},
49#endif 49#endif
50#ifdef AUDIOHW_HAVE_TREBLE_CUTOFF 50#ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
51 [SOUND_TREBLE_CUTOFF] = {"kHz",0, 4, 4, 8, 4}, 51 [SOUND_TREBLE_CUTOFF] = {"kHz", 0, 4, 4, 8, 4},
52#endif 52#endif
53#ifdef AUDIOHW_HAVE_DEPTH_3D 53#ifdef AUDIOHW_HAVE_DEPTH_3D
54 [SOUND_DEPTH_3D] = {"%", 0, 1, 0, 15, 0}, 54 [SOUND_DEPTH_3D] = {"%", 0, 1, 0, 15, 0},
@@ -180,12 +180,11 @@ void audiohw_set_treble_cutoff(int val)
180} 180}
181#endif 181#endif
182 182
183#if defined(HAVE_WM8750) && defined(HAVE_RECORDING) 183#ifdef HAVE_RECORDING
184static int recvol2hw(int value) 184static int recvol2hw(int value)
185{ 185{
186 /* -970...300 to input register value */ 186 /* -1725 to 3000 => 0 ... 23 ... 63 */
187 187 return ((4 * value) / 300) + 23;
188 return ((2*value)/10 + 0xc3);
189} 188}
190#endif 189#endif
191 190
@@ -195,13 +194,6 @@ int sound_val2phys(int setting, int value)
195 194
196 switch (setting) 195 switch (setting)
197 { 196 {
198#ifdef HAVE_RECORDING
199 case SOUND_LEFT_GAIN:
200 case SOUND_RIGHT_GAIN:
201 case SOUND_MIC_GAIN:
202 result = value * 5;
203 break;
204#endif
205#ifdef AUDIOHW_HAVE_DEPTH_3D 197#ifdef AUDIOHW_HAVE_DEPTH_3D
206 case SOUND_DEPTH_3D: 198 case SOUND_DEPTH_3D:
207 result = (100 * value + 8) / 15; 199 result = (100 * value + 8) / 15;
@@ -542,10 +534,6 @@ void audiohw_set_recsrc(int source, bool recording)
542 wmcodec_set_bits(PWRMGMT1, PWRMGMT1_AINL | PWRMGMT1_AINR | 534 wmcodec_set_bits(PWRMGMT1, PWRMGMT1_AINL | PWRMGMT1_AINR |
543 PWRMGMT1_ADCL | PWRMGMT1_ADCR); 535 PWRMGMT1_ADCL | PWRMGMT1_ADCR);
544 536
545 /* Set input volume to PGA 0dB*/
546 wmcodec_set_reg(LINVOL, LINVOL_LIVU | LINVOL_LINVOL(0x17));
547 wmcodec_set_reg(RINVOL, RINVOL_RIVU | RINVOL_RINVOL(0x17));
548
549 /* Setup input source for PGA as INPUT1 */ 537 /* Setup input source for PGA as INPUT1 */
550 wmcodec_set_masked(ADCL, ADCL_LINSEL_LINPUT1, ADCL_LINSEL_MASK); 538 wmcodec_set_masked(ADCL, ADCL_LINSEL_LINPUT1, ADCL_LINSEL_MASK);
551 wmcodec_set_masked(ADCR, ADCR_RINSEL_RINPUT1, ADCR_RINSEL_MASK); 539 wmcodec_set_masked(ADCR, ADCR_RINSEL_RINPUT1, ADCR_RINSEL_MASK);
@@ -608,10 +596,6 @@ void audiohw_set_recsrc(int source, bool recording)
608 wmcodec_set_bits(PWRMGMT1, PWRMGMT1_AINL | PWRMGMT1_AINR | 596 wmcodec_set_bits(PWRMGMT1, PWRMGMT1_AINL | PWRMGMT1_AINR |
609 PWRMGMT1_ADCL | PWRMGMT1_ADCR); 597 PWRMGMT1_ADCL | PWRMGMT1_ADCR);
610 598
611 /* Set input volume to PGA 0dB*/
612 wmcodec_set_reg(LINVOL, LINVOL_LIVU | LINVOL_LINVOL(0x17));
613 wmcodec_set_reg(RINVOL, RINVOL_RIVU | RINVOL_RINVOL(0x17));
614
615 /* Setup input source for PGA as INPUT2 599 /* Setup input source for PGA as INPUT2
616 * MICBOOST disabled 600 * MICBOOST disabled
617 */ 601 */
@@ -649,10 +633,6 @@ void audiohw_set_recsrc(int source, bool recording)
649 wmcodec_set_bits(PWRMGMT1, PWRMGMT1_AINL | PWRMGMT1_AINR | 633 wmcodec_set_bits(PWRMGMT1, PWRMGMT1_AINL | PWRMGMT1_AINR |
650 PWRMGMT1_ADCL | PWRMGMT1_ADCR); 634 PWRMGMT1_ADCL | PWRMGMT1_ADCR);
651 635
652 /* Set input volume to PGA 0dB*/
653 wmcodec_set_reg(LINVOL, LINVOL_LIVU | LINVOL_LINVOL(0x17));
654 wmcodec_set_reg(RINVOL, RINVOL_RIVU | RINVOL_RINVOL(0x17));
655
656 /* Setup input source for PGA as INPUT3 636 /* Setup input source for PGA as INPUT3
657 * MICBOOST disabled 637 * MICBOOST disabled
658 */ 638 */
@@ -685,14 +665,14 @@ void audiohw_set_recsrc(int source, bool recording)
685/* Setup PGA gain */ 665/* Setup PGA gain */
686void audiohw_set_recvol(int vol_l, int vol_r, int type) 666void audiohw_set_recvol(int vol_l, int vol_r, int type)
687{ 667{
688 wmcodec_set_reg(LADCVOL, LADCVOL_LADCVOL(recvol2hw(vol_l))); 668 wmcodec_set_reg(LINVOL, LINVOL_LIZC | LINVOL_LINVOL(recvol2hw(vol_l)));
689 669
690 if (type == AUDIO_GAIN_MIC) 670 if (type == AUDIO_GAIN_MIC)
691 wmcodec_set_reg(RADCVOL, RADCVOL_RAVU | 671 wmcodec_set_reg(RINVOL, RINVOL_RIVU | RINVOL_RIZC |
692 RADCVOL_RADCVOL(recvol2hw(vol_l))); 672 RINVOL_RINVOL(recvol2hw(vol_l)));
693 else 673 else
694 wmcodec_set_reg(RADCVOL, RADCVOL_RAVU | 674 wmcodec_set_reg(RINVOL, RINVOL_RIVU | RINVOL_RIZC |
695 RADCVOL_RADCVOL(recvol2hw(vol_r))); 675 RINVOL_RINVOL(recvol2hw(vol_r)));
696} 676}
697#endif /* HAVE_RECORDING */ 677#endif /* HAVE_RECORDING */
698#endif /* HAVE_WM8750 */ 678#endif /* HAVE_WM8750 */