sound/soc/sof/intel/hda-probes.c
Source file repositories/reference/linux-study-clean/sound/soc/sof/intel/hda-probes.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sof/intel/hda-probes.c- Extension
.c- Size
- 4581 bytes
- Lines
- 151
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hsound/hdaudio_ext.hsound/soc.h../sof-priv.h../sof-client-probes.h../sof-client.hhda.h
Detected Declarations
function hda_compr_get_streamfunction hda_probes_compr_startupfunction hda_probes_compr_shutdownfunction hda_probes_compr_set_paramsfunction hda_probes_compr_triggerfunction hda_probes_compr_pointerfunction hda_probes_registerfunction hda_probes_unregister
Annotated Snippet
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
//
// This file is provided under a dual BSD/GPLv2 license. When using or
// redistributing this file, you may do so under either license.
//
// Copyright(c) 2019-2021 Intel Corporation
//
// Author: Cezary Rojewski <cezary.rojewski@intel.com>
// Converted to SOF client:
// Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
// Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
//
#include <linux/module.h>
#include <sound/hdaudio_ext.h>
#include <sound/soc.h>
#include "../sof-priv.h"
#include "../sof-client-probes.h"
#include "../sof-client.h"
#include "hda.h"
static inline struct hdac_ext_stream *
hda_compr_get_stream(struct snd_compr_stream *cstream)
{
return cstream->runtime->private_data;
}
static int hda_probes_compr_startup(struct sof_client_dev *cdev,
struct snd_compr_stream *cstream,
struct snd_soc_dai *dai, u32 *stream_id)
{
struct snd_sof_dev *sdev = sof_client_dev_to_sof_dev(cdev);
struct hdac_ext_stream *hext_stream;
hext_stream = hda_dsp_stream_get(sdev, cstream->direction, 0);
if (!hext_stream)
return -EBUSY;
hdac_stream(hext_stream)->curr_pos = 0;
hdac_stream(hext_stream)->cstream = cstream;
cstream->runtime->private_data = hext_stream;
*stream_id = hdac_stream(hext_stream)->stream_tag;
return 0;
}
static int hda_probes_compr_shutdown(struct sof_client_dev *cdev,
struct snd_compr_stream *cstream,
struct snd_soc_dai *dai)
{
struct hdac_ext_stream *hext_stream = hda_compr_get_stream(cstream);
struct snd_sof_dev *sdev = sof_client_dev_to_sof_dev(cdev);
int ret;
ret = hda_dsp_stream_put(sdev, cstream->direction,
hdac_stream(hext_stream)->stream_tag);
if (ret < 0) {
dev_dbg(sdev->dev, "stream put failed: %d\n", ret);
return ret;
}
hdac_stream(hext_stream)->cstream = NULL;
cstream->runtime->private_data = NULL;
return 0;
}
static int hda_probes_compr_set_params(struct sof_client_dev *cdev,
struct snd_compr_stream *cstream,
struct snd_compr_params *params,
struct snd_soc_dai *dai)
{
struct hdac_ext_stream *hext_stream = hda_compr_get_stream(cstream);
struct snd_sof_dev *sdev = sof_client_dev_to_sof_dev(cdev);
struct hdac_stream *hstream = hdac_stream(hext_stream);
struct snd_dma_buffer *dmab;
u32 bits, rate;
int bps, ret;
dmab = cstream->runtime->dma_buffer_p;
/* compr params do not store bit depth, default to S32_LE */
bps = snd_pcm_format_physical_width(SNDRV_PCM_FORMAT_S32_LE);
if (bps < 0)
return bps;
bits = hda_dsp_get_bits(sdev, bps);
rate = hda_dsp_get_mult_div(sdev, params->codec.sample_rate);
hstream->format_val = rate | bits | (params->codec.ch_out - 1);
hstream->bufsize = cstream->runtime->buffer_size;
Annotation
- Immediate include surface: `linux/module.h`, `sound/hdaudio_ext.h`, `sound/soc.h`, `../sof-priv.h`, `../sof-client-probes.h`, `../sof-client.h`, `hda.h`.
- Detected declarations: `function hda_compr_get_stream`, `function hda_probes_compr_startup`, `function hda_probes_compr_shutdown`, `function hda_probes_compr_set_params`, `function hda_probes_compr_trigger`, `function hda_probes_compr_pointer`, `function hda_probes_register`, `function hda_probes_unregister`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.