drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c- Extension
.c- Size
- 29622 bytes
- Lines
- 1037
- 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.
- 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/bitfield.hlinux/clk.hlinux/export.hlinux/iopoll.hlinux/media-bus-format.hlinux/module.hlinux/platform_device.hlinux/pm_runtime.hlinux/reset.hvideo/mipi_display.hdrm/bridge/dw_mipi_dsi2.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_mipi_dsi.hdrm/drm_of.hdrm/drm_print.h
Detected Declarations
struct cmd_headerstruct dw_mipi_dsi2enum vid_mode_typeenum mode_ctrlenum ppi_widthfunction cri_fifos_wait_availfunction dw_mipi_dsi2_set_vid_modefunction dw_mipi_dsi2_set_data_stream_modefunction dw_mipi_dsi2_set_cmd_modefunction dw_mipi_dsi2_host_softrstfunction dw_mipi_dsi2_phy_clk_mode_cfgfunction dw_mipi_dsi2_phy_ratio_cfgfunction dw_mipi_dsi2_lp2hs_or_hs2lp_cfgfunction dw_mipi_dsi2_phy_initfunction dw_mipi_dsi2_tx_option_setfunction dw_mipi_dsi2_ipi_color_coding_cfgfunction dw_mipi_dsi2_vertical_timing_configfunction dw_mipi_dsi2_ipi_setfunction dw_mipi_dsi2_work_modefunction dw_mipi_dsi2_host_attachfunction dw_mipi_dsi2_host_detachfunction dw_mipi_dsi2_gen_pkt_hdr_writefunction dw_mipi_dsi2_writefunction dw_mipi_dsi2_readfunction dw_mipi_dsi2_host_transferfunction dw_mipi_dsi2_bridge_atomic_get_input_bus_fmtsfunction dw_mipi_dsi2_bridge_atomic_checkfunction dw_mipi_dsi2_bridge_post_atomic_disablefunction dw_mipi_dsi2_get_lanesfunction dw_mipi_dsi2_mode_setfunction dw_mipi_dsi2_bridge_atomic_pre_enablefunction dw_mipi_dsi2_bridge_mode_setfunction dw_mipi_dsi2_bridge_atomic_enablefunction dw_mipi_dsi2_bridge_mode_validfunction dw_mipi_dsi2_bridge_attachfunction __dw_mipi_dsi2_probefunction __dw_mipi_dsi2_removefunction dw_mipi_dsi2_probefunction dw_mipi_dsi2_removefunction dw_mipi_dsi2_bindfunction dw_mipi_dsi2_unbindexport dw_mipi_dsi2_probeexport dw_mipi_dsi2_removeexport dw_mipi_dsi2_bindexport dw_mipi_dsi2_unbind
Annotated Snippet
struct cmd_header {
u8 cmd_type;
u8 delay;
u8 payload_length;
};
struct dw_mipi_dsi2 {
struct drm_bridge bridge;
struct mipi_dsi_host dsi_host;
struct drm_bridge *panel_bridge;
struct device *dev;
struct regmap *regmap;
struct clk *pclk;
struct clk *sys_clk;
unsigned int lane_mbps; /* per lane */
u32 channel;
u32 lanes;
u32 format;
unsigned long mode_flags;
struct drm_display_mode mode;
const struct dw_mipi_dsi2_plat_data *plat_data;
};
static inline struct dw_mipi_dsi2 *host_to_dsi2(struct mipi_dsi_host *host)
{
return container_of(host, struct dw_mipi_dsi2, dsi_host);
}
static inline struct dw_mipi_dsi2 *bridge_to_dsi2(struct drm_bridge *bridge)
{
return container_of(bridge, struct dw_mipi_dsi2, bridge);
}
static int cri_fifos_wait_avail(struct dw_mipi_dsi2 *dsi2)
{
u32 sts, mask;
int ret;
mask = CRI_BUSY | CRT_FIFOS_NOT_EMPTY;
ret = regmap_read_poll_timeout(dsi2->regmap, DSI2_CORE_STATUS, sts,
!(sts & mask), 0, CMD_PKT_STATUS_TIMEOUT_US);
if (ret < 0) {
dev_err(dsi2->dev, "command interface is busy\n");
return ret;
}
return 0;
}
static void dw_mipi_dsi2_set_vid_mode(struct dw_mipi_dsi2 *dsi2)
{
u32 val = 0, mode;
int ret;
if (dsi2->mode_flags & MIPI_DSI_MODE_VIDEO_NO_HFP)
val |= BLK_HFP_HS_EN;
if (dsi2->mode_flags & MIPI_DSI_MODE_VIDEO_NO_HBP)
val |= BLK_HBP_HS_EN;
if (dsi2->mode_flags & MIPI_DSI_MODE_VIDEO_NO_HSA)
val |= BLK_HSA_HS_EN;
if (dsi2->mode_flags & MIPI_DSI_MODE_VIDEO_BURST)
val |= VID_MODE_TYPE_BURST;
else if (dsi2->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
val |= VID_MODE_TYPE_NON_BURST_SYNC_PULSES;
else
val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS;
regmap_write(dsi2->regmap, DSI2_DSI_VID_TX_CFG, val);
regmap_write(dsi2->regmap, DSI2_MODE_CTRL, VIDEO_MODE);
ret = regmap_read_poll_timeout(dsi2->regmap, DSI2_MODE_STATUS,
mode, mode & VIDEO_MODE,
1000, MODE_STATUS_TIMEOUT_US);
if (ret < 0)
dev_err(dsi2->dev, "failed to enter video mode\n");
}
static void dw_mipi_dsi2_set_data_stream_mode(struct dw_mipi_dsi2 *dsi2)
{
u32 mode;
int ret;
regmap_write(dsi2->regmap, DSI2_MODE_CTRL, DATA_STREAM_MODE);
ret = regmap_read_poll_timeout(dsi2->regmap, DSI2_MODE_STATUS,
mode, mode & DATA_STREAM_MODE,
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/export.h`, `linux/iopoll.h`, `linux/media-bus-format.h`, `linux/module.h`, `linux/platform_device.h`, `linux/pm_runtime.h`.
- Detected declarations: `struct cmd_header`, `struct dw_mipi_dsi2`, `enum vid_mode_type`, `enum mode_ctrl`, `enum ppi_width`, `function cri_fifos_wait_avail`, `function dw_mipi_dsi2_set_vid_mode`, `function dw_mipi_dsi2_set_data_stream_mode`, `function dw_mipi_dsi2_set_cmd_mode`, `function dw_mipi_dsi2_host_softrst`.
- 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.