1. 27 Oct, 2017 2 commits
    • Greg Kroah-Hartman's avatar
      Merge tag 'extcon-next-for-4.15' of... · 4dce3c4b
      Greg Kroah-Hartman authored
      Merge tag 'extcon-next-for-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into usb-next
      
      Chanwoo writes:
      
      Update extcon for 4.15
      
      Detailed description for this pull request:
      1. Split out extcon header file for consumer and provider device
      : The extcon has two type of extcon devices as following.
      - 'extcon provider deivce' adds new extcon device and detect
      the state/properties of external connector. Also, it notifies the
      state/properties to the extcon consumer device.
      - 'extcon consumer device' gets the change state/properties
      from extcon provider device.
      
      Prior to that, include/linux/extcon.h contains all exported API
      for both provider and consumer device driver. To clarify the meaning
      of header file and to remove the wrong use-case on consumer device.
      - include/linux/extcon-provider.h includes API for the provider device driver.
      - include/linux/extcon.h includes the API for the consumer device driver.
      
      2. Support the SmartDock accessory on extcon-max77843.c device driver
      - Support the SmartDock accessory which detects following connectors
       at the same time.
       : USB host throught USB hub for mouse, keyboard and so on.
       : MHL connector for video output.
       : Charger connector for battery charging.
      - It tested with Unitek Y-2165 MHL+OTG Hub Smart Phone Dock.
      
      3. Fix the minor issue of extcon driver
      - Delete the unneeded initialization in extcon-max14577.
      - Make extcon_info static const in order to fix the warning.
      4dce3c4b
    • Greg Kroah-Hartman's avatar
      Merge tag 'phy-for-4.15_v1' of... · 6bd5bb1e
      Greg Kroah-Hartman authored
      Merge tag 'phy-for-4.15_v1' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy into usb-next
      
      Kishon writes:
      
      phy: for 4.15
      
       *) Add support in phy core to perform phy calibration
       *) Return NULL for optional PHY's even if CONFIG_GENERIC_PHY is not selected
       *) Add USB Phy driver for Broadcom STB SoCs
       *) Add support to force mediatek PHY with USB OTG function to enter
          a specific mode
       *) Calibrate rockchip-typec PHY according to docs
       *) Enable dual route feature for sun4i-usb in V3s SoC
       *) Use dr_mode dt property to enable otg capability in rcar-gen3-usb2
       *) Add driver data to specify dedicated otg pins in rcar-gen3-usb2 driver
       *) Configure the RX equalizer of brcm-sata PHY
       *) Update pcie phy settings for ti-pipe3 phy
       *) Add set_mode callback in qcom-ufs-qmp-14nm phy
       *) Use PHY callbacks in phy-qcom-ufs instead of export APIs
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      6bd5bb1e
  2. 25 Oct, 2017 1 commit
  3. 24 Oct, 2017 14 commits
    • Greg Kroah-Hartman's avatar
      Merge tag 'usb-for-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next · 2d5afd51
      Greg Kroah-Hartman authored
      Felipe writes:
      
      usb: changes for v4.15 merge window
      
      Not much going on this time around. With only 51 non-merge commits,
      this was one of the smallest pull requests from the Gadget tree.
      
      Most of the changes are in the mtu3 driver which added support for
      36-bit DMA, support for USB 3.1 and support for dual-role (along with
      some non-critical fixes).
      
      The dwc2 driver got a few improvements to how we handle gadget state
      tracking and also added support for STM32F7xx devices.
      
      Other than that, we just some minor non-critical fixes and
      improvements all over the place.
      2d5afd51
    • John Stultz's avatar
      usb: dwc2: Fix UDC state tracking · ce2b21a4
      John Stultz authored
      It has been noticed that the dwc2 udc state reporting doesn't
      seem to work (at least on HiKey boards). Where after the initial
      setup, the sysfs /sys/class/udc/f72c0000.usb/state file would
      report "configured" no matter the state of the OTG port.
      
      This patch adds a call so that we report to the UDC layer when
      the gadget device is disconnected.
      
      This patch does depend on the previous patch ("usb: dwc2:
      Improve gadget state disconnection handling") in this patch set
      in order to properly work.
      
      Cc: Wei Xu <xuwei5@hisilicon.com>
      Cc: Guodong Xu <guodong.xu@linaro.org>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: YongQin Liu <yongqin.liu@linaro.org>
      Cc: John Youn <johnyoun@synopsys.com>
      Cc: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
      Cc: Douglas Anderson <dianders@chromium.org>
      Cc: Chen Yu <chenyu56@huawei.com>
      Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: linux-usb@vger.kernel.org
      Acked-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
      Tested-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
      Reported-by: default avatarAmit Pundir <amit.pundir@linaro.org>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      ce2b21a4
    • John Stultz's avatar
      usb: dwc2: Error out of dwc2_hsotg_ep_disable() if we're in host mode · 9b481092
      John Stultz authored
      We've found that while in host mode, using Android, if one runs
      the command:
        stop adbd
      
      The existing usb devices being utilized in host mode are disconnected.
      This is most visible with usb networking devices.
      
      This seems to be due to adbd closing the file:
        /dev/usb-ffs/adb/ep0
      Which calls ffs_ep0_release() and the following backtrace:
      
      [<ffffff800875a430>] dwc2_hsotg_ep_disable+0x148/0x150
      [<ffffff800875a498>] dwc2_hsotg_udc_stop+0x60/0x110
      [<ffffff8008787950>] usb_gadget_remove_driver+0x58/0x78
      [<ffffff80087879e4>] usb_gadget_unregister_driver+0x74/0xe8
      [<ffffff80087850c0>] unregister_gadget+0x28/0x58
      [<ffffff800878511c>] unregister_gadget_item+0x2c/0x40
      [<ffffff8008790ea8>] ffs_data_clear+0xe8/0xf8
      [<ffffff8008790ed8>] ffs_data_reset+0x20/0x58
      [<ffffff8008793218>] ffs_data_closed+0x98/0xe8
      [<ffffff80087932d8>] ffs_ep0_release+0x20/0x30
      
      Then when dwc2_hsotg_ep_disable() is called, we call
      kill_all_requests() which causes a bunch of the following
      messages:
      
      dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
      dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
      dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
      dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
      dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
      dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
      dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
      dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
      init: Service 'adbd' (pid 1915) killed by signal 9
      init: Sending signal 9 to service 'adbd' (pid 1915) process group...
      init: Successfully killed process cgroup uid 0 pid 1915 in 0ms
      init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:15)
      dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 8 - ChHltd set, but reason is unknown
      dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
      dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 12 - ChHltd set, but reason is unknown
      dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
      dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 15 - ChHltd set, but reason is unknown
      dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
      dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 3 - ChHltd set, but reason is unknown
      dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
      dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 4 - ChHltd set, but reason is unknown
      dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
      dwc2 f72c0000.usb: dwc2_update_urb_state_abn(): trimming xfer length
      
      And the usb devices connected are basically hung at this point.
      
      It seems like if we're in host mode, we probably shouldn't run
      the dwc2_hostg_ep_disable logic, so this patch returns an error
      in that case.
      
      With this patch (along with the previous patch in this set), we avoid
      the mismatched interrupts and connected usb devices continue to function.
      
      I'm not sure if some other solution would be better here, but this seems
      to work, so I wanted to send it out for input on what the right approach
      should be.
      
      Cc: Wei Xu <xuwei5@hisilicon.com>
      Cc: Guodong Xu <guodong.xu@linaro.org>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: YongQin Liu <yongqin.liu@linaro.org>
      Cc: John Youn <johnyoun@synopsys.com>
      Cc: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
      Cc: Douglas Anderson <dianders@chromium.org>
      Cc: Chen Yu <chenyu56@huawei.com>
      Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: linux-usb@vger.kernel.org
      Acked-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
      Tested-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
      Reported-by: default avatarYongQin Liu <yongqin.liu@linaro.org>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      9b481092
    • John Stultz's avatar
      usb: dwc2: Improve gadget state disconnection handling · d2471d4a
      John Stultz authored
      In the earlier commit dad3f793 ("usb: dwc2: Make sure we
      disconnect the gadget state"), I was trying to fix up the
      fact that we somehow weren't disconnecting the gadget state,
      so that when the OTG port was plugged in the second time we
      would get warnings about the state tracking being wrong.
      
      (This seems to be due to a quirk of the HiKey board where
      we do not ever get any otg interrupts, particularly the session
      end detected signal. Instead we only see status change
      interrupt.)
      
      The fix there was somewhat simple, as it just made sure to
      call dwc2_hsotg_disconnect() before we connected things up
      in OTG mode, ensuring the state handling didn't throw errors.
      
      But in looking at a different issue I was seeing with UDC
      state handling, I realized that it would be much better
      to call dwc2_hsotg_disconnect when we get the state change
      signal moving to host mode.
      
      Thus, this patch removes the earlier disconnect call I added
      and moves it (and the needed locking) to the host mode
      transition.
      
      Cc: Wei Xu <xuwei5@hisilicon.com>
      Cc: Guodong Xu <guodong.xu@linaro.org>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: YongQin Liu <yongqin.liu@linaro.org>
      Cc: John Youn <johnyoun@synopsys.com>
      Cc: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
      Cc: Douglas Anderson <dianders@chromium.org>
      Cc: Chen Yu <chenyu56@huawei.com>
      Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: linux-usb@vger.kernel.org
      Acked-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
      Tested-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      d2471d4a
    • Manu Gautam's avatar
      usb: dwc3: core: Notify current USB mode to USB3 PHY as well · 644cbbc3
      Manu Gautam authored
      Driver currently notifies only USB2 PHY on USB mode change.
      Extend this to USB3 PHY so that PHY drivers based on the
      mode can release system resources - clocks, regulators etc.
      Additionally Qualcomm QMP and QUSB2 PHY drivers need to
      override VBUS signal in PHY wrapper in device mode as USB
      VBUS line is not connected to PHYs. Also, remove NULL checks
      for PHY when calling phy_set_mode as PHY ops already check this.
      Signed-off-by: default avatarManu Gautam <mgautam@codeaurora.org>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      644cbbc3
    • Manu Gautam's avatar
      usb: dwc3: pci: Runtime resume child device from wq · 8eed00b2
      Manu Gautam authored
      Driver currently resumes and increments pm usage_count
      of its child device (dwc3 main) from its runtime_resume
      handler. This requires dwc3 runtime_resume to perform
      pm_runtime_put to decrement the pm usage_count. However
      runtime_put from dwc3 happens for non pci drivers
      (e.g. dwc3-if-simple.c) as well which results in dwc3
      pm usage_count becoming negative after couple of
      runtime suspend resume iterations. Fix this by
      performing runtime_get/put from dwc3-pci driver only
      using workqueue.
      Signed-off-by: default avatarManu Gautam <mgautam@codeaurora.org>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      8eed00b2
    • Manu Gautam's avatar
      usb: dwc3: Don't reinitialize core during host bus-suspend/resume · 689bf72c
      Manu Gautam authored
      Driver powers-off PHYs and reinitializes DWC3 core and gadget on
      resume. While this works fine for gadget mode but in host
      mode there is not re-initialization of host stack. Also, resetting
      bus as part of bus_suspend/resume is not correct which could affect
      (or disconnect) connected devices.
      Fix this by not reinitializing core on suspend/resume in host mode
      for HOST only and OTG/drd configurations.
      Signed-off-by: default avatarManu Gautam <mgautam@codeaurora.org>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      689bf72c
    • Alexey Khoroshilov's avatar
      usb: phy: tahvo: fix error handling in tahvo_usb_probe() · ce035409
      Alexey Khoroshilov authored
      If devm_extcon_dev_allocate() fails, we should disable clk before return.
      
      Found by Linux Driver Verification project (linuxtesting.org).
      Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
      Fixes: 860d2686 ("usb: phy: tahvo: Use devm_extcon_dev_[allocate|register]() and replace deprecated API")
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      ce035409
    • Gustavo A. R. Silva's avatar
      usb: gadget: serial: mark expected switch fall-through · fdb5e4fa
      Gustavo A. R. Silva authored
      In preparation to enabling -Wimplicit-fallthrough, mark switch cases
      where we are expecting to fall through.
      
      Addresses-Coverity-ID: 1350962
      Signed-off-by: default avatarGustavo A. R. Silva <garsilva@embeddedor.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      fdb5e4fa
    • Gustavo A. R. Silva's avatar
      usb: phy: phy-msm-usb: mark expected switch fall-through · 58a636ec
      Gustavo A. R. Silva authored
      In preparation to enabling -Wimplicit-fallthrough, mark switch cases
      where we are expecting to fall through.
      
      Addresses-Coverity-ID: 1222118
      Signed-off-by: default avatarGustavo A. R. Silva <garsilva@embeddedor.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      58a636ec
    • Gustavo A. R. Silva's avatar
      usb: gadget: f_tcm: mark expected switch fall-through · d4acce95
      Gustavo A. R. Silva authored
      In preparation to enabling -Wimplicit-fallthrough, mark switch cases
      where we are expecting to fall through.
      
      Addresses-Coverity-ID: 703128
      Signed-off-by: default avatarGustavo A. R. Silva <garsilva@embeddedor.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      d4acce95
    • Gustavo A. R. Silva's avatar
      usb: gadget: goku_udc: mark expected switch fall-throughs · 457b16d4
      Gustavo A. R. Silva authored
      In preparation to enabling -Wimplicit-fallthrough, mark switch cases
      where we are expecting to fall through.
      
      Addresses-Coverity-ID: 145713
      Signed-off-by: default avatarGustavo A. R. Silva <garsilva@embeddedor.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      457b16d4
    • Marek Szyprowski's avatar
      extcon: max77843: Add support for SmartDock accessory · 4a4a8714
      Marek Szyprowski authored
      SmartDock uses ADC_RESERVED_ACC_3 (0x10) ADC ID type and provides following
      features:
      1. USB host with embedded USB hub (2-4 ports) for mice, keyboard, etc,
      2. MHL for video output,
      3. charging.
      
      Tested with Unitek Y-2165 MHL+OTG Hub Smart Phone Dock.
      Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Acked-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
      Acked-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
      4a4a8714
    • Marek Szyprowski's avatar
      extcon: max77843: Add OTG power control to the MUIC driver · 7b965110
      Marek Szyprowski authored
      Enabling power on VBUS micro-usb pin is required only when passive OTG
      cable is connected. Initially OTG VBUS power control was planned to be
      done in charger driver. However such information is not really available
      from the extcon notifications, so VBUS power control has to be done
      directly in MUIC driver, which has all information about the attached
      accessory.
      
      For example SmartDock is externally powered accessory, provides OTG
      (USB HOST) functionality and use VBUS pin for charging a device battery,
      so the VBUS charging pump should be disabled in such case.
      Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Acked-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
      Acked-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
      7b965110
  4. 23 Oct, 2017 23 commits