Commit Graph

932757 Commits

Author SHA1 Message Date
Christoph Fritz e6dea51e2d
regulator: fan53880: Add initial support
This patch adds support for ON Semiconductor FAN53880 regulator.

The FAN53880 is an I2C porgrammable power management IC (PMIC)
that contains a BUCK (step-down converter), four LDOs (low dropouts)
and one BOOST (step-up converter).  It is designed for mobile power
applications.

Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Link: https://lore.kernel.org/r/20200702210846.31659-2-chf.fritz@googlemail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-03 18:00:28 +01:00
Mark Brown 8cc31dc941
Merge series "regulator: mt6397: Implement of_map_mode regulator_desc function" from Anand K Mistry <amistry@google.com>:
This patchset adds support for being able to change regulator modes for
the mt6397 regulator. This is needed to allow the voltage scaling
support in the MT8173 SoC to be used on the elm (Acer Chromebook R13)
and hana (several Lenovo Chromebooks) devices.

Without a of_map_mode implementation, the regulator-allowed-modes
devicetree field is skipped, and attempting to change the regulator mode
results in an error:
[    1.439165] vpca15: mode operation not allowed

Changes in v2:
- Introduce constants in dt-bindings
- Improve conditional readability

Anand K Mistry (4):
  regulator: mt6397: Move buck modes into header file
  dt-bindings: regulator: mt6397: Document valid modes
  regulator: mt6397: Implement of_map_mode
  arm64: dts: mediatek: Update allowed mt6397 regulator modes for elm
    boards

 .../bindings/regulator/mt6397-regulator.txt     |  3 +++
 arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi    |  4 +++-
 drivers/regulator/mt6397-regulator.c            | 17 ++++++++++++++---
 .../regulator/mediatek,mt6397-regulator.h       | 15 +++++++++++++++
 4 files changed, 35 insertions(+), 4 deletions(-)
 create mode 100644 include/dt-bindings/regulator/mediatek,mt6397-regulator.h

--
2.27.0.212.ge8ba1cc988-goog

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
2020-07-02 16:45:49 +01:00
Mark Brown c9b5e85aeb
Merge series "regulator: da9211: support changing modes" from Anand K Mistry <amistry@google.com>:
This patchset adds support for being able to change regulator modes for
the da9211 regulator. This is needed to allow the voltage scaling
support in the MT8173 SoC to be used in the elm (Acer Chromebook R13)
and hana (several Lenovo Chromebooks) devices.

Anand K Mistry (4):
  regulator: da9211: Move buck modes into header file
  dt-bindings: regulator: da9211: Document allowed modes
  regulator: da9211: Implement of_map_mode
  arm64: dts: mediatek: Update allowed regulator modes for elm boards

 .../devicetree/bindings/regulator/da9211.txt  |  4 +++
 arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi  |  4 ++-
 drivers/regulator/da9211-regulator.c          | 30 +++++++++++++++----
 .../regulator/dlg,da9211-regulator.h          | 16 ++++++++++
 4 files changed, 47 insertions(+), 7 deletions(-)
 create mode 100644 include/dt-bindings/regulator/dlg,da9211-regulator.h

--
2.27.0.212.ge8ba1cc988-goog

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
2020-07-02 16:45:48 +01:00
Mark Brown b3ddc40b61
Merge series "regulator: add support for SY8827N regulator" from Jisheng Zhang <Jisheng.Zhang@synaptics.com>:
The SY8827N from Silergy Corp is a single output DC/DC converter. The
voltage can be controlled via I2C.

Jisheng Zhang (2):
  dt-bindings: regulator: add document bindings for sy8827n
  regulator: add support for SY8827N regulator

 .../bindings/regulator/silergy,sy8827n.yaml   |  45 +++++
 drivers/regulator/Kconfig                     |   7 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/sy8827n.c                   | 185 ++++++++++++++++++
 4 files changed, 238 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/silergy,sy8827n.yaml
 create mode 100644 drivers/regulator/sy8827n.c

