summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/audio')
-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'
84 ; Item #2 'LineFixed' 84 ; Item #2 'LineFixed'
85 ; Item #3 'Speaker' 85 ; Item #3 'Speaker'
86 : values=0 86 : values=0
87numid=6,iface=MIXER,name='Sampling Rate'
88 ; type=ENUMERATED,access=rw------,values=1,items=6
89 ; Item #0 '44100'
90 ; Item #1 '48000'
91 ; Item #2 '88200'
92 ; Item #3 '96000'
93 ; Item #4 '176400'
94 ; Item #5 '192000'
95 : values=0
87*/ 96*/
88 97
89/* List of various codecs used by Sony */ 98/* List of various codecs used by Sony */
@@ -111,6 +120,8 @@ static int fd_noican;
111static int fd_hw; 120static int fd_hw;
112/* Codec */ 121/* Codec */
113static enum nwz_codec_t nwz_codec; 122static enum nwz_codec_t nwz_codec;
123/* does the code support setting the sample rate? */
124static bool has_sample_rate;
114 125
115static enum nwz_codec_t find_codec(void) 126static enum nwz_codec_t find_codec(void)
116{ 127{
@@ -284,6 +295,8 @@ void audiohw_preinit(void)
284 alsa_controls_set_enum("Output Switch", "Headphone"); 295 alsa_controls_set_enum("Output Switch", "Headphone");
285 /* unmute */ 296 /* unmute */
286 alsa_controls_set_bool("CODEC Mute Switch", false); 297 alsa_controls_set_bool("CODEC Mute Switch", false);
298 /* sample rate */
299 has_sample_rate = alsa_has_control("Sampling Rate");
287 300
288 /* init noican */ 301 /* init noican */
289 noican_init(); 302 noican_init();
@@ -381,5 +394,11 @@ void audiohw_close(void)
381 394
382void audiohw_set_frequency(int fsel) 395void audiohw_set_frequency(int fsel)
383{ 396{
384 (void) fsel; 397 if(has_sample_rate)
398 {
399 /* it's slightly annoying that Sony put the value in an enum with strings... */
400 char freq_str[16];
401 sprintf(freq_str, "%d", fsel);
402 alsa_controls_set_enum("Sampling Rate", freq_str);
403 }
385} 404}