From patchwork Sun Jan 7 00:17:01 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: 185700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp333805dyq; Sat, 6 Jan 2024 16:19:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IELWx0SurAZ/0GfgZ9ECUqAegLAXA8il2ZWISvRrDCORW/xFn+EDtekWx2p622jujLEwR/v X-Received: by 2002:a17:903:1210:b0:1cf:c9c3:e79d with SMTP id l16-20020a170903121000b001cfc9c3e79dmr607990plh.59.1704586758316; Sat, 06 Jan 2024 16:19:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704586758; cv=none; d=google.com; s=arc-20160816; b=aloi4uTfEA2rQQi2qR2yy96Z8wmgJPYJdQQxk5Oo+Qs9IPXD5kgcnyV+LWGOY4l+su nQKxmWuSPrVVmZLGzlTeIsiFJ7rj6iDj8lvkxXpIu3sAPiJuW/1hLjcKT3uw9zA7jAcu jHqIlZxd6pc1YlWtfNoT/vBGUGDfuAGCQRV5WfjekXe94Nwrfs941GK63dAdqTTCW27r TmOtvo6V+OgHVMvG2fX8ngLGfwfs/7nXxvU/UEKRrk5AWU+dOhsw6UfPKA0Qsdlh6sqj Up01vjo3VaRRY3KpgimTfecjQykV9KrXLilYqrx7RYw7P7aSYq9y5Wmf13LkjVsJ+0kX rfMQ== 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=HPNivEu9K9n9OQCBvXZdRYlj8dyw2R9Xk3RGkbxdXKo=; fh=PBT+T+L/Wk7fQyAuF/ivTwxWqTQzcP6BniPDJctp9Xs=; b=cp+YXKXJxzge8+S87mTY4l/3QO15bSlwY9m1hX5rFhkJdtEEbzYkUu12HyriC8s/TV AzeoOM/sA00FLvxig+YpG6z7K48rzH+ot/YJm8DqTlnE18eryuWM7dRoMYNFUSSB9ceD QxSTp7jHKPidqGx8sYG5Yq5gLWWfSFGhl65oRVIe4jj80tSJ6cTQRoEAd6xbKiHAyNc3 vOgON1TXbyQ5p0CQmNVVNGngnN05rDE9MGx3Jfgk/bW5IY5yQFGKI+/jX/L0jalfRyzf 1z0yO80/Fp0RTtu5ypiYxeifk/hqlvqfYOrPpSloJhcxXw/hgSu8+QCX7STPjzT61uiR Vnjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-18746-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18746-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 d4-20020a170902854400b001d483d5a0a9si3630208plo.153.2024.01.06.16.19.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 16:19:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18746-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-18746-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18746-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 1CC06282DAB for ; Sun, 7 Jan 2024 00:19:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6700FBE64; Sun, 7 Jan 2024 00:17:58 +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 42EE346A9; Sun, 7 Jan 2024 00:17:54 +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 32AEA14056A; Sun, 7 Jan 2024 01:17:53 +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 4/4] usb: ucsi: Apply UCSI_ACK_CONNECTOR_CHANGE_ACK_CMD to Dell systems Date: Sun, 7 Jan 2024 01:17:01 +0100 Message-Id: <20240107001701.130535-5-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: 1787388764539232538 X-GMAIL-MSGID: 1787388764539232538 Apply the UCSI_ACK_CONNECTOR_CHANGE_ACK_CMD to all Dell systems. There are various reports that ucsi does not work on Dell systems with "GET_CONNECTOR_STATUS failed". At least some of these are most likely due to the need for this quirk. If the logic is wrong users can still use the new quirk override for the typec_ucsi module to disable the quirk. Signed-off-by: Christian A. Ehrhardt --- drivers/usb/typec/ucsi/ucsi_acpi.c | 36 +++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c index 78a0d13584ad..690d5e55bdc4 100644 --- a/drivers/usb/typec/ucsi/ucsi_acpi.c +++ b/drivers/usb/typec/ucsi/ucsi_acpi.c @@ -27,6 +27,11 @@ struct ucsi_acpi { u64 cmd; }; +struct ucsi_acpi_attach_data { + const struct ucsi_operations *ops; + unsigned int quirks; +}; + static int ucsi_acpi_dsm(struct ucsi_acpi *ua, int func) { union acpi_object *obj; @@ -121,12 +126,30 @@ static const struct ucsi_operations ucsi_zenbook_ops = { .async_write = ucsi_acpi_async_write }; -static const struct dmi_system_id zenbook_dmi_id[] = { +static const struct ucsi_acpi_attach_data ucsi_acpi_default_attach_data = { + .ops = &ucsi_acpi_ops, + .quirks = 0 +}; + +static const struct dmi_system_id ucsi_acpi_quirks[] = { { .matches = { DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UA_UM325UA"), }, + .driver_data = &(struct ucsi_acpi_attach_data) { + .ops = &ucsi_zenbook_ops, + .quirks = 0 + }, + }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + }, + .driver_data = &(struct ucsi_acpi_attach_data) { + .ops = &ucsi_acpi_ops, + .quirks = UCSI_ACK_CONNECTOR_CHANGE_ACK_CMD + }, }, { } }; @@ -152,7 +175,8 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data) static int ucsi_acpi_probe(struct platform_device *pdev) { struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); - const struct ucsi_operations *ops = &ucsi_acpi_ops; + const struct dmi_system_id *id; + const struct ucsi_acpi_attach_data *attach; struct ucsi_acpi *ua; struct resource *res; acpi_status status; @@ -182,10 +206,12 @@ static int ucsi_acpi_probe(struct platform_device *pdev) init_completion(&ua->complete); ua->dev = &pdev->dev; - if (dmi_check_system(zenbook_dmi_id)) - ops = &ucsi_zenbook_ops; + attach = &ucsi_acpi_default_attach_data; + id = dmi_first_match(ucsi_acpi_quirks); + if (id) + attach = id->driver_data; - ua->ucsi = ucsi_create(&pdev->dev, ops, 0); + ua->ucsi = ucsi_create(&pdev->dev, attach->ops, attach->quirks); if (IS_ERR(ua->ucsi)) return PTR_ERR(ua->ucsi);