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 <bleung@chromium.org>
Reviewed-by: Jameson Thies <jthies@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20250717200805.3710473-1-bleung@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Benson Leung 2025-07-17 20:08:05 +00:00 committed by Greg Kroah-Hartman
parent 1e61f6ab08
commit af833e7f7d
2 changed files with 5 additions and 4 deletions

View File

@ -164,7 +164,7 @@ static int ucsi_psy_get_current_max(struct ucsi_connector *con,
case UCSI_CONSTAT_PWR_OPMODE_DEFAULT: case UCSI_CONSTAT_PWR_OPMODE_DEFAULT:
/* UCSI can't tell b/w DCP/CDP or USB2/3x1/3x2 SDP chargers */ /* UCSI can't tell b/w DCP/CDP or USB2/3x1/3x2 SDP chargers */
default: default:
val->intval = 0; val->intval = UCSI_TYPEC_DEFAULT_CURRENT * 1000;
break; break;
} }
return 0; return 0;

View File

@ -483,9 +483,10 @@ struct ucsi {
#define UCSI_MAX_SVID 5 #define UCSI_MAX_SVID 5
#define UCSI_MAX_ALTMODES (UCSI_MAX_SVID * 6) #define UCSI_MAX_ALTMODES (UCSI_MAX_SVID * 6)
#define UCSI_TYPEC_VSAFE5V 5000 #define UCSI_TYPEC_VSAFE5V 5000
#define UCSI_TYPEC_1_5_CURRENT 1500 #define UCSI_TYPEC_DEFAULT_CURRENT 100
#define UCSI_TYPEC_3_0_CURRENT 3000 #define UCSI_TYPEC_1_5_CURRENT 1500
#define UCSI_TYPEC_3_0_CURRENT 3000
struct ucsi_connector { struct ucsi_connector {
int num; int num;