drivers/gpu/drm/amd/display/dc/core/dc_sink.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/core/dc_sink.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/core/dc_sink.c- Extension
.c- Size
- 3169 bytes
- Lines
- 101
- 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
dm_services.hdm_helpers.hcore_types.h
Detected Declarations
function filesfunction dc_sink_retainfunction dc_sink_freefunction dc_sink_release
Annotated Snippet
#include "dm_services.h"
#include "dm_helpers.h"
#include "core_types.h"
/*******************************************************************************
* Private functions
******************************************************************************/
static bool dc_sink_construct(struct dc_sink *sink, const struct dc_sink_init_data *init_params)
{
struct dc_link *link = init_params->link;
if (!link)
return false;
sink->sink_signal = init_params->sink_signal;
sink->link = link;
sink->ctx = link->ctx;
sink->dongle_max_pix_clk = init_params->dongle_max_pix_clk;
sink->converter_disable_audio = init_params->converter_disable_audio;
sink->dc_container_id = NULL;
sink->sink_id = init_params->link->ctx->dc_sink_id_count;
// increment dc_sink_id_count because we don't want two sinks with same ID
// unless they are actually the same
init_params->link->ctx->dc_sink_id_count++;
return true;
}
/*******************************************************************************
* Public functions
******************************************************************************/
void dc_sink_retain(struct dc_sink *sink)
{
kref_get(&sink->refcount);
}
static void dc_sink_free(struct kref *kref)
{
struct dc_sink *sink = container_of(kref, struct dc_sink, refcount);
kfree(sink->dc_container_id);
kfree(sink);
}
void dc_sink_release(struct dc_sink *sink)
{
kref_put(&sink->refcount, dc_sink_free);
}
struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
{
struct dc_sink *sink = kzalloc_obj(*sink);
if (NULL == sink)
goto alloc_fail;
if (false == dc_sink_construct(sink, init_params))
goto construct_fail;
kref_init(&sink->refcount);
return sink;
construct_fail:
kfree(sink);
alloc_fail:
return NULL;
}
/*******************************************************************************
* Protected functions - visible only inside of DC (not visible in DM)
******************************************************************************/
Annotation
- Immediate include surface: `dm_services.h`, `dm_helpers.h`, `core_types.h`.
- Detected declarations: `function files`, `function dc_sink_retain`, `function dc_sink_free`, `function dc_sink_release`.
- 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.