forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/sound/soc/intel/skylake/skl-debug.c
....@@ -1,16 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * skl-debug.c - Debugfs for skl driver
34 *
45 * Copyright (C) 2016-17 Intel Corp
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; version 2 of the License.
9
- *
10
- * This program is distributed in the hope that it will be useful, but
11
- * WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- * General Public License for more details.
146 */
157
168 #include <linux/pci.h>
....@@ -28,7 +20,7 @@
2820 #define FW_REG_SIZE 0x60
2921
3022 struct skl_debug {
31
- struct skl *skl;
23
+ struct skl_dev *skl;
3224 struct device *dev;
3325
3426 struct dentry *fs;
....@@ -76,6 +68,8 @@
7668 size_t count, loff_t *ppos)
7769 {
7870 struct skl_module_cfg *mconfig = file->private_data;
71
+ struct skl_module *module = mconfig->module;
72
+ struct skl_module_res *res = &module->resources[mconfig->res_idx];
7973 char *buf;
8074 ssize_t ret;
8175
....@@ -89,8 +83,8 @@
8983 mconfig->id.pvt_id);
9084
9185 ret += scnprintf(buf + ret, MOD_BUF - ret,
92
- "Resources:\n\tMCPS %#x\n\tIBS %#x\n\tOBS %#x\t\n",
93
- mconfig->mcps, mconfig->ibs, mconfig->obs);
86
+ "Resources:\n\tCPC %#x\n\tIBS %#x\n\tOBS %#x\t\n",
87
+ res->cpc, res->ibs, res->obs);
9488
9589 ret += scnprintf(buf + ret, MOD_BUF - ret,
9690 "Module data:\n\tCore %d\n\tIn queue %d\n\t"
....@@ -172,17 +166,15 @@
172166 struct snd_soc_dapm_widget *w,
173167 struct skl_module_cfg *mconfig)
174168 {
175
- if (!debugfs_create_file(w->name, 0444,
176
- d->modules, mconfig,
177
- &mcfg_fops))
178
- dev_err(d->dev, "%s: module debugfs init failed\n", w->name);
169
+ debugfs_create_file(w->name, 0444, d->modules, mconfig,
170
+ &mcfg_fops);
179171 }
180172
181173 static ssize_t fw_softreg_read(struct file *file, char __user *user_buf,
182174 size_t count, loff_t *ppos)
183175 {
184176 struct skl_debug *d = file->private_data;
185
- struct sst_dsp *sst = d->skl->skl_sst->dsp;
177
+ struct sst_dsp *sst = d->skl->dsp;
186178 size_t w0_stat_sz = sst->addr.w0_stat_sz;
187179 void __iomem *in_base = sst->mailbox.in_base;
188180 void __iomem *fw_reg_addr;
....@@ -223,7 +215,7 @@
223215 .llseek = default_llseek,
224216 };
225217
226
-struct skl_debug *skl_debugfs_init(struct skl *skl)
218
+struct skl_debug *skl_debugfs_init(struct skl_dev *skl)
227219 {
228220 struct skl_debug *d;
229221
....@@ -232,32 +224,25 @@
232224 return NULL;
233225
234226 /* create the debugfs dir with platform component's debugfs as parent */
235
- d->fs = debugfs_create_dir("dsp",
236
- skl->component->debugfs_root);
237
- if (IS_ERR(d->fs) || !d->fs) {
238
- dev_err(&skl->pci->dev, "debugfs root creation failed\n");
239
- return NULL;
240
- }
227
+ d->fs = debugfs_create_dir("dsp", skl->component->debugfs_root);
241228
242229 d->skl = skl;
243230 d->dev = &skl->pci->dev;
244231
245232 /* now create the module dir */
246233 d->modules = debugfs_create_dir("modules", d->fs);
247
- if (IS_ERR(d->modules) || !d->modules) {
248
- dev_err(&skl->pci->dev, "modules debugfs create failed\n");
249
- goto err;
250
- }
251234
252
- if (!debugfs_create_file("fw_soft_regs_rd", 0444, d->fs, d,
253
- &soft_regs_ctrl_fops)) {
254
- dev_err(d->dev, "fw soft regs control debugfs init failed\n");
255
- goto err;
256
- }
235
+ debugfs_create_file("fw_soft_regs_rd", 0444, d->fs, d,
236
+ &soft_regs_ctrl_fops);
257237
258238 return d;
239
+}
259240
260
-err:
241
+void skl_debugfs_exit(struct skl_dev *skl)
242
+{
243
+ struct skl_debug *d = skl->debugfs;
244
+
261245 debugfs_remove_recursive(d->fs);
262
- return NULL;
246
+
247
+ d = NULL;
263248 }