From patchwork Fri Jan 20 20:58:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 645406 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01E41C25B50 for ; Fri, 20 Jan 2023 20:59:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbjATU7e (ORCPT ); Fri, 20 Jan 2023 15:59:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbjATU7c (ORCPT ); Fri, 20 Jan 2023 15:59:32 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EFF795758 for ; Fri, 20 Jan 2023 12:59:32 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id b10so6753423pjo.1 for ; Fri, 20 Jan 2023 12:59:32 -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=G/NayfWzq9vrN64+FXlyicb+sQzGrHgAlMcsBqy5/Cs=; b=l/q7MlA/inIGoQ3K/SDK8UD8cG2LVoYnoWkGGQ+EDbGa2+VR4ctg3/rVLdL417Tx+P ChQqo9uxD7mPTcP9lqnLSIMqk6pN88gSpocAfXKF5/2aGaNH9pKI2j2awNxizDvbJS4i AhX1uH6z9QhCZDYBmc7ZI7MYGNkoXRvs6aEU8= 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=G/NayfWzq9vrN64+FXlyicb+sQzGrHgAlMcsBqy5/Cs=; b=zBBNI1oXO5BabsSJv0iRGpb7S1HICrsxF0vSYxqoH6NhtzlxLdQIvwOmfEoBardwLw AM2rvsWl84ZWXThygE0OGIapZ2ysesDD19qKYzuLaYkrEOHhmFysPexST8xz8P8MAAMx 0rOUoEszHd9eOZWcZItUpaA3dxS3u/UZCt9MRbyPxExOVJZjajmRQ2sPL+RzLiQoM5S9 7nc9NSj1x4/TFPDuLS1EDQ6aIwh+kvptF62BOaoRjf0UX50b022RCGBVifgTlW6HVJRW qWiQICj7qLwiAiB034Bz7gRAIeuykbOR1HJwxyKdwfFHhnGnW/8AHhiDxv+/sK5x5H5R 8U3A== X-Gm-Message-State: AFqh2kqOmdXi3bjvmQBaG8vL/CC6FQQsvVVEs8Hwm43q6qbrPt7e3tWh KjM6gnDPbiXotOGCGXKVvYhsWw== X-Google-Smtp-Source: AMrXdXtRw3yvvXA4LlvC6kbgh+AR6TQ+FwpcadiJL93OfITw2aiV8BncTKrpas5qfHVx8jmP5GGejg== X-Received: by 2002:a17:902:7b98:b0:189:9031:6761 with SMTP id w24-20020a1709027b9800b0018990316761mr15758402pll.22.1674248371579; Fri, 20 Jan 2023 12:59:31 -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 n11-20020a170902e54b00b0018c7a5e052asm27248336plf.225.2023.01.20.12.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 12:59:31 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: bleung@chromium.org, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, Prashant Malani , Guenter Roeck Subject: [PATCH v2 1/2] usb: typec: altmodes/displayport: Update active state Date: Fri, 20 Jan 2023 20:58:26 +0000 Message-Id: <20230120205827.740900-1-pmalani@chromium.org> X-Mailer: git-send-email 2.39.0.246.g2a6d74b583-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Update the altmode "active" state when we receive Acks for Enter and Exit Mode commands. Having the right state is necessary to change Pin Assignments using the 'pin_assignment" sysfs file. Cc: Heikki Krogerus Reviewed-by: Benson Leung Signed-off-by: Prashant Malani Reviewed-by: Heikki Krogerus --- Changes since v1: - Dropped the Fixes and Cc: stable tags; given the discussion in [1] I no longer think this constitutes a fix. - Added Reviewed-by tag from Benson. [1] https://lore.kernel.org/linux-usb/20230118031514.1278139-1-pmalani@chromium.org/ drivers/usb/typec/altmodes/displayport.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c index 06fb4732f8cd..bc1c556944d6 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -277,9 +277,11 @@ static int dp_altmode_vdm(struct typec_altmode *alt, case CMDT_RSP_ACK: switch (cmd) { case CMD_ENTER_MODE: + typec_altmode_update_active(alt, true); dp->state = DP_STATE_UPDATE; break; case CMD_EXIT_MODE: + typec_altmode_update_active(alt, false); dp->data.status = 0; dp->data.conf = 0; break; From patchwork Fri Jan 20 20:58:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 644970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D601EC05027 for ; Fri, 20 Jan 2023 21:00:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229742AbjATVAH (ORCPT ); Fri, 20 Jan 2023 16:00:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjATVAG (ORCPT ); Fri, 20 Jan 2023 16:00:06 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFCBB8BA8F for ; Fri, 20 Jan 2023 13:00:04 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id 5so1082197plo.3 for ; Fri, 20 Jan 2023 13:00:04 -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=oi0gtjhsP7zp5xSW3Z3RoqoJbUiEEOmd4JoTvK9TkE0=; b=fg/1GeHrMIY8TGrldd/OZ4ISLqmrvplDrY+W9latQq+0WVyUBB+O194ZQd3Pgdap5J P6TdL322sMvyymyQwP8qddbMEe1ZtmHrlAsvz8vO8NFPTYRDvlhfo8irRWvYrGKgF/UN wUVmkk3yfKmCsADg/cisRcGkI2gAVDaslIdKw= 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=oi0gtjhsP7zp5xSW3Z3RoqoJbUiEEOmd4JoTvK9TkE0=; b=tNpyLxfL9Kg6cssyo/AwA6kBgxOkHRq2u5jR7Qiaz97U2CReNg4Mz53/AOcAqaM7A7 siXp0a1JHzZvUzcqcGPbElKi54EmSxfGsbworbBaBdbrcdcRNurSA5fo3VnaqMI99WFE 8uPdK1Fdpmodepv+IWDkkMe6pOcdspUAIiArGrDPz+lxtXZ7BdNQXHkMxLJ/8dpUMP88 CPsdrGNCJ8mnYPmCxzY1vaPcyHPqJ7kR2oBBPtlvHepKkfTFDAKVTsbQ3gSALeDjUpMj 0MWFfNcXDj6KJnW889iIkKC7lgQPWysK9vDrgZ1OqvR9+6dNGXYDpN+oRsHJ88VtIm5Q QY2g== X-Gm-Message-State: AFqh2kqjWc1RXJ/EunuRmfA2FhCCHYJzq1K9cqFg9uvWTho1W3mE3wHs uL0oGYynivVXI+GfaGPJBuEEPA== X-Google-Smtp-Source: AMrXdXsEiftQhUUKdZowWRfYE7CzV0G4etW5wYZ1PTNLMA0OOLMxzhhYiEHcknDcmuT6G9xFRzdPog== X-Received: by 2002:a17:902:720a:b0:193:25b6:71bc with SMTP id ba10-20020a170902720a00b0019325b671bcmr18561161plb.25.1674248404393; Fri, 20 Jan 2023 13:00:04 -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 n11-20020a170902e54b00b0018c7a5e052asm27248336plf.225.2023.01.20.13.00.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 13:00:04 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: bleung@chromium.org, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, Prashant Malani , Guenter Roeck Subject: [PATCH v2 2/2] usb: typec: tcpm: Remove altmode active state updates Date: Fri, 20 Jan 2023 20:58:28 +0000 Message-Id: <20230120205827.740900-2-pmalani@chromium.org> X-Mailer: git-send-email 2.39.0.246.g2a6d74b583-goog In-Reply-To: <20230120205827.740900-1-pmalani@chromium.org> References: <20230120205827.740900-1-pmalani@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Since the "active" state for partner altmodes is now being taken care of by the altmode driver itself (specifically, DisplayPort altmode), we no longer need to do so from the port driver. So remove the calls to typec_altmode_update_active() from TCPM. Suggested-by: Heikki Krogerus Signed-off-by: Prashant Malani Reviewed-by: Guenter Roeck Reviewed-by: Benson Leung --- Changes since v1: - Patch first introduced in v2. drivers/usb/typec/tcpm/tcpm.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 904c7b4ce2f0..0f5a9d4db105 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -1693,14 +1693,11 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev, } break; case CMD_ENTER_MODE: - if (adev && pdev) { - typec_altmode_update_active(pdev, true); + if (adev && pdev) *adev_action = ADEV_QUEUE_VDM_SEND_EXIT_MODE_ON_FAIL; - } return 0; case CMD_EXIT_MODE: if (adev && pdev) { - typec_altmode_update_active(pdev, false); /* Back to USB Operation */ *adev_action = ADEV_NOTIFY_USB_AND_QUEUE_VDM; return 0;