drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c- Extension
.c- Size
- 22349 bytes
- Lines
- 903
- 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/delay.hlinux/mod_devicetable.hlinux/module.hlinux/platform_device.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_device.hdrm/drm_mipi_dsi.hdrm/drm_of.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_simple_kms_helper.hdw_dsi_reg.h
Detected Declarations
struct mipi_phy_paramsstruct dsi_hw_ctxstruct dw_dsistruct dsi_datastruct dsi_phy_rangefunction dsi_calc_phy_ratefunction dsi_get_phy_paramsfunction dsi_get_dpi_color_codingfunction dsi_phy_tst_setfunction dsi_set_phy_timerfunction dsi_set_mipi_phyfunction dsi_set_mode_timingfunction dsi_set_video_modefunction dsi_mipi_initfunction dsi_encoder_disablefunction dsi_encoder_enablefunction dsi_encoder_phy_mode_validfunction dsi_encoder_mode_validfunction crtcsfunction dsi_encoder_mode_setfunction dsi_encoder_atomic_checkfunction dw_drm_encoder_initfunction dsi_host_attachfunction dsi_host_detachfunction dsi_host_initfunction dsi_bridge_initfunction dsi_bindfunction dsi_unbindfunction dsi_parse_dtfunction dsi_probefunction dsi_remove
Annotated Snippet
struct mipi_phy_params {
u32 clk_t_lpx;
u32 clk_t_hs_prepare;
u32 clk_t_hs_zero;
u32 clk_t_hs_trial;
u32 clk_t_wakeup;
u32 data_t_lpx;
u32 data_t_hs_prepare;
u32 data_t_hs_zero;
u32 data_t_hs_trial;
u32 data_t_ta_go;
u32 data_t_ta_get;
u32 data_t_wakeup;
u32 hstx_ckg_sel;
u32 pll_fbd_div5f;
u32 pll_fbd_div1f;
u32 pll_fbd_2p;
u32 pll_enbwt;
u32 pll_fbd_p;
u32 pll_fbd_s;
u32 pll_pre_div1p;
u32 pll_pre_p;
u32 pll_vco_750M;
u32 pll_lpf_rs;
u32 pll_lpf_cs;
u32 clklp2hs_time;
u32 clkhs2lp_time;
u32 lp2hs_time;
u32 hs2lp_time;
u32 clk_to_data_delay;
u32 data_to_clk_delay;
u32 lane_byte_clk_kHz;
u32 clk_division;
};
struct dsi_hw_ctx {
void __iomem *base;
struct clk *pclk;
};
struct dw_dsi {
struct drm_encoder encoder;
struct device *dev;
struct mipi_dsi_host host;
struct drm_display_mode cur_mode;
struct dsi_hw_ctx *ctx;
struct mipi_phy_params phy;
u32 lanes;
enum mipi_dsi_pixel_format format;
unsigned long mode_flags;
bool enable;
};
struct dsi_data {
struct dw_dsi dsi;
struct dsi_hw_ctx ctx;
};
struct dsi_phy_range {
u32 min_range_kHz;
u32 max_range_kHz;
u32 pll_vco_750M;
u32 hstx_ckg_sel;
};
static const struct dsi_phy_range dphy_range_info[] = {
{ 46875, 62500, 1, 7 },
{ 62500, 93750, 0, 7 },
{ 93750, 125000, 1, 6 },
{ 125000, 187500, 0, 6 },
{ 187500, 250000, 1, 5 },
{ 250000, 375000, 0, 5 },
{ 375000, 500000, 1, 4 },
{ 500000, 750000, 0, 4 },
{ 750000, 1000000, 1, 0 },
{ 1000000, 1500000, 0, 0 }
};
static u32 dsi_calc_phy_rate(u32 req_kHz, struct mipi_phy_params *phy)
{
u32 ref_clk_ps = PHY_REF_CLK_PERIOD_PS;
u32 tmp_kHz = req_kHz;
u32 i = 0;
u32 q_pll = 1;
u32 m_pll = 0;
u32 n_pll = 0;
u32 r_pll = 1;
u32 m_n = 0;
u32 m_n_int = 0;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/component.h`, `linux/delay.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/platform_device.h`, `drm/drm_atomic_helper.h`, `drm/drm_bridge.h`.
- Detected declarations: `struct mipi_phy_params`, `struct dsi_hw_ctx`, `struct dw_dsi`, `struct dsi_data`, `struct dsi_phy_range`, `function dsi_calc_phy_rate`, `function dsi_get_phy_params`, `function dsi_get_dpi_color_coding`, `function dsi_phy_tst_set`, `function dsi_set_phy_timer`.
- 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.