From patchwork Tue Sep 6 22:18:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 9317973 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 532DD60752 for ; Tue, 6 Sep 2016 22:18:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 262E328F03 for ; Tue, 6 Sep 2016 22:18:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1911B28F08; Tue, 6 Sep 2016 22:18:56 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI 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 8E36C28F03 for ; Tue, 6 Sep 2016 22:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934947AbcIFWSr (ORCPT ); Tue, 6 Sep 2016 18:18:47 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:35458 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934061AbcIFWSk (ORCPT ); Tue, 6 Sep 2016 18:18:40 -0400 Received: by mail-pa0-f44.google.com with SMTP id b2so6346788pat.2 for ; Tue, 06 Sep 2016 15:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H3qyLHNIJXsbADDJJ/9/o9SLHEmYb0hlfkwHUOIX6a8=; b=EsJqtZkxaUCw/VPLiHw8A0cKOSu3K9EovCOt4hi6fqVEVa8HPrWns7zIPMdfu+eT8p 5o56J41zWuaBq9IDtrWv/NYAa0fjVD7GdoYE4pmCNGrc5uNZfRLNz1f8zyqLxei0RI6A uJRNw/qCc7FXisXWSkwdXhTm3wKIOrAJYv9pI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H3qyLHNIJXsbADDJJ/9/o9SLHEmYb0hlfkwHUOIX6a8=; b=SOoCMx51wl+J6ZW5NqjIiZdV27w6cJFpGPt/peUGOci41AvzTVOjKMZV5F2yCIGKS3 DjrYbPpXV95rLoAJeXSIB6VcJCOucs2l/O5MrssRzfxX50iVGa0eE1iKKfofVzaAdDvt o3oQB8DXbKqaVZI4vqMgpoRthd1ju7EtuRz0ezUAFqKKDXKh+z3gelVM5StigMYMK/ap Hh3+Kz7faPIuhgv1M115VwE+BdrP65/aM7boHkSTSR6bCYzNNk+K2SONdbktfnni4mjg oLGoAZhyTAe1MGXiHAPqqoMwdMPcLP6R63QwaoSIxpJeJxySoUlrOa2PlGbt0dBZlhQG qTMQ== X-Gm-Message-State: AE9vXwOojkPI0mS2zKFQ3xn7vA1/p1Op5pnls67D0/M6DA5IBGJ+SeB4MzOvoK6Bbyd+lSLY X-Received: by 10.66.85.196 with SMTP id j4mr8728186paz.40.1473200319340; Tue, 06 Sep 2016 15:18:39 -0700 (PDT) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id r19sm33305981pfb.31.2016.09.06.15.18.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Sep 2016 15:18:38 -0700 (PDT) From: Bjorn Andersson To: Eugene Krasnikov , Kalle Valo Cc: wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Andy Gross , Nicolas Dechesne Subject: [PATCH v4 4/4] wcn36xx: Implement print_reg indication Date: Tue, 6 Sep 2016 15:18:32 -0700 Message-Id: <1473200312-22438-4-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1473200312-22438-1-git-send-email-bjorn.andersson@linaro.org> References: <1473200312-22438-1-git-send-email-bjorn.andersson@linaro.org> 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 Some firmware versions sends a "print register indication", handle this by printing out the content. Cc: Nicolas Dechesne Signed-off-by: Bjorn Andersson --- Changes since v3: - Rebased separate patch onto this series drivers/net/wireless/ath/wcn36xx/hal.h | 16 ++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index 4f87ef1e1eb8..b765c647319d 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -350,6 +350,8 @@ enum wcn36xx_hal_host_msg_type { WCN36XX_HAL_AVOID_FREQ_RANGE_IND = 233, + WCN36XX_HAL_PRINT_REG_INFO_IND = 259, + WCN36XX_HAL_MSG_MAX = WCN36XX_HAL_MSG_TYPE_MAX_ENUM_SIZE }; @@ -4703,4 +4705,18 @@ struct stats_class_b_ind { u32 rx_time_total; }; +/* WCN36XX_HAL_PRINT_REG_INFO_IND */ +struct wcn36xx_hal_print_reg_info_ind { + struct wcn36xx_hal_msg_header header; + + u32 count; + u32 scenario; + u32 reason; + + struct { + u32 addr; + u32 value; + } regs[]; +} __packed; + #endif /* _HAL_H_ */ diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index be5e5ea1e5c3..1c2966f7db7a 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2109,6 +2109,30 @@ static int wcn36xx_smd_delete_sta_context_ind(struct wcn36xx *wcn, return -ENOENT; } +static int wcn36xx_smd_print_reg_info_ind(struct wcn36xx *wcn, + void *buf, + size_t len) +{ + struct wcn36xx_hal_print_reg_info_ind *rsp = buf; + int i; + + if (len < sizeof(*rsp)) { + wcn36xx_warn("Corrupted print reg info indication\n"); + return -EIO; + } + + wcn36xx_dbg(WCN36XX_DBG_HAL, + "reginfo indication, scenario: 0x%x reason: 0x%x\n", + rsp->scenario, rsp->reason); + + for (i = 0; i < rsp->count; i++) { + wcn36xx_dbg(WCN36XX_DBG_HAL, "\t0x%x: 0x%x\n", + rsp->regs[i].addr, rsp->regs[i].value); + } + + return 0; +} + int wcn36xx_smd_update_cfg(struct wcn36xx *wcn, u32 cfg_id, u32 value) { struct wcn36xx_hal_update_cfg_req_msg msg_body, *body; @@ -2237,6 +2261,7 @@ int wcn36xx_smd_rsp_process(struct qcom_smd_channel *channel, case WCN36XX_HAL_OTA_TX_COMPL_IND: case WCN36XX_HAL_MISSED_BEACON_IND: case WCN36XX_HAL_DELETE_STA_CONTEXT_IND: + case WCN36XX_HAL_PRINT_REG_INFO_IND: msg_ind = kmalloc(sizeof(*msg_ind) + len, GFP_ATOMIC); if (!msg_ind) { wcn36xx_err("Run out of memory while handling SMD_EVENT (%d)\n", @@ -2296,6 +2321,11 @@ static void wcn36xx_ind_smd_work(struct work_struct *work) hal_ind_msg->msg, hal_ind_msg->msg_len); break; + case WCN36XX_HAL_PRINT_REG_INFO_IND: + wcn36xx_smd_print_reg_info_ind(wcn, + hal_ind_msg->msg, + hal_ind_msg->msg_len); + break; default: wcn36xx_err("SMD_EVENT (%d) not supported\n", msg_header->msg_type);