From nobody Mon Jun 15 10:13:38 2026 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 876EEC433F5 for ; Fri, 29 Apr 2022 21:14:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235370AbiD2VRw (ORCPT ); Fri, 29 Apr 2022 17:17:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234816AbiD2VRq (ORCPT ); Fri, 29 Apr 2022 17:17:46 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E2266D3D97 for ; Fri, 29 Apr 2022 14:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651266867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OVJgetryfXSVXe5yvSCCfrQu6gny1xdVtA3tH62iDPs=; b=Bl43370UAsYwe83oMk9+gPCrcHeBdlsGb74r2KcBVhZkcMtfCN2lntToSk37kzpZsTaasj vkgiygg2XQLw1o6yBLg87SdbH7Ij3JQsj17P4J7jd4x7f6oaWpePZ6PaLFSEGRtUJsf5R4 BHB9N6Hj7nFGhM5Vg1NQc/wHgnjyBhU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-558-yE_d1nJVNU2UXq_hLYQ76A-1; Fri, 29 Apr 2022 17:14:23 -0400 X-MC-Unique: yE_d1nJVNU2UXq_hLYQ76A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B4B7101AA42; Fri, 29 Apr 2022 21:14:23 +0000 (UTC) Received: from emerald.lyude.net (unknown [10.22.8.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id B19B9111CD36; Fri, 29 Apr 2022 21:14:22 +0000 (UTC) From: Lyude Paul To: ibm-acpi-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Hans de Goede , Mark Pearson , Henrique de Moraes Holschuh , Mark Gross Subject: [PATCH 1/2] platform/x86: thinkpad_acpi: Restore X1 Carbon 9th Gen dual fan quirk Date: Fri, 29 Apr 2022 17:14:17 -0400 Message-Id: <20220429211418.4546-2-lyude@redhat.com> In-Reply-To: <20220429211418.4546-1-lyude@redhat.com> References: <20220429211418.4546-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The new method of probing dual fan support introduced in: bf779aaf56ea ("platform/x86: thinkpad_acpi: Add dual fan probe") While this commit says this works on the X1 Carbon 9th Gen, it actually just results in hiding the second fan on my local machine. Additionally, I'm fairly sure this machine powers on quite often without either of the two fans spinning. So let's fix this by adding back the dual fan quirk for the X1 Carbon 9th Gen. Signed-off-by: Lyude Paul Fixes: bf779aaf56ea ("platform/x86: thinkpad_acpi: Add dual fan probe") Cc: Mark Pearson Cc: Hans de Goede Cc: Henrique de Moraes Holschuh Cc: Mark Gross Cc: ibm-acpi-devel@lists.sourceforge.net Cc: platform-driver-x86@vger.kernel.org --- drivers/platform/x86/thinkpad_acpi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/th= inkpad_acpi.c index c568fae56db2..9067fd0a945c 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -8699,6 +8699,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __= initconst =3D { TPACPI_Q_LNV3('N', '2', 'E', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (1st ge= n) */ TPACPI_Q_LNV3('N', '2', 'O', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (2nd ge= n) */ TPACPI_Q_LNV3('N', '3', '0', TPACPI_FAN_2CTL), /* P15 (1st gen) / P15v (1= st gen) */ + TPACPI_Q_LNV3('N', '3', '2', TPACPI_FAN_2CTL), /* X1 Carbon (9th gen) */ TPACPI_Q_LNV3('N', '3', '7', TPACPI_FAN_2CTL), /* T15g (2nd gen) */ TPACPI_Q_LNV3('N', '1', 'O', TPACPI_FAN_NOFAN), /* X1 Tablet (2nd gen) */ }; --=20 2.35.1 From nobody Mon Jun 15 10:13:38 2026 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 0929EC433F5 for ; Fri, 29 Apr 2022 21:14:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235563AbiD2VRz (ORCPT ); Fri, 29 Apr 2022 17:17:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234932AbiD2VRs (ORCPT ); Fri, 29 Apr 2022 17:17:48 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66B07D3AD7 for ; Fri, 29 Apr 2022 14:14:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651266868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vRdwdJR3OoR56yf6TqIrpiS+NzNySH2VSMNhpjHFJH4=; b=ebsBpLAU7gUxxaX+4eAneVpD71f0zLNyL7dm5wNNsOewlQ+biZdqBsWG/YLDHy6wpxR4Wh kbvzEPdsIcfYY6vzlTsCN4lZE/jom64HFMdD/FaZ+u5GpZfyyRaCiStWXh+jMD9O8X/2Fp 5sTydSaNBwQGpkKsxPUMziYwe0jGEuQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-562-XVnx60pGMza8UVmti2IyWw-1; Fri, 29 Apr 2022 17:14:24 -0400 X-MC-Unique: XVnx60pGMza8UVmti2IyWw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A5C9E811E75; Fri, 29 Apr 2022 21:14:23 +0000 (UTC) Received: from emerald.lyude.net (unknown [10.22.8.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52771111CD36; Fri, 29 Apr 2022 21:14:23 +0000 (UTC) From: Lyude Paul To: ibm-acpi-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Hans de Goede , Mark Pearson , Henrique de Moraes Holschuh , Mark Gross Subject: [PATCH 2/2] platform/x86: thinkpad_acpi: Don't probe 2nd fan if enabled by quirk Date: Fri, 29 Apr 2022 17:14:18 -0400 Message-Id: <20220429211418.4546-3-lyude@redhat.com> In-Reply-To: <20220429211418.4546-1-lyude@redhat.com> References: <20220429211418.4546-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If we already know that the system in question has a quirk telling us that the system has a second fan, there's no purpose in probing the second fan - especially when probing the second fan may not work properly with systems relying on quirks. Also, convert all of the conditionals here into a single group of if/else statements. This is because there's no situations where there's more then one quirk on a device. Signed-off-by: Lyude Paul Fixes: bf779aaf56ea ("platform/x86: thinkpad_acpi: Add dual fan probe") Cc: Mark Pearson Cc: Hans de Goede Cc: Henrique de Moraes Holschuh Cc: Mark Gross Cc: ibm-acpi-devel@lists.sourceforge.net Cc: platform-driver-x86@vger.kernel.org --- drivers/platform/x86/thinkpad_acpi.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/th= inkpad_acpi.c index 9067fd0a945c..677822b5d4b4 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -8747,26 +8747,25 @@ static int __init fan_init(struct ibm_init_struct *= iibm) unsigned int speed; =20 fan_status_access_mode =3D TPACPI_FAN_RD_TPEC; - if (quirks & TPACPI_FAN_Q1) + if (quirks & TPACPI_FAN_Q1) { fan_quirk1_setup(); - if (quirks & TPACPI_FAN_2FAN) { + } else if (quirks & TPACPI_FAN_2FAN) { tp_features.second_fan =3D 1; pr_info("secondary fan support enabled\n"); - } - if (quirks & TPACPI_FAN_2CTL) { + } else if (quirks & TPACPI_FAN_2CTL) { tp_features.second_fan =3D 1; tp_features.second_fan_ctl =3D 1; pr_info("secondary fan control enabled\n"); + } else { + /* Try and probe the 2nd fan */ + res =3D fan2_get_speed(&speed); + if (res >=3D 0) { + /* It responded - so let's assume it's there */ + tp_features.second_fan =3D 1; + tp_features.second_fan_ctl =3D 1; + pr_info("secondary fan control detected & enabled\n"); + } } - /* Try and probe the 2nd fan */ - res =3D fan2_get_speed(&speed); - if (res >=3D 0) { - /* It responded - so let's assume it's there */ - tp_features.second_fan =3D 1; - tp_features.second_fan_ctl =3D 1; - pr_info("secondary fan control detected & enabled\n"); - } - } else { pr_err("ThinkPad ACPI EC access misbehaving, fan status and control una= vailable\n"); return -ENODEV; --=20 2.35.1