From patchwork Wed Dec 16 15:08:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattia Dongili X-Patchwork-Id: 68384 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBI4ixog005715 for ; Fri, 18 Dec 2009 04:46:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762194AbZLPPI4 (ORCPT ); Wed, 16 Dec 2009 10:08:56 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1762200AbZLPPI4 (ORCPT ); Wed, 16 Dec 2009 10:08:56 -0500 Received: from static-220-247-10-204.b-man.svips.gol.ne.jp ([220.247.10.204]:38833 "EHLO smtp.kamineko.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762194AbZLPPIz (ORCPT ); Wed, 16 Dec 2009 10:08:55 -0500 Received: by smtp.kamineko.org (Postfix, from userid 1004) id 2AE53742B8; Thu, 17 Dec 2009 00:08:55 +0900 (JST) Received: from caligola.kamineko.org (unknown [192.168.1.10]) by smtp.kamineko.org (Postfix) with ESMTP id 0ADF3742AD; Thu, 17 Dec 2009 00:08:54 +0900 (JST) Received: by caligola.kamineko.org (Postfix, from userid 1000) id 0578416128; Thu, 17 Dec 2009 00:08:54 +0900 (JST) From: Mattia Dongili To: Len Brown Cc: linux-acpi@vger.kernel.org, Mattia Dongili Subject: [PATCH 3/4] sony-laptop: rfkill support for newer models Date: Thu, 17 Dec 2009 00:08:35 +0900 Message-Id: <1260976116-6369-4-git-send-email-malattia@linux.it> X-Mailer: git-send-email 1.6.5.4 In-Reply-To: <1260976116-6369-3-git-send-email-malattia@linux.it> References: <1260976116-6369-1-git-send-email-malattia@linux.it> <1260976116-6369-2-git-send-email-malattia@linux.it> <1260976116-6369-3-git-send-email-malattia@linux.it> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index b2dccf4..cc7d30d 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -131,6 +131,7 @@ enum sony_nc_rfkill { N_SONY_RFKILL, }; +static int sony_rfkill_handle; static struct rfkill *sony_rfkill_devices[N_SONY_RFKILL]; static int sony_rfkill_address[N_SONY_RFKILL] = {0x300, 0x500, 0x700, 0x900}; static void sony_nc_rfkill_update(void); @@ -970,7 +971,7 @@ static void sony_nc_notify(struct acpi_device *device, u32 event) else sony_laptop_report_input_event(ev); } - } else if (sony_find_snc_handle(0x124) == ev) { + } else if (sony_find_snc_handle(sony_rfkill_handle) == ev) { sony_nc_rfkill_update(); return; } @@ -1076,7 +1077,7 @@ static int sony_nc_rfkill_set(void *data, bool blocked) if (!blocked) argument |= 0xff0000; - return sony_call_snc_handle(0x124, argument, &result); + return sony_call_snc_handle(sony_rfkill_handle, argument, &result); } static const struct rfkill_ops sony_rfkill_ops = { @@ -1119,7 +1120,7 @@ static int sony_nc_setup_rfkill(struct acpi_device *device, if (!rfk) return -ENOMEM; - sony_call_snc_handle(0x124, 0x200, &result); + sony_call_snc_handle(sony_rfkill_handle, 0x200, &result); hwblock = !(result & 0x1); rfkill_set_hw_state(rfk, hwblock); @@ -1138,7 +1139,7 @@ static void sony_nc_rfkill_update() int result; bool hwblock; - sony_call_snc_handle(0x124, 0x200, &result); + sony_call_snc_handle(sony_rfkill_handle, 0x200, &result); hwblock = !(result & 0x1); for (i = 0; i < N_SONY_RFKILL; i++) { @@ -1154,7 +1155,7 @@ static void sony_nc_rfkill_update() continue; } - sony_call_snc_handle(0x124, argument, &result); + sony_call_snc_handle(sony_rfkill_handle, argument, &result); rfkill_set_states(sony_rfkill_devices[i], !(result & 0xf), false); } @@ -1164,10 +1165,15 @@ static int sony_nc_rfkill_setup(struct acpi_device *device) { int result, ret; - if (sony_find_snc_handle(0x124) == -1) - return -1; + if (sony_find_snc_handle(0x124) == -1) { + if (sony_find_snc_handle(0x135) == -1) + return -1; + else + sony_rfkill_handle = 0x135; + } else + sony_rfkill_handle = 0x124; - ret = sony_call_snc_handle(0x124, 0xb00, &result); + ret = sony_call_snc_handle(sony_rfkill_handle, 0xb00, &result); if (ret) { printk(KERN_INFO DRV_PFX "Unable to enumerate rfkill devices: %x\n", ret);