From patchwork Tue Nov 15 06:06:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 82262 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp1371070qge; Mon, 14 Nov 2016 22:07:28 -0800 (PST) X-Received: by 10.98.14.82 with SMTP id w79mr43091549pfi.153.1479190048598; Mon, 14 Nov 2016 22:07:28 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 133si25114259pgh.252.2016.11.14.22.07.28; Mon, 14 Nov 2016 22:07:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S966315AbcKOGHZ (ORCPT + 26 others); Tue, 15 Nov 2016 01:07:25 -0500 Received: from mail-pf0-f182.google.com ([209.85.192.182]:34609 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966146AbcKOGHD (ORCPT ); Tue, 15 Nov 2016 01:07:03 -0500 Received: by mail-pf0-f182.google.com with SMTP id c4so22295894pfb.1 for ; Mon, 14 Nov 2016 22:07:03 -0800 (PST) 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=yXZrIZ+mMNP+9X8RSJi6G0ZZJUEsLHPomf4PnfewAPE=; b=Zg9ejWWfUmzz4oxmhARBRdf/BoFXdCRoo8IGzVDaVsTo5/fjy+sE/1W1QPtjjIubL+ f0EOc1Y4EiCYxGZzaJySsKygBcDmUeg1KFcDmUkrGgQnn6EBQIpgew7j1F3jVACAA9yX A+C6UTwJsK3LOies4BTBDtdPJ+/XHRe2FboqQ= 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=yXZrIZ+mMNP+9X8RSJi6G0ZZJUEsLHPomf4PnfewAPE=; b=h19vrZhCaQhNDo2dFCCQMMDkAlGty/oWdP/V13RgUv5ZCrfw7c2iyJiyjkvibdKxrw 2h/+n+HiGpQJPHEXZqL4Cw4cA7+tyVgAcj/RK2TZgta3HcGwrwZmKL/xuIMBT+xnScV0 WY8wkCivk4WDM5gTA0amPqzmop7pDS8mozeZPTnNNOsYH5mlSh4MZWUglKKdO2zb8ILk yzyrD9omSVb8P3+ZvwaaGfUVhqIv4ry5Q7gPfJfMYm5TzT2yXLSm8wa4bomTQeNQBNfb GQtLV7Oh2fB596Svq7XD8O9BuqSrLWNWHKYrbPQwsCtvzE0CiWZen1BvGvgpf613oS7/ xQJw== X-Gm-Message-State: ABUngvcBVGsU+K9OSpa09v978W+TOp0KpEF2OYAVmT576/+stLK4a3sretwYSeBaulC6YsxO X-Received: by 10.99.53.195 with SMTP id c186mr75378734pga.125.1479190022923; Mon, 14 Nov 2016 22:07:02 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id zf9sm39563129pac.12.2016.11.14.22.07.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Nov 2016 22:07:02 -0800 (PST) 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 v5 4/5] wcn36xx: Implement print_reg indication Date: Mon, 14 Nov 2016 22:06:53 -0800 Message-Id: <1479190014-11297-4-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1479190014-11297-1-git-send-email-bjorn.andersson@linaro.org> References: <1479190014-11297-1-git-send-email-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 v4: - None 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);