diff options
author | Philippe Langlais <philippe.langlais@linaro.org> | 2012-03-16 08:54:45 +0100 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 11:05:49 +0200 |
commit | 3b0eed01715de3c6c918ef542d9a86aebf527bac (patch) | |
tree | 35b62a724ba51a5116e6de38b6cc32616441fd2a | |
parent | 16be2ec95a152e65a7522f23a4c9d019325cc41d (diff) |
[Android] USB sound: Add an uevent for USB audio device plug/unplugaudio-android
Send an uevent when an usb audio device (headset) is plugged or unplugged.
They will be use by android framework for the audio accessory detection.
ST-Ericsson ID: 398326
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: I73d1b81d9f6a53be038bb0aa97cbb4ebc696f916
Signed-off-by: Deepak Karda <deepak.karda@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/41288
Reviewed-by: Christophe PRIOUZEAU <christophe.priouzeau@stericsson.com>
Reviewed-by: Robert LIND <robert.lind@stericsson.com>
Reviewed-by: Devinder THAKUR <devinder.thakur@stericsson.com>
Reviewed-by: Hakan GARDRUP <hakan.gardrup@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/42055
Reviewed-by: QABUILD
Reviewed-by: QATEST
Tested-by: Axel FAGERSTEDT <axel.fagerstedt@stericsson.com>
Reviewed-by: Rajaram REGUPATHY <ragupathy.rajaram@stericsson.com>
Reviewed-by: Rabin VINCENT <rabin.vincent@stericsson.com>
-rw-r--r-- | sound/usb/card.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c index e667491baee..d18d7ea63fe 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -48,6 +48,7 @@ #include <linux/usb/audio.h> #include <linux/usb/audio-v2.h> #include <linux/module.h> +#include <linux/switch.h> #include <sound/control.h> #include <sound/core.h> @@ -87,6 +88,8 @@ static bool async_unlink = 1; static int device_setup[SNDRV_CARDS]; /* device parameter for this card */ static bool ignore_ctl_error; +struct switch_dev switch_audio_detection; + module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for the USB audio adapter."); module_param_array(id, charp, NULL, 0444); @@ -597,6 +600,7 @@ static int usb_audio_probe(struct usb_interface *intf, chip = snd_usb_audio_probe(interface_to_usbdev(intf), intf, id); if (chip) { usb_set_intfdata(intf, chip); + switch_set_state(&switch_audio_detection, 1); return 0; } else return -EIO; @@ -604,6 +608,7 @@ static int usb_audio_probe(struct usb_interface *intf, static void usb_audio_disconnect(struct usb_interface *intf) { + switch_set_state(&switch_audio_detection, 0); snd_usb_audio_disconnect(interface_to_usbdev(intf), usb_get_intfdata(intf)); } @@ -721,11 +726,15 @@ static int __init snd_usb_audio_init(void) printk(KERN_WARNING "invalid nrpacks value.\n"); return -EINVAL; } + + switch_audio_detection.name = "usb_audio"; + switch_dev_register(&switch_audio_detection); return usb_register(&usb_audio_driver); } static void __exit snd_usb_audio_cleanup(void) { + switch_dev_unregister(&switch_audio_detection); usb_deregister(&usb_audio_driver); } |