From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Badhri Jagan Sridharan <badhri@google.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Kyle Tso <kyletso@google.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v1] usb: typec: tcpci: Fix up sink disconnect thresholds for PD
Date: Wed, 16 Jun 2021 16:40:38 +0300 [thread overview]
Message-ID: <YMn/Vu13ApE1t024@kuha.fi.intel.com> (raw)
In-Reply-To: <20210615174323.1160132-1-badhri@google.com>
On Tue, Jun 15, 2021 at 10:43:23AM -0700, Badhri Jagan Sridharan wrote:
> "Table 4-3 VBUS Sink Characteristics" of "Type-C Cable and Connector
> Specification" defines the disconnect voltage thresholds of various
> configurations. This change fixes the disconnect threshold voltage
> calculation based on vSinkPD_min and vSinkDisconnectPD as defined
> by the table.
>
> Fixes: e1a97bf80a022 ("usb: typec: tcpci: Implement Auto discharge disconnect callbacks")
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/tcpm/tcpci.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index 22862345d1ab..9858716698df 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -21,8 +21,12 @@
> #define PD_RETRY_COUNT_DEFAULT 3
> #define PD_RETRY_COUNT_3_0_OR_HIGHER 2
> #define AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV 3500
> -#define AUTO_DISCHARGE_PD_HEADROOM_MV 850
> -#define AUTO_DISCHARGE_PPS_HEADROOM_MV 1250
> +#define VSINKPD_MIN_IR_DROP_MV 750
> +#define VSRC_NEW_MIN_PERCENT 95
> +#define VSRC_VALID_MIN_MV 500
> +#define VPPS_NEW_MIN_PERCENT 95
> +#define VPPS_VALID_MIN_MV 100
> +#define VSINKDISCONNECT_PD_MIN_PERCENT 90
>
> #define tcpc_presenting_rd(reg, cc) \
> (!(TCPC_ROLE_CTRL_DRP & (reg)) && \
> @@ -351,11 +355,13 @@ static int tcpci_set_auto_vbus_discharge_threshold(struct tcpc_dev *dev, enum ty
> threshold = AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV;
> } else if (mode == TYPEC_PWR_MODE_PD) {
> if (pps_active)
> - threshold = (95 * requested_vbus_voltage_mv / 100) -
> - AUTO_DISCHARGE_PD_HEADROOM_MV;
> + threshold = ((VPPS_NEW_MIN_PERCENT * requested_vbus_voltage_mv / 100) -
> + VSINKPD_MIN_IR_DROP_MV - VPPS_VALID_MIN_MV) *
> + VSINKDISCONNECT_PD_MIN_PERCENT / 100;
> else
> - threshold = (95 * requested_vbus_voltage_mv / 100) -
> - AUTO_DISCHARGE_PPS_HEADROOM_MV;
> + threshold = ((VSRC_NEW_MIN_PERCENT * requested_vbus_voltage_mv / 100) -
> + VSINKPD_MIN_IR_DROP_MV - VSRC_VALID_MIN_MV) *
> + VSINKDISCONNECT_PD_MIN_PERCENT / 100;
> } else {
> /* 3.5V for non-pd sink */
> threshold = AUTO_DISCHARGE_DEFAULT_THRESHOLD_MV;
> --
> 2.32.0.272.g935e593368-goog
--
heikki
prev parent reply other threads:[~2021-06-16 13:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-15 17:43 [PATCH v1] usb: typec: tcpci: Fix up sink disconnect thresholds for PD Badhri Jagan Sridharan
2021-06-16 13:40 ` 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=YMn/Vu13ApE1t024@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=badhri@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=kyletso@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=stable@vger.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.