sound/soc/codecs/max98363.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/max98363.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/max98363.c- Extension
.c- Size
- 12316 bytes
- Lines
- 457
- 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/module.hlinux/pm_runtime.hlinux/regmap.hlinux/soundwire/sdw.hlinux/soundwire/sdw_registers.hlinux/soundwire/sdw_type.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/tlv.hmax98363.h
Detected Declarations
function max98363_readable_registerfunction max98363_volatile_regfunction max98363_suspendfunction max98363_resumefunction max98363_read_propfunction max98363_io_initfunction max98363_sdw_dai_hw_paramsfunction max98363_pcm_hw_freefunction max98363_set_sdw_streamfunction max98363_update_statusfunction max98363_initfunction max98363_sdw_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2022, Analog Devices Inc.
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_registers.h>
#include <linux/soundwire/sdw_type.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include "max98363.h"
static const struct reg_default max98363_reg[] = {
{MAX98363_R2021_ERR_MON_CTRL, 0x0},
{MAX98363_R2022_SPK_MON_THRESH, 0x0},
{MAX98363_R2023_SPK_MON_DURATION, 0x0},
{MAX98363_R2030_TONE_GEN_CFG, 0x0},
{MAX98363_R203F_TONE_GEN_EN, 0x0},
{MAX98363_R2040_AMP_VOL, 0x0},
{MAX98363_R2041_AMP_GAIN, 0x5},
{MAX98363_R2042_DSP_CFG, 0x0},
};
static bool max98363_readable_register(struct device *dev, unsigned int reg)
{
switch (reg) {
case MAX98363_R2001_INTR_RAW:
case MAX98363_R2003_INTR_STATE:
case MAX98363_R2005_INTR_FALG:
case MAX98363_R2007_INTR_EN:
case MAX98363_R2009_INTR_CLR:
case MAX98363_R2021_ERR_MON_CTRL ... MAX98363_R2023_SPK_MON_DURATION:
case MAX98363_R2030_TONE_GEN_CFG:
case MAX98363_R203F_TONE_GEN_EN:
case MAX98363_R2040_AMP_VOL:
case MAX98363_R2041_AMP_GAIN:
case MAX98363_R2042_DSP_CFG:
case MAX98363_R21FF_REV_ID:
return true;
default:
return false;
}
};
static bool max98363_volatile_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case MAX98363_R2001_INTR_RAW:
case MAX98363_R2003_INTR_STATE:
case MAX98363_R2005_INTR_FALG:
case MAX98363_R2007_INTR_EN:
case MAX98363_R2009_INTR_CLR:
case MAX98363_R21FF_REV_ID:
return true;
default:
return false;
}
}
static const struct regmap_config max98363_sdw_regmap = {
.reg_bits = 32,
.val_bits = 8,
.max_register = MAX98363_R21FF_REV_ID,
.reg_defaults = max98363_reg,
.num_reg_defaults = ARRAY_SIZE(max98363_reg),
.readable_reg = max98363_readable_register,
.volatile_reg = max98363_volatile_reg,
.cache_type = REGCACHE_RBTREE,
.use_single_read = true,
.use_single_write = true,
};
static int max98363_suspend(struct device *dev)
{
struct max98363_priv *max98363 = dev_get_drvdata(dev);
regcache_cache_only(max98363->regmap, true);
regcache_mark_dirty(max98363->regmap);
return 0;
}
#define MAX98363_PROBE_TIMEOUT 5000
static int max98363_resume(struct device *dev)
{
Annotation
- Immediate include surface: `linux/module.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `linux/soundwire/sdw.h`, `linux/soundwire/sdw_registers.h`, `linux/soundwire/sdw_type.h`, `sound/pcm.h`, `sound/pcm_params.h`.
- Detected declarations: `function max98363_readable_register`, `function max98363_volatile_reg`, `function max98363_suspend`, `function max98363_resume`, `function max98363_read_prop`, `function max98363_io_init`, `function max98363_sdw_dai_hw_params`, `function max98363_pcm_hw_free`, `function max98363_set_sdw_stream`, `function max98363_update_status`.
- 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.