Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5d7f4ea authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cpufreq: qcom: Add a property for max lut entries"

parents 20f42600 7b6ced59
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ enum {
};

static unsigned int lut_row_size = LUT_ROW_SIZE;
static unsigned int lut_max_entries = LUT_MAX_ENTRIES;
static bool accumulative_counter;

struct cpufreq_qcom {
@@ -110,7 +111,7 @@ static unsigned long limits_mitigation_notify(struct cpufreq_qcom *c)
	max_vc = readl_relaxed(c->reg_bases[REG_LLM_DCVS_VC_VOTE]) &
						GENMASK(13, 8);

	for (i = 0; i < LUT_MAX_ENTRIES; i++) {
	for (i = 0; i < lut_max_entries; i++) {
		if (c->table[i].driver_data != max_vc)
			continue;
		else {
@@ -241,7 +242,7 @@ static unsigned int qcom_cpufreq_hw_get(unsigned int cpu)
	c = policy->driver_data;

	index = readl_relaxed(c->reg_bases[REG_PERF_STATE]);
	index = min(index, LUT_MAX_ENTRIES - 1);
	index = min(index, lut_max_entries - 1);

	return policy->freq_table[index].frequency;
}
@@ -377,7 +378,7 @@ static int qcom_cpufreq_hw_read_lut(struct platform_device *pdev,
	u32 vc;
	unsigned long cpu;

	c->table = devm_kcalloc(dev, LUT_MAX_ENTRIES + 1,
	c->table = devm_kcalloc(dev, lut_max_entries + 1,
				sizeof(*c->table), GFP_KERNEL);
	if (!c->table)
		return -ENOMEM;
@@ -385,7 +386,7 @@ static int qcom_cpufreq_hw_read_lut(struct platform_device *pdev,
	base_freq = c->reg_bases[REG_FREQ_LUT_TABLE];
	base_volt = c->reg_bases[REG_VOLT_LUT_TABLE];

	for (i = 0; i < LUT_MAX_ENTRIES; i++) {
	for (i = 0; i < lut_max_entries; i++) {
		data = readl_relaxed(base_freq + i * lut_row_size);
		src = (data & GENMASK(31, 30)) >> 30;
		lval = data & GENMASK(7, 0);
@@ -564,6 +565,9 @@ static int qcom_resources_init(struct platform_device *pdev)
	of_property_read_u32(pdev->dev.of_node, "qcom,lut-row-size",
			      &lut_row_size);

	of_property_read_u32(pdev->dev.of_node, "qcom,lut-max-entries",
			      &lut_max_entries);

	for_each_possible_cpu(cpu) {
		cpu_np = of_cpu_device_node_get(cpu);
		if (!cpu_np) {