Skip to content

Commit

Permalink
cpufreq: qcom-nvmem: Add MSM8916
Browse files Browse the repository at this point in the history
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
  • Loading branch information
stephan-gh committed Sep 29, 2023
1 parent 0388e61 commit d3d5e09
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions drivers/cpufreq/qcom-cpufreq-nvmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,31 @@ static int qcom_cpufreq_simple_get_version(struct device *cpu_dev,
return 0;
}

static int qcom_cpufreq_msm8916_get_version(struct device *cpu_dev,
struct device_node *np,
char **pvs_name,
struct qcom_cpufreq_drv *drv)
{
u8 *pvs, *speedbin;

*pvs_name = NULL;
pvs = qcom_cpufreq_read_nvmem_cell(np, "pvs", NULL);
if (IS_ERR(pvs))
return PTR_ERR(pvs);

speedbin = qcom_cpufreq_read_nvmem_cell(np, *pvs ? "bin2" : "bin1", NULL);
if (IS_ERR(speedbin)) {
kfree(pvs);
return PTR_ERR(speedbin);
}

dev_dbg(cpu_dev, "speedbin: %d (pvs: %d)\n", *speedbin, *pvs);
drv->versions = 1 << *speedbin;
kfree(speedbin);
kfree(pvs);
return 0;
}

static void get_krait_bin_format_a(struct device *cpu_dev,
int *speed, int *pvs, int *pvs_ver,
u8 *buf)
Expand Down Expand Up @@ -251,6 +276,13 @@ static const struct qcom_cpufreq_match_data match_data_msm8909 = {
.genpd_names = msm8909_genpd_names,
};

static const char *msm8916_genpd_names[] = { "mx", "apc", "cx", NULL };

static const struct qcom_cpufreq_match_data match_data_msm8916 = {
.get_version = qcom_cpufreq_msm8916_get_version,
.genpd_names = msm8916_genpd_names,
};

static const char *qcs404_genpd_names[] = { "cpr", NULL };

static const struct qcom_cpufreq_match_data match_data_qcs404 = {
Expand Down Expand Up @@ -403,6 +435,8 @@ static struct platform_driver qcom_cpufreq_driver = {

static const struct of_device_id qcom_cpufreq_match_list[] __initconst = {
{ .compatible = "qcom,msm8909", .data = &match_data_msm8909 },
{ .compatible = "qcom,msm8916", .data = &match_data_msm8916 },
{ .compatible = "qcom,apq8016", .data = &match_data_msm8916 },
{ .compatible = "qcom,apq8096", .data = &match_data_kryo },
{ .compatible = "qcom,msm8996", .data = &match_data_kryo },
{ .compatible = "qcom,qcs404", .data = &match_data_qcs404 },
Expand Down

0 comments on commit d3d5e09

Please sign in to comment.