Loading drivers/thermal/qcom/qmi_sensors.c +23 −0 Original line number Diff line number Diff line Loading @@ -482,6 +482,29 @@ static int verify_sensor_and_register(struct qmi_ts_instance *ts) } } /* Check and get sensor list extended */ for (i = 0; ts_resp->sensor_list_ext01_valid && (i < ts_resp->sensor_list_ext01_len); i++) { struct qmi_sensor *qmi_sens = NULL; list_for_each_entry(qmi_sens, &ts->ts_sensor_list, ts_node) { if ((strncasecmp(qmi_sens->qmi_name, ts_resp->sensor_list_ext01[i].sensor_id, QMI_TS_SENSOR_ID_LENGTH_MAX_V01))) continue; qmi_sens->connection_active = true; /* * Send a temperature request notification. */ qmi_ts_request(qmi_sens, true); if (!qmi_sens->tz_dev) ret = qmi_register_sensor_device(qmi_sens); break; } } kfree(ts_resp); return ret; Loading drivers/thermal/qcom/thermal_sensor_service_v01.c +53 −22 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include <linux/soc/qcom/qmi.h> Loading @@ -19,7 +19,7 @@ static struct qmi_elem_info ts_sensor_type_v01_ei[] = { { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .array_type = QMI_COMMON_TLV_TYPE, .tlv_type = QMI_COMMON_TLV_TYPE, }, }; Loading @@ -27,7 +27,7 @@ struct qmi_elem_info ts_get_sensor_list_req_msg_v01_ei[] = { { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .array_type = QMI_COMMON_TLV_TYPE, .tlv_type = QMI_COMMON_TLV_TYPE, }, }; Loading @@ -45,7 +45,7 @@ struct qmi_elem_info ts_get_sensor_list_resp_msg_v01_ei[] = { { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x10, .offset = Loading @@ -55,7 +55,7 @@ struct qmi_elem_info ts_get_sensor_list_resp_msg_v01_ei[] = { { .data_type = QMI_DATA_LEN, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x10, .offset = Loading @@ -73,10 +73,41 @@ struct qmi_elem_info ts_get_sensor_list_resp_msg_v01_ei[] = { sensor_list), .ei_array = ts_sensor_type_v01_ei, }, { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x11, .offset = offsetof(struct ts_get_sensor_list_resp_msg_v01, sensor_list_ext01_valid), }, { .data_type = QMI_DATA_LEN, .elem_len = 1, .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x11, .offset = offsetof(struct ts_get_sensor_list_resp_msg_v01, sensor_list_ext01_len), }, { .data_type = QMI_STRUCT, .elem_len = QMI_TS_SENSOR_LIST_EXT01_MAX_V01, .elem_size = sizeof(struct ts_sensor_type_v01), .array_type = VAR_LEN_ARRAY, .tlv_type = 0x11, .offset = offsetof(struct ts_get_sensor_list_resp_msg_v01, sensor_list_ext01), .ei_array = ts_sensor_type_v01_ei, }, { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .array_type = QMI_COMMON_TLV_TYPE, .tlv_type = QMI_COMMON_TLV_TYPE, }, }; Loading @@ -95,7 +126,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_UNSIGNED_1_BYTE, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x02, .offset = offsetof( Loading @@ -105,7 +136,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x10, .offset = offsetof( Loading @@ -115,7 +146,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_UNSIGNED_4_BYTE, .elem_len = 1, .elem_size = sizeof(int), .elem_size = sizeof(u32), .array_type = NO_ARRAY, .tlv_type = 0x10, .offset = offsetof( Loading @@ -125,7 +156,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x11, .offset = offsetof( Loading @@ -135,7 +166,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_UNSIGNED_4_BYTE, .elem_len = 1, .elem_size = sizeof(int), .elem_size = sizeof(u32), .array_type = NO_ARRAY, .tlv_type = 0x11, .offset = offsetof( Loading @@ -145,7 +176,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x12, .offset = offsetof( Loading @@ -155,7 +186,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_UNSIGNED_4_BYTE, .elem_len = 1, .elem_size = sizeof(uint32_t), .elem_size = sizeof(u32), .array_type = NO_ARRAY, .tlv_type = 0x12, .offset = offsetof( Loading @@ -165,7 +196,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .array_type = QMI_COMMON_TLV_TYPE, .tlv_type = QMI_COMMON_TLV_TYPE, }, }; Loading @@ -184,7 +215,7 @@ struct qmi_elem_info ts_register_notification_temp_resp_msg_v01_ei[] = { { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .array_type = QMI_COMMON_TLV_TYPE, .tlv_type = QMI_COMMON_TLV_TYPE, }, }; Loading @@ -211,7 +242,7 @@ struct qmi_elem_info ts_temp_report_ind_msg_v01_ei[] = { { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x10, .offset = offsetof(struct ts_temp_report_ind_msg_v01, Loading @@ -220,7 +251,7 @@ struct qmi_elem_info ts_temp_report_ind_msg_v01_ei[] = { { .data_type = QMI_UNSIGNED_4_BYTE, .elem_len = 1, .elem_size = sizeof(int), .elem_size = sizeof(u32), .array_type = NO_ARRAY, .tlv_type = 0x10, .offset = offsetof(struct ts_temp_report_ind_msg_v01, Loading @@ -229,7 +260,7 @@ struct qmi_elem_info ts_temp_report_ind_msg_v01_ei[] = { { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x11, .offset = offsetof(struct ts_temp_report_ind_msg_v01, Loading @@ -238,7 +269,7 @@ struct qmi_elem_info ts_temp_report_ind_msg_v01_ei[] = { { .data_type = QMI_UNSIGNED_4_BYTE, .elem_len = 1, .elem_size = sizeof(uint32_t), .elem_size = sizeof(u32), .array_type = NO_ARRAY, .tlv_type = 0x11, .offset = offsetof(struct ts_temp_report_ind_msg_v01, Loading @@ -247,7 +278,7 @@ struct qmi_elem_info ts_temp_report_ind_msg_v01_ei[] = { { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .array_type = QMI_COMMON_TLV_TYPE, .tlv_type = QMI_COMMON_TLV_TYPE, }, }; drivers/thermal/qcom/thermal_sensor_service_v01.h +17 −13 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef THERMAL_SENSOR_SERVICE_V01_H Loading @@ -21,6 +21,7 @@ #define QMI_TS_SENSOR_ID_LENGTH_MAX_V01 32 #define QMI_TS_SENSOR_LIST_MAX_V01 32 #define QMI_TS_SENSOR_LIST_EXT01_MAX_V01 64 struct ts_sensor_type_v01 { char sensor_id[QMI_TS_SENSOR_ID_LENGTH_MAX_V01 + 1]; Loading @@ -34,22 +35,25 @@ extern struct qmi_elem_info ts_get_sensor_list_req_msg_v01_ei[]; struct ts_get_sensor_list_resp_msg_v01 { struct qmi_response_type_v01 resp; uint8_t sensor_list_valid; uint32_t sensor_list_len; u8 sensor_list_valid; u32 sensor_list_len; struct ts_sensor_type_v01 sensor_list[QMI_TS_SENSOR_LIST_MAX_V01]; u8 sensor_list_ext01_valid; u32 sensor_list_ext01_len; struct ts_sensor_type_v01 sensor_list_ext01[QMI_TS_SENSOR_LIST_EXT01_MAX_V01]; }; #define TS_GET_SENSOR_LIST_RESP_MSG_V01_MAX_MSG_LEN 1067 #define TS_GET_SENSOR_LIST_RESP_MSG_V01_MAX_MSG_LEN 3183 extern struct qmi_elem_info ts_get_sensor_list_resp_msg_v01_ei[]; struct ts_register_notification_temp_req_msg_v01 { struct ts_sensor_type_v01 sensor_id; uint8_t send_current_temp_report; uint8_t temp_threshold_high_valid; u8 send_current_temp_report; u8 temp_threshold_high_valid; int temp_threshold_high; uint8_t temp_threshold_low_valid; u8 temp_threshold_low_valid; int temp_threshold_low; uint8_t seq_num_valid; uint32_t seq_num; u8 seq_num_valid; u32 seq_num; }; #define TS_REGISTER_NOTIFICATION_TEMP_REQ_MSG_V01_MAX_MSG_LEN 61 extern struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[]; Loading @@ -71,10 +75,10 @@ enum ts_temp_report_type_enum_v01 { struct ts_temp_report_ind_msg_v01 { struct ts_sensor_type_v01 sensor_id; enum ts_temp_report_type_enum_v01 report_type; uint8_t temp_valid; long temp; uint8_t seq_num_valid; uint32_t seq_num; u8 temp_valid; int temp; u8 seq_num_valid; u32 seq_num; }; #define TS_TEMP_REPORT_IND_MSG_V01_MAX_MSG_LEN 57 extern struct qmi_elem_info ts_temp_report_ind_msg_v01_ei[]; Loading Loading
drivers/thermal/qcom/qmi_sensors.c +23 −0 Original line number Diff line number Diff line Loading @@ -482,6 +482,29 @@ static int verify_sensor_and_register(struct qmi_ts_instance *ts) } } /* Check and get sensor list extended */ for (i = 0; ts_resp->sensor_list_ext01_valid && (i < ts_resp->sensor_list_ext01_len); i++) { struct qmi_sensor *qmi_sens = NULL; list_for_each_entry(qmi_sens, &ts->ts_sensor_list, ts_node) { if ((strncasecmp(qmi_sens->qmi_name, ts_resp->sensor_list_ext01[i].sensor_id, QMI_TS_SENSOR_ID_LENGTH_MAX_V01))) continue; qmi_sens->connection_active = true; /* * Send a temperature request notification. */ qmi_ts_request(qmi_sens, true); if (!qmi_sens->tz_dev) ret = qmi_register_sensor_device(qmi_sens); break; } } kfree(ts_resp); return ret; Loading
drivers/thermal/qcom/thermal_sensor_service_v01.c +53 −22 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include <linux/soc/qcom/qmi.h> Loading @@ -19,7 +19,7 @@ static struct qmi_elem_info ts_sensor_type_v01_ei[] = { { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .array_type = QMI_COMMON_TLV_TYPE, .tlv_type = QMI_COMMON_TLV_TYPE, }, }; Loading @@ -27,7 +27,7 @@ struct qmi_elem_info ts_get_sensor_list_req_msg_v01_ei[] = { { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .array_type = QMI_COMMON_TLV_TYPE, .tlv_type = QMI_COMMON_TLV_TYPE, }, }; Loading @@ -45,7 +45,7 @@ struct qmi_elem_info ts_get_sensor_list_resp_msg_v01_ei[] = { { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x10, .offset = Loading @@ -55,7 +55,7 @@ struct qmi_elem_info ts_get_sensor_list_resp_msg_v01_ei[] = { { .data_type = QMI_DATA_LEN, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x10, .offset = Loading @@ -73,10 +73,41 @@ struct qmi_elem_info ts_get_sensor_list_resp_msg_v01_ei[] = { sensor_list), .ei_array = ts_sensor_type_v01_ei, }, { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x11, .offset = offsetof(struct ts_get_sensor_list_resp_msg_v01, sensor_list_ext01_valid), }, { .data_type = QMI_DATA_LEN, .elem_len = 1, .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x11, .offset = offsetof(struct ts_get_sensor_list_resp_msg_v01, sensor_list_ext01_len), }, { .data_type = QMI_STRUCT, .elem_len = QMI_TS_SENSOR_LIST_EXT01_MAX_V01, .elem_size = sizeof(struct ts_sensor_type_v01), .array_type = VAR_LEN_ARRAY, .tlv_type = 0x11, .offset = offsetof(struct ts_get_sensor_list_resp_msg_v01, sensor_list_ext01), .ei_array = ts_sensor_type_v01_ei, }, { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .array_type = QMI_COMMON_TLV_TYPE, .tlv_type = QMI_COMMON_TLV_TYPE, }, }; Loading @@ -95,7 +126,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_UNSIGNED_1_BYTE, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x02, .offset = offsetof( Loading @@ -105,7 +136,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x10, .offset = offsetof( Loading @@ -115,7 +146,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_UNSIGNED_4_BYTE, .elem_len = 1, .elem_size = sizeof(int), .elem_size = sizeof(u32), .array_type = NO_ARRAY, .tlv_type = 0x10, .offset = offsetof( Loading @@ -125,7 +156,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x11, .offset = offsetof( Loading @@ -135,7 +166,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_UNSIGNED_4_BYTE, .elem_len = 1, .elem_size = sizeof(int), .elem_size = sizeof(u32), .array_type = NO_ARRAY, .tlv_type = 0x11, .offset = offsetof( Loading @@ -145,7 +176,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x12, .offset = offsetof( Loading @@ -155,7 +186,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_UNSIGNED_4_BYTE, .elem_len = 1, .elem_size = sizeof(uint32_t), .elem_size = sizeof(u32), .array_type = NO_ARRAY, .tlv_type = 0x12, .offset = offsetof( Loading @@ -165,7 +196,7 @@ struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[] = { { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .array_type = QMI_COMMON_TLV_TYPE, .tlv_type = QMI_COMMON_TLV_TYPE, }, }; Loading @@ -184,7 +215,7 @@ struct qmi_elem_info ts_register_notification_temp_resp_msg_v01_ei[] = { { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .array_type = QMI_COMMON_TLV_TYPE, .tlv_type = QMI_COMMON_TLV_TYPE, }, }; Loading @@ -211,7 +242,7 @@ struct qmi_elem_info ts_temp_report_ind_msg_v01_ei[] = { { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x10, .offset = offsetof(struct ts_temp_report_ind_msg_v01, Loading @@ -220,7 +251,7 @@ struct qmi_elem_info ts_temp_report_ind_msg_v01_ei[] = { { .data_type = QMI_UNSIGNED_4_BYTE, .elem_len = 1, .elem_size = sizeof(int), .elem_size = sizeof(u32), .array_type = NO_ARRAY, .tlv_type = 0x10, .offset = offsetof(struct ts_temp_report_ind_msg_v01, Loading @@ -229,7 +260,7 @@ struct qmi_elem_info ts_temp_report_ind_msg_v01_ei[] = { { .data_type = QMI_OPT_FLAG, .elem_len = 1, .elem_size = sizeof(uint8_t), .elem_size = sizeof(u8), .array_type = NO_ARRAY, .tlv_type = 0x11, .offset = offsetof(struct ts_temp_report_ind_msg_v01, Loading @@ -238,7 +269,7 @@ struct qmi_elem_info ts_temp_report_ind_msg_v01_ei[] = { { .data_type = QMI_UNSIGNED_4_BYTE, .elem_len = 1, .elem_size = sizeof(uint32_t), .elem_size = sizeof(u32), .array_type = NO_ARRAY, .tlv_type = 0x11, .offset = offsetof(struct ts_temp_report_ind_msg_v01, Loading @@ -247,7 +278,7 @@ struct qmi_elem_info ts_temp_report_ind_msg_v01_ei[] = { { .data_type = QMI_EOTI, .array_type = NO_ARRAY, .array_type = QMI_COMMON_TLV_TYPE, .tlv_type = QMI_COMMON_TLV_TYPE, }, };
drivers/thermal/qcom/thermal_sensor_service_v01.h +17 −13 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef THERMAL_SENSOR_SERVICE_V01_H Loading @@ -21,6 +21,7 @@ #define QMI_TS_SENSOR_ID_LENGTH_MAX_V01 32 #define QMI_TS_SENSOR_LIST_MAX_V01 32 #define QMI_TS_SENSOR_LIST_EXT01_MAX_V01 64 struct ts_sensor_type_v01 { char sensor_id[QMI_TS_SENSOR_ID_LENGTH_MAX_V01 + 1]; Loading @@ -34,22 +35,25 @@ extern struct qmi_elem_info ts_get_sensor_list_req_msg_v01_ei[]; struct ts_get_sensor_list_resp_msg_v01 { struct qmi_response_type_v01 resp; uint8_t sensor_list_valid; uint32_t sensor_list_len; u8 sensor_list_valid; u32 sensor_list_len; struct ts_sensor_type_v01 sensor_list[QMI_TS_SENSOR_LIST_MAX_V01]; u8 sensor_list_ext01_valid; u32 sensor_list_ext01_len; struct ts_sensor_type_v01 sensor_list_ext01[QMI_TS_SENSOR_LIST_EXT01_MAX_V01]; }; #define TS_GET_SENSOR_LIST_RESP_MSG_V01_MAX_MSG_LEN 1067 #define TS_GET_SENSOR_LIST_RESP_MSG_V01_MAX_MSG_LEN 3183 extern struct qmi_elem_info ts_get_sensor_list_resp_msg_v01_ei[]; struct ts_register_notification_temp_req_msg_v01 { struct ts_sensor_type_v01 sensor_id; uint8_t send_current_temp_report; uint8_t temp_threshold_high_valid; u8 send_current_temp_report; u8 temp_threshold_high_valid; int temp_threshold_high; uint8_t temp_threshold_low_valid; u8 temp_threshold_low_valid; int temp_threshold_low; uint8_t seq_num_valid; uint32_t seq_num; u8 seq_num_valid; u32 seq_num; }; #define TS_REGISTER_NOTIFICATION_TEMP_REQ_MSG_V01_MAX_MSG_LEN 61 extern struct qmi_elem_info ts_register_notification_temp_req_msg_v01_ei[]; Loading @@ -71,10 +75,10 @@ enum ts_temp_report_type_enum_v01 { struct ts_temp_report_ind_msg_v01 { struct ts_sensor_type_v01 sensor_id; enum ts_temp_report_type_enum_v01 report_type; uint8_t temp_valid; long temp; uint8_t seq_num_valid; uint32_t seq_num; u8 temp_valid; int temp; u8 seq_num_valid; u32 seq_num; }; #define TS_TEMP_REPORT_IND_MSG_V01_MAX_MSG_LEN 57 extern struct qmi_elem_info ts_temp_report_ind_msg_v01_ei[]; Loading