linux/drivers/gpu/drm/i915/display/intel_tv_regs.h

/* SPDX-License-Identifier: MIT */
/*
 * Copyright © 2023 Intel Corporation
 */

#ifndef __INTEL_TV_REGS_H__
#define __INTEL_TV_REGS_H__

#include "intel_display_reg_defs.h"

/* TV port control */
#define TV_CTL
/* Enables the TV encoder */
#define TV_ENC_ENABLE
/* Sources the TV encoder input from pipe B instead of A. */
#define TV_ENC_PIPE_SEL_SHIFT
#define TV_ENC_PIPE_SEL_MASK
#define TV_ENC_PIPE_SEL(pipe)
/* Outputs composite video (DAC A only) */
#define TV_ENC_OUTPUT_COMPOSITE
/* Outputs SVideo video (DAC B/C) */
#define TV_ENC_OUTPUT_SVIDEO
/* Outputs Component video (DAC A/B/C) */
#define TV_ENC_OUTPUT_COMPONENT
/* Outputs Composite and SVideo (DAC A/B/C) */
#define TV_ENC_OUTPUT_SVIDEO_COMPOSITE
#define TV_TRILEVEL_SYNC
/* Enables slow sync generation (945GM only) */
#define TV_SLOW_SYNC
/* Selects 4x oversampling for 480i and 576p */
#define TV_OVERSAMPLE_4X
/* Selects 2x oversampling for 720p and 1080i */
#define TV_OVERSAMPLE_2X
/* Selects no oversampling for 1080p */
#define TV_OVERSAMPLE_NONE
/* Selects 8x oversampling */
#define TV_OVERSAMPLE_8X
#define TV_OVERSAMPLE_MASK
/* Selects progressive mode rather than interlaced */
#define TV_PROGRESSIVE
/* Sets the colorburst to PAL mode.  Required for non-M PAL modes. */
#define TV_PAL_BURST
/* Field for setting delay of Y compared to C */
#define TV_YC_SKEW_MASK
/* Enables a fix for 480p/576p standard definition modes on the 915GM only */
#define TV_ENC_SDP_FIX
/*
 * Enables a fix for the 915GM only.
 *
 * Not sure what it does.
 */
#define TV_ENC_C0_FIX
/* Bits that must be preserved by software */
#define TV_CTL_SAVE
#define TV_FUSE_STATE_MASK
/* Read-only state that reports all features enabled */
#define TV_FUSE_STATE_ENABLED
/* Read-only state that reports that Macrovision is disabled in hardware*/
#define TV_FUSE_STATE_NO_MACROVISION
/* Read-only state that reports that TV-out is disabled in hardware. */
#define TV_FUSE_STATE_DISABLED
/* Normal operation */
#define TV_TEST_MODE_NORMAL
/* Encoder test pattern 1 - combo pattern */
#define TV_TEST_MODE_PATTERN_1
/* Encoder test pattern 2 - full screen vertical 75% color bars */
#define TV_TEST_MODE_PATTERN_2
/* Encoder test pattern 3 - full screen horizontal 75% color bars */
#define TV_TEST_MODE_PATTERN_3
/* Encoder test pattern 4 - random noise */
#define TV_TEST_MODE_PATTERN_4
/* Encoder test pattern 5 - linear color ramps */
#define TV_TEST_MODE_PATTERN_5
/*
 * This test mode forces the DACs to 50% of full output.
 *
 * This is used for load detection in combination with TVDAC_SENSE_MASK
 */
#define TV_TEST_MODE_MONITOR_DETECT
#define TV_TEST_MODE_MASK

#define TV_DAC
#define TV_DAC_SAVE
/*
 * Reports that DAC state change logic has reported change (RO).
 *
 * This gets cleared when TV_DAC_STATE_EN is cleared
*/
#define TVDAC_STATE_CHG
#define TVDAC_SENSE_MASK
/* Reports that DAC A voltage is above the detect threshold */
#define TVDAC_A_SENSE
/* Reports that DAC B voltage is above the detect threshold */
#define TVDAC_B_SENSE
/* Reports that DAC C voltage is above the detect threshold */
#define TVDAC_C_SENSE
/*
 * Enables DAC state detection logic, for load-based TV detection.
 *
 * The PLL of the chosen pipe (in TV_CTL) must be running, and the encoder set
 * to off, for load detection to work.
 */
