drivers/gpu/drm/tegra/hub.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/tegra/hub.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/tegra/hub.c- Extension
.c- Size
- 33723 bytes
- Lines
- 1234
- 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/delay.hlinux/dma-mapping.hlinux/host1x.hlinux/module.hlinux/of.hlinux/of_graph.hlinux/of_platform.hlinux/platform_device.hlinux/pm_runtime.hlinux/reset.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_blend.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_print.hdrm/drm_probe_helper.hdrm.hdc.hplane.h
Detected Declarations
function tegra_plane_offsetfunction tegra_plane_readlfunction tegra_plane_writelfunction tegra_windowgroup_enablefunction tegra_windowgroup_disablefunction tegra_display_hub_preparefunction tegra_display_hub_cleanupfunction tegra_shared_plane_updatefunction tegra_shared_plane_activatefunction tegra_shared_plane_get_ownerfunction tegra_dc_owns_shared_planefunction tegra_shared_plane_set_ownerfunction tegra_shared_plane_setup_scalerfunction tegra_dc_assign_shared_planefunction tegra_dc_remove_shared_planefunction tegra_shared_plane_atomic_checkfunction tegra_shared_plane_atomic_disablefunction compute_phase_incrfunction tegra_shared_plane_atomic_updatefunction tegra_display_hub_duplicate_statefunction tegra_display_hub_destroy_statefunction tegra_display_hub_create_statefunction tegra_display_hub_get_statefunction tegra_display_hub_atomic_checkfunction tegra_display_hub_updatefunction tegra_display_hub_atomic_commitfunction tegra_display_hub_initfunction tegra_display_hub_exitfunction tegra_display_hub_runtime_suspendfunction tegra_display_hub_runtime_resumefunction tegra_display_hub_probefunction tegra_display_hub_remove
Annotated Snippet
if (err < 0) {
dev_err(wgrp->parent->dev, "failed to resume: %d\n", err);
goto unlock;
}
reset_control_deassert(wgrp->rst);
}
wgrp->usecount++;
unlock:
mutex_unlock(&wgrp->lock);
return err;
}
static void tegra_windowgroup_disable(struct tegra_windowgroup *wgrp)
{
int err;
mutex_lock(&wgrp->lock);
if (wgrp->usecount == 1) {
err = reset_control_assert(wgrp->rst);
if (err < 0) {
pr_err("failed to assert reset for window group %u\n",
wgrp->index);
}
host1x_client_suspend(wgrp->parent);
}
wgrp->usecount--;
mutex_unlock(&wgrp->lock);
}
int tegra_display_hub_prepare(struct tegra_display_hub *hub)
{
unsigned int i;
/*
* XXX Enabling/disabling windowgroups needs to happen when the owner
* display controller is disabled. There's currently no good point at
* which this could be executed, so unconditionally enable all window
* groups for now.
*/
for (i = 0; i < hub->soc->num_wgrps; i++) {
struct tegra_windowgroup *wgrp = &hub->wgrps[i];
/* Skip orphaned window group whose parent DC is disabled */
if (wgrp->parent)
tegra_windowgroup_enable(wgrp);
}
return 0;
}
void tegra_display_hub_cleanup(struct tegra_display_hub *hub)
{
unsigned int i;
/*
* XXX Remove this once window groups can be more fine-grainedly
* enabled and disabled.
*/
for (i = 0; i < hub->soc->num_wgrps; i++) {
struct tegra_windowgroup *wgrp = &hub->wgrps[i];
/* Skip orphaned window group whose parent DC is disabled */
if (wgrp->parent)
tegra_windowgroup_disable(wgrp);
}
}
static void tegra_shared_plane_update(struct tegra_plane *plane)
{
struct tegra_dc *dc = plane->dc;
unsigned long timeout;
u32 mask, value;
mask = COMMON_UPDATE | WIN_A_UPDATE << plane->base.index;
tegra_dc_writel(dc, mask, DC_CMD_STATE_CONTROL);
timeout = jiffies + msecs_to_jiffies(1000);
while (time_before(jiffies, timeout)) {
value = tegra_dc_readl(dc, DC_CMD_STATE_CONTROL);
if ((value & mask) == 0)
break;
usleep_range(100, 400);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/host1x.h`, `linux/module.h`, `linux/of.h`, `linux/of_graph.h`, `linux/of_platform.h`.
- Detected declarations: `function tegra_plane_offset`, `function tegra_plane_readl`, `function tegra_plane_writel`, `function tegra_windowgroup_enable`, `function tegra_windowgroup_disable`, `function tegra_display_hub_prepare`, `function tegra_display_hub_cleanup`, `function tegra_shared_plane_update`, `function tegra_shared_plane_activate`, `function tegra_shared_plane_get_owner`.
- 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.