Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3477006imu; Sun, 11 Nov 2018 16:00:41 -0800 (PST) X-Google-Smtp-Source: AJdET5eYLAlecSnBbvWeHV2nAURw42UBSEhH0Ef6KnGNn5ne5ETNgDRv61hE/PxqLhVFxeu5K8tx X-Received: by 2002:a17:902:162:: with SMTP id 89-v6mr17831019plb.293.1541980841921; Sun, 11 Nov 2018 16:00:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980841; cv=none; d=google.com; s=arc-20160816; b=jrtYiHLmpvMaz8bmN9HIjKPv1kn5uJXnUQqYYPNT7YZv079qucRtN2H2PPsW5zHQol Uw1z5IazFh6K53JaLwoMJt1Ak/xGNRM8/rBFz+VK7YuhNPDRnuDzTrICWxX8WPFpeu5E 13FUf0eJo6c3MpQF04WNlPU+bSY8V6Nz38cAEVj22+2BZU28tUWJuV7qzwSioxLuo/D9 aIbKM316gtJaZIMxwa7scvpe6hpB7fU8GuYJa/MrQRjT97QZ+1WW8A/7XFnBBnMU+Eq1 16VznDNhippC5WYHC7AwDV551m9llcRXfQDKffeKFWI1pMvyOnC8C1L8wDx8+g6WbRjk bMeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wFvrGrF7MgugkjLD2bd/nhMLCjd4y+qG98wEY14xE2M=; b=XZig1C1oxvpH7f+kgS7IzZiH33C2WaTvs/Xy6WQZyuT848omqHKGC/1ORuyYI4qvDQ cRaViWzK4M6LHFHuX5aQPJ3PeoRH0RCJ1U83w2r3RJuiZsa8qeSrGse+lWu5qcCvoh4Q P4rmwegaXaAuvrWLEzNkKADmNlzOTHR6luYMD4JNrwSYJdKjIhJ89XhyVX73STP5i3A0 P+Zn0wtcGW3tW6529P0uYgy+Izh/mOcYHMS4MYlcuW+AP6ac/GMLHOWycpPHvk8O9j70 XDr/coFqofLwlHGUleU3xv3/LEy2X4tfOFbronjiBPzyTqIck+lh31nbzkMjWE3/ARZI MImA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qd7Ypr2h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k71si14388247pgd.351.2018.11.11.16.00.26; Sun, 11 Nov 2018 16:00:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qd7Ypr2h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732653AbeKLJub (ORCPT + 99 others); Mon, 12 Nov 2018 04:50:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:35336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732323AbeKLISB (ORCPT ); Mon, 12 Nov 2018 03:18:01 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E8F79223AE; Sun, 11 Nov 2018 22:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975286; bh=QvD2yYSKxM01tVJHZpOCmBlKrJLkWN5CSYuQ5Mzscj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qd7Ypr2hGYkAzU7vOY0lfEL7aPY2njQxqEywy482zRP/yUdMVwTMfEMxcKYOo0b1d lNIvDqJIJwevtIp2p5ezKpniml/7bjBx92kxiZ9KgqtFaQcV/iRQr4lz9KdMsRYAOJ CZTEogdv9HYJcet3/L05H7F54UeCTj81i/Ho1V6I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Thomson , Heikki Krogerus , Guenter Roeck Subject: [PATCH 4.19 209/361] usb: typec: tcpm: Fix APDO PPS order checking to be based on voltage Date: Sun, 11 Nov 2018 14:19:16 -0800 Message-Id: <20181111221649.462027969@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Adam Thomson commit 1b6af2f58c2b1522e0804b150ca95e50a9e80ea7 upstream. Current code mistakenly checks against max current to determine order but this should be max voltage. This commit fixes the issue so order is correctly determined, thus avoiding failure based on a higher voltage PPS APDO having a lower maximum current output, which is actually valid. Fixes: 2eadc33f40d4 ("typec: tcpm: Add core support for sink side PPS") Cc: Signed-off-by: Adam Thomson Reviewed-by: Heikki Krogerus Reviewed-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/tcpm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/typec/tcpm.c +++ b/drivers/usb/typec/tcpm.c @@ -1430,8 +1430,8 @@ static enum pdo_err tcpm_caps_err(struct if (pdo_apdo_type(pdo[i]) != APDO_TYPE_PPS) break; - if (pdo_pps_apdo_max_current(pdo[i]) < - pdo_pps_apdo_max_current(pdo[i - 1])) + if (pdo_pps_apdo_max_voltage(pdo[i]) < + pdo_pps_apdo_max_voltage(pdo[i - 1])) return PDO_ERR_PPS_APDO_NOT_SORTED; else if (pdo_pps_apdo_min_voltage(pdo[i]) == pdo_pps_apdo_min_voltage(pdo[i - 1]) &&