#define TVDAC_STATE_CHG_EN
/* Sets the DAC A sense value to high */
#define TVDAC_A_SENSE_CTL
/* Sets the DAC B sense value to high */
#define TVDAC_B_SENSE_CTL
/* Sets the DAC C sense value to high */
#define TVDAC_C_SENSE_CTL
/* Overrides the ENC_ENABLE and DAC voltage levels */
#define DAC_CTL_OVERRIDE
/* Sets the slew rate.  Must be preserved in software */
#define ENC_TVDAC_SLEW_FAST
#define DAC_A_1_3_V
#define DAC_A_1_1_V
#define DAC_A_0_7_V
#define DAC_A_MASK
#define DAC_B_1_3_V
#define DAC_B_1_1_V
#define DAC_B_0_7_V
#define DAC_B_MASK
#define DAC_C_1_3_V
#define DAC_C_1_1_V
#define DAC_C_0_7_V
#define DAC_C_MASK

/*
 * CSC coefficients are stored in a floating point format with 9 bits of
 * mantissa and 2 or 3 bits of exponent.  The exponent is represented as 2**-n,
 * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with
 * -1 (0x3) being the only legal negative value.
 */
#define TV_CSC_Y
#define TV_RY_MASK
#define TV_RY_SHIFT
#define TV_GY_MASK
#define TV_GY_SHIFT

#define TV_CSC_Y2
#define TV_BY_MASK
#define TV_BY_SHIFT
/*
 * Y attenuation for component video.
 *
 * Stored in 1.9 fixed point.
 */
#define TV_AY_MASK
#define TV_AY_SHIFT

#define TV_CSC_U
#define TV_RU_MASK
#define TV_RU_SHIFT
#define TV_GU_MASK
#define TV_GU_SHIFT

#define TV_CSC_U2
#define TV_BU_MASK
#define TV_BU_SHIFT
/*
 * U attenuation for component video.
 *
 * Stored in 1.9 fixed point.
 */
#define TV_AU_MASK
#define TV_AU_SHIFT

#define TV_CSC_V
#define TV_RV_MASK
#define TV_RV_SHIFT
#define TV_GV_MASK
#define TV_GV_SHIFT

#define TV_CSC_V2
#define TV_BV_MASK
#define TV_BV_SHIFT
/*
 * V attenuation for component video.
 *
 * Stored in 1.9 fixed point.
 */
#define TV_AV_MASK
#define TV_AV_SHIFT

#define TV_CLR_KNOBS
/* 2s-complement brightness adjustment */
#define TV_BRIGHTNESS_MASK
#define TV_BRIGHTNESS_SHIFT
/* Contrast adjustment, as a 2.6 unsigned floating point number */
#define TV_CONTRAST_MASK
#define TV_CONTRAST_SHIFT
/* Saturation adjustment, as a 2.6 unsigned floating point number */
#define TV_SATURATION_MASK
#define TV_SATURATION_SHIFT
/* Hue adjustment, as an integer phase angle in degrees */
#define TV_HUE_MASK
#define TV_HUE_SHIFT

#define TV_CLR_LEVEL
/* Controls the DAC level for black */
#define TV_BLACK_LEVEL_MASK
#define TV_BLACK_LEVEL_SHIFT
/* Controls the DAC level for blanking */
#define TV_BLANK_LEVEL_MASK
#define TV_BLANK_LEVEL_SHIFT

#define TV_H_CTL_1
/* Number of pixels in the hsync. */
#define TV_HSYNC_END_MASK
#define TV_HSYNC_END_SHIFT
/* Total number of pixels minus one in the line (display and blanking). */
#define TV_HTOTAL_MASK
#define TV_HTOTAL_SHIFT

#define TV_H_CTL_2
/* Enables the colorburst (needed for non-component color) */
#define TV_BURST_ENA
/* Offset of the colorburst from the start of hsync, in pixels minus one. */
#define TV_HBURST_START_SHIFT
#define TV_HBURST_START_MASK
/* Length of the colorburst */
#define TV_HBURST_LEN_SHIFT
#define TV_HBURST_LEN_MASK

#define TV_H_CTL_3
/* End of hblank, measured in pixels minus one from start of hsync */
#define TV_HBLANK_END_SHIFT
#define TV_HBLANK_END_MASK
/* Start of hblank, measured in pixels minus one from start of hsync */
#define TV_HBLANK_START_SHIFT
#define TV_HBLANK_START_MASK

#define TV_V_CTL_1
/* XXX */
#define TV_NBR_END_SHIFT
#define TV_NBR_END_MASK
/* XXX */
#define TV_VI_END_F1_SHIFT
#define TV_VI_END_F1_MASK
/* XXX */
#define TV_VI_END_F2_SHIFT
#define TV_VI_END_F2_MASK

