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

Commit 8a87e196 authored by Archana Sathyakumar's avatar Archana Sathyakumar
Browse files

msm-core: Use cpu device to get the voltage plan



Clock driver will populate the voltages for the cpu device instead of
the regulator device.

Use the cpu device to get the voltage plan instead of the regulator
device.

Change-Id: I25a5f8bfff6eb28eb815cd7667e53fa0389ab1b5
Signed-off-by: default avatarArchana Sathyakumar <asathyak@codeaurora.org>
parent b6acb90f
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -31,8 +31,6 @@ Optional properties:
[Second level nodes]
Required properties to define per core characteristics:
- qcom,cpu-name: CPU phandle to read the mpidr value
- qcom,apc-rail: CPU rail phandle to get frequency and voltage
                 information.

Optional properties to define per core characteristics:
- qcom,sensor:  Sensor phandle to map a particular sensor to the core.
@@ -52,25 +50,21 @@ qcom,msm-core {
		qcom,cpu0-chars {
			qcom,sensor = <&sensor_information0>;
			qcom,cpu-name = <&CPU0>;
			qcom,apc-rail = <&apc0_vreg_corner>;
		};

		qcom,cpu1-chars {
			qcom,sensor = <&sensor_information1>;
			qcom,cpu-name = <&CPU1>;
			qcom,apc-rail = <&apc0_vreg_corner>;
		};

		qcom,cpu2-chars {
			qcom,sensor = <&sensor_information2>;
			qcom,cpu-name = <&CPU2>;
			qcom,apc-rail = <&apc0_vreg_corner>;
		};

		qcom,cpu3-chars {
			qcom,sensor = <&sensor_information3>;
			qcom,cpu-name = <&CPU3>;
			qcom,apc-rail = <&apc0_vreg_corner>;
		};
	};
};
+0 −8
Original line number Diff line number Diff line
@@ -2965,49 +2965,41 @@
			qcom,cpu0-chars {
				qcom,sensor = <&sensor_information7>;
				qcom,cpu-name = <&CPU0>;
				qcom,apc-rail = <&apc0_vreg_corner>;
			};

			qcom,cpu1-chars {
				qcom,sensor = <&sensor_information8>;
				qcom,cpu-name = <&CPU1>;
				qcom,apc-rail = <&apc0_vreg_corner>;
			};

			qcom,cpu2-chars {
				qcom,sensor = <&sensor_information9>;
				qcom,cpu-name = <&CPU2>;
				qcom,apc-rail = <&apc0_vreg_corner>;
			};

			qcom,cpu3-chars {
				qcom,sensor = <&sensor_information10>;
				qcom,cpu-name = <&CPU3>;
				qcom,apc-rail = <&apc0_vreg_corner>;
			};

			qcom,cpu4-chars {
				qcom,sensor = <&sensor_information13>;
				qcom,cpu-name = <&CPU4>;
				qcom,apc-rail = <&apc1_vreg_corner>;
			};

			qcom,cpu5-chars {
				qcom,sensor = <&sensor_information14>;
				qcom,cpu-name = <&CPU5>;
				qcom,apc-rail = <&apc1_vreg_corner>;
			};

			qcom,cpu6-chars {
				qcom,sensor = <&sensor_information15>;
				qcom,cpu-name = <&CPU6>;
				qcom,apc-rail = <&apc1_vreg_corner>;
			};

			qcom,cpu7-chars {
				qcom,sensor = <&sensor_information6>;
				qcom,cpu-name = <&CPU7>;
				qcom,apc-rail = <&apc1_vreg_corner>;
			};
		};
	};
+12 −15
Original line number Diff line number Diff line
@@ -82,7 +82,6 @@ struct cpu_activity_info {
	int sensor_id;
	struct sensor_threshold hi_threshold;
	struct sensor_threshold low_threshold;
	struct device_node *apc_node;
	struct cpu_static_info *sp;
};

@@ -553,8 +552,7 @@ static int msm_get_voltage_levels(struct device *dev, int cpu,
	int i;
	int corner;
	struct opp *opp;
	struct platform_device *pdev =
		of_find_device_by_node(activity[cpu].apc_node);
	struct device *cpu_dev = get_cpu_device(cpu);
	/*
	 * Convert cpr corner voltage to average voltage of both
	 * a53 and a57 votlage value
@@ -562,6 +560,9 @@ static int msm_get_voltage_levels(struct device *dev, int cpu,
	int average_voltage[NUM_OF_CORNERS] = {0, 746, 841, 843, 940, 953, 976,
			1024, 1090, 1100};

	if (!cpu_dev)
		return -ENODEV;

	voltage = devm_kzalloc(dev,
			sizeof(*voltage) * sp->num_of_freqs, GFP_KERNEL);

@@ -570,11 +571,17 @@ static int msm_get_voltage_levels(struct device *dev, int cpu,

	rcu_read_lock();
	for (i = 0; i < sp->num_of_freqs; i++) {
		opp = dev_pm_opp_find_freq_exact(&pdev->dev,
		opp = dev_pm_opp_find_freq_exact(cpu_dev,
				sp->table[i].frequency * 1000, true);
		corner = dev_pm_opp_get_voltage(opp);
		if (corner > 0 && corner < ARRAY_SIZE(average_voltage))

		if (corner > 400000)
			voltage[i] = corner / 1000;
		else if (corner > 0 && corner < ARRAY_SIZE(average_voltage))
			voltage[i] = average_voltage[corner];
		else
			voltage[i]
			     = average_voltage[ARRAY_SIZE(average_voltage) - 1];
	}
	rcu_read_unlock();

@@ -751,7 +758,6 @@ static int msm_core_params_init(struct platform_device *pdev)
	struct device_node *node = NULL;
	struct device_node *child_node = NULL;
	int mpidr;
	char *key = NULL;

	node = of_find_node_by_name(pdev->dev.of_node,
				"qcom,core-mapping");
@@ -774,15 +780,6 @@ static int msm_core_params_init(struct platform_device *pdev)

		activity[cpu].mpidr = mpidr;

		key = "qcom,apc-rail";

		activity[cpu].apc_node = of_parse_phandle(child_node, key, 0);
		if (!activity[cpu].apc_node) {
			pr_err("%s: Couldn't find the opp apcrail\n",
					__func__);
			return -ENODEV;
		}

		ret = msm_core_tsens_init(child_node, cpu);
		if (ret)
			return ret;