sound/soc/codecs/sti-sas.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/sti-sas.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/sti-sas.c- Extension
.c- Size
- 12111 bytes
- Lines
- 466
- 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/io.hlinux/module.hlinux/regmap.hlinux/reset.hlinux/mfd/syscon.hsound/soc.hsound/soc-dapm.h
Detected Declarations
struct sti_dac_audiostruct sti_spdif_audiostruct sti_sas_dev_datastruct sti_sas_datafunction sti_sas_read_regfunction sti_sas_write_regfunction sti_sas_init_sas_registersfunction sti_sas_dac_set_fmtfunction stih407_sas_dac_mutefunction sti_sas_spdif_set_fmtfunction sti_sas_spdif_triggerfunction sti_sas_volatile_registerfunction sti_sas_set_sysclkfunction sti_sas_preparefunction sti_sas_resumefunction sti_sas_component_probefunction sti_sas_driver_probe
Annotated Snippet
struct sti_dac_audio {
struct regmap *regmap;
struct regmap *virt_regmap;
int mclk;
};
struct sti_spdif_audio {
struct regmap *regmap;
int mclk;
};
/* device data structure */
struct sti_sas_dev_data {
const struct regmap_config *regmap;
const struct snd_soc_dai_ops *dac_ops; /* DAC function callbacks */
};
/* driver data structure */
struct sti_sas_data {
struct device *dev;
const struct sti_sas_dev_data *dev_data;
struct sti_dac_audio dac;
struct sti_spdif_audio spdif;
};
/* Read a register from the sysconf reg bank */
static int sti_sas_read_reg(void *context, unsigned int reg,
unsigned int *value)
{
struct sti_sas_data *drvdata = context;
int status;
u32 val;
status = regmap_read(drvdata->dac.regmap, reg, &val);
*value = (unsigned int)val;
return status;
}
/* Read a register from the sysconf reg bank */
static int sti_sas_write_reg(void *context, unsigned int reg,
unsigned int value)
{
struct sti_sas_data *drvdata = context;
return regmap_write(drvdata->dac.regmap, reg, value);
}
static int sti_sas_init_sas_registers(struct snd_soc_component *component,
struct sti_sas_data *data)
{
int ret;
/*
* DAC and SPDIF are activated by default
* put them in IDLE to save power
*/
/* Initialise bi-phase formatter to disabled */
ret = snd_soc_component_update_bits(component, STIH407_AUDIO_GLUE_CTRL,
SPDIF_BIPHASE_ENABLE_MASK, 0);
if (!ret)
/* Initialise bi-phase formatter idle value to 0 */
ret = snd_soc_component_update_bits(component, STIH407_AUDIO_GLUE_CTRL,
SPDIF_BIPHASE_IDLE_MASK, 0);
if (ret < 0) {
dev_err(component->dev, "Failed to update SPDIF registers\n");
return ret;
}
/* Init DAC configuration */
/* init configuration */
ret = snd_soc_component_update_bits(component, STIH407_AUDIO_DAC_CTRL,
STIH407_DAC_STANDBY_MASK,
STIH407_DAC_STANDBY_MASK);
if (!ret)
ret = snd_soc_component_update_bits(component, STIH407_AUDIO_DAC_CTRL,
STIH407_DAC_STANDBY_ANA_MASK,
STIH407_DAC_STANDBY_ANA_MASK);
if (!ret)
ret = snd_soc_component_update_bits(component, STIH407_AUDIO_DAC_CTRL,
STIH407_DAC_SOFTMUTE_MASK,
STIH407_DAC_SOFTMUTE_MASK);
if (ret < 0) {
dev_err(component->dev, "Failed to update DAC registers\n");
return ret;
}
Annotation
- Immediate include surface: `linux/io.h`, `linux/module.h`, `linux/regmap.h`, `linux/reset.h`, `linux/mfd/syscon.h`, `sound/soc.h`, `sound/soc-dapm.h`.
- Detected declarations: `struct sti_dac_audio`, `struct sti_spdif_audio`, `struct sti_sas_dev_data`, `struct sti_sas_data`, `function sti_sas_read_reg`, `function sti_sas_write_reg`, `function sti_sas_init_sas_registers`, `function sti_sas_dac_set_fmt`, `function stih407_sas_dac_mute`, `function sti_sas_spdif_set_fmt`.
- 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.