#define TV_V_CTL_2
/* Length of vsync, in half lines */
#define TV_VSYNC_LEN_MASK
#define TV_VSYNC_LEN_SHIFT
/* Offset of the start of vsync in field 1, measured in one less than the
 * number of half lines.
 */
#define TV_VSYNC_START_F1_MASK
#define TV_VSYNC_START_F1_SHIFT
/*
 * Offset of the start of vsync in field 2, measured in one less than the
 * number of half lines.
 */
#define TV_VSYNC_START_F2_MASK
#define TV_VSYNC_START_F2_SHIFT

#define TV_V_CTL_3
/* Enables generation of the equalization signal */
#define TV_EQUAL_ENA
/* Length of vsync, in half lines */
#define TV_VEQ_LEN_MASK
#define TV_VEQ_LEN_SHIFT
/* Offset of the start of equalization in field 1, measured in one less than
 * the number of half lines.
 */
#define TV_VEQ_START_F1_MASK
#define TV_VEQ_START_F1_SHIFT
/*
 * Offset of the start of equalization in field 2, measured in one less than
 * the number of half lines.
 */
#define TV_VEQ_START_F2_MASK
#define TV_VEQ_START_F2_SHIFT

#define TV_V_CTL_4
/*
 * Offset to start of vertical colorburst, measured in one less than the
 * number of lines from vertical start.
 */
#define TV_VBURST_START_F1_MASK
#define TV_VBURST_START_F1_SHIFT
/*
 * Offset to the end of vertical colorburst, measured in one less than the
 * number of lines from the start of NBR.
 */
#define TV_VBURST_END_F1_MASK
#define TV_VBURST_END_F1_SHIFT

#define TV_V_CTL_5
/*
 * Offset to start of vertical colorburst, measured in one less than the
 * number of lines from vertical start.
 */
#define TV_VBURST_START_F2_MASK
#define TV_VBURST_START_F2_SHIFT
/*
 * Offset to the end of vertical colorburst, measured in one less than the
 * number of lines from the start of NBR.
 */
#define TV_VBURST_END_F2_MASK
#define TV_VBURST_END_F2_SHIFT

#define TV_V_CTL_6
/*
 * Offset to start of vertical colorburst, measured in one less than the
 * number of lines from vertical start.
 */
#define TV_VBURST_START_F3_MASK
#define TV_VBURST_START_F3_SHIFT
/*
 * Offset to the end of vertical colorburst, measured in one less than the
 * number of lines from the start of NBR.
 */
#define TV_VBURST_END_F3_MASK
#define TV_VBURST_END_F3_SHIFT

#define TV_V_CTL_7
/*
 * Offset to start of vertical colorburst, measured in one less than the
 * number of lines from vertical start.
 */
#define TV_VBURST_START_F4_MASK
#define TV_VBURST_START_F4_SHIFT
/*
 * Offset to the end of vertical colorburst, measured in one less than the
 * number of lines from the start of NBR.
 */
#define TV_VBURST_END_F4_MASK
#define TV_VBURST_END_F4_SHIFT

#define TV_SC_CTL_1
/* Turns on the first subcarrier phase generation DDA */
#define TV_SC_DDA1_EN
/* Turns on the first subcarrier phase generation DDA */
#define TV_SC_DDA2_EN
/* Turns on the first subcarrier phase generation DDA */
#define TV_SC_DDA3_EN
/* Sets the subcarrier DDA to reset frequency every other field */
#define TV_SC_RESET_EVERY_2
/* Sets the subcarrier DDA to reset frequency every fourth field */
#define TV_SC_RESET_EVERY_4
/* Sets the subcarrier DDA to reset frequency every eighth field */
#define TV_SC_RESET_EVERY_8
/* Sets the subcarrier DDA to never reset the frequency */
#define TV_SC_RESET_NEVER
/* Sets the peak amplitude of the colorburst.*/
#define TV_BURST_LEVEL_MASK
#define TV_BURST_LEVEL_SHIFT
/* Sets the increment of the first subcarrier phase generation DDA */
#define TV_SCDDA1_INC_MASK
#define TV_SCDDA1_INC_SHIFT

