From d7860f856f21683cba29a81f24d98a67ecf6b08f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 3 Jan 2017 20:57:14 +0100 Subject: [PATCH] 4.9-stable patches added patches: alsa-hda-ca0132-add-quirk-for-alienware-15-r2-2016.patch alsa-hda-fix-headset-mic-problem-on-a-dell-laptop.patch alsa-hda-gate-the-mic-jack-on-hp-z1-gen3-aio.patch alsa-hda-ignore-the-assoc-and-seq-when-comparing-pin-configurations.patch alsa-hda-when-comparing-pin-configurations-ignore-assoc-in-addition-to-seq.patch alsa-hiface-fix-m2tech-hiface-driver-sampling-rate-change.patch alsa-usb-audio-add-quickcam-communicate-deluxe-s7500-to-volume_control_quirks.patch usb-cdc-acm-add-device-id-for-gw-instek-afg-125.patch usb-core-usbport-use-proper-led-api-to-fix-potential-crash.patch usb-dwc3-gadget-set-pcm1-field-of-isochronous-first-trbs.patch usb-gadget-composite-always-set-ep-mult-to-a-sensible-value.patch usb-gadget-composite-correctly-initialize-ep-maxpacket.patch usb-gadget-f_uac2-fix-error-handling-at-afunc_bind.patch usb-hub-fix-auto-remount-of-safely-removed-or-ejected-usb-3-devices.patch usb-serial-kl5kusb105-fix-open-error-path.patch usb-serial-option-add-dlink-dwm-158.patch usb-serial-option-add-support-for-telit-le922a-pids-0x1040-0x1041.patch usb-uhci-report-non-pme-wakeup-signalling-for-intel-hardware.patch usbip-vudc-fix-clear-already_seen-flag-also-for-ep0.patch --- ...2-add-quirk-for-alienware-15-r2-2016.patch | 33 ++++ ...headset-mic-problem-on-a-dell-laptop.patch | 32 ++++ ...-gate-the-mic-jack-on-hp-z1-gen3-aio.patch | 68 +++++++ ...eq-when-comparing-pin-configurations.patch | 37 ++++ ...ions-ignore-assoc-in-addition-to-seq.patch | 48 +++++ ...h-hiface-driver-sampling-rate-change.patch | 35 ++++ ...eluxe-s7500-to-volume_control_quirks.patch | 42 +++++ queue-4.9/series | 19 ++ ...-add-device-id-for-gw-instek-afg-125.patch | 30 +++ ...roper-led-api-to-fix-potential-crash.patch | 74 ++++++++ ...pcm1-field-of-isochronous-first-trbs.patch | 52 ++++++ ...ways-set-ep-mult-to-a-sensible-value.patch | 66 +++++++ ...te-correctly-initialize-ep-maxpacket.patch | 41 +++++ ...ac2-fix-error-handling-at-afunc_bind.patch | 71 ++++++++ ...ely-removed-or-ejected-usb-3-devices.patch | 171 ++++++++++++++++++ ...erial-kl5kusb105-fix-open-error-path.patch | 72 ++++++++ .../usb-serial-option-add-dlink-dwm-158.patch | 29 +++ ...-for-telit-le922a-pids-0x1040-0x1041.patch | 44 +++++ ...wakeup-signalling-for-intel-hardware.patch | 38 ++++ ...clear-already_seen-flag-also-for-ep0.patch | 39 ++++ 20 files changed, 1041 insertions(+) create mode 100644 queue-4.9/alsa-hda-ca0132-add-quirk-for-alienware-15-r2-2016.patch create mode 100644 queue-4.9/alsa-hda-fix-headset-mic-problem-on-a-dell-laptop.patch create mode 100644 queue-4.9/alsa-hda-gate-the-mic-jack-on-hp-z1-gen3-aio.patch create mode 100644 queue-4.9/alsa-hda-ignore-the-assoc-and-seq-when-comparing-pin-configurations.patch create mode 100644 queue-4.9/alsa-hda-when-comparing-pin-configurations-ignore-assoc-in-addition-to-seq.patch create mode 100644 queue-4.9/alsa-hiface-fix-m2tech-hiface-driver-sampling-rate-change.patch create mode 100644 queue-4.9/alsa-usb-audio-add-quickcam-communicate-deluxe-s7500-to-volume_control_quirks.patch create mode 100644 queue-4.9/usb-cdc-acm-add-device-id-for-gw-instek-afg-125.patch create mode 100644 queue-4.9/usb-core-usbport-use-proper-led-api-to-fix-potential-crash.patch create mode 100644 queue-4.9/usb-dwc3-gadget-set-pcm1-field-of-isochronous-first-trbs.patch create mode 100644 queue-4.9/usb-gadget-composite-always-set-ep-mult-to-a-sensible-value.patch create mode 100644 queue-4.9/usb-gadget-composite-correctly-initialize-ep-maxpacket.patch create mode 100644 queue-4.9/usb-gadget-f_uac2-fix-error-handling-at-afunc_bind.patch create mode 100644 queue-4.9/usb-hub-fix-auto-remount-of-safely-removed-or-ejected-usb-3-devices.patch create mode 100644 queue-4.9/usb-serial-kl5kusb105-fix-open-error-path.patch create mode 100644 queue-4.9/usb-serial-option-add-dlink-dwm-158.patch create mode 100644 queue-4.9/usb-serial-option-add-support-for-telit-le922a-pids-0x1040-0x1041.patch create mode 100644 queue-4.9/usb-uhci-report-non-pme-wakeup-signalling-for-intel-hardware.patch create mode 100644 queue-4.9/usbip-vudc-fix-clear-already_seen-flag-also-for-ep0.patch diff --git a/queue-4.9/alsa-hda-ca0132-add-quirk-for-alienware-15-r2-2016.patch b/queue-4.9/alsa-hda-ca0132-add-quirk-for-alienware-15-r2-2016.patch new file mode 100644 index 00000000000..7b8c61e52f4 --- /dev/null +++ b/queue-4.9/alsa-hda-ca0132-add-quirk-for-alienware-15-r2-2016.patch @@ -0,0 +1,33 @@ +From b5337cfe067e96b8a98699da90c7dcd2bec21133 Mon Sep 17 00:00:00 2001 +From: Sven Hahne +Date: Fri, 25 Nov 2016 14:16:43 +0100 +Subject: ALSA: hda/ca0132 - Add quirk for Alienware 15 R2 2016 + +From: Sven Hahne + +commit b5337cfe067e96b8a98699da90c7dcd2bec21133 upstream. + +I'm using an Alienware 15 R2 and had to use the alienware quirks to +get my headphone output working. + +I fixed it by adding, SND_PCI_QUIRK(0x1028, 0x0708, "Alienware 15 R2 +2016", QUIRK_ALIENWARE) to the patch. + +Signed-off-by: Sven Hahne +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_ca0132.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/pci/hda/patch_ca0132.c ++++ b/sound/pci/hda/patch_ca0132.c +@@ -780,6 +780,7 @@ static const struct hda_pintbl alienware + static const struct snd_pci_quirk ca0132_quirks[] = { + SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15 2015", QUIRK_ALIENWARE), + SND_PCI_QUIRK(0x1028, 0x0688, "Alienware 17 2015", QUIRK_ALIENWARE), ++ SND_PCI_QUIRK(0x1028, 0x0708, "Alienware 15 R2 2016", QUIRK_ALIENWARE), + {} + }; + diff --git a/queue-4.9/alsa-hda-fix-headset-mic-problem-on-a-dell-laptop.patch b/queue-4.9/alsa-hda-fix-headset-mic-problem-on-a-dell-laptop.patch new file mode 100644 index 00000000000..394c3276937 --- /dev/null +++ b/queue-4.9/alsa-hda-fix-headset-mic-problem-on-a-dell-laptop.patch @@ -0,0 +1,32 @@ +From 989dbe4a30728c047316ab87e5fa8b609951ce7c Mon Sep 17 00:00:00 2001 +From: Hui Wang +Date: Wed, 23 Nov 2016 16:05:38 +0800 +Subject: ALSA: hda - fix headset-mic problem on a Dell laptop + +From: Hui Wang + +commit 989dbe4a30728c047316ab87e5fa8b609951ce7c upstream. + +This group of new pins is not in the pin quirk table yet, adding +them to the pin quirk table to fix the headset-mic problem. + +Signed-off-by: Hui Wang +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_realtek.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -5917,6 +5917,9 @@ static const struct snd_hda_pin_quirk al + {0x12, 0x90a60180}, + {0x14, 0x90170120}, + {0x21, 0x02211030}), ++ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, ++ {0x1b, 0x01011020}, ++ {0x21, 0x02211010}), + SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, + {0x12, 0x90a60160}, + {0x14, 0x90170120}, diff --git a/queue-4.9/alsa-hda-gate-the-mic-jack-on-hp-z1-gen3-aio.patch b/queue-4.9/alsa-hda-gate-the-mic-jack-on-hp-z1-gen3-aio.patch new file mode 100644 index 00000000000..39a10d692ef --- /dev/null +++ b/queue-4.9/alsa-hda-gate-the-mic-jack-on-hp-z1-gen3-aio.patch @@ -0,0 +1,68 @@ +From f73cd43ac3b41c0f09a126387f302bbc0d9c726d Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 6 Dec 2016 11:55:17 +0100 +Subject: ALSA: hda - Gate the mic jack on HP Z1 Gen3 AiO + +From: Takashi Iwai + +commit f73cd43ac3b41c0f09a126387f302bbc0d9c726d upstream. + +HP Z1 Gen3 AiO with Conexant codec doesn't give an unsolicited event +to the headset mic pin upon the jack plugging, it reports only to the +headphone pin. It results in the missing mic switching. Let's fix up +by simply gating the jack event. + +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_conexant.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +--- a/sound/pci/hda/patch_conexant.c ++++ b/sound/pci/hda/patch_conexant.c +@@ -262,6 +262,7 @@ enum { + CXT_FIXUP_CAP_MIX_AMP_5047, + CXT_FIXUP_MUTE_LED_EAPD, + CXT_FIXUP_HP_SPECTRE, ++ CXT_FIXUP_HP_GATE_MIC, + }; + + /* for hda_fixup_thinkpad_acpi() */ +@@ -633,6 +634,17 @@ static void cxt_fixup_cap_mix_amp_5047(s + (1 << AC_AMPCAP_MUTE_SHIFT)); + } + ++static void cxt_fixup_hp_gate_mic_jack(struct hda_codec *codec, ++ const struct hda_fixup *fix, ++ int action) ++{ ++ /* the mic pin (0x19) doesn't give an unsolicited event; ++ * probe the mic pin together with the headphone pin (0x16) ++ */ ++ if (action == HDA_FIXUP_ACT_PROBE) ++ snd_hda_jack_set_gating_jack(codec, 0x19, 0x16); ++} ++ + /* ThinkPad X200 & co with cxt5051 */ + static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = { + { 0x16, 0x042140ff }, /* HP (seq# overridden) */ +@@ -774,6 +786,10 @@ static const struct hda_fixup cxt_fixups + { } + } + }, ++ [CXT_FIXUP_HP_GATE_MIC] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = cxt_fixup_hp_gate_mic_jack, ++ }, + }; + + static const struct snd_pci_quirk cxt5045_fixups[] = { +@@ -824,6 +840,7 @@ static const struct snd_pci_quirk cxt506 + SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_ASPIRE_DMIC), + SND_PCI_QUIRK(0x1025, 0x054f, "Acer Aspire 4830T", CXT_FIXUP_ASPIRE_DMIC), + SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE), ++ SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC), + SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), + SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), + SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), diff --git a/queue-4.9/alsa-hda-ignore-the-assoc-and-seq-when-comparing-pin-configurations.patch b/queue-4.9/alsa-hda-ignore-the-assoc-and-seq-when-comparing-pin-configurations.patch new file mode 100644 index 00000000000..9ca2002dc1b --- /dev/null +++ b/queue-4.9/alsa-hda-ignore-the-assoc-and-seq-when-comparing-pin-configurations.patch @@ -0,0 +1,37 @@ +From 64047d7f4912de1769d1bf0d34c6322494b13779 Mon Sep 17 00:00:00 2001 +From: Hui Wang +Date: Wed, 23 Nov 2016 16:05:37 +0800 +Subject: ALSA: hda - ignore the assoc and seq when comparing pin configurations + +From: Hui Wang + +commit 64047d7f4912de1769d1bf0d34c6322494b13779 upstream. + +More and more pin configurations have been adding to the pin quirk +table, lots of them are only different from assoc and seq, but they +all apply to the same QUIRK_FIXUP, if we don't compare assoc and seq +when matching pin configurations, it will greatly reduce the pin +quirk table size. + +We have tested this change on a couple of Dell laptops, it worked +well. + +Signed-off-by: Hui Wang +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/hda_auto_parser.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/pci/hda/hda_auto_parser.c ++++ b/sound/pci/hda/hda_auto_parser.c +@@ -901,7 +901,7 @@ static bool pin_config_match(struct hda_ + for (; t_pins->nid; t_pins++) { + if (t_pins->nid == nid) { + found = 1; +- if (t_pins->val == cfg) ++ if ((t_pins->val & 0xfffffff0) == (cfg & 0xfffffff0)) + break; + else if ((cfg & 0xf0000000) == 0x40000000 && (t_pins->val & 0xf0000000) == 0x40000000) + break; diff --git a/queue-4.9/alsa-hda-when-comparing-pin-configurations-ignore-assoc-in-addition-to-seq.patch b/queue-4.9/alsa-hda-when-comparing-pin-configurations-ignore-assoc-in-addition-to-seq.patch new file mode 100644 index 00000000000..55513f4102f --- /dev/null +++ b/queue-4.9/alsa-hda-when-comparing-pin-configurations-ignore-assoc-in-addition-to-seq.patch @@ -0,0 +1,48 @@ +From 5e0ad0d8747f3e4803a9c3d96d64dd7332506d3c Mon Sep 17 00:00:00 2001 +From: Kai-Heng Feng +Date: Tue, 6 Dec 2016 16:56:27 +0800 +Subject: ALSA: hda: when comparing pin configurations, ignore assoc in addition to seq + +From: Kai-Heng Feng + +commit 5e0ad0d8747f3e4803a9c3d96d64dd7332506d3c upstream. + +Commit [64047d7f4912 ALSA: hda - ignore the assoc and seq when comparing +pin configurations] intented to ignore both seq and assoc at pin +comparing, but it only ignored seq. So that commit may still fail to +match pins on some machines. +Change the bitmask to also ignore assoc. + +v2: Use macro to do bit masking. + +Thanks to Hui Wang for the analysis. + +Fixes: 64047d7f4912 ("ALSA: hda - ignore the assoc and seq when comparing...") +Signed-off-by: Kai-Heng Feng +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/hda_auto_parser.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/sound/pci/hda/hda_auto_parser.c ++++ b/sound/pci/hda/hda_auto_parser.c +@@ -884,6 +884,8 @@ void snd_hda_apply_fixup(struct hda_code + } + EXPORT_SYMBOL_GPL(snd_hda_apply_fixup); + ++#define IGNORE_SEQ_ASSOC (~(AC_DEFCFG_SEQUENCE | AC_DEFCFG_DEF_ASSOC)) ++ + static bool pin_config_match(struct hda_codec *codec, + const struct hda_pintbl *pins) + { +@@ -901,7 +903,7 @@ static bool pin_config_match(struct hda_ + for (; t_pins->nid; t_pins++) { + if (t_pins->nid == nid) { + found = 1; +- if ((t_pins->val & 0xfffffff0) == (cfg & 0xfffffff0)) ++ if ((t_pins->val & IGNORE_SEQ_ASSOC) == (cfg & IGNORE_SEQ_ASSOC)) + break; + else if ((cfg & 0xf0000000) == 0x40000000 && (t_pins->val & 0xf0000000) == 0x40000000) + break; diff --git a/queue-4.9/alsa-hiface-fix-m2tech-hiface-driver-sampling-rate-change.patch b/queue-4.9/alsa-hiface-fix-m2tech-hiface-driver-sampling-rate-change.patch new file mode 100644 index 00000000000..ce8793fc511 --- /dev/null +++ b/queue-4.9/alsa-hiface-fix-m2tech-hiface-driver-sampling-rate-change.patch @@ -0,0 +1,35 @@ +From 995c6a7fd9b9212abdf01160f6ce3193176be503 Mon Sep 17 00:00:00 2001 +From: Jussi Laako +Date: Mon, 28 Nov 2016 11:27:45 +0200 +Subject: ALSA: hiface: Fix M2Tech hiFace driver sampling rate change + +From: Jussi Laako + +commit 995c6a7fd9b9212abdf01160f6ce3193176be503 upstream. + +Sampling rate changes after first set one are not reflected to the +hardware, while driver and ALSA think the rate has been changed. + +Fix the problem by properly stopping the interface at the beginning of +prepare call, allowing new rate to be set to the hardware. This keeps +the hardware in sync with the driver. + +Signed-off-by: Jussi Laako +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/hiface/pcm.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/sound/usb/hiface/pcm.c ++++ b/sound/usb/hiface/pcm.c +@@ -445,6 +445,8 @@ static int hiface_pcm_prepare(struct snd + + mutex_lock(&rt->stream_mutex); + ++ hiface_pcm_stream_stop(rt); ++ + sub->dma_off = 0; + sub->period_off = 0; + diff --git a/queue-4.9/alsa-usb-audio-add-quickcam-communicate-deluxe-s7500-to-volume_control_quirks.patch b/queue-4.9/alsa-usb-audio-add-quickcam-communicate-deluxe-s7500-to-volume_control_quirks.patch new file mode 100644 index 00000000000..f7de494cbfd --- /dev/null +++ b/queue-4.9/alsa-usb-audio-add-quickcam-communicate-deluxe-s7500-to-volume_control_quirks.patch @@ -0,0 +1,42 @@ +From 82ffb6fc637150b279f49e174166d2aa3853eaf4 Mon Sep 17 00:00:00 2001 +From: Con Kolivas +Date: Fri, 9 Dec 2016 15:15:57 +1100 +Subject: ALSA: usb-audio: Add QuickCam Communicate Deluxe/S7500 to volume_control_quirks + +From: Con Kolivas + +commit 82ffb6fc637150b279f49e174166d2aa3853eaf4 upstream. + +The Logitech QuickCam Communicate Deluxe/S7500 microphone fails with the +following warning. + +[ 6.778995] usb 2-1.2.2.2: Warning! Unlikely big volume range (=3072), +cval->res is probably wrong. +[ 6.778996] usb 2-1.2.2.2: [5] FU [Mic Capture Volume] ch = 1, val = +4608/7680/1 + +Adding it to the list of devices in volume_control_quirks makes it work +properly, fixing related typo. + +Signed-off-by: Con Kolivas +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/mixer.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/sound/usb/mixer.c ++++ b/sound/usb/mixer.c +@@ -932,9 +932,10 @@ static void volume_control_quirks(struct + case USB_ID(0x046d, 0x0826): /* HD Webcam c525 */ + case USB_ID(0x046d, 0x08ca): /* Logitech Quickcam Fusion */ + case USB_ID(0x046d, 0x0991): ++ case USB_ID(0x046d, 0x09a2): /* QuickCam Communicate Deluxe/S7500 */ + /* Most audio usb devices lie about volume resolution. + * Most Logitech webcams have res = 384. +- * Proboly there is some logitech magic behind this number --fishor ++ * Probably there is some logitech magic behind this number --fishor + */ + if (!strcmp(kctl->id.name, "Mic Capture Volume")) { + usb_audio_info(chip, diff --git a/queue-4.9/series b/queue-4.9/series index f2554edeb54..8bbb1d1ef7d 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -7,3 +7,22 @@ btrfs-fix-relocation-incorrectly-dropping-data-references.patch btrfs-store-and-load-values-of-stripes_min-stripes_max-in-balance-status-item.patch btrfs-fix-emptiness-check-for-dirtied-extent-buffers-at-check_leaf.patch btrfs-fix-qgroup-rescan-worker-initialization.patch +usb-serial-option-add-support-for-telit-le922a-pids-0x1040-0x1041.patch +usb-serial-option-add-dlink-dwm-158.patch +usb-serial-kl5kusb105-fix-open-error-path.patch +usb-cdc-acm-add-device-id-for-gw-instek-afg-125.patch +usb-dwc3-gadget-set-pcm1-field-of-isochronous-first-trbs.patch +usb-hub-fix-auto-remount-of-safely-removed-or-ejected-usb-3-devices.patch +usb-core-usbport-use-proper-led-api-to-fix-potential-crash.patch +usb-gadget-f_uac2-fix-error-handling-at-afunc_bind.patch +usb-gadget-composite-correctly-initialize-ep-maxpacket.patch +usb-gadget-composite-always-set-ep-mult-to-a-sensible-value.patch +usb-uhci-report-non-pme-wakeup-signalling-for-intel-hardware.patch +usbip-vudc-fix-clear-already_seen-flag-also-for-ep0.patch +alsa-usb-audio-add-quickcam-communicate-deluxe-s7500-to-volume_control_quirks.patch +alsa-hiface-fix-m2tech-hiface-driver-sampling-rate-change.patch +alsa-hda-ca0132-add-quirk-for-alienware-15-r2-2016.patch +alsa-hda-ignore-the-assoc-and-seq-when-comparing-pin-configurations.patch +alsa-hda-fix-headset-mic-problem-on-a-dell-laptop.patch +alsa-hda-gate-the-mic-jack-on-hp-z1-gen3-aio.patch +alsa-hda-when-comparing-pin-configurations-ignore-assoc-in-addition-to-seq.patch diff --git a/queue-4.9/usb-cdc-acm-add-device-id-for-gw-instek-afg-125.patch b/queue-4.9/usb-cdc-acm-add-device-id-for-gw-instek-afg-125.patch new file mode 100644 index 00000000000..66dcf87d26d --- /dev/null +++ b/queue-4.9/usb-cdc-acm-add-device-id-for-gw-instek-afg-125.patch @@ -0,0 +1,30 @@ +From 301216044e4c27d5a7323c1fa766266fad00db5e Mon Sep 17 00:00:00 2001 +From: Nathaniel Quillin +Date: Mon, 5 Dec 2016 06:53:00 -0800 +Subject: USB: cdc-acm: add device id for GW Instek AFG-125 + +From: Nathaniel Quillin + +commit 301216044e4c27d5a7323c1fa766266fad00db5e upstream. + +Add device-id entry for GW Instek AFG-125, which has a byte swapped +bInterfaceSubClass (0x20). + +Signed-off-by: Nathaniel Quillin +Acked-by: Oliver Neukum +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/class/cdc-acm.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -1719,6 +1719,7 @@ static const struct usb_device_id acm_id + { USB_DEVICE(0x20df, 0x0001), /* Simtec Electronics Entropy Key */ + .driver_info = QUIRK_CONTROL_LINE_STATE, }, + { USB_DEVICE(0x2184, 0x001c) }, /* GW Instek AFG-2225 */ ++ { USB_DEVICE(0x2184, 0x0036) }, /* GW Instek AFG-125 */ + { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ + }, + /* Motorola H24 HSPA module: */ diff --git a/queue-4.9/usb-core-usbport-use-proper-led-api-to-fix-potential-crash.patch b/queue-4.9/usb-core-usbport-use-proper-led-api-to-fix-potential-crash.patch new file mode 100644 index 00000000000..2579ed65a54 --- /dev/null +++ b/queue-4.9/usb-core-usbport-use-proper-led-api-to-fix-potential-crash.patch @@ -0,0 +1,74 @@ +From 89778ba335e302a450932ce5b703c1ee6216e949 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 6 Dec 2016 00:39:33 +0100 +Subject: usb: core: usbport: Use proper LED API to fix potential crash +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Rafał Miłecki + +commit 89778ba335e302a450932ce5b703c1ee6216e949 upstream. + +Calling brightness_set manually isn't safe as some LED drivers don't +implement this callback. The best idea is to just use a proper helper +which will fallback to the brightness_set_blocking callback if needed. + +This fixes: +[ 1461.761528] Unable to handle kernel NULL pointer dereference at virtual address 00000000 +(...) +[ 1462.117049] Backtrace: +[ 1462.119521] [] (usbport_trig_port_store [ledtrig_usbport]) from [] (dev_attr_store+0x20/0x2c) +[ 1462.129826] r7:dcabc7c0 r6:dee0ff80 r5:00000002 r4:bf228164 +[ 1462.135511] [] (dev_attr_store) from [] (sysfs_kf_write+0x48/0x4c) +[ 1462.143459] r5:00000002 r4:c023f738 +[ 1462.147049] [] (sysfs_kf_write) from [] (kernfs_fop_write+0xf8/0x1f8) +[ 1462.155258] r5:00000002 r4:df4a1000 +[ 1462.158850] [] (kernfs_fop_write) from [] (__vfs_write+0x34/0x120) +[ 1462.166800] r10:00000000 r9:dee0e000 r8:c000fc24 r7:00000002 r6:dee0ff80 r5:c01689c0 +[ 1462.174660] r4:df727a80 +[ 1462.177204] [] (__vfs_write) from [] (vfs_write+0xac/0x170) +[ 1462.184543] r9:dee0e000 r8:c000fc24 r7:dee0ff80 r6:b6f092d0 r5:df727a80 r4:00000002 +[ 1462.192319] [] (vfs_write) from [] (SyS_write+0x4c/0xa8) +[ 1462.199396] r9:dee0e000 r8:c000fc24 r7:00000002 r6:b6f092d0 r5:df727a80 r4:df727a80 +[ 1462.207174] [] (SyS_write) from [] (ret_fast_syscall+0x0/0x3c) +[ 1462.214774] r7:00000004 r6:ffffffff r5:00000000 r4:00000000 +[ 1462.220456] Code: bad PC value +[ 1462.223560] ---[ end trace 676638a3a12c7a56 ]--- + +Reported-by: Ralph Sennhauser +Signed-off-by: Rafał Miłecki +Fixes: 0f247626cbb ("usb: core: Introduce a USB port LED trigger") +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/core/ledtrig-usbport.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +--- a/drivers/usb/core/ledtrig-usbport.c ++++ b/drivers/usb/core/ledtrig-usbport.c +@@ -74,8 +74,7 @@ static void usbport_trig_update_count(st + + usbport_data->count = 0; + usb_for_each_dev(usbport_data, usbport_trig_usb_dev_check); +- led_cdev->brightness_set(led_cdev, +- usbport_data->count ? LED_FULL : LED_OFF); ++ led_set_brightness(led_cdev, usbport_data->count ? LED_FULL : LED_OFF); + } + + /*************************************** +@@ -228,12 +227,12 @@ static int usbport_trig_notify(struct no + case USB_DEVICE_ADD: + usbport_trig_add_usb_dev_ports(usb_dev, usbport_data); + if (observed && usbport_data->count++ == 0) +- led_cdev->brightness_set(led_cdev, LED_FULL); ++ led_set_brightness(led_cdev, LED_FULL); + return NOTIFY_OK; + case USB_DEVICE_REMOVE: + usbport_trig_remove_usb_dev_ports(usbport_data, usb_dev); + if (observed && --usbport_data->count == 0) +- led_cdev->brightness_set(led_cdev, LED_OFF); ++ led_set_brightness(led_cdev, LED_OFF); + return NOTIFY_OK; + } + diff --git a/queue-4.9/usb-dwc3-gadget-set-pcm1-field-of-isochronous-first-trbs.patch b/queue-4.9/usb-dwc3-gadget-set-pcm1-field-of-isochronous-first-trbs.patch new file mode 100644 index 00000000000..84fd9f8c51a --- /dev/null +++ b/queue-4.9/usb-dwc3-gadget-set-pcm1-field-of-isochronous-first-trbs.patch @@ -0,0 +1,52 @@ +From 6b9018d4c1e5c958625be94a160a5984351d4632 Mon Sep 17 00:00:00 2001 +From: Felipe Balbi +Date: Thu, 22 Sep 2016 11:01:01 +0300 +Subject: usb: dwc3: gadget: set PCM1 field of isochronous-first TRBs + +From: Felipe Balbi + +commit 6b9018d4c1e5c958625be94a160a5984351d4632 upstream. + +In case of High-Speed, High-Bandwidth endpoints, we +need to tell DWC3 that we have more than one packet +per interval. We do that by setting PCM1 field of +Isochronous-First TRB. + +Signed-off-by: Felipe Balbi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/dwc3/gadget.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -771,6 +771,9 @@ static void dwc3_prepare_one_trb(struct + unsigned length, unsigned chain, unsigned node) + { + struct dwc3_trb *trb; ++ struct dwc3 *dwc = dep->dwc; ++ struct usb_gadget *gadget = &dwc->gadget; ++ enum usb_device_speed speed = gadget->speed; + + dwc3_trace(trace_dwc3_gadget, "%s: req %p dma %08llx length %d%s", + dep->name, req, (unsigned long long) dma, +@@ -798,10 +801,16 @@ static void dwc3_prepare_one_trb(struct + break; + + case USB_ENDPOINT_XFER_ISOC: +- if (!node) ++ if (!node) { + trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS_FIRST; +- else ++ ++ if (speed == USB_SPEED_HIGH) { ++ struct usb_ep *ep = &dep->endpoint; ++ trb->size |= DWC3_TRB_SIZE_PCM1(ep->mult - 1); ++ } ++ } else { + trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS; ++ } + + /* always enable Interrupt on Missed ISOC */ + trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI; diff --git a/queue-4.9/usb-gadget-composite-always-set-ep-mult-to-a-sensible-value.patch b/queue-4.9/usb-gadget-composite-always-set-ep-mult-to-a-sensible-value.patch new file mode 100644 index 00000000000..e074e5309cc --- /dev/null +++ b/queue-4.9/usb-gadget-composite-always-set-ep-mult-to-a-sensible-value.patch @@ -0,0 +1,66 @@ +From eaa496ffaaf19591fe471a36cef366146eeb9153 Mon Sep 17 00:00:00 2001 +From: Felipe Balbi +Date: Wed, 28 Sep 2016 12:33:31 +0300 +Subject: usb: gadget: composite: always set ep->mult to a sensible value + +From: Felipe Balbi + +commit eaa496ffaaf19591fe471a36cef366146eeb9153 upstream. + +ep->mult is supposed to be set to Isochronous and +Interrupt Endapoint's multiplier value. This value +is computed from different places depending on the +link speed. + +If we're dealing with HighSpeed, then it's part of +bits [12:11] of wMaxPacketSize. This case wasn't +taken into consideration before. + +While at that, also make sure the ep->mult defaults +to one so drivers can use it unconditionally and +assume they'll never multiply ep->maxpacket to zero. + +Signed-off-by: Felipe Balbi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/gadget/composite.c | 9 +++++++-- + drivers/usb/gadget/function/uvc_video.c | 2 +- + 2 files changed, 8 insertions(+), 3 deletions(-) + +--- a/drivers/usb/gadget/composite.c ++++ b/drivers/usb/gadget/composite.c +@@ -201,7 +201,12 @@ ep_found: + _ep->desc = chosen_desc; + _ep->comp_desc = NULL; + _ep->maxburst = 0; +- _ep->mult = 0; ++ _ep->mult = 1; ++ ++ if (g->speed == USB_SPEED_HIGH && (usb_endpoint_xfer_isoc(_ep->desc) || ++ usb_endpoint_xfer_int(_ep->desc))) ++ _ep->mult = usb_endpoint_maxp_mult(_ep->desc); ++ + if (!want_comp_desc) + return 0; + +@@ -218,7 +223,7 @@ ep_found: + switch (usb_endpoint_type(_ep->desc)) { + case USB_ENDPOINT_XFER_ISOC: + /* mult: bits 1:0 of bmAttributes */ +- _ep->mult = comp_desc->bmAttributes & 0x3; ++ _ep->mult = (comp_desc->bmAttributes & 0x3) + 1; + case USB_ENDPOINT_XFER_BULK: + case USB_ENDPOINT_XFER_INT: + _ep->maxburst = comp_desc->bMaxBurst + 1; +--- a/drivers/usb/gadget/function/uvc_video.c ++++ b/drivers/usb/gadget/function/uvc_video.c +@@ -243,7 +243,7 @@ uvc_video_alloc_requests(struct uvc_vide + + req_size = video->ep->maxpacket + * max_t(unsigned int, video->ep->maxburst, 1) +- * (video->ep->mult + 1); ++ * (video->ep->mult); + + for (i = 0; i < UVC_NUM_REQUESTS; ++i) { + video->req_buffer[i] = kmalloc(req_size, GFP_KERNEL); diff --git a/queue-4.9/usb-gadget-composite-correctly-initialize-ep-maxpacket.patch b/queue-4.9/usb-gadget-composite-correctly-initialize-ep-maxpacket.patch new file mode 100644 index 00000000000..1531e93def5 --- /dev/null +++ b/queue-4.9/usb-gadget-composite-correctly-initialize-ep-maxpacket.patch @@ -0,0 +1,41 @@ +From e8f29bb719b47a234f33b0af62974d7a9521a52c Mon Sep 17 00:00:00 2001 +From: Felipe Balbi +Date: Wed, 28 Sep 2016 10:38:11 +0300 +Subject: usb: gadget: composite: correctly initialize ep->maxpacket + +From: Felipe Balbi + +commit e8f29bb719b47a234f33b0af62974d7a9521a52c upstream. + +usb_endpoint_maxp() returns wMaxPacketSize in its +raw form. Without taking into consideration that it +also contains other bits reserved for isochronous +endpoints. + +This patch fixes one occasion where this is a +problem by making sure that we initialize +ep->maxpacket only with lower 10 bits of the value +returned by usb_endpoint_maxp(). Note that seperate +patches will be necessary to audit all call sites of +usb_endpoint_maxp() and make sure that +usb_endpoint_maxp() only returns lower 10 bits of +wMaxPacketSize. + +Signed-off-by: Felipe Balbi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/gadget/composite.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/gadget/composite.c ++++ b/drivers/usb/gadget/composite.c +@@ -197,7 +197,7 @@ int config_ep_by_speed(struct usb_gadget + + ep_found: + /* commit results */ +- _ep->maxpacket = usb_endpoint_maxp(chosen_desc); ++ _ep->maxpacket = usb_endpoint_maxp(chosen_desc) & 0x7ff; + _ep->desc = chosen_desc; + _ep->comp_desc = NULL; + _ep->maxburst = 0; diff --git a/queue-4.9/usb-gadget-f_uac2-fix-error-handling-at-afunc_bind.patch b/queue-4.9/usb-gadget-f_uac2-fix-error-handling-at-afunc_bind.patch new file mode 100644 index 00000000000..698cc904303 --- /dev/null +++ b/queue-4.9/usb-gadget-f_uac2-fix-error-handling-at-afunc_bind.patch @@ -0,0 +1,71 @@ +From f1d3861d63a5d79b8968a02eea1dcb01bb684e62 Mon Sep 17 00:00:00 2001 +From: Peter Chen +Date: Tue, 8 Nov 2016 10:10:44 +0800 +Subject: usb: gadget: f_uac2: fix error handling at afunc_bind + +From: Peter Chen + +commit f1d3861d63a5d79b8968a02eea1dcb01bb684e62 upstream. + +The current error handling flow uses incorrect goto label, fix it + +Fixes: d12a8727171c ("usb: gadget: function: Remove redundant usb_free_all_descriptors") +Signed-off-by: Peter Chen +Signed-off-by: Felipe Balbi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/gadget/function/f_uac2.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +--- a/drivers/usb/gadget/function/f_uac2.c ++++ b/drivers/usb/gadget/function/f_uac2.c +@@ -1067,13 +1067,13 @@ afunc_bind(struct usb_configuration *cfg + agdev->out_ep = usb_ep_autoconfig(gadget, &fs_epout_desc); + if (!agdev->out_ep) { + dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); +- goto err; ++ return ret; + } + + agdev->in_ep = usb_ep_autoconfig(gadget, &fs_epin_desc); + if (!agdev->in_ep) { + dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); +- goto err; ++ return ret; + } + + uac2->p_prm.uac2 = uac2; +@@ -1091,7 +1091,7 @@ afunc_bind(struct usb_configuration *cfg + ret = usb_assign_descriptors(fn, fs_audio_desc, hs_audio_desc, NULL, + NULL); + if (ret) +- goto err; ++ return ret; + + prm = &agdev->uac2.c_prm; + prm->max_psize = hs_epout_desc.wMaxPacketSize; +@@ -1106,19 +1106,19 @@ afunc_bind(struct usb_configuration *cfg + prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); + if (!prm->rbuf) { + prm->max_psize = 0; +- goto err_free_descs; ++ goto err; + } + + ret = alsa_uac2_init(agdev); + if (ret) +- goto err_free_descs; ++ goto err; + return 0; + +-err_free_descs: +- usb_free_all_descriptors(fn); + err: + kfree(agdev->uac2.p_prm.rbuf); + kfree(agdev->uac2.c_prm.rbuf); ++err_free_descs: ++ usb_free_all_descriptors(fn); + return -EINVAL; + } + diff --git a/queue-4.9/usb-hub-fix-auto-remount-of-safely-removed-or-ejected-usb-3-devices.patch b/queue-4.9/usb-hub-fix-auto-remount-of-safely-removed-or-ejected-usb-3-devices.patch new file mode 100644 index 00000000000..b890d2a0b35 --- /dev/null +++ b/queue-4.9/usb-hub-fix-auto-remount-of-safely-removed-or-ejected-usb-3-devices.patch @@ -0,0 +1,171 @@ +From 37be66767e3cae4fd16e064d8bb7f9f72bf5c045 Mon Sep 17 00:00:00 2001 +From: Mathias Nyman +Date: Thu, 17 Nov 2016 11:14:14 +0200 +Subject: usb: hub: Fix auto-remount of safely removed or ejected USB-3 devices + +From: Mathias Nyman + +commit 37be66767e3cae4fd16e064d8bb7f9f72bf5c045 upstream. + +USB-3 does not have any link state that will avoid negotiating a connection +with a plugged-in cable but will signal the host when the cable is +unplugged. + +For USB-3 we used to first set the link to Disabled, then to RxDdetect to +be able to detect cable connects or disconnects. But in RxDetect the +connected device is detected again and eventually enabled. + +Instead set the link into U3 and disable remote wakeups for the device. +This is what Windows does, and what Alan Stern suggested. + +Cc: Alan Stern +Acked-by: Alan Stern +Signed-off-by: Mathias Nyman +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/core/hub.c | 101 +++++++++++++++++-------------------------------- + 1 file changed, 36 insertions(+), 65 deletions(-) + +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -101,6 +101,8 @@ EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rws + + static void hub_release(struct kref *kref); + static int usb_reset_and_verify_device(struct usb_device *udev); ++static void hub_usb3_port_prepare_disable(struct usb_hub *hub, ++ struct usb_port *port_dev); + + static inline char *portspeed(struct usb_hub *hub, int portstatus) + { +@@ -899,82 +901,28 @@ static int hub_set_port_link_state(struc + } + + /* +- * If USB 3.0 ports are placed into the Disabled state, they will no longer +- * detect any device connects or disconnects. This is generally not what the +- * USB core wants, since it expects a disabled port to produce a port status +- * change event when a new device connects. +- * +- * Instead, set the link state to Disabled, wait for the link to settle into +- * that state, clear any change bits, and then put the port into the RxDetect +- * state. ++ * USB-3 does not have a similar link state as USB-2 that will avoid negotiating ++ * a connection with a plugged-in cable but will signal the host when the cable ++ * is unplugged. Disable remote wake and set link state to U3 for USB-3 devices + */ +-static int hub_usb3_port_disable(struct usb_hub *hub, int port1) +-{ +- int ret; +- int total_time; +- u16 portchange, portstatus; +- +- if (!hub_is_superspeed(hub->hdev)) +- return -EINVAL; +- +- ret = hub_port_status(hub, port1, &portstatus, &portchange); +- if (ret < 0) +- return ret; +- +- /* +- * USB controller Advanced Micro Devices, Inc. [AMD] FCH USB XHCI +- * Controller [1022:7814] will have spurious result making the following +- * usb 3.0 device hotplugging route to the 2.0 root hub and recognized +- * as high-speed device if we set the usb 3.0 port link state to +- * Disabled. Since it's already in USB_SS_PORT_LS_RX_DETECT state, we +- * check the state here to avoid the bug. +- */ +- if ((portstatus & USB_PORT_STAT_LINK_STATE) == +- USB_SS_PORT_LS_RX_DETECT) { +- dev_dbg(&hub->ports[port1 - 1]->dev, +- "Not disabling port; link state is RxDetect\n"); +- return ret; +- } +- +- ret = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_SS_DISABLED); +- if (ret) +- return ret; +- +- /* Wait for the link to enter the disabled state. */ +- for (total_time = 0; ; total_time += HUB_DEBOUNCE_STEP) { +- ret = hub_port_status(hub, port1, &portstatus, &portchange); +- if (ret < 0) +- return ret; +- +- if ((portstatus & USB_PORT_STAT_LINK_STATE) == +- USB_SS_PORT_LS_SS_DISABLED) +- break; +- if (total_time >= HUB_DEBOUNCE_TIMEOUT) +- break; +- msleep(HUB_DEBOUNCE_STEP); +- } +- if (total_time >= HUB_DEBOUNCE_TIMEOUT) +- dev_warn(&hub->ports[port1 - 1]->dev, +- "Could not disable after %d ms\n", total_time); +- +- return hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_RX_DETECT); +-} +- + static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) + { + struct usb_port *port_dev = hub->ports[port1 - 1]; + struct usb_device *hdev = hub->hdev; + int ret = 0; + +- if (port_dev->child && set_state) +- usb_set_device_state(port_dev->child, USB_STATE_NOTATTACHED); + if (!hub->error) { +- if (hub_is_superspeed(hub->hdev)) +- ret = hub_usb3_port_disable(hub, port1); +- else ++ if (hub_is_superspeed(hub->hdev)) { ++ hub_usb3_port_prepare_disable(hub, port_dev); ++ ret = hub_set_port_link_state(hub, port_dev->portnum, ++ USB_SS_PORT_LS_U3); ++ } else { + ret = usb_clear_port_feature(hdev, port1, + USB_PORT_FEAT_ENABLE); ++ } + } ++ if (port_dev->child && set_state) ++ usb_set_device_state(port_dev->child, USB_STATE_NOTATTACHED); + if (ret && ret != -ENODEV) + dev_err(&port_dev->dev, "cannot disable (err = %d)\n", ret); + return ret; +@@ -4140,6 +4088,26 @@ void usb_unlocked_enable_lpm(struct usb_ + } + EXPORT_SYMBOL_GPL(usb_unlocked_enable_lpm); + ++/* usb3 devices use U3 for disabled, make sure remote wakeup is disabled */ ++static void hub_usb3_port_prepare_disable(struct usb_hub *hub, ++ struct usb_port *port_dev) ++{ ++ struct usb_device *udev = port_dev->child; ++ int ret; ++ ++ if (udev && udev->port_is_suspended && udev->do_remote_wakeup) { ++ ret = hub_set_port_link_state(hub, port_dev->portnum, ++ USB_SS_PORT_LS_U0); ++ if (!ret) { ++ msleep(USB_RESUME_TIMEOUT); ++ ret = usb_disable_remote_wakeup(udev); ++ } ++ if (ret) ++ dev_warn(&udev->dev, ++ "Port disable: can't disable remote wake\n"); ++ udev->do_remote_wakeup = 0; ++ } ++} + + #else /* CONFIG_PM */ + +@@ -4147,6 +4115,9 @@ EXPORT_SYMBOL_GPL(usb_unlocked_enable_lp + #define hub_resume NULL + #define hub_reset_resume NULL + ++static inline void hub_usb3_port_prepare_disable(struct usb_hub *hub, ++ struct usb_port *port_dev) { } ++ + int usb_disable_lpm(struct usb_device *udev) + { + return 0; diff --git a/queue-4.9/usb-serial-kl5kusb105-fix-open-error-path.patch b/queue-4.9/usb-serial-kl5kusb105-fix-open-error-path.patch new file mode 100644 index 00000000000..676097b20fe --- /dev/null +++ b/queue-4.9/usb-serial-kl5kusb105-fix-open-error-path.patch @@ -0,0 +1,72 @@ +From 6774d5f53271d5f60464f824748995b71da401ab Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Tue, 29 Nov 2016 16:55:01 +0100 +Subject: USB: serial: kl5kusb105: fix open error path + +From: Johan Hovold + +commit 6774d5f53271d5f60464f824748995b71da401ab upstream. + +Kill urbs and disable read before returning from open on failure to +retrieve the line state. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/kl5kusb105.c | 33 ++++++++++++++++++++++++--------- + 1 file changed, 24 insertions(+), 9 deletions(-) + +--- a/drivers/usb/serial/kl5kusb105.c ++++ b/drivers/usb/serial/kl5kusb105.c +@@ -296,7 +296,7 @@ static int klsi_105_open(struct tty_str + rc = usb_serial_generic_open(tty, port); + if (rc) { + retval = rc; +- goto exit; ++ goto err_free_cfg; + } + + rc = usb_control_msg(port->serial->dev, +@@ -315,17 +315,32 @@ static int klsi_105_open(struct tty_str + dev_dbg(&port->dev, "%s - enabled reading\n", __func__); + + rc = klsi_105_get_line_state(port, &line_state); +- if (rc >= 0) { +- spin_lock_irqsave(&priv->lock, flags); +- priv->line_state = line_state; +- spin_unlock_irqrestore(&priv->lock, flags); +- dev_dbg(&port->dev, "%s - read line state 0x%lx\n", __func__, line_state); +- retval = 0; +- } else ++ if (rc < 0) { + retval = rc; ++ goto err_disable_read; ++ } ++ ++ spin_lock_irqsave(&priv->lock, flags); ++ priv->line_state = line_state; ++ spin_unlock_irqrestore(&priv->lock, flags); ++ dev_dbg(&port->dev, "%s - read line state 0x%lx\n", __func__, ++ line_state); ++ ++ return 0; + +-exit: ++err_disable_read: ++ usb_control_msg(port->serial->dev, ++ usb_sndctrlpipe(port->serial->dev, 0), ++ KL5KUSB105A_SIO_CONFIGURE, ++ USB_TYPE_VENDOR | USB_DIR_OUT, ++ KL5KUSB105A_SIO_CONFIGURE_READ_OFF, ++ 0, /* index */ ++ NULL, 0, ++ KLSI_TIMEOUT); ++ usb_serial_generic_close(port); ++err_free_cfg: + kfree(cfg); ++ + return retval; + } + diff --git a/queue-4.9/usb-serial-option-add-dlink-dwm-158.patch b/queue-4.9/usb-serial-option-add-dlink-dwm-158.patch new file mode 100644 index 00000000000..5563c290e30 --- /dev/null +++ b/queue-4.9/usb-serial-option-add-dlink-dwm-158.patch @@ -0,0 +1,29 @@ +From d8a12b7117b42fd708f1e908498350232bdbd5ff Mon Sep 17 00:00:00 2001 +From: Giuseppe Lippolis +Date: Tue, 6 Dec 2016 21:24:19 +0100 +Subject: USB: serial: option: add dlink dwm-158 + +From: Giuseppe Lippolis + +commit d8a12b7117b42fd708f1e908498350232bdbd5ff upstream. + +Adding registration for 3G modem DWM-158 in usb-serial-option + +Signed-off-by: Giuseppe Lippolis +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/option.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -1995,6 +1995,7 @@ static const struct usb_device_id option + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d02, 0xff, 0x00, 0x00) }, + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x02, 0x01) }, + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) }, ++ { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d04, 0xff) }, /* D-Link DWM-158 */ + { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e19, 0xff), /* D-Link DWM-221 B1 */ + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ diff --git a/queue-4.9/usb-serial-option-add-support-for-telit-le922a-pids-0x1040-0x1041.patch b/queue-4.9/usb-serial-option-add-support-for-telit-le922a-pids-0x1040-0x1041.patch new file mode 100644 index 00000000000..ad872a93d03 --- /dev/null +++ b/queue-4.9/usb-serial-option-add-support-for-telit-le922a-pids-0x1040-0x1041.patch @@ -0,0 +1,44 @@ +From 5b09eff0c379002527ad72ea5ea38f25da8a8650 Mon Sep 17 00:00:00 2001 +From: Daniele Palmas +Date: Thu, 1 Dec 2016 16:38:39 +0100 +Subject: USB: serial: option: add support for Telit LE922A PIDs 0x1040, 0x1041 + +From: Daniele Palmas + +commit 5b09eff0c379002527ad72ea5ea38f25da8a8650 upstream. + +This patch adds support for PIDs 0x1040, 0x1041 of Telit LE922A. + +Since the interface positions are the same than the ones used +for other Telit compositions, previous defined blacklists are used. + +Signed-off-by: Daniele Palmas +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/option.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -268,6 +268,8 @@ static void option_instat_callback(struc + #define TELIT_PRODUCT_CC864_SINGLE 0x1006 + #define TELIT_PRODUCT_DE910_DUAL 0x1010 + #define TELIT_PRODUCT_UE910_V2 0x1012 ++#define TELIT_PRODUCT_LE922_USBCFG1 0x1040 ++#define TELIT_PRODUCT_LE922_USBCFG2 0x1041 + #define TELIT_PRODUCT_LE922_USBCFG0 0x1042 + #define TELIT_PRODUCT_LE922_USBCFG3 0x1043 + #define TELIT_PRODUCT_LE922_USBCFG5 0x1045 +@@ -1210,6 +1212,10 @@ static const struct usb_device_id option + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG0), + .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 }, ++ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG1), ++ .driver_info = (kernel_ulong_t)&telit_le910_blacklist }, ++ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG2), ++ .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG3), + .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG5, 0xff), diff --git a/queue-4.9/usb-uhci-report-non-pme-wakeup-signalling-for-intel-hardware.patch b/queue-4.9/usb-uhci-report-non-pme-wakeup-signalling-for-intel-hardware.patch new file mode 100644 index 00000000000..c87938ffa74 --- /dev/null +++ b/queue-4.9/usb-uhci-report-non-pme-wakeup-signalling-for-intel-hardware.patch @@ -0,0 +1,38 @@ +From ccdb6be9ec6580ef69f68949ebe26e0fb58a6fb0 Mon Sep 17 00:00:00 2001 +From: Alan Stern +Date: Fri, 21 Oct 2016 16:49:07 -0400 +Subject: USB: UHCI: report non-PME wakeup signalling for Intel hardware + +From: Alan Stern + +commit ccdb6be9ec6580ef69f68949ebe26e0fb58a6fb0 upstream. + +The UHCI controllers in Intel chipsets rely on a platform-specific non-PME +mechanism for wakeup signalling. They can generate wakeup signals even +though they don't support PME. + +We need to let the USB core know this so that it will enable runtime +suspend for UHCI controllers. + +Signed-off-by: Alan Stern +Signed-off-by: Bjorn Helgaas +Acked-by: Greg Kroah-Hartman +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/host/uhci-pci.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/usb/host/uhci-pci.c ++++ b/drivers/usb/host/uhci-pci.c +@@ -129,6 +129,10 @@ static int uhci_pci_init(struct usb_hcd + if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_HP) + uhci->wait_for_hp = 1; + ++ /* Intel controllers use non-PME wakeup signalling */ ++ if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_INTEL) ++ device_set_run_wake(uhci_dev(uhci), 1); ++ + /* Set up pointers to PCI-specific functions */ + uhci->reset_hc = uhci_pci_reset_hc; + uhci->check_and_reset_hc = uhci_pci_check_and_reset_hc; diff --git a/queue-4.9/usbip-vudc-fix-clear-already_seen-flag-also-for-ep0.patch b/queue-4.9/usbip-vudc-fix-clear-already_seen-flag-also-for-ep0.patch new file mode 100644 index 00000000000..cfe5e4b03cf --- /dev/null +++ b/queue-4.9/usbip-vudc-fix-clear-already_seen-flag-also-for-ep0.patch @@ -0,0 +1,39 @@ +From 3e448e13a662fb20145916636127995cbf37eb83 Mon Sep 17 00:00:00 2001 +From: Krzysztof Opasiak +Date: Thu, 1 Dec 2016 19:14:37 +0100 +Subject: usbip: vudc: fix: Clear already_seen flag also for ep0 + +From: Krzysztof Opasiak + +commit 3e448e13a662fb20145916636127995cbf37eb83 upstream. + +ep_list inside gadget structure doesn't contain ep0. +It is stored separately in ep0 field. + +This causes an urb hang if gadget driver decides to +delay setup handling. On host side this is visible as +timeout error when setting configuration. + +This bug can be reproduced using for example any gadget +with mass storage function. + +Fixes: abdb29574322 ("usbip: vudc: Add vudc_transfer") +Signed-off-by: Krzysztof Opasiak +Acked-by: Shuah Khan +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/usbip/vudc_transfer.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/usb/usbip/vudc_transfer.c ++++ b/drivers/usb/usbip/vudc_transfer.c +@@ -339,6 +339,8 @@ static void v_timer(unsigned long _vudc) + total = timer->frame_limit; + } + ++ /* We have to clear ep0 flags separately as it's not on the list */ ++ udc->ep[0].already_seen = 0; + list_for_each_entry(_ep, &udc->gadget.ep_list, ep_list) { + ep = to_vep(_ep); + ep->already_seen = 0; -- 2.47.3