From patchwork Wed Oct 25 04:29:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= X-Patchwork-Id: 10025825 X-Patchwork-Delegate: andy.shevchenko@gmail.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4804660381 for ; Wed, 25 Oct 2017 04:30:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33B9C28AD6 for ; Wed, 25 Oct 2017 04:30:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 284AB28AE5; Wed, 25 Oct 2017 04:30:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61B7228AE0 for ; Wed, 25 Oct 2017 04:30:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750822AbdJYEaF (ORCPT ); Wed, 25 Oct 2017 00:30:05 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:48915 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750763AbdJYEaE (ORCPT ); Wed, 25 Oct 2017 00:30:04 -0400 Received: by mail-lf0-f68.google.com with SMTP id a69so26323535lfe.5 for ; Tue, 24 Oct 2017 21:30:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kempniu.pl; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eoPsY+OTtqnJPYTojWMT96xI/APWeSke6ixQjOd0u+g=; b=I4h6s7VsaIGnhsORli/LycUDyUTQtVieYinDNUwxybXgUQOv1uCXIqeF6gm72rZ8He oCBIInPu4N8HMPBEyS7bVSKxR0KC3KJArm6ib5naaSnJyj8nY1qc6ruMNX0ZzmKJ35Sj N5wNyxv/JQnrmU8xJU9hEYg9h72FeIBhLrQA4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eoPsY+OTtqnJPYTojWMT96xI/APWeSke6ixQjOd0u+g=; b=BELa8/KrcrixhNliSApEw0kJyCP355nPuXInJxpkiA7h9DeUKbHDXbRvVQQWKSJlwX 6cdIMURqd0JWqUEM8FBPHvLSKbIhbFKbAMpo4lgQz48Qum/oszkbbDiigLohMTY25Xzf pp5uJxIOsY2U5+k1zaqz8M8rRpt+r7rsLi9w6eIAM01ZDIXRtNFzatvEAefJMF6eFlmh EygR5NHldq6thxQfZqZQZ7gJTuw0A+d1tC5Ng2fY70iAgCy5OnNPtDUts/V2fbwvsfFM 6TwV5j8L/FqGnI0MEepes5OZaqfv42JF6LX6veScloWlwDp4cZfX+ec/AYGorun5ImlD QwdQ== X-Gm-Message-State: AMCzsaVbuxX+yVRu+roDMhG01v9G5IJsgQbRIOsl9j+ec77psZ/OLw0+ KDhSiZOomnUVSO7dS6suRmRbJw== X-Google-Smtp-Source: ABhQp+RbVjJJm7v/C/YhQGN1LdBJxfUSl+d3dRRDDWGG+rHK3/gBoTpNm5n4qDMdhesKrBzwz+7n+w== X-Received: by 10.25.115.14 with SMTP id o14mr5313789lfc.79.1508905803361; Tue, 24 Oct 2017 21:30:03 -0700 (PDT) Received: from kmp-mobile.hq.kempniu.pl (kmp-mobile.hq.kempniu.pl. [2001:470:64df:111::1b01]) by smtp.googlemail.com with ESMTPSA id p62sm365483lfd.39.2017.10.24.21.30.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 21:30:02 -0700 (PDT) From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= To: Jonathan Woithe , Darren Hart , Andy Shevchenko , Harvey Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] platform/x86: fujitsu-laptop: Fix radio LED detection Date: Wed, 25 Oct 2017 06:29:46 +0200 Message-Id: <20171025042946.13225-1-kernel@kempniu.pl> X-Mailer: git-send-email 2.14.2 MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Radio LED detection method implemented in commit 4f62568c1fcf ("fujitsu-laptop: Support radio LED") turned out to be incorrect as it causes a radio LED to be erroneously detected on a Fujitsu Lifebook E751 which has a slide switch (and thus no radio LED). Use bit 17 of flags_supported (the value returned by method S000 of ACPI device FUJ02E3) to determine whether a radio LED is present as it seems to be a more reliable indicator, based on comparing DSDT tables of four Fujitsu Lifebook models (E744, E751, S7110, S8420). Reported-by: Heinrich Siebmanns Signed-off-by: Michał Kępień Tested-by: Heinrich Siebmanns Reviewed-by: Jonathan Woithe Tested-by: Heinrich Siebmanns --- I do not have a Fujitsu laptop with a radio LED for testing, so I was only able to check that this patch still does not cause a radio LED to be detected on a Lifebook S7020. Harvey, could you please try this patch on your Lifebook E751 and see whether the log messages you reported disappear? I will be happy to assist you off-list in case you need help with it. drivers/platform/x86/fujitsu-laptop.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 56a8195096a2..2cfbd3fa5136 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -691,6 +691,7 @@ static enum led_brightness eco_led_get(struct led_classdev *cdev) static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) { + struct fujitsu_laptop *priv = acpi_driver_data(device); struct led_classdev *led; int result; @@ -724,12 +725,15 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) } /* - * BTNI bit 24 seems to indicate the presence of a radio toggle - * button in place of a slide switch, and all such machines appear - * to also have an RF LED. Therefore use bit 24 as an indicator - * that an RF LED is present. + * Some Fujitsu laptops have a radio toggle button in place of a slide + * switch and all such machines appear to also have an RF LED. Based on + * comparing DSDT tables of four Fujitsu Lifebook models (E744, E751, + * S7110, S8420; the first one has a radio toggle button, the other + * three have slide switches), bit 17 of flags_supported (the value + * returned by method S000 of ACPI device FUJ02E3) seems to indicate + * whether given model has a radio toggle button. */ - if (call_fext_func(device, FUNC_BUTTONS, 0x0, 0x0, 0x0) & BIT(24)) { + if (priv->flags_supported & BIT(17)) { led = devm_kzalloc(&device->dev, sizeof(*led), GFP_KERNEL); if (!led) return -ENOMEM;