drivers/gpu/drm/imx/dc/dc-cf.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imx/dc/dc-cf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/imx/dc/dc-cf.c- Extension
.c- Size
- 3879 bytes
- Lines
- 173
- 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/bitfield.hlinux/bits.hlinux/component.hlinux/ioport.hlinux/mod_devicetable.hlinux/module.hlinux/platform_device.hlinux/regmap.hdc-drv.hdc-pe.h
Detected Declarations
function dc_cf_enable_shdenfunction dc_cf_get_link_idfunction dc_cf_framedimensionsfunction dc_cf_constantcolor_blackfunction dc_cf_constantcolor_bluefunction dc_cf_initfunction dc_cf_bindfunction dc_cf_probefunction dc_cf_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2024 NXP
*/
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/component.h>
#include <linux/ioport.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include "dc-drv.h"
#include "dc-pe.h"
#define STATICCONTROL 0x8
#define FRAMEDIMENSIONS 0xc
#define HEIGHT(x) FIELD_PREP(GENMASK(29, 16), ((x) - 1))
#define WIDTH(x) FIELD_PREP(GENMASK(13, 0), ((x) - 1))
#define CONSTANTCOLOR 0x10
#define BLUE(x) FIELD_PREP(GENMASK(15, 8), (x))
static const struct dc_subdev_info dc_cf_info[] = {
{ .reg_start = 0x56180960, .id = 0, },
{ .reg_start = 0x561809e0, .id = 1, },
{ .reg_start = 0x561809a0, .id = 4, },
{ .reg_start = 0x56180a20, .id = 5, },
};
static const struct regmap_range dc_cf_regmap_ranges[] = {
regmap_reg_range(STATICCONTROL, CONSTANTCOLOR),
};
static const struct regmap_access_table dc_cf_regmap_access_table = {
.yes_ranges = dc_cf_regmap_ranges,
.n_yes_ranges = ARRAY_SIZE(dc_cf_regmap_ranges),
};
static const struct regmap_config dc_cf_cfg_regmap_config = {
.name = "cfg",
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
.fast_io = true,
.wr_table = &dc_cf_regmap_access_table,
.rd_table = &dc_cf_regmap_access_table,
.max_register = CONSTANTCOLOR,
};
static inline void dc_cf_enable_shden(struct dc_cf *cf)
{
regmap_write(cf->reg_cfg, STATICCONTROL, SHDEN);
}
enum dc_link_id dc_cf_get_link_id(struct dc_cf *cf)
{
return cf->link;
}
void dc_cf_framedimensions(struct dc_cf *cf, unsigned int w,
unsigned int h)
{
regmap_write(cf->reg_cfg, FRAMEDIMENSIONS, WIDTH(w) | HEIGHT(h));
}
void dc_cf_constantcolor_black(struct dc_cf *cf)
{
regmap_write(cf->reg_cfg, CONSTANTCOLOR, 0);
}
void dc_cf_constantcolor_blue(struct dc_cf *cf)
{
regmap_write(cf->reg_cfg, CONSTANTCOLOR, BLUE(0xff));
}
void dc_cf_init(struct dc_cf *cf)
{
dc_cf_enable_shden(cf);
}
static int dc_cf_bind(struct device *dev, struct device *master, void *data)
{
struct platform_device *pdev = to_platform_device(dev);
struct dc_drm_device *dc_drm = data;
struct resource *res_pec;
void __iomem *base_cfg;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bits.h`, `linux/component.h`, `linux/ioport.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/platform_device.h`, `linux/regmap.h`.
- Detected declarations: `function dc_cf_enable_shden`, `function dc_cf_get_link_id`, `function dc_cf_framedimensions`, `function dc_cf_constantcolor_black`, `function dc_cf_constantcolor_blue`, `function dc_cf_init`, `function dc_cf_bind`, `function dc_cf_probe`, `function dc_cf_remove`.
- 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.