diff --git a/drivers/thermal/qcom/qmi_sensors.c b/drivers/thermal/qcom/qmi_sensors.c index 481f1350ea92..ff9763af1f0d 100644 --- a/drivers/thermal/qcom/qmi_sensors.c +++ b/drivers/thermal/qcom/qmi_sensors.c @@ -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; diff --git a/drivers/thermal/qcom/thermal_sensor_service_v01.c b/drivers/thermal/qcom/thermal_sensor_service_v01.c index 9cae54a23a2d..6fddc69bb26e 100644 --- a/drivers/thermal/qcom/thermal_sensor_service_v01.c +++ b/drivers/thermal/qcom/thermal_sensor_service_v01.c @@ -1,6 +1,6 @@ // 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 @@ -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, }, }; @@ -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, }, }; @@ -40,12 +40,12 @@ struct qmi_elem_info ts_get_sensor_list_resp_msg_v01_ei[] = { .tlv_type = 0x02, .offset = offsetof(struct ts_get_sensor_list_resp_msg_v01, resp), - .ei_array = qmi_response_type_v01_ei, + .ei_array = qmi_response_type_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 = @@ -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 = @@ -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, }, }; @@ -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( @@ -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( @@ -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( @@ -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( @@ -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( @@ -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( @@ -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( @@ -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, }, }; @@ -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, }, }; @@ -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, @@ -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, @@ -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, @@ -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, @@ -246,8 +277,8 @@ 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, + .array_type = NO_ARRAY, + .tlv_type = QMI_COMMON_TLV_TYPE, }, }; diff --git a/drivers/thermal/qcom/thermal_sensor_service_v01.h b/drivers/thermal/qcom/thermal_sensor_service_v01.h index b66f14b5c2d9..9ace6844c3d2 100644 --- a/drivers/thermal/qcom/thermal_sensor_service_v01.h +++ b/drivers/thermal/qcom/thermal_sensor_service_v01.h @@ -1,6 +1,6 @@ /* 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 @@ -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]; @@ -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[]; @@ -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[];