@@ -41,6 +41,7 @@ static struct workqueue_struct *wm8971_workq;
/* codec private data */
struct wm8971_priv {
unsigned int sysclk;
+ struct snd_pcm_hw_constraint_list *sysclk_constraints;
int playback_fs;
bool deemph;
};
@@ -528,6 +529,53 @@ static int get_coeff(int mclk, int rate)
return -EINVAL;
}
+/* The set of rates we can generate from the above for each SYSCLK */
+static const unsigned int rates_12288[] = {
+ 8000, 12000, 16000, 24000, 32000, 48000, 96000
+};
+
+static struct snd_pcm_hw_constraint_list constraints_12288 = {
+ .count = ARRAY_SIZE(rates_12288),
+ .list = rates_12288,
+};
+
+static const unsigned int rates_112896[] = {
+ 8000, 11025, 22050, 44100, 88200
+};
+
+static struct snd_pcm_hw_constraint_list constraints_112896 = {
+ .count = ARRAY_SIZE(rates_112896),
+ .list = rates_112896,
+};
+
+static const unsigned int rates_18432[] = {
+ 8000, 12000, 16000, 24000, 32000, 48000, 96000
+};
+
+static struct snd_pcm_hw_constraint_list constraints_18432 = {
+ .count = ARRAY_SIZE(rates_18432),
+ .list = rates_18432,
+};
+
+static const unsigned int rates_169344[] = {
+ 8000, 11025, 22050, 44100, 88200
+};
+
+static struct snd_pcm_hw_constraint_list constraints_169344 = {
+ .count = ARRAY_SIZE(rates_169344),
+ .list = rates_169344,
+};
+
+static const unsigned int rates_12[] = {
+ 8000, 11025, 12000, 16000, 22050, 2400, 32000, 41100, 48000,
+ 48000, 88235, 96000,
+};
+
+static struct snd_pcm_hw_constraint_list constraints_12 = {
+ .count = ARRAY_SIZE(rates_12),
+ .list = rates_12,
+};
+
static int wm8971_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{
@@ -535,15 +583,32 @@ static int wm8971_set_dai_sysclk(struct snd_soc_dai *codec_dai,
struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec);
switch (freq) {
- case 11289600:
- case 12000000:
case 12288000:
- case 16934400:
+ case 24576000:
+ wm8971->sysclk_constraints = &constraints_12288;
+ break;
+ case 11289600:
+ case 22579200:
+ wm8971->sysclk_constraints = &constraints_112896;
+ break;
case 18432000:
- wm8971->sysclk = freq;
- return 0;
+ wm8971->sysclk_constraints = &constraints_18432;
+ break;
+ case 16934400:
+ case 33868800:
+ wm8971->sysclk_constraints = &constraints_169344;
+ break;
+ case 12000000:
+ case 24000000:
+ wm8971->sysclk_constraints = &constraints_12;
+ break;
+ default:
+ return -EINVAL;
}
- return -EINVAL;
+
+ wm8971->sysclk = freq;
+
+ return 0;
}
static int wm8971_set_dai_fmt(struct snd_soc_dai *codec_dai,