forked from openwrt/openwrt
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PMD9655 is used in IPQ8074 and provides S3 for cores, S4 for UBI core and LDO11 for SDIO/eMMC. So as preparation for DVFS add support for the regulator. Signed-off-by: Robert Marko <robimarko@gmail.com>
- Loading branch information
Showing
8 changed files
with
453 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
target/linux/ipq807x/patches-5.15/0123-regulator-qcom_spmi-Add-PMD9655-SPMI-regulator.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
From cb5dc874a8f0740eb988c2851a97d214e463eeb1 Mon Sep 17 00:00:00 2001 | ||
From: Praveenkumar I <ipkumar@codeaurora.org> | ||
Date: Tue, 31 Mar 2020 22:00:27 +0530 | ||
Subject: [PATCH] regulator: qcom_spmi: Add PMD9655 SPMI regulator | ||
|
||
PMD9655 is used in IPQ8074 and provides S3 for cores, | ||
S4 for UBI core and LDO11 for SDIO/eMMC. | ||
|
||
Signed-off-by: Praveenkumar I <ipkumar@codeaurora.org> | ||
Signed-off-by: Robert Marko <robimarko@gmail.com> | ||
--- | ||
drivers/regulator/qcom_spmi-regulator.c | 8 ++++++++ | ||
1 file changed, 8 insertions(+) | ||
|
||
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c | ||
index 41424a3366d0..fbb5eeb3f802 100644 | ||
--- a/drivers/regulator/qcom_spmi-regulator.c | ||
+++ b/drivers/regulator/qcom_spmi-regulator.c | ||
@@ -2092,6 +2092,13 @@ static const struct spmi_regulator_data pms405_regulators[] = { | ||
{ } | ||
}; | ||
|
||
+static const struct spmi_regulator_data pmd9655_regulators[] = { | ||
+ { "s3", 0x1a00, "vdd_s3",}, | ||
+ { "s4", 0x1d00, "vdd_s4",}, | ||
+ { "ldo11", 0x4a00, "vdd_ldo11",}, | ||
+ { } | ||
+}; | ||
+ | ||
static const struct of_device_id qcom_spmi_regulator_match[] = { | ||
{ .compatible = "qcom,pm8004-regulators", .data = &pm8004_regulators }, | ||
{ .compatible = "qcom,pm8005-regulators", .data = &pm8005_regulators }, | ||
@@ -2104,6 +2111,7 @@ static const struct of_device_id qcom_spmi_regulator_match[] = { | ||
{ .compatible = "qcom,pm660-regulators", .data = &pm660_regulators }, | ||
{ .compatible = "qcom,pm660l-regulators", .data = &pm660l_regulators }, | ||
{ .compatible = "qcom,pms405-regulators", .data = &pms405_regulators }, | ||
+ { .compatible = "qcom,pmd9655-regulators", .data = &pmd9655_regulators }, | ||
{ } | ||
}; | ||
MODULE_DEVICE_TABLE(of, qcom_spmi_regulator_match); | ||
-- | ||
2.35.1 | ||
|
27 changes: 27 additions & 0 deletions
27
...inux/ipq807x/patches-5.15/0124-regulator-qcom_spmi-SMPS-range-is-added-to-support-P.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
From 3c5e2d0c4149c287b9992e156a15ff881895bf00 Mon Sep 17 00:00:00 2001 | ||
From: Praveenkumar I <ipkumar@codeaurora.org> | ||
Date: Mon, 4 May 2020 19:31:00 +0530 | ||
Subject: [PATCH] regulator: qcom_spmi: SMPS range is added to support PMD9655 | ||
PMIC | ||
|
||
Signed-off-by: Praveenkumar I <ipkumar@codeaurora.org> | ||
Change-Id: I5571801debec25527fd763d95aff27cc42f53bde | ||
--- | ||
drivers/regulator/qcom_spmi-regulator.c | 1 + | ||
1 file changed, 1 insertion(+) | ||
|
||
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c | ||
index fbb5eeb3f802..bb10a325e5e7 100644 | ||
--- a/drivers/regulator/qcom_spmi-regulator.c | ||
+++ b/drivers/regulator/qcom_spmi-regulator.c | ||
@@ -481,6 +481,7 @@ static struct spmi_voltage_range ln_ldo_ranges[] = { | ||
}; | ||
|
||
static struct spmi_voltage_range smps_ranges[] = { | ||
+ SPMI_VOLTAGE_RANGE(2, 670000, 670000, 990000, 990000, 8000), | ||
SPMI_VOLTAGE_RANGE(0, 375000, 375000, 1562500, 1562500, 12500), | ||
SPMI_VOLTAGE_RANGE(1, 1550000, 1575000, 3125000, 3125000, 25000), | ||
}; | ||
-- | ||
2.35.1 | ||
|
39 changes: 39 additions & 0 deletions
39
...inux/ipq807x/patches-5.15/0125-regulator-qcom_spmi-Initialize-slew-rate-only-if-req.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
From 7475c4cd8898ba5bdf3021a23d3087d7a9747ec4 Mon Sep 17 00:00:00 2001 | ||
From: PRAVEENKUMAR I <ipkumar@codeaurora.org> | ||
Date: Tue, 5 May 2020 07:57:21 +0530 | ||
Subject: [PATCH] regulator: qcom_spmi: Initialize slew rate only if required | ||
|
||
Initialize slew rate only if set_voltage_time_sel in ops | ||
is defined. | ||
|
||
Change-Id: I661c88d2f4a8f26cc85b1e2d4c8aa3170420ba6c | ||
Signed-off-by: Rajith Cherian <rajith@codeaurora.org> | ||
(cherry picked from commit 608a6f171ef4017197fbe2069b5910b582923027) | ||
Signed-off-by: Praveenkumar I <ipkumar@codeaurora.org> | ||
|
||
Change-Id: Ida3cf3d754e1207e34a164d6d86c6e1aa109ef1e | ||
--- | ||
drivers/regulator/qcom_spmi-regulator.c | 7 +++++++ | ||
1 file changed, 7 insertions(+) | ||
|
||
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c | ||
index bb10a325e5e7..d9fef082a34e 100644 | ||
--- a/drivers/regulator/qcom_spmi-regulator.c | ||
+++ b/drivers/regulator/qcom_spmi-regulator.c | ||
@@ -1617,6 +1617,13 @@ static int spmi_regulator_init_slew_rate(struct spmi_regulator *vreg) | ||
int step, delay, slew_rate, step_delay; | ||
const struct spmi_voltage_range *range; | ||
|
||
+ /* | ||
+ * Slew rate need not be initialized if | ||
+ * set_voltage_time_sel in the ops is not defined. | ||
+ */ | ||
+ if (!vreg->desc.ops->set_voltage_time_sel) | ||
+ return 0; | ||
+ | ||
ret = spmi_vreg_read(vreg, SPMI_COMMON_REG_STEP_CTRL, ®, 1); | ||
if (ret) { | ||
dev_err(vreg->dev, "spmi read failed, ret=%d\n", ret); | ||
-- | ||
2.35.1 | ||
|
164 changes: 164 additions & 0 deletions
164
...inux/ipq807x/patches-5.15/0126-regulator-qcom_spmi-Add-support-for-VMPWM_CTL-subtyp.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
From 29d356f93a44cd96a2618ffcc08968a1a0dff828 Mon Sep 17 00:00:00 2001 | ||
From: PRAVEENKUMAR I <ipkumar@codeaurora.org> | ||
Date: Tue, 5 May 2020 07:57:52 +0530 | ||
Subject: [PATCH] regulator: qcom_spmi: Add support for VMPWM_CTL subtype | ||
|
||
Support for Voltage Mode PWM Controller (VMPWM_CTL). | ||
Set/Get microvolts functions added. Function to find the | ||
voltage range for this particular subtype added. | ||
|
||
Change-Id: Ib4bf35ee65de17a917f01e63208368c7770401d4 | ||
Signed-off-by: Rajith Cherian <rajith@codeaurora.org> | ||
(cherry picked from commit 31e7e4183b5afaf18dbca3548f4988c420ebb58b) | ||
Signed-off-by: Praveenkumar I <ipkumar@codeaurora.org> | ||
|
||
Change-Id: Id7a3caef84499b9e2eefda9f57576923c84234f0 | ||
--- | ||
drivers/regulator/qcom_spmi-regulator.c | 82 +++++++++++++++++++++++++ | ||
1 file changed, 82 insertions(+) | ||
|
||
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c | ||
index d9fef082a34e..6176a09df345 100644 | ||
--- a/drivers/regulator/qcom_spmi-regulator.c | ||
+++ b/drivers/regulator/qcom_spmi-regulator.c | ||
@@ -164,6 +164,7 @@ enum spmi_regulator_subtype { | ||
SPMI_REGULATOR_SUBTYPE_ULT_HF_CTL3 = 0x0f, | ||
SPMI_REGULATOR_SUBTYPE_ULT_HF_CTL4 = 0x10, | ||
SPMI_REGULATOR_SUBTYPE_HFS430 = 0x0a, | ||
+ SPMI_REGULATOR_SUBTYPE_VMPWM_CTL = 0x0a, | ||
}; | ||
|
||
enum spmi_common_regulator_registers { | ||
@@ -289,6 +290,10 @@ enum spmi_common_control_register_index { | ||
#define SPMI_FTSMPS_STEP_CTRL_DELAY_MASK 0x07 | ||
#define SPMI_FTSMPS_STEP_CTRL_DELAY_SHIFT 0 | ||
|
||
+#define SPMI_SMPS_VMPWM_VSET_UB_SHIFT 8 | ||
+#define SPMI_SMPS_VMPWM_VSET_UB_MASK 0xf00 | ||
+#define SPMI_SMPS_VMPWM_VSET_LB_MASK 0xff | ||
+ | ||
/* Clock rate in kHz of the FTSMPS regulator reference clock. */ | ||
#define SPMI_FTSMPS_CLOCK_RATE 19200 | ||
|
||
@@ -486,6 +491,10 @@ static struct spmi_voltage_range smps_ranges[] = { | ||
SPMI_VOLTAGE_RANGE(1, 1550000, 1575000, 3125000, 3125000, 25000), | ||
}; | ||
|
||
+static struct spmi_voltage_range smps_vmpwm_ranges[] = { | ||
+ SPMI_VOLTAGE_RANGE(0, 664000, 664000, 1104000, 1104000, 8000), | ||
+}; | ||
+ | ||
static struct spmi_voltage_range ftsmps_ranges[] = { | ||
SPMI_VOLTAGE_RANGE(0, 0, 350000, 1275000, 1275000, 5000), | ||
SPMI_VOLTAGE_RANGE(1, 0, 1280000, 2040000, 2040000, 10000), | ||
@@ -551,6 +560,7 @@ static DEFINE_SPMI_SET_POINTS(nldo2); | ||
static DEFINE_SPMI_SET_POINTS(nldo3); | ||
static DEFINE_SPMI_SET_POINTS(ln_ldo); | ||
static DEFINE_SPMI_SET_POINTS(smps); | ||
+static DEFINE_SPMI_SET_POINTS(smps_vmpwm); | ||
static DEFINE_SPMI_SET_POINTS(ftsmps); | ||
static DEFINE_SPMI_SET_POINTS(ftsmps2p5); | ||
static DEFINE_SPMI_SET_POINTS(ftsmps426); | ||
@@ -745,6 +755,24 @@ spmi_regulator_find_range(struct spmi_regulator *vreg) | ||
return NULL; | ||
} | ||
|
||
+static const struct spmi_voltage_range * | ||
+spmi_regulator_find_uV_range(struct spmi_regulator *vreg, int min, int max) | ||
+{ | ||
+ const struct spmi_voltage_range *range, *end; | ||
+ | ||
+ if (!vreg->set_points || !vreg->set_points->count) | ||
+ return 0; | ||
+ | ||
+ range = vreg->set_points->range; | ||
+ end = range + vreg->set_points->count; | ||
+ | ||
+ for (; range < end; range++) | ||
+ if ((range->min_uV <= min) && (range->max_uV >= max)) | ||
+ return range; | ||
+ | ||
+ return 0; | ||
+} | ||
+ | ||
static int spmi_regulator_select_voltage_same_range(struct spmi_regulator *vreg, | ||
int min_uV, int max_uV) | ||
{ | ||
@@ -966,6 +994,47 @@ static int spmi_regulator_ult_lo_smps_get_voltage(struct regulator_dev *rdev) | ||
return spmi_hw_selector_to_sw(vreg, voltage_sel, range); | ||
} | ||
|
||
+static int spmi_regulator_smps_vmpwm_set_vol_uV(struct regulator_dev *rdev, | ||
+ int min_uV, int max_uV, unsigned *selector) | ||
+{ | ||
+ struct spmi_regulator *vreg = rdev_get_drvdata(rdev); | ||
+ const struct spmi_voltage_range *range; | ||
+ int req_vol; | ||
+ u8 reg[2]; | ||
+ | ||
+ range = spmi_regulator_find_uV_range(vreg, min_uV, max_uV); | ||
+ if (!range) | ||
+ return -EINVAL; | ||
+ | ||
+ *selector = spmi_regulator_select_voltage(vreg, min_uV, max_uV); | ||
+ req_vol = range->set_point_min_uV + (range->step_uV * (*selector)); | ||
+ | ||
+ /* Convert uV to mV as the register supports mV */ | ||
+ req_vol = req_vol/1000; | ||
+ | ||
+ /* | ||
+ * Voltage set point bits<7:0>. 2-Byte Word (lower byte word) | ||
+ */ | ||
+ reg[0] = req_vol & SPMI_SMPS_VMPWM_VSET_LB_MASK; | ||
+ /* | ||
+ * Voltage set point bit <11:8>. 2-Byte Word (upper byte word) | ||
+ */ | ||
+ reg[1] = (req_vol & SPMI_SMPS_VMPWM_VSET_UB_MASK) | ||
+ >> SPMI_SMPS_VMPWM_VSET_UB_SHIFT; | ||
+ | ||
+ return spmi_vreg_write(vreg, SPMI_COMMON_REG_VOLTAGE_RANGE, reg, 2); | ||
+} | ||
+ | ||
+static int spmi_regulator_smps_vmpwm_get_vol_uV(struct regulator_dev *rdev) | ||
+{ | ||
+ struct spmi_regulator *vreg = rdev_get_drvdata(rdev); | ||
+ u8 reg[2]; | ||
+ | ||
+ spmi_vreg_read(vreg, SPMI_COMMON_REG_VOLTAGE_RANGE, reg, 2); | ||
+ | ||
+ return ((reg[1] << SPMI_SMPS_VMPWM_VSET_UB_SHIFT) | reg[0]) * 1000; | ||
+} | ||
+ | ||
static int spmi_regulator_common_list_voltage(struct regulator_dev *rdev, | ||
unsigned selector) | ||
{ | ||
@@ -1314,6 +1383,18 @@ static const struct regulator_ops spmi_smps_ops = { | ||
.set_pull_down = spmi_regulator_common_set_pull_down, | ||
}; | ||
|
||
+static const struct regulator_ops spmi_smps_vmpwm_ops = { | ||
+ .enable = regulator_enable_regmap, | ||
+ .disable = regulator_disable_regmap, | ||
+ .is_enabled = regulator_is_enabled_regmap, | ||
+ .set_voltage = spmi_regulator_smps_vmpwm_set_vol_uV, | ||
+ .get_voltage = spmi_regulator_smps_vmpwm_get_vol_uV, | ||
+ .map_voltage = spmi_regulator_common_map_voltage, | ||
+ .list_voltage = spmi_regulator_common_list_voltage, | ||
+ .set_mode = spmi_regulator_common_set_mode, | ||
+ .get_mode = spmi_regulator_common_get_mode, | ||
+}; | ||
+ | ||
static const struct regulator_ops spmi_ldo_ops = { | ||
.enable = regulator_enable_regmap, | ||
.disable = regulator_disable_regmap, | ||
@@ -1459,6 +1540,7 @@ static const struct regulator_ops spmi_hfs430_ops = { | ||
|
||
static const struct spmi_regulator_mapping supported_regulators[] = { | ||
/* type subtype dig_min dig_max ltype ops setpoints hpm_min */ | ||
+ SPMI_VREG(BUCK, VMPWM_CTL, 0, INF, SMPS, smps_vmpwm, smps_vmpwm, 0), | ||
SPMI_VREG(BUCK, GP_CTL, 0, INF, SMPS, smps, smps, 100000), | ||
SPMI_VREG(BUCK, HFS430, 0, INF, HFS430, hfs430, hfs430, 10000), | ||
SPMI_VREG(LDO, N300, 0, INF, LDO, ldo, nldo1, 10000), | ||
-- | ||
2.35.1 | ||
|
47 changes: 47 additions & 0 deletions
47
target/linux/ipq807x/patches-5.15/0127-ipq807x-sdhc-Fixed-SDR104-mode-card-detection.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
From 6ac91c1597dfd688b5e818708aa4f8c55a41eefb Mon Sep 17 00:00:00 2001 | ||
From: Vasudevan Murugesan <vmuruges@codeaurora.org> | ||
Date: Thu, 8 Jun 2017 19:13:48 +0530 | ||
Subject: [PATCH] ipq807x: sdhc: Fixed SDR104 mode card detection | ||
|
||
Change-Id: I353356284d28d09d79bf7d318c4ebcdbc15e5b02 | ||
Signed-off-by: Vasudevan Murugesan <vmuruges@codeaurora.org> | ||
Signed-off-by: Saravanan Jaganathan <sjaganat@codeaurora.org> | ||
(cherry picked from commit 080d3f390aa409ef2b5adf59a175b6bb2aa863fd) | ||
Signed-off-by: Praveenkumar I <ipkumar@codeaurora.org> | ||
|
||
Change-Id: Ie5edb7b3d972e06f3eb2525e10597b49e9bae14d | ||
--- | ||
drivers/regulator/qcom_spmi-regulator.c | 3 +++ | ||
1 file changed, 3 insertions(+) | ||
|
||
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c | ||
index 6176a09df345..1cdf2117a2fe 100644 | ||
--- a/drivers/regulator/qcom_spmi-regulator.c | ||
+++ b/drivers/regulator/qcom_spmi-regulator.c | ||
@@ -165,6 +165,7 @@ enum spmi_regulator_subtype { | ||
SPMI_REGULATOR_SUBTYPE_ULT_HF_CTL4 = 0x10, | ||
SPMI_REGULATOR_SUBTYPE_HFS430 = 0x0a, | ||
SPMI_REGULATOR_SUBTYPE_VMPWM_CTL = 0x0a, | ||
+ SPMI_REGULATOR_SUBTYPE_HT_P150 = 0x35, | ||
}; | ||
|
||
enum spmi_common_regulator_registers { | ||
@@ -493,6 +494,7 @@ static struct spmi_voltage_range smps_ranges[] = { | ||
|
||
static struct spmi_voltage_range smps_vmpwm_ranges[] = { | ||
SPMI_VOLTAGE_RANGE(0, 664000, 664000, 1104000, 1104000, 8000), | ||
+ SPMI_VOLTAGE_RANGE(1, 1104000, 1104000, 3300000, 3300000, 8000), | ||
}; | ||
|
||
static struct spmi_voltage_range ftsmps_ranges[] = { | ||
@@ -1540,6 +1542,7 @@ static const struct regulator_ops spmi_hfs430_ops = { | ||
|
||
static const struct spmi_regulator_mapping supported_regulators[] = { | ||
/* type subtype dig_min dig_max ltype ops setpoints hpm_min */ | ||
+ SPMI_VREG(LDO, HT_P150, 0, INF, LDO, smps_vmpwm, smps_vmpwm, 0), | ||
SPMI_VREG(BUCK, VMPWM_CTL, 0, INF, SMPS, smps_vmpwm, smps_vmpwm, 0), | ||
SPMI_VREG(BUCK, GP_CTL, 0, INF, SMPS, smps, smps, 100000), | ||
SPMI_VREG(BUCK, HFS430, 0, INF, HFS430, hfs430, hfs430, 10000), | ||
-- | ||
2.35.1 | ||
|
Oops, something went wrong.