aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2023-04-22 11:33:02 +0100
committerMarc Zyngier <maz@kernel.org>2023-04-22 12:01:42 +0100
commitb12951935bb7132713110b0f360684534291a26a (patch)
treede6d4264172cc8f36be658794f3d6bc36fe16c2c
parent20205ef94fc3648a9bc003328c9651d440350802 (diff)
downloadcs-sw-b12951935bb7132713110b0f360684534291a26a.tar.gz
Don't advertise a valid power-supply via SOURCE_CAP
On a M2 MBA, disconnecting the power source results in a constant PD renegotiation, as we advertise a power supply but never provide any current (we advertise 5V, 1.5A... good luck with that). Change the advertised source capability to be a non-battery variable power supply that has nothing to offer (0V, 0mA). This ensures that the DUT will not try to source anything from it, and thus doesn't renegociate. See 6.4.1.2.4 "Variable Supply (non-Battery) Power Data Object" in the USB-PD 2.0 spec. This certainly seem to work with my M2 MBA, but it should be obvious to anyone that I have no idea what I'm doing here! Signed-off-by: Marc Zyngier <maz@kernel.org>
-rw-r--r--vdmtool.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vdmtool.c b/vdmtool.c
index af3de8d..8bf29cd 100644
--- a/vdmtool.c
+++ b/vdmtool.c
@@ -174,7 +174,7 @@ static void send_sink_cap(struct vdm_context *cxt)
static void send_source_cap(struct vdm_context *cxt)
{
int16_t hdr = PD_HEADER(PD_DATA_SOURCE_CAP, 1, 1, 0, 1, PD_REV20, 0);
- uint32_t cap = 0x37019096;
+ uint32_t cap = 1UL << 31; /* Variable non-battery PS, 0V, 0mA */
fusb302_tcpm_transmit(PORT(cxt), TCPC_TX_SOP, hdr, &cap);
cprintf(cxt, ">SOURCE_CAP\n");