From patchwork Fri Mar 24 16:10:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 666933 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7EA96C6FD1C for ; Fri, 24 Mar 2023 16:11:46 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BB60DE90; Fri, 24 Mar 2023 17:10:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BB60DE90 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1679674303; bh=q8znd0OeTjHt3poI+d+TlLZ2i4zzUl8MphJjCr5qDto=; h=To:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From:Reply-To:Cc:From; b=goZDTz3kXnrGcJGZI3s7N7SGPcS04SVCcS6hDJ4keLIqmnzhgtdukzTUTH5lt7QGJ /hHi+z7nZWVQdFJ9mbFRC+CFrXJI7oX87OIdCH0hB1bm0psdd7ntQH5lzucRuhcLX+ OMJpvuGQjKHk7YMhFMDdlIAvCoPpOphSo5pe7LpA= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 2EBF2F800C9; Fri, 24 Mar 2023 17:10:31 +0100 (CET) To: Subject: [PATCH] firmware: cs_dsp: Add a debugfs entry containing control details Date: Fri, 24 Mar 2023 16:10:10 +0000 X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <167967423036.26.11080959777905296733@mailman-core.alsa-project.org> X-Patchwork-Original-From: Richard Fitzgerald via Alsa-devel From: Richard Fitzgerald Reply-To: Richard Fitzgerald Cc: patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Simon Trimmer , Richard Fitzgerald Content-Disposition: inline From: Simon Trimmer The file named 'controls' in the DSP's debugfs root contains a formatted table describing the controls defined within the loaded DSP firmware, it is of the form name: len region:offset addr fwname algid ctltype flags en dirty Where flags is represented as a character for each flag if set, or '-', enabled is whether the control is enabled or disabled and dirty is whether the control value is set in the cache but not the hardware. Signed-off-by: Simon Trimmer Signed-off-by: Richard Fitzgerald --- drivers/firmware/cirrus/cs_dsp.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c index 513136a924cf..faa6402c344d 100644 --- a/drivers/firmware/cirrus/cs_dsp.c +++ b/drivers/firmware/cirrus/cs_dsp.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -457,6 +458,33 @@ static const struct { }, }; +static int cs_dsp_coeff_base_reg(struct cs_dsp_coeff_ctl *ctl, unsigned int *reg, + unsigned int off); + +static int cs_dsp_debugfs_read_controls_show(struct seq_file *s, void *ignored) +{ + struct cs_dsp *dsp = s->private; + struct cs_dsp_coeff_ctl *ctl; + unsigned int reg; + + list_for_each_entry(ctl, &dsp->ctl_list, list) { + cs_dsp_coeff_base_reg(ctl, ®, 0); + seq_printf(s, "%22.*s: %#8lx %s:%08x %#8x %s %#8x %#4x %c%c%c%c %s %s\n", + ctl->subname_len, ctl->subname, ctl->len, + cs_dsp_mem_region_name(ctl->alg_region.type), + ctl->offset, reg, ctl->fw_name, ctl->alg_region.alg, ctl->type, + ctl->flags & WMFW_CTL_FLAG_VOLATILE ? 'V' : '-', + ctl->flags & WMFW_CTL_FLAG_SYS ? 'S' : '-', + ctl->flags & WMFW_CTL_FLAG_READABLE ? 'R' : '-', + ctl->flags & WMFW_CTL_FLAG_WRITEABLE ? 'W' : '-', + ctl->enabled ? "enabled" : "disabled", + ctl->set ? "dirty" : "clean"); + } + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(cs_dsp_debugfs_read_controls); + /** * cs_dsp_init_debugfs() - Create and populate DSP representation in debugfs * @dsp: pointer to DSP structure @@ -479,6 +507,9 @@ void cs_dsp_init_debugfs(struct cs_dsp *dsp, struct dentry *debugfs_root) debugfs_create_file(cs_dsp_debugfs_fops[i].name, 0444, root, dsp, &cs_dsp_debugfs_fops[i].fops); + debugfs_create_file("controls", 0444, root, dsp, + &cs_dsp_debugfs_read_controls_fops); + dsp->debugfs_root = root; } EXPORT_SYMBOL_NS_GPL(cs_dsp_init_debugfs, FW_CS_DSP);