LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes
@ 2019-05-22 18:45 Florian Fainelli
  2019-05-22 18:45 ` [PATCH 1/2] cpufreq: brcmstb-avs-cpufreq: Fix initial command check Florian Fainelli
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Florian Fainelli @ 2019-05-22 18:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: Florian Fainelli, Markus Mayer,
	maintainer:BROADCOM STB AVS CPUFREQ DRIVER, Rafael J. Wysocki,
	Viresh Kumar, Brian Norris, Gregory Fong,
	open list:BROADCOM STB AVS CPUFREQ DRIVER,
	moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE

Hi Rafael, Viresh,

These patch series contains two minor fixes for the brcmstb-avs-cpufreq
driver.

Florian Fainelli (2):
  cpufreq: brcmstb-avs-cpufreq: Fix initial command check
  cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency

 drivers/cpufreq/brcmstb-avs-cpufreq.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

-- 
2.17.1


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

* [PATCH 1/2] cpufreq: brcmstb-avs-cpufreq: Fix initial command check
  2019-05-22 18:45 [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes Florian Fainelli
@ 2019-05-22 18:45 ` Florian Fainelli
  2019-05-22 18:45 ` [PATCH 2/2] cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency Florian Fainelli
  2019-05-27 10:51 ` [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes Rafael J. Wysocki
  2 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2019-05-22 18:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: Florian Fainelli, Markus Mayer,
	maintainer:BROADCOM STB AVS CPUFREQ DRIVER, Rafael J. Wysocki,
	Viresh Kumar, Brian Norris, Gregory Fong,
	open list:BROADCOM STB AVS CPUFREQ DRIVER,
	moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE

There is a logical error in brcm_avs_is_firmware_loaded() whereby if the
firmware returns -EINVAL, we will be reporting this as an error. The
comment is correct, the code was not.

Fixes: de322e085995 ("cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/cpufreq/brcmstb-avs-cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c
index e6f9cbe5835f..6ed53ca8aa98 100644
--- a/drivers/cpufreq/brcmstb-avs-cpufreq.c
+++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c
@@ -446,8 +446,8 @@ static bool brcm_avs_is_firmware_loaded(struct private_data *priv)
 	rc = brcm_avs_get_pmap(priv, NULL);
 	magic = readl(priv->base + AVS_MBOX_MAGIC);
 
-	return (magic == AVS_FIRMWARE_MAGIC) && (rc != -ENOTSUPP) &&
-		(rc != -EINVAL);
+	return (magic == AVS_FIRMWARE_MAGIC) && ((rc != -ENOTSUPP) ||
+		(rc != -EINVAL));
 }
 
 static unsigned int brcm_avs_cpufreq_get(unsigned int cpu)
-- 
2.17.1


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

* [PATCH 2/2] cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency
  2019-05-22 18:45 [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes Florian Fainelli
  2019-05-22 18:45 ` [PATCH 1/2] cpufreq: brcmstb-avs-cpufreq: Fix initial command check Florian Fainelli
@ 2019-05-22 18:45 ` Florian Fainelli
  2019-05-27 10:51 ` [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes Rafael J. Wysocki
  2 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2019-05-22 18:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: Florian Fainelli, Markus Mayer,
	maintainer:BROADCOM STB AVS CPUFREQ DRIVER, Rafael J. Wysocki,
	Viresh Kumar, Brian Norris, Gregory Fong,
	open list:BROADCOM STB AVS CPUFREQ DRIVER,
	moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE

What we read back from the register is going to be capped at 32-bits,
and cpufreq_freq_table.frequency is an unsigned int. Avoid any possible
value truncation by using the appropriate return value.

Fixes: de322e085995 ("cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/cpufreq/brcmstb-avs-cpufreq.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c
index 6ed53ca8aa98..77b0e5d0fb13 100644
--- a/drivers/cpufreq/brcmstb-avs-cpufreq.c
+++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c
@@ -384,12 +384,12 @@ static int brcm_avs_set_pstate(struct private_data *priv, unsigned int pstate)
 	return __issue_avs_command(priv, AVS_CMD_SET_PSTATE, true, args);
 }
 
-static unsigned long brcm_avs_get_voltage(void __iomem *base)
+static u32 brcm_avs_get_voltage(void __iomem *base)
 {
 	return readl(base + AVS_MBOX_VOLTAGE1);
 }
 
-static unsigned long brcm_avs_get_frequency(void __iomem *base)
+static u32 brcm_avs_get_frequency(void __iomem *base)
 {
 	return readl(base + AVS_MBOX_FREQUENCY) * 1000;	/* in kHz */
 }
@@ -653,14 +653,14 @@ static ssize_t show_brcm_avs_voltage(struct cpufreq_policy *policy, char *buf)
 {
 	struct private_data *priv = policy->driver_data;
 
-	return sprintf(buf, "0x%08lx\n", brcm_avs_get_voltage(priv->base));
+	return sprintf(buf, "0x%08x\n", brcm_avs_get_voltage(priv->base));
 }
 
 static ssize_t show_brcm_avs_frequency(struct cpufreq_policy *policy, char *buf)
 {
 	struct private_data *priv = policy->driver_data;
 
-	return sprintf(buf, "0x%08lx\n", brcm_avs_get_frequency(priv->base));
+	return sprintf(buf, "0x%08x\n", brcm_avs_get_frequency(priv->base));
 }
 
 cpufreq_freq_attr_ro(brcm_avs_pstate);
-- 
2.17.1


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

* Re: [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes
  2019-05-22 18:45 [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes Florian Fainelli
  2019-05-22 18:45 ` [PATCH 1/2] cpufreq: brcmstb-avs-cpufreq: Fix initial command check Florian Fainelli
  2019-05-22 18:45 ` [PATCH 2/2] cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency Florian Fainelli
@ 2019-05-27 10:51 ` Rafael J. Wysocki
  2019-05-29 17:01   ` Florian Fainelli
  2 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2019-05-27 10:51 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-kernel, Markus Mayer,
	maintainer:BROADCOM STB AVS CPUFREQ DRIVER, Viresh Kumar,
	Brian Norris, Gregory Fong,
	open list:BROADCOM STB AVS CPUFREQ DRIVER,
	moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE

On Wednesday, May 22, 2019 8:45:45 PM CEST Florian Fainelli wrote:
> Hi Rafael, Viresh,
> 
> These patch series contains two minor fixes for the brcmstb-avs-cpufreq
> driver.
> 
> Florian Fainelli (2):
>   cpufreq: brcmstb-avs-cpufreq: Fix initial command check
>   cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency
> 
>  drivers/cpufreq/brcmstb-avs-cpufreq.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

These look straightforward enough to me, but it would be good to get an ACK from the
driver maintainer for them.




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

* Re: [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes
  2019-05-27 10:51 ` [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes Rafael J. Wysocki
@ 2019-05-29 17:01   ` Florian Fainelli
  2019-06-03 19:55     ` Markus Mayer
  0 siblings, 1 reply; 7+ messages in thread
From: Florian Fainelli @ 2019-05-29 17:01 UTC (permalink / raw)
  To: Rafael J. Wysocki, Markus Mayer, Markus Mayer
  Cc: linux-kernel, maintainer:BROADCOM STB AVS CPUFREQ DRIVER,
	Viresh Kumar, Brian Norris, Gregory Fong,
	open list:BROADCOM STB AVS CPUFREQ DRIVER,
	moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE

On 5/27/19 3:51 AM, Rafael J. Wysocki wrote:
> On Wednesday, May 22, 2019 8:45:45 PM CEST Florian Fainelli wrote:
>> Hi Rafael, Viresh,
>>
>> These patch series contains two minor fixes for the brcmstb-avs-cpufreq
>> driver.
>>
>> Florian Fainelli (2):
>>   cpufreq: brcmstb-avs-cpufreq: Fix initial command check
>>   cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency
>>
>>  drivers/cpufreq/brcmstb-avs-cpufreq.c | 12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> These look straightforward enough to me, but it would be good to get an ACK from the
> driver maintainer for them.

Adding Markus' other email address.

> 
> 
> 


-- 
Florian

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

* Re: [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes
  2019-05-29 17:01   ` Florian Fainelli
@ 2019-06-03 19:55     ` Markus Mayer
  2019-06-04  4:03       ` Viresh Kumar
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Mayer @ 2019-06-03 19:55 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Rafael J. Wysocki, Markus Mayer, Linux Kernel,
	maintainer:BROADCOM STB AVS CPUFREQ DRIVER, Viresh Kumar,
	Brian Norris, Gregory Fong,
	open list:BROADCOM STB AVS CPUFREQ DRIVER,
	moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE

On Wed, 29 May 2019 at 10:02, Florian Fainelli <f.fainelli@gmail.com> wrote:
>
> On 5/27/19 3:51 AM, Rafael J. Wysocki wrote:
> > On Wednesday, May 22, 2019 8:45:45 PM CEST Florian Fainelli wrote:
> >> Hi Rafael, Viresh,
> >>
> >> These patch series contains two minor fixes for the brcmstb-avs-cpufreq
> >> driver.
> >>
> >> Florian Fainelli (2):
> >>   cpufreq: brcmstb-avs-cpufreq: Fix initial command check
> >>   cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency

To both of these

Acked-by: Markus Mayer <mmayer@broadcom.com>

My apologies for the delay.

> >>  drivers/cpufreq/brcmstb-avs-cpufreq.c | 12 ++++++------
> >>  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > These look straightforward enough to me, but it would be good to get an ACK from the
> > driver maintainer for them.
>
> Adding Markus' other email address.
> --
> Florian

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

* Re: [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes
  2019-06-03 19:55     ` Markus Mayer
@ 2019-06-04  4:03       ` Viresh Kumar
  0 siblings, 0 replies; 7+ messages in thread
From: Viresh Kumar @ 2019-06-04  4:03 UTC (permalink / raw)
  To: Markus Mayer
  Cc: Florian Fainelli, Rafael J. Wysocki, Markus Mayer, Linux Kernel,
	maintainer:BROADCOM STB AVS CPUFREQ DRIVER, Brian Norris,
	Gregory Fong, open list:BROADCOM STB AVS CPUFREQ DRIVER,
	moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE

On 03-06-19, 12:55, Markus Mayer wrote:
> On Wed, 29 May 2019 at 10:02, Florian Fainelli <f.fainelli@gmail.com> wrote:
> >
> > On 5/27/19 3:51 AM, Rafael J. Wysocki wrote:
> > > On Wednesday, May 22, 2019 8:45:45 PM CEST Florian Fainelli wrote:
> > >> Hi Rafael, Viresh,
> > >>
> > >> These patch series contains two minor fixes for the brcmstb-avs-cpufreq
> > >> driver.
> > >>
> > >> Florian Fainelli (2):
> > >>   cpufreq: brcmstb-avs-cpufreq: Fix initial command check
> > >>   cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency
> 
> To both of these
> 
> Acked-by: Markus Mayer <mmayer@broadcom.com>

Applied. Thanks.

-- 
viresh

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

end of thread, other threads:[~2019-06-04  4:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 18:45 [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes Florian Fainelli
2019-05-22 18:45 ` [PATCH 1/2] cpufreq: brcmstb-avs-cpufreq: Fix initial command check Florian Fainelli
2019-05-22 18:45 ` [PATCH 2/2] cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency Florian Fainelli
2019-05-27 10:51 ` [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes Rafael J. Wysocki
2019-05-29 17:01   ` Florian Fainelli
2019-06-03 19:55     ` Markus Mayer
2019-06-04  4:03       ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).