drivers/gpu/drm/bridge/nwl-dsi.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/bridge/nwl-dsi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/bridge/nwl-dsi.c- Extension
.c- Size
- 32231 bytes
- Lines
- 1227
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/bits.hlinux/clk.hlinux/irq.hlinux/math64.hlinux/mfd/syscon.hlinux/media-bus-format.hlinux/module.hlinux/mux/consumer.hlinux/of.hlinux/phy/phy.hlinux/platform_device.hlinux/regmap.hlinux/reset.hlinux/sys_soc.hlinux/time64.hdrm/drm_atomic_state_helper.hdrm/drm_bridge.hdrm/drm_mipi_dsi.hdrm/drm_of.hdrm/drm_print.hvideo/mipi_display.hnwl-dsi.h
Detected Declarations
struct nwl_dsi_transferstruct nwl_dsienum transfer_directionfunction nwl_dsi_clear_errorfunction nwl_dsi_writefunction nwl_dsi_readfunction nwl_dsi_get_dpi_pixel_formatfunction ps2bcfunction ui2bcfunction us2lpfunction nwl_dsi_config_hostfunction nwl_dsi_config_dpifunction nwl_dsi_init_interruptsfunction nwl_dsi_host_attachfunction nwl_dsi_read_packetfunction nwl_dsi_finish_transmissionfunction nwl_dsi_begin_transmissionfunction nwl_dsi_host_transferfunction nwl_dsi_irq_handlerfunction nwl_dsi_mode_setfunction nwl_dsi_disablefunction nwl_dsi_bridge_atomic_disablefunction nwl_dsi_get_dphy_paramsfunction nwl_dsi_bridge_mode_validfunction nwl_dsi_bridge_atomic_checkfunction nwl_dsi_bridge_mode_setfunction nwl_dsi_bridge_atomic_enablefunction nwl_dsi_bridge_attachfunction nwl_dsi_parse_dtfunction nwl_dsi_select_inputfunction nwl_dsi_deselect_inputfunction nwl_dsi_probefunction nwl_dsi_remove
Annotated Snippet
struct nwl_dsi_transfer {
const struct mipi_dsi_msg *msg;
struct mipi_dsi_packet packet;
struct completion completed;
int status; /* status of transmission */
enum transfer_direction direction;
bool need_bta;
u8 cmd;
u16 rx_word_count;
size_t tx_len; /* in bytes */
size_t rx_len; /* in bytes */
};
struct nwl_dsi {
struct drm_bridge bridge;
struct mipi_dsi_host dsi_host;
struct device *dev;
struct phy *phy;
union phy_configure_opts phy_cfg;
unsigned int quirks;
struct regmap *regmap;
int irq;
/*
* The DSI host controller needs this reset sequence according to NWL:
* 1. Deassert pclk reset to get access to DSI regs
* 2. Configure DSI Host and DPHY and enable DPHY
* 3. Deassert ESC and BYTE resets to allow host TX operations)
* 4. Send DSI cmds to configure peripheral (handled by panel drv)
* 5. Deassert DPI reset so DPI receives pixels and starts sending
* DSI data
*
* TODO: Since panel_bridges do their DSI setup in enable we
* currently have 4. and 5. swapped.
*/
struct reset_control *rst_byte;
struct reset_control *rst_esc;
struct reset_control *rst_dpi;
struct reset_control *rst_pclk;
struct mux_control *mux;
/* DSI clocks */
struct clk *phy_ref_clk;
struct clk *rx_esc_clk;
struct clk *tx_esc_clk;
struct clk *core_clk;
/*
* hardware bug: the i.MX8MQ needs this clock on during reset
* even when not using LCDIF.
*/
struct clk *lcdif_clk;
/* dsi lanes */
u32 lanes;
enum mipi_dsi_pixel_format format;
struct drm_display_mode mode;
unsigned long dsi_mode_flags;
int error;
struct nwl_dsi_transfer *xfer;
};
static const struct regmap_config nwl_dsi_regmap_config = {
.reg_bits = 16,
.val_bits = 32,
.reg_stride = 4,
.max_register = NWL_DSI_IRQ_MASK2,
.name = DRV_NAME,
};
static inline struct nwl_dsi *bridge_to_dsi(struct drm_bridge *bridge)
{
return container_of(bridge, struct nwl_dsi, bridge);
}
static int nwl_dsi_clear_error(struct nwl_dsi *dsi)
{
int ret = dsi->error;
dsi->error = 0;
return ret;
}
static void nwl_dsi_write(struct nwl_dsi *dsi, unsigned int reg, u32 val)
{
int ret;
if (dsi->error)
return;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bits.h`, `linux/clk.h`, `linux/irq.h`, `linux/math64.h`, `linux/mfd/syscon.h`, `linux/media-bus-format.h`, `linux/module.h`.
- Detected declarations: `struct nwl_dsi_transfer`, `struct nwl_dsi`, `enum transfer_direction`, `function nwl_dsi_clear_error`, `function nwl_dsi_write`, `function nwl_dsi_read`, `function nwl_dsi_get_dpi_pixel_format`, `function ps2bc`, `function ui2bc`, `function us2lp`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.