Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4799043imb; Thu, 7 Mar 2019 00:24:58 -0800 (PST) X-Google-Smtp-Source: APXvYqxj1EOTmqnKpR2t9xIf9yr8ibA8r1+1Aspc0KHIswPlARK5kVPs7xGPjuKPWGOg9gw4ISMc X-Received: by 2002:a63:c042:: with SMTP id z2mr10354666pgi.307.1551947098874; Thu, 07 Mar 2019 00:24:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551947098; cv=none; d=google.com; s=arc-20160816; b=k7NltJjc3eTPNBTRf7onxigt/ugeo+enbTaTvnpimr7k28F7KInxZzOAJmUXKVmEMa joOPYgUxCA0JOn0RLcsfObMmK7fEib1RH26rtxo1l5HVFChU/Je7LRhrXgTsYQInDBDW 3NKF7ECtJlruag5x8TgITNudfKoViRj3UNP+pHUC2wve0RaZ4gUlDRpFMHGcBRPfADlx brhsY52W45Spv5T4bM+nu46/xMY+WqHK1QqxFr1W1WkVAk3dyB0hqDDxTh3wPCGVWEMv 71UPlGKoH00BfW1Xcau/tItzVMP+usx5QfYUrbctLAUew5OSVaA6GPG68DGDj86jTI17 4wfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xlSoW9n3/vhZTtvHjrlW/OG/u/jg3swLcYjt4fKauOM=; b=zeoTq+JHI8VhX7Fvc02gD8NsSOzS0724KaKpxoNvqSvwTTt7QK705pxnfT7j7ZczVg 4G0cqL18mpNjROihbZzYwqIT1fuN+FJ7gg6HRQbgYGN1b/wH9U8LJ21AaLd03+EE7YUe xG5lpJ1BarSy7JXl7bEayeutUcvqBOoaLqFcig0H/rg8EXyPl+DpsAvbJ/jrRATido/v A2ngMRCIvlL+ejt6uKePAUFxYmcWFw+TmmA8I4t5/XXLbb5KayvX/+0lrctlh130SIfc sUgWO99ZMFi3LJN8pnhKyJFAP/E3mfgBQdvD2mhnz6smN4+nlWa17hKA7lKubn9EJuqM DKlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=r9DbNFMd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2si3571005pfd.113.2019.03.07.00.24.43; Thu, 07 Mar 2019 00:24:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=r9DbNFMd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726216AbfCGIXv (ORCPT + 99 others); Thu, 7 Mar 2019 03:23:51 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:44489 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726028AbfCGIXv (ORCPT ); Thu, 7 Mar 2019 03:23:51 -0500 Received: by mail-pg1-f193.google.com with SMTP id j3so10667743pgm.11; Thu, 07 Mar 2019 00:23:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xlSoW9n3/vhZTtvHjrlW/OG/u/jg3swLcYjt4fKauOM=; b=r9DbNFMdx884oMolSYmPmYcNrg1ZhwGTL9jmgTmpZR8CFU/LsSGZVx9+IC5nCNFUvC hMSdKGMkjbdp7uYvfAdQKdr7qwWx1EZw2RNq4TUSsqzwcGpxnWTi8qQ15NmRO88cv2u5 d1CnIz0t6OG4i5IIgQhMpzyF1yS7fSDP39RWvAbezb0KVmJo7/9w6/+HNxgUcnWKK37v uL5GquTIJQdRnX3wUQ2WWDAW+gQQj4SAUwN4ewUnAuigYfs99K1yQ2gX+cTLHtMZl0Ey yFgZA0iYskqI2OmdxZsU7jrKzNXfj0JBXPq6hmny9an27VHCj+Qf8N7eZbB80K2v7tUo 5k4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xlSoW9n3/vhZTtvHjrlW/OG/u/jg3swLcYjt4fKauOM=; b=iSQWeSKea2SLcFJqYaL0iglNmFfbhy4HcbfiUMCsS8PUjvfzTGNLc75UA1Oai3+ahr kBmJa8F0fW3m81GoOCsmmEPqaLjfrftZoFUqJsGcGHcfw0maxXMKWzbh984aLzEczmAx 79h79BYjv4kKnR0ZJtSb5pgw8ieXZVXrjMis+syNMS3UqKtO7w6xVMFgCUnO2QE7nuwI MFzYE+KaPiYjOc7X3OwZEom04zzmM1XhNAjrwx1W1pqRXVjyXitZo0p2RE+wPS7WqGaK qHrTXtuz12TyxwbUSrwcy/OZd6BvRuFle/Ilk+JE0j8yUJjQADZscmDzpV2LDXndrwvP 5wgw== X-Gm-Message-State: APjAAAWavSdp2u7XKbbKjRHa7KJuUCHJDVNPzfysZPE32UR5VZNj8aw8 8BjvV4hjw/UB25frlmr5uo09ui7/XScyZmJGQ/cdUhr25g0= X-Received: by 2002:aa7:930b:: with SMTP id 11mr11658794pfj.49.1551947030319; Thu, 07 Mar 2019 00:23:50 -0800 (PST) MIME-Version: 1.0 References: <20190307080820.9723-1-jiaxun.yang@flygoat.com> In-Reply-To: <20190307080820.9723-1-jiaxun.yang@flygoat.com> From: Andy Shevchenko Date: Thu, 7 Mar 2019 10:23:38 +0200 Message-ID: Subject: Re: [PATCH] platform/x86: thinkpad_acpi: disable bluetooth for some machines To: Jiaxun Yang Cc: Henrique de Moraes Holschuh , Darren Hart , Andy Shevchenko , ibm-acpi-devel@lists.sourceforge.net, Platform Driver , Linux Kernel Mailing List , Stable Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 7, 2019 at 10:09 AM Jiaxun Yang wrote: > > Some AMD based ThinkPads have a firmware bug that calling > "GBDC" will cause bluetooth on Intel wireless cards blocked. > > Probe these models by DMI match and disable bluetooth subdriver > if specified Intel wireless card exist. Thanks for a patch. My comments below. (and take your time, there is merge window going on, so, your fix is probably material for v5.1-rc2) > @@ -79,6 +79,7 @@ > #include > #include > #include > +#include > #include The new include has included the old one with IDs. > #include > #include > @@ -4501,11 +4502,80 @@ static void bluetooth_exit(void) > bluetooth_shutdown(); > } > +static int __init have_bt_fwbug(void) > +{ > + /* Some AMD based ThinkPads have a firmware bug that calling > + * "GBDC" will cause bluetooth on Intel wireless cards blocked > + */ /* * Comments in multi-line style example. * Should look like this one. */ > + if (dmi_check_system(bt_fwbug_list)) { > + if (pci_get_device(PCI_VENDOR_ID_INTEL, 0x24F3, NULL) || \ > + pci_get_device(PCI_VENDOR_ID_INTEL, 0x24FD, NULL) || \ > + pci_get_device(PCI_VENDOR_ID_INTEL, 0x2526, NULL)) You can do a table and use pci_match_device(). On top of it if (x) { if (y) ... } equivalent to if (x && y) { ... } > + return 1; > + else > + return 0; > + } else { > + return 0; > + } > +} > + if (have_bt_fwbug()) { > + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL, > + FW_BUG "disable bluetooth subdriver for Intel cards\n"); > + return 1; > + } > vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL, > "initializing bluetooth subdriver\n"); Below I see the following: /* bluetooth not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p, G4x, R30, R31, R40e, R50e, T20-22, X20-21 */ tp_features.bluetooth = hkey_handle && acpi_evalf(hkey_handle, &status, "GBDC", "qd"); Is it possible to integrate your stuff to this one? Or can you do similar, like tp_features.bluetooth = !have_bt_fwbug(); ? -- With Best Regards, Andy Shevchenko