summaryrefslogtreecommitdiff
path: root/firmware/sound.c
diff options
context:
space:
mode:
authorDaniel Ankers <dan@weirdo.org.uk>2006-11-22 00:49:16 +0000
committerDaniel Ankers <dan@weirdo.org.uk>2006-11-22 00:49:16 +0000
commit43e2c01065df95bac37e2efd15d61c86b736e1c0 (patch)
tree29683fdac7b6d11fd8d57f56c585707a8ed1e241 /firmware/sound.c
parent242cbd5cd73542c79020a4ce9a8e83ee0391bc72 (diff)
downloadrockbox-43e2c01065df95bac37e2efd15d61c86b736e1c0.tar.gz
rockbox-43e2c01065df95bac37e2efd15d61c86b736e1c0.zip
Sansa doesn't use a Wolfson codec. Various other changes to allow Sansa to compile correctly with a normal build. Based on FS#6336 by Pavel Gnelitsa
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11570 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/sound.c')
-rw-r--r--firmware/sound.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/firmware/sound.c b/firmware/sound.c
index 7e29fddec5..6bd9b70029 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -89,6 +89,9 @@ static const struct sound_settings_info sound_settings_table[] = {
89 [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble}, 89 [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0, sound_set_treble},
90#elif (CONFIG_CPU == PNX0101) 90#elif (CONFIG_CPU == PNX0101)
91 [SOUND_VOLUME] = {"dB", 0, 1, -48, 15, 0, sound_set_volume}, 91 [SOUND_VOLUME] = {"dB", 0, 1, -48, 15, 0, sound_set_volume},
92#elif defined(HAVE_PP5024_CODEC)
93/* TODO: Make this correct */
94 [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25, sound_set_volume},
92#else /* MAS3507D */ 95#else /* MAS3507D */
93 [SOUND_VOLUME] = {"dB", 0, 1, -78, 18, -18, sound_set_volume}, 96 [SOUND_VOLUME] = {"dB", 0, 1, -78, 18, -18, sound_set_volume},
94 [SOUND_BASS] = {"dB", 0, 1, -15, 15, 7, sound_set_bass}, 97 [SOUND_BASS] = {"dB", 0, 1, -15, 15, 7, sound_set_bass},
@@ -420,11 +423,17 @@ static int tenthdb2mixer(int db)
420 return -db * 2 / 5; 423 return -db * 2 / 5;
421} 424}
422 425
426#elif defined(HAVE_PP5024_CODEC)
427/* TODO: Work out volume/balance/treble/bass interdependency */
428#define VOLUME_MIN 0
429#define VOLUME_MAX 1
430
423#endif 431#endif
424 432
425#if (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 \ 433#if (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 \
426 || defined HAVE_WM8975 || defined HAVE_WM8758 || defined(HAVE_WM8731) \ 434 || defined HAVE_WM8975 || defined HAVE_WM8758 || defined(HAVE_WM8731) \
427 || defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751) 435 || defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751) \
436 || defined(HAVE_PP5024_CODEC)
428 /* volume/balance/treble/bass interdependency main part */ 437 /* volume/balance/treble/bass interdependency main part */
429#define VOLUME_RANGE (VOLUME_MAX - VOLUME_MIN) 438#define VOLUME_RANGE (VOLUME_MAX - VOLUME_MIN)
430 439
@@ -599,7 +608,8 @@ void sound_set_volume(int value)
599 mas_codec_writereg(0x10, tmp); 608 mas_codec_writereg(0x10, tmp);
600#elif (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 \ 609#elif (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 \
601 || defined HAVE_WM8975 || defined HAVE_WM8758 || defined HAVE_WM8731 \ 610 || defined HAVE_WM8975 || defined HAVE_WM8758 || defined HAVE_WM8731 \
602 || defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751) 611 || defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751) \
612 || defined(HAVE_PP5024_CODEC)
603 current_volume = value * 10; /* tenth of dB */ 613 current_volume = value * 10; /* tenth of dB */
604 set_prescaled_volume(); 614 set_prescaled_volume();
605#elif CONFIG_CPU == PNX0101 615#elif CONFIG_CPU == PNX0101
@@ -620,8 +630,8 @@ void sound_set_balance(int value)
620 || defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751) 630 || defined(HAVE_WM8721) || defined(HAVE_TLV320) || defined(HAVE_WM8751)
621 current_balance = value * VOLUME_RANGE / 100; /* tenth of dB */ 631 current_balance = value * VOLUME_RANGE / 100; /* tenth of dB */
622 set_prescaled_volume(); 632 set_prescaled_volume();
623#elif CONFIG_CPU == PNX0101 633#elif CONFIG_CPU == PNX0101 || defined(HAVE_PP5024_CODEC)
624 /* TODO: implement for iFP */ 634 /* TODO: implement for iFP and Sansa */
625 (void)value; 635 (void)value;
626#endif 636#endif
627} 637}
@@ -647,8 +657,8 @@ void sound_set_bass(int value)
647 current_bass = value * 10; 657 current_bass = value * 10;
648 wmcodec_set_bass(value); 658 wmcodec_set_bass(value);
649 set_prescaled_volume(); 659 set_prescaled_volume();
650#elif CONFIG_CPU == PNX0101 660#elif CONFIG_CPU == PNX0101 || defined(HAVE_PP5024_CODEC)
651 /* TODO: implement for iFP */ 661 /* TODO: implement for iFP and Sansa */
652 (void)value; 662 (void)value;
653#endif 663#endif
654} 664}
@@ -673,8 +683,8 @@ void sound_set_treble(int value)
673 wmcodec_set_treble(value); 683 wmcodec_set_treble(value);
674 current_treble = value * 10; 684 current_treble = value * 10;
675 set_prescaled_volume(); 685 set_prescaled_volume();
676#elif CONFIG_CPU == PNX0101 686#elif CONFIG_CPU == PNX0101 || defined(HAVE_PP5024_CODEC)
677 /* TODO: implement for iFP */ 687 /* TODO: implement for iFP and Sansa */
678 (void)value; 688 (void)value;
679#endif 689#endif
680} 690}