From ea72aea47d262505fa0f453dc0700200cc110b26 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sat, 9 Dec 2023 23:02:20 +1100 Subject: [PATCH] Enforce no EPR polling for non >20V devices --- source/Core/BSP/MHP30/configuration.h | 5 +++-- source/Core/BSP/Miniware/configuration.h | 6 ++++-- source/Core/BSP/Pinecil/configuration.h | 15 ++++++++------- source/Core/BSP/Pinecilv2/configuration.h | 1 + source/Core/BSP/Sequre_S60/configuration.h | 1 + source/Core/Drivers/USBPD.cpp | 2 +- source/Core/Drivers/usb-pd | 2 +- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/source/Core/BSP/MHP30/configuration.h b/source/Core/BSP/MHP30/configuration.h index 5f477c16..6cefa404 100644 --- a/source/Core/BSP/MHP30/configuration.h +++ b/source/Core/BSP/MHP30/configuration.h @@ -152,8 +152,9 @@ #define PROFILE_SUPPORT -#define POW_PD 1 -#define POW_PD_EXT 0 +#define POW_PD 1 +#define POW_PD_EXT 0 +#define USB_PD_EPR_WATTAGE 0 /*No EPR*/ #define TEMP_NTC #define I2C_SOFT_BUS_2 1 #define I2C_SOFT_BUS_1 1 diff --git a/source/Core/BSP/Miniware/configuration.h b/source/Core/BSP/Miniware/configuration.h index 9091b6fa..6fed0d53 100644 --- a/source/Core/BSP/Miniware/configuration.h +++ b/source/Core/BSP/Miniware/configuration.h @@ -198,6 +198,7 @@ #define TIP_HAS_DIRECT_PWM 1 #define POW_DC 1 #define POW_PD 1 +#define USB_PD_EPR_WATTAGE 140 /* EPR Supported */ #define I2C_SOFT_BUS_2 1 #define OLED_I2CBB1 1 #define USB_PD_I2CBB2 1 @@ -252,8 +253,9 @@ #define OLED_I2CBB1 1 #define ACCEL_I2CBB1 1 -#define POW_PD 1 -#define POW_QC 1 +#define POW_PD 1 +#define USB_PD_EPR_WATTAGE 0 /*No EPR*/ +#define POW_QC 1 #define TEMP_NTC #define SC7_ORI_FLIP #endif /* TS80P */ diff --git a/source/Core/BSP/Pinecil/configuration.h b/source/Core/BSP/Pinecil/configuration.h index 06d2e7c4..bced8207 100644 --- a/source/Core/BSP/Pinecil/configuration.h +++ b/source/Core/BSP/Pinecil/configuration.h @@ -86,7 +86,7 @@ #define POWER_PULSE_DEFAULT 0 #else #define POWER_PULSE_DEFAULT 5 -#endif /* Pinecil */ +#endif /* Pinecil */ #define POWER_PULSE_WAIT_DEFAULT 4 // Default rate of the power pulse: 4*2500 = 10000 ms = 10 s #define POWER_PULSE_DURATION_DEFAULT 1 // Default duration of the power pulse: 1*250 = 250 ms @@ -145,12 +145,13 @@ #define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C #define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F -#define POW_PD 1 -#define POW_PD_EXT 0 -#define POW_QC 1 -#define POW_DC 1 -#define POW_QC_20V 1 -#define ENABLE_QC2 1 +#define POW_PD 1 +#define USB_PD_EPR_WATTAGE 0 /*No EPR (Yet?) */ +#define POW_PD_EXT 0 +#define POW_QC 1 +#define POW_DC 1 +#define POW_QC_20V 1 +#define ENABLE_QC2 1 #define TEMP_TMP36 #define ACCEL_BMA #define ACCEL_SC7 diff --git a/source/Core/BSP/Pinecilv2/configuration.h b/source/Core/BSP/Pinecilv2/configuration.h index 5297f3a4..84425f0e 100644 --- a/source/Core/BSP/Pinecilv2/configuration.h +++ b/source/Core/BSP/Pinecilv2/configuration.h @@ -146,6 +146,7 @@ #define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F #define DEVICE_HAS_VALIDATION_CODE // We have 2 digit validations #define POW_PD 1 // Supported features +#define USB_PD_EPR_WATTAGE 140 // USB PD EPR Wattage #define POW_PD_EXT 0 // Future-proof macro for other models with other PD modes #define POW_QC 1 // Supported features #define POW_DC 1 // Supported features diff --git a/source/Core/BSP/Sequre_S60/configuration.h b/source/Core/BSP/Sequre_S60/configuration.h index e97e8ee9..36a2e113 100644 --- a/source/Core/BSP/Sequre_S60/configuration.h +++ b/source/Core/BSP/Sequre_S60/configuration.h @@ -156,6 +156,7 @@ #define OLED_128x32 #define GPIO_VIBRATION #define POW_PD_EXT 1 +#define USB_PD_EPR_WATTAGE 0 /*No EPR*/ #define DEBUG_POWER_MENU_BUTTON_B 1 #define HAS_POWER_DEBUG_MENU #define TEMP_NTC diff --git a/source/Core/Drivers/USBPD.cpp b/source/Core/Drivers/USBPD.cpp index 7bdd4113..276addb9 100644 --- a/source/Core/Drivers/USBPD.cpp +++ b/source/Core/Drivers/USBPD.cpp @@ -27,7 +27,7 @@ bool pdbs_dpm_evaluate_capability(const pd_msg *capabilities, pd_msg *re void pdbs_dpm_get_sink_capability(pd_msg *cap, const bool isPD3); bool EPREvaluateCapabilityFunc(const epr_pd_msg *capabilities, pd_msg *request); FUSB302 fusb((0x22 << 1), fusb_read_buf, fusb_write_buf, ms_delay); // Create FUSB driver -PolicyEngine pe(fusb, get_ms_timestamp, ms_delay, pdbs_dpm_get_sink_capability, pdbs_dpm_evaluate_capability, EPREvaluateCapabilityFunc, 140); +PolicyEngine pe(fusb, get_ms_timestamp, ms_delay, pdbs_dpm_get_sink_capability, pdbs_dpm_evaluate_capability, EPREvaluateCapabilityFunc, USB_PD_EPR_WATTAGE); int USBPowerDelivery::detectionState = 0; uint16_t requested_voltage_mv = 0; diff --git a/source/Core/Drivers/usb-pd b/source/Core/Drivers/usb-pd index feef7101..609dda7d 160000 --- a/source/Core/Drivers/usb-pd +++ b/source/Core/Drivers/usb-pd @@ -1 +1 @@ -Subproject commit feef71016cb3f3d5731f926c0d09b692aaaa9b7e +Subproject commit 609dda7d16a5d572b87794f4fd3b3c01f1bfd1f8