hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/soc/qcom/smd-rpm.c
....@@ -1,15 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2015, Sony Mobile Communications AB.
34 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License version 2 and
7
- * only version 2 as published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
135 */
146
157 #include <linux/module.h>
....@@ -27,12 +19,15 @@
2719 /**
2820 * struct qcom_smd_rpm - state of the rpm device driver
2921 * @rpm_channel: reference to the smd channel
22
+ * @icc: interconnect proxy device
23
+ * @dev: rpm device
3024 * @ack: completion for acks
3125 * @lock: mutual exclusion around the send/complete pair
3226 * @ack_status: result of the rpm request
3327 */
3428 struct qcom_smd_rpm {
3529 struct rpmsg_endpoint *rpm_channel;
30
+ struct platform_device *icc;
3631 struct device *dev;
3732
3833 struct completion ack;
....@@ -92,6 +87,7 @@
9287 /**
9388 * qcom_rpm_smd_write - write @buf to @type:@id
9489 * @rpm: rpm handle
90
+ * @state: active/sleep state flags
9591 * @type: resource type
9692 * @id: resource identifier
9793 * @buf: the data to be written
....@@ -201,6 +197,7 @@
201197 static int qcom_smd_rpm_probe(struct rpmsg_device *rpdev)
202198 {
203199 struct qcom_smd_rpm *rpm;
200
+ int ret;
204201
205202 rpm = devm_kzalloc(&rpdev->dev, sizeof(*rpm), GFP_KERNEL);
206203 if (!rpm)
....@@ -213,20 +210,38 @@
213210 rpm->rpm_channel = rpdev->ept;
214211 dev_set_drvdata(&rpdev->dev, rpm);
215212
216
- return of_platform_populate(rpdev->dev.of_node, NULL, NULL, &rpdev->dev);
213
+ rpm->icc = platform_device_register_data(&rpdev->dev, "icc_smd_rpm", -1,
214
+ NULL, 0);
215
+ if (IS_ERR(rpm->icc))
216
+ return PTR_ERR(rpm->icc);
217
+
218
+ ret = of_platform_populate(rpdev->dev.of_node, NULL, NULL, &rpdev->dev);
219
+ if (ret)
220
+ platform_device_unregister(rpm->icc);
221
+
222
+ return ret;
217223 }
218224
219225 static void qcom_smd_rpm_remove(struct rpmsg_device *rpdev)
220226 {
227
+ struct qcom_smd_rpm *rpm = dev_get_drvdata(&rpdev->dev);
228
+
229
+ platform_device_unregister(rpm->icc);
221230 of_platform_depopulate(&rpdev->dev);
222231 }
223232
224233 static const struct of_device_id qcom_smd_rpm_of_match[] = {
225234 { .compatible = "qcom,rpm-apq8084" },
235
+ { .compatible = "qcom,rpm-ipq6018" },
226236 { .compatible = "qcom,rpm-msm8916" },
237
+ { .compatible = "qcom,rpm-msm8936" },
227238 { .compatible = "qcom,rpm-msm8974" },
239
+ { .compatible = "qcom,rpm-msm8976" },
240
+ { .compatible = "qcom,rpm-msm8994" },
228241 { .compatible = "qcom,rpm-msm8996" },
229242 { .compatible = "qcom,rpm-msm8998" },
243
+ { .compatible = "qcom,rpm-sdm660" },
244
+ { .compatible = "qcom,rpm-qcs404" },
230245 {}
231246 };
232247 MODULE_DEVICE_TABLE(of, qcom_smd_rpm_of_match);