mirror of
https://github.com/torvalds/linux.git
synced 2026-04-26 02:22:28 -04:00
The 'linux/soc/qcom/smd-rpm.h' header defines QCOM_RPM_SMD_KEY_RATE with the exact same value. $ git grep -nHE 'define[[:blank:]]+QCOM_RPM_SMD_KEY_RATE[[:blank:]]' drivers/interconnect/qcom/smd-rpm.c:17:#define QCOM_RPM_SMD_KEY_RATE 0x007a484b include/linux/soc/qcom/smd-rpm.h:52:#define QCOM_RPM_SMD_KEY_RATE 0x007a484b Drop the local define to avoid the duplication. No functional changes intended. Compile tested only. Signed-off-by: Gabor Juhos <j4g8y7@gmail.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260122-icc-qcom-dupe-defines-v1-1-eea876c2d98f@gmail.com Signed-off-by: Georgi Djakov <djakov@kernel.org>
94 lines
2.1 KiB
C
94 lines
2.1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* RPM over SMD communication wrapper for interconnects
|
|
*
|
|
* Copyright (C) 2019 Linaro Ltd
|
|
* Author: Georgi Djakov <georgi.djakov@linaro.org>
|
|
*/
|
|
|
|
#include <linux/interconnect-provider.h>
|
|
#include <linux/module.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/soc/qcom/smd-rpm.h>
|
|
|
|
#include "icc-rpm.h"
|
|
|
|
#define RPM_KEY_BW 0x00007762
|
|
|
|
static struct qcom_smd_rpm *icc_smd_rpm;
|
|
|
|
struct icc_rpm_smd_req {
|
|
__le32 key;
|
|
__le32 nbytes;
|
|
__le32 value;
|
|
};
|
|
|
|
bool qcom_icc_rpm_smd_available(void)
|
|
{
|
|
return !!icc_smd_rpm;
|
|
}
|
|
EXPORT_SYMBOL_GPL(qcom_icc_rpm_smd_available);
|
|
|
|
int qcom_icc_rpm_smd_send(int ctx, int rsc_type, int id, u32 val)
|
|
{
|
|
struct icc_rpm_smd_req req = {
|
|
.key = cpu_to_le32(RPM_KEY_BW),
|
|
.nbytes = cpu_to_le32(sizeof(u32)),
|
|
.value = cpu_to_le32(val),
|
|
};
|
|
|
|
return qcom_rpm_smd_write(icc_smd_rpm, ctx, rsc_type, id, &req,
|
|
sizeof(req));
|
|
}
|
|
EXPORT_SYMBOL_GPL(qcom_icc_rpm_smd_send);
|
|
|
|
int qcom_icc_rpm_set_bus_rate(const struct rpm_clk_resource *clk, int ctx, u32 rate)
|
|
{
|
|
struct clk_smd_rpm_req req = {
|
|
.key = cpu_to_le32(QCOM_RPM_SMD_KEY_RATE),
|
|
.nbytes = cpu_to_le32(sizeof(u32)),
|
|
};
|
|
|
|
/* Branch clocks are only on/off */
|
|
if (clk->branch)
|
|
rate = !!rate;
|
|
|
|
req.value = cpu_to_le32(rate);
|
|
return qcom_rpm_smd_write(icc_smd_rpm,
|
|
ctx,
|
|
clk->resource_type,
|
|
clk->clock_id,
|
|
&req, sizeof(req));
|
|
}
|
|
EXPORT_SYMBOL_GPL(qcom_icc_rpm_set_bus_rate);
|
|
|
|
static void qcom_icc_rpm_smd_remove(struct platform_device *pdev)
|
|
{
|
|
icc_smd_rpm = NULL;
|
|
}
|
|
|
|
static int qcom_icc_rpm_smd_probe(struct platform_device *pdev)
|
|
{
|
|
icc_smd_rpm = dev_get_drvdata(pdev->dev.parent);
|
|
|
|
if (!icc_smd_rpm) {
|
|
dev_err(&pdev->dev, "unable to retrieve handle to RPM\n");
|
|
return -ENODEV;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static struct platform_driver qcom_interconnect_rpm_smd_driver = {
|
|
.driver = {
|
|
.name = "icc_smd_rpm",
|
|
},
|
|
.probe = qcom_icc_rpm_smd_probe,
|
|
.remove = qcom_icc_rpm_smd_remove,
|
|
};
|
|
module_platform_driver(qcom_interconnect_rpm_smd_driver);
|
|
MODULE_AUTHOR("Georgi Djakov <georgi.djakov@linaro.org>");
|
|
MODULE_DESCRIPTION("Qualcomm SMD RPM interconnect proxy driver");
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_ALIAS("platform:icc_smd_rpm");
|