| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * 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. |
|---|
| 13 | 4 | */ |
|---|
| 14 | 5 | |
|---|
| 15 | 6 | #ifndef __LINUX_USB_PD_H |
|---|
| .. | .. |
|---|
| 54 | 45 | PD_DATA_BATT_STATUS = 5, |
|---|
| 55 | 46 | PD_DATA_ALERT = 6, |
|---|
| 56 | 47 | PD_DATA_GET_COUNTRY_INFO = 7, |
|---|
| 57 | | - /* 8-14 Reserved */ |
|---|
| 48 | + PD_DATA_ENTER_USB = 8, |
|---|
| 49 | + /* 9-14 Reserved */ |
|---|
| 58 | 50 | PD_DATA_VENDOR_DEF = 15, |
|---|
| 59 | 51 | /* 16-31 Reserved */ |
|---|
| 60 | 52 | }; |
|---|
| .. | .. |
|---|
| 233 | 225 | #define PDO_FIXED_EXTPOWER BIT(27) /* Externally powered */ |
|---|
| 234 | 226 | #define PDO_FIXED_USB_COMM BIT(26) /* USB communications capable */ |
|---|
| 235 | 227 | #define PDO_FIXED_DATA_SWAP BIT(25) /* Data role swap supported */ |
|---|
| 228 | +#define PDO_FIXED_UNCHUNK_EXT BIT(24) /* Unchunked Extended Message supported (Source) */ |
|---|
| 236 | 229 | #define PDO_FIXED_FRS_CURR_MASK (BIT(24) | BIT(23)) /* FR_Swap Current (Sink) */ |
|---|
| 237 | 230 | #define PDO_FIXED_FRS_CURR_SHIFT 23 |
|---|
| 238 | 231 | #define PDO_FIXED_VOLT_SHIFT 10 /* 50mV units */ |
|---|
| .. | .. |
|---|
| 429 | 422 | return ((rdo >> RDO_BATT_MAX_PWR_SHIFT) & RDO_PWR_MASK) * 250; |
|---|
| 430 | 423 | } |
|---|
| 431 | 424 | |
|---|
| 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 | + |
|---|
| 432 | 455 | /* USB PD timers and counters */ |
|---|
| 433 | 456 | #define PD_T_NO_RESPONSE 5000 /* 4.5 - 5.5 seconds */ |
|---|
| 434 | 457 | #define PD_T_DB_DETECT 10000 /* 10 - 15 seconds */ |
|---|
| .. | .. |
|---|
| 444 | 467 | #define PD_T_DRP_SRC 30 |
|---|
| 445 | 468 | #define PD_T_PS_SOURCE_OFF 920 |
|---|
| 446 | 469 | #define PD_T_PS_SOURCE_ON 480 |
|---|
| 470 | +#define PD_T_PS_SOURCE_ON_PRS 450 /* 390 - 480ms */ |
|---|
| 447 | 471 | #define PD_T_PS_HARD_RESET 30 |
|---|
| 448 | 472 | #define PD_T_SRC_RECOVER 760 |
|---|
| 449 | 473 | #define PD_T_SRC_RECOVER_MAX 1000 |
|---|
| .. | .. |
|---|
| 452 | 476 | #define PD_T_VCONN_SOURCE_ON 100 |
|---|
| 453 | 477 | #define PD_T_SINK_REQUEST 100 /* 100 ms minimum */ |
|---|
| 454 | 478 | #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 */ |
|---|
| 457 | 481 | #define PD_T_SWAP_SRC_START 20 /* Minimum of 20ms */ |
|---|
| 482 | +#define PD_T_BIST_CONT_MODE 50 /* 30 - 60 ms */ |
|---|
| 458 | 483 | #define PD_T_SINK_TX 16 /* 16 - 20 ms */ |
|---|
| 484 | +#define PD_T_CHUNK_NOT_SUPP 42 /* 40 - 50 ms */ |
|---|
| 459 | 485 | |
|---|
| 460 | 486 | #define PD_T_DRP_TRY 100 /* 75 - 150 ms */ |
|---|
| 461 | 487 | #define PD_T_DRP_TRYWAIT 600 /* 400 - 800 ms */ |
|---|
| 462 | 488 | |
|---|
| 463 | 489 | #define PD_T_CC_DEBOUNCE 200 /* 100 - 200 ms */ |
|---|
| 464 | 490 | #define PD_T_PD_DEBOUNCE 20 /* 10 - 20 ms */ |
|---|
| 491 | +#define PD_T_TRY_CC_DEBOUNCE 15 /* 10 - 20 ms */ |
|---|
| 465 | 492 | |
|---|
| 466 | 493 | #define PD_N_CAPS_COUNT (PD_T_NO_RESPONSE / PD_T_SEND_SOURCE_CAP) |
|---|
| 467 | 494 | #define PD_N_HARD_RESET_COUNT 2 |
|---|
| 468 | 495 | |
|---|
| 496 | +#define PD_P_SNK_STDBY_MW 2500 /* 2500 mW */ |
|---|
| 497 | + |
|---|
| 469 | 498 | #endif /* __LINUX_USB_PD_H */ |
|---|