支持的设备- ADV7511
- ADV7511W
- ADV7513
- ADV7533
参考电路
评估板- EVAL-ADV7511W
- EVAL-ADV7612
- EVAL-ADV7612-7511
- EVAL-ADV7842
- EVAL-ADV7842-7511
描述ADV7511驱动程序实现为DRM编码器从驱动程序。在典型的电路板设计中,ADV7511不是用作独立组件,而是用作带有图形核心的其他设备(如SoC或FPGA)的HDMI编码器。将ADV7511驱动程序实现为DRM编码器从驱动程序允许在使用ADV7511的不同平台之间重用驱动程序。
有关使用ADV7511的DRM驱动程序的示例实现,请参阅Linux驱动程序,了解针对Xilinx Zync plus ADV7511设计的ADI示例HDL设计。
该驱动程序通过HDMI支持音频,并通过实施ASoC编解码器驱动程序。这又允许为各种不同平台重用驱动程序。
源代码
状态资源Mainlined?
混帐是
档功能文件
司机 司机/ GPU / DRM /桥梁/ ADV7511 / adv7511_drv.c
司机 司机/ GPU / DRM /桥梁/ ADV7511 / adv7511_audio.c
司机 司机/ GPU / DRM /桥梁/ ADV7511 / adv7533.c
包括司机/ GPU / DRM /桥梁/ ADV7511 / adv7511.h
示例平台设备初始化
DRM通常,DRM编码器从设备将由DRM编码器驱动程序实例化。在编码器从设备实例化之后,需要由DRM编码器驱动程序配置。配置包括与主机图形核心的物理连接以及输出视频格式等设置。如有必要,可以在运行时更改配置,例如,如果连接了具有不同功能的HDMI接收器,则更改输出格式。
ADV7511的配置通过adv7511_video_input_config完成,该应该传递给从编码器的set_config回调函数。
/** * enum adv7511_input_style - Selects the input format style * ADV7511_INPUT_STYLE1: Use input style 1 * ADV7511_INPUT_STYLE2: Use input style 2 * ADV7511_INPUT_STYLE3: Use input style 3 **/enum adv7511_input_style { ADV7511_INPUT_STYLE1 = 2, ADV7511_INPUT_STYLE2 = 1, ADV7511_INPUT_STYLE3 = 3,}; /** * enum adv7511_input_id - Selects the input format id * @ADV7511_INPUT_ID_24BIT_RGB444_YCbCr444: Input pixel format is 24-bit 444 RGB * or 444 YCbCR with separate syncs * @ADV7511_INPUT_ID_16_20_24BIT_YCbCr422_SEPARATE_SYNC: * @ADV7511_INPUT_ID_16_20_24BIT_YCbCr422_EMBEDDED_SYNC: * @ADV7511_INPUT_ID_8_10_12BIT_YCbCr422_SEPARATE_SYNC: * @ADV7511_INPUT_ID_8_10_12BIT_YCbCr422_EMBEDDED_SYNC: * @ADV7511_INPUT_ID_12_15_16BIT_RGB444_YCbCr444: **/enum adv7511_input_id { ADV7511_INPUT_ID_24BIT_RGB444_YCbCr444 = 0, ADV7511_INPUT_ID_16_20_24BIT_YCbCr422_SEPARATE_SYNC = 1, ADV7511_INPUT_ID_16_20_24BIT_YCbCr422_EMBEDDED_SYNC = 2, ADV7511_INPUT_ID_8_10_12BIT_YCbCr422_SEPARATE_SYNC = 3, ADV7511_INPUT_ID_8_10_12BIT_YCbCr422_EMBEDDED_SYNC = 4, ADV7511_INPUT_ID_12_15_16BIT_RGB444_YCbCr444 = 5,}; /** * enum adv7511_input_bit_justifiction - Selects the input format bit justifiction * ADV7511_INPUT_BIT_JUSTIFICATION_EVENLY: Input bits are evenly distributed * ADV7511_INPUT_BIT_JUSTIFICATION_RIGHT: Input bit signals have right justification * ADV7511_INPUT_BIT_JUSTIFICATION_LEFT: Input bit signals have left justification **/enum adv7511_input_bit_justifiction { ADV7511_INPUT_BIT_JUSTIFICATION_EVENLY = 0, ADV7511_INPUT_BIT_JUSTIFICATION_RIGHT = 1, ADV7511_INPUT_BIT_JUSTIFICATION_LEFT = 2,}; /** * enum adv7511_input_color_depth - Selects the input format color depth * @ADV7511_INPUT_COLOR_DEPTH_8BIT: Input format color depth is 8 bits per channel * @ADV7511_INPUT_COLOR_DEPTH_10BIT: Input format color dpeth is 10 bits per channel * @ADV7511_INPUT_COLOR_DEPTH_12BIT: Input format color depth is 12 bits per channel **/enum adv7511_input_color_depth { ADV7511_INPUT_COLOR_DEPTH_8BIT = 3, ADV7511_INPUT_COLOR_DEPTH_10BIT = 1, ADV7511_INPUT_COLOR_DEPTH_12BIT = 2,}; /** * enum adv7511_input_sync_pulse - Selects the sync pulse * @ADV7511_INPUT_SYNC_PULSE_DE: Use the DE signal as sync pulse * @ADV7511_INPUT_SYNC_PULSE_HSYNC: Use the HSYNC signal as sync pulse * @ADV7511_INPUT_SYNC_PULSE_VSYNC: Use the VSYNC signal as sync pulse * @ADV7511_INPUT_SYNC_PULSE_NONE: No external sync pulse signal **/enum adv7511_input_sync_pulse { ADV7511_INPUT_SYNC_PULSE_DE = 0, ADV7511_INPUT_SYNC_PULSE_HSYNC = 1, ADV7511_INPUT_SYNC_PULSE_VSYNC = 2, ADV7511_INPUT_SYNC_PULSE_NONE = 3,}; /** * enum adv7511_input_clock_delay - Delay for the video data input clock * @ADV7511_INPUT_CLOCK_DELAY_MINUS_1200PS: -1200 pico seconds delay * @ADV7511_INPUT_CLOCK_DELAY_MINUS_800PS: -800 pico seconds delay * @ADV7511_INPUT_CLOCK_DELAY_MINUS_400PS: -400 pico seconds delay * @ADV7511_INPUT_CLOCK_DELAY_NONE: No delay * @ADV7511_INPUT_CLOCK_DELAY_PLUS_400PS: 400 pico seconds delay * @ADV7511_INPUT_CLOCK_DELAY_PLUS_800PS: 800 pico seconds delay * @ADV7511_INPUT_CLOCK_DELAY_PLUS_1200PS: 1200 pico seconds delay * @ADV7511_INPUT_CLOCK_DELAY_PLUS_1600PS: 1600 pico seconds delay **/enum adv7511_input_clock_delay { ADV7511_INPUT_CLOCK_DELAY_MINUS_1200PS = 0, ADV7511_INPUT_CLOCK_DELAY_MINUS_800PS = 1, ADV7511_INPUT_CLOCK_DELAY_MINUS_400PS = 2, ADV7511_INPUT_CLOCK_DELAY_NONE = 3, ADV7511_INPUT_CLOCK_DELAY_PLUS_400PS = 4, ADV7511_INPUT_CLOCK_DELAY_PLUS_800PS = 5, ADV7511_INPUT_CLOCK_DELAY_PLUS_1200PS = 6, ADV7511_INPUT_CLOCK_DELAY_PLUS_1600PS = 7,}; /** * enum adv7511_csc_scaling - HDMI videostream format * @ADV7511_OUTPUT_FORMAT_RGB_444: Output format is RGB 444 * @ADV7511_OUTPUT_FORMAT_YCBCR_422: Output format is YCbCr 422 * @ADV7511_OUTPUT_FORMAT_YCBCR_444: Output format is YCbCr 444 **/enum adv7511_output_format { ADV7511_OUTPUT_FORMAT_RGB_444 = 0, ADV7511_OUTPUT_FORMAT_YCBCR_422 = 1, ADV7511_OUTPUT_FORMAT_YCBCR_444 = 2,}; /** * enum adv7511_sync_polarity - Polarity for the input sync signals * ADV7511_SYNC_POLARITY_PASSTHROUGH: Sync polarity matches that of the currently * configured mode. * ADV7511_SYNC_POLARITY_LOW: Sync polarity is low * ADV7511_SYNC_POLARITY_HIGH: Sync polarity is high * * If the polarity is set to either ADV7511_SYNC_POLARITY_LOW or * ADV7511_SYNC_POLARITY_HIGH the ADV7511 will internally invert the signal if * it is required to match the sync polarity setting for the currently selected * mode. If the polarity is set to ADV7511_SYNC_POLARITY_PASSTHROUGH, the ADV7511 * will route the signal unchanged, this is useful if the upstream graphics core * will already generate the sync singals with the correct polarity. **/enum adv7511_sync_polarity { ADV7511_SYNC_POLARITY_PASSTHROUGH, ADV7511_SYNC_POLARITY_LOW, ADV7511_SYNC_POLARITY_HIGH,}; /** * enum adv7511_csc_scaling - Scaling factor for the ADV7511 CSC * @ADV7511_CSC_SCALING_1: CSC results are not scaled * @ADV7511_CSC_SCALING_2: CSC results are scaled by a factor of two * @ADV7511_CSC_SCALING_4: CSC results are scalled by a factor of four **/enum adv7511_csc_scaling { ADV7511_CSC_SCALING_1 = 0, ADV7511_CSC_SCALING_2 = 1, ADV7511_CSC_SCALING_4 = 2,}; /** * enum adv7511_timing_gen_seq - Selects the order in which timing adjustments are performed * @ADV7511_TIMING_GEN_SEQ_SYN_ADJ_FIRST: Sync adjustment first, then DE generation * @ADV7511_TIMING_GEN_SEQ_DE_GEN_FIRST: DE generation first, then sync adjustment * * This setting is only relevant if both DE generation and sync adjustment are * active. **/enum adv7511_timing_gen_seq { ADV7511_TIMING_GEN_SEQ_SYN_ADJ_FIRST = 0, ADV7511_TIMING_GEN_SEQ_DE_GEN_FIRST = 1,}; /** * enum adv7511_up_conversion - Selects the upscaling conversion method * @ADV7511_UP_CONVERSION_ZERO_ORDER: Use zero order up conversion * @ADV7511_UP_CONVERSION_FIRST_ORDER: Use first order up conversion * * This used when converting from a 4:2:2 format to a 4:4:4 format. **/enum adv7511_up_conversion { ADV7511_UP_CONVERSION_ZERO_ORDER = 0, ADV7511_UP_CONVERSION_FIRST_ORDER = 0,}; /** * struct adv7511_video_input_config - Describes adv7511 hardware configuration * @id: Video input format id * @input_style: Video input format style * @sync_pulse: Select the sync pulse * @clock_delay: Clock delay for the input clock * @reverse_bitorder: Reverse video input signal bitorder * @bit_justification: Video input format bit justification * @up_conversion: Selects the upscaling conversion method * @input_color_depth: Input video format color depth * @tmds_clock_inversion: Whether to invert the TDMS clock * @vsync_polartity: vsync input signal configuration * @hsync_polartity: hsync input signal configuration * @csc_enable: Whether to enable color space conversion * @csc_scaling_factor: Color space conversion scaling factor * @csc_coefficents: Color space conversion coefficents * @output_format: Video output format * @timing_gen_seq: Selects the order in which sync DE generation * and sync adjustment are performt. * @hdmi_mode: Whether to use HDMI or DVI output mode **/struct adv7511_video_input_config { enum adv7511_input_id id; enum adv7511_input_style input_style; enum adv7511_input_sync_pulse sync_pulse; enum adv7511_input_clock_delay clock_delay; bool reverse_bitorder; enum adv7511_input_bit_justifiction bit_justification; enum adv7511_up_conversion up_conversion; enum adv7511_input_color_depth input_color_depth; bool tmds_clock_inversion; enum adv7511_sync_polarity vsync_polarity; enum adv7511_sync_polarity hsync_polarity; bool csc_enable; enum adv7511_csc_scaling csc_scaling_factor; const uint16_t *csc_coefficents; enum adv7511_output_format output_format; enum adv7511_timing_gen_seq timing_gen_seq; bool hdmi_mode;};
示例配置static const uint16_t adv7511_csc_ycbcr_to_rgb[] = { 0x0734, 0x04ad, 0x0000, 0x1c1b, 0x1ddc, 0x04ad, 0x1f24, 0x0135, 0x0000, 0x04ad, 0x087c, 0x1b77,}; static const struct adv7511_video_input_config adv7511_config_zc702 = { .id = ADV7511_INPUT_ID_16_20_24BIT_YCbCr422_SEPARATE_SYNC, .input_style = ADV7511_INPUT_STYLE1, .sync_pulse = ADV7511_INPUT_SYNC_PULSE_NONE, .clock_delay = ADV7511_INPUT_CLOCK_DELAY_NONE, .reverse_bitorder = false, .vsync_polarity = ADV7511_SYNC_POLARITY_HIGH, .hsync_polarity = ADV7511_SYNC_POLARITY_HIGH, .up_conversion = ADV7511_UP_CONVERSION_ZERO_ORDER, .input_color_depth = ADV7511_INPUT_COLOR_DEPTH_8BIT, .output_format = ADV7511_OUTPUT_FORMAT_RGB_444, .csc_enable = true, .csc_coefficents = adv7511_csc_ycbcr_to_rgb, .csc_scaling_factor = ADV7511_CSC_SCALING_4, .bit_justification = ADV7511_INPUT_BIT_JUSTIFICATION_RIGHT, .tmds_clock_inversion = true,}; [...] struct drm_encoder_slave_funcs *sfuncs = get_slave_funcs(encoder); sfuncs->set_config(encoder, &adv7511_config_zc702);[...]
ASoC在
DAI配置编解码器驱动程序注册一个DAI:adau-hifi
支持的DAI格式名称由驱动程序支持描述
SND_SOC_DAIFMT_I2S 是I2S模式
SND_SOC_DAIFMT_RIGHT_J是右对齐模式
SND_SOC_DAIFMT_LEFT_J 是左对齐模式
SND_SOC_DAIFMT_ DSP _A 没有 FRM LRC之后的数据MSB
SND_SOC_DAIFMT_ DSP _B 没有 FRM LRC期间的 数据MSB
SND_SOC_DAIFMT_AC97 没有 AC97模式
SND_SOC_DAIFMT_PDM 没有 脉冲密度调制
SND_SOC_DAIFMT_SPDIF 是SPDIF
SND_SOC_DAIFMT_NB_NF是 正常的位和帧时钟
SND_SOC_DAIFMT_NB_IF没有正常的bitclock,倒置的frameclock
SND_SOC_DAIFMT_IB_NF是倒帧时钟,普通bitclock
SND_SOC_DAIFMT_IB_IF没有倒位和帧时钟
SND_SOC_DAIFMT_CBM_CFM没有 编解码器位和帧时钟主站
SND_SOC_DAIFMT_CBS_CFM没有 Codec bitclock slave,frameclock master
SND_SOC_DAIFMT_CBM_CFS没有 Codec bitclock master,frameclock slave
SND_SOC_DAIFMT_CBS_CFS是编解码器位和帧时钟从站
示例DAI配置static struct snd_soc_dai_link hdmi_dai_link = { .name = "HDMI", .stream_name = "HDMI", .cpu_dai_name = "75c00000.axi-spdif-tx", .platform_name = "xilinx_pcm_audio.2", .codec_name = "adv7511.0-0039", .codec_dai_name = "adv7511", .dai_fmt = SND_SOC_DAIFMT_SPDIF | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS,}; static struct snd_soc_card hdmi_card = { .name = "HDMI monitor", .owner = THIS_MODULE, .dai_link = &hdmi_dai_link, .num_links = 1,};
启用Linux驱动程序支持使用“make menuconfig”配置内核(或者使用“make xconfig”或“make qconfig”)
ADV7511驱动器依赖于CONFIG_DRM和CONFIG_ I2C
Linux Kernel Configuration Device Drivers ---> Graphics support ---> <*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) ---> ... <*> AV7511 encoder
|