sound/soc/intel/atom/sst/sst_drv_interface.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/atom/sst/sst_drv_interface.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/atom/sst/sst_drv_interface.c- Extension
.c- Size
- 18129 bytes
- Lines
- 690
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/pci.hlinux/fs.hlinux/firmware.hlinux/pm_runtime.hlinux/pm_qos.hlinux/math64.hsound/core.hsound/pcm.hsound/soc.hsound/compress_driver.hasm/platform_sst_audio.h../sst-mfld-platform.hsst.h
Detected Declarations
function Copyrightfunction sst_get_sfreqfunction sst_get_num_channelfunction sst_get_streamfunction sst_power_controlfunction sst_open_pcm_streamfunction sst_cdev_openfunction sst_cdev_closefunction sst_cdev_ackfunction sst_cdev_set_metadatafunction sst_cdev_stream_pausefunction sst_cdev_stream_pause_releasefunction sst_cdev_stream_startfunction sst_cdev_stream_dropfunction sst_cdev_stream_drainfunction sst_cdev_stream_partial_drainfunction sst_cdev_tstampfunction sst_cdev_capsfunction sst_cdev_codec_capsfunction sst_close_pcm_streamfunction sst_calc_tstampfunction sst_read_timestampfunction sst_stream_startfunction sst_stream_dropfunction sst_stream_pausefunction sst_stream_resumefunction sst_stream_initfunction sst_send_byte_streamfunction sst_registerfunction sst_unregister
Annotated Snippet
if (ret < 0) {
dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret);
return ret;
}
if ((ctx->sst_state == SST_RESET) && (usage_count == 1)) {
ret = sst_load_fw(ctx);
if (ret) {
dev_err(dev, "FW download fail %d\n", ret);
sst_set_fw_state_locked(ctx, SST_RESET);
ret = sst_pm_runtime_put(ctx);
}
}
} else {
usage_count = GET_USAGE_COUNT(dev);
dev_dbg(ctx->dev, "Disable: pm usage count: %d\n", usage_count);
return sst_pm_runtime_put(ctx);
}
return ret;
}
/*
* sst_open_pcm_stream - Open PCM interface
*
* @str_param: parameters of pcm stream
*
* This function is called by MID sound card driver to open
* a new pcm interface
*/
static int sst_open_pcm_stream(struct device *dev,
struct snd_sst_params *str_param)
{
int retval;
struct intel_sst_drv *ctx = dev_get_drvdata(dev);
if (!str_param)
return -EINVAL;
retval = sst_get_stream(ctx, str_param);
if (retval > 0)
ctx->stream_cnt++;
else
dev_err(ctx->dev, "sst_get_stream returned err %d\n", retval);
return retval;
}
static int sst_cdev_open(struct device *dev,
struct snd_sst_params *str_params, struct sst_compress_cb *cb)
{
int str_id, retval;
struct stream_info *stream;
struct intel_sst_drv *ctx = dev_get_drvdata(dev);
retval = pm_runtime_resume_and_get(ctx->dev);
if (retval < 0)
return retval;
str_id = sst_get_stream(ctx, str_params);
if (str_id > 0) {
dev_dbg(dev, "stream allocated in sst_cdev_open %d\n", str_id);
stream = &ctx->streams[str_id];
stream->compr_cb = cb->compr_cb;
stream->compr_cb_param = cb->param;
stream->drain_notify = cb->drain_notify;
stream->drain_cb_param = cb->drain_cb_param;
} else {
dev_err(dev, "stream encountered error during alloc %d\n", str_id);
str_id = -EINVAL;
sst_pm_runtime_put(ctx);
}
return str_id;
}
static int sst_cdev_close(struct device *dev, unsigned int str_id)
{
int retval;
struct stream_info *stream;
struct intel_sst_drv *ctx = dev_get_drvdata(dev);
stream = get_stream_info(ctx, str_id);
if (!stream) {
dev_err(dev, "stream info is NULL for str %d!!!\n", str_id);
return -EINVAL;
}
retval = sst_free_stream(ctx, str_id);
stream->compr_cb_param = NULL;
stream->compr_cb = NULL;
if (retval)
Annotation
- Immediate include surface: `linux/delay.h`, `linux/pci.h`, `linux/fs.h`, `linux/firmware.h`, `linux/pm_runtime.h`, `linux/pm_qos.h`, `linux/math64.h`, `sound/core.h`.
- Detected declarations: `function Copyright`, `function sst_get_sfreq`, `function sst_get_num_channel`, `function sst_get_stream`, `function sst_power_control`, `function sst_open_pcm_stream`, `function sst_cdev_open`, `function sst_cdev_close`, `function sst_cdev_ack`, `function sst_cdev_set_metadata`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.