Skip to content

Commit f0d64f4

Browse files
stephan-ghvireshk
authored andcommitted
cpufreq: qcom-nvmem: Add MSM8909
When the MSM8909 SoC is used together with the PM8909 PMIC the primary power supply for the CPU (VDD_APC) is shared with other components to the SoC, namely the VDD_CX power domain typically supplied by the PM8909 S1 regulator. This means that all votes for necessary performance states go via the RPM firmware which collects the requirements from all the processors in the SoC. The RPM firmware then chooses the actual voltage based on the performance states ("corners"), depending on calibration values in the NVMEM and other factors. The MSM8909 SoC is also sometimes used with the PM8916 or PM660 PMIC. In that case there is a dedicated regulator connected to VDD_APC and Linux is responsible to do adaptive voltage scaling using CPR (similar to the existing code for QCS404). This difference can be described in the device tree, by either assigning the CPU a power domain from RPMPD or from the CPR driver. Describe this using "perf" as generic power domain name, which is also used already for SCMI based platforms. Also add a simple function that reads the speedbin from a NVMEM cell and sets it as-is for opp-supported-hw. The actual bit position can be described in the device tree without additional driver changes. Signed-off-by: Stephan Gerhold <[email protected]> Acked-by: Konrad Dybcio <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> [ Viresh: Fixed rebase conflict. ] Signed-off-by: Viresh Kumar <[email protected]>
1 parent 2a5d46c commit f0d64f4

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/cpufreq/qcom-cpufreq-nvmem.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@ struct qcom_cpufreq_drv {
5252

5353
static struct platform_device *cpufreq_dt_pdev, *cpufreq_pdev;
5454

55+
static int qcom_cpufreq_simple_get_version(struct device *cpu_dev,
56+
struct nvmem_cell *speedbin_nvmem,
57+
char **pvs_name,
58+
struct qcom_cpufreq_drv *drv)
59+
{
60+
u8 *speedbin;
61+
62+
*pvs_name = NULL;
63+
speedbin = nvmem_cell_read(speedbin_nvmem, NULL);
64+
if (IS_ERR(speedbin))
65+
return PTR_ERR(speedbin);
66+
67+
dev_dbg(cpu_dev, "speedbin: %d\n", *speedbin);
68+
drv->versions = 1 << *speedbin;
69+
kfree(speedbin);
70+
return 0;
71+
}
72+
5573
static void get_krait_bin_format_a(struct device *cpu_dev,
5674
int *speed, int *pvs, int *pvs_ver,
5775
u8 *buf)
@@ -207,6 +225,8 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev,
207225
return ret;
208226
}
209227

228+
static const char *generic_genpd_names[] = { "perf", NULL };
229+
210230
static const struct qcom_cpufreq_match_data match_data_kryo = {
211231
.get_version = qcom_cpufreq_kryo_name_version,
212232
};
@@ -215,6 +235,11 @@ static const struct qcom_cpufreq_match_data match_data_krait = {
215235
.get_version = qcom_cpufreq_krait_name_version,
216236
};
217237

238+
static const struct qcom_cpufreq_match_data match_data_msm8909 = {
239+
.get_version = qcom_cpufreq_simple_get_version,
240+
.genpd_names = generic_genpd_names,
241+
};
242+
218243
static const char *qcs404_genpd_names[] = { "cpr", NULL };
219244

220245
static const struct qcom_cpufreq_match_data match_data_qcs404 = {
@@ -344,6 +369,7 @@ static struct platform_driver qcom_cpufreq_driver = {
344369

345370
static const struct of_device_id qcom_cpufreq_match_list[] __initconst = {
346371
{ .compatible = "qcom,apq8096", .data = &match_data_kryo },
372+
{ .compatible = "qcom,msm8909", .data = &match_data_msm8909 },
347373
{ .compatible = "qcom,msm8996", .data = &match_data_kryo },
348374
{ .compatible = "qcom,qcs404", .data = &match_data_qcs404 },
349375
{ .compatible = "qcom,ipq8064", .data = &match_data_krait },

0 commit comments

Comments
 (0)