.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * skl-debug.c - Debugfs for skl driver |
---|
3 | 4 | * |
---|
4 | 5 | * 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. |
---|
14 | 6 | */ |
---|
15 | 7 | |
---|
16 | 8 | #include <linux/pci.h> |
---|
.. | .. |
---|
28 | 20 | #define FW_REG_SIZE 0x60 |
---|
29 | 21 | |
---|
30 | 22 | struct skl_debug { |
---|
31 | | - struct skl *skl; |
---|
| 23 | + struct skl_dev *skl; |
---|
32 | 24 | struct device *dev; |
---|
33 | 25 | |
---|
34 | 26 | struct dentry *fs; |
---|
.. | .. |
---|
76 | 68 | size_t count, loff_t *ppos) |
---|
77 | 69 | { |
---|
78 | 70 | 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]; |
---|
79 | 73 | char *buf; |
---|
80 | 74 | ssize_t ret; |
---|
81 | 75 | |
---|
.. | .. |
---|
89 | 83 | mconfig->id.pvt_id); |
---|
90 | 84 | |
---|
91 | 85 | 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); |
---|
94 | 88 | |
---|
95 | 89 | ret += scnprintf(buf + ret, MOD_BUF - ret, |
---|
96 | 90 | "Module data:\n\tCore %d\n\tIn queue %d\n\t" |
---|
.. | .. |
---|
172 | 166 | struct snd_soc_dapm_widget *w, |
---|
173 | 167 | struct skl_module_cfg *mconfig) |
---|
174 | 168 | { |
---|
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); |
---|
179 | 171 | } |
---|
180 | 172 | |
---|
181 | 173 | static ssize_t fw_softreg_read(struct file *file, char __user *user_buf, |
---|
182 | 174 | size_t count, loff_t *ppos) |
---|
183 | 175 | { |
---|
184 | 176 | 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; |
---|
186 | 178 | size_t w0_stat_sz = sst->addr.w0_stat_sz; |
---|
187 | 179 | void __iomem *in_base = sst->mailbox.in_base; |
---|
188 | 180 | void __iomem *fw_reg_addr; |
---|
.. | .. |
---|
223 | 215 | .llseek = default_llseek, |
---|
224 | 216 | }; |
---|
225 | 217 | |
---|
226 | | -struct skl_debug *skl_debugfs_init(struct skl *skl) |
---|
| 218 | +struct skl_debug *skl_debugfs_init(struct skl_dev *skl) |
---|
227 | 219 | { |
---|
228 | 220 | struct skl_debug *d; |
---|
229 | 221 | |
---|
.. | .. |
---|
232 | 224 | return NULL; |
---|
233 | 225 | |
---|
234 | 226 | /* 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); |
---|
241 | 228 | |
---|
242 | 229 | d->skl = skl; |
---|
243 | 230 | d->dev = &skl->pci->dev; |
---|
244 | 231 | |
---|
245 | 232 | /* now create the module dir */ |
---|
246 | 233 | 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 | | - } |
---|
251 | 234 | |
---|
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); |
---|
257 | 237 | |
---|
258 | 238 | return d; |
---|
| 239 | +} |
---|
259 | 240 | |
---|
260 | | -err: |
---|
| 241 | +void skl_debugfs_exit(struct skl_dev *skl) |
---|
| 242 | +{ |
---|
| 243 | + struct skl_debug *d = skl->debugfs; |
---|
| 244 | + |
---|
261 | 245 | debugfs_remove_recursive(d->fs); |
---|
262 | | - return NULL; |
---|
| 246 | + |
---|
| 247 | + d = NULL; |
---|
263 | 248 | } |
---|