From nobody Fri Dec 19 12:30:01 2025 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F28676518E for ; Thu, 21 Dec 2023 18:51:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZT8ZL3JW" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-33674f60184so1097338f8f.1 for ; Thu, 21 Dec 2023 10:51:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703184708; x=1703789508; darn=vger.kernel.org; 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=u/RAuun52j6HGK4kEaCxfb8okByL4QT7kA8t/dLOABg=; b=ZT8ZL3JWxWUxRX5BbRST4/yGRFGBoIuK5fojF4m92qRKkWVyLRgkbBrPU7stBf81Ox CqBRpIVhs3kwS6kBZuzVRaT+hxPObLhKxPJ8LNJRZkpzcMi32BF775orPDbNa7dV+F98 3a36WqaDpnsLZWS4oL9ZjVwFQZs5YkQ2dvusPKw6VnBafWSR429UpvHGF+p9YhsRfuWF qjmMyx5LQe7IwhWvvYywNsoj7aoERZ6UPVVgyVJmcP6rc0AF9c+RdjdvZHQHhxyXDCV7 yvJbJyA9Wi1JZ3VU3b4BhnzRnvtuwUC+ZzvchFBgLLixCB1dOUSQQt14utlgJTvcVl8y oKjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703184708; x=1703789508; 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=u/RAuun52j6HGK4kEaCxfb8okByL4QT7kA8t/dLOABg=; b=nT9FxvFrP4uNHHv133hc7yhBQyId6b2cCwbjHMlI28Fmpas2as+IHWlDoKLCRJbFlX Ls5IBqXN5ZIq6CsiUUT9yrYJ1+WWFjPtPp/jcYtSuBkZA7AfHe33kG/SOWPmJ8SJmR6L 9AItYjNlAwW2vmru/+sBIEaEjAh7gES+BQcRZKV6CuiybM4ZdSwnRjRd4aT8GMt1mssV zDyX5K/Ym/4DHwkBNntvjp1FYJEKGMsoa/WwBP0eVmnk2etUIYQUft+CIEB0J9817gxT GyWVW26wwp+sT6mp4D4NhvJCkEKF4gp5gvsgfFm3OTgznYh1Yx6fWV1yPXpRKPejkRTx KZ9Q== X-Gm-Message-State: AOJu0Ywjzt5vuKlinEpfQj6fInYJkZ60nweKagy6d2P2IvcnRpH9r3bx 77zxtV2dAgCVE9O24ytebcLQQ28mQSbZ X-Google-Smtp-Source: AGHT+IETw9cgX/GUIL+MuxgyEj1pirm95PG4E7oxAqm6bxRcppfr9mtDzC8qPNRpXI97hsv+NUMAAw== X-Received: by 2002:a5d:4849:0:b0:336:8f9f:c69c with SMTP id n9-20020a5d4849000000b003368f9fc69cmr144677wrs.40.1703184707911; Thu, 21 Dec 2023 10:51:47 -0800 (PST) Received: from localhost.localdomain (31-10-153-16.cgn.dynamic.upc.ch. [31.10.153.16]) by smtp.gmail.com with ESMTPSA id e17-20020a5d5311000000b0033672cfca96sm2585632wrv.89.2023.12.21.10.51.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 10:51:45 -0800 (PST) From: Aleksandrs Vinarskis To: Lee Jones , Andy Shevchenko , Aleksandrs Vinarskis , linux-kernel@vger.kernel.org Cc: Hans de Goede Subject: [PATCH v4 1/2] mfd: intel-lpss: Switch to generalized quirk table Date: Thu, 21 Dec 2023 19:51:41 +0100 Message-Id: <20231221185142.9224-2-alex.vinarskis@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231221185142.9224-1-alex.vinarskis@gmail.com> References: <20231221185142.9224-1-alex.vinarskis@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Introduce generic quirk table, and port existing walkaround for select Microsoft devices to it. This is a preparation for QUIRK_CLOCK_DIVIDER_UNITY. Signed-off-by: Aleksandrs Vinarskis Reviewed-by: Andy Shevchenko --- drivers/mfd/intel-lpss-pci.c | 23 +++++++++++++++-------- drivers/mfd/intel-lpss.c | 2 +- drivers/mfd/intel-lpss.h | 9 ++++++++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c index 4621d3950b8f..07713a2f694f 100644 --- a/drivers/mfd/intel-lpss-pci.c +++ b/drivers/mfd/intel-lpss-pci.c @@ -23,12 +23,17 @@ =20 #include "intel-lpss.h" =20 -/* Some DSDTs have an unused GEXP ACPI device conflicting with I2C4 resour= ces */ -static const struct pci_device_id ignore_resource_conflicts_ids[] =3D { - /* Microsoft Surface Go (version 1) I2C4 */ - { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1182), }, - /* Microsoft Surface Go 2 I2C4 */ - { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1237), }, +static const struct pci_device_id quirk_ids[] =3D { + { + /* Microsoft Surface Go (version 1) I2C4 */ + PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1182), + .driver_data =3D QUIRK_IGNORE_RESOURCE_CONFLICTS, + }, + { + /* Microsoft Surface Go 2 I2C4 */ + PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1237), + .driver_data =3D QUIRK_IGNORE_RESOURCE_CONFLICTS, + }, { } }; =20 @@ -36,6 +41,7 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { const struct intel_lpss_platform_info *data =3D (void *)id->driver_data; + const struct pci_device_id *quirk_pci_info; struct intel_lpss_platform_info *info; int ret; =20 @@ -55,8 +61,9 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev, info->mem =3D pci_resource_n(pdev, 0); info->irq =3D pci_irq_vector(pdev, 0); =20 - if (pci_match_id(ignore_resource_conflicts_ids, pdev)) - info->ignore_resource_conflicts =3D true; + quirk_pci_info =3D pci_match_id(quirk_ids, pdev); + if (quirk_pci_info) + info->quirks =3D quirk_pci_info->driver_data; =20 pdev->d3cold_delay =3D 0; =20 diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c index eff423f7dd28..aafa0da5f8db 100644 --- a/drivers/mfd/intel-lpss.c +++ b/drivers/mfd/intel-lpss.c @@ -412,7 +412,7 @@ int intel_lpss_probe(struct device *dev, return ret; =20 lpss->cell->swnode =3D info->swnode; - lpss->cell->ignore_resource_conflicts =3D info->ignore_resource_conflicts; + lpss->cell->ignore_resource_conflicts =3D info->quirks & QUIRK_IGNORE_RES= OURCE_CONFLICTS; =20 intel_lpss_init_dev(lpss); =20 diff --git a/drivers/mfd/intel-lpss.h b/drivers/mfd/intel-lpss.h index c1d72b117ed5..2fa9ef916258 100644 --- a/drivers/mfd/intel-lpss.h +++ b/drivers/mfd/intel-lpss.h @@ -11,16 +11,23 @@ #ifndef __MFD_INTEL_LPSS_H #define __MFD_INTEL_LPSS_H =20 +#include #include =20 +/* + * Some DSDTs have an unused GEXP ACPI device conflicting with I2C4 resour= ces. + * Set to ignore resource conflicts with ACPI declared SystemMemory region= s. + */ +#define QUIRK_IGNORE_RESOURCE_CONFLICTS BIT(0) + struct device; struct resource; struct software_node; =20 struct intel_lpss_platform_info { struct resource *mem; - bool ignore_resource_conflicts; int irq; + unsigned int quirks; unsigned long clk_rate; const char *clk_con_id; const struct software_node *swnode; --=20 2.40.1 From nobody Fri Dec 19 12:30:01 2025 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4224651B0 for ; Thu, 21 Dec 2023 18:51:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HeRN1MIY" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3368b1e056eso674325f8f.3 for ; Thu, 21 Dec 2023 10:51:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703184710; x=1703789510; darn=vger.kernel.org; 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=7JVWB86A7u7nOiumhApeayaZD5D0qLKZ2ERiwr5pqqE=; b=HeRN1MIYq3a67PSubOb169acSRCmB7RsPJSH2r4G8udYlXZp0H4xVlCg4oIsm1/huq +6tw0ocu3Ftoc+6NTJKVk/6QMOxzaXrUO/8rIi/N+nqOHj1K73RTuyLXTfEyAKbUvbJo Zw0HvW0HAaR/WWhQm+A/BHZYW6xW/AA8AfiPvb76NvYjctulo80Xm7r6s4Cxq5pte5om fUnAl6MMjMILkRLxjqJ5I43/tw9kyRwbEu0Dgb8/bZWSVcTDGlXn38C1avLka/gR+xHq LAwHlafWOVhsL1aUOcD2pulwhaG4sBE2VldOC8flY3CiuzAxPiTHdt9zZdyXX3dagjp5 evMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703184710; x=1703789510; 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=7JVWB86A7u7nOiumhApeayaZD5D0qLKZ2ERiwr5pqqE=; b=Wtgdc+bsyv6gxhUD6weohbSmC7TcxeKgMSWUIh3+H2SC76l8P+LO93IbNybMLeP4Vg RUkWBEQQQWHlrSzrZi6EfVClvc6Yl9p4/OWonrU0PuAugS+Lx/Z7Ea9hArIjbAvh47pb 2QmNmugiuZxKF1nXiY0DUDKr+Sbjw15NMaxfUXTk8ZzkZNeyKs1QKR+HH4k8WR/KpxkZ mvXhdcFC24B8Jm9JEo4ij3xiso991UZF0mjDF/dt8a7qHu7GoUK15DjLEBeqPKSpoENa 983YQZ13uP/R3WMf3nGV+Znu45J8avuYgdZlYi4l7CMBMxQrd9uz+wnkDUaoG6yyOxmp U7YQ== X-Gm-Message-State: AOJu0YwKHqQOE/CC/rdela9VhWlBs9nhe/IZogrhZmvs1pHgZj4YiMdk mlhzs7e4TB71vJqUeuOEZg== X-Google-Smtp-Source: AGHT+IEx5OKkSMuNED3DaScZcp4Zz8y4tH9KMyS5iMJWAVJLX7SmUQYi9Wp0NV0E5bQS8BzjBpd6CQ== X-Received: by 2002:adf:fa51:0:b0:336:5bb3:eff4 with SMTP id y17-20020adffa51000000b003365bb3eff4mr117459wrr.34.1703184709936; Thu, 21 Dec 2023 10:51:49 -0800 (PST) Received: from localhost.localdomain (31-10-153-16.cgn.dynamic.upc.ch. [31.10.153.16]) by smtp.gmail.com with ESMTPSA id e17-20020a5d5311000000b0033672cfca96sm2585632wrv.89.2023.12.21.10.51.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 10:51:48 -0800 (PST) From: Aleksandrs Vinarskis To: Lee Jones , Andy Shevchenko , Aleksandrs Vinarskis , linux-kernel@vger.kernel.org Cc: Hans de Goede Subject: [PATCH v4 2/2] mfd: intel-lpss: Introduce QUIRK_CLOCK_DIVIDER_UNITY for XPS 9530 Date: Thu, 21 Dec 2023 19:51:42 +0100 Message-Id: <20231221185142.9224-3-alex.vinarskis@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231221185142.9224-1-alex.vinarskis@gmail.com> References: <20231221185142.9224-1-alex.vinarskis@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Some devices (eg. Dell XPS 9530, 2023) due to a firmware bug have a misconfigured clock divider, which should've been 1:1. This introduces quirk which conditionally re-configures the clock divider to 1:1. Signed-off-by: Aleksandrs Vinarskis Reviewed-by: Andy Shevchenko --- drivers/mfd/intel-lpss-pci.c | 5 +++++ drivers/mfd/intel-lpss.c | 7 +++++++ drivers/mfd/intel-lpss.h | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c index 07713a2f694f..8c00e0c695c5 100644 --- a/drivers/mfd/intel-lpss-pci.c +++ b/drivers/mfd/intel-lpss-pci.c @@ -34,6 +34,11 @@ static const struct pci_device_id quirk_ids[] =3D { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1237), .driver_data =3D QUIRK_IGNORE_RESOURCE_CONFLICTS, }, + { + /* Dell XPS 9530 (2023) */ + PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x51fb, 0x1028, 0x0beb), + .driver_data =3D QUIRK_CLOCK_DIVIDER_UNITY, + }, { } }; =20 diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c index aafa0da5f8db..2a9018112dfc 100644 --- a/drivers/mfd/intel-lpss.c +++ b/drivers/mfd/intel-lpss.c @@ -300,6 +300,7 @@ static int intel_lpss_register_clock_divider(struct int= el_lpss *lpss, { char name[32]; struct clk *tmp =3D *clk; + int ret; =20 snprintf(name, sizeof(name), "%s-enable", devname); tmp =3D clk_register_gate(NULL, name, __clk_get_name(tmp), 0, @@ -316,6 +317,12 @@ static int intel_lpss_register_clock_divider(struct in= tel_lpss *lpss, return PTR_ERR(tmp); *clk =3D tmp; =20 + if (lpss->info->quirks & QUIRK_CLOCK_DIVIDER_UNITY) { + ret =3D clk_set_rate(tmp, lpss->info->clk_rate); + if (ret) + return ret; + } + snprintf(name, sizeof(name), "%s-update", devname); tmp =3D clk_register_gate(NULL, name, __clk_get_name(tmp), CLK_SET_RATE_PARENT, lpss->priv, 31, 0, NULL); diff --git a/drivers/mfd/intel-lpss.h b/drivers/mfd/intel-lpss.h index 2fa9ef916258..6f8f668f4c6f 100644 --- a/drivers/mfd/intel-lpss.h +++ b/drivers/mfd/intel-lpss.h @@ -19,6 +19,11 @@ * Set to ignore resource conflicts with ACPI declared SystemMemory region= s. */ #define QUIRK_IGNORE_RESOURCE_CONFLICTS BIT(0) +/* + * Some devices have misconfigured clock divider due to a firmware bug. + * Set this to force the clock divider to 1:1 ratio. + */ +#define QUIRK_CLOCK_DIVIDER_UNITY BIT(1) =20 struct device; struct resource; --=20 2.40.1