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

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
15 #include <linux/soc/qcom/smd-rpm.h>
20 * struct qcom_smd_rpm - state of the rpm device driver
22 * @dev: rpm device
25 * @ack_status: result of the rpm request
37 * struct qcom_rpm_header - header for all rpm requests and responses
47 * struct qcom_rpm_request - request message to the rpm
63 * struct qcom_rpm_message - response message from the rpm
67 * @message: textual message from the rpm
69 * Multiple of these messages can be stacked in an rpm message.
86 * qcom_rpm_smd_write - write @buf to @type:@id
87 * @rpm: rpm handle
94 int qcom_rpm_smd_write(struct qcom_smd_rpm *rpm, in qcom_rpm_smd_write() argument
110 /* SMD packets to the RPM may not exceed 256 bytes */ in qcom_rpm_smd_write()
112 return -EINVAL; in qcom_rpm_smd_write()
116 return -ENOMEM; in qcom_rpm_smd_write()
118 mutex_lock(&rpm->lock); in qcom_rpm_smd_write()
120 pkt->hdr.service_type = cpu_to_le32(RPM_SERVICE_TYPE_REQUEST); in qcom_rpm_smd_write()
121 pkt->hdr.length = cpu_to_le32(sizeof(struct qcom_rpm_request) + count); in qcom_rpm_smd_write()
123 pkt->req.msg_id = cpu_to_le32(msg_id++); in qcom_rpm_smd_write()
124 pkt->req.flags = cpu_to_le32(state); in qcom_rpm_smd_write()
125 pkt->req.type = cpu_to_le32(type); in qcom_rpm_smd_write()
126 pkt->req.id = cpu_to_le32(id); in qcom_rpm_smd_write()
127 pkt->req.data_len = cpu_to_le32(count); in qcom_rpm_smd_write()
128 memcpy(pkt->payload, buf, count); in qcom_rpm_smd_write()
130 ret = rpmsg_send(rpm->rpm_channel, pkt, size); in qcom_rpm_smd_write()
134 left = wait_for_completion_timeout(&rpm->ack, RPM_REQUEST_TIMEOUT); in qcom_rpm_smd_write()
136 ret = -ETIMEDOUT; in qcom_rpm_smd_write()
138 ret = rpm->ack_status; in qcom_rpm_smd_write()
142 mutex_unlock(&rpm->lock); in qcom_rpm_smd_write()
154 size_t hdr_length = le32_to_cpu(hdr->length); in qcom_smd_rpm_callback()
156 struct qcom_smd_rpm *rpm = dev_get_drvdata(&rpdev->dev); in qcom_smd_rpm_callback() local
163 if (le32_to_cpu(hdr->service_type) != RPM_SERVICE_TYPE_REQUEST || in qcom_smd_rpm_callback()
165 dev_err(rpm->dev, "invalid request\n"); in qcom_smd_rpm_callback()
171 msg_length = le32_to_cpu(msg->length); in qcom_smd_rpm_callback()
172 switch (le32_to_cpu(msg->msg_type)) { in qcom_smd_rpm_callback()
177 memcpy_fromio(msgbuf, msg->message, len); in qcom_smd_rpm_callback()
178 msgbuf[len - 1] = 0; in qcom_smd_rpm_callback()
181 status = -ENXIO; in qcom_smd_rpm_callback()
183 status = -EINVAL; in qcom_smd_rpm_callback()
190 rpm->ack_status = status; in qcom_smd_rpm_callback()
191 complete(&rpm->ack); in qcom_smd_rpm_callback()
197 struct qcom_smd_rpm *rpm; in qcom_smd_rpm_probe() local
199 rpm = devm_kzalloc(&rpdev->dev, sizeof(*rpm), GFP_KERNEL); in qcom_smd_rpm_probe()
200 if (!rpm) in qcom_smd_rpm_probe()
201 return -ENOMEM; in qcom_smd_rpm_probe()
203 mutex_init(&rpm->lock); in qcom_smd_rpm_probe()
204 init_completion(&rpm->ack); in qcom_smd_rpm_probe()
206 rpm->dev = &rpdev->dev; in qcom_smd_rpm_probe()
207 rpm->rpm_channel = rpdev->ept; in qcom_smd_rpm_probe()
208 dev_set_drvdata(&rpdev->dev, rpm); in qcom_smd_rpm_probe()
210 return of_platform_populate(rpdev->dev.of_node, NULL, NULL, &rpdev->dev); in qcom_smd_rpm_probe()
215 of_platform_depopulate(&rpdev->dev); in qcom_smd_rpm_remove()
219 { .compatible = "qcom,glink-smd-rpm" },
220 { .compatible = "qcom,smd-rpm" },
225 { .compatible = "qcom,rpm-apq8084" },
226 { .compatible = "qcom,rpm-ipq6018" },
227 { .compatible = "qcom,rpm-ipq9574" },
228 { .compatible = "qcom,rpm-msm8226" },
229 { .compatible = "qcom,rpm-msm8909" },
230 { .compatible = "qcom,rpm-msm8916" },
231 { .compatible = "qcom,rpm-msm8936" },
232 { .compatible = "qcom,rpm-msm8953" },
233 { .compatible = "qcom,rpm-msm8974" },
234 { .compatible = "qcom,rpm-msm8976" },
235 { .compatible = "qcom,rpm-msm8994" },
236 { .compatible = "qcom,rpm-msm8996" },
237 { .compatible = "qcom,rpm-msm8998" },
238 { .compatible = "qcom,rpm-sdm660" },
239 { .compatible = "qcom,rpm-sm6115" },
240 { .compatible = "qcom,rpm-sm6125" },
241 { .compatible = "qcom,rpm-sm6375" },
242 { .compatible = "qcom,rpm-qcm2290" },
243 { .compatible = "qcom,rpm-qcs404" },
271 MODULE_DESCRIPTION("Qualcomm SMD backed RPM driver");