Lines Matching +full:rpm +full:- +full:msm8996

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>
23 * RPMPD_X is X encoded as a little-endian, lower-case, ASCII string */
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 },
968 pd->res_type, pd->res_id, &req, sizeof(req)); in rpmpd_send_enable()
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()
988 if (pd->active_only) in to_active_sleep()
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()
1034 pd->enabled = true; in rpmpd_power_on()
1036 if (pd->corner) in rpmpd_power_on()
1051 pd->enabled = false; in rpmpd_power_off()
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()
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()
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",
1181 MODULE_DESCRIPTION("Qualcomm Technologies, Inc. RPM Power Domain Driver");