sound/soc/intel/boards/bytcr_rt5640.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/boards/bytcr_rt5640.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/boards/bytcr_rt5640.c- Extension
.c- Size
- 59478 bytes
- Lines
- 2002
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/i2c.hlinux/init.hlinux/module.hlinux/moduleparam.hlinux/platform_device.hlinux/acpi.hlinux/clk.hlinux/device.hlinux/device/bus.hlinux/dmi.hlinux/gpio/consumer.hlinux/gpio/machine.hlinux/input.hlinux/slab.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/jack.hsound/soc-acpi.hdt-bindings/sound/rt5640.h../../codecs/rt5640.h../atom/sst-atom-controls.h../common/soc-intel-quirks.h
Detected Declarations
struct byt_rt5640_privatestruct acpi_chan_packagefunction log_quirksfunction byt_rt5640_prepare_and_enable_pll1function platform_clock_controlfunction byt_rt5640_event_lineoutfunction byt_rt5640_hp_elitepad_1000g2_jack1_checkfunction byt_rt5640_hp_elitepad_1000g2_jack2_checkfunction byt_rt5640_aif1_hw_paramsfunction snd_soc_register_cardfunction byt_rt5640_get_amcr0f28_settingsfunction byt_rt5640_initfunction byt_rt5640_exitfunction byt_rt5640_codec_fixupfunction byt_rt5640_aif1_startupfunction byt_rt5640_suspendfunction for_each_card_componentsfunction byt_rt5640_resumefunction for_each_card_componentsfunction snd_byt_rt5640_mc_probefunction snd_byt_rt5640_mc_remove
Annotated Snippet
struct byt_rt5640_private {
struct snd_soc_jack jack;
struct snd_soc_jack jack2;
struct rt5640_set_jack_data jack_data;
struct gpio_desc *hsmic_detect;
struct clk *mclk;
struct device *codec_dev;
};
static bool is_bytcr;
static unsigned long byt_rt5640_quirk = BYT_RT5640_MCLK_EN;
static int quirk_override = -1;
module_param_named(quirk, quirk_override, int, 0444);
MODULE_PARM_DESC(quirk, "Board-specific quirk override");
static void log_quirks(struct device *dev)
{
int map;
bool has_mclk = false;
bool has_ssp0 = false;
bool has_ssp0_aif1 = false;
bool has_ssp0_aif2 = false;
bool has_ssp2_aif2 = false;
map = BYT_RT5640_MAP(byt_rt5640_quirk);
switch (map) {
case BYT_RT5640_DMIC1_MAP:
dev_info(dev, "quirk DMIC1_MAP enabled\n");
break;
case BYT_RT5640_DMIC2_MAP:
dev_info(dev, "quirk DMIC2_MAP enabled\n");
break;
case BYT_RT5640_IN1_MAP:
dev_info(dev, "quirk IN1_MAP enabled\n");
break;
case BYT_RT5640_IN3_MAP:
dev_info(dev, "quirk IN3_MAP enabled\n");
break;
case BYT_RT5640_NO_INTERNAL_MIC_MAP:
dev_info(dev, "quirk NO_INTERNAL_MIC_MAP enabled\n");
break;
default:
dev_warn_once(dev, "quirk sets invalid input map: 0x%x, default to DMIC1_MAP\n", map);
byt_rt5640_quirk &= ~BYT_RT5640_MAP_MASK;
byt_rt5640_quirk |= BYT_RT5640_DMIC1_MAP;
break;
}
if (byt_rt5640_quirk & BYT_RT5640_HSMIC2_ON_IN1)
dev_info(dev, "quirk HSMIC2_ON_IN1 enabled\n");
if (BYT_RT5640_JDSRC(byt_rt5640_quirk)) {
dev_info(dev, "quirk realtek,jack-detect-source %ld\n",
BYT_RT5640_JDSRC(byt_rt5640_quirk));
dev_info(dev, "quirk realtek,over-current-threshold-microamp %ld\n",
BYT_RT5640_OVCD_TH(byt_rt5640_quirk) * 100);
dev_info(dev, "quirk realtek,over-current-scale-factor %ld\n",
BYT_RT5640_OVCD_SF(byt_rt5640_quirk));
}
if (byt_rt5640_quirk & BYT_RT5640_JD_NOT_INV)
dev_info(dev, "quirk JD_NOT_INV enabled\n");
if (byt_rt5640_quirk & BYT_RT5640_JD_HP_ELITEP_1000G2)
dev_info(dev, "quirk JD_HP_ELITEPAD_1000G2 enabled\n");
if (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER)
dev_info(dev, "quirk MONO_SPEAKER enabled\n");
if (byt_rt5640_quirk & BYT_RT5640_NO_SPEAKERS)
dev_info(dev, "quirk NO_SPEAKERS enabled\n");
if (byt_rt5640_quirk & BYT_RT5640_SWAPPED_SPEAKERS)
dev_info(dev, "quirk SWAPPED_SPEAKERS enabled\n");
if (byt_rt5640_quirk & BYT_RT5640_LINEOUT)
dev_info(dev, "quirk LINEOUT enabled\n");
if (byt_rt5640_quirk & BYT_RT5640_LINEOUT_AS_HP2)
dev_info(dev, "quirk LINEOUT_AS_HP2 enabled\n");
if (byt_rt5640_quirk & BYT_RT5640_DIFF_MIC)
dev_info(dev, "quirk DIFF_MIC enabled\n");
if (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF1) {
dev_info(dev, "quirk SSP0_AIF1 enabled\n");
has_ssp0 = true;
has_ssp0_aif1 = true;
}
if (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF2) {
dev_info(dev, "quirk SSP0_AIF2 enabled\n");
has_ssp0 = true;
has_ssp0_aif2 = true;
}
if (byt_rt5640_quirk & BYT_RT5640_SSP2_AIF2) {
dev_info(dev, "quirk SSP2_AIF2 enabled\n");
has_ssp2_aif2 = true;
}
if (is_bytcr && !has_ssp0)
dev_err(dev, "Invalid routing, bytcr detected but no SSP0-based quirk, audio cannot work with SSP2 on bytcr\n");
if (has_ssp0_aif1 && has_ssp0_aif2)
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/init.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/platform_device.h`, `linux/acpi.h`, `linux/clk.h`, `linux/device.h`.
- Detected declarations: `struct byt_rt5640_private`, `struct acpi_chan_package`, `function log_quirks`, `function byt_rt5640_prepare_and_enable_pll1`, `function platform_clock_control`, `function byt_rt5640_event_lineout`, `function byt_rt5640_hp_elitepad_1000g2_jack1_check`, `function byt_rt5640_hp_elitepad_1000g2_jack2_check`, `function byt_rt5640_aif1_hw_params`, `function snd_soc_register_card`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.