From patchwork Fri Nov 6 01:27:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 321890 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7FD9C388F7 for ; Fri, 6 Nov 2020 01:28:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BC3B20759 for ; Fri, 6 Nov 2020 01:28:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GxVvL+MS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732577AbgKFB2c (ORCPT ); Thu, 5 Nov 2020 20:28:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731111AbgKFB2c (ORCPT ); Thu, 5 Nov 2020 20:28:32 -0500 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CF5DC0613CF for ; Thu, 5 Nov 2020 17:28:32 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id r186so2689312pgr.0 for ; Thu, 05 Nov 2020 17:28:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Isl/WzUuPljZe1UXO1RGJXR4af+lyqHxbfYjSyUmTkQ=; b=GxVvL+MS9hLkAgTYVlotm7VFLMcrEv7IN1lbn7z4vA8niPlW7ShKz01QQGDywB8JQA 9101aQF4fD+5MQUWb3yRDq2L+BG0PeGz/YbjEwpXSjaxnnSSaqeB4TQQo4MLzLOVpoMK TD8MHX7GCV0SA0+0TiJCubI2WO+XBdAk0lirw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Isl/WzUuPljZe1UXO1RGJXR4af+lyqHxbfYjSyUmTkQ=; b=SVFE9ebC3U/EXkaejjg2QLLfeIiY1mEwzO+l7vbg0TjMPFCfl5PyxSBdJgHL1GYoEO KK0biaKN6o+zQYbp78k9d6myvBhP6tVWkCGJSvOQ+1UiDdkz3ytzLfRyTroLiLjp2tyG ISFTZI4mm1+ZMblZJ6RAJQBoEgdUAaxtNDVvB4aL0CsVeBpY3HFpfPGH9Lb6ah6M7FoA OEor0NgiU+NQPjEsFDxhUiTu4p96n0xoXu4lY2szj7WHA405upHqhyqPyi0yWACB/O0x ca5YmqgZxYEjvTQFbOct9fX2S3v312XQrr6lyYKOWNzSr6qVvDuDGDSEjxpHNp1touBJ dNQQ== X-Gm-Message-State: AOAM530oM94Xgqx6d4yaVQcZiTgpPr+qa1kK1CdX//YtoUfSfCMkDk8v 494l8F4gSv0jDGgH8OaN+H9s8w== X-Google-Smtp-Source: ABdhPJxlLCFCJ/JcONTp3MdrmBI/FubXi07TSbaMEbkuhAwR7QX9NX8DKdtYbY5LrycHI/e2SvoSHA== X-Received: by 2002:a17:90b:d18:: with SMTP id n24mr5512719pjz.206.1604626111708; Thu, 05 Nov 2020 17:28:31 -0800 (PST) Received: from pmalani2.mtv.corp.google.com ([2620:15c:202:201:a28c:fdff:fef0:49dd]) by smtp.gmail.com with ESMTPSA id e2sm3567887pgd.27.2020.11.05.17.28.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 17:28:30 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org Cc: heikki.krogerus@linux.intel.com, dzigterman@chromium.org, alevkoy@chromium.org, Prashant Malani , Benson Leung , Enric Balletbo i Serra , Greg Kroah-Hartman , Guenter Roeck , linux-usb@vger.kernel.org (open list:USB SUBSYSTEM) Subject: [PATCH 1/6] platform/chrome: cros_ec_typec: Make disc_done flag partner-only Date: Thu, 5 Nov 2020 17:27:53 -0800 Message-Id: <20201106012758.525472-2-pmalani@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201106012758.525472-1-pmalani@chromium.org> References: <20201106012758.525472-1-pmalani@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Change the disc_done flag, which indicates whether PD discovery is complete, to sop_disc_done instead, since we will process SOP and SOP' discovery data separately. Signed-off-by: Prashant Malani --- drivers/platform/chrome/cros_ec_typec.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index ce031a10eb1b..801c3d2c1fbd 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -57,8 +57,8 @@ struct cros_typec_port { /* Port alt modes. */ struct typec_altmode p_altmode[CROS_EC_ALTMODE_MAX]; - /* Flag indicating that PD discovery data parsing is completed. */ - bool disc_done; + /* Flag indicating that PD partner discovery data parsing is completed. */ + bool sop_disc_done; struct ec_response_typec_discovery *sop_disc; struct list_head partner_mode_list; }; @@ -210,7 +210,7 @@ static void cros_typec_remove_partner(struct cros_typec_data *typec, typec_unregister_partner(port->partner); port->partner = NULL; memset(&port->p_identity, 0, sizeof(port->p_identity)); - port->disc_done = false; + port->sop_disc_done = false; } static void cros_unregister_ports(struct cros_typec_data *typec) @@ -727,18 +727,13 @@ static void cros_typec_handle_status(struct cros_typec_data *typec, int port_num return; } - if (typec->ports[port_num]->disc_done) - return; - /* Handle any events appropriately. */ - if (resp.events & PD_STATUS_EVENT_SOP_DISC_DONE) { + if (resp.events & PD_STATUS_EVENT_SOP_DISC_DONE && !typec->ports[port_num]->sop_disc_done) { ret = cros_typec_handle_sop_disc(typec, port_num); - if (ret < 0) { + if (ret < 0) dev_err(typec->dev, "Couldn't parse SOP Disc data, port: %d\n", port_num); - return; - } - - typec->ports[port_num]->disc_done = true; + else + typec->ports[port_num]->sop_disc_done = true; } } From patchwork Fri Nov 6 01:27:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 319719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C47A7C388F7 for ; Fri, 6 Nov 2020 01:28:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 673CC20759 for ; Fri, 6 Nov 2020 01:28:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="BIFQ/MX5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732782AbgKFB2n (ORCPT ); Thu, 5 Nov 2020 20:28:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732701AbgKFB2n (ORCPT ); Thu, 5 Nov 2020 20:28:43 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83627C0613CF for ; Thu, 5 Nov 2020 17:28:43 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id o129so2841146pfb.1 for ; Thu, 05 Nov 2020 17:28:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GKXVsKVnKD7fqfNWGDcS/zXjw44CADDVmHlExUpnMvQ=; b=BIFQ/MX5LV63TUUN5zq2ge6nSCXPSUEYTi50u0uHH+8uqA9CZTKiUsKudeh7yhSBg+ dzagMO1T73RXVVcAS17NqPlKgGfvY17LtVyY5q3neIoEmUvWChTBNEbe4myyRaQjWPe6 jujZOKR497rZTsIzsAh1nokXXTzuc5SGMjkaM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GKXVsKVnKD7fqfNWGDcS/zXjw44CADDVmHlExUpnMvQ=; b=JZ3iwotu2sHq+BfcGoxV+ZLu4JDr0hMTWhhG6kNFkFPD4SDHgf2QzqoDUE006FzTi7 ppByXfRaQFQ1KFZcv/sSvgOsjkwa8scFrzn/g+dTI9PJqjn7PMG0aj4Pyq2QUp20EyGC ZrIsY+iY3ustjZtJwd8xD/Jj6UjVmDMdhiggW9ZrVkx4uFxCTCnRcdFbfisu4efP5kxv urFBI9Z1H5nyxnCnfZETD6M8u86i8gBQaOKoiaGjhLaH06hMUV2FN5Oal4S+0oQ9xVIp yAwXqrZyMWML+6DH2wvkwUOZ8MrtzryA1e8Won18cZHkcjXRPIomplsEbuBVjLpZ9hEY 2jGA== X-Gm-Message-State: AOAM530zuyNwigFGvTa8SS1DGs3UvXmtn0hX+NR3H9+aniODeTTxa8ut 0Syq7+Av2MU0xrLFuqWablJy7A== X-Google-Smtp-Source: ABdhPJyJRifPxAumyV2XSUvYywaOBU4JVPwpJ89jNBfZYFANicmmku18h9usUQNW8Kvk//BBmFKYVg== X-Received: by 2002:a17:90a:3e09:: with SMTP id j9mr5481822pjc.192.1604626123078; Thu, 05 Nov 2020 17:28:43 -0800 (PST) Received: from pmalani2.mtv.corp.google.com ([2620:15c:202:201:a28c:fdff:fef0:49dd]) by smtp.gmail.com with ESMTPSA id e2sm3567887pgd.27.2020.11.05.17.28.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 17:28:42 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org Cc: heikki.krogerus@linux.intel.com, dzigterman@chromium.org, alevkoy@chromium.org, Prashant Malani , Benson Leung , Enric Balletbo i Serra , Greg Kroah-Hartman , Guenter Roeck , linux-usb@vger.kernel.org (open list:USB SUBSYSTEM) Subject: [PATCH 2/6] platform/chrome: cros_ec_typec: Factor out PD identity parsing Date: Thu, 5 Nov 2020 17:27:55 -0800 Message-Id: <20201106012758.525472-3-pmalani@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201106012758.525472-1-pmalani@chromium.org> References: <20201106012758.525472-1-pmalani@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Factor out the PD identity parsing code into a separate function. This way it can be re-used for Cable PD identity parsing in future patches. No functional changes are introduced by this patch. Signed-off-by: Prashant Malani --- drivers/platform/chrome/cros_ec_typec.c | 35 ++++++++++++++++--------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 801c3d2c1fbd..f6d3c37c2c27 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -657,6 +657,28 @@ static int cros_typec_register_altmodes(struct cros_typec_data *typec, int port_ return ret; } +/* + * Parse the PD identity data from the EC PD discovery responses and copy that to the supplied + * PD identity struct. + */ +static void cros_typec_parse_pd_identity(struct usb_pd_identity *id, + struct ec_response_typec_discovery *disc) +{ + int i; + + /* First, update the PD identity VDOs for the partner. */ + if (disc->identity_count > 0) + id->id_header = disc->discovery_vdo[0]; + if (disc->identity_count > 1) + id->cert_stat = disc->discovery_vdo[1]; + if (disc->identity_count > 2) + id->product = disc->discovery_vdo[2]; + + /* Copy the remaining identity VDOs till a maximum of 6. */ + for (i = 3; i < disc->identity_count && i < VDO_MAX_OBJECTS; i++) + id->vdo[i - 3] = disc->discovery_vdo[i]; +} + static int cros_typec_handle_sop_disc(struct cros_typec_data *typec, int port_num) { struct cros_typec_port *port = typec->ports[port_num]; @@ -666,7 +688,6 @@ static int cros_typec_handle_sop_disc(struct cros_typec_data *typec, int port_nu .partner_type = TYPEC_PARTNER_SOP, }; int ret = 0; - int i; if (!port->partner) { dev_err(typec->dev, @@ -684,17 +705,7 @@ static int cros_typec_handle_sop_disc(struct cros_typec_data *typec, int port_nu goto disc_exit; } - /* First, update the PD identity VDOs for the partner. */ - if (sop_disc->identity_count > 0) - port->p_identity.id_header = sop_disc->discovery_vdo[0]; - if (sop_disc->identity_count > 1) - port->p_identity.cert_stat = sop_disc->discovery_vdo[1]; - if (sop_disc->identity_count > 2) - port->p_identity.product = sop_disc->discovery_vdo[2]; - - /* Copy the remaining identity VDOs till a maximum of 6. */ - for (i = 3; i < sop_disc->identity_count && i < VDO_MAX_OBJECTS; i++) - port->p_identity.vdo[i - 3] = sop_disc->discovery_vdo[i]; + cros_typec_parse_pd_identity(&port->p_identity, sop_disc); ret = typec_partner_set_identity(port->partner); if (ret < 0) { From patchwork Fri Nov 6 01:28:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 321889 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63347C4742C for ; Fri, 6 Nov 2020 01:29:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1556920786 for ; Fri, 6 Nov 2020 01:29:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HlVd6Md1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732917AbgKFB3d (ORCPT ); Thu, 5 Nov 2020 20:29:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730895AbgKFB3d (ORCPT ); Thu, 5 Nov 2020 20:29:33 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9007DC0613CF for ; Thu, 5 Nov 2020 17:29:31 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id g7so2535306pfc.2 for ; Thu, 05 Nov 2020 17:29:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P6A1qUZApyMU5jCUBIX+1v23CvXu4Fk7lhZ+dP9+1nY=; b=HlVd6Md1B6Nxt142H/Mjr6vuBpA7K9sKazRuc6mY13J1oEc3t9aO64ZTjgbVyTCXga F8NaBXhsbhATbb7V2YAG8jAtBr8wog7mB79et3EiT05i+6K4RWkxoLJYwSvRTYNnPVk1 5Z6poomOhL0DBJBv47VgHxrNcfnvKH/zC5aTI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P6A1qUZApyMU5jCUBIX+1v23CvXu4Fk7lhZ+dP9+1nY=; b=l3E6TzHXNDR+IkUiYOeOTlaqKJKZuq33i9nO4/vvrZhQ5OQtngxXrwGqxjAkkezdd/ jQNQmqmdJkcg1KSFvnWaikl4mnrdaRVnVXMVLhlDUhf0nxPKMPLi+P5M4577Mm+bcmXA NN3jCKP9G7DqT2M/cLR4KH9b4vLJYKq+YO8l5JvNknzaypqunrvAkZunWYWmpmFyePOs zar1epwrjSw6tg9kw7eRxgwrnkKufVR4pWLoqJ3ZeMYpE89O0ofKydTqwKcoj7AMBAhL /MszFf7Hv98FJHTPvGAHUZY3NIwk0814QKvJO6JyGbjNEWPi6F06Juak/IyPVCl9jQ1v 59MA== X-Gm-Message-State: AOAM5303h3RZOOr1dTtqIk8G38mbzr9NU4CBF2TyEsbdqCcV1q2uqfl6 BOd7hK7TuebbDqV52EJauXR4bA== X-Google-Smtp-Source: ABdhPJzteC0hNpMz4X1xVSEOVUrOYOYH3/0JsclrNu/lDxMWF3+4lJ18GzOHfXb2zG/9G213w99Vgg== X-Received: by 2002:a17:90a:8b01:: with SMTP id y1mr4724538pjn.83.1604626171158; Thu, 05 Nov 2020 17:29:31 -0800 (PST) Received: from pmalani2.mtv.corp.google.com ([2620:15c:202:201:a28c:fdff:fef0:49dd]) by smtp.gmail.com with ESMTPSA id e2sm3567887pgd.27.2020.11.05.17.29.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 17:29:30 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org Cc: heikki.krogerus@linux.intel.com, dzigterman@chromium.org, alevkoy@chromium.org, Prashant Malani , Greg Kroah-Hartman , linux-usb@vger.kernel.org (open list:USB SUBSYSTEM) Subject: [PATCH 5/6] usb: pd: Add captive Type C cable type Date: Thu, 5 Nov 2020 17:28:01 -0800 Message-Id: <20201106012758.525472-6-pmalani@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201106012758.525472-1-pmalani@chromium.org> References: <20201106012758.525472-1-pmalani@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The USB Power Delivery Specification R3.0 adds a captive cable type to the "USB Type-C plug to USB Type-C/Captive" field (Bits 19-18, Passive/Active Cable VDO, Table 6-38 & 6-39). Add the corresponding definition to the Cable VDO header. Also add a helper macro to get the Type C cable connector type, when provided the cable VDO. Cc: Heikki Krogerus Signed-off-by: Prashant Malani --- include/linux/usb/pd_vdo.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/usb/pd_vdo.h b/include/linux/usb/pd_vdo.h index 68bdc4e2f5a9..8c5cb5830754 100644 --- a/include/linux/usb/pd_vdo.h +++ b/include/linux/usb/pd_vdo.h @@ -177,7 +177,7 @@ * <31:28> :: Cable HW version * <27:24> :: Cable FW version * <23:20> :: Reserved, Shall be set to zero - * <19:18> :: type-C to Type-A/B/C (00b == A, 01 == B, 10 == C) + * <19:18> :: type-C to Type-A/B/C/Captive (00b == A, 01 == B, 10 == C, 11 == Captive) * <17> :: Type-C to Plug/Receptacle (0b == plug, 1b == receptacle) * <16:13> :: cable latency (0001 == <10ns(~1m length)) * <12:11> :: cable termination type (11b == both ends active VCONN req) @@ -193,6 +193,7 @@ #define CABLE_ATYPE 0 #define CABLE_BTYPE 1 #define CABLE_CTYPE 2 +#define CABLE_CAPTIVE 3 #define CABLE_PLUG 0 #define CABLE_RECEPTACLE 1 #define CABLE_CURR_1A5 0 @@ -208,6 +209,7 @@ | (tx1d) << 10 | (tx2d) << 9 | (rx1d) << 8 | (rx2d) << 7 \ | ((cur) & 0x3) << 5 | (vps) << 4 | (sopp) << 3 \ | ((usbss) & 0x7)) +#define VDO_TYPEC_CABLE_TYPE(vdo) (((vdo) >> 18) & 0x3) /* * AMA VDO