Skip to content

Commit ed914a2

Browse files
crojewsk-intelbroonie
authored andcommitted
ASoC: Intel: avs: Data probing soc-component
Define stub component for data probing. Stub as most operations from standard PCM case do not apply here. Specific bits are CPU DAIs and compress_ops. FE DAIs can link against these new CPU DAI to create new compress devices. Signed-off-by: Cezary Rojewski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 700462f commit ed914a2

File tree

3 files changed

+64
-5
lines changed

3 files changed

+64
-5
lines changed

sound/soc/intel/avs/avs.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ struct avs_soc_component {
322322

323323
extern const struct snd_soc_dai_ops avs_dai_fe_ops;
324324

325+
int avs_soc_component_register(struct device *dev, const char *name,
326+
const struct snd_soc_component_driver *drv,
327+
struct snd_soc_dai_driver *cpu_dais, int num_cpu_dais);
325328
int avs_dmic_platform_register(struct avs_dev *adev, const char *name);
326329
int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned long port_mask,
327330
unsigned long *tdms);
@@ -373,6 +376,8 @@ struct apl_log_buffer_layout {
373376
bool avs_logging_fw(struct avs_dev *adev);
374377
void avs_dump_fw_log(struct avs_dev *adev, const void __iomem *src, unsigned int len);
375378
void avs_dump_fw_log_wakeup(struct avs_dev *adev, const void __iomem *src, unsigned int len);
379+
380+
int avs_probe_platform_register(struct avs_dev *adev, const char *name);
376381
#else
377382
#define AVS_SET_ENABLE_LOGS_OP(name)
378383

@@ -389,6 +394,11 @@ static inline void
389394
avs_dump_fw_log_wakeup(struct avs_dev *adev, const void __iomem *src, unsigned int len)
390395
{
391396
}
397+
398+
static inline int avs_probe_platform_register(struct avs_dev *adev, const char *name)
399+
{
400+
return 0;
401+
}
392402
#endif
393403

394404
#endif /* __SOUND_SOC_INTEL_AVS_H */

sound/soc/intel/avs/pcm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,9 +1126,9 @@ static const struct snd_soc_component_driver avs_component_driver = {
11261126
.topology_name_prefix = "intel/avs",
11271127
};
11281128

1129-
static int avs_soc_component_register(struct device *dev, const char *name,
1130-
const struct snd_soc_component_driver *drv,
1131-
struct snd_soc_dai_driver *cpu_dais, int num_cpu_dais)
1129+
int avs_soc_component_register(struct device *dev, const char *name,
1130+
const struct snd_soc_component_driver *drv,
1131+
struct snd_soc_dai_driver *cpu_dais, int num_cpu_dais)
11321132
{
11331133
struct avs_soc_component *acomp;
11341134
int ret;

sound/soc/intel/avs/probes.c

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ static int avs_probe_compr_copy(struct snd_soc_component *comp, struct snd_compr
249249
return count;
250250
}
251251

252-
__maybe_unused
253252
static const struct snd_soc_cdai_ops avs_probe_dai_ops = {
254253
.startup = avs_probe_compr_open,
255254
.shutdown = avs_probe_compr_free,
@@ -258,7 +257,57 @@ static const struct snd_soc_cdai_ops avs_probe_dai_ops = {
258257
.pointer = avs_probe_compr_pointer,
259258
};
260259

261-
__maybe_unused
262260
static const struct snd_compress_ops avs_probe_compress_ops = {
263261
.copy = avs_probe_compr_copy,
264262
};
263+
264+
static struct snd_soc_dai_driver probe_cpu_dais[] = {
265+
{
266+
.name = "Probe Extraction CPU DAI",
267+
.compress_new = snd_soc_new_compress,
268+
.cops = &avs_probe_dai_ops,
269+
.capture = {
270+
.stream_name = "Probe Extraction",
271+
.channels_min = 1,
272+
.channels_max = 8,
273+
.rates = SNDRV_PCM_RATE_48000,
274+
.rate_min = 48000,
275+
.rate_max = 48000,
276+
},
277+
},
278+
};
279+
280+
static int avs_probe_component_probe(struct snd_soc_component *component)
281+
{
282+
struct avs_soc_component *acomp = to_avs_soc_component(component);
283+
struct avs_dev *adev = to_avs_dev(component->dev);
284+
285+
mutex_lock(&adev->comp_list_mutex);
286+
list_add_tail(&acomp->node, &adev->comp_list);
287+
mutex_unlock(&adev->comp_list_mutex);
288+
return 0;
289+
}
290+
291+
static void avs_probe_component_remove(struct snd_soc_component *component)
292+
{
293+
struct avs_soc_component *acomp = to_avs_soc_component(component);
294+
struct avs_dev *adev = to_avs_dev(component->dev);
295+
296+
mutex_lock(&adev->comp_list_mutex);
297+
list_del(&acomp->node);
298+
mutex_unlock(&adev->comp_list_mutex);
299+
}
300+
301+
static const struct snd_soc_component_driver avs_probe_component_driver = {
302+
.name = "avs-probe-compr",
303+
.probe = avs_probe_component_probe,
304+
.remove = avs_probe_component_remove,
305+
.compress_ops = &avs_probe_compress_ops,
306+
.module_get_upon_open = 1, /* increment refcount when a stream is opened */
307+
};
308+
309+
int avs_probe_platform_register(struct avs_dev *adev, const char *name)
310+
{
311+
return avs_soc_component_register(adev->dev, name, &avs_probe_component_driver,
312+
probe_cpu_dais, ARRAY_SIZE(probe_cpu_dais));
313+
}

0 commit comments

Comments
 (0)