drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c- Extension
.c- Size
- 26008 bytes
- Lines
- 952
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/bitops.hlinux/clk.hlinux/mfd/syscon.hlinux/platform_device.hlinux/regmap.hlinux/reset.hvideo/display_timing.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_crtc.hdrm/drm_drv.hdrm/drm_fb_dma_helper.hdrm/drm_fbdev_dma.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_gem_dma_helper.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_vblank.hdrm/drm_gem_framebuffer_helper.hkirin_drm_drv.hkirin_ade_reg.h
Detected Declarations
struct ade_hw_ctxfunction ade_get_formatfunction ade_update_reload_bitfunction ade_read_reload_bitfunction ade_initfunction ade_crtc_mode_fixupfunction ade_set_pix_clkfunction ade_ldi_set_modefunction ade_power_upfunction ade_power_downfunction ade_set_medianoc_qosfunction ade_crtc_enable_vblankfunction ade_crtc_disable_vblankfunction ade_irq_handlerfunction ade_display_enablefunction ade_rdma_dump_regsfunction ade_clip_dump_regsfunction ade_compositor_routing_dump_regsfunction ade_dump_overlay_compositor_regsfunction ade_dump_regsfunction ade_dump_regsfunction ade_crtc_atomic_disablefunction ade_crtc_mode_set_nofbfunction ade_crtc_atomic_beginfunction ade_crtc_atomic_flushfunction ade_rdma_setfunction ade_rdma_disablefunction ade_clip_setfunction ade_clip_disablefunction has_Alpha_channelfunction ade_get_blending_paramsfunction ade_compositor_routing_setfunction ade_compositor_routing_disablefunction ade_update_channelfunction ade_disable_channelfunction ade_plane_atomic_checkfunction ade_plane_atomic_updatefunction ade_plane_atomic_disablefunction ade_hw_ctx_cleanup
Annotated Snippet
struct ade_hw_ctx {
void __iomem *base;
struct regmap *noc_regmap;
struct clk *ade_core_clk;
struct clk *media_noc_clk;
struct clk *ade_pix_clk;
struct reset_control *reset;
bool power_on;
int irq;
struct drm_crtc *crtc;
};
static const struct kirin_format ade_formats[] = {
/* 16bpp RGB: */
{ DRM_FORMAT_RGB565, ADE_RGB_565 },
{ DRM_FORMAT_BGR565, ADE_BGR_565 },
/* 24bpp RGB: */
{ DRM_FORMAT_RGB888, ADE_RGB_888 },
{ DRM_FORMAT_BGR888, ADE_BGR_888 },
/* 32bpp [A]RGB: */
{ DRM_FORMAT_XRGB8888, ADE_XRGB_8888 },
{ DRM_FORMAT_XBGR8888, ADE_XBGR_8888 },
{ DRM_FORMAT_RGBA8888, ADE_RGBA_8888 },
{ DRM_FORMAT_BGRA8888, ADE_BGRA_8888 },
{ DRM_FORMAT_ARGB8888, ADE_ARGB_8888 },
{ DRM_FORMAT_ABGR8888, ADE_ABGR_8888 },
};
static const u32 channel_formats[] = {
/* channel 1,2,3,4 */
DRM_FORMAT_RGB565, DRM_FORMAT_BGR565, DRM_FORMAT_RGB888,
DRM_FORMAT_BGR888, DRM_FORMAT_XRGB8888, DRM_FORMAT_XBGR8888,
DRM_FORMAT_RGBA8888, DRM_FORMAT_BGRA8888, DRM_FORMAT_ARGB8888,
DRM_FORMAT_ABGR8888
};
/* convert from fourcc format to ade format */
static u32 ade_get_format(u32 pixel_format)
{
int i;
for (i = 0; i < ARRAY_SIZE(ade_formats); i++)
if (ade_formats[i].pixel_format == pixel_format)
return ade_formats[i].hw_format;
/* not found */
DRM_ERROR("Not found pixel format!!fourcc_format= %d\n",
pixel_format);
return ADE_FORMAT_UNSUPPORT;
}
static void ade_update_reload_bit(void __iomem *base, u32 bit_num, u32 val)
{
u32 bit_ofst, reg_num;
bit_ofst = bit_num % 32;
reg_num = bit_num / 32;
ade_update_bits(base + ADE_RELOAD_DIS(reg_num), bit_ofst,
MASK(1), !!val);
}
static u32 ade_read_reload_bit(void __iomem *base, u32 bit_num)
{
u32 tmp, bit_ofst, reg_num;
bit_ofst = bit_num % 32;
reg_num = bit_num / 32;
tmp = readl(base + ADE_RELOAD_DIS(reg_num));
return !!(BIT(bit_ofst) & tmp);
}
static void ade_init(struct ade_hw_ctx *ctx)
{
void __iomem *base = ctx->base;
/* enable clk gate */
ade_update_bits(base + ADE_CTRL1, AUTO_CLK_GATE_EN_OFST,
AUTO_CLK_GATE_EN, ADE_ENABLE);
/* clear overlay */
writel(0, base + ADE_OVLY1_TRANS_CFG);
writel(0, base + ADE_OVLY_CTL);
writel(0, base + ADE_OVLYX_CTL(OUT_OVLY));
/* clear reset and reload regs */
writel(MASK(32), base + ADE_SOFT_RST_SEL(0));
writel(MASK(32), base + ADE_SOFT_RST_SEL(1));
writel(MASK(32), base + ADE_RELOAD_DIS(0));
writel(MASK(32), base + ADE_RELOAD_DIS(1));
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/clk.h`, `linux/mfd/syscon.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/reset.h`, `video/display_timing.h`, `drm/drm_atomic.h`.
- Detected declarations: `struct ade_hw_ctx`, `function ade_get_format`, `function ade_update_reload_bit`, `function ade_read_reload_bit`, `function ade_init`, `function ade_crtc_mode_fixup`, `function ade_set_pix_clk`, `function ade_ldi_set_mode`, `function ade_power_up`, `function ade_power_down`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.