drivers/gpu/drm/bridge/tc358768.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/bridge/tc358768.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/bridge/tc358768.c- Extension
.c- Size
- 40016 bytes
- Lines
- 1466
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/device.hlinux/gpio/consumer.hlinux/i2c.hlinux/kernel.hlinux/math64.hlinux/media-bus-format.hlinux/minmax.hlinux/module.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hlinux/units.hdrm/drm_atomic_helper.hdrm/drm_drv.hdrm/drm_mipi_dsi.hdrm/drm_of.hdrm/drm_panel.hvideo/mipi_display.hvideo/videomode.h
Detected Declarations
struct tc358768_dsi_outputstruct tc358768_privfunction tc358768_clear_errorfunction tc358768_writefunction tc358768_readfunction tc358768_update_bitsfunction tc358768_confw_update_bitsfunction tc358768_dsicmd_txfunction tc358768_sw_resetfunction tc358768_hw_enablefunction tc358768_hw_disablefunction tc358768_pll_to_pclkfunction tc358768_pclk_to_pllfunction tc358768_calc_pllfunction tc358768_dsi_host_attachfunction Videofunction tc358768_dsi_host_detachfunction tc358768_dsi_host_transferfunction tc358768_bridge_attachfunction tc358768_bridge_mode_validfunction tc358768_bridge_atomic_disablefunction tc358768_bridge_atomic_post_disablefunction tc358768_setup_pllfunction tc358768_ns_to_cntfunction tc358768_ps_to_nsfunction tc358768_dpi_to_nsfunction tc358768_dpi_to_dsi_bytesfunction tc358768_dsi_bytes_to_nsfunction tc358768_bridge_atomic_pre_enablefunction isfunction tc358768_config_video_formatfunction tc358768_bridge_atomic_enablefunction tc358768_atomic_get_input_bus_fmtsfunction tc358768_mode_fixupfunction tc358768_is_reserved_regfunction tc358768_writeable_regfunction tc358768_readable_regfunction tc358768_get_regulatorsfunction tc358768_i2c_probefunction tc358768_i2c_remove
Annotated Snippet
struct tc358768_dsi_output {
struct mipi_dsi_device *dev;
struct drm_panel *panel;
struct drm_bridge *bridge;
};
struct tc358768_priv {
struct device *dev;
struct regmap *regmap;
struct gpio_desc *reset_gpio;
struct regulator_bulk_data supplies[ARRAY_SIZE(tc358768_supplies)];
struct clk *refclk;
int enabled;
int error;
struct mipi_dsi_host dsi_host;
struct drm_bridge bridge;
struct tc358768_dsi_output output;
u32 pd_lines; /* number of Parallel Port Input Data Lines */
u32 dsi_lanes; /* number of DSI Lanes */
u32 dsi_bpp; /* number of Bits Per Pixel over DSI */
/* Parameters for PLL programming */
u32 fbd; /* PLL feedback divider */
u32 prd; /* PLL input divider */
u32 frs; /* PLL Freqency range for HSCK (post divider) */
u32 dsiclk; /* pll_clk / 2 */
u32 pclk; /* incoming pclk rate */
};
static inline struct tc358768_priv *dsi_host_to_tc358768(struct mipi_dsi_host
*host)
{
return container_of(host, struct tc358768_priv, dsi_host);
}
static inline struct tc358768_priv *bridge_to_tc358768(struct drm_bridge
*bridge)
{
return container_of(bridge, struct tc358768_priv, bridge);
}
static int tc358768_clear_error(struct tc358768_priv *priv)
{
int ret = priv->error;
priv->error = 0;
return ret;
}
static void tc358768_write(struct tc358768_priv *priv, u32 reg, u32 val)
{
/* work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 */
int tmpval = val;
size_t count = 2;
if (priv->error)
return;
/* 16-bit register? */
if (reg < 0x100 || reg >= 0x600)
count = 1;
priv->error = regmap_bulk_write(priv->regmap, reg, &tmpval, count);
}
static void tc358768_read(struct tc358768_priv *priv, u32 reg, u32 *val)
{
size_t count = 2;
if (priv->error)
return;
/* 16-bit register? */
if (reg < 0x100 || reg >= 0x600) {
*val = 0;
count = 1;
}
priv->error = regmap_bulk_read(priv->regmap, reg, val, count);
}
static void tc358768_update_bits(struct tc358768_priv *priv, u32 reg, u32 mask,
u32 val)
{
u32 tmp, orig;
tc358768_read(priv, reg, &orig);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/device.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/kernel.h`, `linux/math64.h`, `linux/media-bus-format.h`, `linux/minmax.h`.
- Detected declarations: `struct tc358768_dsi_output`, `struct tc358768_priv`, `function tc358768_clear_error`, `function tc358768_write`, `function tc358768_read`, `function tc358768_update_bits`, `function tc358768_confw_update_bits`, `function tc358768_dsicmd_tx`, `function tc358768_sw_reset`, `function tc358768_hw_enable`.
- 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.