drivers/gpu/host1x/tegra114-mipi.c
Source file repositories/reference/linux-study-clean/drivers/gpu/host1x/tegra114-mipi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/host1x/tegra114-mipi.c- Extension
.c- Size
- 13856 bytes
- Lines
- 484
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/host1x.hlinux/io.hlinux/iopoll.hlinux/of_platform.hlinux/platform_device.hlinux/slab.hlinux/tegra-mipi-cal.hdev.h
Detected Declarations
struct tegra_mipi_padstruct tegra_mipi_socstruct tegra_mipifunction tegra_mipi_readlfunction tegra_mipi_writelfunction tegra114_mipi_power_upfunction tegra114_mipi_power_downfunction tegra114_mipi_enablefunction tegra114_mipi_disablefunction tegra114_mipi_finish_calibrationfunction tegra114_mipi_start_calibrationfunction tegra_mipi_probe
Annotated Snippet
struct tegra_mipi_pad {
unsigned long data;
unsigned long clk;
};
struct tegra_mipi_soc {
bool has_clk_lane;
const struct tegra_mipi_pad *pads;
unsigned int num_pads;
bool clock_enable_override;
bool needs_vclamp_ref;
/* bias pad configuration settings */
u8 pad_drive_down_ref;
u8 pad_drive_up_ref;
u8 pad_vclamp_level;
u8 pad_vauxp_level;
/* calibration settings for data lanes */
u8 hspdos;
u8 hspuos;
u8 termos;
/* calibration settings for clock lanes */
u8 hsclkpdos;
u8 hsclkpuos;
};
struct tegra_mipi {
const struct tegra_mipi_soc *soc;
struct device *dev;
void __iomem *regs;
struct mutex lock; /* for register access */
struct clk *clk;
unsigned long usage_count;
};
static inline u32 tegra_mipi_readl(struct tegra_mipi *mipi,
unsigned long offset)
{
return readl(mipi->regs + (offset << 2));
}
static inline void tegra_mipi_writel(struct tegra_mipi *mipi, u32 value,
unsigned long offset)
{
writel(value, mipi->regs + (offset << 2));
}
static int tegra114_mipi_power_up(struct tegra_mipi *mipi)
{
u32 value;
int err;
err = clk_enable(mipi->clk);
if (err < 0)
return err;
value = tegra_mipi_readl(mipi, MIPI_CAL_BIAS_PAD_CFG0);
value &= ~MIPI_CAL_BIAS_PAD_PDVCLAMP;
if (mipi->soc->needs_vclamp_ref)
value |= MIPI_CAL_BIAS_PAD_E_VCLAMP_REF;
tegra_mipi_writel(mipi, value, MIPI_CAL_BIAS_PAD_CFG0);
value = tegra_mipi_readl(mipi, MIPI_CAL_BIAS_PAD_CFG2);
value &= ~MIPI_CAL_BIAS_PAD_PDVREG;
tegra_mipi_writel(mipi, value, MIPI_CAL_BIAS_PAD_CFG2);
clk_disable(mipi->clk);
return 0;
}
static int tegra114_mipi_power_down(struct tegra_mipi *mipi)
{
u32 value;
int err;
err = clk_enable(mipi->clk);
if (err < 0)
return err;
/*
* The MIPI_CAL_BIAS_PAD_PDVREG controls a voltage regulator that
* supplies the DSI pads. This must be kept enabled until none of the
Annotation
- Immediate include surface: `linux/clk.h`, `linux/host1x.h`, `linux/io.h`, `linux/iopoll.h`, `linux/of_platform.h`, `linux/platform_device.h`, `linux/slab.h`, `linux/tegra-mipi-cal.h`.
- Detected declarations: `struct tegra_mipi_pad`, `struct tegra_mipi_soc`, `struct tegra_mipi`, `function tegra_mipi_readl`, `function tegra_mipi_writel`, `function tegra114_mipi_power_up`, `function tegra114_mipi_power_down`, `function tegra114_mipi_enable`, `function tegra114_mipi_disable`, `function tegra114_mipi_finish_calibration`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.