summaryrefslogtreecommitdiff
path: root/firmware/target/arm/sandisk/audio-c200_e200.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/sandisk/audio-c200_e200.c')
-rw-r--r--firmware/target/arm/sandisk/audio-c200_e200.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/firmware/target/arm/sandisk/audio-c200_e200.c b/firmware/target/arm/sandisk/audio-c200_e200.c
index 2f6bde1b98..4de7aa62c3 100644
--- a/firmware/target/arm/sandisk/audio-c200_e200.c
+++ b/firmware/target/arm/sandisk/audio-c200_e200.c
@@ -186,16 +186,25 @@ void audiohw_set_sampr_dividers(int fsel)
186 IISDIV = (IISDIV & ~0xc000003f) | regvals[fsel].iisdiv; 186 IISDIV = (IISDIV & ~0xc000003f) | regvals[fsel].iisdiv;
187} 187}
188 188
189#ifdef HAVE_RECORDING 189#ifdef CONFIG_SAMPR_TYPES
190unsigned int pcm_sampr_type_rec_to_play(unsigned int samplerate) 190unsigned int pcm_sampr_to_hw_sampr(unsigned int samplerate,
191 unsigned int type)
191{ 192{
192 /* Check if the samplerate is in the list of recordable rates. 193#ifdef HAVE_RECORDING
193 * Fail to default if not */ 194 if (samplerate != HW_SAMPR_RESET && type == SAMPR_TYPE_REC)
194 int index = round_value_to_list32(samplerate, rec_freq_sampr, 195 {
195 REC_NUM_FREQ, false); 196 /* Check if the samplerate is in the list of recordable rates.
196 if (samplerate != rec_freq_sampr[index]) 197 * Fail to default if not */
197 return HW_SAMPR_DEFAULT; 198 int index = round_value_to_list32(samplerate, rec_freq_sampr,
198 199 REC_NUM_FREQ, false);
199 return samplerate * 2; /* Recording rates are 1/2 the codec clock */ 200 if (samplerate != rec_freq_sampr[index])
201 samplerate = REC_SAMPR_DEFAULT;
202
203 samplerate *= 2; /* Recording rates are 1/2 the codec clock */
204 }
205#endif /* HAVE_RECORDING */
206
207 return samplerate;
208 (void)type;
200} 209}
201#endif 210#endif /* CONFIG_SAMPR_TYPES */