On SM8250 both the display and video clock controllers are powered up by
the MMCX power domain. Handle this by linking clock controllers to the
proper power domain, and using runtime power management to enable and
disable the MMCX power domain.
Dependencies:
- https://lore.kernel.org/linux-arm-msm/20210703005416.2668319-1-bjorn.andersson@linaro.org/
(pending)
Changes since v5:
- Dropped devm_pm_runtime_enable callback to remove extra dependency
Changes since v4:
- Dropped pm_runtime handling from drivers/clk/qcom/common.c Moved the
code into dispcc-sm8250.c and videocc-sm8250.c
Changes since v3:
- Wrap gdsc_enable/gdsc_disable into pm_runtime_get/put calls rather
than calling pm_runtime_get in gdsc_enabled and _put in gdsc_disable
- Squash gdsc patches together to remove possible dependencies between
two patches.
Changes since v2:
- Move pm_runtime calls from generic genpd code to the gdsc code for
now (as suggested by Ulf & Bjorn)
Changes since v1:
- Rebase on top of Bjorn's patches, removing the need for setting
performance state directly.
- Move runtime PM calls from GDSC code to generic genpd code.
- Always call pm_runtime_enable in the Qualcomm generic clock
controller code.
- Register GDSC power domains as subdomains of the domain powering the
clock controller if there is one.
----------------------------------------------------------------
Dmitry Baryshkov (8):
dt-bindings: clock: qcom,dispcc-sm8x50: add mmcx power domain
dt-bindings: clock: qcom,videocc: add mmcx power domain
clk: qcom: dispcc-sm8250: use runtime PM for the clock controller
clk: qcom: videocc-sm8250: use runtime PM for the clock controller
clk: qcom: gdsc: enable optional power domain support
arm64: dts: qcom: sm8250: remove mmcx regulator
clk: qcom: dispcc-sm8250: stop using mmcx regulator
clk: qcom: videocc-sm8250: stop using mmcx regulator
.../bindings/clock/qcom,dispcc-sm8x50.yaml | 7 +++
.../devicetree/bindings/clock/qcom,videocc.yaml | 7 +++
arch/arm64/boot/dts/qcom/sm8250.dtsi | 11 +---
drivers/clk/qcom/dispcc-sm8250.c | 28 ++++++++--
drivers/clk/qcom/gdsc.c | 59 ++++++++++++++++++++--
drivers/clk/qcom/gdsc.h | 2 +
drivers/clk/qcom/videocc-sm8250.c | 31 +++++++++---
7 files changed, 124 insertions(+), 21 deletions(-)
On sm8250 dispcc requires MMCX power domain to be powered up before
clock controller's registers become available. For now sm8250 was using
external regulator driven by the power domain to describe this
relationship. Switch into specifying power-domain and required opp-state
directly.
Signed-off-by: Dmitry Baryshkov <redacted>
Reviewed-by: Bjorn Andersson <redacted>
Reviewed-by: Rob Herring <robh@kernel.org>
---
.../devicetree/bindings/clock/qcom,dispcc-sm8x50.yaml | 7 +++++++
1 file changed, 7 insertions(+)
@@ -56,6 +56,11 @@ properties:reg:maxItems:1+power-domains:+description:+A phandle and PM domain specifier for the MMCX power domain.+maxItems:1+required:-compatible-reg
On sm8250 videocc requires MMCX power domain to be powered up before
clock controller's registers become available. For now sm8250 was using
external regulator driven by the power domain to describe this
relationship. Switch into specifying power-domain and required opp-state
directly.
Signed-off-by: Dmitry Baryshkov <redacted>
Reviewed-by: Bjorn Andersson <redacted>
Reviewed-by: Rob Herring <robh@kernel.org>
---
Documentation/devicetree/bindings/clock/qcom,videocc.yaml | 7 +++++++
1 file changed, 7 insertions(+)
@@ -47,6 +47,11 @@ properties:reg:maxItems:1+power-domains:+description:+A phandle and PM domain specifier for the MMCX power domain.+maxItems:1+required:-compatible-reg
On sm8250 dispcc and videocc registers are powered up by the MMCX power
domain. Use runtime PM calls to make sure that required power domain is
powered on while we access clock controller's registers.
Signed-off-by: Dmitry Baryshkov <redacted>
---
drivers/clk/qcom/dispcc-sm8250.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
On sm8250 dispcc and videocc registers are powered up by the MMCX power
domain. Currently we use a regulator to enable this domain on demand,
however this has some consequences, as genpd code is not reentrant.
Make gdsc code also use pm_runtime calls to ensure that registers are
accessible during the gdsc_enable/gdsc_disable operations.
Signed-off-by: Dmitry Baryshkov <redacted>
---
drivers/clk/qcom/gdsc.c | 59 ++++++++++++++++++++++++++++++++++++++---
drivers/clk/qcom/gdsc.h | 2 ++
2 files changed, 58 insertions(+), 3 deletions(-)
@@ -50,6 +51,22 @@ enum gdsc_status {GDSC_ON};+staticintgdsc_pm_runtime_get(structgdsc*sc)+{+if(!sc->dev)+return0;++returnpm_runtime_resume_and_get(sc->dev);+}++staticintgdsc_pm_runtime_put(structgdsc*sc)+{+if(!sc->dev)+return0;++returnpm_runtime_put_sync(sc->dev);+}+/* Returns 1 if GDSC status is status, 0 if not, and < 0 on error */staticintgdsc_check_status(structgdsc*sc,enumgdsc_statusstatus){
On sm8250 dispcc and videocc registers are powered up by the MMCX power
domain. Use runtime PM calls to make sure that required power domain is
powered on while we access clock controller's registers.
Signed-off-by: Dmitry Baryshkov <redacted>
---
drivers/clk/qcom/videocc-sm8250.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
Now as the common qcom clock controller code has been taught about power
domains, stop mentioning mmcx supply as a way to power up the clock
controller's gdscs.
Signed-off-by: Dmitry Baryshkov <redacted>
Reviewed-by: Bjorn Andersson <redacted>
---
drivers/clk/qcom/videocc-sm8250.c | 4 ----
1 file changed, 4 deletions(-)
Now as the common qcom clock controller code has been taught about power
domains, stop mentioning mmcx supply as a way to power up the clock
controller's gdsc.
Signed-off-by: Dmitry Baryshkov <redacted>
Reviewed-by: Bjorn Andersson <redacted>
---
drivers/clk/qcom/dispcc-sm8250.c | 1 -
1 file changed, 1 deletion(-)
On Tue, 27 Jul 2021 at 22:20, Dmitry Baryshkov
[off-list ref] wrote:
On SM8250 both the display and video clock controllers are powered up by
the MMCX power domain. Handle this by linking clock controllers to the
proper power domain, and using runtime power management to enable and
disable the MMCX power domain.
Dependencies:
- https://lore.kernel.org/linux-arm-msm/20210703005416.2668319-1-bjorn.andersson@linaro.org/
(pending)
Changes since v5:
- Dropped devm_pm_runtime_enable callback to remove extra dependency
Changes since v4:
- Dropped pm_runtime handling from drivers/clk/qcom/common.c Moved the
code into dispcc-sm8250.c and videocc-sm8250.c
Changes since v3:
- Wrap gdsc_enable/gdsc_disable into pm_runtime_get/put calls rather
than calling pm_runtime_get in gdsc_enabled and _put in gdsc_disable
- Squash gdsc patches together to remove possible dependencies between
two patches.
Changes since v2:
- Move pm_runtime calls from generic genpd code to the gdsc code for
now (as suggested by Ulf & Bjorn)
Changes since v1:
- Rebase on top of Bjorn's patches, removing the need for setting
performance state directly.
- Move runtime PM calls from GDSC code to generic genpd code.
- Always call pm_runtime_enable in the Qualcomm generic clock
controller code.
- Register GDSC power domains as subdomains of the domain powering the
clock controller if there is one.
----------------------------------------------------------------
Dmitry Baryshkov (8):
dt-bindings: clock: qcom,dispcc-sm8x50: add mmcx power domain
dt-bindings: clock: qcom,videocc: add mmcx power domain
clk: qcom: dispcc-sm8250: use runtime PM for the clock controller
clk: qcom: videocc-sm8250: use runtime PM for the clock controller
clk: qcom: gdsc: enable optional power domain support
arm64: dts: qcom: sm8250: remove mmcx regulator
clk: qcom: dispcc-sm8250: stop using mmcx regulator
clk: qcom: videocc-sm8250: stop using mmcx regulator
.../bindings/clock/qcom,dispcc-sm8x50.yaml | 7 +++
.../devicetree/bindings/clock/qcom,videocc.yaml | 7 +++
arch/arm64/boot/dts/qcom/sm8250.dtsi | 11 +---
drivers/clk/qcom/dispcc-sm8250.c | 28 ++++++++--
drivers/clk/qcom/gdsc.c | 59 ++++++++++++++++++++--
drivers/clk/qcom/gdsc.h | 2 +
drivers/clk/qcom/videocc-sm8250.c | 31 +++++++++---
7 files changed, 124 insertions(+), 21 deletions(-)
For the series:
Reviewed-by: Ulf Hansson <redacted>
Kind regards
Uffe
From: Stephen Boyd <sboyd@kernel.org> Date: 2021-08-26 18:31:50
Quoting Dmitry Baryshkov (2021-07-27 13:19:56)
On SM8250 both the display and video clock controllers are powered up by
the MMCX power domain. Handle this by linking clock controllers to the
proper power domain, and using runtime power management to enable and
disable the MMCX power domain.
Dependencies:
- https://lore.kernel.org/linux-arm-msm/20210703005416.2668319-1-bjorn.andersson@linaro.org/
(pending)
Does this patch series need to go through the qcom tree? Presumably the
dependency is going through qcom -> arm-soc
Changes since v5:
- Dropped devm_pm_runtime_enable callback to remove extra dependency
Changes since v4:
- Dropped pm_runtime handling from drivers/clk/qcom/common.c Moved the
code into dispcc-sm8250.c and videocc-sm8250.c
Changes since v3:
- Wrap gdsc_enable/gdsc_disable into pm_runtime_get/put calls rather
than calling pm_runtime_get in gdsc_enabled and _put in gdsc_disable
- Squash gdsc patches together to remove possible dependencies between
two patches.
On SM8250 both the display and video clock controllers are powered up by
the MMCX power domain. Handle this by linking clock controllers to the
proper power domain, and using runtime power management to enable and
disable the MMCX power domain.
Dependencies:
- https://lore.kernel.org/linux-arm-msm/20210703005416.2668319-1-bjorn.andersson@linaro.org/
(pending)
Does this patch series need to go through the qcom tree? Presumably the
dependency is going through qcom -> arm-soc
It looks like Bjorn did not apply his patches in the for-5.15 series, so
we'd have to wait anyway. Probably I should rebase these patches instead
on Rajendra's required-opps patch (which is going in this window).
quoted
Changes since v5:
- Dropped devm_pm_runtime_enable callback to remove extra dependency
Changes since v4:
- Dropped pm_runtime handling from drivers/clk/qcom/common.c Moved the
code into dispcc-sm8250.c and videocc-sm8250.c
Changes since v3:
- Wrap gdsc_enable/gdsc_disable into pm_runtime_get/put calls rather
than calling pm_runtime_get in gdsc_enabled and _put in gdsc_disable
- Squash gdsc patches together to remove possible dependencies between
two patches.
From: Stephen Boyd <sboyd@kernel.org> Date: 2021-08-29 03:51:45
Quoting Dmitry Baryshkov (2021-08-26 14:56:23)
On 26/08/2021 21:31, Stephen Boyd wrote:
quoted
Quoting Dmitry Baryshkov (2021-07-27 13:19:56)
quoted
On SM8250 both the display and video clock controllers are powered up by
the MMCX power domain. Handle this by linking clock controllers to the
proper power domain, and using runtime power management to enable and
disable the MMCX power domain.
Dependencies:
- https://lore.kernel.org/linux-arm-msm/20210703005416.2668319-1-bjorn.andersson@linaro.org/
(pending)
Does this patch series need to go through the qcom tree? Presumably the
dependency is going through qcom -> arm-soc
It looks like Bjorn did not apply his patches in the for-5.15 series, so
we'd have to wait anyway. Probably I should rebase these patches instead
on Rajendra's required-opps patch (which is going in this window).
On Sun, 29 Aug 2021 at 06:51, Stephen Boyd [off-list ref] wrote:
Quoting Dmitry Baryshkov (2021-08-26 14:56:23)
quoted
On 26/08/2021 21:31, Stephen Boyd wrote:
quoted
Quoting Dmitry Baryshkov (2021-07-27 13:19:56)
quoted
On SM8250 both the display and video clock controllers are powered up by
the MMCX power domain. Handle this by linking clock controllers to the
proper power domain, and using runtime power management to enable and
disable the MMCX power domain.
Dependencies:
- https://lore.kernel.org/linux-arm-msm/20210703005416.2668319-1-bjorn.andersson@linaro.org/
(pending)
Does this patch series need to go through the qcom tree? Presumably the
dependency is going through qcom -> arm-soc
It looks like Bjorn did not apply his patches in the for-5.15 series, so
we'd have to wait anyway. Probably I should rebase these patches instead
on Rajendra's required-opps patch (which is going in this window).
Ok. Thanks. I'll drop it from my queue for now.
Just for the reference. I've sent v7 of this patchset. After thinking
more about power domains relationship, I think we have a hole in the
abstraction here. Currently subdomains cause power domains to be
powered up, but do not dictate the performance level the parent domain
should be working in. While this does not look like an issue for the
gdsc (and thus it can be easily solved by the Bjorn's patches, which
enforce rpmhpd to be powered on to 'at least lowest possible'
performance state, this might be not the case for the future links. I
think at some point the pd_add_subdomain() interface should be
extended with the ability to specify minimum required performance
state when the link becomes on. Until that time I have changed code to
enforce having clock controller in pm resume state when gdsc is
enabled, thus CC itself votes on parent's (rpmhpd) performance state.
--
With best wishes
Dmitry
On Sun, 29 Aug 2021 at 17:54, Dmitry Baryshkov
[off-list ref] wrote:
On Sun, 29 Aug 2021 at 06:51, Stephen Boyd [off-list ref] wrote:
quoted
Quoting Dmitry Baryshkov (2021-08-26 14:56:23)
quoted
On 26/08/2021 21:31, Stephen Boyd wrote:
quoted
Quoting Dmitry Baryshkov (2021-07-27 13:19:56)
quoted
On SM8250 both the display and video clock controllers are powered up by
the MMCX power domain. Handle this by linking clock controllers to the
proper power domain, and using runtime power management to enable and
disable the MMCX power domain.
Dependencies:
- https://lore.kernel.org/linux-arm-msm/20210703005416.2668319-1-bjorn.andersson@linaro.org/
(pending)
Does this patch series need to go through the qcom tree? Presumably the
dependency is going through qcom -> arm-soc
It looks like Bjorn did not apply his patches in the for-5.15 series, so
we'd have to wait anyway. Probably I should rebase these patches instead
on Rajendra's required-opps patch (which is going in this window).
Ok. Thanks. I'll drop it from my queue for now.
Just for the reference. I've sent v7 of this patchset. After thinking
more about power domains relationship, I think we have a hole in the
abstraction here. Currently subdomains cause power domains to be
powered up, but do not dictate the performance level the parent domain
should be working in.
That's not entirely true. In genpd_add_subdomain() we verify that if
the child is powered on, the parent must already be powered on,
otherwise we treat this a bad setup and return an error code.
What seems to be missing though, is that if there is a performance
state applied for the child domain, that should be propagated to the
parent domain too. Right?
While this does not look like an issue for the
gdsc (and thus it can be easily solved by the Bjorn's patches, which
enforce rpmhpd to be powered on to 'at least lowest possible'
performance state, this might be not the case for the future links. I
think at some point the pd_add_subdomain() interface should be
extended with the ability to specify minimum required performance
state when the link becomes on.
I guess that minimum performance state could be considered as a
"required-opp" in the DT node for the power-domain provider, no?
Another option would simply be to manage this solely in the
platform/soc specific genpd provider. Would that work?
Until that time I have changed code to
enforce having clock controller in pm resume state when gdsc is
enabled, thus CC itself votes on parent's (rpmhpd) performance state.
--
With best wishes
Dmitry
On Tue, 7 Sept 2021 at 17:34, Ulf Hansson [off-list ref] wrote:
On Sun, 29 Aug 2021 at 17:54, Dmitry Baryshkov
[off-list ref] wrote:
quoted
On Sun, 29 Aug 2021 at 06:51, Stephen Boyd [off-list ref] wrote:
quoted
Quoting Dmitry Baryshkov (2021-08-26 14:56:23)
quoted
On 26/08/2021 21:31, Stephen Boyd wrote:
quoted
Quoting Dmitry Baryshkov (2021-07-27 13:19:56)
quoted
On SM8250 both the display and video clock controllers are powered up by
the MMCX power domain. Handle this by linking clock controllers to the
proper power domain, and using runtime power management to enable and
disable the MMCX power domain.
Dependencies:
- https://lore.kernel.org/linux-arm-msm/20210703005416.2668319-1-bjorn.andersson@linaro.org/
(pending)
Does this patch series need to go through the qcom tree? Presumably the
dependency is going through qcom -> arm-soc
It looks like Bjorn did not apply his patches in the for-5.15 series, so
we'd have to wait anyway. Probably I should rebase these patches instead
on Rajendra's required-opps patch (which is going in this window).
Ok. Thanks. I'll drop it from my queue for now.
Just for the reference. I've sent v7 of this patchset. After thinking
more about power domains relationship, I think we have a hole in the
abstraction here. Currently subdomains cause power domains to be
powered up, but do not dictate the performance level the parent domain
should be working in.
That's not entirely true. In genpd_add_subdomain() we verify that if
the child is powered on, the parent must already be powered on,
otherwise we treat this a bad setup and return an error code.
What seems to be missing though, is that if there is a performance
state applied for the child domain, that should be propagated to the
parent domain too. Right?
quoted
While this does not look like an issue for the
gdsc (and thus it can be easily solved by the Bjorn's patches, which
enforce rpmhpd to be powered on to 'at least lowest possible'
performance state, this might be not the case for the future links. I
think at some point the pd_add_subdomain() interface should be
extended with the ability to specify minimum required performance
state when the link becomes on.
I guess that minimum performance state could be considered as a
"required-opp" in the DT node for the power-domain provider, no?
Yes, up to some point. But this enforces a particular driver code
(that I've had to change from v6 to v7).
In v6 the gdsc's power_on code would pm_runtime_get() the provider
device, power on the domain and the pm_runtime_put() the provider
device. Thus the gdsc genpd would be powered on (keeping parent
domains in the on state), but the provider device itself would be
runtime-suspended (neat idea by Bjorn). However this relied on changes
in rpmhpd behaviour (which still did not make it to linux-next).
In v7 we have to keep the provider device in resumed state while the
gdsc genpd is powered on (to keep the required-opps vote in place).
I suppose that 'child requires minimum parent's performance state'
might become common property at some point, allowing us to drop this
pm_runtime handling.
Another option would simply be to manage this solely in the
platform/soc specific genpd provider. Would that work?
Yes, I've had this in the very old iteration of mmcx fixup patchset
(even before mmcx-regulator came into play). It ended up with quite an
ugly piece of code.
quoted
Until that time I have changed code to
enforce having clock controller in pm resume state when gdsc is
enabled, thus CC itself votes on parent's (rpmhpd) performance state.
--
With best wishes
Dmitry