sound/soc/intel/avs/boards/rt274.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/avs/boards/rt274.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/avs/boards/rt274.c- Extension
.c- Size
- 7943 bytes
- Lines
- 281
- 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/module.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-acpi.h../../../codecs/rt274.h../utils.h
Detected Declarations
function avs_rt274_clock_controlfunction avs_rt274_codec_initfunction avs_rt274_codec_exitfunction avs_rt274_be_fixupfunction avs_create_dai_linkfunction avs_card_suspend_prefunction avs_card_resume_postfunction avs_rt274_probe
Annotated Snippet
if (ret) {
dev_err(codec_dai->dev, "failed to enable PLL2: %d\n", ret);
return ret;
}
}
return 0;
}
static const struct snd_soc_dapm_widget card_widgets[] = {
SND_SOC_DAPM_HP("Headphone Jack", NULL),
SND_SOC_DAPM_MIC("Mic Jack", NULL),
SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, avs_rt274_clock_control,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
};
static const struct snd_soc_dapm_route card_base_routes[] = {
{"Headphone Jack", NULL, "HPO Pin"},
{"MIC", NULL, "Mic Jack"},
{"Headphone Jack", NULL, "Platform Clock"},
{"MIC", NULL, "Platform Clock"},
};
static const struct snd_soc_jack_pin card_headset_pins[] = {
{
.pin = "Headphone Jack",
.mask = SND_JACK_HEADPHONE,
},
{
.pin = "Mic Jack",
.mask = SND_JACK_MICROPHONE,
},
};
static int avs_rt274_codec_init(struct snd_soc_pcm_runtime *runtime)
{
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(runtime, 0);
struct snd_soc_component *component = codec_dai->component;
struct snd_soc_jack_pin *pins;
struct snd_soc_jack *jack;
struct snd_soc_card *card = runtime->card;
struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int num_pins, ret;
jack = snd_soc_card_get_drvdata(card);
num_pins = ARRAY_SIZE(card_headset_pins);
pins = devm_kmemdup_array(card->dev, card_headset_pins, num_pins,
sizeof(card_headset_pins[0]), GFP_KERNEL);
if (!pins)
return -ENOMEM;
ret = snd_soc_card_jack_new_pins(card, "Headset Jack", SND_JACK_HEADSET, jack, pins,
num_pins);
if (ret)
return ret;
snd_soc_component_set_jack(component, jack, NULL);
/* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xF, 0xF, 4, 24);
if (ret < 0) {
dev_err(card->dev, "can't set codec pcm format %d\n", ret);
return ret;
}
snd_soc_dapm_set_idle_bias(dapm, false);
return 0;
}
static void avs_rt274_codec_exit(struct snd_soc_pcm_runtime *rtd)
{
snd_soc_component_set_jack(snd_soc_rtd_to_codec(rtd, 0)->component, NULL, NULL);
}
static int avs_rt274_be_fixup(struct snd_soc_pcm_runtime *runtime, struct snd_pcm_hw_params *params)
{
struct snd_interval *rate, *channels;
struct snd_mask *fmt;
rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
/* The ADSP will convert the FE rate to 48k, stereo */
rate->min = rate->max = AVS_RT274_BE_FIXUP_RATE;
channels->min = channels->max = 2;
Annotation
- Immediate include surface: `linux/module.h`, `sound/jack.h`, `sound/pcm.h`, `sound/pcm_params.h`, `sound/soc.h`, `sound/soc-acpi.h`, `../../../codecs/rt274.h`, `../utils.h`.
- Detected declarations: `function avs_rt274_clock_control`, `function avs_rt274_codec_init`, `function avs_rt274_codec_exit`, `function avs_rt274_be_fixup`, `function avs_create_dai_link`, `function avs_card_suspend_pre`, `function avs_card_resume_post`, `function avs_rt274_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.