stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: tiwai@suse.de, gregkh@linuxfoundation.org, maeda1@free.fr
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "ALSA: rme96: Fix unexpected volume reset after rate changes" has been added to the 4.3-stable tree
Date: Mon, 25 Jan 2016 13:49:36 -0800	[thread overview]
Message-ID: <145375857675252@kroah.com> (raw)


This is a note to let you know that I've just added the patch titled

    ALSA: rme96: Fix unexpected volume reset after rate changes

to the 4.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     alsa-rme96-fix-unexpected-volume-reset-after-rate-changes.patch
and it can be found in the queue-4.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From a74a821624c0c75388a193337babd17a8c02c740 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Fri, 4 Dec 2015 16:44:24 +0100
Subject: ALSA: rme96: Fix unexpected volume reset after rate changes

From: Takashi Iwai <tiwai@suse.de>

commit a74a821624c0c75388a193337babd17a8c02c740 upstream.

rme96 driver needs to reset DAC depending on the sample rate, and this
results in resetting to the max volume suddenly.  It's because of the
missing call of snd_rme96_apply_dac_volume().

However, calling this function right after the DAC reset still may not
work, and we need some delay before this call.  Since the DAC reset
and the procedure after that are performed in the spinlock, we delay
the DAC volume restore at the end after the spinlock.

Reported-and-tested-by: Sylvain LABOISNE <maeda1@free.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/rme96.c |   41 ++++++++++++++++++++++++++---------------
 1 file changed, 26 insertions(+), 15 deletions(-)

--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -741,10 +741,11 @@ snd_rme96_playback_setrate(struct rme96
 	{
 		/* change to/from double-speed: reset the DAC (if available) */
 		snd_rme96_reset_dac(rme96);
+		return 1; /* need to restore volume */
 	} else {
 		writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
+		return 0;
 	}
-	return 0;
 }
 
 static int
@@ -980,6 +981,7 @@ snd_rme96_playback_hw_params(struct snd_
 	struct rme96 *rme96 = snd_pcm_substream_chip(substream);
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	int err, rate, dummy;
+	bool apply_dac_volume = false;
 
 	runtime->dma_area = (void __force *)(rme96->iobase +
 					     RME96_IO_PLAY_BUFFER);
@@ -993,24 +995,26 @@ snd_rme96_playback_hw_params(struct snd_
 	{
                 /* slave clock */
                 if ((int)params_rate(params) != rate) {
-			spin_unlock_irq(&rme96->lock);
-			return -EIO;                    
-                }
-	} else if ((err = snd_rme96_playback_setrate(rme96, params_rate(params))) < 0) {
-		spin_unlock_irq(&rme96->lock);
-		return err;
-	}
-	if ((err = snd_rme96_playback_setformat(rme96, params_format(params))) < 0) {
-		spin_unlock_irq(&rme96->lock);
-		return err;
+			err = -EIO;
+			goto error;
+		}
+	} else {
+		err = snd_rme96_playback_setrate(rme96, params_rate(params));
+		if (err < 0)
+			goto error;
+		apply_dac_volume = err > 0; /* need to restore volume later? */
 	}
+
+	err = snd_rme96_playback_setformat(rme96, params_format(params));
+	if (err < 0)
+		goto error;
 	snd_rme96_setframelog(rme96, params_channels(params), 1);
 	if (rme96->capture_periodsize != 0) {
 		if (params_period_size(params) << rme96->playback_frlog !=
 		    rme96->capture_periodsize)
 		{
-			spin_unlock_irq(&rme96->lock);
-			return -EBUSY;
+			err = -EBUSY;
+			goto error;
 		}
 	}
 	rme96->playback_periodsize =
@@ -1021,9 +1025,16 @@ snd_rme96_playback_hw_params(struct snd_
 		rme96->wcreg &= ~(RME96_WCR_PRO | RME96_WCR_DOLBY | RME96_WCR_EMP);
 		writel(rme96->wcreg |= rme96->wcreg_spdif_stream, rme96->iobase + RME96_IO_CONTROL_REGISTER);
 	}
+
+	err = 0;
+ error:
 	spin_unlock_irq(&rme96->lock);
-		
-	return 0;
+	if (apply_dac_volume) {
+		usleep_range(3000, 10000);
+		snd_rme96_apply_dac_volume(rme96);
+	}
+
+	return err;
 }
 
 static int


Patches currently in stable-queue which might be from tiwai@suse.de are

queue-4.3/alsa-hda-fix-headphone-mic-input-on-a-few-dell-alc293-machines.patch
queue-4.3/alsa-hda-add-fixup-for-acer-aspire-one-cloudbook-14.patch
queue-4.3/alsa-usb-audio-add-sample-rate-inquiry-quirk-for-audioquest-dragonfly.patch
queue-4.3/alsa-hda-realtek-dell-xps-one-alc3260-speaker-no-sound-after-resume-back.patch
queue-4.3/alsa-hda-apply-hp-headphone-fixups-more-generically.patch
queue-4.3/alsa-hda-set-codec-to-d3-at-reboot-shutdown-on-thinkpads.patch
queue-4.3/alsa-hda-realtek-fix-silent-headphone-output-on-macpro-4-1-v2.patch
queue-4.3/alsa-rme96-fix-unexpected-volume-reset-after-rate-changes.patch
queue-4.3/alsa-fireworks-bebob-oxfw-dice-enable-to-make-as-built-in.patch
queue-4.3/alsa-hda-set-skl-hda-controller-power-at-freeze-and-thaw.patch
queue-4.3/alsa-hda-add-inverted-dmic-for-packard-bell-dots.patch
queue-4.3/alsa-hda-add-intel-lewisburg-device-ids-audio.patch
queue-4.3/alsa-hda-add-keycode-map-for-alc-input-device.patch
queue-4.3/alsa-hda-add-a-fixup-for-thinkpad-x1-carbon-2nd.patch
queue-4.3/alsa-hda-skip-eld-notification-during-system-suspend.patch
queue-4.3/alsa-hda-add-mic-mute-hotkey-quirk-for-lenovo-thinkcentre-aio.patch
queue-4.3/alsa-hda-disable-64bit-address-for-creative-hda-controllers.patch
queue-4.3/alsa-hda-fix-noise-on-dell-latitude-e6440.patch
queue-4.3/alsa-hda-ca0132-quirk-for-alienware-17-2015.patch
queue-4.3/alsa-usb-audio-add-a-more-accurate-volume-quirk-for-audioquest-dragonfly.patch
queue-4.3/alsa-hda-fix-headphone-noise-after-dell-xps-13-resume-back-from-s3.patch
queue-4.3/alsa-hda-fix-noise-problems-on-thinkpad-t440s.patch
queue-4.3/alsa-hda-fix-lost-4k-bdl-boundary-workaround.patch
queue-4.3/alsa-hda-apply-pin-fixup-for-hp-probook-6550b.patch
queue-4.3/alsa-hda-fixing-speaker-noise-on-the-two-latest-thinkpad-models.patch
queue-4.3/alsa-hda-apply-click-noise-workaround-for-thinkpads-generically.patch
queue-4.3/alsa-hda-fix-noise-on-gigabyte-z170x-mobo.patch

                 reply	other threads:[~2016-01-25 21:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=145375857675252@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=maeda1@free.fr \
    --cc=stable-commits@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).