--
2.27.0
2020-07-02 16:45:47 +01:00
Jisheng Zhang e2c6678bd8
regulator: mp886x: use .probe_new
Use the new .probe_new for mp886x. It does not use the const
struct i2c_device_id * argument, so convert it to utilise the
simplified i2c driver registration.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Link: https://lore.kernel.org/r/20200702100200.1a4c65d1@xhacker.debian
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02 16:45:46 +01:00
Colin Ian King 94462138f3
regulator: fix null pointer check on regmap
The null pointer check on regmap that checks for a dev_get_regmap failure
is currently returning -ENOENT if the regmap succeeded. Fix this by adding
in the missing ! operator.

Fixes: 4fe66d5a62 ("regulator: Add support for QCOM PMIC VBUS booster")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Addresses-Coverity: ("Dereference after null check")
Link: https://lore.kernel.org/r/20200702115659.38208-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02 16:45:45 +01:00
Anand K Mistry 650e5adae0
regulator: da9211: Document allowed modes
This patch adds a description of how operating modes may be specified.

Signed-off-by: Anand K Mistry <amistry@google.com>
Link: https://lore.kernel.org/r/20200702131350.2.I6131e251d13f60d8c5347bb4faa9dc2364c87848@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02 16:20:59 +01:00
Anand K Mistry 6f1f1a8039
regulator: da9211: Implement of_map_mode
Implementing of_map_mode is necessary to be able to specify operating
modes in the devicetree using 'regulator-allowed-modes', and to change
regulator modes.

Signed-off-by: Anand K Mistry <amistry@google.com>
Link: https://lore.kernel.org/r/20200702131350.3.I6a0bc18fcdb2fe13e838a31e6d034d0e095368bc@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02 16:20:58 +01:00
Anand K Mistry 6c8b65950b
regulator: da9211: Move buck modes into header file
This will allow device trees to make use of these constants.

Signed-off-by: Anand K Mistry <amistry@google.com>
Link: https://lore.kernel.org/r/20200702131350.1.I96e67ab7b4568287eb939e8a572cbc03e87f1aa0@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02 16:20:57 +01:00
Jisheng Zhang 573016266e
regulator: add document bindings for sy8827n
Add device tree binding information for sy8827n regulator driver.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Link: https://lore.kernel.org/r/20200702171335.59f5e79b@xhacker.debian
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02 15:52:01 +01:00
Jisheng Zhang 38fc6f2957
regulator: add support for SY8827N regulator
The SY8827N from Silergy Corp is a single output DC/DC converter. The
voltage can be controlled via I2C.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Link: https://lore.kernel.org/r/20200702171438.20edc523@xhacker.debian
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02 15:52:00 +01:00
Anand K Mistry 347f12d573
regulator: mt6397: Document valid modes
Document valid mode values for BUCK regulators.

Signed-off-by: Anand K Mistry <amistry@google.com>
Link: https://lore.kernel.org/r/20200702162231.v2.2.I0a814b246cfe47f8dd1e25553ee881cbcfd0d8eb@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02 15:25:46 +01:00
Anand K Mistry 8096236db4
regulator: mt6397: Implement of_map_mode
Implementing of_map_mode is necessary to be able to specify operating
modes in the devicetree using 'regulator-allowed-modes', and to change
regulator modes.

Signed-off-by: Anand K Mistry <amistry@google.com>
Link: https://lore.kernel.org/r/20200702162231.v2.3.I7acfb591bfacf3b1b04a3d388385098bfcc9fecd@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02 15:25:45 +01:00
Anand K Mistry 1c537b2d72
regulator: mt6397: Move buck modes into header file
This will allow device trees to make use of these constants.

