1. 17 Jan, 2020 1 commit
  2. 16 Jan, 2020 1 commit
  3. 15 Jan, 2020 5 commits
    • Samuel Holland's avatar
      power: supply: axp20x_usb_power: Only poll while offline · bcfb7ae3
      Samuel Holland authored
      Investigation on the AXP803 shows that VBUS_PLUGIN/VBUS_REMOVAL IRQs are
      triggered on the rising/falling edge of AXP20X_PWR_STATUS_VBUS_USED. The
      reason IRQs do not arrive while N_VBUSEN/DRIVEVBUS is high is because
      AXP20X_PWR_STATUS_VBUS_USED also never goes high.
      
      This also means that if VBUS is online, a VBUS_REMOVAL IRQ is received
      immediately on setting N_VBUSEN/DRIVEVBUS high (and VBUS_PLUGIN shortly
      after it is set back low). This was also verified to be the case when
      manually offlining VBUS through AXP20X_VBUS_PATH_SELECT.
      
      As long as VBUS is online, a present->absent transition necessarily
      implies an online->offline transition. Since will cause an IRQ, there is
      no need to poll while VBUS is online.
      
      To ensure the driver's view of VBUS online status remains accurate,
      unconditionally poll once when receiving an IRQ and when resuming. If
      VBUS is still online at that time, polling will cease until the next
      VBUS_REMOVAL IRQ.
      Reviewed-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      bcfb7ae3
    • Samuel Holland's avatar
      power: supply: axp20x_usb_power: Add wakeup control · 09aaaec5
      Samuel Holland authored
      The USB power supply input can be used as a wakeup source. Hook up the
      VBUS_PLUGIN IRQ to trigger wakeup based on userspace configuration.
      
      To do this, we must remember the list of IRQs for the life of the
      device. To know how much space to allocate for the flexible array
      member, we switch from using a NULL sentinel to using an array length.
      
      Because we now depend on the specific order of the IRQs (we assume
      VBUS_PLUGIN is first and always present), failing to acquire an IRQ
      during probe must be a fatal error.
      
      To avoid spuriously waking up the system when the USB power supply is
      not configured as a wakeup source, we must explicitly disable all non-
      wake IRQs during system suspend. This is because the SoC's NMI input is
      shared among all IRQs on the AXP PMIC. Due to the use of regmap-irq, the
      individual IRQs within the PMIC are nested threaded interrupts, and are
      therefore not automatically disabled during system suspend.
      
      The upshot is that if any other device within the MFD (such as the power
      key) is an enabled wakeup source, all enabled IRQs within the PMIC will
      cause wakeup. We still need to call enable_irq_wake() when we *do* want
      wakeup, in case those other wakeup sources on the PMIC are all disabled.
      Reviewed-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      09aaaec5
    • Samuel Holland's avatar
      power: supply: axp20x_usb_power: Allow offlining · ecbc8dd7
      Samuel Holland authored
      AXP803/AXP813 have a flag that enables/disables the USB power supply
      input. Allow control of this flag via the ONLINE property on those
      variants.
      
      It may be necessary to offline the USB power supply input when using
      the USB port in OTG mode, or to allow userspace to disable charging.
      
      When the USB VBUS input is disabled via the PATH_SEL bit, the VBUS_USED
      bit in PWR_INPUT_STATUS is cleared, so there is no change needed when
      getting the property.
      Reviewed-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      ecbc8dd7
    • Samuel Holland's avatar
      power: supply: axp20x_usb_power: Use a match structure · 56900d45
      Samuel Holland authored
      Instead of ad-hoc variant ID checks throughout the code, let's start
      moving the variant-specific details to a match structure. This allows
      for future flexibility, and it better matches the other axp20x power
      supply drivers.
      
      This commit removes most variant checks from axp20x_usb_power_probe().
      Other parts of the driver still do ID matching; they are left unchanged
      for now.
      Reviewed-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      56900d45
    • Chen Wandun's avatar
      power: suppy: ucs1002: Make the symbol 'ucs1002_regulator_enable' static · 577233a3
      Chen Wandun authored
      Fix the following sparse warning:
      
      drivers/power/supply/ucs1002_power.c:492:5: warning: symbol 'ucs1002_regulator_enable' was not declared. Should it be static?
      
      Fixes: a3d70dac ("power: suppy: ucs1002: disable power when max current is 0")
      Signed-off-by: default avatarChen Wandun <chenwandun@huawei.com>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      577233a3
  4. 14 Jan, 2020 13 commits
  5. 19 Dec, 2019 20 commits