From patchwork Fri Jun 30 12:29:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 106692 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp5861567obb; Fri, 30 Jun 2017 05:34:07 -0700 (PDT) X-Received: by 10.223.163.12 with SMTP id c12mr25077495wrb.85.1498825807600; Fri, 30 Jun 2017 05:30:07 -0700 (PDT) X-Received: by 10.223.163.12 with SMTP id c12mr25077396wrb.85.1498825805648; Fri, 30 Jun 2017 05:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498825805; cv=none; d=google.com; s=arc-20160816; b=k9WCAoSAdbB83kVOTgS3aNtQRBdZh8GolYK1ZpEMNi2ldsFtZ2w+ZsFrVEByYS4yt3 FSrpQoyX5yuNfQ9+HZgts+gBwymGtdCcZ0lnaSxEyuc26nXA3YXIwg+u+sGopPenlzJo QoDPldn8MXMawY81lMGhQaSAZHM3HaxJmCsYv43mvN5/yArvDJTOBcaHWZ4qw8DsWjmh G1BmWaluRGRVLPmHpU4VShvCINpFBgS8AuBsltnDh5EzGhLv6lqdHUsB/6/dSK9e2fU9 +ws9cL03m2MWlk2Sa3AeBLFV2KHdWkP7H7WqA1BmvmMgTVGjp8vuVXnlL+N7M+yXEcoQ unCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :delivered-to:arc-authentication-results; bh=BWB65PISrZOx2mqwGFM+PStc3ushF/7P6/b5r4BlPoY=; b=nGEA/MR+nDFXVZeN4nfvK9Cep0rlY6Ef4JYfJswB/8t8wlr+tmgo05kl+ayATumfE2 ONofFktoAE26B8Ii4okYOzL+pQTHx2R+2BFOQ8tPfptmfTjkWnbgzv+UnAufzpw7MLdB sJRckm4nENXWHdeCoga4KwjRZKPimK8VP2guyGzSg+ShyF8cI9f22U7oD/tg4DFEZR6b aziuAFNHBGqVXmOsNlBVk8MKB3VKjT0RDisC+DnWT39DqcJPTfbUARcqsavVqljRPTA/ c9zZ3qqj+GnQ/vemeB8LeFaIwGuTx4dgsE65PfcniLFDyyoswt4iWQyB8SgjBdDFmSSM TmzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id k34si5990674wre.244.2017.06.30.05.30.05; Fri, 30 Jun 2017 05:30:05 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 9C7DE2674D4; Fri, 30 Jun 2017 14:30:02 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id DDF622674DC; Fri, 30 Jun 2017 14:30:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=disabled version=3.4.0 Received: from mezzanine.sirena.org.uk (mezzanine.sirena.org.uk [106.187.55.193]) by alsa0.perex.cz (Postfix) with ESMTP id BB4D42674CF; Fri, 30 Jun 2017 14:29:54 +0200 (CEST) Received: from [176.12.107.140] (helo=finisterre) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dQv3O-00026r-6w; Fri, 30 Jun 2017 12:29:45 +0000 Received: from broonie by finisterre with local (Exim 4.89) (envelope-from ) id 1dQv37-00010g-4F; Fri, 30 Jun 2017 13:29:25 +0100 From: Mark Brown To: Vunny Sodhi In-Reply-To: <20170629123608.5498-6-guneshwor.o.singh@intel.com> Message-Id: Date: Fri, 30 Jun 2017 13:29:25 +0100 X-SA-Exim-Connect-IP: 176.12.107.140 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Cc: Sodhi@alsa-project.org, alsa-devel@alsa-project.org, B@alsa-project.org, Babu@alsa-project.org, Patches Audio , Pardha Saradhi , Jayachandran , Guneshwor Singh , Ramesh , Mousumi Jana , liam.r.girdwood@linux.intel.com, Takashi Iwai , Mark Brown , Kesapragada@alsa-project.org, "Sodhi, , VunnyX" , Vinod Koul Subject: [alsa-devel] Applied "ASoC: Intel: Skylake: Add support to read firmware registers" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: Intel: Skylake: Add support to read firmware registers has been applied to the asoc tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From bdd0384a5ada8bb5745e5f29c10a5ba88827efad Mon Sep 17 00:00:00 2001 From: Vunny Sodhi Date: Fri, 30 Jun 2017 09:06:08 +0530 Subject: [PATCH] ASoC: Intel: Skylake: Add support to read firmware registers This patch adds debugfs support to read fw registers, mailbox offsets and sram address. Signed-off-by: Mousumi Jana Signed-off-by: Ramesh Babu Signed-off-by: Jayachandran B Signed-off-by: Pardha Saradhi K Signed-off-by: Vunny Sodhi Signed-off-by: Guneshwor Singh Acked-By: Vinod Koul Signed-off-by: Mark Brown --- sound/soc/intel/skylake/skl-debug.c | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) -- 2.13.2 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/intel/skylake/skl-debug.c b/sound/soc/intel/skylake/skl-debug.c index be3238c63200..75497b1fda45 100644 --- a/sound/soc/intel/skylake/skl-debug.c +++ b/sound/soc/intel/skylake/skl-debug.c @@ -16,10 +16,15 @@ #include #include #include "skl.h" +#include "skl-sst-dsp.h" +#include "skl-sst-ipc.h" #include "skl-tplg-interface.h" #include "skl-topology.h" +#include "../common/sst-dsp-priv.h" #define MOD_BUF PAGE_SIZE +#define FW_REG_BUF PAGE_SIZE +#define FW_REG_SIZE 0x60 struct skl_debug { struct skl *skl; @@ -27,6 +32,7 @@ struct skl_debug { struct dentry *fs; struct dentry *modules; + u8 fw_read_buff[FW_REG_BUF]; }; static ssize_t skl_print_pins(struct skl_module_pin *m_pin, char *buf, @@ -169,6 +175,51 @@ void skl_debug_init_module(struct skl_debug *d, dev_err(d->dev, "%s: module debugfs init failed\n", w->name); } +static ssize_t fw_softreg_read(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct skl_debug *d = file->private_data; + struct sst_dsp *sst = d->skl->skl_sst->dsp; + size_t w0_stat_sz = sst->addr.w0_stat_sz; + void __iomem *in_base = sst->mailbox.in_base; + void __iomem *fw_reg_addr; + unsigned int offset; + char *tmp; + ssize_t ret = 0; + + tmp = kzalloc(FW_REG_BUF, GFP_KERNEL); + if (!tmp) + return -ENOMEM; + + fw_reg_addr = in_base - w0_stat_sz; + memset(d->fw_read_buff, 0, FW_REG_BUF); + + if (w0_stat_sz > 0) + __iowrite32_copy(d->fw_read_buff, fw_reg_addr, w0_stat_sz >> 2); + + for (offset = 0; offset < FW_REG_SIZE; offset += 16) { + ret += snprintf(tmp + ret, FW_REG_BUF - ret, "%#.4x: ", offset); + hex_dump_to_buffer(d->fw_read_buff + offset, 16, 16, 4, + tmp + ret, FW_REG_BUF - ret, 0); + ret += strlen(tmp + ret); + + /* print newline for each offset */ + if (FW_REG_BUF - ret > 0) + tmp[ret++] = '\n'; + } + + ret = simple_read_from_buffer(user_buf, count, ppos, tmp, ret); + kfree(tmp); + + return ret; +} + +static const struct file_operations soft_regs_ctrl_fops = { + .open = simple_open, + .read = fw_softreg_read, + .llseek = default_llseek, +}; + struct skl_debug *skl_debugfs_init(struct skl *skl) { struct skl_debug *d; @@ -195,6 +246,12 @@ struct skl_debug *skl_debugfs_init(struct skl *skl) goto err; } + if (!debugfs_create_file("fw_soft_regs_rd", 0444, d->fs, d, + &soft_regs_ctrl_fops)) { + dev_err(d->dev, "fw soft regs control debugfs init failed\n"); + goto err; + } + return d; err: