drivers/mfd/ac100.c
Source file repositories/reference/linux-study-clean/drivers/mfd/ac100.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/ac100.c- Extension
.c- Size
- 4325 bytes
- Lines
- 135
- Domain
- Driver Families
- Bucket
- drivers/mfd
- 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/interrupt.hlinux/kernel.hlinux/mfd/core.hlinux/mfd/ac100.hlinux/module.hlinux/of.hlinux/regmap.hlinux/sunxi-rsb.h
Detected Declarations
function ac100_rsb_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* MFD core driver for X-Powers' AC100 Audio Codec IC
*
* The AC100 is a highly integrated audio codec and RTC subsystem designed
* for mobile applications. It has 3 I2S/PCM interfaces, a 2 channel DAC,
* a 2 channel ADC with 5 inputs and a builtin mixer. The RTC subsystem has
* 3 clock outputs.
*
* The audio codec and RTC parts are completely separate, sharing only the
* host interface for access to its registers.
*
* Copyright (2016) Chen-Yu Tsai
*
* Author: Chen-Yu Tsai <wens@csie.org>
*/
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mfd/core.h>
#include <linux/mfd/ac100.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/sunxi-rsb.h>
static const struct regmap_range ac100_writeable_ranges[] = {
regmap_reg_range(AC100_CHIP_AUDIO_RST, AC100_I2S_SR_CTRL),
regmap_reg_range(AC100_I2S1_CLK_CTRL, AC100_I2S1_MXR_GAIN),
regmap_reg_range(AC100_I2S2_CLK_CTRL, AC100_I2S2_MXR_GAIN),
regmap_reg_range(AC100_I2S3_CLK_CTRL, AC100_I2S3_SIG_PATH_CTRL),
regmap_reg_range(AC100_ADC_DIG_CTRL, AC100_ADC_VOL_CTRL),
regmap_reg_range(AC100_HMIC_CTRL1, AC100_HMIC_STATUS),
regmap_reg_range(AC100_DAC_DIG_CTRL, AC100_DAC_MXR_GAIN),
regmap_reg_range(AC100_ADC_APC_CTRL, AC100_LINEOUT_CTRL),
regmap_reg_range(AC100_ADC_DAP_L_CTRL, AC100_ADC_DAP_OPT),
regmap_reg_range(AC100_DAC_DAP_CTRL, AC100_DAC_DAP_OPT),
regmap_reg_range(AC100_ADC_DAP_ENA, AC100_DAC_DAP_ENA),
regmap_reg_range(AC100_SRC1_CTRL1, AC100_SRC1_CTRL2),
regmap_reg_range(AC100_SRC2_CTRL1, AC100_SRC2_CTRL2),
regmap_reg_range(AC100_CLK32K_ANALOG_CTRL, AC100_CLKOUT_CTRL3),
regmap_reg_range(AC100_RTC_RST, AC100_RTC_UPD),
regmap_reg_range(AC100_ALM_INT_ENA, AC100_ALM_INT_STA),
regmap_reg_range(AC100_ALM_SEC, AC100_RTC_GP(15)),
};
static const struct regmap_range ac100_volatile_ranges[] = {
regmap_reg_range(AC100_CHIP_AUDIO_RST, AC100_PLL_CTRL2),
regmap_reg_range(AC100_HMIC_STATUS, AC100_HMIC_STATUS),
regmap_reg_range(AC100_ADC_DAP_L_STA, AC100_ADC_DAP_L_STA),
regmap_reg_range(AC100_SRC1_CTRL1, AC100_SRC1_CTRL1),
regmap_reg_range(AC100_SRC1_CTRL3, AC100_SRC2_CTRL1),
regmap_reg_range(AC100_SRC2_CTRL3, AC100_SRC2_CTRL4),
regmap_reg_range(AC100_RTC_RST, AC100_RTC_RST),
regmap_reg_range(AC100_RTC_SEC, AC100_ALM_INT_STA),
regmap_reg_range(AC100_ALM_SEC, AC100_ALM_UPD),
};
static const struct regmap_access_table ac100_writeable_table = {
.yes_ranges = ac100_writeable_ranges,
.n_yes_ranges = ARRAY_SIZE(ac100_writeable_ranges),
};
static const struct regmap_access_table ac100_volatile_table = {
.yes_ranges = ac100_volatile_ranges,
.n_yes_ranges = ARRAY_SIZE(ac100_volatile_ranges),
};
static const struct regmap_config ac100_regmap_config = {
.reg_bits = 8,
.val_bits = 16,
.wr_table = &ac100_writeable_table,
.volatile_table = &ac100_volatile_table,
.max_register = AC100_RTC_GP(15),
.cache_type = REGCACHE_MAPLE,
};
static struct mfd_cell ac100_cells[] = {
{
.name = "ac100-codec",
.of_compatible = "x-powers,ac100-codec",
}, {
.name = "ac100-rtc",
.of_compatible = "x-powers,ac100-rtc",
},
};
static int ac100_rsb_probe(struct sunxi_rsb_device *rdev)
{
struct ac100_dev *ac100;
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/kernel.h`, `linux/mfd/core.h`, `linux/mfd/ac100.h`, `linux/module.h`, `linux/of.h`, `linux/regmap.h`, `linux/sunxi-rsb.h`.
- Detected declarations: `function ac100_rsb_probe`.
- Atlas domain: Driver Families / drivers/mfd.
- 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.