drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c- Extension
.c- Size
- 29211 bytes
- Lines
- 1042
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/delay.hlinux/io.hlinux/media-bus-format.hlinux/module.hlinux/of.hlinux/of_device.hlinux/of_graph.hlinux/platform_device.hlinux/pm_runtime.hlinux/reset.hlinux/slab.hlinux/sys_soc.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_of.hdrm/drm_panel.hdrm/drm_print.hdrm/drm_probe_helper.hrcar_lvds.hrcar_lvds_regs.h
Detected Declarations
struct rcar_lvdsstruct rcar_lvds_device_infostruct rcar_lvdsstruct pll_infoenum rcar_lvds_modeenum rcar_lvds_link_typefunction rcar_lvds_readfunction rcar_lvds_writefunction rcar_lvds_pll_setup_gen2function rcar_lvds_pll_setup_gen3function rcar_lvds_d3_e3_pll_calcfunction rcar_lvds_pll_setup_d3_e3function rcar_lvds_get_lvds_modefunction rcar_lvds_enablefunction rcar_lvds_pclk_enablefunction rcar_lvds_disablefunction rcar_lvds_pclk_enablefunction rcar_lvds_pclk_disablefunction rcar_lvds_atomic_enablefunction rcar_lvds_atomic_disablefunction rcar_lvds_mode_fixupfunction rcar_lvds_destroyfunction rcar_lvds_attachfunction rcar_lvds_dual_linkfunction rcar_lvds_is_connectedfunction rcar_lvds_parse_dt_companionfunction rcar_lvds_parse_dtfunction rcar_lvds_get_clocksfunction rcar_lvds_probefunction rcar_lvds_removefunction rcar_lvds_runtime_suspendfunction rcar_lvds_runtime_resumeexport rcar_lvds_pclk_enableexport rcar_lvds_pclk_disableexport rcar_lvds_dual_linkexport rcar_lvds_is_connected
Annotated Snippet
struct rcar_lvds_device_info {
unsigned int gen;
unsigned int quirks;
void (*pll_setup)(struct rcar_lvds *lvds, unsigned int freq);
};
struct rcar_lvds {
struct device *dev;
const struct rcar_lvds_device_info *info;
struct reset_control *rstc;
struct drm_bridge bridge;
struct drm_bridge *next_bridge;
struct drm_panel *panel;
void __iomem *mmio;
struct {
struct clk *mod; /* CPG module clock */
struct clk *extal; /* External clock */
struct clk *dotclkin[2]; /* External DU clocks */
} clocks;
struct drm_bridge *companion;
enum rcar_lvds_link_type link_type;
};
#define bridge_to_rcar_lvds(b) \
container_of(b, struct rcar_lvds, bridge)
static u32 rcar_lvds_read(struct rcar_lvds *lvds, u32 reg)
{
return ioread32(lvds->mmio + reg);
}
static void rcar_lvds_write(struct rcar_lvds *lvds, u32 reg, u32 data)
{
iowrite32(data, lvds->mmio + reg);
}
/* -----------------------------------------------------------------------------
* PLL Setup
*/
static void rcar_lvds_pll_setup_gen2(struct rcar_lvds *lvds, unsigned int freq)
{
u32 val;
if (freq < 39000000)
val = LVDPLLCR_CEEN | LVDPLLCR_COSEL | LVDPLLCR_PLLDLYCNT_38M;
else if (freq < 61000000)
val = LVDPLLCR_CEEN | LVDPLLCR_COSEL | LVDPLLCR_PLLDLYCNT_60M;
else if (freq < 121000000)
val = LVDPLLCR_CEEN | LVDPLLCR_COSEL | LVDPLLCR_PLLDLYCNT_121M;
else
val = LVDPLLCR_PLLDLYCNT_150M;
rcar_lvds_write(lvds, LVDPLLCR, val);
}
static void rcar_lvds_pll_setup_gen3(struct rcar_lvds *lvds, unsigned int freq)
{
u32 val;
if (freq < 42000000)
val = LVDPLLCR_PLLDIVCNT_42M;
else if (freq < 85000000)
val = LVDPLLCR_PLLDIVCNT_85M;
else if (freq < 128000000)
val = LVDPLLCR_PLLDIVCNT_128M;
else
val = LVDPLLCR_PLLDIVCNT_148M;
rcar_lvds_write(lvds, LVDPLLCR, val);
}
struct pll_info {
unsigned long diff;
unsigned int pll_m;
unsigned int pll_n;
unsigned int pll_e;
unsigned int div;
u32 clksel;
};
static void rcar_lvds_d3_e3_pll_calc(struct rcar_lvds *lvds, struct clk *clk,
unsigned long target, struct pll_info *pll,
u32 clksel, bool dot_clock_only)
{
unsigned int div7 = dot_clock_only ? 1 : 7;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/io.h`, `linux/media-bus-format.h`, `linux/module.h`, `linux/of.h`, `linux/of_device.h`, `linux/of_graph.h`.
- Detected declarations: `struct rcar_lvds`, `struct rcar_lvds_device_info`, `struct rcar_lvds`, `struct pll_info`, `enum rcar_lvds_mode`, `enum rcar_lvds_link_type`, `function rcar_lvds_read`, `function rcar_lvds_write`, `function rcar_lvds_pll_setup_gen2`, `function rcar_lvds_pll_setup_gen3`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.