drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c- Extension
.c- Size
- 13405 bytes
- Lines
- 509
- 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/bitfield.hlinux/clk.hlinux/component.hlinux/media-bus-format.hlinux/mod_devicetable.hlinux/module.hlinux/of.hlinux/pm_runtime.hlinux/platform_device.hlinux/regmap.hlinux/reset.hlinux/mfd/syscon.hlinux/phy/phy.hdrm/bridge/dw_mipi_dsi2.hdrm/drm_mipi_dsi.hdrm/drm_of.hdrm/drm_simple_kms_helper.huapi/linux/videodev2.hrockchip_drm_drv.h
Detected Declarations
struct dsigrf_regstruct rockchip_dw_dsi2_chip_datastruct dw_mipi_dsi2_rockchipenum grf_reg_fieldsfunction grf_field_writefunction dw_mipi_dsi2_phy_initfunction dw_mipi_dsi2_phy_power_onfunction dw_mipi_dsi2_phy_power_offfunction dw_mipi_dsi2_get_lane_mbpsfunction dw_mipi_dsi2_phy_get_ifacefunction dw_mipi_dsi2_phy_get_timingfunction dw_mipi_dsi2_encoder_atomic_enablefunction dw_mipi_dsi2_encoder_atomic_checkfunction rockchip_dsi2_drm_create_encoderfunction dw_mipi_dsi2_rockchip_bindfunction dw_mipi_dsi2_rockchip_unbindfunction dw_mipi_dsi2_rockchip_host_attachfunction dw_mipi_dsi2_rockchip_host_detachfunction dw_mipi_dsi2_rockchip_probefunction dw_mipi_dsi2_rockchip_remove
Annotated Snippet
struct dsigrf_reg {
u16 offset;
u16 lsb;
u16 msb;
};
enum grf_reg_fields {
TXREQCLKHS_EN,
GATING_EN,
IPI_SHUTDN,
IPI_COLORM,
IPI_COLOR_DEPTH,
IPI_FORMAT,
MAX_FIELDS,
};
#define IPI_DEPTH_5_6_5_BITS 0x02
#define IPI_DEPTH_6_BITS 0x03
#define IPI_DEPTH_8_BITS 0x05
#define IPI_DEPTH_10_BITS 0x06
struct rockchip_dw_dsi2_chip_data {
u32 reg;
const struct dsigrf_reg *grf_regs;
unsigned long long max_bit_rate_per_lane;
};
struct dw_mipi_dsi2_rockchip {
struct device *dev;
struct rockchip_encoder encoder;
struct regmap *regmap;
unsigned int lane_mbps; /* per lane */
u32 format;
struct regmap *grf_regmap;
struct phy *phy;
union phy_configure_opts phy_opts;
struct dw_mipi_dsi2 *dmd;
struct dw_mipi_dsi2_plat_data pdata;
const struct rockchip_dw_dsi2_chip_data *cdata;
};
static inline struct dw_mipi_dsi2_rockchip *to_dsi2(struct drm_encoder *encoder)
{
struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder);
return container_of(rkencoder, struct dw_mipi_dsi2_rockchip, encoder);
}
static void grf_field_write(struct dw_mipi_dsi2_rockchip *dsi2, enum grf_reg_fields index,
unsigned int val)
{
const struct dsigrf_reg *field = &dsi2->cdata->grf_regs[index];
if (!field)
return;
regmap_write(dsi2->grf_regmap, field->offset,
(val << field->lsb) | (GENMASK(field->msb, field->lsb) << 16));
}
static int dw_mipi_dsi2_phy_init(void *priv_data)
{
return 0;
}
static void dw_mipi_dsi2_phy_power_on(void *priv_data)
{
struct dw_mipi_dsi2_rockchip *dsi2 = priv_data;
int ret;
ret = phy_set_mode(dsi2->phy, PHY_MODE_MIPI_DPHY);
if (ret) {
dev_err(dsi2->dev, "Failed to set phy mode: %d\n", ret);
return;
}
phy_configure(dsi2->phy, &dsi2->phy_opts);
phy_power_on(dsi2->phy);
}
static void dw_mipi_dsi2_phy_power_off(void *priv_data)
{
struct dw_mipi_dsi2_rockchip *dsi2 = priv_data;
phy_power_off(dsi2->phy);
}
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/component.h`, `linux/media-bus-format.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/of.h`, `linux/pm_runtime.h`.
- Detected declarations: `struct dsigrf_reg`, `struct rockchip_dw_dsi2_chip_data`, `struct dw_mipi_dsi2_rockchip`, `enum grf_reg_fields`, `function grf_field_write`, `function dw_mipi_dsi2_phy_init`, `function dw_mipi_dsi2_phy_power_on`, `function dw_mipi_dsi2_phy_power_off`, `function dw_mipi_dsi2_get_lane_mbps`, `function dw_mipi_dsi2_phy_get_iface`.
- 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.