All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] CPUFREQ clean-ups for Tegra186 and Tegra194
@ 2020-12-02  9:14 Jon Hunter
  2020-12-02  9:14 ` [PATCH 1/4] cpufreq: tegra186: Fix sparse 'incorrect type in assignment' warning Jon Hunter
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jon Hunter @ 2020-12-02  9:14 UTC (permalink / raw)
  To: Rafael J . Wysocki, Viresh Kumar, Thierry Reding
  Cc: linux-pm, linux-tegra, Sumit Gupta, Jon Hunter

This series includes some clean-ups for the Tegra186 and Tegra194
CPUFREQ drivers.

Jon Hunter (4):
  cpufreq: tegra186: Fix sparse 'incorrect type in assignment' warning
  cpufreq: tegra186: Simplify cluster information lookup
  cpufreq: tegra194: Remove unnecessary frequency calculation
  cpufreq: tegra194: Rename tegra194_get_speed_common function

 drivers/cpufreq/tegra186-cpufreq.c | 122 +++++++++++++----------------
 drivers/cpufreq/tegra194-cpufreq.c |  12 +--
 2 files changed, 57 insertions(+), 77 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] cpufreq: tegra186: Fix sparse 'incorrect type in assignment' warning
  2020-12-02  9:14 [PATCH 0/4] CPUFREQ clean-ups for Tegra186 and Tegra194 Jon Hunter
@ 2020-12-02  9:14 ` Jon Hunter
  2020-12-02  9:14 ` [PATCH 2/4] cpufreq: tegra186: Simplify cluster information lookup Jon Hunter
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jon Hunter @ 2020-12-02  9:14 UTC (permalink / raw)
  To: Rafael J . Wysocki, Viresh Kumar, Thierry Reding
  Cc: linux-pm, linux-tegra, Sumit Gupta, Jon Hunter

Sparse warns that the incorrect type is being assigned to the CPUFREQ
driver_data variable in the Tegra186 CPUFREQ driver. The Tegra186
CPUFREQ driver is assigned a type of 'void __iomem *' to a pointer of
type 'void *' ...

 drivers/cpufreq/tegra186-cpufreq.c:72:37: sparse: sparse: incorrect
 	type in assignment (different address spaces) @@
	expected void *driver_data @@     got void [noderef] __iomem * @@
 ...

 drivers/cpufreq/tegra186-cpufreq.c:87:40: sparse: sparse: incorrect
 	type in initializer (different address spaces) @@
	expected void [noderef] __iomem *edvd_reg @@     got void *driver_data @@

The Tegra186 CPUFREQ driver is using the policy->driver_data variable to
store and iomem pointer to a Tegra186 CPU register that is used to set
the clock speed for the CPU. This is not necessary because the register
base address is already stored in the driver data and the offset of the
register for each CPU is static. Therefore, fix this by adding a new
structure with the register offsets for each CPU and store this in the
main driver data structure along with the register base address. Please
note that a new structure has been added for storing the register
offsets rather than a simple array, because this will permit further
clean-ups and simplification of the driver.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/cpufreq/tegra186-cpufreq.c | 61 ++++++++++++++++++++++--------
 1 file changed, 46 insertions(+), 15 deletions(-)

diff --git a/drivers/cpufreq/tegra186-cpufreq.c b/drivers/cpufreq/tegra186-cpufreq.c
index 7eb2c56c65de..98b5f32eb0be 100644
--- a/drivers/cpufreq/tegra186-cpufreq.c
+++ b/drivers/cpufreq/tegra186-cpufreq.c
@@ -12,13 +12,45 @@
 #include <soc/tegra/bpmp.h>
 #include <soc/tegra/bpmp-abi.h>
 
-#define EDVD_CORE_VOLT_FREQ(core)		(0x20 + (core) * 0x4)
-#define EDVD_CORE_VOLT_FREQ_F_SHIFT		0
-#define EDVD_CORE_VOLT_FREQ_F_MASK		0xffff
-#define EDVD_CORE_VOLT_FREQ_V_SHIFT		16
+#define EDVD_OFFSET_A57(core)		((SZ_64K * 6) + (0x20 + (core) * 0x4))
+#define EDVD_OFFSET_DENVER(core)	((SZ_64K * 7) + (0x20 + (core) * 0x4))
+#define EDVD_CORE_VOLT_FREQ_F_SHIFT	0
+#define EDVD_CORE_VOLT_FREQ_F_MASK	0xffff
+#define EDVD_CORE_VOLT_FREQ_V_SHIFT	16
+
+struct tegra186_cpufreq_cpu {
+	unsigned int edvd_offset;
+};
+
+static const struct tegra186_cpufreq_cpu tegra186_cpus[] = {
+	/* CPU0 - A57 Cluster */
+	{
+		.edvd_offset = EDVD_OFFSET_A57(0)
+	},
+	/* CPU1 - Denver Cluster */
+	{
+		.edvd_offset = EDVD_OFFSET_DENVER(0)
+	},
+	/* CPU2 - Denver Cluster */
+	{
+		.edvd_offset = EDVD_OFFSET_DENVER(1)
+	},
+	/* CPU3 - A57 Cluster */
+	{
+		.edvd_offset = EDVD_OFFSET_A57(1)
+	},
+	/* CPU4 - A57 Cluster */
+	{
+		.edvd_offset = EDVD_OFFSET_A57(2)
+	},
+	/* CPU5 - A57 Cluster */
+	{
+		.edvd_offset = EDVD_OFFSET_A57(3)
+	},
+
+};
 
 struct tegra186_cpufreq_cluster_info {
-	unsigned long offset;
 	int cpus[4];
 	unsigned int bpmp_cluster_id;
 };
@@ -27,13 +59,11 @@ struct tegra186_cpufreq_cluster_info {
 static const struct tegra186_cpufreq_cluster_info tegra186_clusters[] = {
 	/* Denver cluster */
 	{
-		.offset = SZ_64K * 7,
 		.cpus = { 1, 2, NO_CPU, NO_CPU },
 		.bpmp_cluster_id = 0,
 	},
 	/* A57 cluster */
 	{
-		.offset = SZ_64K * 6,
 		.cpus = { 0, 3, 4, 5 },
 		.bpmp_cluster_id = 1,
 	},
@@ -51,6 +81,7 @@ struct tegra186_cpufreq_data {
 
 	size_t num_clusters;
 	struct tegra186_cpufreq_cluster *clusters;
+	const struct tegra186_cpufreq_cpu *cpus;
 };
 
 static int tegra186_cpufreq_init(struct cpufreq_policy *policy)
@@ -71,13 +102,12 @@ static int tegra186_cpufreq_init(struct cpufreq_policy *policy)
 		if (core == ARRAY_SIZE(info->cpus))
 			continue;
 
-		policy->driver_data =
-			data->regs + info->offset + EDVD_CORE_VOLT_FREQ(core);
 		policy->freq_table = cluster->table;
 		break;
 	}
 
 	policy->cpuinfo.transition_latency = 300 * 1000;
+	policy->driver_data = NULL;
 
 	return 0;
 }
@@ -85,11 +115,12 @@ static int tegra186_cpufreq_init(struct cpufreq_policy *policy)
 static int tegra186_cpufreq_set_target(struct cpufreq_policy *policy,
 				       unsigned int index)
 {
+	struct tegra186_cpufreq_data *data = cpufreq_get_driver_data();
 	struct cpufreq_frequency_table *tbl = policy->freq_table + index;
-	void __iomem *edvd_reg = policy->driver_data;
+	unsigned int edvd_offset = data->cpus[policy->cpu].edvd_offset;
 	u32 edvd_val = tbl->driver_data;
 
-	writel(edvd_val, edvd_reg);
+	writel(edvd_val, data->regs + edvd_offset);
 
 	return 0;
 }
@@ -98,16 +129,15 @@ static unsigned int tegra186_cpufreq_get(unsigned int cpu)
 {
 	struct tegra186_cpufreq_data *data = cpufreq_get_driver_data();
 	struct cpufreq_policy *policy;
-	void __iomem *edvd_reg;
-	unsigned int i, freq = 0;
+	unsigned int i, edvd_offset, freq = 0;
 	u32 ndiv;
 
 	policy = cpufreq_cpu_get(cpu);
 	if (!policy)
 		return 0;
 
-	edvd_reg = policy->driver_data;
-	ndiv = readl(edvd_reg) & EDVD_CORE_VOLT_FREQ_F_MASK;
+	edvd_offset = data->cpus[policy->cpu].edvd_offset;
+	ndiv = readl(data->regs + edvd_offset) & EDVD_CORE_VOLT_FREQ_F_MASK;
 
 	for (i = 0; i < data->num_clusters; i++) {
 		struct tegra186_cpufreq_cluster *cluster = &data->clusters[i];
@@ -240,6 +270,7 @@ static int tegra186_cpufreq_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	data->num_clusters = ARRAY_SIZE(tegra186_clusters);
+	data->cpus = tegra186_cpus;
 
 	bpmp = tegra_bpmp_get(&pdev->dev);
 	if (IS_ERR(bpmp))
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] cpufreq: tegra186: Simplify cluster information lookup
  2020-12-02  9:14 [PATCH 0/4] CPUFREQ clean-ups for Tegra186 and Tegra194 Jon Hunter
  2020-12-02  9:14 ` [PATCH 1/4] cpufreq: tegra186: Fix sparse 'incorrect type in assignment' warning Jon Hunter
