drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c- Extension
.c- Size
- 7240 bytes
- Lines
- 298
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/io.hlinux/mm.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pm.hlinux/pm_runtime.hlinux/slab.hdrm/clients/drm_client_setup.hdrm/drm_atomic_helper.hdrm/drm_drv.hdrm/drm_fbdev_dma.hdrm/drm_fourcc.hdrm/drm_gem_dma_helper.hdrm/drm_modeset_helper.hdrm/drm_module.hdrm/drm_probe_helper.hdrm/drm_vblank.hshmob_drm_drv.hshmob_drm_kms.hshmob_drm_plane.hshmob_drm_regs.h
Detected Declarations
function Copyrightfunction shmob_drm_irqfunction shmob_drm_pm_suspendfunction shmob_drm_pm_resumefunction shmob_drm_pm_runtime_suspendfunction shmob_drm_pm_runtime_resumefunction shmob_drm_removefunction shmob_drm_shutdownfunction shmob_drm_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* shmob_drm_drv.c -- SH Mobile DRM driver
*
* Copyright (C) 2012 Renesas Electronics Corporation
*
* Laurent Pinchart (laurent.pinchart@ideasonboard.com)
*/
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <drm/clients/drm_client_setup.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_fbdev_dma.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_gem_dma_helper.h>
#include <drm/drm_modeset_helper.h>
#include <drm/drm_module.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_vblank.h>
#include "shmob_drm_drv.h"
#include "shmob_drm_kms.h"
#include "shmob_drm_plane.h"
#include "shmob_drm_regs.h"
/* -----------------------------------------------------------------------------
* Hardware initialization
*/
static int shmob_drm_setup_clocks(struct shmob_drm_device *sdev,
enum shmob_drm_clk_source clksrc)
{
struct clk *clk;
char *clkname;
switch (clksrc) {
case SHMOB_DRM_CLK_BUS:
clkname = "fck";
sdev->lddckr = LDDCKR_ICKSEL_BUS;
break;
case SHMOB_DRM_CLK_PERIPHERAL:
clkname = "media";
sdev->lddckr = LDDCKR_ICKSEL_MIPI;
break;
case SHMOB_DRM_CLK_EXTERNAL:
clkname = "lclk";
sdev->lddckr = LDDCKR_ICKSEL_HDMI;
break;
default:
return -EINVAL;
}
clk = devm_clk_get(sdev->dev, clkname);
if (IS_ERR(clk)) {
dev_err(sdev->dev, "cannot get dot clock %s\n", clkname);
return PTR_ERR(clk);
}
sdev->clock = clk;
return 0;
}
/* -----------------------------------------------------------------------------
* DRM operations
*/
static irqreturn_t shmob_drm_irq(int irq, void *arg)
{
struct drm_device *dev = arg;
struct shmob_drm_device *sdev = to_shmob_device(dev);
unsigned long flags;
u32 status;
/* Acknowledge interrupts. Putting interrupt enable and interrupt flag
* bits in the same register is really brain-dead design and requires
* taking a spinlock.
*/
spin_lock_irqsave(&sdev->irq_lock, flags);
status = lcdc_read(sdev, LDINTR);
lcdc_write(sdev, LDINTR, status ^ LDINTR_STATUS_MASK);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/io.h`, `linux/mm.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/pm.h`, `linux/pm_runtime.h`.
- Detected declarations: `function Copyright`, `function shmob_drm_irq`, `function shmob_drm_pm_suspend`, `function shmob_drm_pm_resume`, `function shmob_drm_pm_runtime_suspend`, `function shmob_drm_pm_runtime_resume`, `function shmob_drm_remove`, `function shmob_drm_shutdown`, `function shmob_drm_probe`.
- 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.