Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp213445pxj; Tue, 18 May 2021 01:26:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMfwdmM9F7An18w5OEGa0qGOxzrL3xMDIJ8I+H9D4lso3jd/P5X5FRKiy6f3g0LmIwmf8u X-Received: by 2002:a05:6e02:1c25:: with SMTP id m5mr3212396ilh.295.1621326411826; Tue, 18 May 2021 01:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621326411; cv=none; d=google.com; s=arc-20160816; b=PImMnt87JtMh7lrbrSB2hGDrAwvw13so6pjBRofOuN/tzi40nzPXAAq267iWpclXgH j4p7Hefdu9E4wTYlu7DBLfCeaeXVcc/mYfvfdfNb8fuyWo3ydkUO0QcnTA5h2JRJQNg2 cel648RaG4k3ZSEis4510Rz2ycmNy4AQwHaIKVjWBNy7gm80z92zU+Njs+Dro8QxB33S Eet6nEPTISKTSEkKQtVdROu1hxTl91EMro4jNEnth5njTViKKESmhh66avFu2hHfLyTC hLv3gGSQJ9ILADhQFf7qPybxzxHdwGCnrj2zkuDGFOa6IrTGQrlljLroRh2XyYOUdGCH tC6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UIb29IIpQf7Y5p+MBqMMsiNKBP0e6urzDuplFWZjrLo=; b=0Zd9orhZXDE2T+uzuOmHxVXeDI7ajnM3cWMbcGxzylsVi1gfvsrah435icti0bxJ72 tAj+2hMw7TySQDph+Ysl+o4LUzYYLJOrhvlcA6/kDjzdPTZ5qnpBvbC0Ngm2eloW3Atx //6165EA2lsqo+vxGrQjGs89vBGoUK+lZ20pVXNoAZdPxFIpxk8bjPVsfc4mL6VaDupa IYjMRo78iIq1BWJ9SlrpyJj1Q5UtltlAh2peUS3ofDboR8LvWX9Z9Gsg3Su1tqdwDIBv TRBmUx+S83FkvJyNb/0R270KMyIZyJ9+CnPmT61NLO9jo4HTzOLfMOhAo++y+AX7m2gN YSiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=af3ZcJLu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a7si22226636jat.120.2021.05.18.01.26.36; Tue, 18 May 2021 01:26:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=af3ZcJLu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239881AbhEQPAS (ORCPT + 99 others); Mon, 17 May 2021 11:00:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:39050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241258AbhEQOua (ORCPT ); Mon, 17 May 2021 10:50:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A2D9E61480; Mon, 17 May 2021 14:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261393; bh=3zmsvrqaGYy16ByGXjrsrkNiDHoPdXzTP6TFt0spZaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=af3ZcJLu0rHdDT2qyoUFba+pPNHRkiZoF4gc12NHXNay6lQnOwmXOlRkaZozVQPxM U7iZkCxXRgJnYrDkp7SJMYnTlfmuqBPlBOyqQzp43OUdlOutdABZDSwR0w7n2RB5is wpixUheICgVrZMShOoWTbajyUy7w1BvZENG2kmf0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Badhri Jagan Sridharan Subject: [PATCH 5.12 341/363] usb: typec: tcpm: Fix error while calculating PPS out values Date: Mon, 17 May 2021 16:03:27 +0200 Message-Id: <20210517140314.133311674@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Badhri Jagan Sridharan commit 374157ff88ae1a7f7927331cbc72c1ec11994e8a upstream. "usb: typec: tcpm: Address incorrect values of tcpm psy for pps supply" introduced a regression for req_out_volt and req_op_curr calculation. req_out_volt should consider the newly calculated max voltage instead of previously accepted max voltage by the port partner. Likewise, req_op_curr should consider the newly calculated max current instead of previously accepted max current by the port partner. Fixes: e3a072022487 ("usb: typec: tcpm: Address incorrect values of tcpm psy for pps supply") Reviewed-by: Guenter Roeck Signed-off-by: Badhri Jagan Sridharan Link: https://lore.kernel.org/r/20210415050121.1928298-1-badhri@google.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/tcpm/tcpm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -3145,10 +3145,10 @@ static unsigned int tcpm_pd_select_pps_a port->pps_data.req_max_volt = min(pdo_pps_apdo_max_voltage(src), pdo_pps_apdo_max_voltage(snk)); port->pps_data.req_max_curr = min_pps_apdo_current(src, snk); - port->pps_data.req_out_volt = min(port->pps_data.max_volt, - max(port->pps_data.min_volt, + port->pps_data.req_out_volt = min(port->pps_data.req_max_volt, + max(port->pps_data.req_min_volt, port->pps_data.req_out_volt)); - port->pps_data.req_op_curr = min(port->pps_data.max_curr, + port->pps_data.req_op_curr = min(port->pps_data.req_max_curr, port->pps_data.req_op_curr); }