drivers/gpu/drm/imx/ipuv3/imx-tve.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imx/ipuv3/imx-tve.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/imx/ipuv3/imx-tve.c- Extension
.c- Size
- 17095 bytes
- Lines
- 693
- 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.
- 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-provider.hlinux/clk.hlinux/component.hlinux/i2c.hlinux/module.hlinux/platform_device.hlinux/regmap.hlinux/regulator/consumer.hlinux/videodev2.hvideo/imx-ipu-v3.hdrm/drm_atomic_helper.hdrm/drm_edid.hdrm/drm_managed.hdrm/drm_probe_helper.hdrm/drm_simple_kms_helper.himx-drm.h
Detected Declarations
struct imx_tve_encoderstruct imx_tvefunction tve_enablefunction tve_disablefunction tve_setup_tvoutfunction tve_setup_vgafunction imx_tve_connector_get_modesfunction imx_tve_connector_mode_validfunction imx_tve_encoder_mode_setfunction imx_tve_encoder_enablefunction imx_tve_encoder_disablefunction imx_tve_atomic_checkfunction imx_tve_connector_destroyfunction imx_tve_irq_handlerfunction clk_tve_di_recalc_ratefunction clk_tve_di_determine_ratefunction clk_tve_di_set_ratefunction tve_clk_initfunction imx_tve_disable_regulatorfunction imx_tve_readable_regfunction of_get_tve_modefunction imx_tve_bindfunction imx_tve_put_devicefunction imx_tve_probefunction imx_tve_remove
Annotated Snippet
struct imx_tve_encoder {
struct drm_connector connector;
struct drm_encoder encoder;
struct imx_tve *tve;
};
struct imx_tve {
struct device *dev;
int mode;
int di_hsync_pin;
int di_vsync_pin;
struct regmap *regmap;
struct regulator *dac_reg;
struct i2c_adapter *ddc;
struct clk *clk;
struct clk *di_sel_clk;
struct clk_hw clk_hw_di;
struct clk *di_clk;
};
static inline struct imx_tve *con_to_tve(struct drm_connector *c)
{
return container_of(c, struct imx_tve_encoder, connector)->tve;
}
static inline struct imx_tve *enc_to_tve(struct drm_encoder *e)
{
return container_of(e, struct imx_tve_encoder, encoder)->tve;
}
static void tve_enable(struct imx_tve *tve)
{
clk_prepare_enable(tve->clk);
regmap_update_bits(tve->regmap, TVE_COM_CONF_REG, TVE_EN, TVE_EN);
/* clear interrupt status register */
regmap_write(tve->regmap, TVE_STAT_REG, 0xffffffff);
/* cable detection irq disabled in VGA mode, enabled in TVOUT mode */
if (tve->mode == TVE_MODE_VGA)
regmap_write(tve->regmap, TVE_INT_CONT_REG, 0);
else
regmap_write(tve->regmap, TVE_INT_CONT_REG,
TVE_CD_SM_IEN |
TVE_CD_LM_IEN |
TVE_CD_MON_END_IEN);
}
static void tve_disable(struct imx_tve *tve)
{
regmap_update_bits(tve->regmap, TVE_COM_CONF_REG, TVE_EN, 0);
clk_disable_unprepare(tve->clk);
}
static int tve_setup_tvout(struct imx_tve *tve)
{
return -ENOTSUPP;
}
static int tve_setup_vga(struct imx_tve *tve)
{
unsigned int mask;
unsigned int val;
int ret;
/* set gain to (1 + 10/128) to provide 0.7V peak-to-peak amplitude */
ret = regmap_update_bits(tve->regmap, TVE_TVDAC0_CONT_REG,
TVE_TVDAC_GAIN_MASK, 0x0a);
if (ret)
return ret;
ret = regmap_update_bits(tve->regmap, TVE_TVDAC1_CONT_REG,
TVE_TVDAC_GAIN_MASK, 0x0a);
if (ret)
return ret;
ret = regmap_update_bits(tve->regmap, TVE_TVDAC2_CONT_REG,
TVE_TVDAC_GAIN_MASK, 0x0a);
if (ret)
return ret;
/* set configuration register */
mask = TVE_DATA_SOURCE_MASK | TVE_INP_VIDEO_FORM;
val = TVE_DATA_SOURCE_BUS2 | TVE_INP_YCBCR_444;
mask |= TVE_TV_STAND_MASK | TVE_P2I_CONV_EN;
val |= TVE_TV_STAND_HD_1080P30 | 0;
mask |= TVE_TV_OUT_MODE_MASK | TVE_SYNC_CH_0_EN;
val |= TVE_TV_OUT_RGB | TVE_SYNC_CH_0_EN;
ret = regmap_update_bits(tve->regmap, TVE_COM_CONF_REG, mask, val);
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/clk.h`, `linux/component.h`, `linux/i2c.h`, `linux/module.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/regulator/consumer.h`.
- Detected declarations: `struct imx_tve_encoder`, `struct imx_tve`, `function tve_enable`, `function tve_disable`, `function tve_setup_tvout`, `function tve_setup_vga`, `function imx_tve_connector_get_modes`, `function imx_tve_connector_mode_valid`, `function imx_tve_encoder_mode_set`, `function imx_tve_encoder_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.
- 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.