Skip to content

Commit 7bdf19a

Browse files
Jyri Sarhakv2019i
authored andcommitted
probe: ipc4: get_config()-support for getting all possible probe points
Add new param_id recognized by get_config() for getting all available probe points. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 5e03015 commit 7bdf19a

2 files changed

Lines changed: 69 additions & 0 deletions

File tree

src/include/ipc4/probe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#define IPC4_PROBE_MODULE_INJECTION_DMA_DETACH 2
4747
#define IPC4_PROBE_MODULE_PROBE_POINTS_ADD 3
4848
#define IPC4_PROBE_MODULE_DISCONNECT_PROBE_POINTS 4
49+
#define IPC4_PROBE_MODULE_AVAILABLE_PROBE_POINTS 5
4950

5051
/**
5152
* Description of probe dma

src/probe/probe.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,69 @@ static int probe_set_config(struct processing_module *mod, uint32_t param_id,
14911491
}
14921492
}
14931493

1494+
static int probe_add_point_info_params(struct sof_ipc_probe_info_params *info,
1495+
probe_point_id_t id, int index, size_t max_size)
1496+
{
1497+
struct probe_pdata *_probe = probe_get();
1498+
struct probe_point pp = {
1499+
.buffer_id = id,
1500+
.purpose = PROBE_PURPOSE_EXTRACTION,
1501+
};
1502+
int i;
1503+
1504+
if (offsetof(struct sof_ipc_probe_info_params, probe_point[index]) +
1505+
sizeof(pp) > max_size) {
1506+
info->num_elems = index;
1507+
return -ENOENT;
1508+
}
1509+
1510+
for (i = 0; i < ARRAY_SIZE(_probe->probe_points); i++)
1511+
if (_probe->probe_points[i].stream_tag != PROBE_POINT_INVALID &&
1512+
_probe->probe_points[i].buffer_id.full_id == id.full_id)
1513+
pp.stream_tag = _probe->probe_points[i].stream_tag;
1514+
1515+
info->probe_point[index] = pp;
1516+
return 0;
1517+
}
1518+
1519+
static int probe_get_available_points(struct processing_module *mod,
1520+
struct sof_ipc_probe_info_params *info,
1521+
size_t max_size)
1522+
{
1523+
struct ipc_comp_dev *icd;
1524+
struct list_item *clist;
1525+
int i = 0;
1526+
1527+
list_for_item(clist, &ipc_get()->comp_list) {
1528+
struct comp_buffer *buf;
1529+
probe_point_id_t id;
1530+
1531+
icd = container_of(clist, struct ipc_comp_dev, list);
1532+
if (icd->type != COMP_TYPE_COMPONENT)
1533+
continue;
1534+
1535+
id.fields.module_id = IPC4_MOD_ID(icd->id);
1536+
id.fields.instance_id = IPC4_INST_ID(icd->id);
1537+
1538+
id.fields.type = PROBE_TYPE_INPUT;
1539+
comp_dev_for_each_producer(icd->cd, buf) {
1540+
id.fields.index = IPC4_SRC_QUEUE_ID(buf_get_id(buf));
1541+
if (probe_add_point_info_params(info, id, i, max_size))
1542+
return 0;
1543+
i++;
1544+
}
1545+
id.fields.type = PROBE_TYPE_OUTPUT;
1546+
comp_dev_for_each_consumer(icd->cd, buf) {
1547+
id.fields.index = IPC4_SINK_QUEUE_ID(buf_get_id(buf));
1548+
if (probe_add_point_info_params(info, id, i, max_size))
1549+
return 0;
1550+
i++;
1551+
}
1552+
}
1553+
info->num_elems = i;
1554+
return 0;
1555+
}
1556+
14941557
static int probe_get_config(struct processing_module *mod,
14951558
uint32_t config_id, uint32_t *data_offset_size,
14961559
uint8_t *fragment, size_t fragment_size)
@@ -1515,6 +1578,11 @@ static int probe_get_config(struct processing_module *mod,
15151578
info->num_elems = j;
15161579
comp_info(dev, "%u probe points sent", j);
15171580
break;
1581+
case IPC4_PROBE_MODULE_AVAILABLE_PROBE_POINTS:
1582+
probe_get_available_points(mod, info, fragment_size);
1583+
comp_info(dev, "%u available probe points sent",
1584+
info->num_elems);
1585+
break;
15181586
default:
15191587
comp_err(dev, "unknown config_id %u", config_id);
15201588
return -EINVAL;

0 commit comments

Comments
 (0)