+/*
+ * set rate constraints
+ */
+static int set_rate_constraints(ice1712_t *ice, snd_pcm_substream_t *substream)
+{
+ snd_pcm_runtime_t *runtime = substream->runtime;
+ if (ice->eeprom.data[ICE_EEP2_ACLINK] & 0x80) {
+ /* I2S */
+ if (ice->eeprom.data[ICE_EEP2_I2S] & 0x08)
+ return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_192);
+ else {
+ runtime->hw.rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_96000;
+ runtime->hw.rate_max = 96000;
+ return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_96);
+ }
+ } else if (ice->ac97) {
+ /* ACLINK */
+ int ratec;
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ ratec = AC97_RATES_FRONT_DAC;
+ else
+ ratec = AC97_RATES_ADC;
+ runtime->hw.rates = ice->ac97->rates[ratec];
+ runtime->hw.rate_max = 48000;
+ if (runtime->hw.rates == SNDRV_PCM_RATE_48000) {
+ runtime->hw.rate_min = 48000;
+ return 0;
+ } else {
+ runtime->hw.rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_48000;
+ return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_48);
+ }
+ }
+ return 0;
+}
+