Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3411559pxb; Mon, 16 Nov 2020 14:04:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJqqKz6qLztCB4xDoSLJAPcNJKUT/6Oixs/TL+wVGgKOFATy3UbZBaZViTFwHhtX4PCKK0 X-Received: by 2002:a17:906:6987:: with SMTP id i7mr17846641ejr.18.1605564260604; Mon, 16 Nov 2020 14:04:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605564260; cv=none; d=google.com; s=arc-20160816; b=IzvnD/ot/1n34zEU06mMhkXfMewMiMuzXT9ZhfoDL1kxgzCOl7UP4elnW4cY2/HTsX P4jGyziPhSs9Y3L072T86+iNesjkqVtLHeqB3t7o1Z8Cs1O++GYckprr4FZZRhNTGTB8 b8+iKolBzBL05V+SrqcRMyHKLDTXr0jMPGtZXPbOh2wAiBHDAQqrWOLUwG5DTyLkAx4+ /nlwGK46Zsr/IBO1YXa2XoyOhsxGhzupQ7aRKFloUZwfDGH6sT6MO5Q1mB1UYovPPQBA PbAcLe0eEM/FU9e485oTA7d21pb9GyLi/uY4fIkk48MPF3Fu1qvDvTr2pB8zec8icQ7X mhnw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ratfCf17pWeTifPqw6qz8fSuUGcC46Cued5E0TpKD5Y=; b=PqLs8rTUWLfQhYD3KIQNbBB7vW9WmP9U4Vx0Bjn3LTHlgWo0iD9RqGxOI3O/99nPla Crlgtaq4zadYLECMT9w96sIWb2lJ8MxcyAQkRxEEB5Mr63SnehvqGZe4TvFx7ua7tVIU cBG3+7Zw5YmbnRpFB59FeC5Sz13fdU9hpKGGE71maZ4SpaTtioeAUcc+UOawyQ4B5vW3 zdQqH6zTE5nKIHuKA2dZgFhnLph1MSmBLMR5LTiUMmVNApGhweNskqqzCzE0RE8BkeP3 DUekav6fjP32RFg9CsYwYpNMbOvb/jpBRHh8sLSOfoPnxVdrb0wYwLip0VMvV4gKYWk7 qF5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Bz5i1nkX; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si12850883ejy.703.2020.11.16.14.03.57; Mon, 16 Nov 2020 14:04:20 -0800 (PST) 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=@chromium.org header.s=google header.b=Bz5i1nkX; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731973AbgKPUOA (ORCPT + 99 others); Mon, 16 Nov 2020 15:14:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731956AbgKPUN7 (ORCPT ); Mon, 16 Nov 2020 15:13:59 -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 75C19C0613CF for ; Mon, 16 Nov 2020 12:13:59 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id 131so4680408pfb.9 for ; Mon, 16 Nov 2020 12:13:59 -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=ratfCf17pWeTifPqw6qz8fSuUGcC46Cued5E0TpKD5Y=; b=Bz5i1nkX8TACC+DpQ312MjVtRNrtax07fBV6j/LqGABPtchYR8h9ZDA5zg3XtkSb9s 4IKtbpUltiM260HRu9PGELfP094Vz/HHk0q9vJXtypx8Zuf+OMh+qdad05MV4g2o5hj6 xkLTU3KSIZ6BGckfHMRjlnG+CTTiHns6EE3gM= 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=ratfCf17pWeTifPqw6qz8fSuUGcC46Cued5E0TpKD5Y=; b=GsLNmNuTZWz1hXLPXUmFyD7HjKtymQ1EOIdYwaXRE5ZjkPbe3X+Ywfy7l0sqrZEIYV yntnryMYY3zB3Ep7uEUDj//Kj1orYbZM1Jfr1hmPuZjbyznZPJQizP7tX33cQqvSd3c9 7sEF1+YdDMWBGICQFxhvYdSpnGiik7YQlRfcdhJctHIGeYWcVvgGXpygEMjZqMixSQvw Oi7zVbeJHhDH5Bp/LFq0GIhJAkkkvSy9A6eUyAh9M5jsPPRhtXjFdvbwg5uhF/nakQ7E pVZWEw8cDvQ5pIiI6QeaSqLU/I1V2LkFCIJx+Qa5Xm8IciyPxbzs257v1FQQc74Msh16 b7Tw== X-Gm-Message-State: AOAM531qDiBPddf9Hrvlv0EZA+wUGeF5RI4dYeWWiFt01o7PeSa7m2y3 s86OjU1t70fz33u4C6g+r/5FnMygVOBmwg== X-Received: by 2002:a63:fd0b:: with SMTP id d11mr750236pgh.50.1605557638811; Mon, 16 Nov 2020 12:13:58 -0800 (PST) Received: from pmalani2.mtv.corp.google.com ([2620:15c:202:201:a28c:fdff:fef0:49dd]) by smtp.gmail.com with ESMTPSA id a12sm234577pjh.48.2020.11.16.12.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2020 12:13:58 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, heikki.krogerus@linux.intel.com, enric.balletbo@collabora.com Cc: Prashant Malani , Benson Leung , Guenter Roeck Subject: [PATCH v3 09/11] platform/chrome: cros_ec_typec: Set partner num_altmodes Date: Mon, 16 Nov 2020 12:11:54 -0800 Message-Id: <20201116201150.2919178-10-pmalani@chromium.org> X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog In-Reply-To: <20201116201150.2919178-1-pmalani@chromium.org> References: <20201116201150.2919178-1-pmalani@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set the number of altmodes available for a registered partner using the Type C connector class framework routine. Cc: Heikki Krogerus Signed-off-by: Prashant Malani Reviewed-by: Heikki Krogerus --- Changes in v3: - Re-arranged patch order and combined it with related series of patches. - Added Reviewed-by tags Changes in v2: - Patch introduced for the first time in v2. drivers/platform/chrome/cros_ec_typec.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index cf609aa10567..ad5e37bfd45d 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -642,6 +642,7 @@ static int cros_typec_register_altmodes(struct cros_typec_data *typec, int port_ struct cros_typec_altmode_node *node; struct typec_altmode_desc desc; struct typec_altmode *amode; + int num_altmodes = 0; int ret = 0; int i, j; @@ -668,9 +669,16 @@ static int cros_typec_register_altmodes(struct cros_typec_data *typec, int port_ node->amode = amode; list_add_tail(&node->list, &port->partner_mode_list); + num_altmodes++; } } + ret = typec_partner_set_num_altmodes(port->partner, num_altmodes); + if (ret < 0) { + dev_err(typec->dev, "Unable to set partner num_altmodes for port: %d\n", port_num); + goto err_cleanup; + } + return 0; err_cleanup: -- 2.29.2.299.gdc1121823c-goog