Signed-off-by: Anand K Mistry <amistry@google.com>
Link: https://lore.kernel.org/r/20200702162231.v2.1.Icf69e2041b1af4548347018186c3ba6310f53e66@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-02 15:25:45 +01:00
Mark Brown d5ff5fb977
Merge series "Introduce PMIC based USB type C detection" from Wesley Cheng <wcheng@codeaurora.org>:
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
2020-07-01 21:53:29 +01:00
Mark Brown d69323ee52
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
2020-07-01 21:53:28 +01:00
Mark Brown e5abaf9192
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
2020-07-01 21:53:27 +01:00
Luca Ceresoli 81fdcef3a6
regulator: lp87565: enable voltage regardless of ENx pin
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: Luca Ceresoli <luca@lucaceresoli.net>
Link: https://lore.kernel.org/r/20200622204329.11147-2-luca@lucaceresoli.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-01 21:53:02 +01:00
Kathiravan T 93e39d096d
regulator: add MP5496 regulator compatible
IPQ6018 uses the PMIC MP5496. Add the binding for the same.

Signed-off-by: Kathiravan T <kathirav@codeaurora.org>
Link: https://lore.kernel.org/r/1592889472-6843-4-git-send-email-kathirav@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-01 21:35:55 +01:00
Kathiravan T 47894c8594
regulator: qcom_smd: Add MP5496 regulators
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: Kathiravan T <kathirav@codeaurora.org>
Link: https://lore.kernel.org/r/1592889472-6843-5-git-send-email-kathirav@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-01 21:35:54 +01:00
Rikard Falkeborn 3b619e3e2d
regulator: qcom_spmi: Constify struct regulator_ops
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: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20200629194632.8147-3-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-01 18:33:15 +01:00
Rikard Falkeborn 8d41df6469
regulator: qcom_rpm: Constify struct regulator_ops
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: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20200629194632.8147-2-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-01 18:33:14 +01:00
Wesley Cheng a824bab7c6
regulator: Add dt-binding for QCOM PMIC VBUS output regulator
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: Wesley Cheng <wcheng@codeaurora.org>
Link: https://lore.kernel.org/r/20200626185516.18018-6-wcheng@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-01 18:07:20 +01:00
Wesley Cheng 4fe66d5a62
regulator: Add support for QCOM PMIC VBUS booster
Some Qualcomm PMICs have the capability to source the VBUS output to
connected peripherals.  This driver will register a regulator to the
regulator list to enable or disable this source by an external driver.

Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
Link: https://lore.kernel.org/r/20200626185516.18018-5-wcheng@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-01 18:07:15 +01:00
Lee Jones bfa29acd18
regulator: qcom_smd-regulator: Remove unused 'struct regulator_desc pmi8994_boost'
This was an upstreaming error.  Remove it as it's not to be used.

Fixes the following W=1 kernel build warning:

 drivers/regulator/qcom_smd-regulator.c:477:36: warning: ‘pmi8994_boost’ defined but not used [-Wunused-const-variable=]

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-arm-msm@vger.kernel.org
Link: https://lore.kernel.org/r/20200626065738.93412-10-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-26 15:34:25 +01:00
Lee Jones 0c52616637
regulator: wm8400-regulator: Repair dodgy kerneldoc header formatting
W=1 kernel builds report a lack of descriptions for various
function arguments.  In reality they are documented, but the
formatting was not as expected '@.*:'.  Instead, some weird
arg identifiers were used.

This change fixes the following warnings:

 drivers/regulator/wm8400-regulator.c:243: warning: Function parameter or member 'dev' not described in 'wm8400_register_regulator'
 drivers/regulator/wm8400-regulator.c:243: warning: Function parameter or member 'reg' not described in 'wm8400_register_regulator'
 drivers/regulator/wm8400-regulator.c:243: warning: Function parameter or member 'initdata' not described in 'wm8400_register_regulator'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: patches@opensource.cirrus.com
Link: https://lore.kernel.org/r/20200626065738.93412-9-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-26 15:34:24 +01:00
Lee Jones 02d8886319
regulator: tps65218-regulator: Remove pointless 'is unsigned int <0' check
'rid' is declared as unsigned int, so there is little point checking for <0.

