summaryrefslogtreecommitdiffstats
path: root/firmware/drivers
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2017-10-01 16:13:54 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2017-10-01 17:23:43 +0200
commita82ebac53a23867452a62e3bd6c2516679ac95d8 (patch)
treea03b0986f141e882f12d66b0fc05825b2008e40b /firmware/drivers
parent50e93d56874dec894b81fa6fcfecc6d46525ee2a (diff)
downloadrockbox-a82ebac53a23867452a62e3bd6c2516679ac95d8.tar.gz
rockbox-a82ebac53a23867452a62e3bd6c2516679ac95d8.tar.bz2
rockbox-a82ebac53a23867452a62e3bd6c2516679ac95d8.zip
sonynwza10/a20: enable pcm frequency selection
Change-Id: I335fcdbb652253e777d0d7406545d0d44d98f4f0
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/audio/nwzlinux-codec.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/firmware/drivers/audio/nwzlinux-codec.c b/firmware/drivers/audio/nwzlinux-codec.c
index aa0c7efcf8..36ebaa8b79 100644
--- a/firmware/drivers/audio/nwzlinux-codec.c
+++ b/firmware/drivers/audio/nwzlinux-codec.c
@@ -84,6 +84,15 @@ numid=4,iface=MIXER,name='Output Switch'
; Item #2 'LineFixed'
; Item #3 'Speaker'
: values=0
+numid=6,iface=MIXER,name='Sampling Rate'
+ ; type=ENUMERATED,access=rw------,values=1,items=6
+ ; Item #0 '44100'
+ ; Item #1 '48000'
+ ; Item #2 '88200'
+ ; Item #3 '96000'
+ ; Item #4 '176400'
+ ; Item #5 '192000'
+ : values=0
*/
/* List of various codecs used by Sony */
@@ -111,6 +120,8 @@ static int fd_noican;
static int fd_hw;
/* Codec */
static enum nwz_codec_t nwz_codec;
+/* does the code support setting the sample rate? */
+static bool has_sample_rate;
static enum nwz_codec_t find_codec(void)
{
@@ -284,6 +295,8 @@ void audiohw_preinit(void)
alsa_controls_set_enum("Output Switch", "Headphone");
/* unmute */
alsa_controls_set_bool("CODEC Mute Switch", false);
+ /* sample rate */
+ has_sample_rate = alsa_has_control("Sampling Rate");
/* init noican */
noican_init();
@@ -381,5 +394,11 @@ void audiohw_close(void)
void audiohw_set_frequency(int fsel)
{
- (void) fsel;
+ if(has_sample_rate)
+ {
+ /* it's slightly annoying that Sony put the value in an enum with strings... */
+ char freq_str[16];
+ sprintf(freq_str, "%d", fsel);
+ alsa_controls_set_enum("Sampling Rate", freq_str);
+ }
}