sound/soc/intel/avs/boards/rt5682.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/avs/boards/rt5682.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/avs/boards/rt5682.c- Extension
.c- Size
- 10100 bytes
- Lines
- 346
- 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/clk.hlinux/dmi.hlinux/i2c.hlinux/input.hlinux/module.hlinux/platform_device.hsound/core.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/rt5682.hsound/soc.hsound/soc-acpi.h../../common/soc-intel-quirks.h../../../codecs/rt5682.h../utils.h
Detected Declarations
function avs_rt5682_quirk_cbfunction avs_rt5682_codec_initfunction avs_rt5682_codec_exitfunction avs_rt5682_hw_paramsfunction avs_rt5682_be_fixupfunction avs_create_dai_linkfunction avs_card_suspend_prefunction avs_card_resume_postfunction avs_rt5682_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
//
// Copyright(c) 2021-2022 Intel Corporation
//
// Authors: Cezary Rojewski <cezary.rojewski@intel.com>
// Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
//
#include <linux/clk.h>
#include <linux/dmi.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <sound/core.h>
#include <sound/jack.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/rt5682.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include "../../common/soc-intel-quirks.h"
#include "../../../codecs/rt5682.h"
#include "../utils.h"
#define AVS_RT5682_SSP_CODEC(quirk) ((quirk) & GENMASK(2, 0))
#define AVS_RT5682_SSP_CODEC_MASK (GENMASK(2, 0))
#define AVS_RT5682_MCLK_EN BIT(3)
#define AVS_RT5682_MCLK_24MHZ BIT(4)
#define AVS_RT5682_CODEC_DAI_NAME "rt5682-aif1"
/* Default: MCLK on, MCLK 19.2M, SSP0 */
static unsigned long avs_rt5682_quirk = AVS_RT5682_MCLK_EN | AVS_RT5682_SSP_CODEC(0);
static int avs_rt5682_quirk_cb(const struct dmi_system_id *id)
{
avs_rt5682_quirk = (unsigned long)id->driver_data;
return 1;
}
static const struct dmi_system_id avs_rt5682_quirk_table[] = {
{
.callback = avs_rt5682_quirk_cb,
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
DMI_MATCH(DMI_PRODUCT_NAME, "WhiskeyLake Client"),
},
.driver_data = (void *)(AVS_RT5682_MCLK_EN |
AVS_RT5682_MCLK_24MHZ |
AVS_RT5682_SSP_CODEC(1)),
},
{
.callback = avs_rt5682_quirk_cb,
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
DMI_MATCH(DMI_PRODUCT_NAME, "Ice Lake Client"),
},
.driver_data = (void *)(AVS_RT5682_MCLK_EN |
AVS_RT5682_SSP_CODEC(0)),
},
{}
};
static const struct snd_kcontrol_new card_controls[] = {
SOC_DAPM_PIN_SWITCH("Headphone Jack"),
SOC_DAPM_PIN_SWITCH("Headset Mic"),
};
static const struct snd_soc_dapm_widget card_widgets[] = {
SND_SOC_DAPM_HP("Headphone Jack", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
};
static const struct snd_soc_dapm_route card_base_routes[] = {
/* HP jack connectors - unknown if we have jack detect */
{ "Headphone Jack", NULL, "HPOL" },
{ "Headphone Jack", NULL, "HPOR" },
/* other jacks */
{ "IN1P", NULL, "Headset Mic" },
};
static const struct snd_soc_jack_pin card_jack_pins[] = {
{
.pin = "Headphone Jack",
.mask = SND_JACK_HEADPHONE,
},
{
.pin = "Headset Mic",
.mask = SND_JACK_MICROPHONE,
Annotation
- Immediate include surface: `linux/clk.h`, `linux/dmi.h`, `linux/i2c.h`, `linux/input.h`, `linux/module.h`, `linux/platform_device.h`, `sound/core.h`, `sound/jack.h`.
- Detected declarations: `function avs_rt5682_quirk_cb`, `function avs_rt5682_codec_init`, `function avs_rt5682_codec_exit`, `function avs_rt5682_hw_params`, `function avs_rt5682_be_fixup`, `function avs_create_dai_link`, `function avs_card_suspend_pre`, `function avs_card_resume_post`, `function avs_rt5682_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.