sound/soc/codecs/tas2770.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/tas2770.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/tas2770.c- Extension
.c- Size
- 25559 bytes
- Lines
- 987
- 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/moduleparam.hlinux/err.hlinux/init.hlinux/delay.hlinux/hwmon.hlinux/pm.hlinux/i2c.hlinux/gpio/consumer.hlinux/regulator/consumer.hlinux/firmware.hlinux/regmap.hlinux/of.hlinux/slab.hsound/soc.hsound/pcm.hsound/pcm_params.hsound/initval.hsound/tlv.htas2770.h
Detected Declarations
function tas2770_resetfunction tas2770_update_pwr_ctrlfunction tas2770_codec_suspendfunction tas2770_codec_resumefunction tas2770_dac_eventfunction sense_eventfunction tas2770_mutefunction tas2770_set_ivsense_transmitfunction tas2770_set_pdm_transmitfunction tas2770_set_bitwidthfunction tas2770_set_sampleratefunction tas2770_hw_paramsfunction tas2770_set_fmtfunction tas2770_set_dai_tdm_slotfunction tas2770_set_dai_tdm_idlefunction tas2770_read_die_tempfunction tas2770_hwmon_is_faultfunction tas2770_hwmon_is_visiblefunction tas2770_hwmon_readfunction tas2770_codec_probefunction tas2770_register_codecfunction tas2770_volatilefunction tas2770_writeablefunction tas2770_parse_dtfunction tas2770_i2c_probe
Annotated Snippet
if (ret < 0) {
regcache_cache_only(tas2770->regmap, false);
regcache_sync(tas2770->regmap);
return ret;
}
ret = 0;
}
return ret;
}
static int tas2770_codec_resume(struct snd_soc_component *component)
{
struct tas2770_priv *tas2770 = snd_soc_component_get_drvdata(component);
int ret;
if (tas2770->sdz_gpio) {
gpiod_set_value_cansleep(tas2770->sdz_gpio, 1);
usleep_range(1000, 2000);
} else {
ret = tas2770_update_pwr_ctrl(tas2770);
if (ret < 0)
return ret;
}
regcache_cache_only(tas2770->regmap, false);
return regcache_sync(tas2770->regmap);
}
#else
#define tas2770_codec_suspend NULL
#define tas2770_codec_resume NULL
#endif
static const char * const tas2770_ASI1_src[] = {
"I2C offset", "Left", "Right", "LeftRightDiv2",
};
static SOC_ENUM_SINGLE_DECL(
tas2770_ASI1_src_enum, TAS2770_TDM_CFG_REG2,
4, tas2770_ASI1_src);
static const struct snd_kcontrol_new tas2770_asi1_mux =
SOC_DAPM_ENUM("ASI1 Source", tas2770_ASI1_src_enum);
static int tas2770_dac_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_component *component =
snd_soc_dapm_to_component(w->dapm);
struct tas2770_priv *tas2770 =
snd_soc_component_get_drvdata(component);
int ret;
switch (event) {
case SND_SOC_DAPM_POST_PMU:
tas2770->dac_powered = 1;
ret = tas2770_update_pwr_ctrl(tas2770);
break;
case SND_SOC_DAPM_PRE_PMD:
tas2770->dac_powered = 0;
ret = tas2770_update_pwr_ctrl(tas2770);
break;
default:
dev_err(tas2770->dev, "Not supported evevt\n");
return -EINVAL;
}
return ret;
}
static const struct snd_kcontrol_new isense_switch =
SOC_DAPM_SINGLE("Switch", TAS2770_PWR_CTRL, 3, 1, 1);
static const struct snd_kcontrol_new vsense_switch =
SOC_DAPM_SINGLE("Switch", TAS2770_PWR_CTRL, 2, 1, 1);
static int sense_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct tas2770_priv *tas2770 = snd_soc_component_get_drvdata(component);
/*
* Powering up ISENSE/VSENSE requires a trip through the shutdown state.
* Do that here to ensure that our changes are applied properly, otherwise
* we might end up with non-functional IVSENSE if playback started earlier,
* which would break software speaker protection.
*/
switch (event) {
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/err.h`, `linux/init.h`, `linux/delay.h`, `linux/hwmon.h`, `linux/pm.h`, `linux/i2c.h`.
- Detected declarations: `function tas2770_reset`, `function tas2770_update_pwr_ctrl`, `function tas2770_codec_suspend`, `function tas2770_codec_resume`, `function tas2770_dac_event`, `function sense_event`, `function tas2770_mute`, `function tas2770_set_ivsense_transmit`, `function tas2770_set_pdm_transmit`, `function tas2770_set_bitwidth`.
- 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.