Add a skeleton driver for supporting Qualcomm QMI thermal mitigation
(TMD) cooling devices.
The QMI TMD cooling devices are used for various mitigations for
remote subsystem(s) including remote processor mitigation, rail
voltage restriction etc. This driver uses kernel QMI interface
to send the message to remote subsystem(s).
Each child node of the QMI TMD devicetree node should represent
each remote subsystem and each child of this subsystem represents
separate cooling devices.
Cc: daniel.lezcano@xxxxxxxxxx
Cc: rafael@xxxxxxxxxx
Cc: andersson@xxxxxxxxxx
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@xxxxxxxxxx>
---
.../qcom/qmi_cooling/qcom_qmi_cooling.c | 632 ++++++++++++++++++
.../qcom/qmi_cooling/qcom_tmd_services.c | 352 ++++++++++
.../qcom/qmi_cooling/qcom_tmd_services.h | 120 ++++
3 files changed, 1104 insertions(+)
create mode 100644 drivers/thermal/qcom/qmi_cooling/qcom_qmi_cooling.c
create mode 100644 drivers/thermal/qcom/qmi_cooling/qcom_tmd_services.c
create mode 100644 drivers/thermal/qcom/qmi_cooling/qcom_tmd_services.h
diff --git a/drivers/thermal/qcom/qmi_cooling/qcom_qmi_cooling.c b/drivers/thermal/qcom/qmi_cooling/qcom_qmi_cooling.c
new file mode 100644
index 000000000000..4cb601533b9d
--- /dev/null
+++ b/drivers/thermal/qcom/qmi_cooling/qcom_qmi_cooling.c
+static char device_clients[][QMI_CLIENT_NAME_LENGTH] = {
+ {"pa"},
+ {"pa_fr1"},
+ {"cx_vdd_limit"},
+ {"modem"},
+ {"modem_current"},
+ {"modem_skin"},
diff --git a/drivers/thermal/qcom/qmi_cooling/qcom_tmd_services.c b/drivers/thermal/qcom/qmi_cooling/qcom_tmd_services.c
new file mode 100644
index 000000000000..5b950b8952f0
--- /dev/null
+++ b/drivers/thermal/qcom/qmi_cooling/qcom_tmd_services.c
@@ -0,0 +1,352 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2022, Linaro Limited
+ */
+
+#include <linux/soc/qcom/qmi.h>
+
+#include "qcom_tmd_services.h"
+
+static struct qmi_elem_info tmd_mitigation_dev_id_type_v01_ei[] = {
+ {
+ .data_type = QMI_STRING,
+ .elem_len = QMI_TMD_MITIGATION_DEV_ID_LENGTH_MAX_V01 + 1,
+ .elem_size = sizeof(char),
+ .array_type = NO_ARRAY,
+ .tlv_type = 0,
+ .offset = offsetof(
+ struct tmd_mitigation_dev_id_type_v01,
+ mitigation_dev_id),
+ },
+ {
+ .data_type = QMI_EOTI,
+ .array_type = NO_ARRAY,
+ .tlv_type = QMI_COMMON_TLV_TYPE,
+ },
+};
diff --git a/drivers/thermal/qcom/qmi_cooling/qcom_tmd_services.h b/drivers/thermal/qcom/qmi_cooling/qcom_tmd_services.h
new file mode 100644
index 000000000000..8af0bfd7eb48
--- /dev/null
+++ b/drivers/thermal/qcom/qmi_cooling/qcom_tmd_services.h
+extern struct qmi_elem_info tmd_get_mitigation_device_list_req_msg_v01_ei[];