mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
sonynwza10/a20: enable pcm frequency selection
Change-Id: I335fcdbb652253e777d0d7406545d0d44d98f4f0
This commit is contained in:
parent
50e93d5687
commit
a82ebac53a
5 changed files with 41 additions and 1 deletions
|
|
@ -84,6 +84,15 @@ numid=4,iface=MIXER,name='Output Switch'
|
||||||
; Item #2 'LineFixed'
|
; Item #2 'LineFixed'
|
||||||
; Item #3 'Speaker'
|
; Item #3 'Speaker'
|
||||||
: values=0
|
: 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 */
|
/* List of various codecs used by Sony */
|
||||||
|
|
@ -111,6 +120,8 @@ static int fd_noican;
|
||||||
static int fd_hw;
|
static int fd_hw;
|
||||||
/* Codec */
|
/* Codec */
|
||||||
static enum nwz_codec_t nwz_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)
|
static enum nwz_codec_t find_codec(void)
|
||||||
{
|
{
|
||||||
|
|
@ -284,6 +295,8 @@ void audiohw_preinit(void)
|
||||||
alsa_controls_set_enum("Output Switch", "Headphone");
|
alsa_controls_set_enum("Output Switch", "Headphone");
|
||||||
/* unmute */
|
/* unmute */
|
||||||
alsa_controls_set_bool("CODEC Mute Switch", false);
|
alsa_controls_set_bool("CODEC Mute Switch", false);
|
||||||
|
/* sample rate */
|
||||||
|
has_sample_rate = alsa_has_control("Sampling Rate");
|
||||||
|
|
||||||
/* init noican */
|
/* init noican */
|
||||||
noican_init();
|
noican_init();
|
||||||
|
|
@ -381,5 +394,11 @@ void audiohw_close(void)
|
||||||
|
|
||||||
void audiohw_set_frequency(int fsel)
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,12 @@
|
||||||
/* There is no hardware tone control */
|
/* There is no hardware tone control */
|
||||||
#define HAVE_SW_TONE_CONTROLS
|
#define HAVE_SW_TONE_CONTROLS
|
||||||
|
|
||||||
|
/* The A15 and A25 support more sampling rates, in fact they support crazy high bit-rates such
|
||||||
|
* as 176.4 and 192 kHz but Rockbox does not support those */
|
||||||
|
#if defined(SONY_NWZA10) || defined(SONY_NWA20)
|
||||||
|
#define HW_SAMPR_CAPS (SAMPR_CAP_44 | SAMPR_CAP_48 | SAMPR_CAP_88 | SAMPR_CAP_96)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* KeyPad configuration for plugins */
|
/* KeyPad configuration for plugins */
|
||||||
#define CONFIG_KEYPAD SONY_NWZ_PAD
|
#define CONFIG_KEYPAD SONY_NWZ_PAD
|
||||||
#define HAS_BUTTON_HOLD
|
#define HAS_BUTTON_HOLD
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,15 @@ bool alsa_controls_find(snd_ctl_elem_id_t *id, const char *name)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool alsa_has_control(const char *name)
|
||||||
|
{
|
||||||
|
snd_ctl_elem_id_t *id;
|
||||||
|
/* allocate things on stack */
|
||||||
|
snd_ctl_elem_id_alloca(&id);
|
||||||
|
/* find control */
|
||||||
|
return alsa_controls_find(id, name);
|
||||||
|
}
|
||||||
|
|
||||||
/* find a control element enum index by name, return -1 if not found */
|
/* find a control element enum index by name, return -1 if not found */
|
||||||
int alsa_controls_find_enum(const char *name, const char *enum_name)
|
int alsa_controls_find_enum(const char *name, const char *enum_name)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ void alsa_controls_close(void);
|
||||||
/* find a control element ID by name, return false of not found, the id needs
|
/* find a control element ID by name, return false of not found, the id needs
|
||||||
* to be allocated */
|
* to be allocated */
|
||||||
bool alsa_controls_find(snd_ctl_elem_id_t *id, const char *name);
|
bool alsa_controls_find(snd_ctl_elem_id_t *id, const char *name);
|
||||||
|
/* check wether a control exists */
|
||||||
|
bool alsa_has_control(const char *name);
|
||||||
/* find a control element enum index by name, return -1 if not found */
|
/* find a control element enum index by name, return -1 if not found */
|
||||||
int alsa_controls_find_enum(const char *name, const char *enum_name);
|
int alsa_controls_find_enum(const char *name, const char *enum_name);
|
||||||
/* set a control, potentially supports several values */
|
/* set a control, potentially supports several values */
|
||||||
|
|
|
||||||
|
|
@ -479,6 +479,10 @@ static void pcm_dma_apply_settings_nolock(void)
|
||||||
{
|
{
|
||||||
snd_pcm_drop(handle);
|
snd_pcm_drop(handle);
|
||||||
set_hwparams(handle, pcm_sampr);
|
set_hwparams(handle, pcm_sampr);
|
||||||
|
#if defined(HAVE_NWZ_LINUX_CODEC)
|
||||||
|
/* Sony NWZ linux driver uses a nonstandard mecanism to set the sampling rate */
|
||||||
|
audiohw_set_frequency(pcm_sampr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcm_dma_apply_settings(void)
|
void pcm_dma_apply_settings(void)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue