diff mbox series

[2/3] pmdomain: qcom: rpmpd: Add MSM8974+PM8841 power domains

Message ID 20240210-msm8974-rpmpd-v1-2-de9355e6842a@z3ntu.xyz (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series Add RPMPD support for MSM8974 | expand

Commit Message

Luca Weiss Feb. 10, 2024, 2:12 p.m. UTC
Add the power domains CX & GFX found on devices with MSM8974 and PM8841.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
 drivers/pmdomain/qcom/rpmpd.c | 66 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

Comments

Konrad Dybcio Feb. 10, 2024, 2:19 p.m. UTC | #1
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 <luca@z3ntu.xyz>
> ---

[...]

> +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
Luca Weiss Feb. 10, 2024, 4:31 p.m. UTC | #2
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 <luca@z3ntu.xyz>
> > ---
> 
> [...]
> 
> > +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
diff mbox series

Patch

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 },