SPMI regulator driver updates
Subsystems (3)
v4 cover SPMI regulator driver updates
This is the leftover parts of the SPMI regulator driver port. The OCP feature and other vendor specific DT bindings that didn't make v4.2. I've added a hook to configure OCP per
Stephen Boyd (2):
regulator: Add over current protection (OCP) support
regulator: qcom-spmi: Add vendor specific configuration
.../bindings/regulator/qcom,spmi-regulator.txt | 60 ++++++- .../devicetree/bindings/regulator/regulator.txt | 1 + drivers/regulator/core.c | 9 + drivers/regulator/of_regulator.c | 3 + drivers/regulator/qcom_spmi-regulator.c | 200 ++++++++++++++++++++- include/linux/regulator/driver.h | 1 + include/linux/regulator/machine.h | 1 + 7 files changed, 266 insertions(+), 9 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v4 1/2 regulator: Add over current protection (OCP) support
Some regulators can automatically shut down when they detect an over current event. Add an op (set_over_current_protection) and a DT property + constraint to support this capability.
---
Changes since v3:
* New patch
Documentation/devicetree/bindings/regulator/regulator.txt | 1 + drivers/regulator/core.c | 9 +++++++++ drivers/regulator/of_regulator.c | 3 +++ include/linux/regulator/driver.h | 1 + include/linux/regulator/machine.h | 1 + 5 files changed, 15 insertions(+)
Documentation/devicetree/bindings/regulator/regulator.txt +1 -0
@@ -42,6 +42,7 @@ Optional properties: - regulator-system-load: Load in uA present on regulator that is not captured by any consumer request. - regulator-pull-down: Enable pull down resistor when the regulator is disabled. +- regulator-over-current-protection: Enable over current protection. Deprecated properties: - regulator-compatible: If a regulator chip contains multiple
drivers/regulator/core.c +9 -0
@@ -1081,6 +1081,15 @@ static int set_machine_constraints(struct regulator_dev *rdev, } } +if (rdev->constraints->over_current_protection + && ops->set_over_current_protection) { + ret = ops->set_over_current_protection (rdev); +if (ret <0 ) { +rdev_err (rdev,"failed to set over current protection\n" ); + goto out; + } + } +print_constraints (rdev);return 0 ; out:
drivers/regulator/of_regulator.c +3 -0
@@ -107,6 +107,9 @@ static void of_get_regulation_constraints(struct device_node *np,if (!of_property_read_u32 (np,"regulator-system-load" , &pval)) constraints->system_load = pval; + constraints->over_current_protection =of_property_read_bool (np, +"regulator-over-current-protection" ); +for (i =0 ; i <ARRAY_SIZE (regulator_states); i++) {switch (i) {case PM_SUSPEND_MEM :
include/linux/regulator/driver.h +1 -0
@@ -148,6 +148,7 @@ struct regulator_ops {int (*get_current_limit) (struct regulator_dev *);int (*set_input_current_limit) (struct regulator_dev *,int lim_uA); +int (*set_over_current_protection) (struct regulator_dev *);/* enable/disable regulator */ int (*enable) (struct regulator_dev *);
include/linux/regulator/machine.h +1 -0
@@ -147,6 +147,7 @@ struct regulation_constraints { unsigned ramp_disable:1; /* disable ramp delay */ unsigned soft_start:1; /* ramp voltage slowly */ unsigned pull_down:1; /* pull down resistor when regulator off */ + unsigned over_current_protection:1; /* auto disable on over current */ };/**
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Mark Brown
maintainerApplied "regulator: Add over current protection (OCP) support" to the regulator tree
The patch
regulator: Add over current protection (OCP) support
has been applied to the regulator tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
3a003baeec246f604ed1d2e0087560d7f15edcc6Mon Sep 17 00:00:00 2001
From: Stephen Boyd <[email protected]>
Date: Fri, 17 Jul 2015 14:41:54 -0700
Subject: [PATCH] regulator: Add over current protection (OCP) support
Some regulators can automatically shut down when they detect an over current event. Add an op (set_over_current_protection) and a DT property + constraint to support this capability.
--- Documentation/devicetree/bindings/regulator/regulator.txt | 1 + drivers/regulator/core.c | 9 +++++++++ drivers/regulator/of_regulator.c | 3 +++ include/linux/regulator/driver.h | 1 + include/linux/regulator/machine.h | 1 + 5 files changed, 15 insertions(+)
Documentation/devicetree/bindings/regulator/regulator.txt +1 -0
@@ -42,6 +42,7 @@ Optional properties: - regulator-system-load: Load in uA present on regulator that is not captured by any consumer request. - regulator-pull-down: Enable pull down resistor when the regulator is disabled. +- regulator-over-current-protection: Enable over current protection. Deprecated properties: - regulator-compatible: If a regulator chip contains multiple
drivers/regulator/core.c +9 -0
@@ -1081,6 +1081,15 @@ static int set_machine_constraints(struct regulator_dev *rdev, } } +if (rdev->constraints->over_current_protection + && ops->set_over_current_protection) { + ret = ops->set_over_current_protection (rdev); +if (ret <0 ) { +rdev_err (rdev,"failed to set over current protection\n" ); + goto out; + } + } +print_constraints (rdev);return 0 ; out:
drivers/regulator/of_regulator.c +3 -0
@@ -107,6 +107,9 @@ static void of_get_regulation_constraints(struct device_node *np,if (!of_property_read_u32 (np,"regulator-system-load" , &pval)) constraints->system_load = pval; + constraints->over_current_protection =of_property_read_bool (np, +"regulator-over-current-protection" ); +for (i =0 ; i <ARRAY_SIZE (regulator_states); i++) {switch (i) {case PM_SUSPEND_MEM :
include/linux/regulator/driver.h +1 -0
@@ -148,6 +148,7 @@ struct regulator_ops {int (*get_current_limit) (struct regulator_dev *);int (*set_input_current_limit) (struct regulator_dev *,int lim_uA); +int (*set_over_current_protection) (struct regulator_dev *);/* enable/disable regulator */ int (*enable) (struct regulator_dev *);
include/linux/regulator/machine.h +1 -0
@@ -147,6 +147,7 @@ struct regulation_constraints { unsigned ramp_disable:1; /* disable ramp delay */ unsigned soft_start:1; /* ramp voltage slowly */ unsigned pull_down:1; /* pull down resistor when regulator off */ + unsigned over_current_protection:1; /* auto disable on over current */ };/**
Signature · 1 line
2.1.4
PATCH v4 2/2 regulator: qcom-spmi: Add vendor specific configuration
In reply to Stephen BoydAdd support for over current protection (OCP), pin control selection, soft start strength, and auto-mode.
---
Notes:
Changes from v3:
* Split this patch out from rest of driver
* Moved auto mode into regulator-init-mode and made it equal to FAST mode
* Moved qcom,ocp-enable to regulator-over-current-protection property
Changes from v1:
* New patch split from orignal SPMI regulator driver
.../bindings/regulator/qcom,spmi-regulator.txt | 60 ++++++- drivers/regulator/qcom_spmi-regulator.c | 200 ++++++++++++++++++++- 2 files changed, 251 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt +56 -4
@@ -91,13 +91,65 @@ see regulator.txt - with additional custom properties described below: - regulator-initial-mode: Usage: optional Value type: <u32> - Descrption: 1 = Set initial mode to high power mode (HPM), also referred - to as NPM. HPM consumes more ground current than LPM, but + Description: 2 = Set initial mode to auto mode (automatically select + between HPM and LPM); not available on boost type + regulators. + + 1 = Set initial mode to high power mode (HPM), also referred + to as NPM. HPM consumes more ground current than LPM, but it can source significantly higher load current. HPM is not available on boost type regulators. For voltage switch type regulators, HPM implies that over current protection and - soft start are active all the time. 0 = Set initial mode to - low power mode (LPM). + soft start are active all the time. + + 0 = Set initial mode to low power mode (LPM). + +- qcom,ocp-max-retries: + Usage: optional + Value type: <u32> + Description: Maximum number of times to try toggling a voltage switch + off and back on as a result of consecutive over current + events. + +- qcom,ocp-retry-delay: + Usage: optional + Value type: <u32> + Description: Time to delay in milliseconds between each voltage switch + toggle after an over current event takes place. + +- qcom,pin-ctrl-enable: + Usage: optional + Value type: <u32> + Description: Bit mask specifying which hardware pins should be used to + enable the regulator, if any; supported bits are: + 0 = ignore all hardware enable signals + BIT(0) = follow HW0_EN signal + BIT(1) = follow HW1_EN signal + BIT(2) = follow HW2_EN signal + BIT(3) = follow HW3_EN signal + +- qcom,pin-ctrl-hpm: + Usage: optional + Value type: <u32> + Description: Bit mask specifying which hardware pins should be used to + force the regulator into high power mode, if any; + supported bits are: + 0 = ignore all hardware enable signals + BIT(0) = follow HW0_EN signal + BIT(1) = follow HW1_EN signal + BIT(2) = follow HW2_EN signal + BIT(3) = follow HW3_EN signal + BIT(4) = follow PMIC awake state + +- qcom,vs-soft-start-strength: + Usage: optional + Value type: <u32> + Description: This property sets the soft start strength for voltage + switch type regulators; supported values are: + 0 = 0.05 uA + 1 = 0.25 uA + 2 = 0.55 uA + 3 = 0.75 uA Example:
drivers/regulator/qcom_spmi-regulator.c +195 -5
252 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Mark Brown
maintainerApplied "regulator: qcom-spmi: Add vendor specific configuration" to the regulator tree
The patch
regulator: qcom-spmi: Add vendor specific configuration
has been applied to the regulator tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
e2adfacde619d8e39dc8c02919bd2524d3c39588Mon Sep 17 00:00:00 2001
From: Stephen Boyd <[email protected]>
Date: Fri, 17 Jul 2015 14:41:55 -0700
Subject: [PATCH] regulator: qcom-spmi: Add vendor specific configuration
Add support for over current protection (OCP), pin control selection, soft start strength, and auto-mode.
--- .../bindings/regulator/qcom,spmi-regulator.txt | 60 ++++++- drivers/regulator/qcom_spmi-regulator.c | 200 ++++++++++++++++++++- 2 files changed, 251 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt +56 -4
@@ -91,13 +91,65 @@ see regulator.txt - with additional custom properties described below: - regulator-initial-mode: Usage: optional Value type: <u32> - Descrption: 1 = Set initial mode to high power mode (HPM), also referred - to as NPM. HPM consumes more ground current than LPM, but + Description: 2 = Set initial mode to auto mode (automatically select + between HPM and LPM); not available on boost type + regulators. + + 1 = Set initial mode to high power mode (HPM), also referred + to as NPM. HPM consumes more ground current than LPM, but it can source significantly higher load current. HPM is not available on boost type regulators. For voltage switch type regulators, HPM implies that over current protection and - soft start are active all the time. 0 = Set initial mode to - low power mode (LPM). + soft start are active all the time. + + 0 = Set initial mode to low power mode (LPM). + +- qcom,ocp-max-retries: + Usage: optional + Value type: <u32> + Description: Maximum number of times to try toggling a voltage switch + off and back on as a result of consecutive over current + events. + +- qcom,ocp-retry-delay: + Usage: optional + Value type: <u32> + Description: Time to delay in milliseconds between each voltage switch + toggle after an over current event takes place. + +- qcom,pin-ctrl-enable: + Usage: optional + Value type: <u32> + Description: Bit mask specifying which hardware pins should be used to + enable the regulator, if any; supported bits are: + 0 = ignore all hardware enable signals + BIT(0) = follow HW0_EN signal + BIT(1) = follow HW1_EN signal + BIT(2) = follow HW2_EN signal + BIT(3) = follow HW3_EN signal + +- qcom,pin-ctrl-hpm: + Usage: optional + Value type: <u32> + Description: Bit mask specifying which hardware pins should be used to + force the regulator into high power mode, if any; + supported bits are: + 0 = ignore all hardware enable signals + BIT(0) = follow HW0_EN signal + BIT(1) = follow HW1_EN signal + BIT(2) = follow HW2_EN signal + BIT(3) = follow HW3_EN signal + BIT(4) = follow PMIC awake state + +- qcom,vs-soft-start-strength: + Usage: optional + Value type: <u32> + Description: This property sets the soft start strength for voltage + switch type regulators; supported values are: + 0 = 0.05 uA + 1 = 0.25 uA + 2 = 0.55 uA + 3 = 0.75 uA Example:
drivers/regulator/qcom_spmi-regulator.c +195 -5
252 lines not on this page · raw message
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html