sound/soc/ti/omap-hdmi.c
Source file repositories/reference/linux-study-clean/sound/soc/ti/omap-hdmi.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/ti/omap-hdmi.c- Extension
.c- Size
- 10437 bytes
- Lines
- 404
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/err.hlinux/string.hlinux/platform_device.hsound/soc.hsound/pcm_params.hsound/dmaengine_pcm.huapi/sound/asound.hsound/asoundef.hsound/omap-hdmi-audio.hsdma-pcm.h
Detected Declarations
struct hdmi_audio_datafunction hdmi_dai_abortfunction snd_pcm_runningfunction hdmi_dai_startupfunction hdmi_dai_hw_paramsfunction hdmi_dai_triggerfunction hdmi_dai_shutdownfunction omap_hdmi_audio_probe
Annotated Snippet
struct hdmi_audio_data {
struct snd_soc_card *card;
const struct omap_hdmi_audio_ops *ops;
struct device *dssdev;
struct snd_dmaengine_dai_dma_data dma_data;
struct omap_dss_audio dss_audio;
struct snd_aes_iec958 iec;
struct snd_cea_861_aud_if cea;
struct mutex current_stream_lock;
struct snd_pcm_substream *current_stream;
};
static
struct hdmi_audio_data *card_drvdata_substream(struct snd_pcm_substream *ss)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(ss);
return snd_soc_card_get_drvdata(rtd->card);
}
static void hdmi_dai_abort(struct device *dev)
{
struct hdmi_audio_data *ad = dev_get_drvdata(dev);
guard(mutex)(&ad->current_stream_lock);
if (ad->current_stream && ad->current_stream->runtime &&
snd_pcm_running(ad->current_stream)) {
dev_err(dev, "HDMI display disabled, aborting playback\n");
snd_pcm_stream_lock_irq(ad->current_stream);
snd_pcm_stop(ad->current_stream, SNDRV_PCM_STATE_DISCONNECTED);
snd_pcm_stream_unlock_irq(ad->current_stream);
}
}
static int hdmi_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct hdmi_audio_data *ad = card_drvdata_substream(substream);
int ret;
/*
* Make sure that the period bytes are multiple of the DMA packet size.
* Largest packet size we use is 32 32-bit words = 128 bytes
*/
ret = snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 128);
if (ret < 0) {
dev_err(dai->dev, "Could not apply period constraint: %d\n",
ret);
return ret;
}
ret = snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 128);
if (ret < 0) {
dev_err(dai->dev, "Could not apply buffer constraint: %d\n",
ret);
return ret;
}
snd_soc_dai_set_dma_data(dai, substream, &ad->dma_data);
scoped_guard(mutex, &ad->current_stream_lock)
ad->current_stream = substream;
ret = ad->ops->audio_startup(ad->dssdev, hdmi_dai_abort);
if (ret) {
scoped_guard(mutex, &ad->current_stream_lock)
ad->current_stream = NULL;
}
return ret;
}
static int hdmi_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
struct hdmi_audio_data *ad = card_drvdata_substream(substream);
struct snd_aes_iec958 *iec = &ad->iec;
struct snd_cea_861_aud_if *cea = &ad->cea;
WARN_ON(ad->current_stream != substream);
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
ad->dma_data.maxburst = 16;
break;
case SNDRV_PCM_FORMAT_S24_LE:
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/err.h`, `linux/string.h`, `linux/platform_device.h`, `sound/soc.h`, `sound/pcm_params.h`, `sound/dmaengine_pcm.h`.
- Detected declarations: `struct hdmi_audio_data`, `function hdmi_dai_abort`, `function snd_pcm_running`, `function hdmi_dai_startup`, `function hdmi_dai_hw_params`, `function hdmi_dai_trigger`, `function hdmi_dai_shutdown`, `function omap_hdmi_audio_probe`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source 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.