drivers/gpu/drm/sti/sti_tvout.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/sti/sti_tvout.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/sti/sti_tvout.c- Extension
.c- Size
- 24996 bytes
- Lines
- 890
- 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/clk.hlinux/component.hlinux/io.hlinux/module.hlinux/of_platform.hlinux/platform_device.hlinux/reset.hlinux/seq_file.hdrm/drm_atomic_helper.hdrm/drm_debugfs.hdrm/drm_device.hdrm/drm_file.hdrm/drm_print.hsti_crtc.hsti_drv.hsti_vtg.h
Detected Declarations
struct sti_tvoutstruct sti_tvout_encoderenum sti_tvout_video_out_typefunction tvout_readfunction tvout_writefunction tvout_vip_set_color_orderfunction tvout_vip_set_clip_modefunction tvout_vip_set_rndfunction tvout_vip_set_sel_inputfunction tvout_vip_set_in_vid_fmtfunction tvout_preformatter_set_matrixfunction tvout_dvo_startfunction tvout_hdmi_startfunction tvout_hda_startfunction readlfunction tvout_dbg_hd_dac_cfgfunction tvout_dbg_showfunction tvout_debugfs_initfunction sti_tvout_encoder_dpmsfunction sti_tvout_late_registerfunction sti_tvout_early_unregisterfunction sti_dvo_encoder_enablefunction sti_dvo_encoder_disablefunction sti_tvout_create_dvo_encoderfunction sti_hda_encoder_enablefunction sti_hda_encoder_disablefunction sti_hdmi_encoder_enablefunction sti_hdmi_encoder_disablefunction sti_tvout_create_encodersfunction sti_tvout_destroy_encodersfunction sti_tvout_bindfunction sti_tvout_unbindfunction sti_tvout_probefunction sti_tvout_remove
Annotated Snippet
struct sti_tvout {
struct device *dev;
struct drm_device *drm_dev;
void __iomem *regs;
struct reset_control *reset;
struct drm_encoder *hdmi;
struct drm_encoder *hda;
struct drm_encoder *dvo;
bool debugfs_registered;
};
struct sti_tvout_encoder {
struct drm_encoder encoder;
struct sti_tvout *tvout;
};
#define to_sti_tvout_encoder(x) \
container_of(x, struct sti_tvout_encoder, encoder)
#define to_sti_tvout(x) to_sti_tvout_encoder(x)->tvout
/* preformatter conversion matrix */
static const u32 rgb_to_ycbcr_601[8] = {
0xF927082E, 0x04C9FEAB, 0x01D30964, 0xFA95FD3D,
0x0000082E, 0x00002000, 0x00002000, 0x00000000
};
/* 709 RGB to YCbCr */
static const u32 rgb_to_ycbcr_709[8] = {
0xF891082F, 0x0367FF40, 0x01280B71, 0xF9B1FE20,
0x0000082F, 0x00002000, 0x00002000, 0x00000000
};
static u32 tvout_read(struct sti_tvout *tvout, int offset)
{
return readl(tvout->regs + offset);
}
static void tvout_write(struct sti_tvout *tvout, u32 val, int offset)
{
writel(val, tvout->regs + offset);
}
/**
* tvout_vip_set_color_order - Set the clipping mode of a VIP
*
* @tvout: tvout structure
* @reg: register to set
* @cr_r: red chroma or red order
* @y_g: y or green order
* @cb_b: blue chroma or blue order
*/
static void tvout_vip_set_color_order(struct sti_tvout *tvout, int reg,
u32 cr_r, u32 y_g, u32 cb_b)
{
u32 val = tvout_read(tvout, reg);
val &= ~(TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_R_SHIFT);
val &= ~(TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_G_SHIFT);
val &= ~(TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_B_SHIFT);
val |= cr_r << TVO_VIP_REORDER_R_SHIFT;
val |= y_g << TVO_VIP_REORDER_G_SHIFT;
val |= cb_b << TVO_VIP_REORDER_B_SHIFT;
tvout_write(tvout, val, reg);
}
/**
* tvout_vip_set_clip_mode - Set the clipping mode of a VIP
*
* @tvout: tvout structure
* @reg: register to set
* @range: clipping range
*/
static void tvout_vip_set_clip_mode(struct sti_tvout *tvout, int reg, u32 range)
{
u32 val = tvout_read(tvout, reg);
val &= ~(TVO_VIP_CLIP_MASK << TVO_VIP_CLIP_SHIFT);
val |= range << TVO_VIP_CLIP_SHIFT;
tvout_write(tvout, val, reg);
}
/**
* tvout_vip_set_rnd - Set the rounded value of a VIP
*
* @tvout: tvout structure
* @reg: register to set
* @rnd: rounded val per component
*/
Annotation
- Immediate include surface: `linux/clk.h`, `linux/component.h`, `linux/io.h`, `linux/module.h`, `linux/of_platform.h`, `linux/platform_device.h`, `linux/reset.h`, `linux/seq_file.h`.
- Detected declarations: `struct sti_tvout`, `struct sti_tvout_encoder`, `enum sti_tvout_video_out_type`, `function tvout_read`, `function tvout_write`, `function tvout_vip_set_color_order`, `function tvout_vip_set_clip_mode`, `function tvout_vip_set_rnd`, `function tvout_vip_set_sel_input`, `function tvout_vip_set_in_vid_fmt`.
- 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.