sound/soc/intel/boards/bytcr_rt5651.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/boards/bytcr_rt5651.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/boards/bytcr_rt5651.c- Extension
.c- Size
- 34062 bytes
- Lines
- 1168
- 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/init.hlinux/i2c.hlinux/module.hlinux/platform_device.hlinux/property.hlinux/acpi.hlinux/clk.hlinux/device.hlinux/dmi.hlinux/input.hlinux/gpio/consumer.hlinux/gpio/machine.hlinux/slab.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/jack.hsound/soc-acpi.h../../codecs/rt5651.h../atom/sst-atom-controls.h../common/soc-intel-quirks.h
Detected Declarations
struct byt_rt5651_privatestruct acpi_chan_packagefunction log_quirksfunction byt_rt5651_prepare_and_enable_pll1function platform_clock_controlfunction rt5651_ext_amp_power_eventfunction byt_rt5651_aif1_hw_paramsfunction byt_rt5651_pov_p1006w_quirk_cbfunction byt_rt5651_quirk_cbfunction snd_soc_register_cardfunction byt_rt5651_initfunction byt_rt5651_codec_fixupfunction byt_rt5651_aif1_startupfunction byt_rt5651_suspendfunction for_each_card_componentsfunction byt_rt5651_resumefunction for_each_card_componentsfunction snd_byt_rt5651_mc_probefunction snd_byt_rt5651_mc_remove
Annotated Snippet
struct byt_rt5651_private {
struct clk *mclk;
struct gpio_desc *ext_amp_gpio;
struct gpio_desc *hp_detect;
struct snd_soc_jack jack;
struct device *codec_dev;
};
static const struct acpi_gpio_mapping *byt_rt5651_gpios;
/* Default: jack-detect on JD1_1, internal mic on in2, headsetmic on in3 */
static unsigned long byt_rt5651_quirk = BYT_RT5651_DEFAULT_QUIRKS |
BYT_RT5651_IN2_MAP;
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;
map = BYT_RT5651_MAP(byt_rt5651_quirk);
switch (map) {
case BYT_RT5651_DMIC_MAP:
dev_info(dev, "quirk DMIC_MAP enabled");
break;
case BYT_RT5651_IN1_MAP:
dev_info(dev, "quirk IN1_MAP enabled");
break;
case BYT_RT5651_IN2_MAP:
dev_info(dev, "quirk IN2_MAP enabled");
break;
case BYT_RT5651_IN1_IN2_MAP:
dev_info(dev, "quirk IN1_IN2_MAP enabled");
break;
default:
dev_warn_once(dev, "quirk sets invalid input map: 0x%x, default to DMIC_MAP\n", map);
byt_rt5651_quirk &= ~BYT_RT5651_MAP_MASK;
byt_rt5651_quirk |= BYT_RT5651_DMIC_MAP;
break;
}
if (BYT_RT5651_JDSRC(byt_rt5651_quirk)) {
dev_info(dev, "quirk realtek,jack-detect-source %ld\n",
BYT_RT5651_JDSRC(byt_rt5651_quirk));
dev_info(dev, "quirk realtek,over-current-threshold-microamp %ld\n",
BYT_RT5651_OVCD_TH(byt_rt5651_quirk) * 100);
dev_info(dev, "quirk realtek,over-current-scale-factor %ld\n",
BYT_RT5651_OVCD_SF(byt_rt5651_quirk));
}
if (byt_rt5651_quirk & BYT_RT5651_DMIC_EN)
dev_info(dev, "quirk DMIC enabled");
if (byt_rt5651_quirk & BYT_RT5651_MCLK_EN)
dev_info(dev, "quirk MCLK_EN enabled");
if (byt_rt5651_quirk & BYT_RT5651_MCLK_25MHZ)
dev_info(dev, "quirk MCLK_25MHZ enabled");
if (byt_rt5651_quirk & BYT_RT5651_SSP2_AIF2)
dev_info(dev, "quirk SSP2_AIF2 enabled\n");
if (byt_rt5651_quirk & BYT_RT5651_SSP0_AIF1)
dev_info(dev, "quirk SSP0_AIF1 enabled\n");
if (byt_rt5651_quirk & BYT_RT5651_SSP0_AIF2)
dev_info(dev, "quirk SSP0_AIF2 enabled\n");
if (byt_rt5651_quirk & BYT_RT5651_MONO_SPEAKER)
dev_info(dev, "quirk MONO_SPEAKER enabled\n");
if (byt_rt5651_quirk & BYT_RT5651_JD_NOT_INV)
dev_info(dev, "quirk JD_NOT_INV enabled\n");
}
#define BYT_CODEC_DAI1 "rt5651-aif1"
#define BYT_CODEC_DAI2 "rt5651-aif2"
static int byt_rt5651_prepare_and_enable_pll1(struct snd_soc_dai *codec_dai,
int rate, int bclk_ratio)
{
int clk_id, clk_freq, ret;
/* Configure the PLL before selecting it */
if (!(byt_rt5651_quirk & BYT_RT5651_MCLK_EN)) {
clk_id = RT5651_PLL1_S_BCLK1;
clk_freq = rate * bclk_ratio;
} else {
clk_id = RT5651_PLL1_S_MCLK;
if (byt_rt5651_quirk & BYT_RT5651_MCLK_25MHZ)
clk_freq = 25000000;
else
clk_freq = 19200000;
}
ret = snd_soc_dai_set_pll(codec_dai, 0, clk_id, clk_freq, rate * 512);
if (ret < 0) {
Annotation
- Immediate include surface: `linux/init.h`, `linux/i2c.h`, `linux/module.h`, `linux/platform_device.h`, `linux/property.h`, `linux/acpi.h`, `linux/clk.h`, `linux/device.h`.
- Detected declarations: `struct byt_rt5651_private`, `struct acpi_chan_package`, `function log_quirks`, `function byt_rt5651_prepare_and_enable_pll1`, `function platform_clock_control`, `function rt5651_ext_amp_power_event`, `function byt_rt5651_aif1_hw_params`, `function byt_rt5651_pov_p1006w_quirk_cb`, `function byt_rt5651_quirk_cb`, `function snd_soc_register_card`.
- 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.