From patchwork Thu Aug 30 19:34:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gertjan van Wingerde X-Patchwork-Id: 1389391 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 278A1DF264 for ; Thu, 30 Aug 2012 19:40:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751703Ab2H3Tkt (ORCPT ); Thu, 30 Aug 2012 15:40:49 -0400 Received: from cpsmtpb-ews09.kpnxchange.com ([213.75.39.14]:4270 "EHLO cpsmtpb-ews09.kpnxchange.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751221Ab2H3Tkj (ORCPT ); Thu, 30 Aug 2012 15:40:39 -0400 Received: from cpsps-ews17.kpnxchange.com ([10.94.84.183]) by cpsmtpb-ews09.kpnxchange.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 30 Aug 2012 21:34:24 +0200 Received: from CPSMTPM-CMT104.kpnxchange.com ([195.121.3.20]) by cpsps-ews17.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Thu, 30 Aug 2012 21:34:23 +0200 Received: from wingerd.gvw.nl ([86.87.118.224]) by CPSMTPM-CMT104.kpnxchange.com with Microsoft SMTPSVC(7.0.6002.18264); Thu, 30 Aug 2012 21:34:22 +0200 Received: by wingerd.gvw.nl (Postfix, from userid 1026) id DCDC7202D90; Thu, 30 Aug 2012 21:34:21 +0200 (CEST) From: Gertjan van Wingerde To: , "John W. Linville" Cc: , Ivo van Doorn , Helmut Schaa , Gertjan van Wingerde , Subject: [PATCH 05/14] rt2x00: Fix rt2500pci rfkill polling prior to interface start. Date: Thu, 30 Aug 2012 21:34:04 +0200 Message-Id: <1346355248-5331-6-git-send-email-gwingerde@gmail.com> X-Mailer: git-send-email 1.7.11.1 In-Reply-To: <1346355248-5331-5-git-send-email-gwingerde@gmail.com> References: <1346355248-5331-1-git-send-email-gwingerde@gmail.com> <1346355248-5331-2-git-send-email-gwingerde@gmail.com> <1346355248-5331-3-git-send-email-gwingerde@gmail.com> <1346355248-5331-4-git-send-email-gwingerde@gmail.com> <1346355248-5331-5-git-send-email-gwingerde@gmail.com> X-OriginalArrivalTime: 30 Aug 2012 19:34:22.0602 (UTC) FILETIME=[74EECEA0:01CD86E6] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org We need to program the rfkill switch GPIO pin direction to input at device initialization time, not only when the interface is brought up. Doing this only when the interface is brought up could lead to rfkill detecting the switch is turned on erroneously and inability to create the interface and bringing it up. Signed-off-by: Gertjan van Wingerde Cc: diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 959d565..68bca14 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c @@ -1929,6 +1929,7 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev) { int retval; + u32 reg; /* * Allocate eeprom data. @@ -1942,6 +1943,14 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev) return retval; /* + * Enable rfkill polling by setting GPIO direction of the + * rfkill switch GPIO pin correctly. + */ + rt2x00pci_register_read(rt2x00dev, GPIOCSR, ®); + rt2x00_set_field32(®, GPIOCSR_DIR0, 1); + rt2x00pci_register_write(rt2x00dev, GPIOCSR, reg); + + /* * Initialize hw specifications. */ retval = rt2500pci_probe_hw_mode(rt2x00dev);