sound/hda/controllers/tegra.c
Source file repositories/reference/linux-study-clean/sound/hda/controllers/tegra.c
File Facts
- System
- Linux kernel
- Corpus path
sound/hda/controllers/tegra.c- Extension
.c- Size
- 16425 bytes
- Lines
- 649
- Domain
- Driver Families
- Bucket
- sound/hda
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/clk.hlinux/clocksource.hlinux/completion.hlinux/delay.hlinux/dma-mapping.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/module.hlinux/moduleparam.hlinux/mutex.hlinux/of.hlinux/platform_device.hlinux/reset.hlinux/slab.hlinux/time.hlinux/string.hlinux/pm_runtime.hsound/core.hsound/initval.hsound/hda_codec.hhda_controller.h
Detected Declarations
struct hda_tegra_socstruct hda_tegrafunction hda_tegra_initfunction hda_tegra_suspendfunction hda_tegra_resumefunction hda_tegra_runtime_suspendfunction hda_tegra_runtime_resumefunction hda_tegra_dev_disconnectfunction hda_tegra_dev_freefunction hda_tegra_init_chipfunction hda_tegra_first_initfunction hda_tegra_createfunction hda_tegra_probefunction hda_tegra_probe_workfunction hda_tegra_removefunction hda_tegra_shutdown
Annotated Snippet
struct hda_tegra_soc {
bool has_hda2codec_2x_reset;
bool has_hda2hdmi;
bool has_hda2codec_2x;
bool input_stream;
bool always_on;
bool requires_init;
};
struct hda_tegra {
struct azx chip;
struct device *dev;
struct reset_control_bulk_data resets[3];
struct clk_bulk_data clocks[3];
unsigned int nresets;
unsigned int nclocks;
void __iomem *regs;
struct work_struct probe_work;
const struct hda_tegra_soc *soc;
};
#ifdef CONFIG_PM
static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT;
module_param(power_save, bint, 0644);
MODULE_PARM_DESC(power_save,
"Automatic power-saving timeout (in seconds, 0 = disable).");
#else
#define power_save 0
#endif
static const struct hda_controller_ops hda_tegra_ops; /* nothing special */
static void hda_tegra_init(struct hda_tegra *hda)
{
u32 v;
/* Enable PCI access */
v = readl(hda->regs + HDA_IPFS_CONFIG);
v |= HDA_IPFS_EN_FPCI;
writel(v, hda->regs + HDA_IPFS_CONFIG);
/* Enable MEM/IO space and bus master */
v = readl(hda->regs + HDA_CFG_CMD);
v &= ~HDA_DISABLE_INTR;
v |= HDA_ENABLE_MEM_SPACE | HDA_ENABLE_IO_SPACE |
HDA_ENABLE_BUS_MASTER | HDA_ENABLE_SERR;
writel(v, hda->regs + HDA_CFG_CMD);
writel(HDA_BAR0_INIT_PROGRAM, hda->regs + HDA_CFG_BAR0);
writel(HDA_BAR0_FINAL_PROGRAM, hda->regs + HDA_CFG_BAR0);
writel(HDA_FPCI_BAR0_START, hda->regs + HDA_IPFS_FPCI_BAR0);
v = readl(hda->regs + HDA_IPFS_INTR_MASK);
v |= HDA_IPFS_EN_INTR;
writel(v, hda->regs + HDA_IPFS_INTR_MASK);
}
/*
* power management
*/
static int hda_tegra_suspend(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
int rc;
rc = pm_runtime_force_suspend(dev);
if (rc < 0)
return rc;
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
return 0;
}
static int hda_tegra_resume(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
int rc;
rc = pm_runtime_force_resume(dev);
if (rc < 0)
return rc;
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}
static int hda_tegra_runtime_suspend(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
struct azx *chip = card->private_data;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clocksource.h`, `linux/completion.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`.
- Detected declarations: `struct hda_tegra_soc`, `struct hda_tegra`, `function hda_tegra_init`, `function hda_tegra_suspend`, `function hda_tegra_resume`, `function hda_tegra_runtime_suspend`, `function hda_tegra_runtime_resume`, `function hda_tegra_dev_disconnect`, `function hda_tegra_dev_free`, `function hda_tegra_init_chip`.
- Atlas domain: Driver Families / sound/hda.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.