drivers/gpu/drm/display/drm_hdmi_cec_helper.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/display/drm_hdmi_cec_helper.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/display/drm_hdmi_cec_helper.c- Extension
.c- Size
- 5549 bytes
- Lines
- 194
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
drm/drm_bridge.hdrm/drm_connector.hdrm/drm_managed.hdrm/display/drm_hdmi_cec_helper.hlinux/export.hlinux/mutex.hmedia/cec.h
Detected Declarations
struct drm_connector_hdmi_cec_datafunction drm_connector_hdmi_cec_adap_enablefunction drm_connector_hdmi_cec_adap_log_addrfunction drm_connector_hdmi_cec_adap_transmitfunction drm_connector_hdmi_cec_adapter_phys_addr_invalidatefunction drm_connector_hdmi_cec_adapter_phys_addr_setfunction drm_connector_hdmi_cec_adapter_unregisterfunction drmm_connector_hdmi_cec_registerfunction drm_connector_hdmi_cec_received_msgfunction drm_connector_hdmi_cec_transmit_attempt_donefunction drm_connector_hdmi_cec_transmit_doneexport drmm_connector_hdmi_cec_registerexport drm_connector_hdmi_cec_received_msgexport drm_connector_hdmi_cec_transmit_attempt_doneexport drm_connector_hdmi_cec_transmit_done
Annotated Snippet
struct drm_connector_hdmi_cec_data {
struct cec_adapter *adapter;
const struct drm_connector_hdmi_cec_funcs *funcs;
};
static int drm_connector_hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)
{
struct drm_connector *connector = cec_get_drvdata(adap);
struct drm_connector_hdmi_cec_data *data = connector->cec.data;
return data->funcs->enable(connector, enable);
}
static int drm_connector_hdmi_cec_adap_log_addr(struct cec_adapter *adap, u8 logical_addr)
{
struct drm_connector *connector = cec_get_drvdata(adap);
struct drm_connector_hdmi_cec_data *data = connector->cec.data;
return data->funcs->log_addr(connector, logical_addr);
}
static int drm_connector_hdmi_cec_adap_transmit(struct cec_adapter *adap, u8 attempts,
u32 signal_free_time, struct cec_msg *msg)
{
struct drm_connector *connector = cec_get_drvdata(adap);
struct drm_connector_hdmi_cec_data *data = connector->cec.data;
return data->funcs->transmit(connector, attempts, signal_free_time, msg);
}
static const struct cec_adap_ops drm_connector_hdmi_cec_adap_ops = {
.adap_enable = drm_connector_hdmi_cec_adap_enable,
.adap_log_addr = drm_connector_hdmi_cec_adap_log_addr,
.adap_transmit = drm_connector_hdmi_cec_adap_transmit,
};
static void drm_connector_hdmi_cec_adapter_phys_addr_invalidate(struct drm_connector *connector)
{
struct drm_connector_hdmi_cec_data *data = connector->cec.data;
cec_phys_addr_invalidate(data->adapter);
}
static void drm_connector_hdmi_cec_adapter_phys_addr_set(struct drm_connector *connector,
u16 addr)
{
struct drm_connector_hdmi_cec_data *data = connector->cec.data;
cec_s_phys_addr(data->adapter, addr, false);
}
static void drm_connector_hdmi_cec_adapter_unregister(struct drm_device *dev, void *res)
{
struct drm_connector *connector = res;
struct drm_connector_hdmi_cec_data *data = connector->cec.data;
cec_unregister_adapter(data->adapter);
if (data->funcs->uninit)
data->funcs->uninit(connector);
kfree(data);
connector->cec.data = NULL;
}
static struct drm_connector_cec_funcs drm_connector_hdmi_cec_adapter_funcs = {
.phys_addr_invalidate = drm_connector_hdmi_cec_adapter_phys_addr_invalidate,
.phys_addr_set = drm_connector_hdmi_cec_adapter_phys_addr_set,
};
int drmm_connector_hdmi_cec_register(struct drm_connector *connector,
const struct drm_connector_hdmi_cec_funcs *funcs,
const char *name,
u8 available_las,
struct device *dev)
{
struct drm_connector_hdmi_cec_data *data;
struct cec_connector_info conn_info;
struct cec_adapter *cec_adap;
int ret;
if (!funcs->init || !funcs->enable || !funcs->log_addr || !funcs->transmit)
return -EINVAL;
data = kzalloc_obj(*data);
if (!data)
return -ENOMEM;
data->funcs = funcs;
Annotation
- Immediate include surface: `drm/drm_bridge.h`, `drm/drm_connector.h`, `drm/drm_managed.h`, `drm/display/drm_hdmi_cec_helper.h`, `linux/export.h`, `linux/mutex.h`, `media/cec.h`.
- Detected declarations: `struct drm_connector_hdmi_cec_data`, `function drm_connector_hdmi_cec_adap_enable`, `function drm_connector_hdmi_cec_adap_log_addr`, `function drm_connector_hdmi_cec_adap_transmit`, `function drm_connector_hdmi_cec_adapter_phys_addr_invalidate`, `function drm_connector_hdmi_cec_adapter_phys_addr_set`, `function drm_connector_hdmi_cec_adapter_unregister`, `function drmm_connector_hdmi_cec_register`, `function drm_connector_hdmi_cec_received_msg`, `function drm_connector_hdmi_cec_transmit_attempt_done`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration 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.