1. 20 Jul, 2020 3 commits
    • Mark Brown's avatar
      Merge series "regulator_sync_state() support" from Saravana Kannan <saravanak@google.com>: · f70e472d
      Mark Brown authored
      Consider the following example:
      - regulator-X is provided by device-X.
      - regulator-X is a supplier to device-A, device-B and device-C.
      - device-A is off/inactive from boot.
      - device-B and device-C are left on/active by the bootloader
      - regulator-X is left on boot by the bootloader at 2000 mV to supply
        device-B and device-C.
      
      Example boot sequence 1:
      1. device-X is probed successfully.
      2. device-A is probed by driver-A
         a. driver-A gets regulator-X
         b. driver-A votes on regulator-X
         c. driver-A initializes device-A
         d. driver-A votes off regulator-X
         e. regulator-X is turned off.
      3. System crashes or device-B and device-C become unreliable because
         regulator-X was turned off without following the proper quiescing
         steps for device-B and device-C.
      
      Example boot sequence 2:
      1. device-X is probed successfully.
      2. device-B is probed by driver-B
         a. driver-B gets regulator-X
         b. driver-B votes on regulator-X
         c. driver-B lowers device-B performance point.
         d. driver-B lowers voltage vote to 1000 mV.
         e. regulator-X voltage is lowered to 1000 mV.
      3. System crashes or device-C becomes unreliable because regulator-X
         voltage was lowered to 1000 mV when device-C still needed it at 2000 mV
      
      This patch series makes sure these examples are handled correctly and
      system crash or device instability is avoided and the system remains
      usable.
      
      More details provided in the commit texts.
      
      v2->v3:
      Patch 2/4 - No functional change. Simple refactor.
      Patch 3/4
      - Was Patch 2/2 in v2.
      - Rewrote commit text to hopefully address all previous points.
      - Renamed variable/functions. Hope it's clearer.
      - Added more comments.
      - Added logging
      - Fixed timeout functionality.
      - Handle exclusive consumers properly
      - Handle coupled regulators properly
      Patch 4/4 - Prevents voltage from going too low during boot.
      
      v1->v2:
      Patch 1/2
      - New patch
      Patch 2/2
      - This was the only patch in v1
      - Made the late_initcall_sync timeout a commandline param
      - If timeout is set, we also give up waiting for all consumers after
        the timeout expires.
      - Made every regulator driver add sync_state() support
      
      Saravana Kannan (4):
        driver core: Add dev_set_drv_sync_state()
        regulator: core: Add destroy_regulator()
        regulator: core: Add basic enable/disable support for sync_state()
          callbacks
        regulator: core: Add voltage support for sync_state() callbacks
      
       drivers/regulator/core.c         | 200 ++++++++++++++++++++++++++++---
       include/linux/device.h           |  12 ++
       include/linux/regulator/driver.h |   2 +
       3 files changed, 198 insertions(+), 16 deletions(-)
      
      --
      2.28.0.rc0.105.gf9edc3c819-goog
      f70e472d
    • Chen-Yu Tsai's avatar
      regulator: gpio: Honor regulator-boot-on property · 3acff11c
      Chen-Yu Tsai authored
      When requesting the enable GPIO, the driver should do so with the
      correct output level matching some expected state. This is especially
      important if the regulator is a critical one, such as a supply for
      the boot CPU. This is currently done by checking for the enable-at-boot
      property, but this is not documented in the device tree binding, nor
      does it match the common regulator properties.
      
      Honor the common regulator-boot-on property by checking the boot_on
      constraint setting within the DT probe path. This is the same as what
      is done in the fixed regulator driver.
      
      Also add a comment stating that the enable-at-boot property should not
      be used.
      
      Fixes: 006694d0 ("regulator: gpio-regulator: Allow use of GPIO controlled regulators though DT")
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Link: https://lore.kernel.org/r/20200720132809.26908-1-wens@kernel.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      3acff11c
    • Saravana Kannan's avatar
      regulator: core: Add destroy_regulator() · e1794aa4
      Saravana Kannan authored
      Part of the regulator_get() code is already factored out into
      create_regulator(). This patch factors out some of the regulator_put()
      code into destroy_regulator() so that create_regulator() has a
      corresponding unwind function. Subsequent patches will use this
      function.
      Signed-off-by: default avatarSaravana Kannan <saravanak@google.com>
      Link: https://lore.kernel.org/r/20200716042053.1927676-3-saravanak@google.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      e1794aa4
  2. 16 Jul, 2020 1 commit
  3. 15 Jul, 2020 3 commits
  4. 13 Jul, 2020 1 commit
  5. 08 Jul, 2020 3 commits
  6. 07 Jul, 2020 1 commit
  7. 06 Jul, 2020 4 commits
  8. 03 Jul, 2020 2 commits
  9. 02 Jul, 2020 13 commits
  10. 01 Jul, 2020 9 commits
    • Mark Brown's avatar
      Merge series "Introduce PMIC based USB type C detection" from Wesley Cheng <wcheng@codeaurora.org>: · d5ff5fb9
      Mark Brown authored
      Changes in v4:
       - Modified qcom,pmic-typec binding to include the SS mux and the DRD remote
         endpoint nodes underneath port@1, which is assigned to the SSUSB path
         according to usb-connector
       - Added usb-connector reference to the typec dt-binding
       - Added tags to the usb type c and vbus nodes
       - Removed "qcom" tags from type c and vbus nodes
       - Modified Kconfig module name, and removed module alias from the typec driver
      
      Changes in v3:
       - Fix driver reference to match driver name in Kconfig for
         qcom_usb_vbus-regulator.c
       - Utilize regulator bitmap helpers for enable, disable and is enabled calls in
         qcom_usb_vbus-regulator.c
       - Use of_get_regulator_init_data() to initialize regulator init data, and to
         set constraints in qcom_usb_vbus-regulator.c
       - Remove the need for a local device structure in the vbus regulator driver
      
      Changes in v2:
       - Use devm_kzalloc() in qcom_pmic_typec_probe()
       - Add checks to make sure return value of typec_find_port_power_role() is
         valid
       - Added a VBUS output regulator driver, which will be used by the PMIC USB
         type c driver to enable/disable the source
       - Added logic to control vbus source from the PMIC type c driver when
         UFP/DFP is detected
       - Added dt-binding for this new regulator driver
       - Fixed Kconfig typec notation to match others
       - Leave type C block disabled until enabled by a platform DTS
      
      Add the required drivers for implementing type C orientation and role
      detection using the Qualcomm PMIC.  Currently, PMICs such as the PM8150B
      have an integrated type C block, which can be utilized for this.  This
      series adds the dt-binding, PMIC type C driver, and DTS nodes.
      
      The PMIC type C driver will register itself as a type C port w/ a
      registered type C switch for orientation, and will fetch a USB role switch
      handle for the role notifications.  It will also have the ability to enable
      the VBUS output to any connected devices based on if the device is behaving
      as a UFP or DFP.
      
      Wesley Cheng (6):
        usb: typec: Add QCOM PMIC typec detection driver
        dt-bindings: usb: Add Qualcomm PMIC type C controller dt-binding
        arm64: boot: dts: qcom: pm8150b: Add node for USB type C block
        regulator: Add support for QCOM PMIC VBUS booster
        dt-bindings: regulator: Add dt-binding for QCOM PMIC VBUS output
          regulator
        arm64: boot: dts: qcom: pm8150b: Add DTS node for PMIC VBUS booster
      
       .../regulator/qcom,usb-vbus-regulator.yaml    |  41 +++
       .../bindings/usb/qcom,pmic-typec.yaml         | 113 +++++++
       arch/arm64/boot/dts/qcom/pm8150b.dtsi         |  13 +
       arch/arm64/boot/dts/qcom/sm8150-mtp.dts       |   4 +
       drivers/regulator/Kconfig                     |  10 +
       drivers/regulator/Makefile                    |   1 +
       drivers/regulator/qcom_usb_vbus-regulator.c   |  97 ++++++
       drivers/usb/typec/Kconfig                     |  12 +
       drivers/usb/typec/Makefile                    |   1 +
       drivers/usb/typec/qcom-pmic-typec.c           | 275 ++++++++++++++++++
       10 files changed, 567 insertions(+)
       create mode 100644 Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
       create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml
       create mode 100644 drivers/regulator/qcom_usb_vbus-regulator.c
       create mode 100644 drivers/usb/typec/qcom-pmic-typec.c
      
      --
      The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
      a Linux Foundation Collaborative Project
      d5ff5fb9
    • Mark Brown's avatar
      Merge series "regulator/qcom: Constify static structs" from Rikard Falkeborn... · d69323ee
      Mark Brown authored
      Merge series "regulator/qcom: Constify static structs" from Rikard Falkeborn <rikard.falkeborn@gmail.com>:
      
      Constify some static structs to allow the compiler to put them in
      read-only memory.
      
      Rikard Falkeborn (2):
        regulator: qcom_rpm: Constify struct regulator_ops
        regulator: qcom_spmi: Constify struct regulator_ops
      
       drivers/regulator/qcom_rpm-regulator.c  |  6 +++---
       drivers/regulator/qcom_spmi-regulator.c | 24 ++++++++++++------------
       2 files changed, 15 insertions(+), 15 deletions(-)
      
      --
      2.27.0
      d69323ee
    • Mark Brown's avatar
      Merge series "Add frequency / voltage scaling support for IPQ6018 SoC" from... · e5abaf91
      Mark Brown authored
      Merge series "Add frequency / voltage scaling support for IPQ6018 SoC" from Kathiravan T <kathirav@codeaurora.org>:
      
      IPQ6018 SoC uses the PMIC MP5496. SMPA2 and LDOA2 regulator of MP5496
      controls the APSS and SDCC voltage scaling respectively. Add support
      for the same.
      
      changes since V1:
      	- Moved YAML conversion to the last as per Mark's comments
      
      Kathiravan T (6):
        dt-bindings: soc: qcom: Add IPQ6018 compatible
        soc: qcom: smd-rpm: Add IPQ6018 compatible
        dt-bindings: regulator: add MP5496 regulator compatible
        regulator: qcom_smd: Add MP5496 regulators
        dt-bindings: soc: qcom: convert the SMD-RPM document to YAML schema
        dt-bindings: regulator: convert QCOM SMD-RPM regulator document to
          YAML schema
      
       .../bindings/regulator/qcom,smd-rpm-regulator.txt  | 320 ---------------------
       .../bindings/regulator/qcom,smd-rpm-regulator.yaml | 106 +++++++
       .../devicetree/bindings/soc/qcom/qcom,smd-rpm.txt  |  62 ----
       .../devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml |  92 ++++++
       drivers/regulator/qcom_smd-regulator.c             |  34 +++
       drivers/soc/qcom/smd-rpm.c                         |   1 +
       6 files changed, 233 insertions(+), 382 deletions(-)
       delete mode 100644 Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
       create mode 100644 Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml
       delete mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt
       create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.yaml
      
      --
      QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
      e5abaf91
    • Luca Ceresoli's avatar
      regulator: lp87565: enable voltage regardless of ENx pin · 81fdcef3
      Luca Ceresoli authored
      This driver enables outputs by setting bit EN_BUCKn in the BUCKn_CTRL1
      register. However, if bit EN_PIN_CTRLn in the same register is set, the
      output is actually enabled only if EN_BUCKn is set AND an enable pin is
      active. Since the driver does not touch EN_PIN_CTRLn, the choice is left to
      the hardware, which in turn gets this bit from OTP memory, and in absence
      of OTP data it uses a default value that is documented in the datasheet for
      LP8752x, but not for LP8756x.
      
      Thus the driver doesn't really "know" whether it is actually enabling the
      output or not.
      
      In order to make sure activation is always driver-controlled, just clear
      the EN_PIN_CTRLn bit. Now all activation solely depend on the EN_BUCKn bit.
      Signed-off-by: default avatarLuca Ceresoli <luca@lucaceresoli.net>
      Link: https://lore.kernel.org/r/20200622204329.11147-2-luca@lucaceresoli.netSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      81fdcef3
    • Kathiravan T's avatar
      regulator: add MP5496 regulator compatible · 93e39d09
      Kathiravan T authored
      IPQ6018 uses the PMIC MP5496. Add the binding for the same.
      Signed-off-by: default avatarKathiravan T <kathirav@codeaurora.org>
      Link: https://lore.kernel.org/r/1592889472-6843-4-git-send-email-kathirav@codeaurora.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      93e39d09
    • Kathiravan T's avatar
      regulator: qcom_smd: Add MP5496 regulators · 47894c85
      Kathiravan T authored
      IPQ6018 SoC uses the PMIC MP5496. SMPA2 and LDOA2 regulator controls the
      APSS and SDCC voltage scaling respectively. Add support for the same.
      Signed-off-by: default avatarKathiravan T <kathirav@codeaurora.org>
      Link: https://lore.kernel.org/r/1592889472-6843-5-git-send-email-kathirav@codeaurora.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      47894c85
    • Rikard Falkeborn's avatar
      regulator: qcom_spmi: Constify struct regulator_ops · 3b619e3e
      Rikard Falkeborn authored
      These are never modified, so make them const to allow the compiler to
      put them in read-only memory.
      
      Before:
         text    data     bss     dec     hex filename
        20362    2592     152   23106    5a42 drivers/regulator/qcom_spmi-regulator.o
      
      After:
         text    data     bss     dec     hex filename
        21814    1140     152   23106    5a42 drivers/regulator/qcom_spmi-regulator.o
      Signed-off-by: default avatarRikard Falkeborn <rikard.falkeborn@gmail.com>
      Link: https://lore.kernel.org/r/20200629194632.8147-3-rikard.falkeborn@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      3b619e3e
    • Rikard Falkeborn's avatar
      regulator: qcom_rpm: Constify struct regulator_ops · 8d41df64
      Rikard Falkeborn authored
      These are never modified, so make them const to allow the compiler to
      put them in read-only memory.
      
      Before:
         text    data     bss     dec     hex filename
        17485     500       8   17993    4649 drivers/regulator/qcom_rpm-regulator.o
      
      After:
         text    data     bss     dec     hex filename
        17881     104       8   17993    4649 drivers/regulator/qcom_rpm-regulator.o
      Signed-off-by: default avatarRikard Falkeborn <rikard.falkeborn@gmail.com>
      Link: https://lore.kernel.org/r/20200629194632.8147-2-rikard.falkeborn@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      8d41df64
    • Wesley Cheng's avatar
      regulator: Add dt-binding for QCOM PMIC VBUS output regulator · a824bab7
      Wesley Cheng authored
      This describes how to enable the Qualcomm PMIC VBUS booster used for
      providing power to connected USB peripherals when the USB role is host
      mode.  The driver itself will register the vbus_usb regulator, so that
      external drivers can utilize the enable/disable regulator APIs.
      Signed-off-by: default avatarWesley Cheng <wcheng@codeaurora.org>
      Link: https://lore.kernel.org/r/20200626185516.18018-6-wcheng@codeaurora.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      a824bab7