@ 2020-12-02  9:14 ` Jon Hunter
  2020-12-02  9:14 ` [PATCH 3/4] cpufreq: tegra194: Remove unnecessary frequency calculation Jon Hunter
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jon Hunter @ 2020-12-02  9:14 UTC (permalink / raw)
  To: Rafael J . Wysocki, Viresh Kumar, Thierry Reding
  Cc: linux-pm, linux-tegra, Sumit Gupta, Jon Hunter

The CPUFREQ driver framework references each individual CPUs when
getting and setting the speed. Tegra186 has 3 clusters of A57 CPUs and
1 cluster of Denver CPUs. Hence, the Tegra186 CPUFREQ driver need to
know which cluster a given CPU belongs to. The logic in the Tegra186
driver can be greatly simplified by storing the cluster ID associated
with each CPU in the tegra186_cpufreq_cpu structure. This allow us to
completely remove the Tegra cluster info structure from the driver and
simplifiy the code.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/cpufreq/tegra186-cpufreq.c | 85 +++++++-----------------------
 1 file changed, 20 insertions(+), 65 deletions(-)

diff --git a/drivers/cpufreq/tegra186-cpufreq.c b/drivers/cpufreq/tegra186-cpufreq.c
index 98b5f32eb0be..e566ea298b59 100644
--- a/drivers/cpufreq/tegra186-cpufreq.c
+++ b/drivers/cpufreq/tegra186-cpufreq.c
@@ -12,6 +12,7 @@
 #include <soc/tegra/bpmp.h>
 #include <soc/tegra/bpmp-abi.h>
 
