From 11ef4ce1f9500ca1bd5651bc0e0dc49bf0dfbd2d Mon Sep 17 00:00:00 2001 From: Peter D'Hoye Date: Sun, 28 Sep 2008 23:25:07 +0000 Subject: Accept FS #9394 by Christian Lees and extend it to all PP targets with a WM8731: More samplerates for playback and recording. Only tested on H10 but should work on the others too. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18662 a1c6a512-1295-4272-9138-f99709370657 --- docs/CREDITS | 1 + firmware/drivers/audio/wm8731.c | 24 +++++++++++++++++++++++- firmware/export/config-h10.h | 6 ++++-- firmware/export/config-h10_5gb.h | 6 ++++-- firmware/export/config-hdd1630.h | 6 ++++-- firmware/export/config-ipod3g.h | 8 ++++++++ firmware/export/config-ipodmini.h | 8 ++++++++ firmware/export/config-ipodmini2g.h | 8 ++++++++ firmware/export/config-tpj1022.h | 8 ++++++++ firmware/target/arm/pcm-pp.c | 12 ++++++++++-- 10 files changed, 78 insertions(+), 9 deletions(-) diff --git a/docs/CREDITS b/docs/CREDITS index 8571aa368a..76b86801a9 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -418,6 +418,7 @@ Florin Popescu Volker Mische Vitja Makarov Francisco Vila +Christian Lees The libmad team The wavpack team diff --git a/firmware/drivers/audio/wm8731.c b/firmware/drivers/audio/wm8731.c index a1149c3d2e..a895f4fd8b 100644 --- a/firmware/drivers/audio/wm8731.c +++ b/firmware/drivers/audio/wm8731.c @@ -223,8 +223,30 @@ void audiohw_set_nsorder(int order) void audiohw_set_sample_rate(int sampling_control) { + int rate = 0; + switch(sampling_control) + { + case SAMPR_96: + rate = WM8731_USB24_96000HZ; + break; + case SAMPR_88: + rate = WM8731_USB24_88200HZ; + break; + case SAMPR_48: + rate = WM8731_USB24_48000HZ; + break; + case SAMPR_44: + rate = WM8731_USB24_44100HZ; + break; + case SAMPR_32: + rate = WM8731_USB24_32000HZ; + break; + case SAMPR_8: + rate = WM8731_USB24_8000HZ; + break; + } codec_set_active(false); - wmcodec_write(SAMPCTRL, sampling_control); + wmcodec_write(SAMPCTRL, rate); codec_set_active(true); } diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h index 071fb0f650..d38a5df636 100644 --- a/firmware/export/config-h10.h +++ b/firmware/export/config-h10.h @@ -18,10 +18,12 @@ #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO) /* define the bitmask of hardware sample rates */ -#define HW_SAMPR_CAPS (SAMPR_CAP_44) +#define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) /* define the bitmask of recording sample rates */ -#define REC_SAMPR_CAPS (SAMPR_CAP_44) +#define REC_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) /* define this if you have a bitmap LCD display */ #define HAVE_LCD_BITMAP diff --git a/firmware/export/config-h10_5gb.h b/firmware/export/config-h10_5gb.h index e7c77e4f4d..56a61c8be5 100644 --- a/firmware/export/config-h10_5gb.h +++ b/firmware/export/config-h10_5gb.h @@ -18,10 +18,12 @@ #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO) /* define the bitmask of hardware sample rates */ -#define HW_SAMPR_CAPS (SAMPR_CAP_44) +#define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) /* define the bitmask of recording sample rates */ -#define REC_SAMPR_CAPS (SAMPR_CAP_44) +#define REC_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) /* define this if you have a bitmap LCD display */ #define HAVE_LCD_BITMAP diff --git a/firmware/export/config-hdd1630.h b/firmware/export/config-hdd1630.h index 5b89bded21..55ad5a1340 100755 --- a/firmware/export/config-hdd1630.h +++ b/firmware/export/config-hdd1630.h @@ -19,10 +19,12 @@ #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO) /* define the bitmask of hardware sample rates */ -#define HW_SAMPR_CAPS (SAMPR_CAP_44) +#define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) /* define the bitmask of recording sample rates */ -#define REC_SAMPR_CAPS (SAMPR_CAP_44) +#define REC_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) /* define this if you have a bitmap LCD display */ #define HAVE_LCD_BITMAP diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index 6c78f408bf..d5b593388e 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h @@ -17,6 +17,14 @@ /* define this if you have recording possibility */ /*#define HAVE_RECORDING*/ +/* define the bitmask of hardware sample rates */ +#define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) + +/* define the bitmask of recording sample rates +#define REC_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) */ + /* define this if you have a bitmap LCD display */ #define HAVE_LCD_BITMAP diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index b5c566f4c5..eadd3a6b1d 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h @@ -16,6 +16,14 @@ /* define this if you have recording possibility */ /*#define HAVE_RECORDING*/ +/* define the bitmask of hardware sample rates */ +#define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) + +/* define the bitmask of recording sample rates +#define REC_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) */ + /* define this if you have a bitmap LCD display */ #define HAVE_LCD_BITMAP diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index 6a6ab7b07a..259cb2f874 100644 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h @@ -16,6 +16,14 @@ /* define this if you have recording possibility */ /*#define HAVE_RECORDING*/ +/* define the bitmask of hardware sample rates */ +#define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) + +/* define the bitmask of recording sample rates +#define REC_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) */ + /* define this if you have a bitmap LCD display */ #define HAVE_LCD_BITMAP diff --git a/firmware/export/config-tpj1022.h b/firmware/export/config-tpj1022.h index ea235edc24..5307074aa1 100644 --- a/firmware/export/config-tpj1022.h +++ b/firmware/export/config-tpj1022.h @@ -15,6 +15,14 @@ /* define this if you have recording possibility */ /*#define HAVE_RECORDING*/ /* TODO: add support for this */ +/* define the bitmask of hardware sample rates */ +#define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) + +/* define the bitmask of recording sample rates +#define REC_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_48 | \ + SAMPR_CAP_44 | SAMPR_CAP_32 | SAMPR_CAP_8) */ + /* define this if you have a bitmap LCD display */ #define HAVE_LCD_BITMAP diff --git a/firmware/target/arm/pcm-pp.c b/firmware/target/arm/pcm-pp.c index 38fd49165e..e37ee9aaad 100644 --- a/firmware/target/arm/pcm-pp.c +++ b/firmware/target/arm/pcm-pp.c @@ -94,9 +94,13 @@ static int sr_ctrl = MROBE100_44100HZ; #endif void pcm_set_frequency(unsigned int frequency) -{ - (void)frequency; +{ +#ifdef HAVE_WM8731 + pcm_freq = frequency; +#else + (void)frequency; pcm_freq = HW_SAMPR_DEFAULT; +#endif #ifdef HAVE_WM8751 sr_ctrl = MROBE100_44100HZ; #endif @@ -107,6 +111,10 @@ void pcm_apply_settings(void) #ifdef HAVE_WM8751 audiohw_set_frequency(sr_ctrl); #endif + +#ifdef HAVE_WM8731 + audiohw_set_sample_rate(pcm_freq); +#endif pcm_curr_sampr = pcm_freq; } -- cgit v1.2.3