All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Badhri Jagan Sridharan <badhri@google.com>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Sebastian Reichel <sre@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Amit Sunil Dhamne <amitsd@google.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH v1 3/3] tcpm: Implement sink support for PD SPR AVS negotiation
Date: Mon, 2 Mar 2026 13:55:29 +0100	[thread overview]
Message-ID: <aaWIwQvxrAf-v5ec@black.igk.intel.com> (raw)
In-Reply-To: <20260226055311.2591357-4-badhri@google.com>

On Thu, Feb 26, 2026 at 05:53:11AM +0000, Badhri Jagan Sridharan wrote:
> Add support to enable TCPM to negotiate with
> USB PD Standard Power Range Adjustable Voltage Supply (SPR AVS) when
> acting as a power sink.
> 
> * Added support to the tcpm power supply properties, allowing userspace
>   to enable and control the dynamic limits (voltage and current)
>   specific to the SPR AVS contract.
> * Implemented tcpm_pd_select_spr_avs_apdo() to select the appropriate
>   APDO and validate the requested voltage/current against both the
>   Source and Sink capabilities.
> * Implemented tcpm_pd_build_spr_avs_request() to construct the
>   Request Data Object (RDO) for SPR AVS.
> * Added SNK_NEGOTIATE_SPR_AVS_CAPABILITIES state to the state machine to
>   handle negotiation for SPR AVS.
> * Updated the SNK_TRANSITION_SINK state to implement the SPR
>   AVS-specific VBUS transition rules, including reducing current draw to
>   PD_I_SNK_STBY_MA for large voltage changes, as required by USB PD spec.
> 
> Log stub captured when enabling AVS:
> $ echo 3 > /sys/class/power_supply/tcpm-source-psy-1-0025/online
> $ cat /d/usb/tcpm-1-0025/log
> [  358.895775] request to set AVS online
> [  358.895792] AMS POWER_NEGOTIATION start
> [  358.895806] state change SNK_READY -> AMS_START [rev3 POWER_NEGOTIATION]
> [  358.895850] state change AMS_START -> SNK_NEGOTIATE_SPR_AVS_CAPABILITIES [rev3 POWER_NEGOTIATION]
> [  358.895866] SPR AVS src_pdo_index:4 snk_pdo_index:2 req_op_curr_ma roundup:2200 req_out_volt_mv roundup:9000
> [  358.895880] Requesting APDO SPR AVS 4: 9000 mV, 2200 mA
> [  358.896405] set_auto_vbus_discharge_threshold mode:0 pps_active:n vbus:0 pps_apdo_min_volt:0 ret:0
> [  358.896422] PD TX, header: 0x1a82
> [  358.900158] PD TX complete, status: 0
> [  358.900205] pending state change SNK_NEGOTIATE_SPR_AVS_CAPABILITIES -> HARD_RESET_SEND @ 60 ms [rev3 POWER_NEGOTIATION]
> [  358.904832] PD RX, header: 0x1a3 [1]
> [  358.904854] state change SNK_NEGOTIATE_SPR_AVS_CAPABILITIES -> SNK_TRANSITION_SINK [rev3 POWER_NEGOTIATION]
> [  358.904888] pending state change SNK_TRANSITION_SINK -> HARD_RESET_SEND @ 700 ms [rev3 POWER_NEGOTIATION]
> [  359.021530] PD RX, header: 0x3a6 [1]
> [  359.021546] Setting voltage/current limit 9000 mV 2200 mA
> [  359.023035] set_auto_vbus_discharge_threshold mode:3 pps_active:n vbus:9000 pps_apdo_min_volt:0 ret:0
> [  359.023053] state change SNK_TRANSITION_SINK -> SNK_READY [rev3 POWER_NEGOTIATION]
> [  359.023090] AMS POWER_NEGOTIATION finished
> 
> $ cat /sys/class/power_supply/tcpm-source-psy-1-0025/online
> 3
> 
> Log stub captured when increasing voltage:
> $ echo 9100000 > /sys/class/power_supply/tcpm-source-psy-1-0025/voltage_now
> $ cat /d/usb/tcpm-1-0025/log
> 
> [  632.116714] AMS POWER_NEGOTIATION start
> [  632.116728] state change SNK_READY -> AMS_START [rev3 POWER_NEGOTIATION]
> [  632.116779] state change AMS_START -> SNK_NEGOTIATE_SPR_AVS_CAPABILITIES [rev3 POWER_NEGOTIATION]
> [  632.116798] SPR AVS src_pdo_index:4 snk_pdo_index:2 req_op_curr_ma roundup:2200 req_out_volt_mv roundup:9100
> [  632.116811] Requesting APDO SPR AVS 4: 9100 mV, 2200 mA
> [  632.117315] set_auto_vbus_discharge_threshold mode:0 pps_active:n vbus:0 pps_apdo_min_volt:0 ret:0
> [  632.117328] PD TX, header: 0x1c82
> [  632.121007] PD TX complete, status: 0
> [  632.121052] pending state change SNK_NEGOTIATE_SPR_AVS_CAPABILITIES -> HARD_RESET_SEND @ 60 ms [rev3 POWER_NEGOTIATION]
> [  632.124572] PD RX, header: 0x5a3 [1]
> [  632.124594] state change SNK_NEGOTIATE_SPR_AVS_CAPABILITIES -> SNK_TRANSITION_SINK [rev3 POWER_NEGOTIATION]
> [  632.124623] pending state change SNK_TRANSITION_SINK -> HARD_RESET_SEND @ 700 ms [rev3 POWER_NEGOTIATION]
> [  632.149256] PD RX, header: 0x7a6 [1]
> [  632.149271] Setting voltage/current limit 9100 mV 2200 mA
> [  632.150770] set_auto_vbus_discharge_threshold mode:3 pps_active:n vbus:9100 pps_apdo_min_volt:0 ret:0
> [  632.150787] state change SNK_TRANSITION_SINK -> SNK_READY [rev3 POWER_NEGOTIATION]
> [  632.150823] AMS POWER_NEGOTIATION finished
> 
> $ cat /sys/class/power_supply/tcpm-source-psy-1-0025/voltage_now
> 9100000
> 
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> Reviewed-by: Amit Sunil Dhamne <amitsd@google.com>

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

-- 
heikki

      reply	other threads:[~2026-03-02 12:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26  5:53 [PATCH v1 0/3] Add support for AVS in TCPM Badhri Jagan Sridharan
2026-02-26  5:53 ` [PATCH v1 1/3] dt-bindings: connector: Add SPR AVS Sink APDO definitions Badhri Jagan Sridharan
2026-03-06  0:58   ` Rob Herring (Arm)
2026-02-26  5:53 ` [PATCH v1 2/3] power: supply: Add PD SPR AVS support to USB type enum Badhri Jagan Sridharan
2026-03-09 15:22   ` Sebastian Reichel
2026-03-16 22:34     ` Badhri Jagan Sridharan
2026-02-26  5:53 ` [PATCH v1 3/3] tcpm: Implement sink support for PD SPR AVS negotiation Badhri Jagan Sridharan
2026-03-02 12:55   ` Heikki Krogerus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aaWIwQvxrAf-v5ec@black.igk.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=amitsd@google.com \
    --cc=badhri@google.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.