forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/net/wireless/intel/iwlwifi/fw/api/power.h
....@@ -8,6 +8,7 @@
88 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
99 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
1010 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
11
+ * Copyright (C) 2018 - 2020 Intel Corporation
1112 *
1213 * This program is free software; you can redistribute it and/or modify
1314 * it under the terms of version 2 of the GNU General Public License as
....@@ -30,6 +31,7 @@
3031 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
3132 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
3233 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
34
+ * Copyright (C) 2018 - 2020 Intel Corporation
3335 * All rights reserved.
3436 *
3537 * Redistribution and use in source and binary forms, with or without
....@@ -198,9 +200,16 @@
198200 * @DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK:
199201 * '1' Allow to save power by turning off
200202 * receiver and transmitter. '0' - does not allow.
203
+ * @DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK:
204
+ * Device Retention indication, '1' indicate retention is enabled.
205
+ * @DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK:
206
+ * 32Khz external slow clock valid indication, '1' indicate cloack is
207
+ * valid.
201208 */
202209 enum iwl_device_power_flags {
203
- DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
210
+ DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
211
+ DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK = BIT(1),
212
+ DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK = BIT(12),
204213 };
205214
206215 /**
....@@ -316,48 +325,120 @@
316325 IWL_TX_POWER_MODE_SET_DEVICE = 1,
317326 IWL_TX_POWER_MODE_SET_CHAINS = 2,
318327 IWL_TX_POWER_MODE_SET_ACK = 3,
319
-}; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_4 */;
328
+ IWL_TX_POWER_MODE_SET_SAR_TIMER = 4,
329
+ IWL_TX_POWER_MODE_SET_SAR_TIMER_DEFAULT_TABLE = 5,
330
+}; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_5 */;
320331
332
+#define IWL_NUM_CHAIN_TABLES 1
333
+#define IWL_NUM_CHAIN_TABLES_V2 2
321334 #define IWL_NUM_CHAIN_LIMITS 2
322335 #define IWL_NUM_SUB_BANDS 5
336
+#define IWL_NUM_SUB_BANDS_V2 11
323337
324338 /**
325
- * struct iwl_dev_tx_power_cmd - TX power reduction command
339
+ * struct iwl_dev_tx_power_common - Common part of the TX power reduction cmd
326340 * @set_mode: see &enum iwl_dev_tx_power_cmd_mode
327341 * @mac_context_id: id of the mac ctx for which we are reducing TX power.
328342 * @pwr_restriction: TX power restriction in 1/8 dBms.
329343 * @dev_24: device TX power restriction in 1/8 dBms
330344 * @dev_52_low: device TX power restriction upper band - low
331345 * @dev_52_high: device TX power restriction upper band - high
332
- * @per_chain_restriction: per chain restrictions
333346 */
334
-struct iwl_dev_tx_power_cmd_v3 {
347
+struct iwl_dev_tx_power_common {
335348 __le32 set_mode;
336349 __le32 mac_context_id;
337350 __le16 pwr_restriction;
338351 __le16 dev_24;
339352 __le16 dev_52_low;
340353 __le16 dev_52_high;
341
- __le16 per_chain_restriction[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
354
+};
355
+
356
+/**
357
+ * struct iwl_dev_tx_power_cmd_v3 - TX power reduction command version 3
358
+ * @per_chain: per chain restrictions
359
+ */
360
+struct iwl_dev_tx_power_cmd_v3 {
361
+ __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
342362 } __packed; /* TX_REDUCED_POWER_API_S_VER_3 */
343363
344364 #define IWL_DEV_MAX_TX_POWER 0x7FFF
345365
346366 /**
347
- * struct iwl_dev_tx_power_cmd - TX power reduction command
348
- * @v3: version 3 of the command, embedded here for easier software handling
367
+ * struct iwl_dev_tx_power_cmd_v4 - TX power reduction command version 4
368
+ * @per_chain: per chain restrictions
349369 * @enable_ack_reduction: enable or disable close range ack TX power
350370 * reduction.
351371 * @reserved: reserved (padding)
352372 */
353
-struct iwl_dev_tx_power_cmd {
354
- /* v4 is just an extension of v3 - keep this here */
355
- struct iwl_dev_tx_power_cmd_v3 v3;
373
+struct iwl_dev_tx_power_cmd_v4 {
374
+ __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
356375 u8 enable_ack_reduction;
357376 u8 reserved[3];
358377 } __packed; /* TX_REDUCED_POWER_API_S_VER_4 */
359378
379
+/**
380
+ * struct iwl_dev_tx_power_cmd_v5 - TX power reduction command version 5
381
+ * @per_chain: per chain restrictions
382
+ * @enable_ack_reduction: enable or disable close range ack TX power
383
+ * reduction.
384
+ * @per_chain_restriction_changed: is per_chain_restriction has changed
385
+ * from last command. used if set_mode is
386
+ * IWL_TX_POWER_MODE_SET_SAR_TIMER.
387
+ * note: if not changed, the command is used for keep alive only.
388
+ * @reserved: reserved (padding)
389
+ * @timer_period: timer in milliseconds. if expires FW will change to default
390
+ * BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
391
+ */
392
+struct iwl_dev_tx_power_cmd_v5 {
393
+ __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
394
+ u8 enable_ack_reduction;
395
+ u8 per_chain_restriction_changed;
396
+ u8 reserved[2];
397
+ __le32 timer_period;
398
+} __packed; /* TX_REDUCED_POWER_API_S_VER_5 */
399
+
400
+/**
401
+ * struct iwl_dev_tx_power_cmd_v5 - TX power reduction command version 5
402
+ * @per_chain: per chain restrictions
403
+ * @enable_ack_reduction: enable or disable close range ack TX power
404
+ * reduction.
405
+ * @per_chain_restriction_changed: is per_chain_restriction has changed
406
+ * from last command. used if set_mode is
407
+ * IWL_TX_POWER_MODE_SET_SAR_TIMER.
408
+ * note: if not changed, the command is used for keep alive only.
409
+ * @reserved: reserved (padding)
410
+ * @timer_period: timer in milliseconds. if expires FW will change to default
411
+ * BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
412
+ */
413
+struct iwl_dev_tx_power_cmd_v6 {
414
+ __le16 per_chain[IWL_NUM_CHAIN_TABLES_V2][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
415
+ u8 enable_ack_reduction;
416
+ u8 per_chain_restriction_changed;
417
+ u8 reserved[2];
418
+ __le32 timer_period;
419
+} __packed; /* TX_REDUCED_POWER_API_S_VER_6 */
420
+
421
+/**
422
+ * struct iwl_dev_tx_power_cmd - TX power reduction command (multiversion)
423
+ * @common: common part of the command
424
+ * @v3: version 3 part of the command
425
+ * @v4: version 4 part of the command
426
+ * @v5: version 5 part of the command
427
+ * @v6: version 6 part of the command
428
+ */
429
+struct iwl_dev_tx_power_cmd {
430
+ struct iwl_dev_tx_power_common common;
431
+ union {
432
+ struct iwl_dev_tx_power_cmd_v3 v3;
433
+ struct iwl_dev_tx_power_cmd_v4 v4;
434
+ struct iwl_dev_tx_power_cmd_v5 v5;
435
+ struct iwl_dev_tx_power_cmd_v6 v6;
436
+ };
437
+};
438
+
360439 #define IWL_NUM_GEO_PROFILES 3
440
+#define IWL_NUM_BANDS_PER_CHAIN_V1 2
441
+#define IWL_NUM_BANDS_PER_CHAIN_V2 3
361442
362443 /**
363444 * enum iwl_geo_per_chain_offset_operation - type of operation
....@@ -381,20 +462,45 @@
381462 u8 chain_b;
382463 } __packed; /* PER_CHAIN_LIMIT_OFFSET_PER_CHAIN_S_VER_1 */
383464
384
-struct iwl_per_chain_offset_group {
385
- struct iwl_per_chain_offset lb;
386
- struct iwl_per_chain_offset hb;
387
-} __packed; /* PER_CHAIN_LIMIT_OFFSET_GROUP_S_VER_1 */
388
-
389465 /**
390
- * struct iwl_geo_tx_power_profile_cmd - struct for GEO_TX_POWER_LIMIT cmd.
466
+ * struct iwl_geo_tx_power_profile_cmd_v1 - struct for GEO_TX_POWER_LIMIT cmd.
391467 * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
392468 * @table: offset profile per band.
393469 */
394
-struct iwl_geo_tx_power_profiles_cmd {
470
+struct iwl_geo_tx_power_profiles_cmd_v1 {
395471 __le32 ops;
396
- struct iwl_per_chain_offset_group table[IWL_NUM_GEO_PROFILES];
397
-} __packed; /* GEO_TX_POWER_LIMIT */
472
+ struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V1];
473
+} __packed; /* GEO_TX_POWER_LIMIT_VER_1 */
474
+
475
+/**
476
+ * struct iwl_geo_tx_power_profile_cmd_v2 - struct for GEO_TX_POWER_LIMIT cmd.
477
+ * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
478
+ * @table: offset profile per band.
479
+ * @table_revision: BIOS table revision.
480
+ */
481
+struct iwl_geo_tx_power_profiles_cmd_v2 {
482
+ __le32 ops;
483
+ struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V1];
484
+ __le32 table_revision;
485
+} __packed; /* GEO_TX_POWER_LIMIT_VER_2 */
486
+
487
+/**
488
+ * struct iwl_geo_tx_power_profile_cmd_v3 - struct for GEO_TX_POWER_LIMIT cmd.
489
+ * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
490
+ * @table: offset profile per band.
491
+ * @table_revision: BIOS table revision.
492
+ */
493
+struct iwl_geo_tx_power_profiles_cmd_v3 {
494
+ __le32 ops;
495
+ struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V2];
496
+ __le32 table_revision;
497
+} __packed; /* GEO_TX_POWER_LIMIT_VER_3 */
498
+
499
+union iwl_geo_tx_power_profiles_cmd {
500
+ struct iwl_geo_tx_power_profiles_cmd_v1 v1;
501
+ struct iwl_geo_tx_power_profiles_cmd_v2 v2;
502
+ struct iwl_geo_tx_power_profiles_cmd_v3 v3;
503
+};
398504
399505 /**
400506 * struct iwl_geo_tx_power_profiles_resp - response to GEO_TX_POWER_LIMIT cmd
....@@ -403,6 +509,28 @@
403509 struct iwl_geo_tx_power_profiles_resp {
404510 __le32 profile_idx;
405511 } __packed; /* GEO_TX_POWER_LIMIT_RESP */
512
+
513
+/**
514
+ * union iwl_ppag_table_cmd - union for all versions of PPAG command
515
+ * @v1: version 1, table revision = 0
516
+ * @v2: version 2, table revision = 1
517
+ *
518
+ * @enabled: 1 if PPAG is enabled, 0 otherwise
519
+ * @gain: table of antenna gain values per chain and sub-band
520
+ * @reserved: reserved
521
+ */
522
+union iwl_ppag_table_cmd {
523
+ struct {
524
+ __le32 enabled;
525
+ s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
526
+ s8 reserved[2];
527
+ } v1;
528
+ struct {
529
+ __le32 enabled;
530
+ s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
531
+ s8 reserved[2];
532
+ } v2;
533
+} __packed;
406534
407535 /**
408536 * struct iwl_beacon_filter_cmd
....@@ -444,6 +572,13 @@
444572 * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
445573 * for a longer period of time then this escape-timeout. Units: Beacons.
446574 * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
575
+ * @bf_threshold_absolute_low: See below.
576
+ * @bf_threshold_absolute_high: Send Beacon to driver if Energy value calculated
577
+ * for this beacon crossed this absolute threshold. For the 'Increase'
578
+ * direction the bf_energy_absolute_low[i] is used. For the 'Decrease'
579
+ * direction the bf_energy_absolute_high[i] is used. Zero value means
580
+ * that this specific threshold is ignored for beacon filtering, and
581
+ * beacon will not be forced to be sent to driver due to this setting.
447582 */
448583 struct iwl_beacon_filter_cmd {
449584 __le32 bf_energy_delta;
....@@ -457,7 +592,9 @@
457592 __le32 bf_escape_timer;
458593 __le32 ba_escape_timer;
459594 __le32 ba_enable_beacon_abort;
460
-} __packed;
595
+ __le32 bf_threshold_absolute_low[2];
596
+ __le32 bf_threshold_absolute_high[2];
597
+} __packed; /* BEACON_FILTER_CONFIG_API_S_VER_4 */
461598
462599 /* Beacon filtering and beacon abort */
463600 #define IWL_BF_ENERGY_DELTA_DEFAULT 5