Sound Open Firmware
Loading...
Searching...
No Matches
selector.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright(c) 2019 Intel Corporation. All rights reserved.
4 *
5 * Author: Lech Betlej <lech.betlej@linux.intel.com>
6 */
7
13
14#ifndef __SOF_AUDIO_SELECTOR_H__
15#define __SOF_AUDIO_SELECTOR_H__
16
18#include <sof/trace/trace.h>
19#include <ipc/stream.h>
20#if CONFIG_IPC_MAJOR_4
21#include <ipc4/base-config.h>
22#endif
23#include <user/selector.h>
24#include <user/trace.h>
25#include <stdint.h>
26
27struct comp_buffer;
28struct comp_dev;
29
31#define SEL_COEF_ONE_Q10 1024 /* int16(1 * 2^10) */
32
33#if CONFIG_IPC_MAJOR_3
35#define SEL_SOURCE_1CH 1
36#define SEL_SOURCE_2CH 2
37#define SEL_SOURCE_4CH 4
38
40#define SEL_SINK_1CH 1
41#define SEL_SINK_2CH 2
42#define SEL_SINK_4CH 4
43#else
45#define SEL_SOURCE_CHANNELS_MAX 8
46
48#define SEL_SINK_CHANNELS_MAX 8
49
51#define SEL_MAX_NUM_CONFIGS 8
52
53#define SEL_NUM_IN_PIN_FMTS 1
54#define SEL_NUM_OUT_PIN_FMTS 1
55
56#endif
57
58#if CONFIG_IPC_MAJOR_4
60typedef void (*sel_func)(struct processing_module *mod, struct input_stream_buffer *bsource,
61 struct output_stream_buffer *bsink, uint32_t frames);
62
64enum ipc4_selector_config_id {
65 IPC4_SELECTOR_COEFFS_CONFIG_ID = 0,
66};
67
69struct ipc4_selector_coeffs_config {
70 uint8_t source_channels_count;
71 uint8_t sink_channels_count;
72 uint8_t source_channel_config;
73 uint8_t sink_channel_config;
74
77};
78
79enum ipc4_selector_init_payload_fmt {
80 IPC4_SEL_INIT_PAYLOAD_BASE_WITH_EXT,
81 IPC4_SEL_INIT_PAYLOAD_BASE_WITH_OUT_FMT,
82};
83
84struct sof_selector_ipc4_pin_config {
85 struct ipc4_input_pin_format in_pin;
86 struct ipc4_output_pin_format out_pin;
87};
88
89/*
90 * Base module config is not added in this structure because it is handled
91 * by module adapter.
92 */
93struct sof_selector_ipc4_config {
94 /*
95 * Windows will send the base_config + output_format payload, but Linux will
96 * send the base_config + base_config_ext payload, use a union to make the
97 * selector module be compatible for both OSes.
98 */
99 union {
100 struct sof_selector_ipc4_pin_config pin_cfg;
101 struct ipc4_audio_format output_format;
102 };
103 enum ipc4_selector_init_payload_fmt init_payload_fmt;
104};
105
106struct sof_selector_avs_ipc4_config {
107 struct ipc4_base_module_cfg base_cfg;
108 struct ipc4_audio_format output_format;
109};
110
111#else
112typedef void (*sel_func)(struct comp_dev *dev, struct audio_stream *sink,
113 const struct audio_stream *source, uint32_t frames);
114#endif
115
117struct comp_data {
118#if CONFIG_IPC_MAJOR_4
119 struct sof_selector_ipc4_config sel_ipc4_cfg;
120 struct ipc4_selector_coeffs_config coeffs_config;
121 struct ipc4_selector_coeffs_config *multi_coeffs_config;
122 size_t multi_coeffs_config_size;
123#endif
124
127 enum sof_ipc_frame source_format;
128 enum sof_ipc_frame sink_format;
134};
135
142
144extern const struct comp_func_map func_map[];
145
146#if CONFIG_IPC_MAJOR_4
151sel_func sel_get_processing_function(struct processing_module *mod);
152
153#ifdef UNIT_TEST
154void sys_comp_module_selector_interface_init(void);
155#endif
156#else
162
163#ifdef UNIT_TEST
164void sys_comp_selector_init(void);
165#endif
166#endif
167
168#endif /* __SOF_AUDIO_SELECTOR_H__ */
IPC definitions for streams.
sel_func sel_get_processing_function(struct comp_dev *dev)
Retrieves selector processing function.
#define SEL_SOURCE_CHANNELS_MAX
Maximum supported channel count on input.
Definition selector.h:45
#define SEL_SINK_CHANNELS_MAX
Maximum supported channel count on output.
Definition selector.h:48
const struct comp_func_map func_map[]
Map of formats with dedicated processing functions.
void(* sel_func)(struct comp_dev *dev, struct audio_stream *sink, const struct audio_stream *source, uint32_t frames)
Definition selector.h:112
Audio stream is a circular buffer aware of audio format of the data in the buffer so provides API for...
Definition audio_stream.h:52
Definition buffer.h:130
Selector component private data.
Definition igo_nr_comp.h:21
struct sof_igo_nr_config config
blob data buffer
Definition igo_nr_comp.h:41
uint32_t source_period_bytes
source number of period bytes
Definition selector.h:125
uint32_t source_format
source frame format
Definition igo_nr_comp.h:36
bool new_config
True if new configuration has been received.
Definition selector.h:133
int num_configs
Number of coefficients sets in configuration blob.
Definition selector.h:131
bool passthrough
Use a passthrough copy function when no up/down mix.
Definition selector.h:132
uint32_t sink_format
sink frame format
Definition igo_nr_comp.h:35
sel_func sel_func
channel selector processing function
Definition selector.h:130
uint32_t sink_period_bytes
sink number of period bytes
Definition selector.h:126
Audio component base device "class".
Definition component.h:645
Selector processing functions map.
Definition selector.h:137
sel_func sel_func
selector processing function
Definition selector.h:140
uint16_t source
source frame format
Definition selector.h:138
uint32_t out_channels
number of output stream channels
Definition selector.h:139
Selector component configuration data.
Definition selector.h:14