drivers/gpu/drm/omapdrm/dss/sdi.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/omapdrm/dss/sdi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/omapdrm/dss/sdi.c- Extension
.c- Size
- 8951 bytes
- Lines
- 391
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/err.hlinux/export.hlinux/kernel.hlinux/of.hlinux/of_graph.hlinux/platform_device.hlinux/regulator/consumer.hlinux/string.hdrm/drm_bridge.hdss.homapdss.h
Detected Declarations
struct sdi_devicestruct sdi_clk_calc_ctxfunction dpi_calc_dispc_cbfunction dpi_calc_dss_cbfunction sdi_calc_clock_divfunction sdi_config_lcd_managerfunction sdi_bridge_attachfunction sdi_bridge_mode_validfunction sdi_bridge_mode_fixupfunction sdi_bridge_mode_setfunction sdi_bridge_enablefunction sdi_bridge_disablefunction sdi_bridge_initfunction sdi_bridge_cleanupfunction sdi_init_outputfunction sdi_uninit_outputfunction sdi_init_portfunction sdi_uninit_port
Annotated Snippet
struct sdi_device {
struct platform_device *pdev;
struct dss_device *dss;
bool update_enabled;
struct regulator *vdds_sdi_reg;
struct dss_lcd_mgr_config mgr_config;
unsigned long pixelclock;
int datapairs;
struct omap_dss_device output;
struct drm_bridge bridge;
};
#define drm_bridge_to_sdi(bridge) \
container_of(bridge, struct sdi_device, bridge)
struct sdi_clk_calc_ctx {
struct sdi_device *sdi;
unsigned long pck_min, pck_max;
unsigned long fck;
struct dispc_clock_info dispc_cinfo;
};
static bool dpi_calc_dispc_cb(int lckd, int pckd, unsigned long lck,
unsigned long pck, void *data)
{
struct sdi_clk_calc_ctx *ctx = data;
ctx->dispc_cinfo.lck_div = lckd;
ctx->dispc_cinfo.pck_div = pckd;
ctx->dispc_cinfo.lck = lck;
ctx->dispc_cinfo.pck = pck;
return true;
}
static bool dpi_calc_dss_cb(unsigned long fck, void *data)
{
struct sdi_clk_calc_ctx *ctx = data;
ctx->fck = fck;
return dispc_div_calc(ctx->sdi->dss->dispc, fck,
ctx->pck_min, ctx->pck_max,
dpi_calc_dispc_cb, ctx);
}
static int sdi_calc_clock_div(struct sdi_device *sdi, unsigned long pclk,
unsigned long *fck,
struct dispc_clock_info *dispc_cinfo)
{
int i;
struct sdi_clk_calc_ctx ctx;
/*
* DSS fclk gives us very few possibilities, so finding a good pixel
* clock may not be possible. We try multiple times to find the clock,
* each time widening the pixel clock range we look for, up to
* +/- 1MHz.
*/
for (i = 0; i < 10; ++i) {
bool ok;
memset(&ctx, 0, sizeof(ctx));
ctx.sdi = sdi;
if (pclk > 1000 * i * i * i)
ctx.pck_min = max(pclk - 1000 * i * i * i, 0lu);
else
ctx.pck_min = 0;
ctx.pck_max = pclk + 1000 * i * i * i;
ok = dss_div_calc(sdi->dss, pclk, ctx.pck_min,
dpi_calc_dss_cb, &ctx);
if (ok) {
*fck = ctx.fck;
*dispc_cinfo = ctx.dispc_cinfo;
return 0;
}
}
return -EINVAL;
}
static void sdi_config_lcd_manager(struct sdi_device *sdi)
Annotation
- Immediate include surface: `linux/delay.h`, `linux/err.h`, `linux/export.h`, `linux/kernel.h`, `linux/of.h`, `linux/of_graph.h`, `linux/platform_device.h`, `linux/regulator/consumer.h`.
- Detected declarations: `struct sdi_device`, `struct sdi_clk_calc_ctx`, `function dpi_calc_dispc_cb`, `function dpi_calc_dss_cb`, `function sdi_calc_clock_div`, `function sdi_config_lcd_manager`, `function sdi_bridge_attach`, `function sdi_bridge_mode_valid`, `function sdi_bridge_mode_fixup`, `function sdi_bridge_mode_set`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.