Removing these checks fixes the following W=1 warnings:

 drivers/regulator/tps65218-regulator.c: In function ‘tps65218_pmic_set_suspend_enable’:
 drivers/regulator/tps65218-regulator.c:131:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
 131 | if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
 | ^
 drivers/regulator/tps65218-regulator.c: In function ‘tps65218_pmic_set_suspend_disable’:
 drivers/regulator/tps65218-regulator.c:144:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
 144 | if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1)
 | ^

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: Keerthy <j-keerthy@ti.com>
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: linux-omap@vger.kernel.org
Link: https://lore.kernel.org/r/20200626065738.93412-8-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-26 15:34:23 +01:00
Lee Jones 44455a6d3b
regulator: tps65217-regulator: Use the returned value of tps65217_reg_read()
Until now the aforementioned return value has been ignored.
Previous and current calls to tps65217_reg_read() return
instantly when the value is not 0, so let's do that.

Fixes the following W=1 warning:

 drivers/regulator/tps65217-regulator.c: In function ‘tps65217_regulator_probe’:
 drivers/regulator/tps65217-regulator.c:227:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
 227 | int i, ret;
 | ^~~

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: Russ Dill <Russ.Dill@ti.com>
Cc: Keerthy <j-keerthy@ti.com>
Cc: AnilKumar Ch <anilkumar@ti.com>
Cc: linux-omap@vger.kernel.org
Link: https://lore.kernel.org/r/20200626065738.93412-7-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-26 15:34:22 +01:00
Lee Jones f10a5e499c
regulator: tps65217-regulator: Remove pointless 'is unsigned int <0' check
'rid' is declared as unsigned int, so there is little point checking for <0.

Removing these checks fixes the following W=1 warnings:

 drivers/regulator/tps65217-regulator.c: In function ‘tps65217_pmic_set_suspend_enable’:
 drivers/regulator/tps65217-regulator.c:127:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
 127 | if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4)
 | ^
 drivers/regulator/tps65217-regulator.c: In function ‘tps65217_pmic_set_suspend_disable’:
 drivers/regulator/tps65217-regulator.c:140:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
 140 | if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4)
 | ^

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: Russ Dill <Russ.Dill@ti.com>
Cc: Keerthy <j-keerthy@ti.com>
Cc: AnilKumar Ch <anilkumar@ti.com>
Cc: linux-omap@vger.kernel.org
Link: https://lore.kernel.org/r/20200626065738.93412-6-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-26 15:34:21 +01:00
Lee Jones ec84a7dff4
regulator: stpmic1_regulator: Properly document 'struct stpmic1_regulator_cfg'
In kerneldoc format, data structures have to start with 'struct'
else the kerneldoc tooling/parsers/validators get confused.

Fixes the following W=1 kernel build warning:

 drivers/regulator/stpmic1_regulator.c:25: warning: cannot understand function prototype: 'struct stpmic1_regulator_cfg '

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: Pascal Paillet <p.paillet@st.com>
Link: https://lore.kernel.org/r/20200626065738.93412-5-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-26 15:34:20 +01:00
Lee Jones 4e773e7392
regulator: pwm-regulator: Demote kerneldoc header to standard comment
This particular comment doesn't have anything to do with documenting
functions or data structures.  Instead it is used as a section header.

Fixes W=1 warning:

 drivers/regulator/pwm-regulator.c:55: warning: Function parameter or member 'rdev' not described in 'pwm_regulator_init_state'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200626065738.93412-4-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-26 15:34:19 +01:00
Lee Jones 7cb5f69207
regulator: qcom-rpmh-regulator: Repair dodgy kerneldoc header formatting
W=1 kernel builds report a lack of descriptions for various
enum properties and function arguments.  In reality they are
documented, but the formatting was not as expected '@.*:'.
Instead, some weird arg identifiers were used or none at all.

This change fixes the following warnings:

 drivers/regulator/qcom-rpmh-regulator.c:33: warning: Enum value 'VRM' not described in enum 'rpmh_regulator_type'
 drivers/regulator/qcom-rpmh-regulator.c:33: warning: Enum value 'XOB' not described in enum 'rpmh_regulator_type'
 drivers/regulator/qcom-rpmh-regulator.c:416: warning: Function parameter or member 'vreg' not described in 'rpmh_regulator_init_vreg'
 drivers/regulator/qcom-rpmh-regulator.c:416: warning: Function parameter or member 'dev' not described in 'rpmh_regulator_init_vreg'
 drivers/regulator/qcom-rpmh-regulator.c:416: warning: Function parameter or member 'node' not described in 'rpmh_regulator_init_vreg'
 drivers/regulator/qcom-rpmh-regulator.c:416: warning: Function parameter or member 'pmic_id' not described in 'rpmh_regulator_init_vreg'
 drivers/regulator/qcom-rpmh-regulator.c:416: warning: Function parameter or member 'pmic_rpmh_data' not described in 'rpmh_regulator_init_vreg'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-arm-msm@vger.kernel.org
