* [PATCH v3 0/2] Enable VBUS current boost on pm8150b platforms
@ 2021-04-27 13:07 Bryan O'Donoghue
2021-04-27 13:07 ` [PATCH v3 1/2] regulator: Add a routine to set the current limit for QCOM PMIC VBUS Bryan O'Donoghue
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2021-04-27 13:07 UTC (permalink / raw)
To: agross, bjorn.andersson, lgirdwood, broonie, robh, devicetree
Cc: wcheng, linux-arm-msm, dmitry.baryshkov, bryan.odonoghue
V3:
- Drop the SoC regulator constraints for
regulator-min-microamp
regulator-max-microamp
These will be applied on a per-board basis - Mark Brown
V2:
The first version of this patch set the current limit to 3 amps as was done
in downstream. Mark indicated a preference to set this on a per-system
basis instead of blitzing it, as in downstream.
Looking at what was upstream versus what was in my working tree I saw that
in fact the VBUS boost driver had been upstreamed minus accompanying DTS in
pm8150b.
So there's no need for a fixes as this driver doesn't appear to be in use.
A subsequent patchset will enable the VBUS boost for the two relevant
upstream platforms.
First thing though, is the driver + dts change.
- Use regulator_set_current_limit_regmap/regulator_get_current_limit_regmap
with a relevant current-to-bitmap lookup.
- Add a parallel DTS entry to the pm8150b
It looks like this was submitted upstream but not followed up on
I've add regulator-min-microamp/regulator-max-microamp to Wesley's
original work.
I've made sure to test that its possible to set the current to anything in
the range of 500 mA to 3 A and confirmed the output on a scope.
Once these two patches are in, I'll send out board enablement for the
sm8150-mtp and qrb5165-rb5.
https://lore.kernel.org/linux-arm-msm/8687acdb-75e9-5fc5-dd3e-9a19615676b5@linaro.org/T/#t
Bryan O'Donoghue (1):
regulator: Add a routine to set the current limit for QCOM PMIC VBUS
Wesley Cheng (1):
arm64: boot: dts: qcom: pm8150b: Add DTS node for PMIC VBUS booster
arch/arm64/boot/dts/qcom/pm8150b.dtsi | 6 ++++++
drivers/regulator/qcom_usb_vbus-regulator.c | 12 ++++++++++++
2 files changed, 18 insertions(+)
--
2.30.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3 1/2] regulator: Add a routine to set the current limit for QCOM PMIC VBUS
2021-04-27 13:07 [PATCH v3 0/2] Enable VBUS current boost on pm8150b platforms Bryan O'Donoghue
@ 2021-04-27 13:07 ` Bryan O'Donoghue
2021-04-27 13:07 ` [PATCH v3 2/2] arm64: boot: dts: qcom: pm8150b: Add DTS node for PMIC VBUS booster Bryan O'Donoghue
2021-05-11 8:25 ` (subset) [PATCH v3 0/2] Enable VBUS current boost on pm8150b platforms Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2021-04-27 13:07 UTC (permalink / raw)
To: agross, bjorn.andersson, lgirdwood, broonie, robh, devicetree
Cc: wcheng, linux-arm-msm, dmitry.baryshkov, bryan.odonoghue
Add hooks to regulator_get_current_limit_regmap() and
regulator_set_current_limit_regmap() with an accompanying map of amperages.
This lets us use the existing helper functions to map requested current
settings to register bit-map/indicies.
This change is required to elevate the default 2 Amps set by the bootloader
to 3 Amps or indeed to constrain the value lower as the system design may
dictate.
The valid range is 500 mA to 3 A in increments of 500 mA.
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
drivers/regulator/qcom_usb_vbus-regulator.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/regulator/qcom_usb_vbus-regulator.c b/drivers/regulator/qcom_usb_vbus-regulator.c
index 457788b505720..2e627c2b6c512 100644
--- a/drivers/regulator/qcom_usb_vbus-regulator.c
+++ b/drivers/regulator/qcom_usb_vbus-regulator.c
@@ -16,13 +16,21 @@
#define CMD_OTG 0x40
#define OTG_EN BIT(0)
+#define OTG_CURRENT_LIMIT_CFG 0x52
+#define OTG_CURRENT_LIMIT_MASK GENMASK(2, 0)
#define OTG_CFG 0x53
#define OTG_EN_SRC_CFG BIT(1)
+static const unsigned int curr_table[] = {
+ 500000, 1000000, 1500000, 2000000, 2500000, 3000000,
+};
+
static const struct regulator_ops qcom_usb_vbus_reg_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
+ .get_current_limit = regulator_get_current_limit_regmap,
+ .set_current_limit = regulator_set_current_limit_regmap,
};
static struct regulator_desc qcom_usb_vbus_rdesc = {
@@ -30,6 +38,8 @@ static struct regulator_desc qcom_usb_vbus_rdesc = {
.ops = &qcom_usb_vbus_reg_ops,
.owner = THIS_MODULE,
.type = REGULATOR_VOLTAGE,
+ .curr_table = curr_table,
+ .n_current_limits = ARRAY_SIZE(curr_table),
};
static int qcom_usb_vbus_regulator_probe(struct platform_device *pdev)
@@ -61,6 +71,8 @@ static int qcom_usb_vbus_regulator_probe(struct platform_device *pdev)
qcom_usb_vbus_rdesc.enable_reg = base + CMD_OTG;
qcom_usb_vbus_rdesc.enable_mask = OTG_EN;
+ qcom_usb_vbus_rdesc.csel_reg = base + OTG_CURRENT_LIMIT_CFG;
+ qcom_usb_vbus_rdesc.csel_mask = OTG_CURRENT_LIMIT_MASK;
config.dev = dev;
config.init_data = init_data;
config.of_node = dev->of_node;
--
2.30.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 2/2] arm64: boot: dts: qcom: pm8150b: Add DTS node for PMIC VBUS booster
2021-04-27 13:07 [PATCH v3 0/2] Enable VBUS current boost on pm8150b platforms Bryan O'Donoghue
2021-04-27 13:07 ` [PATCH v3 1/2] regulator: Add a routine to set the current limit for QCOM PMIC VBUS Bryan O'Donoghue
@ 2021-04-27 13:07 ` Bryan O'Donoghue
2021-05-11 8:25 ` (subset) [PATCH v3 0/2] Enable VBUS current boost on pm8150b platforms Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2021-04-27 13:07 UTC (permalink / raw)
To: agross, bjorn.andersson, lgirdwood, broonie, robh, devicetree
Cc: wcheng, linux-arm-msm, dmitry.baryshkov, bryan.odonoghue
From: Wesley Cheng <wcheng@codeaurora.org>
Add the required DTS node for the USB VBUS output regulator, which is
available on PM8150B. This will provide the VBUS source to connected
peripherals.
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
arch/arm64/boot/dts/qcom/pm8150b.dtsi | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/pm8150b.dtsi b/arch/arm64/boot/dts/qcom/pm8150b.dtsi
index b21e56a46145b..058cc5107c754 100644
--- a/arch/arm64/boot/dts/qcom/pm8150b.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm8150b.dtsi
@@ -53,6 +53,12 @@ power-on@800 {
status = "disabled";
};
+ pm8150b_vbus: dcdc@1100 {
+ compatible = "qcom,pm8150b-vbus-reg";
+ status = "disabled";
+ reg = <0x1100>;
+ };
+
pm8150b_temp: temp-alarm@2400 {
compatible = "qcom,spmi-temp-alarm";
reg = <0x2400>;
--
2.30.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: (subset) [PATCH v3 0/2] Enable VBUS current boost on pm8150b platforms
2021-04-27 13:07 [PATCH v3 0/2] Enable VBUS current boost on pm8150b platforms Bryan O'Donoghue
2021-04-27 13:07 ` [PATCH v3 1/2] regulator: Add a routine to set the current limit for QCOM PMIC VBUS Bryan O'Donoghue
2021-04-27 13:07 ` [PATCH v3 2/2] arm64: boot: dts: qcom: pm8150b: Add DTS node for PMIC VBUS booster Bryan O'Donoghue
@ 2021-05-11 8:25 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-05-11 8:25 UTC (permalink / raw)
To: lgirdwood, agross, bjorn.andersson, Bryan O'Donoghue,
devicetree, robh
Cc: Mark Brown, wcheng, dmitry.baryshkov, linux-arm-msm
On Tue, 27 Apr 2021 14:07:10 +0100, Bryan O'Donoghue wrote:
> V3:
> - Drop the SoC regulator constraints for
> regulator-min-microamp
> regulator-max-microamp
> These will be applied on a per-board basis - Mark Brown
>
> V2:
> The first version of this patch set the current limit to 3 amps as was done
> in downstream. Mark indicated a preference to set this on a per-system
> basis instead of blitzing it, as in downstream.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/2] regulator: Add a routine to set the current limit for QCOM PMIC VBUS
commit: 67823d9dadd4dddee4b6bd075f6852b6ade5604a
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-11 8:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27 13:07 [PATCH v3 0/2] Enable VBUS current boost on pm8150b platforms Bryan O'Donoghue
2021-04-27 13:07 ` [PATCH v3 1/2] regulator: Add a routine to set the current limit for QCOM PMIC VBUS Bryan O'Donoghue
2021-04-27 13:07 ` [PATCH v3 2/2] arm64: boot: dts: qcom: pm8150b: Add DTS node for PMIC VBUS booster Bryan O'Donoghue
2021-05-11 8:25 ` (subset) [PATCH v3 0/2] Enable VBUS current boost on pm8150b platforms Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).