From patchwork Wed Jan 11 02:05:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 41713 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3076136wrt; Tue, 10 Jan 2023 18:06:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXsLMgMMOUG6m+fS9lo3DDTzOBjVciRUkzl7WbVVKAfPWem2RglO2+PVyvjmuPjdydOxiOzp X-Received: by 2002:a05:6402:b14:b0:498:21b3:aeaf with SMTP id bm20-20020a0564020b1400b0049821b3aeafmr11790504edb.1.1673402799692; Tue, 10 Jan 2023 18:06:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673402799; cv=none; d=google.com; s=arc-20160816; b=pFd1um12L8LWF+mSlfTAtH1+pdFgbkvQq+g97/Tv5OdAKtRFfTn5qCO+BXkowqdeGB 0EZCuH7zGsOwLqEN5kNxl3r6eTdxnxAaRLzxxPWIkUzE1qXVtJzgkNcuHk+OukuJ8QOS UiD78NURPzB0xsDdjpVvmNhQrYAt8jeN+LCMrrzm3zESfADWZJeVqMgJjbEYZ3877MF9 ml6XmgwTNhIwSQEuYhzS1Yusx/7aHv/UX6fTna1LKHGBtkj9aG8IqZLonBCtPB6C1nLU 0t7/Kd47IAe6K4tjbJa1N1q432r355ytyzkGIDXdAcVWfnGY5J9m/dG/IU4a2Qt0QrJI atmw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=qS19MD5Zbe+eJ9gIfmAabpV1LfKfinJzSfEen8dZJOE=; b=qKOr+MsPVF+RSTbw9A+TO6kR0l2zVT8gDVVdBtUpHRLMOSBuuv6S+GfLQMHBwe18w9 QvmWDFgWJ6+g69ksuP5xiQANfZ2bohS1CbD2fDCdvKSk3XH/z5M1trTvKPHeQB676oDd HPfYISx6TsEQa2kMa4S/La0hygqfOSR6Dmg2zFHugt8wp77/QI9lbwBVv2eXckTH6sN0 MyynpJNgUzs8KQDTKweXA9h4alNejXsDzspv6ehXK8GumdQfDaqqC4q4kBmPCCCA4wwA 6TTyVkjLXmgDHvBOLGv+uI8af2X+Iy7CPU3UBTU7b/zrxh+0PcZpp9mE1Hc5GaMUWX2R LaGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DNcVUKHG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a19-20020a50e713000000b00483cadc3789si12472961edn.69.2023.01.10.18.06.15; Tue, 10 Jan 2023 18:06:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DNcVUKHG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234508AbjAKCGD (ORCPT + 99 others); Tue, 10 Jan 2023 21:06:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234969AbjAKCF7 (ORCPT ); Tue, 10 Jan 2023 21:05:59 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1462AB58 for ; Tue, 10 Jan 2023 18:05:58 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id v13-20020a17090a6b0d00b00219c3be9830so15545954pjj.4 for ; Tue, 10 Jan 2023 18:05:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qS19MD5Zbe+eJ9gIfmAabpV1LfKfinJzSfEen8dZJOE=; b=DNcVUKHG9cU/nPJHm64CxJPtzm3cG4CMsD19HXOfPf6VjsbcFZnaoqYOZ+nHs/NP93 y2GJkNOxJTCkAPkNNDR4lVP7I3Nf8tab5XzO+kRDMz82tjk7XHPGLgBgSXB4NHfJTo+N v7BVDc0FjZCBuC3I21/210GDz60MgYQOKQxQI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qS19MD5Zbe+eJ9gIfmAabpV1LfKfinJzSfEen8dZJOE=; b=14HHE6dLsxiPJK6/BXUyyH/vHQkhw6mpVE+dgqb0dTKzNXxNIcj9KNC0CyKY2uJJj+ +GmUB91bnQ78GHJs1UL9VJeDay1bML+lqwIqGAxXqSUcQR02Hyfy1otKOx/WPTt67jDR KLjqBARosSqqTv3Lb6FhAv9GU9y7uXR21hQI0P99vQiTu9qJTewttfgGgy8qQ5479I8j ZtEeHfOC1+u74TD0YDNpvDtBZHUiBYzndiw4i4ztsJhfYjmQ5dn3ztHxZ8AIMecRwNNV J/S2nk34w5SKqJy1F3zu9frjOZNF1kxcbI+f6RH0W9kZNQco9/Hr8ahXyueLdMl6aCcS o4IQ== X-Gm-Message-State: AFqh2krRjmrGq41b1/jZ2xDa5X6tvqKOIh2eH0i/PcUufOCPmScjCd5v MXAyTAJZ385O7K/B/g06MwEHpZTEqujzBWrN X-Received: by 2002:a05:6a20:9588:b0:b2:549c:b0eb with SMTP id iu8-20020a056a20958800b000b2549cb0ebmr89906325pzb.36.1673402757139; Tue, 10 Jan 2023 18:05:57 -0800 (PST) Received: from pmalani.c.googlers.com.com (33.5.83.34.bc.googleusercontent.com. [34.83.5.33]) by smtp.gmail.com with ESMTPSA id z6-20020a656646000000b00477a442d450sm7336738pgv.16.2023.01.10.18.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 18:05:56 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: bleung@chromium.org, Prashant Malani , stable@vger.kernel.org, Heikki Krogerus , Greg Kroah-Hartman , Guillaume Ranquet , Macpaul Lin , Pablo Sun Subject: [PATCH 1/3] usb: typec: altmodes/displayport: Add pin assignment helper Date: Wed, 11 Jan 2023 02:05:41 +0000 Message-Id: <20230111020546.3384569-1-pmalani@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754690014315196845?= X-GMAIL-MSGID: =?utf-8?q?1754690014315196845?= The code to extract a peripheral's currently supported Pin Assignments is repeated in a couple of locations. Factor it out into a separate function. This will also make it easier to add fixes (we only need to update 1 location instead of 2). Fixes: c1e5c2f0cb8a ("usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles") Cc: stable@vger.kernel.org Cc: Heikki Krogerus Signed-off-by: Prashant Malani Reviewed-by: Benson Leung Reviewed-by: Heikki Krogerus --- While this patch doesn't fix anything, it is required by the actual fix (which is Patch 2/3 in this series). So, I've add the "Fixes" tag and "Cc stable" tag to ensure that both patches are picked. If this is the incorrect approach and there is a better way, my apologies, and please let me know the appropriate process. drivers/usb/typec/altmodes/displayport.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c index 06fb4732f8cd..f9d4a7648bc9 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -420,6 +420,18 @@ static const char * const pin_assignments[] = { [DP_PIN_ASSIGN_F] = "F", }; +/* + * Helper function to extract a peripheral's currently supported + * Pin Assignments from its DisplayPort alternate mode state. + */ +static u8 get_current_pin_assignments(struct dp_altmode *dp) +{ + if (DP_CONF_CURRENTLY(dp->data.conf) == DP_CONF_DFP_D) + return DP_CAP_UFP_D_PIN_ASSIGN(dp->alt->vdo); + else + return DP_CAP_DFP_D_PIN_ASSIGN(dp->alt->vdo); +} + static ssize_t pin_assignment_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) @@ -446,10 +458,7 @@ pin_assignment_store(struct device *dev, struct device_attribute *attr, goto out_unlock; } - if (DP_CONF_CURRENTLY(dp->data.conf) == DP_CONF_DFP_D) - assignments = DP_CAP_UFP_D_PIN_ASSIGN(dp->alt->vdo); - else - assignments = DP_CAP_DFP_D_PIN_ASSIGN(dp->alt->vdo); + assignments = get_current_pin_assignments(dp); if (!(DP_CONF_GET_PIN_ASSIGN(conf) & assignments)) { ret = -EINVAL; @@ -486,10 +495,7 @@ static ssize_t pin_assignment_show(struct device *dev, cur = get_count_order(DP_CONF_GET_PIN_ASSIGN(dp->data.conf)); - if (DP_CONF_CURRENTLY(dp->data.conf) == DP_CONF_DFP_D) - assignments = DP_CAP_UFP_D_PIN_ASSIGN(dp->alt->vdo); - else - assignments = DP_CAP_DFP_D_PIN_ASSIGN(dp->alt->vdo); + assignments = get_current_pin_assignments(dp); for (i = 0; assignments; assignments >>= 1, i++) { if (assignments & 1) { From patchwork Wed Jan 11 02:05:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 41714 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3076289wrt; Tue, 10 Jan 2023 18:07:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXuVasHshgP6kIQGUybqUCFDGWFc7LNObgkq58H23yXYe8ShzwT8fK2m0/gb9jUD+nEX631y X-Received: by 2002:a17:906:d18f:b0:7c1:80d7:55f2 with SMTP id c15-20020a170906d18f00b007c180d755f2mr69763663ejz.48.1673402828869; Tue, 10 Jan 2023 18:07:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673402828; cv=none; d=google.com; s=arc-20160816; b=HR+p8Hq0Wbp2p8nMJu0SxntHh6Czq5AwAA8WluheldQhacDLPG+jmhWhvZn1i05Oos MdOCk8wjKNct53sFxB5N3zBr0VoahkjNdpScBnOkj+VeTQonraoOzMGjuoca/HD22vJ+ 3xTdKnHui/MzOSrBW8flczzCp2TlpOX6VwIQ39qlCeI4GK9ChIE4IyP8Y181tPeOC2G4 vwJNPSH9pdUJou7KDkKa0IaIFRuFqPArmIG8IKz67mZ6wWrMYPLNIobFlyc0H9CxK/9Z Bxy2fA7Glq76ObxmUS7qO5k1dT/fBPD8keb0pvNasGHAMMAMlYG9dx6VF0guEilroY8B /rsQ== 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=fOOH1h4KChlf2EGy6Niqg+gxYFOWhvY7/46pTYzOve8=; b=QwXbp+yBVdQz1X32sElsTOuYtKRnM4GxFZEA6hjslTDZIGPBGerr5qLHycx4MVIceP h3yErapLvEo/8VezjeEY4WAr0E4WDYavJtIgcUNNu2cEwiTPmkbjHCjioKB1tEwTKJq1 5q2ieILD9LGKQM9neAyeaSD6ffDlS5FzzjpbEZufEH0SF78aspv36VfwjvutG8hP9doE /zY0IV1PtTc/f5CeQ0qs71AVeHPB1Ss/sJmUh7WZltLIslRTPYtTa4JOB/g3+kR8SsvG pwSfleDIL2mL2ossdyeAwCs37QukZvGbDpry1WM3i6QTPWhYhuoLa/ZbuAAiXQKHNgWe miIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lzq1c4GT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wu1-20020a170906eec100b007a1d4f0e7fcsi13279168ejb.655.2023.01.10.18.06.46; Tue, 10 Jan 2023 18:07:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lzq1c4GT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234853AbjAKCGI (ORCPT + 99 others); Tue, 10 Jan 2023 21:06:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234942AbjAKCGE (ORCPT ); Tue, 10 Jan 2023 21:06:04 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C6C42ED for ; Tue, 10 Jan 2023 18:06:03 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id b9-20020a17090a7ac900b00226ef160dcaso13806601pjl.2 for ; Tue, 10 Jan 2023 18:06:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fOOH1h4KChlf2EGy6Niqg+gxYFOWhvY7/46pTYzOve8=; b=lzq1c4GT3OSKqRRDQNDqpsLFknvNebMBft69ALfIwBu8YiwtWVX6NYPre1ahsuWnIu gvRq7RNluMHnz6cheKyvzuZQItjdS3hGJXYGycUpQ2gxzvFppDugHewMKIIZVlPR9H67 5FXAlAsPd9Zu3U7x3U5ILvewmBFIXkdGV6xz8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fOOH1h4KChlf2EGy6Niqg+gxYFOWhvY7/46pTYzOve8=; b=OXbtNx3j76/aJM74k88qH3Ds5iiO28l7mBzhRsVyvgb7RasrFeu9K5b9uhEfkEmxw9 2DpBdV3SJu5ESAiW+9lVK5KQUXMuCWdEU96dx4Z8oUYvXtahCTFBirgrCaKF4W/kbEHK QM271e/ewoHd1Es4XD3EuT/ztMupJ6Z5Eaq836DkzaZ8mOak9PipRBCS7v1qpj9emcJN hxhYvirryi+9bi47JhWLIue06Ty83NFG6EwJ7prHe21ERPV8AwNlXiIrYQ7P6dnRJgZL 2bTC3GRvvLHDRsoP87dD+kClZpX4nHHxVzSQAHtiKhDxpzEgITODKJyshEqVjss5Xhlp nfdA== X-Gm-Message-State: AFqh2kp8D1/6AZyiWdGV0kCWgmiObH5y64NsJAge/tpMudl7pb+BP9sj mY0YZ+FpeRr9aCMgjhvmFySqxDPOuHe8ysvy X-Received: by 2002:a05:6a20:c26:b0:9d:efbf:816d with SMTP id bw38-20020a056a200c2600b0009defbf816dmr544549pzb.54.1673402762422; Tue, 10 Jan 2023 18:06:02 -0800 (PST) Received: from pmalani.c.googlers.com.com (33.5.83.34.bc.googleusercontent.com. [34.83.5.33]) by smtp.gmail.com with ESMTPSA id z6-20020a656646000000b00477a442d450sm7336738pgv.16.2023.01.10.18.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 18:06:01 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: bleung@chromium.org, Prashant Malani , stable@vger.kernel.org, Heikki Krogerus , Greg Kroah-Hartman , Guillaume Ranquet , Macpaul Lin , Pablo Sun Subject: [PATCH 2/3] usb: typec: altmodes/displayport: Fix pin assignment calculation Date: Wed, 11 Jan 2023 02:05:42 +0000 Message-Id: <20230111020546.3384569-2-pmalani@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230111020546.3384569-1-pmalani@chromium.org> References: <20230111020546.3384569-1-pmalani@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754690045035739724?= X-GMAIL-MSGID: =?utf-8?q?1754690045035739724?= Commit c1e5c2f0cb8a ("usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles") fixed the pin assignment calculation to take into account whether the peripheral was a plug or a receptacle. But the "pin_assignments" sysfs logic was not updated. Address this by using the macros introduced in the aforementioned commit in the sysfs logic too. Fixes: c1e5c2f0cb8a ("usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles") Cc: stable@vger.kernel.org Cc: Heikki Krogerus Signed-off-by: Prashant Malani Reviewed-by: Benson Leung Reviewed-by: Heikki Krogerus --- drivers/usb/typec/altmodes/displayport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c index f9d4a7648bc9..c0d65c93cefe 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -427,9 +427,9 @@ static const char * const pin_assignments[] = { static u8 get_current_pin_assignments(struct dp_altmode *dp) { if (DP_CONF_CURRENTLY(dp->data.conf) == DP_CONF_DFP_D) - return DP_CAP_UFP_D_PIN_ASSIGN(dp->alt->vdo); + return DP_CAP_PIN_ASSIGN_DFP_D(dp->alt->vdo); else - return DP_CAP_DFP_D_PIN_ASSIGN(dp->alt->vdo); + return DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo); } static ssize_t From patchwork Wed Jan 11 02:05:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 41715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3076638wrt; Tue, 10 Jan 2023 18:08:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXsXCXprcMCECz7ooSpF0AbnNYRrlyXyjpYlBT4sx/55lyLgDOSbUKCU11Zb/Rs1zUG5NqUF X-Received: by 2002:a17:906:8a58:b0:7c1:6981:d062 with SMTP id gx24-20020a1709068a5800b007c16981d062mr62325232ejc.72.1673402889957; Tue, 10 Jan 2023 18:08:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673402889; cv=none; d=google.com; s=arc-20160816; b=lCQ2DqlN7u0GLt5Ni5F08D2CUO/vBaZxbMKMTcQ9iPDkBOgsrl8IAdl0AmEhapUIRg yTTT/TyIV+CB+bx2ctDu29LAwmKV2aZuoAqLd/D6kn5YiFzjiDGXuAZ3VGPjYns1MoE6 OoDaOTumYkTTAo/JK0Y8ioY10mZX8oFuZsv4aUGx8LiDjYiVvRumfZUX24nn8hGiioew osexNPpEft6LwMX1JsxIXxQ+m9CfMx62goH1oL0iZkND6JYg3cmPCTvI0KA9q2OElBEK 2Knr8IX8YKjgTaT+YhYyXJveMNN6+1z8Kvv9+iHR6r3fXvgG1nnDvTjTtTwxj1204iLA 5NEQ== 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=aBFAbmggijOhKjLzf9il6pua2012DvMDyGgeIBZj5ls=; b=vsUGlXzMDOLaPQVt3aNZoo0Jz/+kcCBQ2xRd5GhjZH11GTJvc/9Xf/Hndp+seHq4V4 Sm04K6rDHNK/Cw4or8e6ZLIGhZ0n3aRg0Y2kUoIX64QLwVu0VT33vj/pTDMbU2ZHT15v YsEfvZiyKsM+9kB1goccdYdv9Iuk6IMROl/gXm9Rmu4ZBT8ULYp1V4Ga7nOq/u76D1bu ebzksoumAxCJdheq3oqdiQh3v6FJOgY4kg+CmG4I4AuNRIEJ3wj2q8b4ucRzUaFXvDNV C643lUj1vxj/SQUZI2b2RQl7u35PvXCdCSh+OyECwj+wMdyHziOaUQyyI072HeoWdIYr qSvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=m2MFXy1x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd41-20020a17090796a900b00824f19f0717si14825733ejc.650.2023.01.10.18.07.46; Tue, 10 Jan 2023 18:08:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=m2MFXy1x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235469AbjAKCGY (ORCPT + 99 others); Tue, 10 Jan 2023 21:06:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234935AbjAKCGI (ORCPT ); Tue, 10 Jan 2023 21:06:08 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC88FCF6 for ; Tue, 10 Jan 2023 18:06:07 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id z4-20020a17090a170400b00226d331390cso15542380pjd.5 for ; Tue, 10 Jan 2023 18:06:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aBFAbmggijOhKjLzf9il6pua2012DvMDyGgeIBZj5ls=; b=m2MFXy1xICKP7wXEyoTOm7zW0ptblveblZ8XnwBpeo2AKBwPeFD5jmjnjHS6MtgLnx KyKFP2HmIFuQmtQYccuYE92XM+qfF/VMEIgI4zwELU1woAYUZ7poA9Qb1r92ssWmC6wV ur7+Sh2GggjJFj+4LcSt6TetHYyIJ8lb2nBSQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aBFAbmggijOhKjLzf9il6pua2012DvMDyGgeIBZj5ls=; b=5gZLLfufbb6qePy0ym9lL+1KbJQuMOogt5qpzqFErGeybUs374ZWBybUMZeWYSCY8a dEg4UqRXrYxfS0D5g+GQmpXg2KWQOksub04O46vKq2VEon8SsM92Z8EB2EezqWCb97KK 3wlaxriypYwVHaaDfY0ePiDJF+uopnYAusJ7IScZLUdR0JSr4ERRuyfqaxIn6LeEKFEC J+p8/XoZqjuUhxikKTapgQji9SY+bhoFLXtC9xCdiQPbDg6ek7Zh9aemCBfLZG8T1wln 3hvc1eumSuocJFnR2ZXwIpF2rcp4++c6AK6luRBd6jc09wuUQTtvcpwW9mvZdHALxRZD F8bg== X-Gm-Message-State: AFqh2kpWWU5v1eRnIvjLVkn0pxehMdogI5MFXDwVsM1cwBwThtiO/RI5 oLH/rI17E2Ts/ywDaL1kXvEJZFnbk6H9rG6k X-Received: by 2002:a05:6a20:b285:b0:af:ec0f:f6b5 with SMTP id ei5-20020a056a20b28500b000afec0ff6b5mr72803915pzb.11.1673402766884; Tue, 10 Jan 2023 18:06:06 -0800 (PST) Received: from pmalani.c.googlers.com.com (33.5.83.34.bc.googleusercontent.com. [34.83.5.33]) by smtp.gmail.com with ESMTPSA id z6-20020a656646000000b00477a442d450sm7336738pgv.16.2023.01.10.18.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 18:06:06 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: bleung@chromium.org, Prashant Malani , Heikki Krogerus , Greg Kroah-Hartman , Guillaume Ranquet , Macpaul Lin , Pablo Sun Subject: [PATCH 3/3] usb: typec: altmodes/displayport: Use proper macro for pin assignment check Date: Wed, 11 Jan 2023 02:05:43 +0000 Message-Id: <20230111020546.3384569-3-pmalani@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230111020546.3384569-1-pmalani@chromium.org> References: <20230111020546.3384569-1-pmalani@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754690108538544549?= X-GMAIL-MSGID: =?utf-8?q?1754690108538544549?= While looking at the DP configuration VDO to determine the peripheral configuration, the spec (Table 8-5: DisplayPort Configurations, VESA DisplayPort Alt Mode Standard v2.0) lists the options as "UFP_U as a DP Source/Sink Device". So, use the correct macro while performing this check. Effectively it's the same as the existing code, but the proposed macro describes the state a little better. No functional changes introduced. Cc: Heikki Krogerus Signed-off-by: Prashant Malani Reviewed-by: Benson Leung Reviewed-by: Heikki Krogerus --- drivers/usb/typec/altmodes/displayport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c index c0d65c93cefe..746bfbf3d557 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -426,7 +426,7 @@ static const char * const pin_assignments[] = { */ static u8 get_current_pin_assignments(struct dp_altmode *dp) { - if (DP_CONF_CURRENTLY(dp->data.conf) == DP_CONF_DFP_D) + if (DP_CONF_CURRENTLY(dp->data.conf) == DP_CONF_UFP_U_AS_DFP_D) return DP_CAP_PIN_ASSIGN_DFP_D(dp->alt->vdo); else return DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo);