From patchwork Thu Aug 30 21:04:26 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: 1389691 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 A59CEDF264 for ; Thu, 30 Aug 2012 21:05:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752693Ab2H3VE4 (ORCPT ); Thu, 30 Aug 2012 17:04:56 -0400 Received: from cpsmtpb-ews05.kpnxchange.com ([213.75.39.8]:4962 "EHLO cpsmtpb-ews05.kpnxchange.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752563Ab2H3VEg (ORCPT ); Thu, 30 Aug 2012 17:04:36 -0400 Received: from cpsps-ews26.kpnxchange.com ([10.94.84.192]) by cpsmtpb-ews05.kpnxchange.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 30 Aug 2012 23:04:34 +0200 Received: from CPSMTPM-CMT101.kpnxchange.com ([195.121.3.17]) by cpsps-ews26.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Thu, 30 Aug 2012 23:04:34 +0200 Received: from wingerd.gvw.nl ([86.87.118.224]) by CPSMTPM-CMT101.kpnxchange.com with Microsoft SMTPSVC(7.0.6002.18264); Thu, 30 Aug 2012 23:04:34 +0200 Received: by wingerd.gvw.nl (Postfix, from userid 1026) id 87B12202D93; Thu, 30 Aug 2012 23:04:33 +0200 (CEST) From: Gertjan van Wingerde To: , "John W. Linville" Cc: , Ivo van Doorn , Helmut Schaa , Gertjan van Wingerde , Subject: [PATCH 14/17] rt2x00: Fix rt73usb rfkill polling prior to interface start. Date: Thu, 30 Aug 2012 23:04:26 +0200 Message-Id: <1346360670-6498-9-git-send-email-gwingerde@gmail.com> X-Mailer: git-send-email 1.7.11.1 In-Reply-To: <1346360670-6498-8-git-send-email-gwingerde@gmail.com> References: <1346355248-5331-10-git-send-email-gwingerde@gmail.com> <1346360670-6498-1-git-send-email-gwingerde@gmail.com> <1346360670-6498-2-git-send-email-gwingerde@gmail.com> <1346360670-6498-3-git-send-email-gwingerde@gmail.com> <1346360670-6498-4-git-send-email-gwingerde@gmail.com> <1346360670-6498-5-git-send-email-gwingerde@gmail.com> <1346360670-6498-6-git-send-email-gwingerde@gmail.com> <1346360670-6498-7-git-send-email-gwingerde@gmail.com> <1346360670-6498-8-git-send-email-gwingerde@gmail.com> X-OriginalArrivalTime: 30 Aug 2012 21:04:34.0244 (UTC) FILETIME=[0E85D840:01CD86F3] 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. Reported-and-tested-by: Andreas Messer Signed-off-by: Gertjan van Wingerde Cc: diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index d5b6fb8..cfa9f37 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c @@ -2177,6 +2177,7 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev) { int retval; + u32 reg; /* * Allocate eeprom data. @@ -2190,6 +2191,14 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev) return retval; /* + * Enable rfkill polling by setting GPIO direction of the + * rfkill switch GPIO pin correctly. + */ + rt2x00usb_register_read(rt2x00dev, MAC_CSR13, ®); + rt2x00_set_field32(®, MAC_CSR13_DIR7, 0); + rt2x00usb_register_write(rt2x00dev, MAC_CSR13, reg); + + /* * Initialize hw specifications. */ retval = rt73usb_probe_hw_mode(rt2x00dev);