From patchwork Thu Aug 3 14:28:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitkumar Karwar X-Patchwork-Id: 9879251 X-Patchwork-Delegate: kvalo@adurom.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 2959860360 for ; Thu, 3 Aug 2017 14:33:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C1D728929 for ; Thu, 3 Aug 2017 14:33:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10DBE2891F; Thu, 3 Aug 2017 14:33: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, FREEMAIL_FROM, 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 94B7C288D2 for ; Thu, 3 Aug 2017 14:33:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751897AbdHCOdF (ORCPT ); Thu, 3 Aug 2017 10:33:05 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:37268 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751700AbdHCOdD (ORCPT ); Thu, 3 Aug 2017 10:33:03 -0400 Received: by mail-pg0-f68.google.com with SMTP id 83so1661959pgb.4 for ; Thu, 03 Aug 2017 07:33:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=K1H1bXBt379giA5cVou5r7n7Ijs2PqnxVqMNPN/M6Pw=; b=S28uL6ltqrtK4R+yuKig10EdQAV0XJPoHSqz3CW6OizhZAxqM8ypPMbmeV0G4UI9gG AhpmENw1GEw5nqMJPMfqEfK+ZzLwl4EfOEC+b01syUGSUJ1OTBYtSbfSWY7yUQVJ0MsE vPmmpK5jegp7CiW1Nxx/y6m4AD0J56OdkCUb4yxIAzlemVAntVkasJ6e2TeJ0G93tte/ HpHyIn6LwMnx3HLan2kBLlaIKAoXzWXf8rOK30Z30+E4+fYONzNki+rXxqGpV0a8JBtC ilNtepH12bZJfKkA2+dwz88yv/fhxUmsMdxvqu5VcmhcBJuBUz6F5j2wQoYTdfflSqfO wFsQ== 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:in-reply-to :references; bh=K1H1bXBt379giA5cVou5r7n7Ijs2PqnxVqMNPN/M6Pw=; b=ZeCsZfRVR7K4HR9F0zWV41Jq6jpnXxIzYgT660VHUQNLxoYytZnEvvfWnXksmf1pgv F0kHh51zb45gBYe7f614aFObcSfzXr8l0EuGuuXnELVtfQDWCZV2kAEBKbexNsc2fpd2 C5/WdJd87KNUoVHC15Qb68G1Z+IM/zoEAbu7kEzrxDXk/TkE7qxvLE+nfxkZQ6J0WchA 7Byd04bQNciBU+Jg6GPvXkEdKcrO6Ke2W2PqEglJC44OWFlL/GyORYfF3oIg7lr58SSj rsGQgu5/VqT7eq6vzeW3DqjIyxgrK/+jLCGh+MAazzTEibO51cVxwooWOeOuOW2v4Qsx IUBQ== X-Gm-Message-State: AIVw110cg+yLkS2juXiu1r5LiR5+1ou0Tm+Klvxrq9JQrDLjGUiUL5kX dYUIdERZpjRbnP5s X-Received: by 10.99.157.8 with SMTP id i8mr1768103pgd.101.1501770783391; Thu, 03 Aug 2017 07:33:03 -0700 (PDT) Received: from cpu185.redpinesignals.com ([203.196.161.90]) by smtp.gmail.com with ESMTPSA id f87sm64021625pfe.108.2017.08.03.07.33.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Aug 2017 07:33:02 -0700 (PDT) From: Amitkumar Karwar To: Kalle Valo Cc: linux-wireless@vger.kernel.org, Amitkumar Karwar , Prameela Rani Garnepudi , Pavani Muthyala Subject: [v2 1/8] rsi: add support for rf-kill functionality Date: Thu, 3 Aug 2017 19:58:57 +0530 Message-Id: <1501770544-6746-2-git-send-email-amitkarwar@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501770544-6746-1-git-send-email-amitkarwar@gmail.com> References: <1501770544-6746-1-git-send-email-amitkarwar@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Pavani Muthyala This patch implements rfkill_poll handler. Also, necessary changes are done in interface up and down handler to support rfkill functionality. Signed-off-by: Pavani Muthyala Signed-off-by: Amitkumar Karwar --- drivers/net/wireless/rsi/rsi_91x_mac80211.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c index c91d6ef..193f922 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c +++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c @@ -279,11 +279,12 @@ static int rsi_mac80211_start(struct ieee80211_hw *hw) struct rsi_hw *adapter = hw->priv; struct rsi_common *common = adapter->priv; + rsi_dbg(ERR_ZONE, "===> Interface UP <===\n"); mutex_lock(&common->mutex); common->iface_down = false; - mutex_unlock(&common->mutex); - + wiphy_rfkill_start_polling(hw->wiphy); rsi_send_rx_filter_frame(common, 0); + mutex_unlock(&common->mutex); return 0; } @@ -299,8 +300,10 @@ static void rsi_mac80211_stop(struct ieee80211_hw *hw) struct rsi_hw *adapter = hw->priv; struct rsi_common *common = adapter->priv; + rsi_dbg(ERR_ZONE, "===> Interface DOWN <===\n"); mutex_lock(&common->mutex); common->iface_down = true; + wiphy_rfkill_stop_polling(hw->wiphy); /* Block all rx frames */ rsi_send_rx_filter_frame(common, 0xffff); @@ -1214,6 +1217,19 @@ static void rsi_reg_notify(struct wiphy *wiphy, mutex_unlock(&common->mutex); } +static void rsi_mac80211_rfkill_poll(struct ieee80211_hw *hw) +{ + struct rsi_hw *adapter = hw->priv; + struct rsi_common *common = adapter->priv; + + mutex_lock(&common->mutex); + if (common->fsm_state != FSM_MAC_INIT_DONE) + wiphy_rfkill_set_hw_state(hw->wiphy, true); + else + wiphy_rfkill_set_hw_state(hw->wiphy, false); + mutex_unlock(&common->mutex); +} + static struct ieee80211_ops mac80211_ops = { .tx = rsi_mac80211_tx, .start = rsi_mac80211_start, @@ -1232,6 +1248,7 @@ static struct ieee80211_ops mac80211_ops = { .sta_remove = rsi_mac80211_sta_remove, .set_antenna = rsi_mac80211_set_antenna, .get_antenna = rsi_mac80211_get_antenna, + .rfkill_poll = rsi_mac80211_rfkill_poll, }; /**