hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/include/linux/usb/pd.h
....@@ -1,15 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * Copyright 2015-2017 Google, Inc
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
134 */
145
156 #ifndef __LINUX_USB_PD_H
....@@ -54,7 +45,8 @@
5445 PD_DATA_BATT_STATUS = 5,
5546 PD_DATA_ALERT = 6,
5647 PD_DATA_GET_COUNTRY_INFO = 7,
57
- /* 8-14 Reserved */
48
+ PD_DATA_ENTER_USB = 8,
49
+ /* 9-14 Reserved */
5850 PD_DATA_VENDOR_DEF = 15,
5951 /* 16-31 Reserved */
6052 };
....@@ -233,6 +225,7 @@
233225 #define PDO_FIXED_EXTPOWER BIT(27) /* Externally powered */
234226 #define PDO_FIXED_USB_COMM BIT(26) /* USB communications capable */
235227 #define PDO_FIXED_DATA_SWAP BIT(25) /* Data role swap supported */
228
+#define PDO_FIXED_UNCHUNK_EXT BIT(24) /* Unchunked Extended Message supported (Source) */
236229 #define PDO_FIXED_FRS_CURR_MASK (BIT(24) | BIT(23)) /* FR_Swap Current (Sink) */
237230 #define PDO_FIXED_FRS_CURR_SHIFT 23
238231 #define PDO_FIXED_VOLT_SHIFT 10 /* 50mV units */
....@@ -429,6 +422,36 @@
429422 return ((rdo >> RDO_BATT_MAX_PWR_SHIFT) & RDO_PWR_MASK) * 250;
430423 }
431424
425
+/* Enter_USB Data Object */
426
+#define EUDO_USB_MODE_MASK GENMASK(30, 28)
427
+#define EUDO_USB_MODE_SHIFT 28
428
+#define EUDO_USB_MODE_USB2 0
429
+#define EUDO_USB_MODE_USB3 1
430
+#define EUDO_USB_MODE_USB4 2
431
+#define EUDO_USB4_DRD BIT(26)
432
+#define EUDO_USB3_DRD BIT(25)
433
+#define EUDO_CABLE_SPEED_MASK GENMASK(23, 21)
434
+#define EUDO_CABLE_SPEED_SHIFT 21
435
+#define EUDO_CABLE_SPEED_USB2 0
436
+#define EUDO_CABLE_SPEED_USB3_GEN1 1
437
+#define EUDO_CABLE_SPEED_USB4_GEN2 2
438
+#define EUDO_CABLE_SPEED_USB4_GEN3 3
439
+#define EUDO_CABLE_TYPE_MASK GENMASK(20, 19)
440
+#define EUDO_CABLE_TYPE_SHIFT 19
441
+#define EUDO_CABLE_TYPE_PASSIVE 0
442
+#define EUDO_CABLE_TYPE_RE_TIMER 1
443
+#define EUDO_CABLE_TYPE_RE_DRIVER 2
444
+#define EUDO_CABLE_TYPE_OPTICAL 3
445
+#define EUDO_CABLE_CURRENT_MASK GENMASK(18, 17)
446
+#define EUDO_CABLE_CURRENT_SHIFT 17
447
+#define EUDO_CABLE_CURRENT_NOTSUPP 0
448
+#define EUDO_CABLE_CURRENT_3A 2
449
+#define EUDO_CABLE_CURRENT_5A 3
450
+#define EUDO_PCIE_SUPPORT BIT(16)
451
+#define EUDO_DP_SUPPORT BIT(15)
452
+#define EUDO_TBT_SUPPORT BIT(14)
453
+#define EUDO_HOST_PRESENT BIT(13)
454
+
432455 /* USB PD timers and counters */
433456 #define PD_T_NO_RESPONSE 5000 /* 4.5 - 5.5 seconds */
434457 #define PD_T_DB_DETECT 10000 /* 10 - 15 seconds */
....@@ -444,6 +467,7 @@
444467 #define PD_T_DRP_SRC 30
445468 #define PD_T_PS_SOURCE_OFF 920
446469 #define PD_T_PS_SOURCE_ON 480
470
+#define PD_T_PS_SOURCE_ON_PRS 450 /* 390 - 480ms */
447471 #define PD_T_PS_HARD_RESET 30
448472 #define PD_T_SRC_RECOVER 760
449473 #define PD_T_SRC_RECOVER_MAX 1000
....@@ -452,18 +476,23 @@
452476 #define PD_T_VCONN_SOURCE_ON 100
453477 #define PD_T_SINK_REQUEST 100 /* 100 ms minimum */
454478 #define PD_T_ERROR_RECOVERY 100 /* minimum 25 is insufficient */
455
-#define PD_T_SRCSWAPSTDBY 625 /* Maximum of 650ms */
456
-#define PD_T_NEWSRC 250 /* Maximum of 275ms */
479
+#define PD_T_SRCSWAPSTDBY 625 /* Maximum of 650ms */
480
+#define PD_T_NEWSRC 250 /* Maximum of 275ms */
457481 #define PD_T_SWAP_SRC_START 20 /* Minimum of 20ms */
482
+#define PD_T_BIST_CONT_MODE 50 /* 30 - 60 ms */
458483 #define PD_T_SINK_TX 16 /* 16 - 20 ms */
484
+#define PD_T_CHUNK_NOT_SUPP 42 /* 40 - 50 ms */
459485
460486 #define PD_T_DRP_TRY 100 /* 75 - 150 ms */
461487 #define PD_T_DRP_TRYWAIT 600 /* 400 - 800 ms */
462488
463489 #define PD_T_CC_DEBOUNCE 200 /* 100 - 200 ms */
464490 #define PD_T_PD_DEBOUNCE 20 /* 10 - 20 ms */
491
+#define PD_T_TRY_CC_DEBOUNCE 15 /* 10 - 20 ms */
465492
466493 #define PD_N_CAPS_COUNT (PD_T_NO_RESPONSE / PD_T_SEND_SOURCE_CAP)
467494 #define PD_N_HARD_RESET_COUNT 2
468495
496
+#define PD_P_SNK_STDBY_MW 2500 /* 2500 mW */
497
+
469498 #endif /* __LINUX_USB_PD_H */