From patchwork Fri Apr 29 21:14:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lyude Paul X-Patchwork-Id: 12832818 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 42D03C43217 for ; Fri, 29 Apr 2022 21:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235065AbiD2VRs (ORCPT ); Fri, 29 Apr 2022 17:17:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234608AbiD2VRr (ORCPT ); Fri, 29 Apr 2022 17:17:47 -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 CC037D3DAA for ; Fri, 29 Apr 2022 14:14:28 -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=OVJgetryfXSVXe5yvSCCfrQu6gny1xdVtA3tH62iDPs=; b=MtiKwjb/VXp2wN5p0bMtpxo2luOTtr4is5NFWIGQQJZwxEn8qdE13MhdgGflupHX4k3BPR jIjGhNm3QOZWa5rUjvB2518Az2MeGPZJFwBg8Po1K/nKuwHUdBg1Lmn7OacYq27J7InV+7 aae0o3AgOPc8H5luV7uS6R60UPvcNjA= 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 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org 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/thinkpad_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 = { TPACPI_Q_LNV3('N', '2', 'E', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (1st gen) */ TPACPI_Q_LNV3('N', '2', 'O', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (2nd gen) */ TPACPI_Q_LNV3('N', '3', '0', TPACPI_FAN_2CTL), /* P15 (1st gen) / P15v (1st 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) */ }; From patchwork Fri Apr 29 21:14:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lyude Paul X-Patchwork-Id: 12832816 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 3C877C433F5 for ; Fri, 29 Apr 2022 21:14:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234894AbiD2VRq (ORCPT ); Fri, 29 Apr 2022 17:17:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234608AbiD2VRq (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 7A839D3DB4 for ; Fri, 29 Apr 2022 14:14:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651266865; 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=OaewuHhgudAm6ngMIWOPH1aeqWjU6X6NnPLj3MR/sAhMXzPpsnitsx19SQBqyt3VoTavz6 UbAoazTT5f4OOAV/BllXgQHbIFASyP/1kGNzTdVBVD9xLeFvbpPRfrZm29dCBKuJ166qoN 7XSmuzlVYVdkmYqEQSi8C1ZL6yR73m0= 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 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org 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/thinkpad_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; fan_status_access_mode = 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 = 1; pr_info("secondary fan support enabled\n"); - } - if (quirks & TPACPI_FAN_2CTL) { + } else if (quirks & TPACPI_FAN_2CTL) { tp_features.second_fan = 1; tp_features.second_fan_ctl = 1; pr_info("secondary fan control enabled\n"); + } else { + /* Try and probe the 2nd fan */ + res = fan2_get_speed(&speed); + if (res >= 0) { + /* It responded - so let's assume it's there */ + tp_features.second_fan = 1; + tp_features.second_fan_ctl = 1; + pr_info("secondary fan control detected & enabled\n"); + } } - /* Try and probe the 2nd fan */ - res = fan2_get_speed(&speed); - if (res >= 0) { - /* It responded - so let's assume it's there */ - tp_features.second_fan = 1; - tp_features.second_fan_ctl = 1; - pr_info("secondary fan control detected & enabled\n"); - } - } else { pr_err("ThinkPad ACPI EC access misbehaving, fan status and control unavailable\n"); return -ENODEV;