Skip to content

Commit 126060a

Browse files
ktrzcinxlgirdwood
authored andcommitted
logger: Send parsed runtime log levels to FW via debugFS
"/sys/kernel/debug/sof/filter" file is responsible for updating trace log levels. IPC message contain list of new trace threshold, it is represented as single line in file where entries are separated with ";". Single entry has form of: "<uuid_id> <pipe_id> <comp_id> <log_level>" Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
1 parent b1fc922 commit 126060a

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

tools/logger/filter.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,13 @@ static int filter_parse_entry(const struct snd_sof_uids_header *uids_dict,
266266
}
267267

268268
/**
269-
* Parse `input_str` content.
269+
* Parse `input_str` content and send it to FW via debugFS.
270270
*
271271
* `input_str` contain single filter definition element per line.
272272
* Each line is parsed by `filter_parse_entry`, and saved in list.
273+
* List of `sof_ipc_dma_trace_filter_elem` is writend to debugFS,
274+
* and then send as IPC to FW (this action is implemented in driver).
275+
* Each line in debugFS represents single IPC message.
273276
*
274277
* @param dictionary uuid dictionary from ldc file
275278
* @param format log level settings in format `log_level=component`
@@ -282,6 +285,7 @@ int filter_update_firmware(const struct snd_sof_uids_header *uids_dict,
282285
struct list_item *list_elem;
283286
struct list_item *list_temp;
284287
char *line_end;
288+
FILE *out_fd;
285289
int ret = 0;
286290

287291
list_init(&filter_list);
@@ -297,7 +301,27 @@ int filter_update_firmware(const struct snd_sof_uids_header *uids_dict,
297301
line_end = strchr(input_str, '\n');
298302
}
299303

304+
/* write output to debugFS */
305+
out_fd = fopen(FILTER_KERNEL_PATH, "w");
306+
if (!out_fd) {
307+
log_err(NULL, "Unable to open out file '%s'\n",
308+
FILTER_KERNEL_PATH);
309+
ret = -errno;
310+
goto err;
311+
}
312+
313+
list_for_item(list_elem, &filter_list) {
314+
filter = container_of(list_elem, struct filter_element,
315+
list);
316+
fprintf(out_fd, "%d %X %d %d;", filter->log_level,
317+
filter->uuid_id, filter->pipe_id, filter->comp_id);
318+
}
319+
fprintf(stdout, "\n");
320+
300321
err:
322+
if (out_fd)
323+
fclose(out_fd);
324+
301325
/* free each component from parsed element list */
302326
list_for_item_safe(list_elem, list_temp, &filter_list) {
303327
filter = container_of(list_elem, struct filter_element,

tools/logger/filter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#ifndef __LOGGER_FILTER_H__
99
#define __LOGGER_FILTER_H__
1010

11+
#define FILTER_KERNEL_PATH "/sys/kernel/debug/sof/filter"
12+
1113
int filter_update_firmware(const struct snd_sof_uids_header *uids_dict,
1214
char *input_str);
1315

0 commit comments

Comments
 (0)