Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp662715pxj; Tue, 18 May 2021 11:16:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvFkiYrSnI5iKm5pAtF8pJuQAm9SRW0UHE4IGtaOKHl/A3kej2DRFAK6/GIpm1EPF6VBwh X-Received: by 2002:a05:6402:1719:: with SMTP id y25mr8637952edu.304.1621361819130; Tue, 18 May 2021 11:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621361819; cv=none; d=google.com; s=arc-20160816; b=ioQaW/c41QTnEVae7E+QVnrZVgEhlZM8GbsRr2OsKTyuI6Eg4tIU1efMKuEWvwIyCz 23ejmhf/YJ/DdubsBMduM6hWZvhk4yvTIA+E3ZqlFczYtC8rDIJHnFOw1C45w9AsL3z7 nd2hQdRmeRh5v+Emi/3rLrYSnTdsTeL4Jp+zEcWa4iOVBTO/ueDkMlHJxVdtb7uupOFG 8+CegxjU5kBVk/0x5YNWcTFCGd0WjdEKS4SjZq6pe25cZM/hUo9MyC4hAYHtzNIbFQ2I umBfWn1/RVvyD6lVCHHQ/NluiqDn03zogIHDSbzBHkrDEVcakOSy/1vTmVeq83JjTCup L2zw== 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=tM5wVBfaJbwcR4kiXGGrqmqvyDdHz8NsTNZc1BDf6o8=; b=uhjRgFEr+DnyFs2hvkPsWnhs3F80VPUyRxO2F6TI7182k603WeEPT2qZ0Kwk3BSbvl YdLUDdfn/vyjMha4FkjYXkKIDVv4uCWQt7+PvT8b8jBZ55EvBZd1aeRNMQ8KfJiwoffd STFlWc6YsLACtlLRsw2Ld5Q3jeuhFOlN69SlcJ6pUlIdYeDmuD2RSjOq3MaxfjzkNw4H 1/0RMDzLZGiINGjGv3BXIi5RKzvMSbmjOyEtLnxdJMHCBk8GWoPvTqdt/gtO3/K/Df8d +W6M+gO55CM+GmLuCP7/Zd/fzJBzKFm+kNMlzRooRhUoH9YxsV/g+s8U75UXPPX5yAGg wlUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=McHMvn0G; 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 g20si18191828edt.518.2021.05.18.11.16.35; Tue, 18 May 2021 11:16:59 -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=McHMvn0G; 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 S1345513AbhEQQNG (ORCPT + 99 others); Mon, 17 May 2021 12:13:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:36438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245499AbhEQPsm (ORCPT ); Mon, 17 May 2021 11:48:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 31F3E61D45; Mon, 17 May 2021 14:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262712; bh=ypN5Lw65AuqvnK3+EJEuJgmgMvdvWTB1XhY+/EFHE08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=McHMvn0Gei9kMmVsyvm45VRD+HzlNCeurvwrix3QSmbTl303l7XJjnIvYB/Td7uZP /vv1aHFhq5Xbktw/gKk6Aei6+CpJBdeIwYOlSZsnwDkJlIMpPEowN7jngajE/EAVpk 1dngpN0MDqNHfNLVnzL10c3YIdfM9hsQxkXVRSxM= 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.10 275/289] usb: typec: tcpm: Fix error while calculating PPS out values Date: Mon, 17 May 2021 16:03:20 +0200 Message-Id: <20210517140314.399848569@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 @@ -2501,10 +2501,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); }