Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5495ffbd authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Takashi Iwai
Browse files

ALSA: via82xx: allow to disable the SRC



Add the PCM rule to allow disabling the PCM playback SRC.

Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 57e5c630
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -1175,6 +1175,7 @@ static int snd_via82xx_pcm_open(struct via82xx *chip, struct viadev *viadev,
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct snd_pcm_runtime *runtime = substream->runtime;
	int err;
	int err;
	struct via_rate_lock *ratep;
	struct via_rate_lock *ratep;
	bool use_src = false;


	runtime->hw = snd_via82xx_hw;
	runtime->hw = snd_via82xx_hw;
	
	
@@ -1196,6 +1197,7 @@ static int snd_via82xx_pcm_open(struct via82xx *chip, struct viadev *viadev,
				     SNDRV_PCM_RATE_8000_48000);
				     SNDRV_PCM_RATE_8000_48000);
		runtime->hw.rate_min = 8000;
		runtime->hw.rate_min = 8000;
		runtime->hw.rate_max = 48000;
		runtime->hw.rate_max = 48000;
		use_src = true;
	} else if (! ratep->rate) {
	} else if (! ratep->rate) {
		int idx = viadev->direction ? AC97_RATES_ADC : AC97_RATES_FRONT_DAC;
		int idx = viadev->direction ? AC97_RATES_ADC : AC97_RATES_FRONT_DAC;
		runtime->hw.rates = chip->ac97->rates[idx];
		runtime->hw.rates = chip->ac97->rates[idx];
@@ -1212,6 +1214,12 @@ static int snd_via82xx_pcm_open(struct via82xx *chip, struct viadev *viadev,
	if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
	if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
		return err;
		return err;


	if (use_src) {
		err = snd_pcm_hw_rule_noresample(runtime, 48000);
		if (err < 0)
			return err;
	}

	runtime->private_data = viadev;
	runtime->private_data = viadev;
	viadev->substream = substream;
	viadev->substream = substream;