Link: https://lore.kernel.org/r/20200626065738.93412-3-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-26 15:34:18 +01:00
Lee Jones 36f69fa96a
regulator: max8998: Staticify internal function max8998_get_current_limit()
max8998_get_current_limit() is only used via the .get_current_limit,
so it doesn't need to be publicly supported, or to have its own
external prototype.  Instead, we'll make it static.

Fixes the following W=1 warning:

 drivers/regulator/max8998.c:418:5: warning: no previous prototype for ‘max8998_get_current_limit’ [-Wmissing-prototypes]
 418 | int max8998_get_current_limit(struct regulator_dev *rdev)
 | ^~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20200626065738.93412-2-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-26 15:34:18 +01:00
Lee Jones 0c32f8aa07
regulator: max14577-regulator: Demote kerneldoc header to standard comment
Nothing about this comment identifies it as a kerneldoc header.
It's missing all of it's function argument descriptions and the
correct function header.

Fixes the following W=1 warning(s):

 drivers/regulator/max14577-regulator.c:166: warning: Function parameter or member 'max14577' not described in 'max14577_get_regma
 drivers/regulator/max14577-regulator.c:166: warning: Function parameter or member 'reg_id' not described in 'max14577_get_regmap'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200625163614.4001403-11-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-25 20:11:17 +01:00
Lee Jones 7b804ce0c2
regulator: cpcap-regulator: Demote kerneldoc header to standard comment
Nothing about this comment identifies it as a kerneldoc header.
They're missing all of their struct's property descriptions and
the correct 'struct *' header.

Fixes the following W=1 warning(s):

 drivers/regulator/cpcap-regulator.c:99: warning: cannot understand function prototype: 'struct cpcap_regulator '
 drivers/regulator/cpcap-regulator.c:337: warning: cannot understand function prototype: 'const struct cpcap_regulator omap4_regulators[] = '

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200625163614.4001403-9-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-25 20:11:16 +01:00
Lee Jones b89a5effb3
regulator: cpcap-regulator: Remove declared and set, but never used variable 'ignore'
It's okay to not check the return value that you're not conserned
about, however it is not okay to assign a variable and not check or
use the result.

Fixes W=1 warnings(s):

 drivers/regulator/cpcap-regulator.c:172:13: warning: variable ‘ignore’ set but not used [-Wunused-but-set-variable]
 172 | int error, ignore;
 | ^~~~~~
 drivers/regulator/cpcap-regulator.c: In function ‘cpcap_regulator_disable’:
 drivers/regulator/cpcap-regulator.c:196:13: warning: variable ‘ignore’ set but not used [-Wunused-but-set-variable]
 196 | int error, ignore;
 | ^~~~~~

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200625163614.4001403-8-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-25 20:11:15 +01:00
Lee Jones 2f5add1e42
regulator: wm8350-regulator: Repair odd formatting in documentation
Kerneldoc expects function arguments to be in the format '@.*:'.  If
this format is not followed the kerneldoc tooling/parsers/validators
get confused.

Fixes the following W=1 warning(s):

 drivers/regulator/wm8350-regulator.c🔢 warning: Function parameter or member 'wm8350' not described in 'wm8350_register_led'
 drivers/regulator/wm8350-regulator.c🔢 warning: Function parameter or member 'lednum' not described in 'wm8350_register_led'
 drivers/regulator/wm8350-regulator.c🔢 warning: Function parameter or member 'dcdc' not described in 'wm8350_register_led'
 drivers/regulator/wm8350-regulator.c🔢 warning: Function parameter or member 'isink' not described in 'wm8350_register_led'
 drivers/regulator/wm8350-regulator.c🔢 warning: Function parameter or member 'pdata' not described in 'wm8350_register_led'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200625163614.4001403-7-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-25 20:11:14 +01:00
