summaryrefslogtreecommitdiffstats
path: root/drivers/usb
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'usb-5.14-rc1' of ↵Linus Torvalds2021-07-05149-1942/+3915
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb Pull USB / Thunderbolt updates from Greg KH: "Here is the big set of USB and Thunderbolt patches for 5.14-rc1. Nothing major here just lots of little changes for new hardware and features. Highlights are: - more USB 4 support added to the thunderbolt core - build warning fixes all over the place - usb-serial driver updates and new device support - mtu3 driver updates - gadget driver updates - dwc3 driver updates - dwc2 driver updates - isp1760 host driver updates - musb driver updates - lots of other tiny things. Full details are in the shortlog. All of these have been in linux-next for a while now with no reported issues" * tag 'usb-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (223 commits) phy: qcom-qusb2: Add configuration for SM4250 and SM6115 dt-bindings: phy: qcom,qusb2: document sm4250/6115 compatible dt-bindings: usb: qcom,dwc3: Add bindings for sm6115/4250 USB: cdc-acm: blacklist Heimann USB Appset device usb: xhci-mtk: allow multiple Start-Split in a microframe usb: ftdi-elan: remove redundant continue statement in a while-loop usb: class: cdc-wdm: return the correct errno code xhci: remove redundant continue statement usb: dwc3: Fix debugfs creation flow usb: gadget: hid: fix error return code in hid_bind() usb: gadget: eem: fix echo command packet response issue usb: gadget: f_hid: fix endianness issue with descriptors Revert "USB: misc: Add onboard_usb_hub driver" Revert "of/platform: Add stubs for of_platform_device_create/destroy()" Revert "usb: host: xhci-plat: Create platform device for onboard hubs in probe()" Revert "arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub" xhci: solve a double free problem while doing s4 xhci: handle failed buffer copy to URB sg list and fix a W=1 copiler warning xhci: Add adaptive interrupt rate for isoch TRBs with XHCI_AVOID_BEI quirk xhci: Remove unused defines for ERST_SIZE and ERST_ENTRIES ...
| * USB: cdc-acm: blacklist Heimann USB Appset deviceHannu Hartikainen2021-06-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The device (32a7:0000 Heimann Sensor GmbH USB appset demo) claims to be a CDC-ACM device in its descriptors but in fact is not. If it is run with echo disabled it returns garbled data, probably due to something that happens in the TTY layer. And when run with echo enabled (the default), it will mess up the calibration data of the sensor the first time any data is sent to the device. In short, I had a bad time after connecting the sensor and trying to get it to work. I hope blacklisting it in the cdc-acm driver will save someone else a bit of trouble. Signed-off-by: Hannu Hartikainen <hannu@hrtk.in> Cc: stable <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210622141454.337948-1-hannu@hrtk.in Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * usb: xhci-mtk: allow multiple Start-Split in a microframeChunfeng Yun2021-06-242-20/+0
| | | | | | | | | | | | | | | | | | | | This patch is used to relax bandwidth schedule by allowing multiple Start-Split in the same microframe. Reviewed-and-Tested-by: Ikjoon Jang <ikjn@chromium.org> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1623995165-25759-1-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * usb: ftdi-elan: remove redundant continue statement in a while-loopColin Ian King2021-06-241-1/+0
| | | | | | | | | | | | | | | | | | | | The continue statement at the end of the while-loop is redundant, remove it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Addresses-Coverity: ("Continue has no effect") Link: https://lore.kernel.org/r/20210621095545.9659-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * usb: class: cdc-wdm: return the correct errno codeJunlin Yang2021-06-241-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | The "rv" is initialized to "-ENOMEM", because "rv" is re-assigned to "-EINVAL", when kmalloc & usb_alloc_urb failed, the return value should return "-ENOMEM" rather than "-EINVAL",so the "rv" assignment is placed in the position where usb_endpoint_is_int_in is false. Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Junlin Yang <yangjunlin@yulong.com> Link: https://lore.kernel.org/r/20210621132415.2341-1-angkery@163.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * Merge tag 'usb-serial-5.14-rc1' of ↵Greg Kroah-Hartman2021-06-2421-174/+282
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next Johan writes: USB-serial updates for 5.14-rc1 Here are the USB-serial updates for 5.14-rc1, including: - gpio support for CP2108 - chars_in_buffer and write_room return-value updates - chars_in_buffer and write_room clean ups Included are also various clean ups. All have been in linux-next with no reported issues. * tag 'usb-serial-5.14-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial: USB: serial: cp210x: add support for GPIOs on CP2108 USB: serial: drop irq-flags initialisations USB: serial: mos7840: drop buffer-callback return-value comments USB: serial: mos7720: drop buffer-callback sanity checks USB: serial: io_edgeport: drop buffer-callback sanity checks USB: serial: digi_acceleport: add chars_in_buffer locking USB: serial: digi_acceleport: reduce chars_in_buffer over-reporting USB: serial: make usb_serial_driver::chars_in_buffer return uint USB: serial: make usb_serial_driver::write_room return uint
| | * USB: serial: cp210x: add support for GPIOs on CP2108Pho Tran2021-06-161-19/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to some other CP210x device types, CP2108 has a number of GPIO pins that can be exposed through gpiolib. CP2108 has four serial interfaces but only one set of GPIO pins, which is modelled as a single gpio chip and registered as a child of the first interface. CP2108 has 16 GPIOs so the width of the state variables needs to be extended to 16 bits and this is also reflected in the control requests. Like CP2104, CP2108 have GPIO pins with configurable alternate functions and pins unavailable for GPIO use are determined and reported to gpiolib at probe. Signed-off-by: Pho Tran <pho.tran@silabs.com> Co-developed-by: Tung Pham <tung.pham@silabs.com> Signed-off-by: Tung Pham <tung.pham@silabs.com> [ johan: rewrite gpio get() and set(); misc cleanups; amend commit message ] Link: https://lore.kernel.org/r/20210610132844.25495-1-johan@kernel.org Signed-off-by: Johan Hovold <johan@kernel.org>
| | * USB: serial: drop irq-flags initialisationsJohan Hovold2021-05-213-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no need to initialise irq-flags variables before saving the interrupt state. Drop the redundant initialisations from the three drivers that got this wrong. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
| | * USB: serial: mos7840: drop buffer-callback return-value commentsJohan Hovold2021-05-211-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver write_room and chars_in_buffer callbacks used to incorrectly return a negative errno in case they were called with a NULL port driver-data pointer or if some other always-true sanity checks failed. The bogus sanity checks were later removed by commit ce039bd4b21f ("USB: serial: mos7840: drop paranoid port checks") and 7b2faede671a ("USB: serial: mos7840: drop port driver data accessors") but the function-header comments were never updated to match. Drop the outdated return-value comments. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
| | * USB: serial: mos7720: drop buffer-callback sanity checksJohan Hovold2021-05-211-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver write_room and chars_in_buffer callbacks used to incorrectly return a negative errno in case they were ever called with a NULL port driver-data pointer. The return value was later changed to zero by commit 23198fda7182 ("tty: fix chars_in_buffers") but the bogus sanity checks were left in place as were the outdated function-header comments. The port driver data isn't cleared until after the port has been deregistered and all open ttys have been hung up so drop the unnecessary sanity checks and the outdated comments. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
| | * USB: serial: io_edgeport: drop buffer-callback sanity checksJohan Hovold2021-05-211-26/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver write_room and chars_in_buffer callbacks used to incorrectly return a negative errno in case they were called while or after the port had been closed. The return value was later changed to zero by commit d76f2f4462bb ("io_edgeport: Fix various bogus returns to the tty layer") but the bogus sanity checks were left in place as were the outdated function-header comments. These callbacks will never be called for an uninitialised port so drop the unnecessary sanity checks and the outdated comments. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
| | * USB: serial: digi_acceleport: add chars_in_buffer lockingJohan Hovold2021-05-211-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both the dp_write_urb_in_use flag and dp_out_buf_len counter should be accessed while holding the driver port lock. Add the missing locking to chars_in_buffer and clean up the implementation somewhat by using a common exit path. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
| | * USB: serial: digi_acceleport: reduce chars_in_buffer over-reportingJohan Hovold2021-05-211-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to an ancient quirk in n_tty poll implementation, the digi_acceleport driver has been reporting that its queue contains 256 (WAKEUP_CHARS) characters whenever its write URB is in use. This has not been necessary since 2003 when the line-discipline started taking the write room into account so let's return the maximum transfer size again in order to over-report a little less and incidentally fix the related debug statement. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
| | * USB: serial: make usb_serial_driver::chars_in_buffer return uintJiri Slaby2021-05-1913-37/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | tty_operations::chars_in_buffer is being switched to return uint. Do the same for usb_serial_driver's chars_in_buffer. Signed-off-by: Jiri Slaby <jslaby@suse.cz> [ johan: amend commit message ] Signed-off-by: Johan Hovold <johan@kernel.org>
| | * USB: serial: make usb_serial_driver::write_room return uintJiri Slaby2021-05-1919-48/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Line disciplines expect a positive value or zero returned from tty->ops->write_room (invoked by tty_write_room). Both of them are being updated to return an unsigned int. Switch also usb_serial_driver::write_room and all its users. Signed-off-by: Jiri Slaby <jslaby@suse.cz> [ johan: amend commit message, drop unrelated comment change ] Signed-off-by: Johan Hovold <johan@kernel.org>
| * | xhci: remove redundant continue statementColin Ian King2021-06-211-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The continue statement at the end of a for-loop has no effect, remove it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Addresses-Coverity: ("Continue has no effect") Cc: Mathias Nyman <mathias.nyman@intel.com> Link: https://lore.kernel.org/r/20210618090447.99114-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | usb: dwc3: Fix debugfs creation flowMinas Harutyunyan2021-06-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Creation EP's debugfs called earlier than debugfs folder for dwc3 device created. As result EP's debugfs are created in '/sys/kernel/debug' instead of '/sys/kernel/debug/usb/dwc3.1.auto'. Moved dwc3_debugfs_init() function call before calling dwc3_core_init_mode() to allow create dwc3 debugfs parent before creating EP's debugfs's. Fixes: 8d396bb0a5b6 ("usb: dwc3: debugfs: Add and remove endpoint dirs dynamically") Cc: stable <stable@vger.kernel.org> Reviewed-by: Jack Pham <jackp@codeaurora.org> Signed-off-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> Link: https://lore.kernel.org/r/01fafb5b2d8335e98e6eadbac61fc796bdf3ec1a.1623948457.git.Minas.Harutyunyan@synopsys.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | usb: gadget: hid: fix error return code in hid_bind()Yang Yingliang2021-06-211-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix to return a negative error code from the error handling case instead of 0. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20210618043835.2641360-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | usb: gadget: eem: fix echo command packet response issueLinyu Yuan2021-06-211-4/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when receive eem echo command, it will send a response, but queue this response to the usb request which allocate from gadget device endpoint zero, and transmit the request to IN endpoint of eem interface. on dwc3 gadget, it will trigger following warning in function __dwc3_gadget_ep_queue(), if (WARN(req->dep != dep, "request %pK belongs to '%s'\n", &req->request, req->dep->name)) return -EINVAL; fix it by allocating a usb request from IN endpoint of eem interface, and transmit the usb request to same IN endpoint of eem interface. Signed-off-by: Linyu Yuan <linyyuan@codeaurora.com> Cc: stable <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210616115142.34075-1-linyyuan@codeaurora.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | usb: gadget: f_hid: fix endianness issue with descriptorsRuslan Bilovol2021-06-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running sparse checker it shows warning message about incorrect endianness used for descriptor initialization: | f_hid.c:91:43: warning: incorrect type in initializer (different base types) | f_hid.c:91:43: expected restricted __le16 [usertype] bcdHID | f_hid.c:91:43: got int Fixing issue with cpu_to_le16() macro, however this is not a real issue as the value is the same both endians. Cc: Fabien Chouteau <fabien.chouteau@barco.com> Cc: Segiy Stetsyuk <serg_stetsuk@ukr.net> Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com> Link: https://lore.kernel.org/r/20210617162755.29676-1-ruslan.bilovol@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | Merge tag 'usb-v5.14-rc1' of ↵Greg Kroah-Hartman2021-06-212-7/+4
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next Peter writes: Some tiny improvements for cdns USB3 drivers, no important things. * tag 'usb-v5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb: usb: cdns3: cdns3-gadget: Use list_move_tail instead of list_del/list_add_tail doc: dt-binding: cdns,usb3: Add interrupt-names property under required usb: cdnsp: Useless condition has been removed usb: cdns3: Corrected comment to align with kernel-doc comment
| | * | usb: cdns3: cdns3-gadget: Use list_move_tail instead of list_del/list_add_tailBaokun Li2021-06-101-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using list_move_tail() instead of list_del() + list_add_tail(). Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Baokun Li <libaokun1@huawei.com> Link: https://lore.kernel.org/r/20210609072720.1358527-1-libaokun1@huawei.com Signed-off-by: Peter Chen <peter.chen@kernel.org>
| | * | usb: cdnsp: Useless condition has been removedPawel Laszczak2021-05-111-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code generates a Smatch warning: drivers/usb/cdns3/cdnsp-mem.c:1085 cdnsp_mem_cleanup() warn: variable dereferenced before check 'pdev->dcbaa' (see line 1067) The unchecked dereference happens inside the function when we call: cdnsp_free_priv_device(pdev); But fortunately, the "pdev->dcbaa" pointer can never be NULL so it does not lead to a runtime issue. We can just remove the NULL check which silences the warning and makes the code consistent. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Pawel Laszczak <pawell@cadence.com> Link: https://lore.kernel.org/r/20210505055854.40240-1-pawell@gli-login.cadence.com Signed-off-by: Peter Chen <peter.chen@kernel.org>
| | * | usb: cdns3: Corrected comment to align with kernel-doc commentSouptick Joarder2021-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Minor update in comment. Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Link: https://lore.kernel.org/r/1619338565-4574-1-git-send-email-jrdr.linux@gmail.com Signed-off-by: Peter Chen <peter.chen@kernel.org>
| * | | Merge tag 'v5.13-rc7' into usb-nextGreg Kroah-Hartman2021-06-212-2/+21
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | Revert "USB: misc: Add onboard_usb_hub driver"Greg Kroah-Hartman2021-06-183-515/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit b4e326165e21d6a11483f6a4de2174b933413554 as the patch series is causing build issues in linux-next at the moment. Cc: Matthias Kaehlcke <mka@chromium.org> Link: https://lore.kernel.org/r/YMuRcrE8xlWnFSWW@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | Revert "usb: host: xhci-plat: Create platform device for onboard hubs in ↵Greg Kroah-Hartman2021-06-183-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | probe()" This reverts commit c950686b382d0ea5234545fcce252c9e63d7b7a9 as the patch series is causing build issues in linux-next at the moment. Cc: Matthias Kaehlcke <mka@chromium.org> Link: https://lore.kernel.org/r/YMuRcrE8xlWnFSWW@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | xhci: solve a double free problem while doing s4Zhangjiantao (Kirin, nanjing)2021-06-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when system is doing s4, the process of xhci_resume may be as below: 1、xhci_mem_cleanup 2、xhci_init->xhci_mem_init->xhci_mem_cleanup(when memory is not enough). xhci_mem_cleanup will be executed twice when system is out of memory. xhci->port_caps is freed in xhci_mem_cleanup,but it isn't set to NULL. It will be freed twice when xhci_mem_cleanup is called the second time. We got following bug when system resumes from s4: kernel BUG at mm/slub.c:309! Internal error: Oops - BUG: 0 [#1] PREEMPT SMP CPU: 0 PID: 5929 Tainted: G S W 5.4.96-arm64-desktop #1 pc : __slab_free+0x5c/0x424 lr : kfree+0x30c/0x32c Call trace: __slab_free+0x5c/0x424 kfree+0x30c/0x32c xhci_mem_cleanup+0x394/0x3cc xhci_mem_init+0x9ac/0x1070 xhci_init+0x8c/0x1d0 xhci_resume+0x1cc/0x5fc xhci_plat_resume+0x64/0x70 platform_pm_thaw+0x28/0x60 dpm_run_callback+0x54/0x24c device_resume+0xd0/0x200 async_resume+0x24/0x60 async_run_entry_fn+0x44/0x110 process_one_work+0x1f0/0x490 worker_thread+0x5c/0x450 kthread+0x158/0x160 ret_from_fork+0x10/0x24 Original patch that caused this issue was backported to 4.4 stable, so this should be backported to 4.4 stabe as well. Fixes: cf0ee7c60c89 ("xhci: Fix memory leak when caching protocol extended capability PSI tables - take 2") Cc: stable@vger.kernel.org # v4.4+ Signed-off-by: Jiantao Zhang <water.zhangjiantao@huawei.com> Signed-off-by: Tao Xue <xuetao09@huawei.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20210617150354.1512157-5-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | xhci: handle failed buffer copy to URB sg list and fix a W=1 copiler warningMathias Nyman2021-06-171-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Set the urb->actual_length to bytes successfully copied in case all bytes weren't copied from a temporary buffer to the URB sg list. Also print a debug message Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20210617150354.1512157-4-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | xhci: Add adaptive interrupt rate for isoch TRBs with XHCI_AVOID_BEI quirkMathias Nyman2021-06-173-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Save a bit of power by not interrupting so often by default if XHCI_AVOID_BEI quirk is set. In normal cases the xhci driver will only generate an interrupt on the last isochronous TRB of an URB. In a common UVC webcam usecase there are 32 TRBs per URB. if AVOID_BEI flag is set then xhci driver will force an interrupt every 8th isoc TRB to make sure the event ring doesn't get too full. This is however way too frequent in common single webcam use cases, causing 1000 interrupts/sec and thus poor powermanagement performance. Instead start with interrupting every 32 isoc TRB, and halve it in case event ring becomes half-full. Stop halving when reaching a rate of every 8th trb. This is a one way solution. If interrupt rate is increased it will stay high until driver is reloaded. The highest rate is the same as the old default rate. Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20210617150354.1512157-3-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | xhci: Remove unused defines for ERST_SIZE and ERST_ENTRIESMathias Nyman2021-06-171-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't want those around confusing people. ERST_NUM_SEGS is used both when allocating event ring segments, and when allocating entries in the event ring segment table (erst). Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20210617150354.1512157-2-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: typec: Add the missed altmode_id_remove() in typec_register_altmode()Jing Xiangfeng2021-06-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | typec_register_altmode() misses to call altmode_id_remove() in an error path. Add the missed function call to fix it. Fixes: 8a37d87d72f0 ("usb: typec: Bus type for alternate modes") Cc: stable <stable@vger.kernel.org> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com> Link: https://lore.kernel.org/r/20210617073226.47599-1-jingxiangfeng@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: typec: tcpm: Relax disconnect threshold during power negotiationKyle Tso2021-06-171-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the voltage is being decreased in power negotiation, the Source will set the power supply to operate at the new voltage level before sending PS_RDY. Relax the threshold before sending Request Message so that it will not race with Source which begins to adjust the voltage right after it sends Accept Message (PPS) or tSrcTransition (25~35ms) after it sends Accept Message (non-PPS). The real threshold will be set after Sink receives PS_RDY Message. Fixes: f321a02caebd ("usb: typec: tcpm: Implement enabling Auto Discharge disconnect support") Cc: stable <stable@vger.kernel.org> Cc: Badhri Jagan Sridharan <badhri@google.com> Reviewed-by: Badhri Jagan Sridharan <badhri@google.com> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Kyle Tso <kyletso@google.com> Link: https://lore.kernel.org/r/20210616090102.1897674-1-kyletso@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: typec: tcpm: Ignore Vsafe0v in PR_SWAP_SNK_SRC_SOURCE_ON stateKyle Tso2021-06-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In PR_SWAP_SNK_SRC_SOURCE_ON state, Vsafe0v is expected as well so do nothing here to avoid state machine going into SNK_UNATTACHED. Fixes: 28b43d3d746b ("usb: typec: tcpm: Introduce vsafe0v for vbus") Cc: stable <stable@vger.kernel.org> Reviewed-by: Badhri Jagan Sridharan <badhri@google.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Kyle Tso <kyletso@google.com> Link: https://lore.kernel.org/r/20210615173206.1646477-1-kyletso@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: typec: tcpci: Fix up sink disconnect thresholds for PDBadhri Jagan Sridharan2021-06-171-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Table 4-3 VBUS Sink Characteristics" of "Type-C Cable and Connector Specification" defines the disconnect voltage thresholds of various configurations. This change fixes the disconnect threshold voltage calculation based on vSinkPD_min and vSinkDisconnectPD as defined by the table. Fixes: e1a97bf80a022 ("usb: typec: tcpci: Implement Auto discharge disconnect callbacks") Cc: stable <stable@vger.kernel.org> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com> Link: https://lore.kernel.org/r/20210615174323.1160132-1-badhri@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | USB: UDC: net2280: remove redundant continue statementColin Ian King2021-06-171-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The continue statement at the end of a for-loop has no effect, remove it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Addresses-Coverity: ("Continue has no effect") Link: https://lore.kernel.org/r/20210617112638.9072-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: host: u132-hcd: remove redundant continue statementsColin Ian King2021-06-171-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are continue statements at the end of loops that have no effect and are redundant. Remove them. Signed-off-by: Colin Ian King <colin.king@canonical.com> Addresses-Coverity: ("Continue has no effect") Link: https://lore.kernel.org/r/20210617123826.13764-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: host: xhci-tegra: Use devm_platform_get_and_ioremap_resource()Yang Yingliang2021-06-171-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use devm_platform_get_and_ioremap_resource() to simplify code. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20210616044519.2183826-3-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: host: xhci-tegra: Add missing of_node_put() in tegra_xusb_probe()Yang Yingliang2021-06-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This node pointer is returned by of_parse_phandle() with refcount incremented in this function. of_node_put() on it before exitting this function. Fixes: 971ee247060d ("usb: xhci: tegra: Enable ELPG for runtime/system PM") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20210616044519.2183826-2-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: host: xhci-tegra: add missing put_device() in tegra_xusb_probe()Yang Yingliang2021-06-171-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Goto put_padctl to put refcount of device on error in tegra_xusb_probe() Fixes: 971ee247060d ("usb: xhci: tegra: Enable ELPG for runtime/system PM") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20210616044519.2183826-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: renesas-xhci: Fix handling of unknown ROM stateMoritz Fischer2021-06-171-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ROM load sometimes seems to return an unknown status (RENESAS_ROM_STATUS_NO_RESULT) instead of success / fail. If the ROM load indeed failed this leads to failures when trying to communicate with the controller later on. Attempt to load firmware using RAM load in those cases. Fixes: 2478be82de44 ("usb: renesas-xhci: Add ROM loader for uPD720201") Cc: stable@vger.kernel.org Cc: Mathias Nyman <mathias.nyman@intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Vinod Koul <vkoul@kernel.org> Tested-by: Vinod Koul <vkoul@kernel.org> Reviewed-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Moritz Fischer <mdf@kernel.org> Link: https://lore.kernel.org/r/20210615153758.253572-1-mdf@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: host: xhci-plat: Create platform device for onboard hubs in probe()Matthias Kaehlcke2021-06-153-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Call onboard_hub_create/destroy_pdevs() from _probe()/_remove() to create/destroy platform devices for onboard USB hubs that may be connected to the root hub of the controller. These functions are a NOP unless CONFIG_USB_ONBOARD_HUB=y/m. Also add a field to struct xhci_hcd to keep track of the onboard hub platform devices that are owned by the xHCI. Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Link: https://lore.kernel.org/r/20210609150159.v12.4.I7a3a7d9d2126c34079b1cab87aa0b2ec3030f9b7@changeid Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | USB: misc: Add onboard_usb_hub driverMatthias Kaehlcke2021-06-153-0/+515
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main issue this driver addresses is that a USB hub needs to be powered before it can be discovered. For discrete onboard hubs (an example for such a hub is the Realtek RTS5411) this is often solved by supplying the hub with an 'always-on' regulator, which is kind of a hack. Some onboard hubs may require further initialization steps, like changing the state of a GPIO or enabling a clock, which requires even more hacks. This driver creates a platform device representing the hub which performs the necessary initialization. Currently it only supports switching on a single regulator, support for multiple regulators or other actions can be added as needed. Different initialization sequences can be supported based on the compatible string. Besides performing the initialization the driver can be configured to power the hub off during system suspend. This can help to extend battery life on battery powered devices which have no requirements to keep the hub powered during suspend. The driver can also be configured to leave the hub powered when a wakeup capable USB device is connected when suspending, and power it off otherwise. Technically the driver consists of two drivers, the platform driver described above and a very thin USB driver that subclasses the generic driver. The purpose of this driver is to provide the platform driver with the USB devices corresponding to the hub(s) (a hub controller may provide multiple 'logical' hubs, e.g. one to support USB 2.0 and another for USB 3.x). Note: the current series only supports hubs connected directly to a root hub (through xhci-plat), support for other configurations could be added if needed. Co-developed-by: Ravi Chandra Sadineni <ravisadineni@chromium.org> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org> Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Link: https://lore.kernel.org/r/20210609150159.v12.2.I7c9a1f1d6ced41dd8310e8a03da666a32364e790@changeid Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: mtu3: use clock bulk to get clocksChunfeng Yun2021-06-152-80/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use clock bulk helpers to get/enable/disable clocks, meanwhile make sys_ck optional, then will be easier to handle clocks. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1623139069-8173-24-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: mtu3: rebuild role switch get/set hooksChunfeng Yun2021-06-151-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use common helper ssusb_set_mode() to do role switch instead of manual switch helper; Remove unnecessary local variable when get role status Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1623139069-8173-14-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: mtu3: use force mode for dual role switchChunfeng Yun2021-06-152-12/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Force IDDIG status for all three ways of dual role switch, this is needed when use Type-C to switch mode. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1623139069-8173-13-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: mtu3: add helper to get pointer of ssusb_mtk structChunfeng Yun2021-06-151-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a helper to get pointer of ssusb_mtk struct from the pointer of otg_switch_mtk struct. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1623139069-8173-12-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: mtu3: rebuild role switch flow of extconChunfeng Yun2021-06-152-32/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a preparation patch to plan to use the same work to handle role switch for all three supported ways. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1623139069-8173-11-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: mtu3: use enum usb_role instead of private defined onesChunfeng Yun2021-06-151-37/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now we mainly use usb-role-switch to set dual role mode, and all three ways supported use the same function to switch mode, use usb_role enum will make code clear Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1623139069-8173-10-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: mtu3: drop support vbus detectionChunfeng Yun2021-06-152-55/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now it's never used on any platform, and will not used later. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1623139069-8173-9-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>