Search Linux Wireless

[RFC v1 189/256] cl8k: add temperature.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Viktor Barna <viktor.barna@xxxxxxxxxx>

(Part of the split. Please, take a look at the cover letter for more
details).

Signed-off-by: Viktor Barna <viktor.barna@xxxxxxxxxx>
---
 .../net/wireless/celeno/cl8k/temperature.h    | 74 +++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 drivers/net/wireless/celeno/cl8k/temperature.h

diff --git a/drivers/net/wireless/celeno/cl8k/temperature.h b/drivers/net/wireless/celeno/cl8k/temperature.h
new file mode 100644
index 000000000000..9f34d06b64eb
--- /dev/null
+++ b/drivers/net/wireless/celeno/cl8k/temperature.h
@@ -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 */
--
2.30.0

________________________________
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any retransmission, dissemination, copying or other use of, or taking of any action in reliance upon this information is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Nothing contained herein shall be deemed as a representation, warranty or a commitment by Celeno. No warranties are expressed or implied, including, but not limited to, any implied warranties of non-infringement, merchantability and fitness for a particular purpose.
________________________________





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux