drivers/gpu/drm/rockchip/rockchip_lvds.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/rockchip/rockchip_lvds.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/rockchip/rockchip_lvds.c- Extension
.c- Size
- 19599 bytes
- Lines
- 718
- 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.
- 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/component.hlinux/mfd/syscon.hlinux/of_graph.hlinux/phy/phy.hlinux/pinctrl/devinfo.hlinux/platform_device.hlinux/pm_runtime.hlinux/regmap.hlinux/reset.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_bridge_connector.hdrm/drm_of.hdrm/drm_panel.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_simple_kms_helper.hrockchip_drm_drv.hrockchip_lvds.h
Detected Declarations
struct rockchip_lvdsstruct rockchip_lvds_soc_datastruct rockchip_lvdsfunction rk3288_writelfunction rockchip_lvds_name_to_formatfunction rockchip_lvds_name_to_outputfunction rockchip_lvds_bridge_get_modesfunction rockchip_lvds_encoder_atomic_checkfunction rk3288_lvds_poweronfunction rk3288_lvds_powerofffunction rk3288_lvds_grf_configfunction rk3288_lvds_set_vop_sourcefunction rk3288_lvds_encoder_enablefunction rk3288_lvds_encoder_disablefunction px30_lvds_poweronfunction px30_lvds_powerofffunction px30_lvds_grf_configfunction px30_lvds_set_vop_sourcefunction px30_lvds_encoder_enablefunction px30_lvds_encoder_disablefunction rk3288_lvds_probefunction px30_lvds_probefunction rockchip_lvds_bindfunction for_each_child_of_nodefunction rockchip_lvds_unbindfunction rockchip_lvds_probefunction rockchip_lvds_remove
Annotated Snippet
struct rockchip_lvds_soc_data {
int (*probe)(struct platform_device *pdev, struct rockchip_lvds *lvds);
const struct drm_encoder_helper_funcs *helper_funcs;
};
struct rockchip_lvds {
struct device *dev;
void __iomem *regs;
struct regmap *grf;
struct clk *pclk;
struct phy *dphy;
const struct rockchip_lvds_soc_data *soc_data;
int output; /* rgb lvds or dual lvds output */
int format; /* vesa or jeida format */
struct drm_device *drm_dev;
struct drm_panel *panel;
struct drm_bridge *bridge;
struct rockchip_encoder encoder;
struct dev_pin_info *pins;
};
static inline struct rockchip_lvds *brige_to_lvds(struct drm_bridge *bridge)
{
return (struct rockchip_lvds *)bridge->driver_private;
}
static inline struct rockchip_lvds *encoder_to_lvds(struct drm_encoder *encoder)
{
struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder);
return container_of(rkencoder, struct rockchip_lvds, encoder);
}
static inline void rk3288_writel(struct rockchip_lvds *lvds, u32 offset,
u32 val)
{
writel_relaxed(val, lvds->regs + offset);
if (lvds->output == DISPLAY_OUTPUT_LVDS)
return;
writel_relaxed(val, lvds->regs + offset + RK3288_LVDS_CH1_OFFSET);
}
static inline int rockchip_lvds_name_to_format(const char *s)
{
if (strncmp(s, "jeida-18", 8) == 0)
return LVDS_JEIDA_18;
else if (strncmp(s, "jeida-24", 8) == 0)
return LVDS_JEIDA_24;
else if (strncmp(s, "vesa-24", 7) == 0)
return LVDS_VESA_24;
return -EINVAL;
}
static inline int rockchip_lvds_name_to_output(const char *s)
{
if (strncmp(s, "rgb", 3) == 0)
return DISPLAY_OUTPUT_RGB;
else if (strncmp(s, "lvds", 4) == 0)
return DISPLAY_OUTPUT_LVDS;
else if (strncmp(s, "duallvds", 8) == 0)
return DISPLAY_OUTPUT_DUAL_LVDS;
return -EINVAL;
}
static int
rockchip_lvds_bridge_get_modes(struct drm_bridge *bridge, struct drm_connector *connector)
{
struct rockchip_lvds *lvds = brige_to_lvds(bridge);
struct drm_panel *panel = lvds->panel;
return drm_panel_get_modes(panel, connector);
}
static const
struct drm_bridge_funcs rockchip_lvds_bridge_funcs = {
.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
.atomic_reset = drm_atomic_helper_bridge_reset,
.get_modes = rockchip_lvds_bridge_get_modes,
};
static int
rockchip_lvds_encoder_atomic_check(struct drm_encoder *encoder,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state)
{
struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/component.h`, `linux/mfd/syscon.h`, `linux/of_graph.h`, `linux/phy/phy.h`, `linux/pinctrl/devinfo.h`, `linux/platform_device.h`, `linux/pm_runtime.h`.
- Detected declarations: `struct rockchip_lvds`, `struct rockchip_lvds_soc_data`, `struct rockchip_lvds`, `function rk3288_writel`, `function rockchip_lvds_name_to_format`, `function rockchip_lvds_name_to_output`, `function rockchip_lvds_bridge_get_modes`, `function rockchip_lvds_encoder_atomic_check`, `function rk3288_lvds_poweron`, `function rk3288_lvds_poweroff`.
- 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.
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.