drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c- Extension
.c- Size
- 48455 bytes
- Lines
- 1760
- 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/hw_bitfield.hlinux/iopoll.hlinux/math64.hlinux/mfd/syscon.hlinux/module.hlinux/of_device.hlinux/of_platform.hlinux/phy/phy.hlinux/platform_device.hlinux/pm_runtime.hlinux/regmap.hvideo/mipi_display.hdrm/bridge/dw_mipi_dsi.hdrm/drm_mipi_dsi.hdrm/drm_of.hdrm/drm_print.hdrm/drm_simple_kms_helper.hrockchip_drm_drv.h
Detected Declarations
struct rockchip_dw_dsi_chip_datastruct dw_mipi_dsi_rockchipstruct dphy_pll_parameter_mapstruct hsttfunction max_mbps_to_parameterfunction dsi_writefunction dw_mipi_dsi_phy_writefunction ns2bcfunction ns2uifunction dw_mipi_dsi_phy_initfunction dw_mipi_dsi_phy_power_onfunction dw_mipi_dsi_phy_power_offfunction dw_mipi_dsi_get_lane_mbpsfunction dw_mipi_dsi_phy_get_timingfunction dw_mipi_dsi_rockchip_configfunction dw_mipi_dsi_rockchip_set_lcdselfunction dw_mipi_dsi_encoder_atomic_checkfunction dw_mipi_dsi_encoder_enablefunction rockchip_dsi_drm_create_encoderfunction dw_mipi_dsi_rockchip_bindfunction dw_mipi_dsi_rockchip_unbindfunction dw_mipi_dsi_rockchip_host_attachfunction dw_mipi_dsi_rockchip_host_detachfunction dw_mipi_dsi_rockchip_dphy_bindfunction dw_mipi_dsi_rockchip_dphy_unbindfunction dw_mipi_dsi_dphy_initfunction dw_mipi_dsi_dphy_exitfunction dw_mipi_dsi_dphy_configurefunction dw_mipi_dsi_dphy_power_onfunction dw_mipi_dsi_dphy_power_offfunction dw_mipi_dsi_rockchip_resumefunction dw_mipi_dsi_rockchip_probefunction dw_mipi_dsi_rockchip_removefunction rk3399_dphy_tx1rx1_initfunction rk3399_dphy_tx1rx1_power_onfunction rk3399_dphy_tx1rx1_power_off
Annotated Snippet
struct rockchip_dw_dsi_chip_data {
u32 reg;
u32 lcdsel_grf_reg;
u32 lcdsel_big;
u32 lcdsel_lit;
u32 enable_grf_reg;
u32 enable;
u32 lanecfg1_grf_reg;
u32 lanecfg1;
u32 lanecfg2_grf_reg;
u32 lanecfg2;
int (*dphy_rx_init)(struct phy *phy);
int (*dphy_rx_power_on)(struct phy *phy);
int (*dphy_rx_power_off)(struct phy *phy);
unsigned int flags;
unsigned int max_data_lanes;
};
struct dw_mipi_dsi_rockchip {
struct device *dev;
struct rockchip_encoder encoder;
void __iomem *base;
struct regmap *grf_regmap;
struct clk *pclk;
struct clk *pllref_clk;
struct clk *grf_clk;
struct clk *phy_cfg_clk;
/* dual-channel */
bool is_slave;
struct dw_mipi_dsi_rockchip *slave;
/* optional external dphy */
struct phy *phy;
union phy_configure_opts phy_opts;
/* being a phy for other mipi hosts */
unsigned int usage_mode;
struct mutex usage_mutex;
struct phy *dphy;
struct phy_configure_opts_mipi_dphy dphy_config;
unsigned int lane_mbps; /* per lane */
u16 input_div;
u16 feedback_div;
u32 format;
struct dw_mipi_dsi *dmd;
const struct rockchip_dw_dsi_chip_data *cdata;
struct dw_mipi_dsi_plat_data pdata;
bool dsi_bound;
};
static struct dw_mipi_dsi_rockchip *to_dsi(struct drm_encoder *encoder)
{
struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder);
return container_of(rkencoder, struct dw_mipi_dsi_rockchip, encoder);
}
struct dphy_pll_parameter_map {
unsigned int max_mbps;
u8 hsfreqrange;
u8 icpctrl;
u8 lpfctrl;
};
/* The table is based on 27MHz DPHY pll reference clock. */
static const struct dphy_pll_parameter_map dppa_map[] = {
{ 89, 0x00, CP_CURRENT_3UA, LPF_RESISTORS_13KOHM },
{ 99, 0x10, CP_CURRENT_3UA, LPF_RESISTORS_13KOHM },
{ 109, 0x20, CP_CURRENT_3UA, LPF_RESISTORS_13KOHM },
{ 129, 0x01, CP_CURRENT_3UA, LPF_RESISTORS_15_5KOHM },
{ 139, 0x11, CP_CURRENT_3UA, LPF_RESISTORS_15_5KOHM },
{ 149, 0x21, CP_CURRENT_3UA, LPF_RESISTORS_15_5KOHM },
{ 169, 0x02, CP_CURRENT_6UA, LPF_RESISTORS_13KOHM },
{ 179, 0x12, CP_CURRENT_6UA, LPF_RESISTORS_13KOHM },
{ 199, 0x22, CP_CURRENT_6UA, LPF_RESISTORS_13KOHM },
{ 219, 0x03, CP_CURRENT_4_5UA, LPF_RESISTORS_13KOHM },
{ 239, 0x13, CP_CURRENT_4_5UA, LPF_RESISTORS_13KOHM },
{ 249, 0x23, CP_CURRENT_4_5UA, LPF_RESISTORS_13KOHM },
{ 269, 0x04, CP_CURRENT_6UA, LPF_RESISTORS_11_5KOHM },
{ 299, 0x14, CP_CURRENT_6UA, LPF_RESISTORS_11_5KOHM },
Annotation
- Immediate include surface: `linux/clk.h`, `linux/hw_bitfield.h`, `linux/iopoll.h`, `linux/math64.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of_device.h`, `linux/of_platform.h`.
- Detected declarations: `struct rockchip_dw_dsi_chip_data`, `struct dw_mipi_dsi_rockchip`, `struct dphy_pll_parameter_map`, `struct hstt`, `function max_mbps_to_parameter`, `function dsi_write`, `function dw_mipi_dsi_phy_write`, `function ns2bc`, `function ns2ui`, `function dw_mipi_dsi_phy_init`.
- 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.