drivers/gpu/drm/fsl-dcu/fsl_tcon.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/fsl-dcu/fsl_tcon.c- Extension
.c- Size
- 2218 bytes
- Lines
- 108
- 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/clk.hlinux/io.hlinux/mm.hlinux/of_address.hlinux/platform_device.hlinux/regmap.hfsl_tcon.h
Detected Declarations
function fsl_tcon_bypass_disablefunction fsl_tcon_bypass_enablefunction fsl_tcon_init_regmapfunction fsl_tcon_free
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright 2015 Toradex AG
*
* Stefan Agner <stefan@agner.ch>
*
* Freescale TCON device driver
*/
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/mm.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include "fsl_tcon.h"
void fsl_tcon_bypass_disable(struct fsl_tcon *tcon)
{
regmap_update_bits(tcon->regs, FSL_TCON_CTRL1,
FSL_TCON_CTRL1_TCON_BYPASS, 0);
}
void fsl_tcon_bypass_enable(struct fsl_tcon *tcon)
{
regmap_update_bits(tcon->regs, FSL_TCON_CTRL1,
FSL_TCON_CTRL1_TCON_BYPASS,
FSL_TCON_CTRL1_TCON_BYPASS);
}
static const struct regmap_config fsl_tcon_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
.name = "tcon",
};
static int fsl_tcon_init_regmap(struct device *dev,
struct fsl_tcon *tcon,
struct device_node *np)
{
struct resource res;
void __iomem *regs;
if (of_address_to_resource(np, 0, &res))
return -EINVAL;
regs = devm_ioremap_resource(dev, &res);
if (IS_ERR(regs))
return PTR_ERR(regs);
tcon->regs = devm_regmap_init_mmio(dev, regs,
&fsl_tcon_regmap_config);
return PTR_ERR_OR_ZERO(tcon->regs);
}
struct fsl_tcon *fsl_tcon_init(struct device *dev)
{
struct fsl_tcon *tcon;
struct device_node *np;
int ret;
/* TCON node is not mandatory, some devices do not provide TCON */
np = of_parse_phandle(dev->of_node, "fsl,tcon", 0);
if (!np)
return NULL;
tcon = devm_kzalloc(dev, sizeof(*tcon), GFP_KERNEL);
if (!tcon)
goto err_node_put;
ret = fsl_tcon_init_regmap(dev, tcon, np);
if (ret) {
dev_err(dev, "Couldn't create the TCON regmap\n");
goto err_node_put;
}
tcon->ipg_clk = of_clk_get_by_name(np, "ipg");
if (IS_ERR(tcon->ipg_clk)) {
dev_err(dev, "Couldn't get the TCON bus clock\n");
goto err_node_put;
}
ret = clk_prepare_enable(tcon->ipg_clk);
if (ret) {
dev_err(dev, "Couldn't enable the TCON clock\n");
goto err_node_put;
}
Annotation
- Immediate include surface: `linux/clk.h`, `linux/io.h`, `linux/mm.h`, `linux/of_address.h`, `linux/platform_device.h`, `linux/regmap.h`, `fsl_tcon.h`.
- Detected declarations: `function fsl_tcon_bypass_disable`, `function fsl_tcon_bypass_enable`, `function fsl_tcon_init_regmap`, `function fsl_tcon_free`.
- 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.