drivers/gpu/drm/tegra/gr3d.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/tegra/gr3d.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/tegra/gr3d.c- Extension
.c- Size
- 14559 bytes
- Lines
- 616
- 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.
- 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/delay.hlinux/host1x.hlinux/iommu.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pm_domain.hlinux/pm_opp.hlinux/pm_runtime.hlinux/reset.hsoc/tegra/common.hsoc/tegra/pmc.hdrm.hgem.hgr3d.h
Detected Declarations
struct gr3d_socstruct gr3dfunction gr3d_initfunction gr3d_exitfunction gr3d_open_channelfunction gr3d_close_channelfunction gr3d_is_addr_regfunction gr3d_power_up_legacy_domainfunction gr3d_init_powerfunction gr3d_get_clocksfunction gr3d_get_resetsfunction gr3d_probefunction gr3d_removefunction gr3d_runtime_suspendfunction gr3d_runtime_resume
Annotated Snippet
struct gr3d_soc {
unsigned int version;
unsigned int num_clocks;
unsigned int num_resets;
};
struct gr3d {
struct tegra_drm_client client;
struct host1x_channel *channel;
const struct gr3d_soc *soc;
struct clk_bulk_data *clocks;
unsigned int nclocks;
struct reset_control_bulk_data resets[RST_GR3D_MAX];
unsigned int nresets;
struct tegra_pmc *pmc;
struct dev_pm_domain_list *pd_list;
DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS);
};
static inline struct gr3d *to_gr3d(struct tegra_drm_client *client)
{
return container_of(client, struct gr3d, client);
}
static int gr3d_init(struct host1x_client *client)
{
struct tegra_drm_client *drm = host1x_to_drm_client(client);
struct drm_device *dev = dev_get_drvdata(client->host);
unsigned long flags = HOST1X_SYNCPT_HAS_BASE;
struct gr3d *gr3d = to_gr3d(drm);
int err;
gr3d->channel = host1x_channel_request(client);
if (!gr3d->channel)
return -ENOMEM;
client->syncpts[0] = host1x_syncpt_request(client, flags);
if (!client->syncpts[0]) {
err = -ENOMEM;
dev_err(client->dev, "failed to request syncpoint: %d\n", err);
goto put;
}
err = host1x_client_iommu_attach(client);
if (err < 0) {
dev_err(client->dev, "failed to attach to domain: %d\n", err);
goto free;
}
err = tegra_drm_register_client(dev->dev_private, drm);
if (err < 0) {
dev_err(client->dev, "failed to register client: %d\n", err);
goto detach_iommu;
}
return 0;
detach_iommu:
host1x_client_iommu_detach(client);
free:
host1x_syncpt_put(client->syncpts[0]);
put:
host1x_channel_put(gr3d->channel);
return err;
}
static int gr3d_exit(struct host1x_client *client)
{
struct tegra_drm_client *drm = host1x_to_drm_client(client);
struct drm_device *dev = dev_get_drvdata(client->host);
struct gr3d *gr3d = to_gr3d(drm);
int err;
err = tegra_drm_unregister_client(dev->dev_private, drm);
if (err < 0)
return err;
host1x_client_iommu_detach(client);
host1x_syncpt_put(client->syncpts[0]);
host1x_channel_put(gr3d->channel);
gr3d->channel = NULL;
return 0;
}
static const struct host1x_client_ops gr3d_client_ops = {
.init = gr3d_init,
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/host1x.h`, `linux/iommu.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/pm_domain.h`.
- Detected declarations: `struct gr3d_soc`, `struct gr3d`, `function gr3d_init`, `function gr3d_exit`, `function gr3d_open_channel`, `function gr3d_close_channel`, `function gr3d_is_addr_reg`, `function gr3d_power_up_legacy_domain`, `function gr3d_init_power`, `function gr3d_get_clocks`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.