Skip to content

Commit af833e7

Browse files
bleungatchromiumgregkh
authored andcommitted
usb: typec: ucsi: psy: Set current max to 100mA for BC 1.2 and Default
ucsi_psy_get_current_max would return 0mA as the maximum current if UCSI detected a BC or a Default USB Power sporce. The comment in this function is true that we can't tell the difference between DCP/CDP or SDP chargers, but we can guarantee that at least 1-unit of USB 1.1/2.0 power is available, which is 100mA, which is a better fallback value than 0, which causes some userspaces, including the ChromeOS power manager, to regard this as a power source that is not providing any power. In reality, 100mA is guaranteed from all sources in these classes. Signed-off-by: Benson Leung <[email protected]> Reviewed-by: Jameson Thies <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1e61f6a commit af833e7

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

drivers/usb/typec/ucsi/psy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static int ucsi_psy_get_current_max(struct ucsi_connector *con,
164164
case UCSI_CONSTAT_PWR_OPMODE_DEFAULT:
165165
/* UCSI can't tell b/w DCP/CDP or USB2/3x1/3x2 SDP chargers */
166166
default:
167-
val->intval = 0;
167+
val->intval = UCSI_TYPEC_DEFAULT_CURRENT * 1000;
168168
break;
169169
}
170170
return 0;

drivers/usb/typec/ucsi/ucsi.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,10 @@ struct ucsi {
483483
#define UCSI_MAX_SVID 5
484484
#define UCSI_MAX_ALTMODES (UCSI_MAX_SVID * 6)
485485

486-
#define UCSI_TYPEC_VSAFE5V 5000
487-
#define UCSI_TYPEC_1_5_CURRENT 1500
488-
#define UCSI_TYPEC_3_0_CURRENT 3000
486+
#define UCSI_TYPEC_VSAFE5V 5000
487+
#define UCSI_TYPEC_DEFAULT_CURRENT 100
488+
#define UCSI_TYPEC_1_5_CURRENT 1500
489+
#define UCSI_TYPEC_3_0_CURRENT 3000
489490

490491
struct ucsi_connector {
491492
int num;

0 commit comments

Comments
 (0)