Lee Jones aeee55b76b
regulator: ab8500: Remove unused embedded struct expand_register
Used primarily for the AB8540 which lost support in early 2018.
It is now deemed safe to remove this legacy data structure.

Also fixes W=1 issue:

  drivers/regulator/ab8500.c:88: warning: Function parameter or member 'expand_register' not described in 'ab8500_regulator_info'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200625163614.4001403-6-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-25 20:11:13 +01:00
Lee Jones d3cc3dfcc2
regulator: dbx500-prcmu: Remove unused function dbx500_regulator_testcase()
There isn't any code present within the current kernel to
override this 'weak' function.  Besides returning '0', which
is never checked anyway, the whole function appears to be
superfluous.

Consequently fixes W=1 warning:

 drivers/regulator/dbx500-prcmu.c:113:27: warning: no previous prototype for ‘dbx500_regulator_testcase’ [-Wmissing-prototypes]
 113 | int __attribute__((weak)) dbx500_regulator_testcase(
 | ^~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200625163614.4001403-5-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-25 20:11:12 +01:00
Lee Jones da6690767c
regulator: consumer: Supply missing prototypes for 3 core functions
regulator_suspend_enable(), regulator_suspend_disable() and
regulator_set_suspend_voltage() are all exported members of the
API, but are all missing prototypes.

Fixes the following W=1 warning(s):

 drivers/regulator/core.c:3805:5: warning: no previous prototype for ‘regulator_suspend_enable’ [-Wmissing-prototypes]
 3805 | int regulator_suspend_enable(struct regulator_dev *rdev,
 | ^~~~~~~~~~~~~~~~~~~~~~~~
 drivers/regulator/core.c:3812:5: warning: no previous prototype for ‘regulator_suspend_disable’ [-Wmissing-prototypes]
 3812 | int regulator_suspend_disable(struct regulator_dev *rdev,
 | ^~~~~~~~~~~~~~~~~~~~~~~~~
 drivers/regulator/core.c:3851:5: warning: no previous prototype for ‘regulator_set_suspend_voltage’ [-Wmissing-prototypes]
 3851 | int regulator_set_suspend_voltage(struct regulator *regulator, int min_uV,
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200625163614.4001403-2-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-25 20:11:12 +01:00
Robin Gong a7503a9d8f
regulator: pfuze100: add condition check for 'ramp_delay = 0'
Checking for 'ramp_delay = 0' to avoid Coverity warning report.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Link: https://lore.kernel.org/r/1592920870-12693-1-git-send-email-yibin.gong@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-23 13:15:13 +01:00
Rikard Falkeborn 9ed84d24de
regulator: max8997: Constify struct regulator_ops
These are not modified so make them const to allow the compiler to put
them in read-only memory.

Before:
   text    data     bss     dec     hex filename
  13114    8596       0   21710    54ce drivers/regulator/max8997-regulator.o

After:
   text    data     bss     dec     hex filename
  14038    7672       0   21710    54ce drivers/regulator/max8997-regulator.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20200617223247.25566-6-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-18 13:47:35 +01:00
Rikard Falkeborn b08af72d6e
regulator: max8907: Constify static structs
These are not modified so make them const to allow the compiler to put
them in read-only memory.

Before:
   text    data     bss     dec     hex filename
   2753    7328       0   10081    2761 drivers/regulator/max8907-regulator.o

After:
   text    data     bss     dec     hex filename
   9405     684       0   10089    2769 drivers/regulator/max8907-regulator.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20200617223247.25566-5-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-18 13:47:34 +01:00
Rikard Falkeborn b37f076d4b
regulator: ltc3676: Constify ltc3676_regulators
ltc3676_regulators is not modified and can be made const to allow the
compiler to put it in read-only memory.

Before:
   text    data     bss     dec     hex filename
   4361    2064       8    6433    1921 drivers/regulator/ltc3676.o

After:
   text    data     bss     dec     hex filename
   6121     304       8    6433    1921 drivers/regulator/ltc3676.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20200617223247.25566-4-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-18 13:47:33 +01:00
Rikard Falkeborn bcf39c1eb1
regulator: cpcap: Constify cpcap_regulator_ops
cpcap_regulator_ops is not modified and can be made const to allow the
compiler to put it in read-only memory.

Before:
   text    data     bss     dec     hex filename
  14472     236       0   14708    3974 drivers/regulator/cpcap-regulator.o

After:
   text    data     bss     dec     hex filename
  14604     104       0   14708    3974 drivers/regulator/cpcap-regulator.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20200617223247.25566-3-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-18 13:47:32 +01:00
Rikard Falkeborn cae62a9379
regulator: anatop: Constify anatop_core_rops
anatop_core_rops is not modified and can therefore be made const which
allows the compiler to put it in read-only memory.

Before:
   text    data     bss     dec     hex filename
   4502     412       0    4914    1332 drivers/regulator/anatop-regulator.o

After:
   text    data     bss     dec     hex filename
   4634     280       0    4914    1332 drivers/regulator/anatop-regulator.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20200617223247.25566-2-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-18 13:47:31 +01:00
Mark Brown 0ac87aed5b
Merge series "Add support for voltage regulator on ChromeOS EC." from Pi-Hsun Shih <pihsun@chromium.org>:
Add support for controlling voltage regulator that is connected and
controlled by ChromeOS EC. Kernel controls these regulators through
newly added EC host commands.

Changes from v5:
* Move new host command to a separate patch.
* Use devm_regulator_register.
* Address review comments.

Changes from v4:
* Change compatible name from regulator-cros-ec to cros-ec-regulator.

Changes from v3:
* Fix dt bindings file name.
* Remove check around CONFIG_OF in driver.
* Add new host commands to cros_ec_trace.
* Address review comments.

Changes from v2:
* Add 'depends on OF' to Kconfig.
* Add Kconfig description about compiling as module.

Changes from v1:
* Change compatible string to google,regulator-cros-ec.
* Use reg property in device tree.
* Change license for dt binding according to checkpatch.pl.
* Address comments on code styles.

Pi-Hsun Shih (3):
  dt-bindings: regulator: Add DT binding for cros-ec-regulator
  platform/chrome: cros_ec: Add command for regulator control.
  regulator: Add driver for cros-ec-regulator

 .../regulator/google,cros-ec-regulator.yaml   |  51 ++++
 drivers/platform/chrome/cros_ec_trace.c       |   5 +
 drivers/regulator/Kconfig                     |  10 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/cros-ec-regulator.c         | 257 ++++++++++++++++++
 .../linux/platform_data/cros_ec_commands.h    |  82 ++++++
 6 files changed, 406 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/google,cros-ec-regulator.yaml
 create mode 100644 drivers/regulator/cros-ec-regulator.c

base-commit: b791d1bdf9
--
2.27.0.290.gba653c62da-goog
2020-06-15 23:06:31 +01:00
Kieran Bingham d3f3723387
regulator: Fix trivial spelling
The word 'descriptor' is misspelled throughout the tree.

Fix it up accordingly:
    decriptors -> descriptors

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20200609124610.3445662-10-kieran.bingham+renesas@ideasonboard.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-15 23:06:30 +01:00
Kieran Bingham 1f0b740004
regulator: gpio: Fix trivial spelling
decriptor -> descriptor.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Link: https://lore.kernel.org/r/20200609124610.3445662-17-kieran.bingham+renesas@ideasonboard.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-15 23:06:29 +01:00
Pi-Hsun Shih 8d9f8d57e0
regulator: Add driver for cros-ec-regulator
Add driver for cros-ec-regulator, representing a voltage regulator that
is connected and controlled by ChromeOS EC, and is controlled by kernel
with EC host commands.

Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20200612040526.192878-4-pihsun@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-15 22:40:14 +01:00