From patchwork Thu Dec 14 16:53:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 10112699 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 97AE460327 for ; Thu, 14 Dec 2017 16:53:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CA3A29C98 for ; Thu, 14 Dec 2017 16:53:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8148A29C8D; Thu, 14 Dec 2017 16:53:27 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 0357E29C95 for ; Thu, 14 Dec 2017 16:53:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753532AbdLNQxZ (ORCPT ); Thu, 14 Dec 2017 11:53:25 -0500 Received: from alexa-out.qualcomm.com ([129.46.98.28]:17927 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753258AbdLNQxY (ORCPT ); Thu, 14 Dec 2017 11:53:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1513270404; x=1544806404; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Jk7CAAOSQ45xgj2f9SZ59zo0Sq2JMPBH2fnMDobrNBc=; b=TMoHh1KexEwxsojX73jti3u+lsG2DAHKN9UaUosiFj06ZKchKJeV5Qxh BrGuvNsANoWQROs0lR6Yr8s7BIGVWyQsuyQupVLTYqv1Hu3AffTj2LlwS 28kPTMmS8XmhMkNv1LpekFoEPTuUaRWiltAPcZCGcjgNTxAd6mgHbI0GG M=; Received: from ironmsg03-sd.qualcomm.com ([10.53.140.143]) by alexa-out.qualcomm.com with ESMTP/TLS/AES256-SHA; 14 Dec 2017 08:53:24 -0800 X-IronPort-AV: E=McAfee;i="5900,7806,8744"; a="3345915" X-MGA-submission: =?us-ascii?q?MDFLCZe/MyKvUYf+I0UZEa+5r7BkawcQEBr+NG?= =?us-ascii?q?A4ieeCLuIvl7BbCgLyhoxeXbT62xR99WWgk0TXv4gMuOSB6vvSIdDHyX?= =?us-ascii?q?cUVAvNdGGCVkd+p7ue5uKqckRTAebN1ZXvMK56ASXJagTkIIzmBOXOJ8?= =?us-ascii?q?bX?= Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by ironmsg03-sd.qualcomm.com with ESMTP; 14 Dec 2017 08:53:22 -0800 From: Maya Erez To: Kalle Valo Cc: Maya Erez , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com Subject: [PATCH v2 4/9] wil6210: set platform features based on FW capabilities Date: Thu, 14 Dec 2017 18:53:08 +0200 Message-Id: <1513270393-919-5-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1513270393-919-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1513270393-919-1-git-send-email-qca_merez@qca.qualcomm.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 In some cases the platform should be aware of the FW capabilities to decide which feature to enable. For example, FW can control the external REF clock for power saving. Driver should notify the platform about that, to allow platform power management optimization. Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/main.c | 11 +++++++++++ drivers/net/wireless/ath/wil6210/wil_platform.h | 6 ++++++ drivers/net/wireless/ath/wil6210/wmi.h | 1 + 3 files changed, 18 insertions(+) diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index bafd8d5..7a8f8c2 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c @@ -771,6 +771,7 @@ static void wil_collect_fw_info(struct wil6210_priv *wil) void wil_refresh_fw_capabilities(struct wil6210_priv *wil) { struct wiphy *wiphy = wil_to_wiphy(wil); + int features; wil->keep_radio_on_during_sleep = test_bit(WIL_PLATFORM_CAPA_RADIO_ON_IN_SUSPEND, @@ -792,6 +793,16 @@ void wil_refresh_fw_capabilities(struct wil6210_priv *wil) wiphy->max_sched_scan_ie_len = WMI_MAX_IE_LEN; wiphy->max_sched_scan_plans = WMI_MAX_PLANS_NUM; } + + if (wil->platform_ops.set_features) { + features = (test_bit(WMI_FW_CAPABILITY_REF_CLOCK_CONTROL, + wil->fw_capabilities) && + test_bit(WIL_PLATFORM_CAPA_EXT_CLK, + wil->platform_capa)) ? + BIT(WIL_PLATFORM_FEATURE_FW_EXT_CLK_CONTROL) : 0; + + wil->platform_ops.set_features(wil->platform_handle, features); + } } void wil_mbox_ring_le2cpus(struct wil6210_mbox_ring *r) diff --git a/drivers/net/wireless/ath/wil6210/wil_platform.h b/drivers/net/wireless/ath/wil6210/wil_platform.h index 5cfb946..177026e 100644 --- a/drivers/net/wireless/ath/wil6210/wil_platform.h +++ b/drivers/net/wireless/ath/wil6210/wil_platform.h @@ -27,6 +27,11 @@ enum wil_platform_event { WIL_PLATFORM_EVT_POST_SUSPEND = 4, }; +enum wil_platform_features { + WIL_PLATFORM_FEATURE_FW_EXT_CLK_CONTROL = 0, + WIL_PLATFORM_FEATURE_MAX, +}; + enum wil_platform_capa { WIL_PLATFORM_CAPA_RADIO_ON_IN_SUSPEND = 0, WIL_PLATFORM_CAPA_T_PWR_ON_0 = 1, @@ -45,6 +50,7 @@ struct wil_platform_ops { void (*uninit)(void *handle); int (*notify)(void *handle, enum wil_platform_event evt); int (*get_capa)(void *handle); + void (*set_features)(void *handle, int features); }; /** diff --git a/drivers/net/wireless/ath/wil6210/wmi.h b/drivers/net/wireless/ath/wil6210/wmi.h index c7b84d1..d3e75f0 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.h +++ b/drivers/net/wireless/ath/wil6210/wmi.h @@ -72,6 +72,7 @@ enum wmi_fw_capability { WMI_FW_CAPABILITY_SET_SILENT_RSSI_TABLE = 13, WMI_FW_CAPABILITY_LO_POWER_CALIB_FROM_OTP = 14, WMI_FW_CAPABILITY_PNO = 15, + WMI_FW_CAPABILITY_REF_CLOCK_CONTROL = 18, WMI_FW_CAPABILITY_MAX, };