1. 18 Feb, 2020 1 commit
  2. 17 Feb, 2020 1 commit
  3. 13 Feb, 2020 3 commits
  4. 12 Feb, 2020 6 commits
  5. 11 Feb, 2020 10 commits
    • Andy Shevchenko's avatar
      MAINTAINERS: Sort entries in database for THUNDERBOLT · da0f3e02
      Andy Shevchenko authored
      Run parse-maintainers.pl and choose THUNDERBOLT record. Fix it accordingly.
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      da0f3e02
    • Colin Ian King's avatar
      usb: dwc3: debug: fix string position formatting mixup with ret and len · 42cd5ffe
      Colin Ian King authored
      Currently the string formatting is mixing up the offset of ret and
      len. Re-work the code to use just len, remove ret and use scnprintf
      instead of snprintf and len position accumulation where required.
      Remove the -ve return check since scnprintf never returns a failure
      -ve size. Also break overly long lines to clean up checkpatch
      warnings.
      
      Addresses-Coverity: ("Unused value")
      Fixes: 1381a511 ("usb: dwc3: debug: purge usage of strcat")
      Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      42cd5ffe
    • Sergey Organov's avatar
      usb: gadget: serial: fix Tx stall after buffer overflow · e4bfded5
      Sergey Organov authored
      Symptom: application opens /dev/ttyGS0 and starts sending (writing) to
      it while either USB cable is not connected, or nobody listens on the
      other side of the cable. If driver circular buffer overflows before
      connection is established, no data will be written to the USB layer
      until/unless /dev/ttyGS0 is closed and re-opened again by the
      application (the latter besides having no means of being notified about
      the event of establishing of the connection.)
      
      Fix: on open and/or connect, kick Tx to flush circular buffer data to
      USB layer.
      Signed-off-by: default avatarSergey Organov <sorganov@gmail.com>
      Reviewed-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      e4bfded5
    • Lars-Peter Clausen's avatar
      usb: gadget: ffs: ffs_aio_cancel(): Save/restore IRQ flags · 43d56572
      Lars-Peter Clausen authored
      ffs_aio_cancel() can be called from both interrupt and thread context. Make
      sure that the current IRQ state is saved and restored by using
      spin_{un,}lock_irq{save,restore}().
      
      Otherwise undefined behavior might occur.
      Acked-by: default avatarMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      43d56572
    • Minas Harutyunyan's avatar
      usb: dwc2: Fix SET/CLEAR_FEATURE and GET_STATUS flows · 9a0d6f7c
      Minas Harutyunyan authored
      SET/CLEAR_FEATURE for Remote Wakeup allowance not handled correctly.
      GET_STATUS handling provided not correct data on DATA Stage.
      Issue seen when gadget's dr_mode set to "otg" mode and connected
      to MacOS.
      Both are fixed and tested using USBCV Ch.9 tests.
      Signed-off-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
      Fixes: fa389a6d ("usb: dwc2: gadget: Add remote_wakeup_allowed flag")
      Tested-by: default avatarJack Mitchell <ml@embed.me.uk>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      9a0d6f7c
    • Minas Harutyunyan's avatar
      usb: dwc2: Fix in ISOC request length checking · 860ef6cd
      Minas Harutyunyan authored
      Moved ISOC request length checking from dwc2_hsotg_start_req() function to
      dwc2_hsotg_ep_queue().
      
      Fixes: 4fca54aa ("usb: gadget: s3c-hsotg: add multi count support")
      Signed-off-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      860ef6cd
    • Jack Pham's avatar
      usb: gadget: composite: Support more than 500mA MaxPower · a2035411
      Jack Pham authored
      USB 3.x SuperSpeed peripherals can draw up to 900mA of VBUS power
      when in configured state. However, if a configuration wanting to
      take advantage of this is added with MaxPower greater than 500
      (currently possible if using a ConfigFS gadget) the composite
      driver fails to accommodate this for a couple reasons:
      
       - usb_gadget_vbus_draw() when called from set_config() and
         composite_resume() will be passed the MaxPower value without
         regard for the current connection speed, resulting in a
         violation for USB 2.0 since the max is 500mA.
      
       - the bMaxPower of the configuration descriptor would be
         incorrectly encoded, again if the connection speed is only
         at USB 2.0 or below, likely wrapping around U8_MAX since
         the 2mA multiplier corresponds to a maximum of 510mA.
      
      Fix these by adding checks against the current gadget->speed
      when the c->MaxPower value is used (set_config() and
      composite_resume()) and appropriately limit based on whether
      it is currently at a low-/full-/high- or super-speed connection.
      
      Because 900 is not divisible by 8, with the round-up division
      currently used in encode_bMaxPower() a MaxPower of 900mA will
      result in an encoded value of 0x71. When a host stack (including
      Linux and Windows) enumerates this on a single port root hub, it
      reads this value back and decodes (multiplies by 8) to get 904mA
      which is strictly greater than 900mA that is typically budgeted
      for that port, causing it to reject the configuration. Instead,
      we should be using the round-down behavior of normal integral
      division so that 900 / 8 -> 0x70 or 896mA to stay within range.
      And we might as well change it for the high/full/low case as well
      for consistency.
      
      N.B. USB 3.2 Gen N x 2 allows for up to 1500mA but there doesn't
      seem to be any any peripheral controller supported by Linux that
      does two lane operation, so for now keeping the clamp at 900
      should be fine.
      Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      a2035411
    • Jack Pham's avatar
      usb: gadget: composite: Fix bMaxPower for SuperSpeedPlus · c724417b
      Jack Pham authored
      SuperSpeedPlus peripherals must report their bMaxPower of the
      configuration descriptor in units of 8mA as per the USB 3.2
      specification. The current switch statement in encode_bMaxPower()
      only checks for USB_SPEED_SUPER but not USB_SPEED_SUPER_PLUS so
      the latter falls back to USB 2.0 encoding which uses 2mA units.
      Replace the switch with a simple if/else.
      
      Fixes: eae5820b ("usb: gadget: composite: Write SuperSpeedPlus config descriptors")
      Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      c724417b
    • John Keeping's avatar
      usb: gadget: u_audio: Fix high-speed max packet size · 904967c6
      John Keeping authored
      Prior to commit eb9fecb9 ("usb: gadget: f_uac2: split out audio
      core") the maximum packet size was calculated only from the high-speed
      descriptor but now we use the largest of the full-speed and high-speed
      descriptors.
      
      This is correct, but the full-speed value is likely to be higher than
      that for high-speed and this leads to submitting requests for OUT
      transfers (received by the gadget) which are larger than the endpoint's
      maximum packet size.  These are rightly rejected by the gadget core.
      
      config_ep_by_speed() already sets up the correct maximum packet size for
      the enumerated speed in the usb_ep structure, so we can simply use this
      instead of the overall value that has been used to allocate buffers for
      requests.
      
      Note that the minimum period for ALSA is still set from the largest
      value, and this is unavoidable because it's possible to open the audio
      device before the gadget has been enumerated.
      Tested-by: default avatarPavel Hofman  <pavel.hofman@ivitera.com>
      Signed-off-by: default avatarJohn Keeping <john@metanate.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      904967c6
    • Anurag Kumar Vulisha's avatar
      usb: dwc3: gadget: Check for IOC/LST bit in TRB->ctrl fields · 5ee85897
      Anurag Kumar Vulisha authored
      The current code in dwc3_gadget_ep_reclaim_completed_trb() will
      check for IOC/LST bit in the event->status and returns if
      IOC/LST bit is set. This logic doesn't work if multiple TRBs
      are queued per request and the IOC/LST bit is set on the last
      TRB of that request.
      
      Consider an example where a queued request has multiple queued
      TRBs and IOC/LST bit is set only for the last TRB. In this case,
      the core generates XferComplete/XferInProgress events only for
      the last TRB (since IOC/LST are set only for the last TRB). As
      per the logic in dwc3_gadget_ep_reclaim_completed_trb()
      event->status is checked for IOC/LST bit and returns on the
      first TRB. This leaves the remaining TRBs left unhandled.
      
      Similarly, if the gadget function enqueues an unaligned request
      with sglist already in it, it should fail the same way, since we
      will append another TRB to something that already uses more than
      one TRB.
      
      To aviod this, this patch changes the code to check for IOC/LST
      bits in TRB->ctrl instead.
      
      At a practical level, this patch resolves USB transfer stalls seen
      with adb on dwc3 based HiKey960 after functionfs gadget added
      scatter-gather support around v4.20.
      
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Yang Fei <fei.yang@intel.com>
      Cc: Thinh Nguyen <thinhn@synopsys.com>
      Cc: Tejas Joglekar <tejas.joglekar@synopsys.com>
      Cc: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
      Cc: Jack Pham <jackp@codeaurora.org>
      Cc: Todd Kjos <tkjos@google.com>
      Cc: Greg KH <gregkh@linuxfoundation.org>
      Cc: Linux USB List <linux-usb@vger.kernel.org>
      Cc: stable <stable@vger.kernel.org>
      Tested-by: default avatarTejas Joglekar <tejas.joglekar@synopsys.com>
      Reviewed-by: default avatarThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: default avatarAnurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
      [jstultz: forward ported to mainline, reworded commit log, reworked
       to only check trb->ctrl as suggested by Felipe]
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      5ee85897
  6. 10 Feb, 2020 18 commits
  7. 09 Feb, 2020 1 commit
    • Linus Torvalds's avatar
      Merge tag 'zonefs-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs · 380a129e
      Linus Torvalds authored
      Pull new zonefs file system from Damien Le Moal:
       "Zonefs is a very simple file system exposing each zone of a zoned
        block device as a file.
      
        Unlike a regular file system with native zoned block device support
        (e.g. f2fs or the on-going btrfs effort), zonefs does not hide the
        sequential write constraint of zoned block devices to the user. As a
        result, zonefs is not a POSIX compliant file system. Its goal is to
        simplify the implementation of zoned block devices support in
        applications by replacing raw block device file accesses with a richer
        file based API, avoiding relying on direct block device file ioctls
        which may be more obscure to developers.
      
        One example of this approach is the implementation of LSM
        (log-structured merge) tree structures (such as used in RocksDB and
        LevelDB) on zoned block devices by allowing SSTables to be stored in a
        zone file similarly to a regular file system rather than as a range of
        sectors of a zoned device. The introduction of the higher level
        construct "one file is one zone" can help reducing the amount of
        changes needed in the application while at the same time allowing the
        use of zoned block devices with various programming languages other
        than C.
      
        Zonefs IO management implementation uses the new iomap generic code.
        Zonefs has been successfully tested using a functional test suite
        (available with zonefs userland format tool on github) and a prototype
        implementation of LevelDB on top of zonefs"
      
      * tag 'zonefs-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs:
        zonefs: Add documentation
        fs: New zonefs file system
      380a129e