2024-02-10 14:13:39

by Luca Weiss

[permalink] [raw]
Subject: [PATCH 0/3] Add RPMPD support for MSM8974

Add driver support for the RPM power domains found on the different
MSM8974 devices.

Devicetree integration will come at a later point since also some
mostly remoteproc drivers need to be adjusted.

Also the MX power domains on this SoC seems to work quite a bit
differently, we'd need to send raw voltages to it, so these are ignored
in this series.

Signed-off-by: Luca Weiss <[email protected]>
---
Luca Weiss (3):
dt-bindings: power: rpmpd: Add MSM8974 power domains
pmdomain: qcom: rpmpd: Add MSM8974+PM8841 power domains
pmdomain: qcom: rpmpd: Add MSM8974PRO+PMA8084 power domains

.../devicetree/bindings/power/qcom,rpmpd.yaml | 2 +
drivers/pmdomain/qcom/rpmpd.c | 107 +++++++++++++++++++++
include/dt-bindings/power/qcom-rpmpd.h | 8 ++
3 files changed, 117 insertions(+)
---
base-commit: 6e3fa474051f3d276ea708bdb8e8e1f66d1d3ee5
change-id: 20240210-msm8974-rpmpd-6e48fe374275

Best regards,
--
Luca Weiss <[email protected]>



2024-02-10 14:14:06

by Luca Weiss

[permalink] [raw]
Subject: [PATCH 1/3] dt-bindings: power: rpmpd: Add MSM8974 power domains

Add the compatibles and indexes for the rpmpd in MSM8974, both with the
standard PM8841+PM8941 PMICs but also devices found with PMA8084.

Signed-off-by: Luca Weiss <[email protected]>
---
Documentation/devicetree/bindings/power/qcom,rpmpd.yaml | 2 ++
include/dt-bindings/power/qcom-rpmpd.h | 8 ++++++++
2 files changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/qcom,rpmpd.yaml b/Documentation/devicetree/bindings/power/qcom,rpmpd.yaml
index 2ff246cf8b81..929b7ef9c1bc 100644
--- a/Documentation/devicetree/bindings/power/qcom,rpmpd.yaml
+++ b/Documentation/devicetree/bindings/power/qcom,rpmpd.yaml
@@ -24,6 +24,8 @@ properties:
- qcom,msm8917-rpmpd
- qcom,msm8939-rpmpd
- qcom,msm8953-rpmpd
+ - qcom,msm8974-rpmpd
+ - qcom,msm8974pro-pma8084-rpmpd
- qcom,msm8976-rpmpd
- qcom,msm8994-rpmpd
- qcom,msm8996-rpmpd
diff --git a/include/dt-bindings/power/qcom-rpmpd.h b/include/dt-bindings/power/qcom-rpmpd.h
index 7f4e2983a4c5..9f0fe60ba745 100644
--- a/include/dt-bindings/power/qcom-rpmpd.h
+++ b/include/dt-bindings/power/qcom-rpmpd.h
@@ -308,6 +308,14 @@
#define MSM8953_VDDMX 5
#define MSM8953_VDDMX_AO 6

+/* MSM8974 Power Domain Indexes */
+#define MSM8974_VDDCX 0
+#define MSM8974_VDDCX_AO 1
+#define MSM8974_VDDCX_VFC 2
+#define MSM8974_VDDGFX 3
+#define MSM8974_VDDGFX_AO 4
+#define MSM8974_VDDGFX_VFC 5
+
/* MSM8976 Power Domain Indexes */
#define MSM8976_VDDCX 0
#define MSM8976_VDDCX_AO 1

--
2.43.0


2024-02-10 14:14:07

by Luca Weiss

[permalink] [raw]
Subject: [PATCH 3/3] pmdomain: qcom: rpmpd: Add MSM8974PRO+PMA8084 power domains

Add the power domains CX & GFX found on MSM8974 devices that use PMA8084
instead of the standard PM8841+PM8941 combo.

