* [PATCH] clk: qcom: smd-rpm: conditionally enable scaling before doing handover
@ 2023-05-06 20:10 Luca Weiss
2023-05-16 1:27 ` Konrad Dybcio
2023-05-25 4:54 ` Bjorn Andersson
0 siblings, 2 replies; 5+ messages in thread
From: Luca Weiss @ 2023-05-06 20:10 UTC (permalink / raw)
To: ~postmarketos/upstreaming, phone-devel, Bjorn Andersson,
Andy Gross, Konrad Dybcio, Michael Turquette, Stephen Boyd
Cc: linux-arm-msm, linux-clk, linux-kernel, Luca Weiss
On older platforms like msm8226, msm8974 and msm8916 the driver in the
downstream kernel enables scaling first before doing the handover of the
clocks.
While this normally doesn't seem to cause noticeable problems, on
apq8026-asus-sparrow this causes the device to immediately reboot,
perhaps due to older rpm firmware that becomes unhappy.
On newer platforms the order has swapped and enabling scaling is done
after the handover, so let's introduce this behavior only conditionally
for msm8226 and msm8974 for now.
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
drivers/clk/qcom/clk-smd-rpm.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c
index 887b945a6fb7..6d5476afc4d1 100644
--- a/drivers/clk/qcom/clk-smd-rpm.c
+++ b/drivers/clk/qcom/clk-smd-rpm.c
@@ -178,6 +178,7 @@ struct clk_smd_rpm_req {
struct rpm_smd_clk_desc {
struct clk_smd_rpm **clks;
size_t num_clks;
+ bool scaling_before_handover;
};
static DEFINE_MUTEX(rpm_smd_clk_lock);
@@ -693,6 +694,7 @@ static struct clk_smd_rpm *msm8974_clks[] = {
static const struct rpm_smd_clk_desc rpm_clk_msm8974 = {
.clks = msm8974_clks,
.num_clks = ARRAY_SIZE(msm8974_clks),
+ .scaling_before_handover = true,
};
static struct clk_smd_rpm *msm8976_clks[] = {
@@ -1318,6 +1320,12 @@ static int rpm_smd_clk_probe(struct platform_device *pdev)
rpm_smd_clks = desc->clks;
num_clks = desc->num_clks;
+ if (desc->scaling_before_handover) {
+ ret = clk_smd_rpm_enable_scaling(rpm);
+ if (ret)
+ goto err;
+ }
+
for (i = 0; i < num_clks; i++) {
if (!rpm_smd_clks[i])
continue;
@@ -1329,9 +1337,11 @@ static int rpm_smd_clk_probe(struct platform_device *pdev)
goto err;
}
- ret = clk_smd_rpm_enable_scaling(rpm);
- if (ret)
- goto err;
+ if (!desc->scaling_before_handover) {
+ ret = clk_smd_rpm_enable_scaling(rpm);
+ if (ret)
+ goto err;
+ }
for (i = 0; i < num_clks; i++) {
if (!rpm_smd_clks[i])
---
base-commit: dd9e11d6477a52ede9ebe575c83285e79e823889
change-id: 20230506-rpmcc-scaling-handover-a63029ed9d13
Best regards,
--
Luca Weiss <luca@z3ntu.xyz>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] clk: qcom: smd-rpm: conditionally enable scaling before doing handover
2023-05-06 20:10 [PATCH] clk: qcom: smd-rpm: conditionally enable scaling before doing handover Luca Weiss
@ 2023-05-16 1:27 ` Konrad Dybcio
2023-05-17 14:59 ` Luca Weiss
2023-05-25 4:54 ` Bjorn Andersson
1 sibling, 1 reply; 5+ messages in thread
From: Konrad Dybcio @ 2023-05-16 1:27 UTC (permalink / raw)
To: Luca Weiss, ~postmarketos/upstreaming, phone-devel,
Bjorn Andersson, Andy Gross, Michael Turquette, Stephen Boyd
Cc: linux-arm-msm, linux-clk, linux-kernel
On 6.05.2023 22:10, Luca Weiss wrote:
> On older platforms like msm8226, msm8974 and msm8916 the driver in the
> downstream kernel enables scaling first before doing the handover of the
> clocks.
>
> While this normally doesn't seem to cause noticeable problems, on
> apq8026-asus-sparrow this causes the device to immediately reboot,
> perhaps due to older rpm firmware that becomes unhappy.
>
> On newer platforms the order has swapped and enabling scaling is done
> after the handover, so let's introduce this behavior only conditionally
> for msm8226 and msm8974 for now.
>
> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> ---
Did you give this a spin on some 8974? I think hammerhead had
issues around rpmcc in the past..
Konrad
> drivers/clk/qcom/clk-smd-rpm.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c
> index 887b945a6fb7..6d5476afc4d1 100644
> --- a/drivers/clk/qcom/clk-smd-rpm.c
> +++ b/drivers/clk/qcom/clk-smd-rpm.c
> @@ -178,6 +178,7 @@ struct clk_smd_rpm_req {
> struct rpm_smd_clk_desc {
> struct clk_smd_rpm **clks;
> size_t num_clks;
> + bool scaling_before_handover;
> };
>
> static DEFINE_MUTEX(rpm_smd_clk_lock);
> @@ -693,6 +694,7 @@ static struct clk_smd_rpm *msm8974_clks[] = {
> static const struct rpm_smd_clk_desc rpm_clk_msm8974 = {
> .clks = msm8974_clks,
> .num_clks = ARRAY_SIZE(msm8974_clks),
> + .scaling_before_handover = true,
> };
>
> static struct clk_smd_rpm *msm8976_clks[] = {
> @@ -1318,6 +1320,12 @@ static int rpm_smd_clk_probe(struct platform_device *pdev)
> rpm_smd_clks = desc->clks;
> num_clks = desc->num_clks;
>
> + if (desc->scaling_before_handover) {
> + ret = clk_smd_rpm_enable_scaling(rpm);
> + if (ret)
> + goto err;
> + }
> +
> for (i = 0; i < num_clks; i++) {
> if (!rpm_smd_clks[i])
> continue;
> @@ -1329,9 +1337,11 @@ static int rpm_smd_clk_probe(struct platform_device *pdev)
> goto err;
> }
>
> - ret = clk_smd_rpm_enable_scaling(rpm);
> - if (ret)
> - goto err;
> + if (!desc->scaling_before_handover) {
> + ret = clk_smd_rpm_enable_scaling(rpm);
> + if (ret)
> + goto err;
> + }
>
> for (i = 0; i < num_clks; i++) {
> if (!rpm_smd_clks[i])
>
> ---
> base-commit: dd9e11d6477a52ede9ebe575c83285e79e823889
> change-id: 20230506-rpmcc-scaling-handover-a63029ed9d13
>
> Best regards,
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] clk: qcom: smd-rpm: conditionally enable scaling before doing handover
2023-05-16 1:27 ` Konrad Dybcio
@ 2023-05-17 14:59 ` Luca Weiss
2023-05-17 19:11 ` Konrad Dybcio
0 siblings, 1 reply; 5+ messages in thread
From: Luca Weiss @ 2023-05-17 14:59 UTC (permalink / raw)
To: ~postmarketos/upstreaming, phone-devel, Bjorn Andersson,
Andy Gross, Michael Turquette, Stephen Boyd, Konrad Dybcio
Cc: linux-arm-msm, linux-clk, linux-kernel
On Dienstag, 16. Mai 2023 03:27:46 CEST Konrad Dybcio wrote:
> On 6.05.2023 22:10, Luca Weiss wrote:
> > On older platforms like msm8226, msm8974 and msm8916 the driver in the
> > downstream kernel enables scaling first before doing the handover of the
> > clocks.
> >
> > While this normally doesn't seem to cause noticeable problems, on
> > apq8026-asus-sparrow this causes the device to immediately reboot,
> > perhaps due to older rpm firmware that becomes unhappy.
> >
> > On newer platforms the order has swapped and enabling scaling is done
> > after the handover, so let's introduce this behavior only conditionally
> > for msm8226 and msm8974 for now.
> >
> > Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> > ---
>
> Did you give this a spin on some 8974? I think hammerhead had
> issues around rpmcc in the past..
Yes, appears to be fine on msm8974 also.
I tried to reproduce the hammerhead ocmem hang we had in the past but even
with v6.3 rpmcc it seems to be fine. But iirc it was happening more or less at
random in the past so wouldn't be surprised if my tests just didn't show
anything on accident.
Regards
Luca
>
> Konrad
>
> > drivers/clk/qcom/clk-smd-rpm.c | 16 +++++++++++++---
> > 1 file changed, 13 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/clk/qcom/clk-smd-rpm.c
> > b/drivers/clk/qcom/clk-smd-rpm.c index 887b945a6fb7..6d5476afc4d1 100644
> > --- a/drivers/clk/qcom/clk-smd-rpm.c
> > +++ b/drivers/clk/qcom/clk-smd-rpm.c
> > @@ -178,6 +178,7 @@ struct clk_smd_rpm_req {
> >
> > struct rpm_smd_clk_desc {
> >
> > struct clk_smd_rpm **clks;
> > size_t num_clks;
> >
> > + bool scaling_before_handover;
> >
> > };
> >
> > static DEFINE_MUTEX(rpm_smd_clk_lock);
> >
> > @@ -693,6 +694,7 @@ static struct clk_smd_rpm *msm8974_clks[] = {
> >
> > static const struct rpm_smd_clk_desc rpm_clk_msm8974 = {
> >
> > .clks = msm8974_clks,
> > .num_clks = ARRAY_SIZE(msm8974_clks),
> >
> > + .scaling_before_handover = true,
> >
> > };
> >
> > static struct clk_smd_rpm *msm8976_clks[] = {
> >
> > @@ -1318,6 +1320,12 @@ static int rpm_smd_clk_probe(struct platform_device
> > *pdev)>
> > rpm_smd_clks = desc->clks;
> > num_clks = desc->num_clks;
> >
> > + if (desc->scaling_before_handover) {
> > + ret = clk_smd_rpm_enable_scaling(rpm);
> > + if (ret)
> > + goto err;
> > + }
> > +
> >
> > for (i = 0; i < num_clks; i++) {
> >
> > if (!rpm_smd_clks[i])
> >
> > continue;
> >
> > @@ -1329,9 +1337,11 @@ static int rpm_smd_clk_probe(struct platform_device
> > *pdev)>
> > goto err;
> >
> > }
> >
> > - ret = clk_smd_rpm_enable_scaling(rpm);
> > - if (ret)
> > - goto err;
> > + if (!desc->scaling_before_handover) {
> > + ret = clk_smd_rpm_enable_scaling(rpm);
> > + if (ret)
> > + goto err;
> > + }
> >
> > for (i = 0; i < num_clks; i++) {
> >
> > if (!rpm_smd_clks[i])
> >
> > ---
> > base-commit: dd9e11d6477a52ede9ebe575c83285e79e823889
> > change-id: 20230506-rpmcc-scaling-handover-a63029ed9d13
> >
> > Best regards,
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] clk: qcom: smd-rpm: conditionally enable scaling before doing handover
2023-05-17 14:59 ` Luca Weiss
@ 2023-05-17 19:11 ` Konrad Dybcio
0 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2023-05-17 19:11 UTC (permalink / raw)
To: Luca Weiss, ~postmarketos/upstreaming, phone-devel,
Bjorn Andersson, Andy Gross, Michael Turquette, Stephen Boyd
Cc: linux-arm-msm, linux-clk, linux-kernel
On 17.05.2023 16:59, Luca Weiss wrote:
> On Dienstag, 16. Mai 2023 03:27:46 CEST Konrad Dybcio wrote:
>> On 6.05.2023 22:10, Luca Weiss wrote:
>>> On older platforms like msm8226, msm8974 and msm8916 the driver in the
>>> downstream kernel enables scaling first before doing the handover of the
>>> clocks.
>>>
>>> While this normally doesn't seem to cause noticeable problems, on
>>> apq8026-asus-sparrow this causes the device to immediately reboot,
>>> perhaps due to older rpm firmware that becomes unhappy.
>>>
>>> On newer platforms the order has swapped and enabling scaling is done
>>> after the handover, so let's introduce this behavior only conditionally
>>> for msm8226 and msm8974 for now.
>>>
>>> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
>>> ---
>>
>> Did you give this a spin on some 8974? I think hammerhead had
>> issues around rpmcc in the past..
>
> Yes, appears to be fine on msm8974 also.
>
> I tried to reproduce the hammerhead ocmem hang we had in the past but even
> with v6.3 rpmcc it seems to be fine. But iirc it was happening more or less at
> random in the past so wouldn't be surprised if my tests just didn't show
> anything on accident.
>
> Regards
> Luca
OK sg
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Konrad
>
>>
>> Konrad
>>
>>> drivers/clk/qcom/clk-smd-rpm.c | 16 +++++++++++++---
>>> 1 file changed, 13 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/clk/qcom/clk-smd-rpm.c
>>> b/drivers/clk/qcom/clk-smd-rpm.c index 887b945a6fb7..6d5476afc4d1 100644
>>> --- a/drivers/clk/qcom/clk-smd-rpm.c
>>> +++ b/drivers/clk/qcom/clk-smd-rpm.c
>>> @@ -178,6 +178,7 @@ struct clk_smd_rpm_req {
>>>
>>> struct rpm_smd_clk_desc {
>>>
>>> struct clk_smd_rpm **clks;
>>> size_t num_clks;
>>>
>>> + bool scaling_before_handover;
>>>
>>> };
>>>
>>> static DEFINE_MUTEX(rpm_smd_clk_lock);
>>>
>>> @@ -693,6 +694,7 @@ static struct clk_smd_rpm *msm8974_clks[] = {
>>>
>>> static const struct rpm_smd_clk_desc rpm_clk_msm8974 = {
>>>
>>> .clks = msm8974_clks,
>>> .num_clks = ARRAY_SIZE(msm8974_clks),
>>>
>>> + .scaling_before_handover = true,
>>>
>>> };
>>>
>>> static struct clk_smd_rpm *msm8976_clks[] = {
>>>
>>> @@ -1318,6 +1320,12 @@ static int rpm_smd_clk_probe(struct platform_device
>>> *pdev)>
>>> rpm_smd_clks = desc->clks;
>>> num_clks = desc->num_clks;
>>>
>>> + if (desc->scaling_before_handover) {
>>> + ret = clk_smd_rpm_enable_scaling(rpm);
>>> + if (ret)
>>> + goto err;
>>> + }
>>> +
>>>
>>> for (i = 0; i < num_clks; i++) {
>>>
>>> if (!rpm_smd_clks[i])
>>>
>>> continue;
>>>
>>> @@ -1329,9 +1337,11 @@ static int rpm_smd_clk_probe(struct platform_device
>>> *pdev)>
>>> goto err;
>>>
>>> }
>>>
>>> - ret = clk_smd_rpm_enable_scaling(rpm);
>>> - if (ret)
>>> - goto err;
>>> + if (!desc->scaling_before_handover) {
>>> + ret = clk_smd_rpm_enable_scaling(rpm);
>>> + if (ret)
>>> + goto err;
>>> + }
>>>
>>> for (i = 0; i < num_clks; i++) {
>>>
>>> if (!rpm_smd_clks[i])
>>>
>>> ---
>>> base-commit: dd9e11d6477a52ede9ebe575c83285e79e823889
>>> change-id: 20230506-rpmcc-scaling-handover-a63029ed9d13
>>>
>>> Best regards,
>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: qcom: smd-rpm: conditionally enable scaling before doing handover
2023-05-06 20:10 [PATCH] clk: qcom: smd-rpm: conditionally enable scaling before doing handover Luca Weiss
2023-05-16 1:27 ` Konrad Dybcio
@ 2023-05-25 4:54 ` Bjorn Andersson
1 sibling, 0 replies; 5+ messages in thread
From: Bjorn Andersson @ 2023-05-25 4:54 UTC (permalink / raw)
To: Konrad Dybcio, Stephen Boyd, Andy Gross, Luca Weiss, phone-devel,
~postmarketos/upstreaming, Michael Turquette
Cc: linux-clk, linux-arm-msm, linux-kernel
On Sat, 06 May 2023 22:10:32 +0200, Luca Weiss wrote:
> On older platforms like msm8226, msm8974 and msm8916 the driver in the
> downstream kernel enables scaling first before doing the handover of the
> clocks.
>
> While this normally doesn't seem to cause noticeable problems, on
> apq8026-asus-sparrow this causes the device to immediately reboot,
> perhaps due to older rpm firmware that becomes unhappy.
>
> [...]
Applied, thanks!
[1/1] clk: qcom: smd-rpm: conditionally enable scaling before doing handover
commit: e9a2db5caf9f219d9cf570cb0965710344c85519
Best regards,
--
Bjorn Andersson <andersson@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-25 4:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-06 20:10 [PATCH] clk: qcom: smd-rpm: conditionally enable scaling before doing handover Luca Weiss
2023-05-16 1:27 ` Konrad Dybcio
2023-05-17 14:59 ` Luca Weiss
2023-05-17 19:11 ` Konrad Dybcio
2023-05-25 4:54 ` Bjorn Andersson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®