Lines Matching +full:smd +full:- +full:rpm
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>
21 * RPMPD_X is X encoded as a little-endian, lower-case, ASCII string */
106 struct qcom_smd_rpm *rpm; member
119 /* msm8976 RPM Power Domains */
141 /* msm8996 RPM Power domains */
165 /* msm8998 RPM Power domains */
197 /* qcs404 RPM Power domains */
224 { .compatible = "qcom,msm8976-rpmpd", .data = &msm8976_desc },
225 { .compatible = "qcom,msm8996-rpmpd", .data = &msm8996_desc },
226 { .compatible = "qcom,msm8998-rpmpd", .data = &msm8998_desc },
227 { .compatible = "qcom,qcs404-rpmpd", .data = &qcs404_desc },
240 return qcom_rpm_smd_write(pd->rpm, QCOM_SMD_RPM_ACTIVE_STATE, in rpmpd_send_enable()
241 pd->res_type, pd->res_id, &req, sizeof(req)); in rpmpd_send_enable()
247 .key = pd->key, in rpmpd_send_corner()
252 return qcom_rpm_smd_write(pd->rpm, state, pd->res_type, pd->res_id, in rpmpd_send_corner()
261 if (pd->active_only) in to_active_sleep()
270 struct rpmpd *peer = pd->peer; in rpmpd_aggregate_corner()
275 to_active_sleep(pd, pd->corner, &this_active_corner, &this_sleep_corner); in rpmpd_aggregate_corner()
277 if (peer && peer->enabled) in rpmpd_aggregate_corner()
278 to_active_sleep(peer, peer->corner, &peer_active_corner, in rpmpd_aggregate_corner()
303 pd->enabled = true; in rpmpd_power_on()
305 if (pd->corner) in rpmpd_power_on()
323 pd->enabled = false; in rpmpd_power_off()
336 if (state > pd->max_state) in rpmpd_set_performance()
337 state = pd->max_state; in rpmpd_set_performance()
341 pd->corner = state; in rpmpd_set_performance()
344 if (!pd->enabled && pd->key != KEY_FLOOR_CORNER && in rpmpd_set_performance()
345 pd->key != KEY_FLOOR_LEVEL) in rpmpd_set_performance()
367 struct qcom_smd_rpm *rpm; in rpmpd_probe() local
371 rpm = dev_get_drvdata(pdev->dev.parent); in rpmpd_probe()
372 if (!rpm) { in rpmpd_probe()
373 dev_err(&pdev->dev, "Unable to retrieve handle to RPM\n"); in rpmpd_probe()
374 return -ENODEV; in rpmpd_probe()
377 desc = of_device_get_match_data(&pdev->dev); in rpmpd_probe()
379 return -EINVAL; in rpmpd_probe()
381 rpmpds = desc->rpmpds; in rpmpd_probe()
382 num = desc->num_pds; in rpmpd_probe()
384 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); in rpmpd_probe()
386 return -ENOMEM; in rpmpd_probe()
388 data->domains = devm_kcalloc(&pdev->dev, num, sizeof(*data->domains), in rpmpd_probe()
390 data->num_domains = num; in rpmpd_probe()
394 dev_warn(&pdev->dev, "rpmpds[] with empty entry at index=%d\n", in rpmpd_probe()
399 rpmpds[i]->rpm = rpm; in rpmpd_probe()
400 rpmpds[i]->max_state = desc->max_state; in rpmpd_probe()
401 rpmpds[i]->pd.power_off = rpmpd_power_off; in rpmpd_probe()
402 rpmpds[i]->pd.power_on = rpmpd_power_on; in rpmpd_probe()
403 rpmpds[i]->pd.set_performance_state = rpmpd_set_performance; in rpmpd_probe()
404 rpmpds[i]->pd.opp_to_performance_state = rpmpd_get_performance; in rpmpd_probe()
405 pm_genpd_init(&rpmpds[i]->pd, NULL, true); in rpmpd_probe()
407 data->domains[i] = &rpmpds[i]->pd; in rpmpd_probe()
410 return of_genpd_add_provider_onecell(pdev->dev.of_node, data); in rpmpd_probe()
415 .name = "qcom-rpmpd",
428 MODULE_DESCRIPTION("Qualcomm Technologies, Inc. RPM Power Domain Driver");