From patchwork Fri Apr 13 05:55:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10339553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B9ADD6039A for ; Fri, 13 Apr 2018 06:11:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86A1E286B5 for ; Fri, 13 Apr 2018 06:11:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AABF286BC; Fri, 13 Apr 2018 06:11:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE198286B5 for ; Fri, 13 Apr 2018 06:11:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751041AbeDMGLX (ORCPT ); Fri, 13 Apr 2018 02:11:23 -0400 Received: from mail-db5eur01on0056.outbound.protection.outlook.com ([104.47.2.56]:51936 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750989AbeDMGLW (ORCPT ); Fri, 13 Apr 2018 02:11:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=CwMWiHVfpPDefG3KD9ezyLV3Mvi2LdbZ6HY0xI+wj0w=; b=fkNh7ug07ndv/IJqPP27bL12XeEkVopDdMQSBFtUY55ICeC24+MFO4Lv3J6HNwdvtymlrmhYHMG0w6MyJehi5gXjOEAJwgTQByAnrQROi9qSJubN5m/qp68k9jauR20zmSNZalxTsI/+iJV9RuDaxHEBJrk+rYUdcfks52B3UJo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jun.li@nxp.com; Received: from b47624-OptiPlex-7040.ap.freescale.net (92.121.68.129) by AM0PR0402MB3906.eurprd04.prod.outlook.com (2603:10a6:208:f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.675.10; Fri, 13 Apr 2018 06:11:17 +0000 From: Li Jun To: gregkh@linuxfoundation.org, robh+dt@kernel.org, heikki.krogerus@linux.intel.com, hdegoede@redhat.com Cc: linux@roeck-us.net, rmfrfs@gmail.com, yueyao.zhu@gmail.com, linux-usb@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH v3 1/5] usb: typec: tcpm: pdo matching optimization Date: Fri, 13 Apr 2018 13:55:09 +0800 Message-Id: <1523598913-11507-2-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523598913-11507-1-git-send-email-jun.li@nxp.com> References: <1523598913-11507-1-git-send-email-jun.li@nxp.com> MIME-Version: 1.0 X-Originating-IP: [92.121.68.129] X-ClientProxiedBy: KL1PR0302CA0007.apcprd03.prod.outlook.com (2603:1096:802::17) To AM0PR0402MB3906.eurprd04.prod.outlook.com (2603:10a6:208:f::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:AM0PR0402MB3906; X-Microsoft-Exchange-Diagnostics: 1; AM0PR0402MB3906; 3:5UCocR4zeE8NZU2QcBcQJBFx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Hq06PI4ntLK/r8ifcsYFiTBg+D1noXvOlXPYlBqsfw+rBxoQFlK+CoyJ/kpNdzWwuFJHGE2WW241CipSyxPa+Pwf1FDDe4iGIK9N7FiM6jlQdVqvTSuULVjWa2IlFIel8KGnDolNmmoHUbp7HqXkQbtZdoRaXsG+xcKF5tTh4yStTKj4iDxbtfRazHAFLEKrw03GHdNyvrP03MAd42ZBUwa6v82wnLdY8Cub3O6yHxbTJ0FVtj7LP/nIgfcehLfkCHbc2Jrn8CpbsLXg5/3enCffBzg8IG5RAvpudWD0XhrfbE1AgLyXVLdsLz7dYZGsJF2; 4:Wg8jm83lbseEr9zJQ5RrzXp/QVfMcCg/tBXlKdStzu0rDvGzSsvJPkE/JVpu4+4Zh/Dx2IUr3fsbuNXgUnlcGWipNFbb6tj6T8aHajuQPxx7wQRAX9oO2qWCassrvX6z6aEJsloneHTpm8ca9vnBU9MHZZvllBNVYRd5tm7nzWDi3pwmSkUkh3ZSmtJ/85qIHzvXP21E1BC0btymUGKjtgE3SOu35NiFFjZfAliMXj7KTn+0vbw4+frBydRjV6hgzaimPUe+k+KtyXxNqJp1UDzHPOM6GUmR/O2J2Q96ci9J+SjjqfMif2e+pZOqbAOd X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231232)(944501327)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:AM0PR0402MB3906; BCL:0; PCL:0; RULEID:; SRVR:AM0PR0402MB3906; X-Forefront-PRVS: 0641678E68 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39380400002)(396003)(376002)(366004)(39860400002)(189003)(199004)(478600001)(8676002)(6666003)(4326008)(68736007)(5660300001)(8936002)(50226002)(6486002)(81156014)(81166006)(26005)(36756003)(53936002)(6506007)(386003)(59450400001)(105586002)(3846002)(47776003)(51416003)(6512007)(97736004)(86362001)(25786009)(48376002)(76176011)(575784001)(52116002)(66066001)(16526019)(50466002)(6116002)(305945005)(2906002)(956004)(2616005)(106356001)(486006)(316002)(16586007)(11346002)(186003)(476003)(446003)(7736002)(39060400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0402MB3906; H:b47624-OptiPlex-7040.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR0402MB3906; 23:FSpngoXbFQucc+4/EGCV7H1wRvrJQa8KTEngwET?= =?us-ascii?Q?TTAmp+7JMe+z2f/HfAo3zs/CZX+M6EizkksNAg1Chk6VHfyiOKWUu8gV4az9?= =?us-ascii?Q?u0sWXW3GV9TnPP5QAa11n3DGIst0LlPss9Gpk9YV5/WMvbc1ReT/yD5ON2mF?= =?us-ascii?Q?UFAKQ8AjJ5YClvizba7Q+MxBGrJPbOYjTnE6OxL5eFWSQBdL6JJgupTW5HfN?= =?us-ascii?Q?8FHIWnbYY7nFU3ZCHOPyfCALrcC8xhE5LCqTaNNfXWQGW5ThzrvYAsIT6TDM?= =?us-ascii?Q?xwZSXHH4yxFh+Kq/QkIWK8Z6jCQoXREWKwXD8yS/lEbmgIMyPKrWYISwm5vw?= =?us-ascii?Q?/zIimre2IGFHUbLR3hvi0Jj+bavTClQLSpFeHknYtUZjDytOD5NRpeRgq2u8?= =?us-ascii?Q?nDE0uXD9hLOV739q2sUucrHhh+9JLHNI2OWhju/Y2h956e0U3AJpD2buoSzl?= =?us-ascii?Q?dmqrOW061CplEbwIO1VelQ4cOLoDRPJSYMOWt8Tt9T1z6i6YrjbehKtRtbJL?= =?us-ascii?Q?eZ23vi7CNvYumoqNec6KDrcmAaov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Microsoft-Exchange-Diagnostics: 1; AM0PR0402MB3906; 6:O8AR5vnadg02dun2L2wC77VSz4r5LRI+/xyRPJPFijxWtQWak5EADnqHI6JGd+qdIcS7blplgkYbzqj0qsdgQ+/5GiZRNX5XoSN0ASbdtgJGJn5UVuzQnRxEwoGngb78PyflZGiMAJo4DQ2p1dgomv1Rh6mPR7PCHl6tQwe2RMVAvIZqKAulyAeeIjNBUpTVxNWcioDoipJMtIaStwklMx3CoPYgrvNL992HkoVVO1wJP4KbzcaEl2it13BzACbJNYWYDOQHPZ6RjK7PBtP0eGBkCSx5u4mDy9uUKorAxb7jPY7gxqFwBKfZeXd95fJqMUG9n357S8lqaxSbDddAQGnJydl8yPTYbcN1tka2AKLQLPGVA3OJcJo1zM03Y3X3+AfSCRe+GiEDrrYm6NRc18n2h9GYSy82ocQfDmOPer0YzmXtOxRgZDeZ3eRZsdl8sFSjnBO4InGnIZyoSJJ2fA==; 5:HtrkAa1tQ+v4wueLRGXO2F3q/WnOmYWXSQSmQI8+josmGD34yPfHGShqUKO1cemIB6LZyCyD97ebEyvm7MW8EFc5R2QaIujTE1U2PvGTMJpEI8QVfDAt6YhUonx+FvOZxDeHtAkeB8Z0lWA7qVply/9ymKin1RZH7RIjhrIeYQ4=; 24:Be+FuJbrseH25fABQoke917wUAKRDPuX+yhc+PN+/It8FwoDDtpSzenBS8VIsbPp0SXAOK6i1VUmc+KbiXwkRc8wD/1Ank6u5lFKa1Qqxqc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR0402MB3906; 7:AGuoN27lFTe8DgZrfpOyQJNAm0EuINCNPu2kIQAwF8Na60xCAjS0rA0+njgIhj+8efdHjlrVM3eb2up9MM278okI2gcybYuMv10zuAYZqz52wyaDn5KdT0+aCfDmNYqAOVHCvmZJjz1SfCq3vnGHz1nXA6Z+vroRMD6Uwqvg6D2+jbj+TLu6IEFzYs2hUxqOK7Hmpikn0W1DtZXKMaM/deHWWKJOzluTMZgHlkpWMjCmpEqTZH7lV8jp0LO/eida X-MS-Office365-Filtering-Correlation-Id: f35013e3-ef03-45d3-9407-08d5a1055fff X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2018 06:11:17.1380 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f35013e3-ef03-45d3-9407-08d5a1055fff X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3906 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch is a combination of commit 57e6f0d7b804 ("typec: tcpm: Only request matching pdos") and source pdo selection optimization based on it, instead of only compare between the same pdo type of sink and source, we should check source pdo voltage range is within the voltage range of one sink pdo. Signed-off-by: Li Jun --- drivers/usb/typec/tcpm.c | 102 ++++++++++++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 37 deletions(-) diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c index 677d121..c127339 100644 --- a/drivers/usb/typec/tcpm.c +++ b/drivers/usb/typec/tcpm.c @@ -1772,40 +1772,65 @@ static int tcpm_pd_check_request(struct tcpm_port *port) return 0; } -static int tcpm_pd_select_pdo(struct tcpm_port *port) +#define min_power(x, y) min(pdo_max_power(x), pdo_max_power(y)) +#define min_current(x, y) min(pdo_max_current(x), pdo_max_current(y)) + +static int tcpm_pd_select_pdo(struct tcpm_port *port, int *sink_pdo, + int *src_pdo) { - unsigned int i, max_mw = 0, max_mv = 0; + unsigned int i, j, max_src_mv = 0, min_src_mv = 0, max_mw = 0, + max_mv = 0, src_mw = 0, src_ma = 0, max_snk_mv = 0, + min_snk_mv = 0; int ret = -EINVAL; /* - * Select the source PDO providing the most power while staying within - * the board's voltage limits. Prefer PDO providing exp + * Select the source PDO providing the most power which has a + * matchig sink cap. */ for (i = 0; i < port->nr_source_caps; i++) { u32 pdo = port->source_caps[i]; enum pd_pdo_type type = pdo_type(pdo); - unsigned int mv, ma, mw; - if (type == PDO_TYPE_FIXED) - mv = pdo_fixed_voltage(pdo); - else - mv = pdo_min_voltage(pdo); + if (type == PDO_TYPE_FIXED) { + max_src_mv = pdo_fixed_voltage(pdo); + min_src_mv = max_src_mv; + } else { + max_src_mv = pdo_max_voltage(pdo); + min_src_mv = pdo_min_voltage(pdo); + } if (type == PDO_TYPE_BATT) { - mw = pdo_max_power(pdo); + src_mw = pdo_max_power(pdo); } else { - ma = min(pdo_max_current(pdo), - port->max_snk_ma); - mw = ma * mv / 1000; + src_ma = pdo_max_current(pdo); + src_mw = src_ma * min_src_mv / 1000; } - /* Perfer higher voltages if available */ - if ((mw > max_mw || (mw == max_mw && mv > max_mv)) && - mv <= port->max_snk_mv) { - ret = i; - max_mw = mw; - max_mv = mv; + for (j = 0; j < port->nr_snk_pdo; j++) { + pdo = port->snk_pdo[j]; + + if (pdo_type(pdo) == PDO_TYPE_FIXED) { + min_snk_mv = pdo_fixed_voltage(pdo); + max_snk_mv = pdo_fixed_voltage(pdo); + } else { + min_snk_mv = pdo_min_voltage(pdo); + max_snk_mv = pdo_max_voltage(pdo); + } + + if (max_src_mv <= max_snk_mv && + min_src_mv >= min_snk_mv) { + /* Prefer higher voltages if available */ + if ((src_mw == max_mw && min_src_mv > max_mv) || + src_mw > max_mw) { + *src_pdo = i; + *sink_pdo = j; + max_mw = src_mw; + max_mv = min_src_mv; + } + break; + } } + } return ret; @@ -1816,13 +1841,14 @@ static int tcpm_pd_build_request(struct tcpm_port *port, u32 *rdo) unsigned int mv, ma, mw, flags; unsigned int max_ma, max_mw; enum pd_pdo_type type; - int index; - u32 pdo; + int src_pdo_index, snk_pdo_index; + u32 pdo, matching_snk_pdo; - index = tcpm_pd_select_pdo(port); - if (index < 0) + if (tcpm_pd_select_pdo(port, &snk_pdo_index, &src_pdo_index) < 0) return -EINVAL; - pdo = port->source_caps[index]; + + pdo = port->source_caps[src_pdo_index]; + matching_snk_pdo = port->snk_pdo[snk_pdo_index]; type = pdo_type(pdo); if (type == PDO_TYPE_FIXED) @@ -1830,26 +1856,28 @@ static int tcpm_pd_build_request(struct tcpm_port *port, u32 *rdo) else mv = pdo_min_voltage(pdo); - /* Select maximum available current within the board's power limit */ + /* Select maximum available current within the sink pdo's limit */ if (type == PDO_TYPE_BATT) { - mw = pdo_max_power(pdo); - ma = 1000 * min(mw, port->max_snk_mw) / mv; + mw = min_power(pdo, matching_snk_pdo); + ma = 1000 * mw / mv; } else { - ma = min(pdo_max_current(pdo), - 1000 * port->max_snk_mw / mv); + ma = min_current(pdo, matching_snk_pdo); + mw = ma * mv / 1000; } - ma = min(ma, port->max_snk_ma); flags = RDO_USB_COMM | RDO_NO_SUSPEND; /* Set mismatch bit if offered power is less than operating power */ - mw = ma * mv / 1000; max_ma = ma; max_mw = mw; if (mw < port->operating_snk_mw) { flags |= RDO_CAP_MISMATCH; - max_mw = port->operating_snk_mw; - max_ma = max_mw * 1000 / mv; + if (type == PDO_TYPE_BATT && + (pdo_max_power(matching_snk_pdo) > pdo_max_power(pdo))) + max_mw = pdo_max_power(matching_snk_pdo); + else if (pdo_max_current(matching_snk_pdo) > + pdo_max_current(pdo)) + max_ma = pdo_max_current(matching_snk_pdo); } tcpm_log(port, "cc=%d cc1=%d cc2=%d vbus=%d vconn=%s polarity=%d", @@ -1858,16 +1886,16 @@ static int tcpm_pd_build_request(struct tcpm_port *port, u32 *rdo) port->polarity); if (type == PDO_TYPE_BATT) { - *rdo = RDO_BATT(index + 1, mw, max_mw, flags); + *rdo = RDO_BATT(src_pdo_index + 1, mw, max_mw, flags); tcpm_log(port, "Requesting PDO %d: %u mV, %u mW%s", - index, mv, mw, + src_pdo_index, mv, mw, flags & RDO_CAP_MISMATCH ? " [mismatch]" : ""); } else { - *rdo = RDO_FIXED(index + 1, ma, max_ma, flags); + *rdo = RDO_FIXED(src_pdo_index + 1, ma, max_ma, flags); tcpm_log(port, "Requesting PDO %d: %u mV, %u mA%s", - index, mv, ma, + src_pdo_index, mv, ma, flags & RDO_CAP_MISMATCH ? " [mismatch]" : ""); }