1 // SPDX-License-Identifier: GPL-2.0
3 * RPM over SMD communication wrapper for interconnects
5 * Copyright (C) 2019 Linaro Ltd
6 * Author: Georgi Djakov <georgi.djakov@linaro.org>
9 #include <linux/interconnect-provider.h>
10 #include <linux/module.h>
12 #include <linux/of_platform.h>
13 #include <linux/platform_device.h>
14 #include <linux/soc/qcom/smd-rpm.h>
18 #define RPM_KEY_BW 0x00007762
20 static struct qcom_smd_rpm *icc_smd_rpm;
22 struct icc_rpm_smd_req {
28 bool qcom_icc_rpm_smd_available(void)
32 EXPORT_SYMBOL_GPL(qcom_icc_rpm_smd_available);
34 int qcom_icc_rpm_smd_send(int ctx, int rsc_type, int id, u32 val)
36 struct icc_rpm_smd_req req = {
37 .key = cpu_to_le32(RPM_KEY_BW),
38 .nbytes = cpu_to_le32(sizeof(u32)),
39 .value = cpu_to_le32(val),
42 return qcom_rpm_smd_write(icc_smd_rpm, ctx, rsc_type, id, &req,
45 EXPORT_SYMBOL_GPL(qcom_icc_rpm_smd_send);
47 static int qcom_icc_rpm_smd_remove(struct platform_device *pdev)
54 static int qcom_icc_rpm_smd_probe(struct platform_device *pdev)
56 icc_smd_rpm = dev_get_drvdata(pdev->dev.parent);
59 dev_err(&pdev->dev, "unable to retrieve handle to RPM\n");
66 static struct platform_driver qcom_interconnect_rpm_smd_driver = {
68 .name = "icc_smd_rpm",
70 .probe = qcom_icc_rpm_smd_probe,
71 .remove = qcom_icc_rpm_smd_remove,
73 module_platform_driver(qcom_interconnect_rpm_smd_driver);
74 MODULE_AUTHOR("Georgi Djakov <georgi.djakov@linaro.org>");
75 MODULE_DESCRIPTION("Qualcomm SMD RPM interconnect proxy driver");
76 MODULE_LICENSE("GPL v2");
77 MODULE_ALIAS("platform:icc_smd_rpm");