drivers/gpu/drm/imx/dc/dc-tc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imx/dc/dc-tc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/imx/dc/dc-tc.c- Extension
.c- Size
- 3362 bytes
- Lines
- 142
- 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/component.hlinux/mod_devicetable.hlinux/module.hlinux/platform_device.hlinux/regmap.hdc-drv.hdc-de.h
Detected Declarations
function dc_tc_initfunction dc_tc_bindfunction dc_tc_probefunction dc_tc_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2024 NXP
*/
#include <linux/component.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-de.h"
#define TCON_CTRL 0x410
#define CTRL_RST_VAL 0x01401408
/* red: MAPBIT 29-20, green: MAPBIT 19-10, blue: MAPBIT 9-0 */
#define MAPBIT3_0 0x418
#define MAPBIT7_4 0x41c
#define MAPBIT11_8 0x420
#define MAPBIT15_12 0x424
#define MAPBIT19_16 0x428
#define MAPBIT23_20 0x42c
#define MAPBIT27_24 0x430
#define MAPBIT31_28 0x434
static const struct dc_subdev_info dc_tc_info[] = {
{ .reg_start = 0x5618c800, .id = 0, },
{ .reg_start = 0x5618e400, .id = 1, },
};
static const struct regmap_range dc_tc_regmap_ranges[] = {
regmap_reg_range(TCON_CTRL, TCON_CTRL),
regmap_reg_range(MAPBIT3_0, MAPBIT31_28),
};
static const struct regmap_access_table dc_tc_regmap_access_table = {
.yes_ranges = dc_tc_regmap_ranges,
.n_yes_ranges = ARRAY_SIZE(dc_tc_regmap_ranges),
};
static const struct regmap_config dc_tc_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
.fast_io = true,
.wr_table = &dc_tc_regmap_access_table,
.rd_table = &dc_tc_regmap_access_table,
.max_register = MAPBIT31_28,
};
/*
* The pixels reach TCON are always in 30-bit BGR format.
* The first bridge always receives pixels in 30-bit RGB format.
* So, map the format to MEDIA_BUS_FMT_RGB101010_1X30.
*/
static const u32 dc_tc_mapbit[] = {
0x17161514, 0x1b1a1918, 0x0b0a1d1c, 0x0f0e0d0c,
0x13121110, 0x03020100, 0x07060504, 0x00000908,
};
void dc_tc_init(struct dc_tc *tc)
{
/* reset TCON_CTRL to POR default so that TCON works in bypass mode */
regmap_write(tc->reg, TCON_CTRL, CTRL_RST_VAL);
/* set format */
regmap_bulk_write(tc->reg, MAPBIT3_0, dc_tc_mapbit,
ARRAY_SIZE(dc_tc_mapbit));
}
static int dc_tc_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;
void __iomem *base;
struct dc_tc *tc;
int id;
tc = devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL);
if (!tc)
return -ENOMEM;
base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(base))
return PTR_ERR(base);
tc->reg = devm_regmap_init_mmio(dev, base, &dc_tc_regmap_config);
Annotation
- Immediate include surface: `linux/component.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/platform_device.h`, `linux/regmap.h`, `dc-drv.h`, `dc-de.h`.
- Detected declarations: `function dc_tc_init`, `function dc_tc_bind`, `function dc_tc_probe`, `function dc_tc_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.