summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Yan <juyan@nvidia.com>2014-03-24 19:10:32 -0700
committerManish Tuteja <mtuteja@nvidia.com>2014-07-30 21:18:46 -0700
commit282fa8e2055eea1364b5864b0b997f30890107f8 (patch)
tree8aeb8f9d1151db1a19cb9bd0bdbb52442fa4ef6d
parent16971c4be6bbf07ded3c7d35e60e0ffaf7fccef5 (diff)
sound: Add blacklist for audio devices
Prevent specified audio devices from sending uevents upon connection/disconnection. Bug 1474213 Change-Id: I532968ed9717dc18db62671deedd60bb4a38463e Signed-off-by: Jun Yan <juyan@nvidia.com> Reviewed-on: http://git-master/r/385931 GVS: Gerrit_Virtual_Submit Reviewed-by: Rahul Mittal <rmittal@nvidia.com> Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com> Reviewed-by: Pierre Gervais <pgervais@nvidia.com> (cherry picked from commit 553636416a0700b354385d7a508d67653814272d) Reviewed-on: http://git-master/r/449065 Reviewed-by: Jason Roche <jroche@nvidia.com> Tested-by: Anshul Jain (SW) <anshulj@nvidia.com> Reviewed-by: Anshul Jain (SW) <anshulj@nvidia.com>
-rw-r--r--sound/usb/card.c29
-rw-r--r--sound/usb/nonswitch-table.h24
2 files changed, 50 insertions, 3 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 58c8df39b3f9..9b03643bdb42 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -88,6 +88,7 @@ static int nrpacks = 8; /* max. number of packets per urb */
static bool async_unlink = 1;
static int device_setup[SNDRV_CARDS]; /* device parameter for this card */
static bool ignore_ctl_error;
+static int usb_nonswitch_match(struct usb_device* udev);
module_param_array(index, int, NULL, 0444);
MODULE_PARM_DESC(index, "Index value for the USB audio adapter.");
@@ -539,7 +540,8 @@ snd_usb_audio_probe(struct usb_device *dev,
}
#ifdef CONFIG_SWITCH
- switch_set_state(&usb_switch_dev, STATE_CONNECTED);
+ if (!usb_nonswitch_match(dev))
+ switch_set_state(&usb_switch_dev, STATE_CONNECTED);
#endif
usb_chip[chip->index] = chip;
@@ -570,6 +572,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
{
struct snd_card *card;
struct list_head *p;
+ int i;
if (chip == (void *)-1L)
return;
@@ -581,7 +584,12 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
chip->num_interfaces--;
#ifdef CONFIG_SWITCH
- switch_set_state(&usb_switch_dev, STATE_DISCONNECTED);
+ for (i = 0; i < chip->index; i++) {
+ if (usb_chip[i] && !usb_nonswitch_match(usb_chip[i]->dev))
+ break;
+ }
+ if ((i == chip->index) && !usb_nonswitch_match(dev))
+ switch_set_state(&usb_switch_dev, STATE_DISCONNECTED);
#endif
if (chip->num_interfaces <= 0) {
@@ -720,7 +728,22 @@ static struct usb_device_id usb_audio_ids [] = {
{ } /* Terminating entry */
};
-MODULE_DEVICE_TABLE (usb, usb_audio_ids);
+#ifdef CONFIG_SWITCH
+static struct usb_device_id usb_nonswitch_ids [] = {
+#include "nonswitch-table.h"
+ { }
+};
+
+static int usb_nonswitch_match(struct usb_device* udev) {
+ int i;
+ for(i = 0; i < sizeof(usb_nonswitch_ids); i++) {
+ if ((usb_nonswitch_ids[i].idVendor == udev->descriptor.idVendor) &&
+ (usb_nonswitch_ids[i].idProduct == udev->descriptor.idProduct))
+ return 1;
+ }
+ return 0;
+}
+#endif
/*
* entry point for linux usb interface
diff --git a/sound/usb/nonswitch-table.h b/sound/usb/nonswitch-table.h
new file mode 100644
index 000000000000..518055885dbb
--- /dev/null
+++ b/sound/usb/nonswitch-table.h
@@ -0,0 +1,24 @@
+/*
+ * USB nonswitch table
+ *
+ * Copyright (c) 2014, NVIDIA Corporation. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* Some USB Sound device depends on other conditions to prempt sound play/acquire.
+ * Prevent them from sending uevent upon connection/disconnection
+ */
+{
+ USB_DEVICE(0x0955, 0x7210),//This is the VID and PID for Blake device
+},