#define TV_SC_CTL_2
/* Sets the rollover for the second subcarrier phase generation DDA */
#define TV_SCDDA2_SIZE_MASK
#define TV_SCDDA2_SIZE_SHIFT
/* Sets the increent of the second subcarrier phase generation DDA */
#define TV_SCDDA2_INC_MASK
#define TV_SCDDA2_INC_SHIFT

#define TV_SC_CTL_3
/* Sets the rollover for the third subcarrier phase generation DDA */
#define TV_SCDDA3_SIZE_MASK
#define TV_SCDDA3_SIZE_SHIFT
/* Sets the increent of the third subcarrier phase generation DDA */
#define TV_SCDDA3_INC_MASK
#define TV_SCDDA3_INC_SHIFT

#define TV_WIN_POS
/* X coordinate of the display from the start of horizontal active */
#define TV_XPOS_MASK
#define TV_XPOS_SHIFT
/* Y coordinate of the display from the start of vertical active (NBR) */
#define TV_YPOS_MASK
#define TV_YPOS_SHIFT

#define TV_WIN_SIZE
/* Horizontal size of the display window, measured in pixels*/
#define TV_XSIZE_MASK
#define TV_XSIZE_SHIFT
/*
 * Vertical size of the display window, measured in pixels.
 *
 * Must be even for interlaced modes.
 */
#define TV_YSIZE_MASK
#define TV_YSIZE_SHIFT

#define TV_FILTER_CTL_1
/*
 * Enables automatic scaling calculation.
 *
 * If set, the rest of the registers are ignored, and the calculated values can
 * be read back from the register.
 */
#define TV_AUTO_SCALE
/*
 * Disables the vertical filter.
 *
 * This is required on modes more than 1024 pixels wide */
#define TV_V_FILTER_BYPASS
/* Enables adaptive vertical filtering */
#define TV_VADAPT
#define TV_VADAPT_MODE_MASK
/* Selects the least adaptive vertical filtering mode */
#define TV_VADAPT_MODE_LEAST
/* Selects the moderately adaptive vertical filtering mode */
#define TV_VADAPT_MODE_MODERATE
/* Selects the most adaptive vertical filtering mode */
#define TV_VADAPT_MODE_MOST
/*
 * Sets the horizontal scaling factor.
 *
 * This should be the fractional part of the horizontal scaling factor divided
 * by the oversampling rate.  TV_HSCALE should be less than 1, and set to:
 *
 * (src width - 1) / ((oversample * dest width) - 1)
 */
#define TV_HSCALE_FRAC_MASK
#define TV_HSCALE_FRAC_SHIFT

#define TV_FILTER_CTL_2
/*
 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
 *
 * TV_VSCALE should be (src height - 1) / ((interlace * dest height) - 1)
 */
#define TV_VSCALE_INT_MASK
#define TV_VSCALE_INT_SHIFT
/*
 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
 *
 * \sa TV_VSCALE_INT_MASK
 */
#define TV_VSCALE_FRAC_MASK
#define TV_VSCALE_FRAC_SHIFT

#define TV_FILTER_CTL_3
/*
 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
 *
 * TV_VSCALE should be (src height - 1) / (1/4 * (dest height - 1))
 *
 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
 */
#define TV_VSCALE_IP_INT_MASK
#define TV_VSCALE_IP_INT_SHIFT
/*
 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
 *
 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
 *
 * \sa TV_VSCALE_IP_INT_MASK
 */
#define TV_VSCALE_IP_FRAC_MASK
#define TV_VSCALE_IP_FRAC_SHIFT

#define TV_CC_CONTROL
#define TV_CC_ENABLE
/*
 * Specifies which field to send the CC data in.
 *
 * CC data is usually sent in field 0.
 */
#define TV_CC_FID_MASK
#define TV_CC_FID_SHIFT
/* Sets the horizontal position of the CC data.  Usually 135. */
#define TV_CC_HOFF_MASK
#define TV_CC_HOFF_SHIFT
/* Sets the vertical position of the CC data.  Usually 21 */
#define TV_CC_LINE_MASK
#define TV_CC_LINE_SHIFT

#define TV_CC_DATA
#define TV_CC_RDY
/* Second word of CC data to be transmitted. */
#define TV_CC_DATA_2_MASK
#define TV_CC_DATA_2_SHIFT
/* First word of CC data to be transmitted. */
#define TV_CC_DATA_1_MASK
#define TV_CC_DATA_1_SHIFT

#define TV_H_LUMA(i)
#define TV_H_CHROMA(i)
#define TV_V_LUMA(i)
#define TV_V_CHROMA(i)

#endif /* __INTEL_TV_REGS_H__ */