drivers/gpu/drm/bridge/analogix/anx7625.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/bridge/analogix/anx7625.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/bridge/analogix/anx7625.c- Extension
.c- Size
- 77691 bytes
- Lines
- 3026
- 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/cleanup.hlinux/gcd.hlinux/gpio/consumer.hlinux/i2c.hlinux/interrupt.hlinux/iopoll.hlinux/kernel.hlinux/module.hlinux/mutex.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/slab.hlinux/types.hlinux/usb.hlinux/usb/pd.hlinux/usb/role.hlinux/workqueue.hlinux/of_graph.hlinux/of_platform.hdrm/display/drm_dp_aux_bus.hdrm/display/drm_dp_helper.hdrm/display/drm_hdcp_helper.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_edid.hdrm/drm_mipi_dsi.hdrm/drm_of.hdrm/drm_panel.hdrm/drm_print.hdrm/drm_probe_helper.hmedia/v4l2-fwnode.hsound/hdmi-codec.h
Detected Declarations
function Copyrightfunction anx7625_reg_readfunction anx7625_reg_block_readfunction anx7625_reg_writefunction anx7625_reg_block_writefunction anx7625_write_orfunction anx7625_write_andfunction anx7625_write_and_orfunction anx7625_config_bit_matrixfunction anx7625_read_ctrl_status_p0function wait_aux_op_finishfunction anx7625_aux_transfunction anx7625_video_mute_controlfunction anx7625_reduction_of_a_fractionfunction anx7625_calculate_m_nfunction anx7625_odfc_configfunction variationfunction anx7625_dsi_video_timing_configfunction anx7625_swap_dsi_lane3function anx7625_api_dsi_configfunction anx7625_dsi_configfunction anx7625_api_dpi_configfunction anx7625_dpi_configfunction anx7625_read_flash_statusfunction anx7625_hdcp_key_probefunction anx7625_hdcp_key_loadfunction anx7625_hdcp_disablefunction anx7625_hdcp_enablefunction anx7625_dp_startfunction anx7625_dp_stopfunction sp_tx_rst_auxfunction sp_tx_aux_wrfunction sp_tx_aux_rdfunction sp_tx_get_edid_blockfunction edid_readfunction segments_edid_readfunction sp_tx_edid_readfunction anx7625_power_onfunction anx7625_power_standbyfunction anx7625_configfunction anx7625_hpd_timer_configfunction anx7625_read_hpd_gpio_config_statusfunction anx7625_disable_pd_protocolfunction anx7625_configure_hpdfunction anx7625_need_pdfunction anx7625_ocm_loading_checkfunction anx7625_power_on_initfunction anx7625_init_gpio
Annotated Snippet
if (*post_divider > POST_DIVIDER_MAX) {
DRM_ERROR("cannot find property post_divider(%d)\n",
*post_divider);
return -EDOM;
}
}
/* Patch to improve the accuracy */
if (*post_divider == 7) {
/* 27,000,000 is not divisible by 7 */
*post_divider = 8;
} else if (*post_divider == 11) {
/* 27,000,000 is not divisible by 11 */
*post_divider = 12;
} else if ((*post_divider == 13) || (*post_divider == 14)) {
/* 27,000,000 is not divisible by 13 or 14 */
*post_divider = 15;
}
if (pixelclock * (*post_divider) > PLL_OUT_FREQ_ABS_MAX) {
DRM_ERROR("act clock(%u) large than maximum(%lu)\n",
pixelclock * (*post_divider),
PLL_OUT_FREQ_ABS_MAX);
return -EDOM;
}
*m = pixelclock;
*n = XTAL_FRQ / (*post_divider);
anx7625_reduction_of_a_fraction(m, n);
return 0;
}
static int anx7625_odfc_config(struct anx7625_data *ctx,
u8 post_divider)
{
int ret;
struct device *dev = ctx->dev;
/* Config input reference clock frequency 27MHz/19.2MHz */
ret = anx7625_write_and(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_16,
~(REF_CLK_27000KHZ << MIPI_FREF_D_IND));
ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_16,
(REF_CLK_27000KHZ << MIPI_FREF_D_IND));
/* Post divider */
ret |= anx7625_write_and(ctx, ctx->i2c.rx_p1_client,
MIPI_DIGITAL_PLL_8, 0x0f);
ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_8,
post_divider << 4);
/* Add patch for MIS2-125 (5pcs ANX7625 fail ATE MBIST test) */
ret |= anx7625_write_and(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_7,
~MIPI_PLL_VCO_TUNE_REG_VAL);
/* Reset ODFC PLL */
ret |= anx7625_write_and(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_7,
~MIPI_PLL_RESET_N);
ret |= anx7625_write_or(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_PLL_7,
MIPI_PLL_RESET_N);
if (ret < 0)
DRM_DEV_ERROR(dev, "IO error.\n");
return ret;
}
/*
* The MIPI source video data exist large variation (e.g. 59Hz ~ 61Hz),
* anx7625 defined K ratio for matching MIPI input video clock and
* DP output video clock. Increase K value can match bigger video data
* variation. IVO panel has small variation than DP CTS spec, need
* decrease the K value.
*/
static int anx7625_set_k_value(struct anx7625_data *ctx)
{
struct drm_edid_product_id id;
drm_edid_get_product_id(ctx->cached_drm_edid, &id);
if (be16_to_cpu(id.manufacturer_name) == IVO_MID)
return anx7625_reg_write(ctx, ctx->i2c.rx_p1_client,
MIPI_DIGITAL_ADJ_1, 0x3B);
return anx7625_reg_write(ctx, ctx->i2c.rx_p1_client,
MIPI_DIGITAL_ADJ_1, 0x3D);
}
static int anx7625_dsi_video_timing_config(struct anx7625_data *ctx)
{
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/gcd.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/interrupt.h`, `linux/iopoll.h`, `linux/kernel.h`, `linux/module.h`.
- Detected declarations: `function Copyright`, `function anx7625_reg_read`, `function anx7625_reg_block_read`, `function anx7625_reg_write`, `function anx7625_reg_block_write`, `function anx7625_write_or`, `function anx7625_write_and`, `function anx7625_write_and_or`, `function anx7625_config_bit_matrix`, `function anx7625_read_ctrl_status_p0`.
- 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.