sound/soc/sunxi/sun50i-codec-analog.c
Source file repositories/reference/linux-study-clean/sound/soc/sunxi/sun50i-codec-analog.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sunxi/sun50i-codec-analog.c- Extension
.c- Size
- 21107 bytes
- Lines
- 597
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/io.hlinux/kernel.hlinux/mod_devicetable.hlinux/module.hlinux/platform_device.hlinux/regmap.hsound/soc.hsound/soc-dapm.hsound/tlv.hsun8i-adda-pr-regmap.h
Detected Declarations
function sun50i_codec_hbias_eventfunction sun50i_a64_codec_set_bias_levelfunction sun50i_codec_analog_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* This driver supports the analog controls for the internal codec
* found in Allwinner's A64 SoC.
*
* Copyright (C) 2016 Chen-Yu Tsai <wens@csie.org>
* Copyright (C) 2017 Marcus Cooper <codekipper@gmail.com>
* Copyright (C) 2018 Vasily Khoruzhick <anarsoul@gmail.com>
*
* Based on sun8i-codec-analog.c
*
*/
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/tlv.h>
#include "sun8i-adda-pr-regmap.h"
/* Codec analog control register offsets and bit fields */
#define SUN50I_ADDA_HP_CTRL 0x00
#define SUN50I_ADDA_HP_CTRL_PA_CLK_GATE 7
#define SUN50I_ADDA_HP_CTRL_HPPA_EN 6
#define SUN50I_ADDA_HP_CTRL_HPVOL 0
#define SUN50I_ADDA_OL_MIX_CTRL 0x01
#define SUN50I_ADDA_OL_MIX_CTRL_MIC1 6
#define SUN50I_ADDA_OL_MIX_CTRL_MIC2 5
#define SUN50I_ADDA_OL_MIX_CTRL_PHONE 4
#define SUN50I_ADDA_OL_MIX_CTRL_PHONEN 3
#define SUN50I_ADDA_OL_MIX_CTRL_LINEINL 2
#define SUN50I_ADDA_OL_MIX_CTRL_DACL 1
#define SUN50I_ADDA_OL_MIX_CTRL_DACR 0
#define SUN50I_ADDA_OR_MIX_CTRL 0x02
#define SUN50I_ADDA_OR_MIX_CTRL_MIC1 6
#define SUN50I_ADDA_OR_MIX_CTRL_MIC2 5
#define SUN50I_ADDA_OR_MIX_CTRL_PHONE 4
#define SUN50I_ADDA_OR_MIX_CTRL_PHONEP 3
#define SUN50I_ADDA_OR_MIX_CTRL_LINEINR 2
#define SUN50I_ADDA_OR_MIX_CTRL_DACR 1
#define SUN50I_ADDA_OR_MIX_CTRL_DACL 0
#define SUN50I_ADDA_EARPIECE_CTRL0 0x03
#define SUN50I_ADDA_EARPIECE_CTRL0_EAR_RAMP_TIME 4
#define SUN50I_ADDA_EARPIECE_CTRL0_ESPSR 0
#define SUN50I_ADDA_EARPIECE_CTRL1 0x04
#define SUN50I_ADDA_EARPIECE_CTRL1_ESPPA_EN 7
#define SUN50I_ADDA_EARPIECE_CTRL1_ESPPA_MUTE 6
#define SUN50I_ADDA_EARPIECE_CTRL1_ESP_VOL 0
#define SUN50I_ADDA_LINEOUT_CTRL0 0x05
#define SUN50I_ADDA_LINEOUT_CTRL0_LEN 7
#define SUN50I_ADDA_LINEOUT_CTRL0_REN 6
#define SUN50I_ADDA_LINEOUT_CTRL0_LSRC_SEL 5
#define SUN50I_ADDA_LINEOUT_CTRL0_RSRC_SEL 4
#define SUN50I_ADDA_LINEOUT_CTRL1 0x06
#define SUN50I_ADDA_LINEOUT_CTRL1_VOL 0
#define SUN50I_ADDA_MIC1_CTRL 0x07
#define SUN50I_ADDA_MIC1_CTRL_MIC1G 4
#define SUN50I_ADDA_MIC1_CTRL_MIC1AMPEN 3
#define SUN50I_ADDA_MIC1_CTRL_MIC1BOOST 0
#define SUN50I_ADDA_MIC2_CTRL 0x08
#define SUN50I_ADDA_MIC2_CTRL_MIC2G 4
#define SUN50I_ADDA_MIC2_CTRL_MIC2AMPEN 3
#define SUN50I_ADDA_MIC2_CTRL_MIC2BOOST 0
#define SUN50I_ADDA_LINEIN_CTRL 0x09
#define SUN50I_ADDA_LINEIN_CTRL_LINEING 0
#define SUN50I_ADDA_MIX_DAC_CTRL 0x0a
#define SUN50I_ADDA_MIX_DAC_CTRL_DACAREN 7
#define SUN50I_ADDA_MIX_DAC_CTRL_DACALEN 6
#define SUN50I_ADDA_MIX_DAC_CTRL_RMIXEN 5
#define SUN50I_ADDA_MIX_DAC_CTRL_LMIXEN 4
#define SUN50I_ADDA_MIX_DAC_CTRL_RHPPAMUTE 3
#define SUN50I_ADDA_MIX_DAC_CTRL_LHPPAMUTE 2
#define SUN50I_ADDA_MIX_DAC_CTRL_RHPIS 1
#define SUN50I_ADDA_MIX_DAC_CTRL_LHPIS 0
Annotation
- Immediate include surface: `linux/io.h`, `linux/kernel.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/platform_device.h`, `linux/regmap.h`, `sound/soc.h`, `sound/soc-dapm.h`.
- Detected declarations: `function sun50i_codec_hbias_event`, `function sun50i_a64_codec_set_bias_level`, `function sun50i_codec_analog_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.