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: 75578 Delivered-To: patch@linaro.org Received: by 10.140.106.11 with SMTP id d11csp24930qgf; Tue, 6 Sep 2016 15:19:05 -0700 (PDT) X-Received: by 10.66.47.67 with SMTP id b3mr7770221pan.43.1473200345641; Tue, 06 Sep 2016 15:19:05 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y187si37435385pfy.250.2016.09.06.15.19.05; Tue, 06 Sep 2016 15:19:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934947AbcIFWSr (ORCPT + 1 other); 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 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(+) -- 2.5.0 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);