Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp921545rdb; Sat, 6 Jan 2024 16:18:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFipe9guNgj7GpyqlDhFWoGbDXOObQoUqKWclKEIOYzZU/dTuWtQp6knBhDCrlKUCynFa48 X-Received: by 2002:a05:6830:138c:b0:6dd:c889:ca15 with SMTP id d12-20020a056830138c00b006ddc889ca15mr655009otq.37.1704586731369; Sat, 06 Jan 2024 16:18:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704586731; cv=none; d=google.com; s=arc-20160816; b=zRWemTXK4ulooKHU9maD2cVnOdcPHnq3cdSHv6f/bNlizUU1CK7M8KQYu7FyrtuLIK IzXdANjWr5qPq+M1xkI/YuH1UaYmmvUh8tcDRlEQx2sWmfViKHFXCzBtRYmfcXVe4X0C h1rqXm4Pcf2u/JUrL/zwZub08Pq8edsJHTS9C2JOfbRCgRPZ6eVSwaTisKKCnM2hO9YG Aht2X6D9+wo5B0oXf1o20SBQQhPxPRjDGwW22Lf1KTXd4ISnTP1gYcJ0CssYlMHpD+4n oDlYFPMiq1KdalMTyBdJqRzRqCPIYFDn/bty67UpzcFBSKo0GcZrhqaTOsMYBq3+sU8A Gf9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=u/twq7oEWzvQ/7mfPMJVHHnr+GLtOTTKaAsZVrSqFds=; fh=PBT+T+L/Wk7fQyAuF/ivTwxWqTQzcP6BniPDJctp9Xs=; b=oCG7d2pR+pZswbyjQkBiXFa12sl5wZffl+q9II6qLxRABHTTaVljzIGtfectvcegvj F70+OvWww3YFkETPLAxzAlL7WE5675X1qEPVsQ40vyEja0UUNkIlWLU5DLz1rU926pCZ RjdZgZmr6PhMZsHJMrTtCeru5a7MS75sCc6jJSIKOr11H0vo8IBypDr87iP7kK1W01qz N3o5ADDn9X4DkwKAkwckS8IOTcYSo8FqvV5XYYNFFKPFIc9ZA+ZwUsCvjoNuy3QGuvPf QeTF+4mPnYBiijvgQugWLxl8uKGcsJ4n9HrmJtaEvhCfi6ZKKmvcYQwA0oSZAu0dD+f5 UqzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-18745-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18745-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u26-20020a05622a199a00b0042836ba6d58si4940236qtc.365.2024.01.06.16.18.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 16:18:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18745-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-18745-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18745-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 240301C20D14 for ; Sun, 7 Jan 2024 00:18:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 820E61FD5; Sun, 7 Jan 2024 00:17:55 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from cae.in-ulm.de (cae.in-ulm.de [217.10.14.231]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B588323DD; Sun, 7 Jan 2024 00:17:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=c--e.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=c--e.de Received: by cae.in-ulm.de (Postfix, from userid 1000) id 2D28014042E; Sun, 7 Jan 2024 01:17:51 +0100 (CET) From: "Christian A. Ehrhardt" To: Heikki Krogerus , linux-usb@vger.kernel.org Cc: "Christian A. Ehrhardt" , Dell.Client.Kernel@dell.com, Greg Kroah-Hartman , Neil Armstrong , Hans de Goede , Jack Pham , Fabrice Gasnier , =?UTF-8?q?Samuel=20=C4=8Cavoj?= , linux-kernel@vger.kernel.org Subject: [PATCH 3/4] usb: ucsi: Quirk to ack a connector change ack cmd Date: Sun, 7 Jan 2024 01:17:00 +0100 Message-Id: <20240107001701.130535-4-lk@c--e.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240107001701.130535-1-lk@c--e.de> References: <20240107001701.130535-1-lk@c--e.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The PPM on some Dell laptops seems to expect that the ACK_CC_CI command to clear the connector change notification is in turn followed by another ACK_CC_CI to acknowledge the ACK_CC_CI command itself. This is in violation of the UCSI spec that states: "The only notification that is not acknowledged by the OPM is the command completion notification for the ACK_CC_CI or the PPM_RESET command." Add a quirk to send this ack anyway. Signed-off-by: Christian A. Ehrhardt --- drivers/usb/typec/ucsi/ucsi.c | 7 ++++++- drivers/usb/typec/ucsi/ucsi.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 00b23292f46f..8718836b6aba 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -54,11 +54,16 @@ static int ucsi_acknowledge_command(struct ucsi *ucsi) static int ucsi_acknowledge_connector_change(struct ucsi *ucsi) { u64 ctrl; + int ret; ctrl = UCSI_ACK_CC_CI; ctrl |= UCSI_ACK_CONNECTOR_CHANGE; - return ucsi->ops->sync_write(ucsi, UCSI_CONTROL, &ctrl, sizeof(ctrl)); + ret = ucsi->ops->sync_write(ucsi, UCSI_CONTROL, &ctrl, sizeof(ctrl)); + if (ret == 0 && ucsi->quirks & UCSI_ACK_CONNECTOR_CHANGE_ACK_CMD) + ret = ucsi_acknowledge_command(ucsi); + + return ret; } static int ucsi_exec_command(struct ucsi *ucsi, u64 command); diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h index 5e6d2225c9c8..9ea2143776cf 100644 --- a/drivers/usb/typec/ucsi/ucsi.h +++ b/drivers/usb/typec/ucsi/ucsi.h @@ -321,6 +321,7 @@ struct ucsi { /* Enabled quirks. */ unsigned int quirks; +#define UCSI_ACK_CONNECTOR_CHANGE_ACK_CMD BIT(0) }; #define UCSI_MAX_SVID 5 -- 2.40.1