summaryrefslogtreecommitdiffstats
path: root/drivers
AgeCommit message (Collapse)AuthorFilesLines
2017-06-19usb: gadget: function: make current f_uac1 implementation legacyRuslan Bilovol7-51/+53
Before introducing new f_uac1 function (with virtual ALSA card) make current implementation legacy. This includes renaming of existing files, some variables, config options and documentation Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-19usb: gadget: f_uac2: split out audio coreRuslan Bilovol6-636/+845
Abstract the peripheral side ALSA sound card code from the f_uac2 function into a component that can be called by various functions, so the various flavors can be split apart and selectively reused. Visible changes: - add uac_params structure to pass audio paramteres for g_audio_setup - make ALSA sound card's name configurable - add [in/out]_ep_maxpsize - allocate snd_uac_chip structure during g_audio_setup - add u_audio_[start/stop]_[capture/playback] functions Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-19usb: gadget: f_uac2: remove platform driver/device creationRuslan Bilovol1-79/+28
Simplify f_uac2 by removing platform driver/device creation; use composite's usb_gadget device as parent for sound card and for debug prints. This removes extra layer of code without any functional change. Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-19usb: gadget: function: f_uac1: implement get_alt()Ruslan Bilovol1-1/+39
After commit 7e4da3fcf7c9 ("usb: gadget: composite: Test get_alt() presence instead of set_alt()") f_uac1 function became broken because it doesn't have get_alt() callback implementation and composite framework never set altsetting 1 for audiostreaming interface. On host site it looks like: [424339.017711] 21:1:1: usb_set_interface failed (-32) Since host can't set altsetting 1, it can't start playing audio. In order to fix it implemented get_alt along with minor improvements (error conditions checking) similar to what existing f_uac2 has. Cc: Krzysztof Opasiak <k.opasiak@samsung.com> Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-19usb: gadget: udc: atmel: Remove unnecessary macrosAlexandre Belloni2-12/+8
commit 46ddd79e893b ("usb: gadget: udc: atmel: Remove AVR32 bits from the driver") left the accessor macros introduced by commit a3dd3befd7cb ("usb: gadget: atmel_usba: use endian agnostic IO on ARM"). They can now be removed. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-19usb: gadget: bdc: 64-bit pointer capability checkSrinath Mannam1-1/+1
Corrected the register to check the 64-bit pointer capability state. 64-bit pointer implementation capability was checking in wrong register, which causes the BDC enumeration failure in 64-bit memory address. Fixes: efed421a94e6 ("usb: gadget: Add UDC driver for Broadcom USB3.0 device controller IP BDC") Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-15usb: dwc3: exynos: Handle return value of clk_prepare_enableArvind Yadav1-3/+10
clk_prepare_enable() can fail here and we must check its return value. Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-15usb: gadget: mv_udc: Handle return value of clk_prepare_enable.Arvind Yadav1-3/+6
clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: dwc3: gadget: increase readability of dwc3_gadget_init_endpoints()Andy Shevchenko1-14/+15
The commit 47d3946ea220 usb: dwc3: refactor gadget endpoint count calculation refactored dwc3_gadget_init_endpoints() and in particular changed in or out endpoint numbering to be through. It's not always convenient and makes code a slightly harder to read. Introduce a new temporary variable to make it easier to understand what is going on inside the function. While doing that, rename local variables as follows: u8 num -> u8 total int num -> int kbytes Replace implicit direction check via epnum with explicit use of direction variable. While here, replace %d to %u when compounding endpoint name since we are using unsigned type. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: gadget: mass_storage: set msg_registered after msg registeredLi Jun1-2/+6
If there is no UDC available, the msg register will fail and this flag will not be set, but the driver is already added into pending driver list, then the module removal modprobe -r can not remove the driver from the pending list. Signed-off-by: Li Jun <jun.li@nxp.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: gadget: udc: renesas_usb3: add support for dedicated DMACYoshihiro Shimoda1-0/+392
The USB3.0 peripheral controller on R-Car SoCs has a dedicated DMAC. The DMAC needs a "PRD table" in system memory and the DMAC can have four PRD tables. This patch adds support for the DMAC. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: gadget: udc: atmel: Remove AVR32 bits from the driverAndy Shevchenko2-12/+1
AVR32 is gone. Now it's time to clean up the driver by removing leftovers that was used by AVR32 related code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: mtu3: Handle return value of clk_prepare_enableArvind Yadav1-3/+20
clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: dwc3: core: program PHY for proper DRD modesFelipe Balbi1-1/+26
If PHY is entering Host mode, we need to enable VBUS. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: dwc3: core: initialize ULPI before trying to get the PHYFelipe Balbi1-4/+6
If don't reorder initialization like this, we will never be able to get a reference to ULPI PHYs. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: dwc3: ulpi: conditionally resume ULPI PHYFelipe Balbi1-0/+12
If PHY is suspended by the time we want to issue ULPI transfers, we will observe timeouts on the ULPI interface. In order to avoid such issue, let's make sure PHY is resumed before issuing a ULPI transfer. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: dwc3: ep0: make sure wValue is 0 on GetStatus()Felipe Balbi1-0/+6
We don't (yet) support PTM_STATUS messages so let's not reply to them erroneously. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: gadget: udc: add a 'function' sysfs fileFelipe Balbi1-0/+13
This file will print out the name of the currently running USB Gadget Driver. It can be read even when there are no functions loaded. Suggested-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: gadget: dummy: implement ->udc_set_speed()Felipe Balbi1-16/+23
Move the code which was part of pullup() to the newly introduced method. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: dwc3: gadget: implement ->udc_set_speed()Felipe Balbi1-43/+58
Use this method to make sure we don't try to connect on speeds not supported by the gadget driver. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: gadget: core: introduce ->udc_set_speed() methodFelipe Balbi1-0/+20
Sometimes, the gadget driver we want to run has max_speed lower than what the UDC supports. In such situations, UDC might want to make sure we don't try to connect on speeds not supported by the gadget driver (e.g. super-speed capable dwc3 with high-speed capable g_midi) because that will just fail. In order to make sure this situation never happens, we introduce a new optional ->udc_set_speed() method which can be implemented by interested UDC drivers. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: gadget: udc: Add Synopsys UDC Platform driverRaviteja Garimella5-20/+409
This patch adds platform driver support for Synopsys UDC. A new driver file (snps_udc_plat.c) is created for this purpose where the platform driver registration is done based on OF node. Currently, UDC integrated into Broadcom's iProc SoCs (Northstar2 and Cygnus) work with this driver. New members are added to the UDC data structure for having platform device support along with extcon and phy support. Kconfig and Makefiles are modified to select platform driver for compilation. Signed-off-by: Raviteja Garimella <raviteja.garimella@broadcom.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: gadget: udc: Provide correct arguments for 'dma_pool_create'Raviteja Garimella1-2/+2
Change the argument from NULL to a struct device for the dma_pool_create call during dma init. Signed-off-by: Raviteja Garimella <raviteja.garimella@broadcom.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: gadget: udc: make debug prints compatible with both pci and platform ↵Raviteja Garimella3-15/+18
devices This patch adds a struct device member to UDC data structure and makes changes to the arguments of dev_err and dev_dbg calls so that the debug prints work for both pci and platform devices. Signed-off-by: Raviteja Garimella <raviteja.garimella@broadcom.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: gadget: udc: Rename amd5536udc driver file based on IPRaviteja Garimella2-1/+1
This patch renames the amd5536udc.c that has the core driver functionality of Synopsys UDC to snps_udc_core.c The symbols exported here can be used by any UDC driver that uses the same Synopsys IP. Signed-off-by: Raviteja Garimella <raviteja.garimella@broadcom.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: gadget: configfs: use hexadecimal values and new lineStefan Agner1-3/+3
Other unsigned properties return hexadecimal values, follow this convention when printing b_vendor_code too. Also add newlines to the OS Descriptor support related properties, like other sysfs files use. Reviewed-by: Krzysztof Opasiak <k.opasiak@samsung.com> Signed-off-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-13usb: gadget: configfs: make qw_sign attribute symmetricStefan Agner1-2/+6
Currently qw_sign requires UTF-8 character to set, but returns UTF-16 when read. This isn't obvious when simply using cat since the null characters are not visible, but hexdump unveils the true string: # echo MSFT100 > os_desc/qw_sign # hexdump -C os_desc/qw_sign 00000000 4d 00 53 00 46 00 54 00 31 00 30 00 30 00 |M.S.F.T.1.0.0.| Make qw_sign symmetric by returning an UTF-8 string too. Also follow common convention and add a new line at the end. Reviewed-by: Krzysztof Opasiak <k.opasiak@samsung.com> Signed-off-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-02usb: gadget: Allow a non-SuperSpeed gadget to support LPMJohn Youn1-2/+6
This commit allows a gadget that does not support SuperSpeed to indicate that it supports LPM. It does this by setting the 'lpm_capable' flag in the gadget structure. If a gadget sets this, the composite gadget framework will set the bcdUSB to 0x0201 to indicate that this supports BOS descriptors, and also return a USB 2.0 Extension descriptor as part of the BOS descriptor set. See USB 2.0 LPM ECN Section 3. Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Sevak Arakelyan <sevaka@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-02usb: gadget: composite: Exclude SS Dev Cap DescJohn Youn1-23/+28
Don't send the SuperSpeed USB Device Capability descriptor if the gadget is not capable of SuperSpeed. Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Sevak Arakelyan <sevaka@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-02usb: gadget: function: f_fs: Move epfile waitqueue to ffs_data.Jerry Zhang2-9/+13
There were individual waitqueues for each epfile but eps_enable would iterate through all of them, resulting in essentially the same wakeup time. The waitqueue represents the function being enabled, so a central waitqueue in ffs_data makes more sense and is less redundant. Also use wake_up_interruptible to reflect use of wait_event_interruptible. Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Jerry Zhang <zhangjerry@google.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-02usb: gadget: function: f_fs: Let ffs_epfile_ioctl wait for enable.Jerry Zhang1-39/+54
This allows users to make an ioctl call as the first action on a connection. Ex, some functions might want to get endpoint size before making any i/os. Previously, calling ioctls before read/write would depending on the timing of endpoints being enabled. ESHUTDOWN is now a possible return value and ENODEV is not, so change docs accordingly. Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Jerry Zhang <zhangjerry@google.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-02usb: gadget: remove redundant self assignmentStefan Agner1-3/+1
The assignment ret = ret is redundant and can be removed. Reviewed-by: Krzysztof Opasiak <k.opasiak@samsung.com> Reviewed-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-02usb: dwc3: trace: decode ctrl requestFelipe Balbi2-4/+238
Instead of *always* dumping raw ctrl bytes, let's decode standard requests which will make the lives of those debugging DWC3 quite a bit easier. Output will now look like so: irq/34-dwc3-1594 [000] d..1 107.573081: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18) irq/34-dwc3-1594 [000] d..1 107.573694: dwc3_ctrl_req: Set Address(Addr = 01) irq/34-dwc3-1594 [000] d..1 107.588319: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18) irq/34-dwc3-1594 [000] d..1 107.588816: dwc3_ctrl_req: Get Configuration Descriptor(Index = 0, Length = 9) irq/34-dwc3-1594 [000] d..1 107.589191: dwc3_ctrl_req: Set Configuration(Config = 3) irq/34-dwc3-1594 [000] d..1 107.589846: dwc3_ctrl_req: Get BOS Descriptor(Index = 0, Length = 5) irq/34-dwc3-1594 [000] d..1 107.590146: dwc3_ctrl_req: Get BOS Descriptor(Index = 0, Length = 22) irq/34-dwc3-1594 [000] d..1 107.590546: dwc3_ctrl_req: Get Configuration Descriptor(Index = 0, Length = 9) irq/34-dwc3-1594 [000] d..1 107.590840: dwc3_ctrl_req: Get Configuration Descriptor(Index = 0, Length = 69) irq/34-dwc3-1594 [000] d..1 107.591138: dwc3_ctrl_req: Get Configuration Descriptor(Index = 1, Length = 9) irq/34-dwc3-1594 [000] d..1 107.591541: dwc3_ctrl_req: Get Configuration Descriptor(Index = 1, Length = 32) irq/34-dwc3-1594 [000] d..1 107.591834: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18) irq/34-dwc3-1594 [000] d..1 114.701005: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18) irq/34-dwc3-1594 [000] d..1 114.721080: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18) irq/34-dwc3-1594 [000] d..1 114.722709: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18) irq/34-dwc3-1594 [000] d..1 114.728979: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18) irq/34-dwc3-1594 [000] d..1 114.730544: dwc3_ctrl_req: Get Device Qualifier Descriptor(Index = 0, Length = 10) irq/34-dwc3-1594 [000] d..1 115.776018: dwc3_ctrl_req: Get Configuration Descriptor(Index = 0, Length = 9) irq/34-dwc3-1594 [000] d..1 115.776760: dwc3_ctrl_req: Set Configuration(Config = 0) irq/34-dwc3-1594 [000] d..1 115.777676: dwc3_ctrl_req: Get Configuration(Length = 1) irq/34-dwc3-1594 [000] d..1 115.924797: dwc3_ctrl_req: Get Device Descriptor(Index = 0, Length = 18) irq/34-dwc3-1594 [000] d..1 115.929025: dwc3_ctrl_req: Get String Descriptor(Index = 0, Length = 500) irq/34-dwc3-1594 [000] d..1 115.929566: dwc3_ctrl_req: Get String Descriptor(Index = 1, Length = 500) irq/34-dwc3-1594 [000] d..1 115.930911: dwc3_ctrl_req: Get String Descriptor(Index = 0, Length = 500) irq/34-dwc3-1594 [000] d..1 115.931528: dwc3_ctrl_req: Get String Descriptor(Index = 2, Length = 500) irq/34-dwc3-1594 [000] d..1 115.932950: dwc3_ctrl_req: Get String Descriptor(Index = 0, Length = 500) irq/34-dwc3-1594 [000] d..1 115.933533: dwc3_ctrl_req: Get String Descriptor(Index = 3, Length = 500) Note that Class and Vendor requests won't be decoded for obvious reasons. Those will be printed as a raw sequence of bytes. This patch has been tested against a normal host (both Linux and Windows) and USB30CV Chapter 9 tests. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-02usb: dwc3: debug: remove static char buffer from dwc3_decode_event()Felipe Balbi2-8/+9
Instead, we can require caller to pass a buffer for the function to use. This cleans things quite a bit. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-02usb: dwc3: trace: rely on __string() and __assign_str()Felipe Balbi1-8/+8
Instead of going for a 512 byte buffer and using snprintf(), let's rely on helps __string() and __assign_str() where possible. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-02usb: dwc3: gadget: slight cleanup to dwc3_process_event_entry()Felipe Balbi1-12/+4
No functional changes, just a slight readability improvement. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-02usb: dwc3: debugfs: slightly improve output of trb_ringFelipe Balbi1-5/+4
Instead of printing out enqueue and dequeue pointer value as a header to the output, let's mark the TRBs in question with 'E' and 'D'. The output looks slightly easier to read. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-02usb: dwc3: update documentationFelipe Balbi4-65/+124
No functional changes, just making sure we can use these for ReST docs later. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-06-02usb: dwc3: replace %p with %pKFelipe Balbi2-7/+4
%p will leak kernel pointers, so let's not expose the information on dmesg and instead use %pK. %pK will only show the actual addresses if explicitly enabled under /proc/sys/kernel/kptr_restrict. Cc: <stable@vger.kernel.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-05-17usb: gadget: udc-xilinx: clean up a variable nameDan Carpenter1-1/+1
"ep->udc->lock" and "udc->lock" are the same thing. It confuses Smatch if we don't use the same name consistently. Reviewed-by: Sören Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-05-17usb: dwc3: add disable u2mac linestate check quirkWilliam Wu2-6/+18
This patch adds a quirk to disable USB 2.0 MAC linestate check during HS transmit. Refer the dwc3 databook, we can use it for some special platforms if the linestate not reflect the expected line state(J) during transmission. When use this quirk, the controller implements a fixed 40-bit TxEndDelay after the packet is given on UTMI and ignores the linestate during the transmit of a token (during token-to-token and token-to-data IPGAP). On some rockchip platforms (e.g. rk3399), it requires to disable the u2mac linestate check to decrease the SSPLIT token to SETUP token inter-packet delay from 566ns to 466ns, and fix the issue that FS/LS devices not recognized if inserted through USB 3.0 HUB. Acked-by: Rob Herring <robh@kernel.org> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: William Wu <william.wu@rock-chips.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-05-17usb: gadget: udc: add null check before pointer dereferenceGustavo A. R. Silva1-2/+3
Add null check before dereferencing dev->regs pointer inside net2280_led_shutdown() function. Addresses-Coverity-ID: 101783 Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-05-17usb: phy: phy-msm-usb: Remove redundant extcon register/unregisterBaolin Wang1-67/+18
Since usb phy core has added common code to register or unregister extcon device, then phy-msm-usb driver does not need its own code to register/unregister extcon device, then remove them. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-05-17usb: phy: phy-qcom-8x16-usb: Remove redundant extcon register/unregisterBaolin Wang1-15/+5
Since usb phy core has added common code to register or unregister extcon device, then phy-qcom-8x16-usb driver does not need its own code to register/unregister extcon device, then remove them. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-05-17usb: phy: Introduce one extcon device into usb phyBaolin Wang2-3/+60
Usually usb phy need register one extcon device to get the connection notifications. It will remove some duplicate code if the extcon device is registered using common code instead of each phy driver having its own related extcon APIs. So we add one pointer of extcon device into usb phy structure, and some other helper functions to register extcon. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-05-17usb: fix the comment with regards to DocBookMauro Carvalho Chehab1-1/+1
The USB gadget documentation is not at DocBook anymore. The main file was converted to ReST, and stored at Documentation/driver-api/usb/gadget.rst, but there are still several plain text files related to gadget under Documentation/usb. So, be generic and just mention documentation without specifying where it is. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-05-17usb: gadget: f_uac2: calculate wMaxPacketSize before endpoint matchSekhar Nori1-6/+6
Calculate wMaxPacketSize before endpoint matching the descriptor is found. This allows audio gadget to be used with controllers which have a shortage or unavailability of endpoints that can handle max packet size of 1023 (FS) or 1024 (HS). With this audio gadget can be used on TI's OMAP-L138 SoC which has a MUSB HS controller with endpoints having max packet size much less than 1023 or 1024. See mode_2_cfg in drivers/usb/musb/musb_core.c Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-05-17usb: dwc3: gadget: lazily map requests for DMAFelipe Balbi1-9/+12
Some functions might want to have very, very long request queues. We can't make any assumptions about how many requests we *are* able to map, so instead of mapping requests early, let's map them late. This way, functions can queue as many requests as they'd like but we won't take DMA resources until they are needed. Also, we can now stop processing requests when we run out of DMA resources but still keep requests in the queue for late processing. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-05-17usb: dwc3: gadget: don't WARN about lack of TRBsFelipe Balbi1-3/+1
We don't need a big fat warning with stack dump at all. Running out of TRBs is a normal condition and we will have more TRBs available as soon as some transfers complete. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-05-16USB: f_mass_storage: improve memory barriers and synchronizationAlan Stern2-206/+156
This patch reworks the way f_mass_storage.c handles memory barriers and synchronization: The driver now uses a wait_queue instead of doing its own task-state manipulations (even though only one task will ever use the wait_queue). The thread_wakeup_needed variable is removed. It was only a source of trouble; although it was what the driver tested to see whether it should wake up, what we really wanted to see was whether a USB transfer had completed. All the explicit memory barriers scattered throughout the driver are replaced by a few calls to smp_load_acquire() and smp_store_release(). The inreq_busy and outreq_busy fields are removed. In their place, the driver keeps track of the current I/O direction by splitting BUF_STATE_BUSY into two states: BUF_STATE_SENDING and BUF_STATE_RECEIVING. The buffer states are no longer protected by a lock. Mutual exclusion isn't needed; the state is changed only by the driver's main thread when it owns the buffer, and only by the request completion routine when the gadget core owns the buffer. The do_write() and throw_away_data() routines were reorganized to make efficient use of the new sleeping mechanism. This resulted in the removal of one indentation level in those routines, making the patch appear to be more more complicated than it really is. In a few places, the driver allowed itself to be frozen although it really shouldn't have (in the middle of executing a SCSI command). Those places have been fixed. The logic in the exception handler for aborting transfers and waiting for them to stop has been simplified. Tested-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>