Lines Matching +full:msm8996 +full:- +full:rpmpd

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. */
14 #include <linux/soc/qcom/smd-rpm.h>
16 #include <dt-bindings/power/qcom-rpmpd.h>
18 #define domain_to_rpmpd(domain) container_of(domain, struct rpmpd, pd)
23 * RPMPD_X is X encoded as a little-endian, lower-case, ASCII string */
51 struct rpmpd { struct
54 struct rpmpd *peer; argument
66 struct rpmpd **rpmpds; argument
74 static struct rpmpd cx_rwcx0_lvl_ao;
75 static struct rpmpd cx_rwcx0_lvl = {
83 static struct rpmpd cx_rwcx0_lvl_ao = {
92 static struct rpmpd cx_s1a_corner_ao;
93 static struct rpmpd cx_s1a_corner = {
101 static struct rpmpd cx_s1a_corner_ao = {
110 static struct rpmpd cx_s1a_lvl_ao;
111 static struct rpmpd cx_s1a_lvl = {
119 static struct rpmpd cx_s1a_lvl_ao = {
128 static struct rpmpd cx_s2a_corner_ao;
129 static struct rpmpd cx_s2a_corner = {
137 static struct rpmpd cx_s2a_corner_ao = {
146 static struct rpmpd cx_s2a_lvl_ao;
147 static struct rpmpd cx_s2a_lvl = {
155 static struct rpmpd cx_s2a_lvl_ao = {
164 static struct rpmpd cx_s3a_lvl_ao;
165 static struct rpmpd cx_s3a_lvl = {
173 static struct rpmpd cx_s3a_lvl_ao = {
182 static struct rpmpd cx_rwcx0_vfl = {
189 static struct rpmpd cx_rwsc2_vfl = {
196 static struct rpmpd cx_s1a_vfc = {
203 static struct rpmpd cx_s1a_vfl = {
210 static struct rpmpd cx_s2a_vfc = {
217 static struct rpmpd cx_s2a_vfl = {
224 static struct rpmpd cx_s3a_vfl = {
231 static struct rpmpd cx_s2b_corner_ao;
232 static struct rpmpd cx_s2b_corner = {
240 static struct rpmpd cx_s2b_corner_ao = {
249 static struct rpmpd cx_s2b_vfc = {
257 static struct rpmpd gfx_s7a_corner = {
264 static struct rpmpd gfx_s7a_vfc = {
271 static struct rpmpd gfx_s2b_corner = {
278 static struct rpmpd gfx_s2b_vfc = {
285 static struct rpmpd gfx_s4b_corner = {
292 static struct rpmpd gfx_s4b_vfc = {
299 static struct rpmpd mx_rwmx0_lvl;
300 static struct rpmpd gx_rwgx0_lvl_ao;
301 static struct rpmpd gx_rwgx0_lvl = {
310 static struct rpmpd mx_rwmx0_lvl_ao;
311 static struct rpmpd gx_rwgx0_lvl_ao = {
322 static struct rpmpd mx_l2a_lvl_ao;
323 static struct rpmpd mx_l2a_lvl = {
331 static struct rpmpd mx_l2a_lvl_ao = {
340 static struct rpmpd mx_l3a_corner_ao;
341 static struct rpmpd mx_l3a_corner = {
349 static struct rpmpd mx_l3a_corner_ao = {
358 static struct rpmpd mx_l3a_lvl_ao;
359 static struct rpmpd mx_l3a_lvl = {
367 static struct rpmpd mx_l3a_lvl_ao = {
376 static struct rpmpd mx_l12a_lvl_ao;
377 static struct rpmpd mx_l12a_lvl = {
385 static struct rpmpd mx_l12a_lvl_ao = {
394 static struct rpmpd mx_s2a_corner_ao;
395 static struct rpmpd mx_s2a_corner = {
403 static struct rpmpd mx_s2a_corner_ao = {
412 static struct rpmpd mx_rwmx0_lvl_ao;
413 static struct rpmpd mx_rwmx0_lvl = {
421 static struct rpmpd mx_rwmx0_lvl_ao = {
430 static struct rpmpd mx_s6a_lvl_ao;
431 static struct rpmpd mx_s6a_lvl = {
439 static struct rpmpd mx_s6a_lvl_ao = {
448 static struct rpmpd mx_s7a_lvl_ao;
449 static struct rpmpd mx_s7a_lvl = {
457 static struct rpmpd mx_s7a_lvl_ao = {
466 static struct rpmpd mx_l12a_vfl = {
473 static struct rpmpd mx_rwmx0_vfl = {
480 static struct rpmpd mx_rwsm6_vfl = {
488 static struct rpmpd md_s1a_corner_ao;
489 static struct rpmpd md_s1a_corner = {
497 static struct rpmpd md_s1a_corner_ao = {
506 static struct rpmpd md_s1a_lvl_ao;
507 static struct rpmpd md_s1a_lvl = {
515 static struct rpmpd md_s1a_lvl_ao = {
524 static struct rpmpd md_s1a_vfc = {
532 static struct rpmpd lpi_cx_rwlc0_lvl = {
539 static struct rpmpd lpi_cx_rwlc0_vfl = {
547 static struct rpmpd lpi_mx_rwlm0_lvl = {
554 static struct rpmpd lpi_mx_rwlm0_vfl = {
562 static struct rpmpd ssc_cx_l26a_corner = {
569 static struct rpmpd ssc_cx_rwlc0_lvl = {
576 static struct rpmpd ssc_cx_rwsc0_lvl = {
583 static struct rpmpd ssc_cx_l26a_vfc = {
590 static struct rpmpd ssc_cx_rwlc0_vfl = {
597 static struct rpmpd ssc_cx_rwsc0_vfl = {
605 static struct rpmpd ssc_mx_rwlm0_lvl = {
612 static struct rpmpd ssc_mx_rwsm0_lvl = {
619 static struct rpmpd ssc_mx_rwlm0_vfl = {
626 static struct rpmpd ssc_mx_rwsm0_vfl = {
633 static struct rpmpd *mdm9607_rpmpds[] = {
648 static struct rpmpd *msm8226_rpmpds[] = {
660 static struct rpmpd *msm8939_rpmpds[] = {
677 static struct rpmpd *msm8916_rpmpds[] = {
691 static struct rpmpd *msm8917_rpmpds[] = {
705 static struct rpmpd *msm8953_rpmpds[] = {
721 static struct rpmpd *msm8974_rpmpds[] = {
735 static struct rpmpd *msm8974pro_pma8084_rpmpds[] = {
749 static struct rpmpd *msm8976_rpmpds[] = {
764 static struct rpmpd *msm8994_rpmpds[] = {
782 static struct rpmpd *msm8996_rpmpds[] = {
798 static struct rpmpd *msm8998_rpmpds[] = {
817 static struct rpmpd *qcs404_rpmpds[] = {
833 static struct rpmpd *qm215_rpmpds[] = {
847 static struct rpmpd *sdm660_rpmpds[] = {
866 static struct rpmpd *sm6115_rpmpds[] = {
883 static struct rpmpd *sm6125_rpmpds[] = {
898 static struct rpmpd *sm6375_rpmpds[] = {
917 static struct rpmpd *qcm2290_rpmpds[] = {
935 { .compatible = "qcom,mdm9607-rpmpd", .data = &mdm9607_desc },
936 { .compatible = "qcom,msm8226-rpmpd", .data = &msm8226_desc },
937 { .compatible = "qcom,msm8909-rpmpd", .data = &msm8916_desc },
938 { .compatible = "qcom,msm8916-rpmpd", .data = &msm8916_desc },
939 { .compatible = "qcom,msm8917-rpmpd", .data = &msm8917_desc },
940 { .compatible = "qcom,msm8939-rpmpd", .data = &msm8939_desc },
941 { .compatible = "qcom,msm8953-rpmpd", .data = &msm8953_desc },
942 { .compatible = "qcom,msm8974-rpmpd", .data = &msm8974_desc },
943 { .compatible = "qcom,msm8974pro-pma8084-rpmpd", .data = &msm8974pro_pma8084_desc },
944 { .compatible = "qcom,msm8976-rpmpd", .data = &msm8976_desc },
945 { .compatible = "qcom,msm8994-rpmpd", .data = &msm8994_desc },
946 { .compatible = "qcom,msm8996-rpmpd", .data = &msm8996_desc },
947 { .compatible = "qcom,msm8998-rpmpd", .data = &msm8998_desc },
948 { .compatible = "qcom,qcm2290-rpmpd", .data = &qcm2290_desc },
949 { .compatible = "qcom,qcs404-rpmpd", .data = &qcs404_desc },
950 { .compatible = "qcom,qm215-rpmpd", .data = &qm215_desc },
951 { .compatible = "qcom,sdm660-rpmpd", .data = &sdm660_desc },
952 { .compatible = "qcom,sm6115-rpmpd", .data = &sm6115_desc },
953 { .compatible = "qcom,sm6125-rpmpd", .data = &sm6125_desc },
954 { .compatible = "qcom,sm6375-rpmpd", .data = &sm6375_desc },
959 static int rpmpd_send_enable(struct rpmpd *pd, bool enable) in rpmpd_send_enable()
968 pd->res_type, pd->res_id, &req, sizeof(req)); in rpmpd_send_enable()
971 static int rpmpd_send_corner(struct rpmpd *pd, int state, unsigned int corner) in rpmpd_send_corner()
974 .key = pd->key, in rpmpd_send_corner()
979 return qcom_rpm_smd_write(rpmpd_smd_rpm, state, pd->res_type, pd->res_id, in rpmpd_send_corner()
983 static void to_active_sleep(struct rpmpd *pd, unsigned int corner, in to_active_sleep()
988 if (pd->active_only) in to_active_sleep()
994 static int rpmpd_aggregate_corner(struct rpmpd *pd) in rpmpd_aggregate_corner()
997 struct rpmpd *peer = pd->peer; in rpmpd_aggregate_corner()
1003 if (!pd->state_synced) in rpmpd_aggregate_corner()
1004 this_active_corner = this_sleep_corner = pd->max_state - 1; in rpmpd_aggregate_corner()
1006 to_active_sleep(pd, pd->corner, &this_active_corner, &this_sleep_corner); in rpmpd_aggregate_corner()
1008 if (peer && peer->enabled) in rpmpd_aggregate_corner()
1009 to_active_sleep(peer, peer->corner, &peer_active_corner, in rpmpd_aggregate_corner()
1026 struct rpmpd *pd = domain_to_rpmpd(domain); in rpmpd_power_on()
1034 pd->enabled = true; in rpmpd_power_on()
1036 if (pd->corner) in rpmpd_power_on()
1045 struct rpmpd *pd = domain_to_rpmpd(domain); in rpmpd_power_off()
1051 pd->enabled = false; in rpmpd_power_off()
1061 struct rpmpd *pd = domain_to_rpmpd(domain); in rpmpd_set_performance()
1063 if (state > pd->max_state) in rpmpd_set_performance()
1064 state = pd->max_state; in rpmpd_set_performance()
1068 pd->corner = state; in rpmpd_set_performance()
1071 if (!pd->enabled && pd->key != cpu_to_le32(KEY_FLOOR_CORNER) && in rpmpd_set_performance()
1072 pd->key != cpu_to_le32(KEY_FLOOR_LEVEL)) in rpmpd_set_performance()
1083 struct rpmpd **rpmpds; in rpmpd_probe()
1086 rpmpd_smd_rpm = dev_get_drvdata(pdev->dev.parent); in rpmpd_probe()
1088 dev_err(&pdev->dev, "Unable to retrieve handle to RPM\n"); in rpmpd_probe()
1089 return -ENODEV; in rpmpd_probe()
1092 desc = of_device_get_match_data(&pdev->dev); in rpmpd_probe()
1094 return -EINVAL; in rpmpd_probe()
1096 rpmpds = desc->rpmpds; in rpmpd_probe()
1097 num = desc->num_pds; in rpmpd_probe()
1099 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); in rpmpd_probe()
1101 return -ENOMEM; in rpmpd_probe()
1103 data->domains = devm_kcalloc(&pdev->dev, num, sizeof(*data->domains), in rpmpd_probe()
1105 if (!data->domains) in rpmpd_probe()
1106 return -ENOMEM; in rpmpd_probe()
1108 data->num_domains = num; in rpmpd_probe()
1112 dev_warn(&pdev->dev, "rpmpds[] with empty entry at index=%d\n", in rpmpd_probe()
1117 rpmpds[i]->max_state = desc->max_state; in rpmpd_probe()
1118 rpmpds[i]->pd.power_off = rpmpd_power_off; in rpmpd_probe()
1119 rpmpds[i]->pd.power_on = rpmpd_power_on; in rpmpd_probe()
1120 rpmpds[i]->pd.set_performance_state = rpmpd_set_performance; in rpmpd_probe()
1121 rpmpds[i]->pd.flags = GENPD_FLAG_ACTIVE_WAKEUP; in rpmpd_probe()
1122 pm_genpd_init(&rpmpds[i]->pd, NULL, true); in rpmpd_probe()
1124 data->domains[i] = &rpmpds[i]->pd; in rpmpd_probe()
1132 if (rpmpds[i]->parent) in rpmpd_probe()
1133 pm_genpd_add_subdomain(rpmpds[i]->parent, &rpmpds[i]->pd); in rpmpd_probe()
1136 return of_genpd_add_provider_onecell(pdev->dev.of_node, data); in rpmpd_probe()
1142 struct rpmpd **rpmpds = desc->rpmpds; in rpmpd_sync_state()
1143 struct rpmpd *pd; in rpmpd_sync_state()
1148 for (i = 0; i < desc->num_pds; i++) { in rpmpd_sync_state()
1153 pd->state_synced = true; in rpmpd_sync_state()
1155 if (!pd->enabled) in rpmpd_sync_state()
1156 pd->corner = 0; in rpmpd_sync_state()
1160 dev_err(dev, "failed to sync %s: %d\n", pd->pd.name, ret); in rpmpd_sync_state()
1167 .name = "qcom-rpmpd",