.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2015, Sony Mobile Communications AB. |
---|
3 | 4 | * 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. |
---|
13 | 5 | */ |
---|
14 | 6 | |
---|
15 | 7 | #include <linux/module.h> |
---|
.. | .. |
---|
27 | 19 | /** |
---|
28 | 20 | * struct qcom_smd_rpm - state of the rpm device driver |
---|
29 | 21 | * @rpm_channel: reference to the smd channel |
---|
| 22 | + * @icc: interconnect proxy device |
---|
| 23 | + * @dev: rpm device |
---|
30 | 24 | * @ack: completion for acks |
---|
31 | 25 | * @lock: mutual exclusion around the send/complete pair |
---|
32 | 26 | * @ack_status: result of the rpm request |
---|
33 | 27 | */ |
---|
34 | 28 | struct qcom_smd_rpm { |
---|
35 | 29 | struct rpmsg_endpoint *rpm_channel; |
---|
| 30 | + struct platform_device *icc; |
---|
36 | 31 | struct device *dev; |
---|
37 | 32 | |
---|
38 | 33 | struct completion ack; |
---|
.. | .. |
---|
92 | 87 | /** |
---|
93 | 88 | * qcom_rpm_smd_write - write @buf to @type:@id |
---|
94 | 89 | * @rpm: rpm handle |
---|
| 90 | + * @state: active/sleep state flags |
---|
95 | 91 | * @type: resource type |
---|
96 | 92 | * @id: resource identifier |
---|
97 | 93 | * @buf: the data to be written |
---|
.. | .. |
---|
201 | 197 | static int qcom_smd_rpm_probe(struct rpmsg_device *rpdev) |
---|
202 | 198 | { |
---|
203 | 199 | struct qcom_smd_rpm *rpm; |
---|
| 200 | + int ret; |
---|
204 | 201 | |
---|
205 | 202 | rpm = devm_kzalloc(&rpdev->dev, sizeof(*rpm), GFP_KERNEL); |
---|
206 | 203 | if (!rpm) |
---|
.. | .. |
---|
213 | 210 | rpm->rpm_channel = rpdev->ept; |
---|
214 | 211 | dev_set_drvdata(&rpdev->dev, rpm); |
---|
215 | 212 | |
---|
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; |
---|
217 | 223 | } |
---|
218 | 224 | |
---|
219 | 225 | static void qcom_smd_rpm_remove(struct rpmsg_device *rpdev) |
---|
220 | 226 | { |
---|
| 227 | + struct qcom_smd_rpm *rpm = dev_get_drvdata(&rpdev->dev); |
---|
| 228 | + |
---|
| 229 | + platform_device_unregister(rpm->icc); |
---|
221 | 230 | of_platform_depopulate(&rpdev->dev); |
---|
222 | 231 | } |
---|
223 | 232 | |
---|
224 | 233 | static const struct of_device_id qcom_smd_rpm_of_match[] = { |
---|
225 | 234 | { .compatible = "qcom,rpm-apq8084" }, |
---|
| 235 | + { .compatible = "qcom,rpm-ipq6018" }, |
---|
226 | 236 | { .compatible = "qcom,rpm-msm8916" }, |
---|
| 237 | + { .compatible = "qcom,rpm-msm8936" }, |
---|
227 | 238 | { .compatible = "qcom,rpm-msm8974" }, |
---|
| 239 | + { .compatible = "qcom,rpm-msm8976" }, |
---|
| 240 | + { .compatible = "qcom,rpm-msm8994" }, |
---|
228 | 241 | { .compatible = "qcom,rpm-msm8996" }, |
---|
229 | 242 | { .compatible = "qcom,rpm-msm8998" }, |
---|
| 243 | + { .compatible = "qcom,rpm-sdm660" }, |
---|
| 244 | + { .compatible = "qcom,rpm-qcs404" }, |
---|
230 | 245 | {} |
---|
231 | 246 | }; |
---|
232 | 247 | MODULE_DEVICE_TABLE(of, qcom_smd_rpm_of_match); |
---|