new file mode 100644
@@ -0,0 +1,74 @@
+/* SPDX-License-Identifier: MIT */
+/* Copyright(c) 2019-2021, Celeno Communications Ltd. */
+
+#ifndef CL_TEMPERATURE_H
+#define CL_TEMPERATURE_H
+
+#include <net/mac80211.h>
+#include "vendor_cmd.h"
+
+#define CL_TEMP_PROTECT_INTERVAL_MS 40000
+#define CL_TEMP_PROTECT_NUM_SAMPLES 4
+#define CL_TEMP_PROTECT_RADIO_OFF_HYST 10
+
+#define CL_TEMP_COMP_ITERATIONS 4
+
+#define CL_TEMPERATURE_TIMER_INTERVAL_MS 4000
+#define CL_TEMPERATURE_UPDATE_INTERVAL_MS (CL_TEMPERATURE_TIMER_INTERVAL_MS - 100)
+
+enum cl_temp_state {
+ TEMP_PROTECT_OFF,
+ TEMP_PROTECT_INTERNAL,
+ TEMP_PROTECT_EXTERNAL,
+ TEMP_PROTECT_DIFF
+};
+
+enum cl_temp_mode {
+ TEMP_MODE_INTERNAL,
+ TEMP_MODE_EXTERNAL
+};
+
+struct cl_temp_comp_db {
+ s8 calib_temperature;
+ s8 power_offset;
+ s32 acc_temp_delta;
+ s32 avg_temp_delta;
+};
+
+struct cl_temp_protect_db {
+ bool force_radio_off;
+ u8 duty_cycle;
+ u8 test_mode_duty_cycle;
+ u8 curr_idx;
+ s16 last_samples[CL_TEMP_PROTECT_NUM_SAMPLES];
+ unsigned long last_timestamp;
+};
+
+struct cl_temperature {
+ s8 diff_internal_external;
+ u8 comp_iterations;
+ struct cl_temp_protect_db protect_db;
+ struct task_struct *kthread;
+ wait_queue_head_t wait_q;
+ s16 internal_last;
+ s16 external_last;
+ unsigned long internal_read_timestamp;
+ unsigned long external_read_timestamp;
+ struct mutex mutex;
+};
+
+struct cl_chip;
+struct cl_hw;
+
+void cl_temperature_init(struct cl_chip *chip);
+void cl_temperature_close(struct cl_chip *chip);
+s16 cl_temperature_get_internal(struct cl_hw *cl_hw);
+s8 cl_temperature_read(struct cl_hw *cl_hw, enum cl_temp_mode mode);
+int cl_temperature_cli(struct cl_hw *cl_hw, struct cli_params *cli_params);
+void cl_temperature_recovery(struct cl_hw *cl_hw);
+bool cl_temperature_protect_did_reduce_duty_cycle(struct cl_hw *cl_hw);
+int cl_temperature_diff_e2p_read(struct cl_hw *cl_hw);
+s16 cl_temperature_calib_calc(struct cl_hw *cl_hw, u16 raw_bits);
+void cl_temperature_comp_update_calib(struct cl_hw *cl_hw);
+
+#endif /* CL_TEMPERATURE_H */