Signed-off-by: Luca Weiss <[email protected]>
---
drivers/pmdomain/qcom/rpmpd.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)

diff --git a/drivers/pmdomain/qcom/rpmpd.c b/drivers/pmdomain/qcom/rpmpd.c
index bb28a7319bed..3cd0d1ad6188 100644
--- a/drivers/pmdomain/qcom/rpmpd.c
+++ b/drivers/pmdomain/qcom/rpmpd.c
@@ -252,6 +252,31 @@ static struct rpmpd cx_s2b_vfc = {
};

/* G(F)X */
+static struct rpmpd gfx_s7a_corner_ao;
+static struct rpmpd gfx_s7a_corner = {
+ .pd = { .name = "gfx", },
+ .peer = &gfx_s7a_corner_ao,
+ .res_type = RPMPD_SMPA,
+ .res_id = 7,
+ .key = KEY_CORNER,
+};
+
+static struct rpmpd gfx_s7a_corner_ao = {
+ .pd = { .name = "gfx_ao", },
+ .peer = &gfx_s7a_corner,
+ .active_only = true,
+ .res_type = RPMPD_SMPA,
+ .res_id = 7,
+ .key = KEY_CORNER,
+};
+
+static struct rpmpd gfx_s7a_vfc = {
+ .pd = { .name = "gfx_vfc", },
+ .res_type = RPMPD_SMPA,
+ .res_id = 7,
+ .key = KEY_FLOOR_CORNER,
+};
+
static struct rpmpd gfx_s2b_corner = {
.pd = { .name = "gfx", },
.res_type = RPMPD_SMPB,
@@ -728,6 +753,21 @@ static const struct rpmpd_desc msm8974_desc = {
.max_state = MAX_CORNER_RPMPD_STATE,
};

+static struct rpmpd *msm8974pro_pma8084_rpmpds[] = {
+ [MSM8974_VDDCX] = &cx_s2a_corner,
+ [MSM8974_VDDCX_AO] = &cx_s2a_corner_ao,
+ [MSM8974_VDDCX_VFC] = &cx_s2a_vfc,
+ [MSM8974_VDDGFX] = &gfx_s7a_corner,
+ [MSM8974_VDDGFX_AO] = &gfx_s7a_corner_ao,
+ [MSM8974_VDDGFX_VFC] = &gfx_s7a_vfc,
+};
+
+static const struct rpmpd_desc msm8974pro_pma8084_desc = {
+ .rpmpds = msm8974pro_pma8084_rpmpds,
+ .num_pds = ARRAY_SIZE(msm8974pro_pma8084_rpmpds),
+ .max_state = MAX_CORNER_RPMPD_STATE,
+};
+
static struct rpmpd *msm8976_rpmpds[] = {
[MSM8976_VDDCX] = &cx_s2a_lvl,
[MSM8976_VDDCX_AO] = &cx_s2a_lvl_ao,
@@ -922,6 +962,7 @@ static const struct of_device_id rpmpd_match_table[] = {
{ .compatible = "qcom,msm8939-rpmpd", .data = &msm8939_desc },
{ .compatible = "qcom,msm8953-rpmpd", .data = &msm8953_desc },
{ .compatible = "qcom,msm8974-rpmpd", .data = &msm8974_desc },
+ { .compatible = "qcom,msm8974pro-pma8084-rpmpd", .data = &msm8974pro_pma8084_desc },
{ .compatible = "qcom,msm8976-rpmpd", .data = &msm8976_desc },
{ .compatible = "qcom,msm8994-rpmpd", .data = &msm8994_desc },
{ .compatible = "qcom,msm8996-rpmpd", .data = &msm8996_desc },

--
2.43.0


2024-02-10 14:14:46

by Luca Weiss

[permalink] [raw]
Subject: [PATCH 2/3] pmdomain: qcom: rpmpd: Add MSM8974+PM8841 power domains

Add the power domains CX & GFX found on devices with MSM8974 and PM8841.

Signed-off-by: Luca Weiss <[email protected]>
---
drivers/pmdomain/qcom/rpmpd.c | 66 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)

diff --git a/drivers/pmdomain/qcom/rpmpd.c b/drivers/pmdomain/qcom/rpmpd.c
index 7796d65f96e8..bb28a7319bed 100644
--- a/drivers/pmdomain/qcom/rpmpd.c
+++ b/drivers/pmdomain/qcom/rpmpd.c
@@ -226,6 +226,31 @@ static struct rpmpd cx_s3a_vfl = {
.key = KEY_FLOOR_LEVEL,
};

+static struct rpmpd cx_s2b_corner_ao;
+static struct rpmpd cx_s2b_corner = {
+ .pd = { .name = "cx", },
+ .peer = &cx_s2b_corner_ao,
+ .res_type = RPMPD_SMPB,
+ .res_id = 2,
+ .key = KEY_CORNER,
+};
+
+static struct rpmpd cx_s2b_corner_ao = {
+ .pd = { .name = "cx_ao", },
+ .peer = &cx_s2b_corner,
+ .active_only = true,
+ .res_type = RPMPD_SMPB,
+ .res_id = 2,
+ .key = KEY_CORNER,
+};
+
+static struct rpmpd cx_s2b_vfc = {
+ .pd = { .name = "cx_vfc", },
+ .res_type = RPMPD_SMPB,
+ .res_id = 2,
+ .key = KEY_FLOOR_CORNER,
+};
+
/* G(F)X */
static struct rpmpd gfx_s2b_corner = {
.pd = { .name = "gfx", },
@@ -241,6 +266,31 @@ static struct rpmpd gfx_s2b_vfc = {
.key = KEY_FLOOR_CORNER,
};

+static struct rpmpd gfx_s4b_corner_ao;
+static struct rpmpd gfx_s4b_corner = {
+ .pd = { .name = "gfx", },
+ .peer = &gfx_s4b_corner_ao,
+ .res_type = RPMPD_SMPB,
+ .res_id = 4,
+ .key = KEY_CORNER,
+};
+
+static struct rpmpd gfx_s4b_corner_ao = {
+ .pd = { .name = "gfx_ao", },
+ .peer = &gfx_s4b_corner,
+ .active_only = true,
+ .res_type = RPMPD_SMPB,
+ .res_id = 4,
+ .key = KEY_CORNER,
+};
+
+static struct rpmpd gfx_s4b_vfc = {
+ .pd = { .name = "gfx_vfc", },
+ .res_type = RPMPD_SMPB,
+ .res_id = 4,
+ .key = KEY_FLOOR_CORNER,
+};
+
static struct rpmpd mx_rwmx0_lvl;
static struct rpmpd gx_rwgx0_lvl_ao;
static struct rpmpd gx_rwgx0_lvl = {
@@ -663,6 +713,21 @@ static const struct rpmpd_desc msm8953_desc = {
.max_state = RPM_SMD_LEVEL_TURBO,
};

+static struct rpmpd *msm8974_rpmpds[] = {
+ [MSM8974_VDDCX] = &cx_s2b_corner,
+ [MSM8974_VDDCX_AO] = &cx_s2b_corner_ao,
+ [MSM8974_VDDCX_VFC] = &cx_s2b_vfc,
+ [MSM8974_VDDGFX] = &gfx_s4b_corner,
+ [MSM8974_VDDGFX_AO] = &gfx_s4b_corner_ao,
+ [MSM8974_VDDGFX_VFC] = &gfx_s4b_vfc,
+};
+
+static const struct rpmpd_desc msm8974_desc = {
+ .rpmpds = msm8974_rpmpds,
+ .num_pds = ARRAY_SIZE(msm8974_rpmpds),
+ .max_state = MAX_CORNER_RPMPD_STATE,
+};
+
static struct rpmpd *msm8976_rpmpds[] = {
[MSM8976_VDDCX] = &cx_s2a_lvl,
[MSM8976_VDDCX_AO] = &cx_s2a_lvl_ao,
@@ -856,6 +921,7 @@ static const struct of_device_id rpmpd_match_table[] = {
{ .compatible = "qcom,msm8917-rpmpd", .data = &msm8917_desc },
{ .compatible = "qcom,msm8939-rpmpd", .data = &msm8939_desc },
{ .compatible = "qcom,msm8953-rpmpd", .data = &msm8953_desc },
+ { .compatible = "qcom,msm8974-rpmpd", .data = &msm8974_desc },
{ .compatible = "qcom,msm8976-rpmpd", .data = &msm8976_desc },
{ .compatible = "qcom,msm8994-rpmpd", .data = &msm8994_desc },
{ .compatible = "qcom,msm8996-rpmpd", .data = &msm8996_desc },

--
2.43.0


2024-02-10 14:20:23

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH 2/3] pmdomain: qcom: rpmpd: Add MSM8974+PM8841 power domains



On 2/10/24 15:12, Luca Weiss wrote:
> Add the power domains CX & GFX found on devices with MSM8974 and PM8841.
>
> Signed-off-by: Luca Weiss <[email protected]>
> ---

[...]

> +static struct rpmpd gfx_s4b_corner_ao;
> +static struct rpmpd gfx_s4b_corner = {
> + .pd = { .name = "gfx", },
> + .peer = &gfx_s4b_corner_ao,
> + .res_type = RPMPD_SMPB,
> + .res_id = 4,
> + .key = KEY_CORNER,
> +};
> +
> +static struct rpmpd gfx_s4b_corner_ao = {
> + .pd = { .name = "gfx_ao", },
> + .peer = &gfx_s4b_corner,
> + .active_only = true,
> + .res_type = RPMPD_SMPB,
> + .res_id = 4,
> + .key = KEY_CORNER,
> +};

I don't see a s4b_ao downstream.. Though it's very unfortunate we
didn't choose to add power-domain-cells or sth and set the bucket
through that..

Konrad

2024-02-10 14:23:24

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH 3/3] pmdomain: qcom: rpmpd: Add MSM8974PRO+PMA8084 power domains



On 2/10/24 15:12, Luca Weiss wrote:
> Add the power domains CX & GFX found on MSM8974 devices that use PMA8084
> instead of the standard PM8841+PM8941 combo.
>
> Signed-off-by: Luca Weiss <[email protected]>
> ---

Same comment as p2, gfx_ao may not make much sense on this
platform

Konrad

2024-02-11 14:15:24

by Luca Weiss

[permalink] [raw]
Subject: Re: [PATCH 2/3] pmdomain: qcom: rpmpd: Add MSM8974+PM8841 power domains

On Samstag, 10. Februar 2024 15:19:54 CET Konrad Dybcio wrote:
> On 2/10/24 15:12, Luca Weiss wrote:
> > Add the power domains CX & GFX found on devices with MSM8974 and PM8841.
> >
> > Signed-off-by: Luca Weiss <[email protected]>
> > ---
>
> [...]
>
> > +static struct rpmpd gfx_s4b_corner_ao;
> > +static struct rpmpd gfx_s4b_corner = {
> > + .pd = { .name = "gfx", },
> > + .peer = &gfx_s4b_corner_ao,
> > + .res_type = RPMPD_SMPB,
> > + .res_id = 4,
> > + .key = KEY_CORNER,
> > +};
> > +
> > +static struct rpmpd gfx_s4b_corner_ao = {
> > + .pd = { .name = "gfx_ao", },
> > + .peer = &gfx_s4b_corner,
> > + .active_only = true,
> > + .res_type = RPMPD_SMPB,
> > + .res_id = 4,
> > + .key = KEY_CORNER,
> > +};
>
> I don't see a s4b_ao downstream.. Though it's very unfortunate we
> didn't choose to add power-domain-cells or sth and set the bucket
> through that..

Right, overlooked that. Will drop gfx_ao for both this and the other patch.

Regards
Luca

>
> Konrad