+#define TEGRA186_NUM_CLUSTERS		2
 #define EDVD_OFFSET_A57(core)		((SZ_64K * 6) + (0x20 + (core) * 0x4))
 #define EDVD_OFFSET_DENVER(core)	((SZ_64K * 7) + (0x20 + (core) * 0x4))
 #define EDVD_CORE_VOLT_FREQ_F_SHIFT	0
@@ -19,58 +20,44 @@
 #define EDVD_CORE_VOLT_FREQ_V_SHIFT	16
 
 struct tegra186_cpufreq_cpu {
+	unsigned int bpmp_cluster_id;
 	unsigned int edvd_offset;
 };
 
 static const struct tegra186_cpufreq_cpu tegra186_cpus[] = {
 	/* CPU0 - A57 Cluster */
 	{
+		.bpmp_cluster_id = 1,
 		.edvd_offset = EDVD_OFFSET_A57(0)
 	},
 	/* CPU1 - Denver Cluster */
 	{
+		.bpmp_cluster_id = 0,
 		.edvd_offset = EDVD_OFFSET_DENVER(0)
 	},
 	/* CPU2 - Denver Cluster */
 	{
+		.bpmp_cluster_id = 0,
 		.edvd_offset = EDVD_OFFSET_DENVER(1)
 	},
 	/* CPU3 - A57 Cluster */
 	{
+		.bpmp_cluster_id = 1,
 		.edvd_offset = EDVD_OFFSET_A57(1)
 	},
 	/* CPU4 - A57 Cluster */
 	{
+		.bpmp_cluster_id = 1,
 		.edvd_offset = EDVD_OFFSET_A57(2)
 	},
 	/* CPU5 - A57 Cluster */
 	{
-		.edvd_offset = EDVD_OFFSET_A57(3)
-	},
-
-};
-
-struct tegra186_cpufreq_cluster_info {
-	int cpus[4];
-	unsigned int bpmp_cluster_id;
-};
-
-#define NO_CPU -1
-static const struct tegra186_cpufreq_cluster_info tegra186_clusters[] = {
-	/* Denver cluster */
-	{
-		.cpus = { 1, 2, NO_CPU, NO_CPU },
-		.bpmp_cluster_id = 0,
-	},
-	/* A57 cluster */
-	{
-		.cpus = { 0, 3, 4, 5 },
 		.bpmp_cluster_id = 1,
+		.edvd_offset = EDVD_OFFSET_A57(3)
 	},
 };
 
 struct tegra186_cpufreq_cluster {
-	const struct tegra186_cpufreq_cluster_info *info;
 	struct cpufreq_frequency_table *table;
 	u32 ref_clk_khz;
 	u32 div;
@@ -78,8 +65,6 @@ struct tegra186_cpufreq_cluster {
 
 struct tegra186_cpufreq_data {
 	void __iomem *regs;
-
-	size_t num_clusters;
 	struct tegra186_cpufreq_cluster *clusters;
 	const struct tegra186_cpufreq_cpu *cpus;
 };
@@ -87,25 +72,9 @@ struct tegra186_cpufreq_data {
 static int tegra186_cpufreq_init(struct cpufreq_policy *policy)
 {
 	struct tegra186_cpufreq_data *data = cpufreq_get_driver_data();
-	unsigned int i;
-
-	for (i = 0; i < data->num_clusters; i++) {
-		struct tegra186_cpufreq_cluster *cluster = &data->clusters[i];
-		const struct tegra186_cpufreq_cluster_info *info =
-			cluster->info;
-		int core;
-
-		for (core = 0; core < ARRAY_SIZE(info->cpus); core++) {
-			if (info->cpus[core] == policy->cpu)
-				break;
-		}
-		if (core == ARRAY_SIZE(info->cpus))
-			continue;
-
-		policy->freq_table = cluster->table;
-		break;
-	}
+	unsigned int cluster = data->cpus[policy->cpu].bpmp_cluster_id;
 
+	policy->freq_table = data->clusters[cluster].table;
 	policy->cpuinfo.transition_latency = 300 * 1000;
 	policy->driver_data = NULL;
 
@@ -128,8 +97,9 @@ static int tegra186_cpufreq_set_target(struct cpufreq_policy *policy,
 static unsigned int tegra186_cpufreq_get(unsigned int cpu)
 {
 	struct tegra186_cpufreq_data *data = cpufreq_get_driver_data();
+	struct tegra186_cpufreq_cluster *cluster;
 	struct cpufreq_policy *policy;
-	unsigned int i, edvd_offset, freq = 0;
+	unsigned int edvd_offset, cluster_id;
 	u32 ndiv;
 
 	policy = cpufreq_cpu_get(cpu);
@@ -138,24 +108,11 @@ static unsigned int tegra186_cpufreq_get(unsigned int cpu)
 
 	edvd_offset = data->cpus[policy->cpu].edvd_offset;
 	ndiv = readl(data->regs + edvd_offset) & EDVD_CORE_VOLT_FREQ_F_MASK;
-
-	for (i = 0; i < data->num_clusters; i++) {
-		struct tegra186_cpufreq_cluster *cluster = &data->clusters[i];
-		int core;
-
-		for (core = 0; core < ARRAY_SIZE(cluster->info->cpus); core++) {
-			if (cluster->info->cpus[core] != policy->cpu)
-				continue;
-
-			freq = (cluster->ref_clk_khz * ndiv) / cluster->div;
-			goto out;
-		}
-	}
-
-out:
+	cluster_id = data->cpus[policy->cpu].bpmp_cluster_id;
+	cluster = &data->clusters[cluster_id];
 	cpufreq_cpu_put(policy);
 
-	return freq;
+	return (cluster->ref_clk_khz * ndiv) / cluster->div;
 }
 
 static struct cpufreq_driver tegra186_cpufreq_driver = {
@@ -171,7 +128,7 @@ static struct cpufreq_driver tegra186_cpufreq_driver = {
 
 static struct cpufreq_frequency_table *init_vhint_table(
 	struct platform_device *pdev, struct tegra_bpmp *bpmp,
-	struct tegra186_cpufreq_cluster *cluster)
+	struct tegra186_cpufreq_cluster *cluster, unsigned int cluster_id)
 {
 	struct cpufreq_frequency_table *table;
 	struct mrq_cpu_vhint_request req;
@@ -190,7 +147,7 @@ static struct cpufreq_frequency_table *init_vhint_table(
 
 	memset(&req, 0, sizeof(req));
 	req.addr = phys;
-	req.cluster_id = cluster->info->bpmp_cluster_id;
+	req.cluster_id = cluster_id;
 
 	memset(&msg, 0, sizeof(msg));
 	msg.mrq = MRQ_CPU_VHINT;
@@ -264,12 +221,11 @@ static int tegra186_cpufreq_probe(struct platform_device *pdev)
 	if (!data)
 		return -ENOMEM;
 
-	data->clusters = devm_kcalloc(&pdev->dev, ARRAY_SIZE(tegra186_clusters),
+	data->clusters = devm_kcalloc(&pdev->dev, TEGRA186_NUM_CLUSTERS,
 				      sizeof(*data->clusters), GFP_KERNEL);
 	if (!data->clusters)
 		return -ENOMEM;
 
-	data->num_clusters = ARRAY_SIZE(tegra186_clusters);
 	data->cpus = tegra186_cpus;
 
 	bpmp = tegra_bpmp_get(&pdev->dev);
@@ -282,11 +238,10 @@ static int tegra186_cpufreq_probe(struct platform_device *pdev)
 		goto put_bpmp;
 	}
 
-	for (i = 0; i < data->num_clusters; i++) {
+	for (i = 0; i < TEGRA186_NUM_CLUSTERS; i++) {
 		struct tegra186_cpufreq_cluster *cluster = &data->clusters[i];
 
-		cluster->info = &tegra186_clusters[i];
-		cluster->table = init_vhint_table(pdev, bpmp, cluster);
+		cluster->table = init_vhint_table(pdev, bpmp, cluster, i);
 		if (IS_ERR(cluster->table)) {
 			err = PTR_ERR(cluster->table);
 			goto put_bpmp;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] cpufreq: tegra194: Remove unnecessary frequency calculation
  2020-12-02  9:14 [PATCH 0/4] CPUFREQ clean-ups for Tegra186 and Tegra194 Jon Hunter
  2020-12-02  9:14 ` [PATCH 1/4] cpufreq: tegra186: Fix sparse 'incorrect type in assignment' warning Jon Hunter
  2020-12-02  9:14 ` [PATCH 2/4] cpufreq: tegra186: Simplify cluster information lookup Jon Hunter
@ 2020-12-02  9:14 ` Jon Hunter
  2020-12-02  9:14 ` [PATCH 4/4] cpufreq: tegra194: Rename tegra194_get_speed_common function Jon Hunter
  2020-12-07  7:33 ` [PATCH 0/4] CPUFREQ clean-ups for Tegra186 and Tegra194 Viresh Kumar
  4 siblings, 0 replies; 6+ messages in thread
From: Jon Hunter @ 2020-12-02  9:14 UTC (permalink / raw)
  To: Rafael J . Wysocki, Viresh Kumar, Thierry Reding
  Cc: linux-pm, linux-tegra, Sumit Gupta, Jon Hunter

The Tegra194 CPUFREQ driver sets the CPUFREQ_NEED_INITIAL_FREQ_CHECK
flag which means that the CPUFREQ framework will call the 'get' callback
on boot to determine the current frequency of the CPUs. Therefore, it is
not necessary for the Tegra194 CPUFREQ driver to internally call the
tegra194_get_speed_common() during initialisation to query the current
frequency as well. Fix this by removing the call to the
tegra194_get_speed_common() during initialisation and simplify the code.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/cpufreq/tegra194-cpufreq.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
index 79015875f346..a706ba929424 100644
--- a/drivers/cpufreq/tegra194-cpufreq.c
+++ b/drivers/cpufreq/tegra194-cpufreq.c
@@ -21,7 +21,6 @@
 #define KHZ                     1000
 #define REF_CLK_MHZ             408 /* 408 MHz */
 #define US_DELAY                500
-#define US_DELAY_MIN            2
 #define CPUFREQ_TBL_STEP_HZ     (50 * KHZ * KHZ)
 #define MAX_CNT                 ~0U
 
@@ -44,7 +43,6 @@ struct tegra194_cpufreq_data {
 
 struct tegra_cpu_ctr {
 	u32 cpu;
-	u32 delay;
 	u32 coreclk_cnt, last_coreclk_cnt;
 	u32 refclk_cnt, last_refclk_cnt;
 };
@@ -112,7 +110,7 @@ static void tegra_read_counters(struct work_struct *work)
 	val = read_freq_feedback();
 	c->last_refclk_cnt = lower_32_bits(val);
 	c->last_coreclk_cnt = upper_32_bits(val);
-	udelay(c->delay);
+	udelay(US_DELAY);
 	val = read_freq_feedback();
 	c->refclk_cnt = lower_32_bits(val);
 	c->coreclk_cnt = upper_32_bits(val);
@@ -139,7 +137,7 @@ static void tegra_read_counters(struct work_struct *work)
  * @cpu - logical cpu whose freq to be updated
  * Returns freq in KHz on success, 0 if cpu is offline
  */
-static unsigned int tegra194_get_speed_common(u32 cpu, u32 delay)
+static unsigned int tegra194_get_speed_common(u32 cpu)
 {
 	struct read_counters_work read_counters_work;
 	struct tegra_cpu_ctr c;
@@ -153,7 +151,6 @@ static unsigned int tegra194_get_speed_common(u32 cpu, u32 delay)
 	 * interrupts enabled.
 	 */
 	read_counters_work.c.cpu = cpu;
-	read_counters_work.c.delay = delay;
 	INIT_WORK_ONSTACK(&read_counters_work.work, tegra_read_counters);
 	queue_work_on(cpu, read_counters_wq, &read_counters_work.work);
 	flush_work(&read_counters_work.work);
@@ -209,7 +206,7 @@ static unsigned int tegra194_get_speed(u32 cpu)
 	smp_call_function_single(cpu, get_cpu_cluster, &cl, true);
 
 	/* reconstruct actual cpu freq using counters */
-	rate = tegra194_get_speed_common(cpu, US_DELAY);
+	rate = tegra194_get_speed_common(cpu);
 
 	/* get last written ndiv value */
 	ret = smp_call_function_single(cpu, get_cpu_ndiv, &ndiv, true);
@@ -248,9 +245,6 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
 	if (cl >= data->num_clusters)
 		return -EINVAL;
 
-	/* boot freq */
-	policy->cur = tegra194_get_speed_common(policy->cpu, US_DELAY_MIN);
-
 	/* set same policy for all cpus in a cluster */
 	for (cpu = (cl * 2); cpu < ((cl + 1) * 2); cpu++)
 		cpumask_set_cpu(cpu, policy->cpus);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] cpufreq: tegra194: Rename tegra194_get_speed_common function
  2020-12-02  9:14 [PATCH 0/4] CPUFREQ clean-ups for Tegra186 and Tegra194 Jon Hunter
                   ` (2 preceding siblings ...)
  2020-12-02  9:14 ` [PATCH 3/4] cpufreq: tegra194: Remove unnecessary frequency calculation Jon Hunter
@ 2020-12-02  9:14 ` Jon Hunter
  2020-12-07  7:33 ` [PATCH 0/4] CPUFREQ clean-ups for Tegra186 and Tegra194 Viresh Kumar
  4 siblings, 0 replies; 6+ messages in thread
From: Jon Hunter @ 2020-12-02  9:14 UTC (permalink / raw)
  To: Rafael J . Wysocki, Viresh Kumar, Thierry Reding
  Cc: linux-pm, linux-tegra, Sumit Gupta, Jon Hunter

The function tegra194_get_speed_common() uses hardware timers to
calculate the current CPUFREQ and so rename this function to be
tegra194_calculate_speed() to reflect what it does.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/cpufreq/tegra194-cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
index a706ba929424..6a67f36f3b80 100644
--- a/drivers/cpufreq/tegra194-cpufreq.c
+++ b/drivers/cpufreq/tegra194-cpufreq.c
@@ -137,7 +137,7 @@ static void tegra_read_counters(struct work_struct *work)
  * @cpu - logical cpu whose freq to be updated
  * Returns freq in KHz on success, 0 if cpu is offline
  */
-static unsigned int tegra194_get_speed_common(u32 cpu)
+static unsigned int tegra194_calculate_speed(u32 cpu)
 {
 	struct read_counters_work read_counters_work;
 	struct tegra_cpu_ctr c;
@@ -206,7 +206,7 @@ static unsigned int tegra194_get_speed(u32 cpu)
 	smp_call_function_single(cpu, get_cpu_cluster, &cl, true);
 
 	/* reconstruct actual cpu freq using counters */
-	rate = tegra194_get_speed_common(cpu);
+	rate = tegra194_calculate_speed(cpu);
 
 	/* get last written ndiv value */
 	ret = smp_call_function_single(cpu, get_cpu_ndiv, &ndiv, true);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] CPUFREQ clean-ups for Tegra186 and Tegra194
  2020-12-02  9:14 [PATCH 0/4] CPUFREQ clean-ups for Tegra186 and Tegra194 Jon Hunter
                   ` (3 preceding siblings ...)
  2020-12-02  9:14 ` [PATCH 4/4] cpufreq: tegra194: Rename tegra194_get_speed_common function Jon Hunter
@ 2020-12-07  7:33 ` Viresh Kumar
  4 siblings, 0 replies; 6+ messages in thread
From: Viresh Kumar @ 2020-12-07  7:33 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Rafael J . Wysocki, Thierry Reding, linux-pm, linux-tegra, Sumit Gupta

On 02-12-20, 09:14, Jon Hunter wrote:
> This series includes some clean-ups for the Tegra186 and Tegra194
> CPUFREQ drivers.
> 
> Jon Hunter (4):
>   cpufreq: tegra186: Fix sparse 'incorrect type in assignment' warning
>   cpufreq: tegra186: Simplify cluster information lookup
>   cpufreq: tegra194: Remove unnecessary frequency calculation
>   cpufreq: tegra194: Rename tegra194_get_speed_common function
> 
>  drivers/cpufreq/tegra186-cpufreq.c | 122 +++++++++++++----------------
>  drivers/cpufreq/tegra194-cpufreq.c |  12 +--
>  2 files changed, 57 insertions(+), 77 deletions(-)

Applied. Thanks.

-- 
viresh

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-07  7:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02  9:14 [PATCH 0/4] CPUFREQ clean-ups for Tegra186 and Tegra194 Jon Hunter
2020-12-02  9:14 ` [PATCH 1/4] cpufreq: tegra186: Fix sparse 'incorrect type in assignment' warning Jon Hunter
2020-12-02  9:14 ` [PATCH 2/4] cpufreq: tegra186: Simplify cluster information lookup Jon Hunter
2020-12-02  9:14 ` [PATCH 3/4] cpufreq: tegra194: Remove unnecessary frequency calculation Jon Hunter
2020-12-02  9:14 ` [PATCH 4/4] cpufreq: tegra194: Rename tegra194_get_speed_common function Jon Hunter
2020-12-07  7:33 ` [PATCH 0/4] CPUFREQ clean-ups for Tegra186 and Tegra194 Viresh Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.