aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)AuthorFilesLines
2019-04-25usb: usb251xb: Lock i2c-bus segment the hub residesSerge Semin1-0/+55
SMBus slave configuration is activated by CFG_SEL[1:0]=0x1 pins state. This is the mode the hub is supposed to be to let this driver work correctly. But a race condition might happen right after reset is cleared due to CFG_SEL[0] pin being multiplexed with SMBus SCL function. In case if the reset pin is handled by a i2c GPIO expander, which is also placed at the same i2c-bus segment as the usb251x SMB-interface connected to, then the hub reset clearance might cause the CFG_SEL[0] being latched in unpredictable state. So sometimes the hub configuration mode might be 0x1 (as expected), but sometimes being 0x0, which doesn't imply to have the hub SMBus-slave interface activated and consequently causes this driver failure. In order to fix the problem we must make sure the GPIO-reset chip doesn't reside the same i2c-bus segment as the SMBus-interface of the hub. If it doesn't, we can safely block the segment for the time the reset is cleared to prevent anyone generating a traffic at the i2c-bus SCL lane connected to the CFG_SEL[0] pin. But if it does, nothing we can do, so just return an error. If we locked the i2c-bus segment and tried to communicate with the GPIO-expander, it would cause a deadlock. If we didn't lock the i2c-bus segment, it would randomly cause the CFG_SEL[0] bit flip. Signed-off-by: Serge Semin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-25usb: dwc3: Allow building USB_DWC3_QCOM without EXTCONMarc Gonzalez1-2/+4
Keep EXTCON support optional, as some platforms do not need it. Do the same for USB_DWC3_OMAP while we're at it. Fixes: 3def4031b3e3f ("usb: dwc3: add EXTCON dependency for qcom") Signed-off-by: Marc Gonzalez <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-25usbip: stub_rx: tidy the indenting in is_clear_halt_cmd()Dan Carpenter1-3/+3
There is an extra space character before the return statement. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-24Merge tag 'drm/tegra/for-5.2-rc1' of ↵Dave Airlie1-1/+2
git://anongit.freedesktop.org/tegra/linux into drm-next drm/tegra: Changes for v5.2-rc1 This contains a fix for the usage of shared resets that previously generated a WARN on boot. In addition, there's a fix for CPU cache maintenance of GEM buffers allocated using get_pages(). (airlied: contains a merge from a shared tegra tree) Signed-off-by: Dave Airlie <[email protected]> From: Thierry Reding <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-04-21USB: serial: digi_acceleport: clean up set_termiosJohan Hovold1-17/+16
Clean up set_termios() by adding missing white space around operators and making a couple of continuation lines more readable. Also drop a couple of redundant braces. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2019-04-21USB: serial: digi_acceleport: clean up modem-control handlingJohan Hovold1-4/+4
Clean up modem-control handling somewhat by adding missing whitespace around operators and splitting a long statement in two. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2019-04-19USB: core: Fix bug caused by duplicate interface PM usage counterAlan Stern2-21/+5
The syzkaller fuzzer reported a bug in the USB hub driver which turned out to be caused by a negative runtime-PM usage counter. This allowed a hub to be runtime suspended at a time when the driver did not expect it. The symptom is a WARNING issued because the hub's status URB is submitted while it is already active: URB 0000000031fb463e submitted while active WARNING: CPU: 0 PID: 2917 at drivers/usb/core/urb.c:363 The negative runtime-PM usage count was caused by an unfortunate design decision made when runtime PM was first implemented for USB. At that time, USB class drivers were allowed to unbind from their interfaces without balancing the usage counter (i.e., leaving it with a positive count). The core code would take care of setting the counter back to 0 before allowing another driver to bind to the interface. Later on when runtime PM was implemented for the entire kernel, the opposite decision was made: Drivers were required to balance their runtime-PM get and put calls. In order to maintain backward compatibility, however, the USB subsystem adapted to the new implementation by keeping an independent usage counter for each interface and using it to automatically adjust the normal usage counter back to 0 whenever a driver was unbound. This approach involves duplicating information, but what is worse, it doesn't work properly in cases where a USB class driver delays decrementing the usage counter until after the driver's disconnect() routine has returned and the counter has been adjusted back to 0. Doing so would cause the usage counter to become negative. There's even a warning about this in the USB power management documentation! As it happens, this is exactly what the hub driver does. The kick_hub_wq() routine increments the runtime-PM usage counter, and the corresponding decrement is carried out by hub_event() in the context of the hub_wq work-queue thread. This work routine may sometimes run after the driver has been unbound from its interface, and when it does it causes the usage counter to go negative. It is not possible for hub_disconnect() to wait for a pending hub_event() call to finish, because hub_disconnect() is called with the device lock held and hub_event() acquires that lock. The only feasible fix is to reverse the original design decision: remove the duplicate interface-specific usage counter and require USB drivers to balance their runtime PM gets and puts. As far as I know, all existing drivers currently do this. Signed-off-by: Alan Stern <[email protected]> Reported-and-tested-by: [email protected] CC: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-19usb: mtu3: get optional clock by devm_clk_get_optional()Chunfeng Yun1-16/+3
Use devm_clk_get_optional() to get optional clock instead of optional_clk_get() which uses devm_clk_get() to get clock and checks for -EPROBE_DEFER but not -ENOENT as devm_clk_get_optional() does, in fact, only ignoring -ENOENT will cover more errors, so the replacement doesn't change original purpose. Signed-off-by: Chunfeng Yun <[email protected]> Reviewed-by: Matthias Brugger <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-19usb: chipidea: msm: get optional clock by devm_clk_get_optional()Chunfeng Yun1-6/+3
When the driver tries to get optional clock, it ignores all errors except -EPROBE_DEFER, but if only ignores -ENOENT, it will cover some real errors, such as -ENOMEM, so use devm_clk_get_optional() to get optional clock. Cc: Peter Chen <[email protected]> Signed-off-by: Chunfeng Yun <[email protected]> Acked-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-19usb: dwc2: get optional clock by devm_clk_get_optional()Chunfeng Yun1-3/+3
When the driver tries to get optional clock, it ignores all errors, but if only ignores -ENOENT, it will cover some real errors, such as -EPROBE_DEFER, so use devm_clk_get_optional() to get optional clock. Cc: Minas Harutyunyan <[email protected]> Signed-off-by: Chunfeng Yun <[email protected]> Acked-by: Minas Harutyunyan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-19usb: misc: usb3503: get optional clock by devm_clk_get_optional()Chunfeng Yun1-30/+18
When the driver tries to get optional clock, it ignores all errors except -EPROBE_DEFER, but if only ignores -ENOENT, it will cover some real errors, such as -ENOMEM, so use devm_clk_get_optional() to get optional clock. And remove unnecessary stack variable clk. Cc: Dongjin Kim <[email protected]> Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-19usb: host: xhci-plat: get optional clock by devm_clk_get_optional()Chunfeng Yun1-21/+18
When the driver tries to get optional clock, it ignores all errors except -EPROBE_DEFER, but if only ignores -ENOENT, it will cover some real errors, such as -ENOMEM, so use devm_clk_get_optional() to get optional clock. Cc: Mathias Nyman <[email protected]> Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-19usb: xhci-mtk: get optional clock by devm_clk_get_optional()Chunfeng Yun1-16/+3
Use devm_clk_get_optional() to get optional clock instead of optional_clk_get() which uses devm_clk_get() to get clock and checks for -EPROBE_DEFER but not -ENOENT as devm_clk_get_optional() does, in fact, only ignoring -ENOENT will cover more errors, so the replacement doesn't change original purpose. Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-19usb: typec: fusb302: Revert "Resolve fixed power role contract setup"Hans de Goede1-9/+46
Some tcpc device-drivers need to explicitly be told to watch for connection events, otherwise the tcpc will not generate any TCPM_CC_EVENTs and devices being plugged into the Type-C port will not be noticed. For dual-role ports tcpm_start_drp_toggling() is used to tell the tcpc to watch for connection events. But for single-role ports we've so far been falling back to just calling tcpm_set_cc(). For some tcpc-s such as the fusb302 this is not enough and no TCPM_CC_EVENT will be generated. Commit ea3b4d5523bc ("usb: typec: fusb302: Resolve fixed power role contract setup") fixed SRPs not working because of this by making the fusb302 driver start connection detection on every tcpm_set_cc() call. It turns out this breaks src->snk power-role swapping because during the swap we first set the Cc pins to Rp, calling set_cc, and then send a PS_RDY message. But the fusb302 cannot send PD messages while its toggling engine is active, so sending the PS_RDY message fails. Struct tcpc_dev now has a new start_srp_connection_detect callback and fusb302.c now implements this. This callback gets called when we the fusb302 needs to start connection detection, fixing fusb302 SRPs not seeing connected devices. This allows us to revert the changes to fusb302's set_cc implementation, making it once again purely setup the Cc-s and matching disconnect detection, fixing src->snk power-role swapping no longer working. Note that since the code was refactored in between, codewise this is not a straight forward revert. Functionality wise this is a straight revert and the original functionality is fully restored. Fixes: ea3b4d5523bc ("usb: typec: fusb302: Resolve fixed power role ...") Cc: Adam Thomson <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Acked-by: Heikki Krogerus <[email protected]> Tested-by: Adam Thomson <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-19usb: typec: fusb302: Implement start_toggling for all port-typesHans de Goede1-3/+13
When in single-role port mode, we must start single-role toggling to get an interrupt when a device / cable gets plugged into the port. This commit modifies the fusb302 start_toggling implementation to start toggling for all port-types, so that connection-detection works on single-role ports too. Fixes: ea3b4d5523bc("usb: typec: fusb302: Resolve fixed power role ...") Cc: Adam Thomson <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Acked-by: Heikki Krogerus <[email protected]> Tested-by: Adam Thomson <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-19usb: typec: tcpm: Notify the tcpc to start connection-detection for SRPsHans de Goede4-27/+35
Some tcpc device-drivers need to explicitly be told to watch for connection events, otherwise the tcpc will not generate any TCPM_CC_EVENTs and devices being plugged into the Type-C port will not be noticed. For dual-role ports tcpm_start_drp_toggling() is used to tell the tcpc to watch for connection events. Sofar we lack a similar callback to the tcpc for single-role ports. With some tcpc-s such as the fusb302 this means no TCPM_CC_EVENTs will be generated when the port is configured as a single-role port. This commit renames start_drp_toggling to start_toggling and since the device-properties are parsed by the tcpm-core, adds a port_type parameter to the start_toggling callback so that the tcpc_dev driver knows the port-type and can act accordingly when it starts toggling. The new start_toggling callback now always gets called if defined, instead of only being called for DRP ports. To avoid this causing undesirable functional changes all existing start_drp_toggling implementations are not only renamed to start_toggling, but also get a port_type check added and return -EOPNOTSUPP when port_type is not DRP. Fixes: ea3b4d5523bc("usb: typec: fusb302: Resolve fixed power role ...") Cc: Adam Thomson <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Acked-by: Heikki Krogerus <[email protected]> Tested-by: Adam Thomson <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-19usb: host: use usb_endpoint_maxp instead of usb_maxpacketYan Zhu1-6/+4
fhci_queue_urb() shouldn't use urb->pipe to compute the maxpacket size anyway.It should use usb_endpoint_maxp(&urb->ep->desc). Signed-off-by: Yan Zhu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-19USB: dummy-hcd: Fix failure to give back unlinked URBsAlan Stern1-4/+15
The syzkaller USB fuzzer identified a failure mode in which dummy-hcd would never give back an unlinked URB. This causes usb_kill_urb() to hang, leading to WARNINGs and unkillable threads. In dummy-hcd, all URBs are given back by the dummy_timer() routine as it scans through the list of pending URBS. Failure to give back URBs can be caused by failure to start or early exit from the scanning loop. The code currently has two such pathways: One is triggered when an unsupported bus transfer speed is encountered, and the other by exhausting the simulated bandwidth for USB transfers during a frame. This patch removes those two paths, thereby allowing all unlinked URBs to be given back in a timely manner. It adds a check for the bus speed when the gadget first starts running, so that dummy_timer() will never thereafter encounter an unsupported speed. And it prevents the loop from exiting as soon as the total bandwidth has been used up (the scanning loop continues, giving back unlinked URBs as they are found, but not transferring any more data). Thanks to Andrey Konovalov for manually running the syzkaller fuzzer to help track down the source of the bug. Signed-off-by: Alan Stern <[email protected]> Reported-and-tested-by: [email protected] CC: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-17USB: core: Don't unbind interfaces following device reset failureAlan Stern1-1/+4
The SCSI core does not like to have devices or hosts unregistered while error recovery is in progress. Trying to do so can lead to self-deadlock: Part of the removal code tries to obtain a lock already held by the error handler. This can cause problems for the usb-storage and uas drivers, because their error handler routines perform a USB reset, and if the reset fails then the USB core automatically goes on to unbind all drivers from the device's interfaces -- all while still in the context of the SCSI error handler. As it turns out, practically all the scenarios leading to a USB reset failure end up causing a device disconnect (the main error pathway in usb_reset_and_verify_device(), at the end of the routine, calls hub_port_logical_disconnect() before returning). As a result, the hub_wq thread will soon become aware of the problem and will unbind all the device's drivers in its own context, not in the error-handler's context. This means that usb_reset_device() does not need to call usb_unbind_and_rebind_marked_interfaces() in cases where usb_reset_and_verify_device() has returned an error, because hub_wq will take care of everything anyway. This particular problem was observed in somewhat artificial circumstances, by using usbfs to tell a hub to power-down a port connected to a USB-3 mass storage device using the UAS protocol. With the port turned off, the currently executing command timed out and the error handler started running. The USB reset naturally failed, because the hub port was off, and the error handler deadlocked as described above. Not carrying out the call to usb_unbind_and_rebind_marked_interfaces() fixes this issue. Signed-off-by: Alan Stern <[email protected]> Reported-by: Kento Kobayashi <[email protected]> Tested-by: Kento Kobayashi <[email protected]> CC: Bart Van Assche <[email protected]> CC: Martin K. Petersen <[email protected]> CC: Jacky Cao <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-16usb-storage: Set virt_boundary_mask to avoid SG overflowsAlan Stern1-14/+12
The USB subsystem has always had an unusual requirement for its scatter-gather transfers: Each element in the scatterlist (except the last one) must have a length divisible by the bulk maxpacket size. This is a particular issue for USB mass storage, which uses SG lists created by the block layer rather than setting up its own. So far we have scraped by okay because most devices have a logical block size of 512 bytes or larger, and the bulk maxpacket sizes for USB 2 and below are all <= 512. However, USB 3 has a bulk maxpacket size of 1024. Since the xhci-hcd driver includes native SG support, this hasn't mattered much. But now people are trying to use USB-3 mass storage devices with USBIP, and the vhci-hcd driver currently does not have full SG support. The result is an overflow error, when the driver attempts to implement an SG transfer of 63 512-byte blocks as a single 3584-byte (7 blocks) transfer followed by seven 4096-byte (8 blocks) transfers. The device instead sends 31 1024-byte packets followed by a 512-byte packet, and this overruns the first SG buffer. Ideally this would be fixed by adding better SG support to vhci-hcd. But for now it appears we can work around the problem by asking the block layer to respect the maxpacket limitation, through the use of the virt_boundary_mask. Signed-off-by: Alan Stern <[email protected]> Reported-by: Seth Bollinger <[email protected]> Tested-by: Seth Bollinger <[email protected]> CC: Ming Lei <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-16USB: core: Fix unterminated string returned by usb_string()Alan Stern1-1/+3
Some drivers (such as the vub300 MMC driver) expect usb_string() to return a properly NUL-terminated string, even when an error occurs. (In fact, vub300's probe routine doesn't bother to check the return code from usb_string().) When the driver goes on to use an unterminated string, it leads to kernel errors such as stack-out-of-bounds, as found by the syzkaller USB fuzzer. An out-of-range string index argument is not at all unlikely, given that some devices don't provide string descriptors and therefore list 0 as the value for their string indexes. This patch makes usb_string() return a properly terminated empty string along with the -EINVAL error code when an out-of-range index is encountered. And since a USB string index is a single-byte value, indexes >= 256 are just as invalid as values of 0 or below. Signed-off-by: Alan Stern <[email protected]> Reported-by: [email protected] CC: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-16USB: hub: Remove returned value 'status' since never usedMathieu Malaterre1-7/+6
The returned value in status has never been used since commit 4296c70a5ec3 ("USB/xHCI: Enable USB 3.0 hub remote wakeup.") So remove 'status' completely. Remove warning (W=1): drivers/usb/core/hub.c:3671:8: warning: variable 'status' set but not used [-Wunused-but-set-variable] Signed-off-by: Mathieu Malaterre <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-16usb: host: xhci-tegra: Add Tegra186 XUSB supportJC Kuo1-0/+25
This commit adds Tegra186 XUSB host mode controller support. This is very similar to the existing support for Tegra124 and Tegra210, except that the number of ports and PHYs differs and the IPFS wrapper being gone. Signed-off-by: JC Kuo <[email protected]> Acked-by: Mathias Nyman <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-16usb: host: xhci-tegra: Selectively program IPFSJC Kuo1-17/+26
Starting with Tegra186, the XUSB controller no longer has the IPFS wrapper. This commit adds a "has_ipfs" field to struct tegra_xusb_soc that can be used to declare the existence of the IPFS wrapper. For the existing chips (i.e. Tegra124 and Tegra210), the new field is set to true. A future patch adding support for Tegra186 will set it to false. Signed-off-by: JC Kuo <[email protected]> Acked-by: Mathias Nyman <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-12usb: ohci-da8xx: drop the vbus GPIOBartosz Golaszewski1-27/+5
All users now setup a fixed regulator for the vbus supply. We can drop the vbus GPIO code. Signed-off-by: Bartosz Golaszewski <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Sekhar Nori <[email protected]>
2019-04-12usb: ohci-da8xx: disable the regulator if the overcurrent irq firedBartosz Golaszewski1-5/+17
Historically the power supply management in this driver has been handled in two separate places in parallel. Device-tree users simply defined an appropriate regulator, while two boards with no DT support (da830-evm and omapl138-hawk) passed functions defined in their respective board files over platform data. These functions simply used legacy GPIO calls to watch the oc GPIO for interrupts and disable the vbus GPIO when the irq fires. Commit d193abf1c913 ("usb: ohci-da8xx: add vbus and overcurrent gpios") updated these GPIO calls to the modern API and moved them inside the driver. This however is not the optimal solution for the vbus GPIO which should be modeled as a fixed regulator that can be controlled with a GPIO. In order to keep the overcurrent protection available once we move the board files to using fixed regulators we need to disable the enable_reg regulator when the overcurrent indicator interrupt fires. Since we cannot call regulator_disable() from interrupt context, we need to switch to using a oneshot threaded interrupt. Acked-by: Alan Stern <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Sekhar Nori <[email protected]>
2019-04-12usb: ohci-da8xx: let the regulator framework keep track of use countBartosz Golaszewski1-6/+2
There's no reason to have a separate variable to keep track of the regulator state. The regulator core already does that. Remove reg_enabled from struct da8xx_ohci_hcd. Signed-off-by: Bartosz Golaszewski <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Sekhar Nori <[email protected]>
2019-04-08drivers: Remove explicit invocations of mmiowb()Will Deacon2-6/+0
mmiowb() is now implied by spin_unlock() on architectures that require it, so there is no reason to call it from driver code. This patch was generated using coccinelle: @mmiowb@ @@ - mmiowb(); and invoked as: $ for d in drivers include/linux/qed sound; do \ spatch --include-headers --sp-file mmiowb.cocci --dir $d --in-place; done NOTE: mmiowb() has only ever guaranteed ordering in conjunction with spin_unlock(). However, pairing each mmiowb() removal in this patch with the corresponding call to spin_unlock() is not at all trivial, so there is a small chance that this change may regress any drivers incorrectly relying on mmiowb() to order MMIO writes between CPUs using lock-free synchronisation. If you've ended up bisecting to this commit, you can reintroduce the mmiowb() calls using wmb() instead, which should restore the old behaviour on all architectures other than some esoteric ia64 systems. Acked-by: Linus Torvalds <[email protected]> Signed-off-by: Will Deacon <[email protected]>
2019-04-03video: backlight: Remove useless BACKLIGHT_LCD_SUPPORT kernel symbolAlexander Shiyan1-1/+0
We have two *_CLASS_DEVICE kernel config options (LCD_CLASS_DEVICE and BACKLIGHT_LCD_DEVICE) that do the same job. The patch removes useless BACKLIGHT_LCD_SUPPORT option and converts LCD_CLASS_DEVICE into a menu. Signed-off-by: Alexander Shiyan <[email protected]> Acked-by: Bartlomiej Zolnierkiewicz <[email protected]> Acked-by: Daniel Thompson <[email protected]> Signed-off-by: Lee Jones <[email protected]>
2019-04-03USB: serial: pl2303: fix tranceiver suspend modeJohan Hovold1-4/+29
Add helper function to update register bits instead of overwriting the entire control register when updating the flow-control settings. This specifically avoids having the tranceiver suspend mode (bit 0) depend on the flow control setting. The tranceiver is currently configured at probe to be disabled during suspend, but this was overridden when disabling flow control or enabling xon/xoff. Fixes: 715f9527c1c1 ("USB: flow control fix for pl2303") Fixes: 7041d9c3f01b ("USB: serial: pl2303: add support for tx xon/xoff flow control") Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2019-04-03USB: serial: pl2303: fix non-supported xon/xoffJohan Hovold1-5/+20
Older pl2303 devices do not support automatic xon/xoff flow control, so add add a flag to prevent trying to enable it for legacy device types. Refactor the IXON test into a helper function to improve readability. Fixes: 7041d9c3f01b ("USB: serial: pl2303: add support for tx xon/xoff flow control") Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2019-04-01Merge 5.1-rc3 into usb-nextGreg Kroah-Hartman22-36/+106
We want the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-29Merge tag 'usb-serial-5.1-rc3' of ↵Greg Kroah-Hartman5-8/+20
https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus Johan writes: USB-serial fixes for 5.1-rc3 Here's a fix for a long-standing refcount issue in the mos7720 parport implementation, and a set of device id updates. All have been in linux-next with no reported issues. Signed-off-by: Johan Hovold <[email protected]> * tag 'usb-serial-5.1-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial: USB: serial: option: add Olicard 600 USB: serial: cp210x: add new device id USB: serial: mos7720: fix mos_parport refcount imbalance on error path USB: serial: option: set driver_info for SIM5218 and compatibles USB: serial: ftdi_sio: add additional NovaTech products USB: serial: option: add support for Quectel EM12
2019-03-29Merge tag 'fixes-for-v5.1-rc2' of ↵Greg Kroah-Hartman4-8/+11
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus Felipe writes: usb: fixes for v5.1-rc2 One deadlock fix on f_hid. NET2280 got a fix on its dequeue implementation and a fix for overrun of OUT messages. DWC3 learned about another Intel product: Comment Lake PCH. NET2272 got a similar fix to NET2280 on its dequeue implementation. * tag 'fixes-for-v5.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: USB: gadget: f_hid: fix deadlock in f_hidg_write() usb: gadget: net2272: Fix net2272_dequeue() usb: gadget: net2280: Fix net2280_dequeue() usb: gadget: net2280: Fix overrun of OUT messages usb: dwc3: pci: add support for Comet Lake PCH ID
2019-03-28USB: serial: option: add Olicard 600Bjørn Mork1-4/+6
This is a Qualcomm based device with a QMI function on interface 4. It is mode switched from 2020:2030 using a standard eject message. T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 6 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=2020 ProdID=2031 Rev= 2.32 S: Manufacturer=Mobile Connect S: Product=Mobile Connect S: SerialNumber=0123456789ABCDEF C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=125us Cc: [email protected] Signed-off-by: Bjørn Mork <[email protected]> [ johan: use tabs to align comments in adjacent lines ] Signed-off-by: Johan Hovold <[email protected]>
2019-03-28USB: serial: cp210x: add new device idGreg Kroah-Hartman1-0/+1
Lorenz Messtechnik has a device that is controlled by the cp210x driver, so add the device id to the driver. The device id was provided by Silicon-Labs for the devices from this vendor. Reported-by: Uli <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Cc: stable <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2019-03-28usb: u132-hcd: fix resource leakMukesh Ojha1-0/+3
if platform_driver_register fails, cleanup the allocated resource gracefully. Signed-off-by: Mukesh Ojha <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-28usb: cdc-acm: fix race during wakeup blocking TX trafficRomain Izard1-3/+1
When the kernel is compiled with preemption enabled, the URB completion handler can run in parallel with the work responsible for waking up the tty layer. If the URB handler sets the EVENT_TTY_WAKEUP bit during the call to tty_port_tty_wakeup() to signal that there is room for additional input, it will be cleared at the end of this call. As a result, TX traffic on the upper layer will be blocked. This can be seen with a kernel configured with CONFIG_PREEMPT, and a fast modem connected with PPP running over a USB CDC-ACM port. Use test_and_clear_bit() instead, which ensures that each wakeup requested by the URB completion code will trigger a call to tty_port_tty_wakeup(). Fixes: 1aba579f3cf5 cdc-acm: handle read pipe errors Signed-off-by: Romain Izard <[email protected]> Cc: stable <[email protected]> Acked-by: Oliver Neukum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: mtu3: fix EXTCON dependencyArnd Bergmann1-0/+1
When EXTCON is a loadable module, mtu3 fails to link as built-in: drivers/usb/mtu3/mtu3_plat.o: In function `mtu3_probe': mtu3_plat.c:(.text+0x690): undefined reference to `extcon_get_edev_by_phandle' Add a Kconfig dependency to force mtu3 also to be a loadable module if extconn is, but still allow it to be built without extcon. Fixes: d0ed062a8b75 ("usb: mtu3: dual-role mode support") Signed-off-by: Arnd Bergmann <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: usb251xb: fix to avoid potential NULL pointer dereferenceAditya Pakki1-1/+1
of_match_device in usb251xb_probe can fail and returns a NULL pointer. The patch avoids a potential NULL pointer dereference in this scenario. Signed-off-by: Aditya Pakki <[email protected]> Reviewed-by: Richard Leitner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: core: Try generic PHY_MODE_USB_HOST if usb_phy_roothub_set_mode failsChen-Yu Tsai1-0/+3
Some PHYs do not support PHY_MODE_USB_HOST_SS, i.e. USB 3.0 or higher. Fall back and try the more generic PHY_MODE_USB_HOST if it fails. Fixes: b97a31348379 ("usb: core: comply to PHY framework") Signed-off-by: Chen-Yu Tsai <[email protected]> Tested-by: Neil Armstrong <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: introduce usb_ep_type_string() functionChunfeng Yun4-35/+20
In some places, the code prints a human-readable USB endpoint transfer type (e.g. "bulk"). This involves a switch statement sometimes wrapped around in ({ ... }) block leading to code repetition. To make this scenario easier, here introduces usb_ep_type_string() function, which returns a human-readable name of provided endpoint type. It also changes a few places switch was used to use this new function. Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: typec: fusb302: Make fusb302_irq_work staticYueHaibing1-1/+1
Fix sparse warning: drivers/usb/typec/tcpm/fusb302.c:1454:6: warning: symbol 'fusb302_irq_work' was not declared. Should it be static? Signed-off-by: YueHaibing <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Reviewed-by: Mukesh Ojha <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: u132-hcd: fix potential NULL pointer dereferenceKangjie Lu1-0/+2
In case create_singlethread_workqueue fails, the fix notifies callers the error to avoid potential NULL pointer dereferences. Signed-off-by: Kangjie Lu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: typec: wcove: Provide fwnode for the portHeikki Krogerus1-13/+16
By registering a software fwnode for the port, we can supply the connector capabilities to the tcpm using the common USB connector device properties instead of relying on platform data (struct tcpc_config). Signed-off-by: Heikki Krogerus <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: core: Add PM runtime calls to usb_hcd_platform_shutdownTony Lindgren1-0/+3
If ohci-platform is runtime suspended, we can currently get an "imprecise external abort" on reboot with ohci-platform loaded when PM runtime is implemented for the SoC. Let's fix this by adding PM runtime support to usb_hcd_platform_shutdown. Signed-off-by: Tony Lindgren <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: sierra: fix a missing check of device_create_fileKangjie Lu1-3/+1
device_create_file() could fail and return an error code. The fix captures the error and returns the error code upstream in case it indeed failed. Signed-off-by: Kangjie Lu <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: mtu3: add a function to switch mailbox state to stringChunfeng Yun1-2/+18
By introducing mailbox_state_string(), allow to make debug log more readable Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: mtu3: add tracepoints to help debugChunfeng Yun9-1/+347
This patch implements a few initial tracepoints for the mtu3 driver. More traces can be added as necessary in order to ease the task of debugging. Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: mtu3: move vbus and mode debugfs interfaces into mtu3_debugfs.cChunfeng Yun4-110/+110
Due to the separated debugfs files are added, move vbus and mode debugfs interfaces related with dual-role switch from mtu3_dr.c into mtu3_debugfs.c Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>