From patchwork Wed Dec 16 03:49:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ike Panhc X-Patchwork-Id: 7859361 Return-Path: X-Original-To: patchwork-platform-driver-x86@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DCC609F32E for ; Wed, 16 Dec 2015 03:50:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 22D7D202D1 for ; Wed, 16 Dec 2015 03:50:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4047C202BE for ; Wed, 16 Dec 2015 03:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965803AbbLPDuQ (ORCPT ); Tue, 15 Dec 2015 22:50:16 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:44683 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965766AbbLPDtm (ORCPT ); Tue, 15 Dec 2015 22:49:42 -0500 Received: from 1.general.ikepanhc.us.vpn ([10.172.69.54] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1a935w-0000ZE-HJ; Wed, 16 Dec 2015 03:49:41 +0000 From: Ike Panhc To: Darren Hart , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ideapad: Report hard block off if it is never on Date: Wed, 16 Dec 2015 11:49:33 +0800 Message-Id: <1450237773-1685-1-git-send-email-ike.pan@canonical.com> X-Mailer: git-send-email 1.9.1 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hardware radio switch is rare on recently ideapad and some of them reported radio hardware blocked by error. With more and more ideapads available in market to maintain the dmi table becomes a never-finished job. Therefore I am thinking an easy way to detect by response from hardware. This patch will make driver says hardware switch is not blocked if the response from ACPI is always radio blocked. For an ideapad without radio switch, no matter what ACPI says, driver will report false on hardware blocked. For an ideapad with radio switch, if driver loaded with radio on, no behavior is changed. For an ideapad with radio switch and driver loaded with radio off, driver will report unblocked falsely and network manager might not scan if wireless driver reports blocked. Once the switch is on, driver will report correct information. Signed-off-by: Ike Panhc --- drivers/platform/x86/ideapad-laptop.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index a313dfc..91ccb4e 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -482,11 +482,16 @@ static void ideapad_sync_rfk_state(struct ideapad_private *priv) { unsigned long hw_blocked = 0; int i; + static int hw_unblock_once; if (priv->has_hw_rfkill_switch) { if (read_ec_data(priv->adev->handle, VPCCMD_R_RF, &hw_blocked)) return; + if (hw_blocked) + hw_unblock_once = 1; hw_blocked = !hw_blocked; + if (!hw_unblock_once) + hw_blocked = 0; } for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)