]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.1 patches
authorGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Nov 2011 19:01:23 +0000 (11:01 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Nov 2011 19:01:23 +0000 (11:01 -0800)
added patches:
alsa-usb-audio-check-the-db-range-validity-in-the-later-read-too.patch
alsa-usb-audio-fix-the-missing-volume-quirks-at-delayed-init.patch

queue-3.1/alsa-usb-audio-check-the-db-range-validity-in-the-later-read-too.patch [new file with mode: 0644]
queue-3.1/alsa-usb-audio-fix-the-missing-volume-quirks-at-delayed-init.patch [new file with mode: 0644]
queue-3.1/series

diff --git a/queue-3.1/alsa-usb-audio-check-the-db-range-validity-in-the-later-read-too.patch b/queue-3.1/alsa-usb-audio-check-the-db-range-validity-in-the-later-read-too.patch
new file mode 100644 (file)
index 0000000..9a46648
--- /dev/null
@@ -0,0 +1,42 @@
+From 9fcd0ab130579d9742538340edda3225f2b49a3e Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 19 Aug 2011 08:30:53 +0200
+Subject: ALSA: usb-audio - Check the dB-range validity in the later read, too
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 9fcd0ab130579d9742538340edda3225f2b49a3e upstream.
+
+When the initial check of dB-range failed due to the read error, try to
+check again at the later read, too.  When an invalid dB range is found,
+remove TLV flags and notify the mixer info change.
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ sound/usb/mixer.c |   13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+--- a/sound/usb/mixer.c
++++ b/sound/usb/mixer.c
+@@ -881,8 +881,17 @@ static int mixer_ctl_feature_info(struct
+               uinfo->value.integer.min = 0;
+               uinfo->value.integer.max = 1;
+       } else {
+-              if (! cval->initialized)
+-                      get_min_max(cval,  0);
++              if (!cval->initialized) {
++                      get_min_max(cval, 0);
++                      if (cval->initialized && cval->dBmin >= cval->dBmax) {
++                              kcontrol->vd[0].access &=
++                                      ~(SNDRV_CTL_ELEM_ACCESS_TLV_READ |
++                                        SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK);
++                              snd_ctl_notify(cval->mixer->chip->card,
++                                             SNDRV_CTL_EVENT_MASK_INFO,
++                                             &kcontrol->id);
++                      }
++              }
+               uinfo->value.integer.min = 0;
+               uinfo->value.integer.max =
+                       (cval->max - cval->min + cval->res - 1) / cval->res;
diff --git a/queue-3.1/alsa-usb-audio-fix-the-missing-volume-quirks-at-delayed-init.patch b/queue-3.1/alsa-usb-audio-fix-the-missing-volume-quirks-at-delayed-init.patch
new file mode 100644 (file)
index 0000000..b952a3c
--- /dev/null
@@ -0,0 +1,190 @@
+From dcaaf9f2c16b56f8bb316881fcd3f15c18fc71e7 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 8 Nov 2011 17:50:27 +0100
+Subject: ALSA: usb-audio - Fix the missing volume quirks at delayed init
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit dcaaf9f2c16b56f8bb316881fcd3f15c18fc71e7 upstream.
+
+In the recent usb-audio driver, the initialization of volume ranges
+may be delayed when the device doesn't respond well at the probing time.
+But the volume quirks for certain devices are applied only in
+mixer_ctl_feature_info() thus only at the very first probe and will be
+missing when the volume range is initialized later.
+
+This patch moves the volume quirk code to be always called from the
+volume-range extraction (get_min_max()), so that the quirks are properly
+applied in the later init time.
+
+Reported-and-tested-by: Alexey Fisher <bug-track@fisher-privat.net>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ sound/usb/mixer.c |  109 +++++++++++++++++++++++++++++-------------------------
+ 1 file changed, 59 insertions(+), 50 deletions(-)
+
+--- a/sound/usb/mixer.c
++++ b/sound/usb/mixer.c
+@@ -765,10 +765,60 @@ static void usb_mixer_elem_free(struct s
+  * interface to ALSA control for feature/mixer units
+  */
++/* volume control quirks */
++static void volume_control_quirks(struct usb_mixer_elem_info *cval,
++                                struct snd_kcontrol *kctl)
++{
++      switch (cval->mixer->chip->usb_id) {
++      case USB_ID(0x0471, 0x0101):
++      case USB_ID(0x0471, 0x0104):
++      case USB_ID(0x0471, 0x0105):
++      case USB_ID(0x0672, 0x1041):
++      /* quirk for UDA1321/N101.
++       * note that detection between firmware 2.1.1.7 (N101)
++       * and later 2.1.1.21 is not very clear from datasheets.
++       * I hope that the min value is -15360 for newer firmware --jk
++       */
++              if (!strcmp(kctl->id.name, "PCM Playback Volume") &&
++                  cval->min == -15616) {
++                      snd_printk(KERN_INFO
++                               "set volume quirk for UDA1321/N101 chip\n");
++                      cval->max = -256;
++              }
++              break;
++
++      case USB_ID(0x046d, 0x09a4):
++              if (!strcmp(kctl->id.name, "Mic Capture Volume")) {
++                      snd_printk(KERN_INFO
++                              "set volume quirk for QuickCam E3500\n");
++                      cval->min = 6080;
++                      cval->max = 8768;
++                      cval->res = 192;
++              }
++              break;
++
++      case USB_ID(0x046d, 0x0808):
++      case USB_ID(0x046d, 0x0809):
++      case USB_ID(0x046d, 0x0991):
++      /* Most audio usb devices lie about volume resolution.
++       * Most Logitech webcams have res = 384.
++       * Proboly there is some logitech magic behind this number --fishor
++       */
++              if (!strcmp(kctl->id.name, "Mic Capture Volume")) {
++                      snd_printk(KERN_INFO
++                              "set resolution quirk: cval->res = 384\n");
++                      cval->res = 384;
++              }
++              break;
++
++      }
++}
++
+ /*
+  * retrieve the minimum and maximum values for the specified control
+  */
+-static int get_min_max(struct usb_mixer_elem_info *cval, int default_min)
++static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
++                                 int default_min, struct snd_kcontrol *kctl)
+ {
+       /* for failsafe */
+       cval->min = default_min;
+@@ -844,6 +894,9 @@ static int get_min_max(struct usb_mixer_
+               cval->initialized = 1;
+       }
++      if (kctl)
++              volume_control_quirks(cval, kctl);
++
+       /* USB descriptions contain the dB scale in 1/256 dB unit
+        * while ALSA TLV contains in 1/100 dB unit
+        */
+@@ -864,6 +917,7 @@ static int get_min_max(struct usb_mixer_
+       return 0;
+ }
++#define get_min_max(cval, def)        get_min_max_with_quirks(cval, def, NULL)
+ /* get a feature/mixer unit info */
+ static int mixer_ctl_feature_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
+@@ -882,7 +936,7 @@ static int mixer_ctl_feature_info(struct
+               uinfo->value.integer.max = 1;
+       } else {
+               if (!cval->initialized) {
+-                      get_min_max(cval, 0);
++                      get_min_max_with_quirks(cval, 0, kcontrol);
+                       if (cval->initialized && cval->dBmin >= cval->dBmax) {
+                               kcontrol->vd[0].access &=
+                                       ~(SNDRV_CTL_ELEM_ACCESS_TLV_READ |
+@@ -1045,9 +1099,6 @@ static void build_feature_ctl(struct mix
+               cval->ch_readonly = readonly_mask;
+       }
+-      /* get min/max values */
+-      get_min_max(cval, 0);
+-
+       /* if all channels in the mask are marked read-only, make the control
+        * read-only. set_cur_mix_value() will check the mask again and won't
+        * issue write commands to read-only channels. */
+@@ -1069,6 +1120,9 @@ static void build_feature_ctl(struct mix
+               len = snd_usb_copy_string_desc(state, nameid,
+                               kctl->id.name, sizeof(kctl->id.name));
++      /* get min/max values */
++      get_min_max_with_quirks(cval, 0, kctl);
++
+       switch (control) {
+       case UAC_FU_MUTE:
+       case UAC_FU_VOLUME:
+@@ -1118,51 +1172,6 @@ static void build_feature_ctl(struct mix
+               break;
+       }
+-      /* volume control quirks */
+-      switch (state->chip->usb_id) {
+-      case USB_ID(0x0471, 0x0101):
+-      case USB_ID(0x0471, 0x0104):
+-      case USB_ID(0x0471, 0x0105):
+-      case USB_ID(0x0672, 0x1041):
+-      /* quirk for UDA1321/N101.
+-       * note that detection between firmware 2.1.1.7 (N101)
+-       * and later 2.1.1.21 is not very clear from datasheets.
+-       * I hope that the min value is -15360 for newer firmware --jk
+-       */
+-              if (!strcmp(kctl->id.name, "PCM Playback Volume") &&
+-                  cval->min == -15616) {
+-                      snd_printk(KERN_INFO
+-                               "set volume quirk for UDA1321/N101 chip\n");
+-                      cval->max = -256;
+-              }
+-              break;
+-
+-      case USB_ID(0x046d, 0x09a4):
+-              if (!strcmp(kctl->id.name, "Mic Capture Volume")) {
+-                      snd_printk(KERN_INFO
+-                              "set volume quirk for QuickCam E3500\n");
+-                      cval->min = 6080;
+-                      cval->max = 8768;
+-                      cval->res = 192;
+-              }
+-              break;
+-
+-      case USB_ID(0x046d, 0x0808):
+-      case USB_ID(0x046d, 0x0809):
+-      case USB_ID(0x046d, 0x0991):
+-      /* Most audio usb devices lie about volume resolution.
+-       * Most Logitech webcams have res = 384.
+-       * Proboly there is some logitech magic behind this number --fishor
+-       */
+-              if (!strcmp(kctl->id.name, "Mic Capture Volume")) {
+-                      snd_printk(KERN_INFO
+-                              "set resolution quirk: cval->res = 384\n");
+-                      cval->res = 384;
+-              }
+-              break;
+-
+-      }
+-
+       range = (cval->max - cval->min) / cval->res;
+       /* Are there devices with volume range more than 255? I use a bit more
+        * to be sure. 384 is a resolution magic number found on Logitech
index cf247f14348c3b359a9ba573713abec2a4899f61..dc44227ce6783d6a518c2c379f7501d8dad3f461 100644 (file)
@@ -7,3 +7,5 @@ sh-fix-cached-uncaced-address-calculation-in-29bit-mode.patch
 drm-i915-fix-object-refcount-leak-on-mmappable-size-limit-error-path.patch
 drm-nouveau-initialize-chan-fence.lock-before-use.patch
 drm-radeon-kms-make-an-aux-failure-debug-only.patch
+alsa-usb-audio-check-the-db-range-validity-in-the-later-read-too.patch
+alsa-usb-audio-fix-the-missing-volume-quirks-at-delayed-init.patch