From patchwork Sun Jan 7 00:17:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Christian A. Ehrhardt" X-Patchwork-Id: 185699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp333736dyq; Sat, 6 Jan 2024 16:19:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYJ/b6+mPQY4atF7WaiINf7xLg1AduCcYn9L6ZabrwO8UOqbxTIxR5qkEIcLrQB4xUWWV2 X-Received: by 2002:a17:903:2305:b0:1d4:42f:d39b with SMTP id d5-20020a170903230500b001d4042fd39bmr2212859plh.3.1704586740664; Sat, 06 Jan 2024 16:19:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704586740; cv=none; d=google.com; s=arc-20160816; b=tV/ySdF2aL2UwP9Lqi8HWhLFq4wWPiB5Z0XspT880BGfBDWlXdWqxHR02d9sSRY94k 2ajL3hvplYsjrRRpy3kkyyF87dEKdqZhALmhvm+oRLVTcczOXGL0g5QsyaXZhIrAxe6+ b+tFJxeVaataRtO3FuTebKFy46qEjV++ZSpjfb8QRj3ZksJoeoYSAHHtCwgaeymiDaSg TWeOQGzMXsyD+sPbP3SmbVjakMxWPr78GwhbB8dwkij4yFmhm5EPVEF99WJTjVgkRdWM yBQ1XH5Jxz2KcjHIWPz2H59a+9v+VVr+lyH8dTsN7LHK5dNrdtEmXYPeQ/3bu8c1FZDs Na1g== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18745-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id v20-20020a17090a899400b0028c99453374si3311861pjn.176.2024.01.06.16.19.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 16:19:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18745-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-18745-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18745-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 724E3282DAB for ; Sun, 7 Jan 2024 00:19:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85BDB748C; Sun, 7 Jan 2024 00:17:56 +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_=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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787388746153047535 X-GMAIL-MSGID: 1787388746153047535 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