piSmasher Configuration Libraries
piSmasher peripheral device configuration libraries
TDA998x HDMI Transmitter

Modules

 Matrix Control
 
 TDA998X_Audio
 
 TDA998X_CEC_Core
 
 TDA998X_EDID
 
 TDA998X_HDMI_Core
 
 TDA998X_Video_In
 
 TDA998X_Video_Out
 

Data Structures

struct  tda998x_pkt
 Metadata packet structure. More...
 
struct  tda998x_mpeg_pkt
 
struct  tda998x_spd_pkt
 
struct  tda998x_cfg
 TDA998X driver configuration. More...
 
struct  tda998x_dev
 TDA998X device. More...
 

Macros

#define PAGE_ADDR(__PAGE__, __ADDR__)   (((__PAGE__) << 8) | ((__ADDR__) & 0xFFU))
 
#define PAGE_OF(__REG__)   (((__REG__) >> 8) & 0xFFU)
 
#define ERR_BAD_PARAM   (0x009U)
 
#define ERR_NOT_PERMITTED   (0x00AU)
 
#define ERR_NULL_PARAM   (0x00BU)
 
#define ERR_ILLEGAL_PARAMS   (0x010U)
 
#define ERR_NOT_FOUND   (0x011U)
 
#define ERR_RESOURCE_NOT_AVAILABLE   (0x012U)
 
#define DDC_EDID_ADDRESS   (0xA0U)
 
#define DDC_EDID_ADDRESS_ALT   (0xA2U)
 
#define DDC_SGMT_PTR_ADDRESS   (0x60U)
 
#define EDID_BLK0_EXT_CNT   (0x7E)
 

Enumerations

enum  tda998x_sink { SINK_DVI = 0, SINK_HDMI = 0x01, SINK_EDID = 0x02 }
 
enum  tda998x_vid_fmt {
  VFMT_INVALID = 0, VFMT_01_640x480p_60Hz = 1, VFMT_02_720x480p_60Hz = 2, VFMT_03_720x480p_60Hz = 3,
  VFMT_04_1280x720p_60Hz = 4, VFMT_05_1920x1080i_60Hz = 5, VFMT_06_720x480i_60Hz = 6, VFMT_07_720x480i_60Hz = 7,
  VFMT_08_720x240p_60Hz = 8, VFMT_09_720x240p_60Hz = 9, VFMT_10_720x480i_60Hz = 10, VFMT_11_720x480i_60Hz = 11,
  VFMT_12_720x240p_60Hz = 12, VFMT_13_720x240p_60Hz = 13, VFMT_14_1440x480p_60Hz = 14, VFMT_15_1440x480p_60Hz = 15,
  VFMT_16_1920x1080p_60Hz = 16, VFMT_17_720x576p_50Hz = 17, VFMT_18_720x576p_50Hz = 18, VFMT_19_1280x720p_50Hz = 19,
  VFMT_20_1920x1080i_50Hz = 20, VFMT_21_720x576i_50Hz = 21, VFMT_22_720x576i_50Hz = 22, VFMT_23_720x288p_50Hz = 23,
  VFMT_24_720x288p_50Hz = 24, VFMT_25_720x576i_50Hz = 25, VFMT_26_720x576i_50Hz = 26, VFMT_27_720x288p_50Hz = 27,
  VFMT_28_720x288p_50Hz = 28, VFMT_29_1440x576p_50Hz = 29, VFMT_30_1440x576p_50Hz = 30, VFMT_31_1920x1080p_50Hz = 31,
  VFMT_32_1920x1080p_24Hz = 32, VFMT_33_1920x1080p_25Hz = 33, VFMT_34_1920x1080p_30Hz = 34, VFMT_35_2880x480p_60Hz = 35,
  VFMT_36_2880x480p_60Hz = 36, VFMT_37_2880x576p_50Hz = 37, VFMT_38_2880x576p_50Hz = 38, VFMT_60_1280x720p_24Hz = 60,
  VFMT_61_1280x720p_25Hz = 61, VFMT_62_1280x720p_30Hz = 62, VFMT_PC_640x480p_60Hz = 128, VFMT_PC_800x600p_60Hz = 129,
  VFMT_PC_1152x960p_60Hz = 130, VFMT_PC_1024x768p_60Hz = 131, VFMT_PC_1280x768p_60Hz = 132, VFMT_PC_1280x1024p_60Hz = 133,
  VFMT_PC_1366x768p_60Hz = 134, VFMT_PC_1400x1050p_60Hz = 135, VFMT_PC_1600x1200p_60Hz = 136, VFMT_PC_1920x1200p_60Hz = 137
}
 EIA/CEA-861B video format type. More...
 
enum  tda998x_vidin_mode { VINMODE_CCIR656 = 0, VINMODE_RGB444 = 1, VINMODE_YUV444 = 2, VINMODE_YUV422 = 3 }
 
enum  tda998x_sync_src { SYNCSRC_EMBEDDED = 0, SYNCSRC_EXT_VREF = 1, SYNCSRC_EXT_VS = 2 }
 
enum  tda998x_scaler_mode { SCALER_MODE_OFF = 0, SCALER_MODE_ON = 1, SCALER_MODE_AUTO = 2 }
 
enum  tda998x_format_3d { FORMAT_3D_NONE = 0, FORMAT_3D_FRAME_PACKING = 1, FORMAT_3D_TOP_AND_BOTTOM = 2, FORMAT_3D_SIDE_BY_SIDEF = 3 }
 
enum  tda998x_vidout_mode { VOUTMODE_RGB444 = 0, VOUTMODE_YUV422 = 1, VOUTMODE_YUV444 = 2 }
 
enum  tda998x_dwidth { VOUT_DBITS_12 = 0, VOUT_DBITS_8 = 1, VOUT_DBITS_10 = 2 }
 
enum  tda998x_color_depth { COLORDEPTH_24 = 0, COLORDEPTH_30 = 1, COLORDEPTH_36 = 2, COLORDEPTH_48 = 3 }
 
enum  tda998x_vqr { VQR_DEFAULT = 0, VQR_RGB_FULL = 1, VQR_RGB_LIMITED = 2 }
 Video quantization range. More...
 
enum  tda998x_mpeg_frame { MPEG_FRAME_UNKNOWN = 0, MPEG_FRAME_I = 1, MPEG_FRAME_B = 2, MPEG_FRAME_P = 3 }
 
enum  tda998x_spd_dev {
  SPDINFO_UNKNOWN = 0, SPDINFO_DIGITAL_STB = 1, SPDINFO_DVD = 2, SPDINFO_DVHS = 3,
  SPDINFO_HDD_VIDEO = 4, SPDINFO_DVC = 5, SPDINFO_DSC = 6, SPDINFO_VIDEO_CD = 7,
  SPDINFO_GAME = 8, SPDINFO_PC = 9
}
 
enum  tda998x_state { TDA998X_STATE_ON, TDA998X_STATE_STANDBY, TDA998X_STATE_SUSPEND, TDA998X_STATE_OFF }
 TDA998X state. More...
 
enum  tda998x_hotplug_status { HOTPLUG_INACTIVE = 0, HOTPLUG_ACTIVE }
 
enum  tda998x_callback {
  CALLBACK_ENCRYPT, CALLBACK_HPD, CALLBACK_T0, CALLBACK_BCAPS,
  CALLBACK_BSTATUS, CALLBACK_SHA_1, CALLBACK_PJ, CALLBACK_R0,
  CALLBACK_SW_INT, CALLBACK_RX_SENSE, CALLBACK_EDID_BLK_READ, CALLBACK_PLL_LOCK,
  CALLBACK_VS_RPT
}
 

Functions

int tda998x_init (struct tda998x_dev *dev, struct tda998x_cfg *cfg)
 
int tda998x_edid_get_block (struct tda998x_dev *dev, uint8_t *block, int nblocks, int len)
 Get EDID Block Data. More...
 
int tda998x_read_edid (struct tda998x_dev *dev, uint8_t *data)
 
int tda998x_get_hotplug_status (struct tda998x_dev *dev, enum tda998x_hotplug_status *hotplug_status, bool client)
 
int tda998x_set_input_output (struct tda998x_dev *dev, struct tda998x_vidin_cfg *vidin_cfg, struct tda998x_vidout_cfg *vidout_cfg, struct tda998x_audin_cfg *audin_cfg, enum tda998x_sink sink)
 Set Input and Output. More...
 
int tda998x_handle_interrupt (struct tda998x_dev *dev)
 

Detailed Description

Enumeration Type Documentation

◆ tda998x_callback

#include <projects/lib/tda998x.h>

Enumerator
CALLBACK_ENCRYPT 

HDCP encrypt as above (Obsolete)

CALLBACK_HPD 

Transition on HPD input

CALLBACK_T0 

HDCP state machine in state T0

CALLBACK_BCAPS 

BCAPS available

CALLBACK_BSTATUS 

BSTATUS available

CALLBACK_SHA_1 

sha-1(ksv,bstatus,m0)=V'

CALLBACK_PJ 

pj=pj' check fails

CALLBACK_R0 

R0 interrupt

CALLBACK_SW_INT 

SW DEBUG interrupt

CALLBACK_RX_SENSE 

RX SENSE interrupt

CALLBACK_EDID_BLK_READ 

EDID BLK READ interrupt

CALLBACK_PLL_LOCK 

Pll Lock (Serial or Formatter)

CALLBACK_VS_RPT 

VS Interrupt for Gamut packets

489  {
491  CALLBACK_HPD,
492  CALLBACK_T0,
496  CALLBACK_PJ,
497  CALLBACK_R0,
Definition: tda998x.h:491
Definition: tda998x.h:498
Definition: tda998x.h:499
Definition: tda998x.h:495
Definition: tda998x.h:500
Definition: tda998x.h:494
Definition: tda998x.h:497
Definition: tda998x.h:489
Definition: tda998x.h:496
Definition: tda998x.h:493
Definition: tda998x.h:492
Definition: tda998x.h:501
Definition: tda998x.h:490

◆ tda998x_color_depth

#include <projects/lib/tda998x.h>

Enumerator
COLORDEPTH_24 

8 bits per color

COLORDEPTH_30 

10 bits per color

COLORDEPTH_36 

12 bits per color

COLORDEPTH_48 

16 bits per color

208  {
209  COLORDEPTH_24 = 0,
210  COLORDEPTH_30 = 1,
211  COLORDEPTH_36 = 2,
212  COLORDEPTH_48 = 3
Definition: tda998x.h:208
Definition: tda998x.h:211
Definition: tda998x.h:209
Definition: tda998x.h:210

◆ tda998x_dwidth

#include <projects/lib/tda998x.h>

Enumerator
VOUT_DBITS_12 

12 bits

VOUT_DBITS_8 

8 bits

VOUT_DBITS_10 

10 bits

202  {
203  VOUT_DBITS_12 = 0,
204  VOUT_DBITS_8 = 1,
205  VOUT_DBITS_10 = 2,
Definition: tda998x.h:204
Definition: tda998x.h:203
Definition: tda998x.h:202

◆ tda998x_format_3d

#include <projects/lib/tda998x.h>

Enumerator
FORMAT_3D_NONE 

3D video data not present

FORMAT_3D_FRAME_PACKING 

Frame packing

FORMAT_3D_TOP_AND_BOTTOM 

Top and bottom

FORMAT_3D_SIDE_BY_SIDEF 

Side by side half structure

189  {
190  FORMAT_3D_NONE = 0,
Definition: tda998x.h:189
Definition: tda998x.h:192
Definition: tda998x.h:190
Definition: tda998x.h:191

◆ tda998x_mpeg_frame

#include <projects/lib/tda998x.h>

Enumerator
MPEG_FRAME_UNKNOWN 

Unknown

MPEG_FRAME_I 

i-frame

MPEG_FRAME_B 

b-frame

MPEG_FRAME_P 

p-frame

232  {
233  MPEG_FRAME_UNKNOWN = 0,
234  MPEG_FRAME_I = 1,
235  MPEG_FRAME_B = 2,
236  MPEG_FRAME_P = 3,
Definition: tda998x.h:235
Definition: tda998x.h:233
Definition: tda998x.h:232
Definition: tda998x.h:234

◆ tda998x_scaler_mode

#include <projects/lib/tda998x.h>

Enumerator
SCALER_MODE_OFF 

Off

SCALER_MODE_ON 

On

SCALER_MODE_AUTO 

Auto

166  {
167  SCALER_MODE_OFF = 0,
168  SCALER_MODE_ON = 1,
169  SCALER_MODE_AUTO = 2,
Definition: tda998x.h:167
Definition: tda998x.h:168
Definition: tda998x.h:166

◆ tda998x_sink

#include <projects/lib/tda998x.h>

Enumerator
SINK_DVI 

DVI

SINK_HDMI 

HDMI

SINK_EDID 

As currently defined in EDID

64  {
65  SINK_DVI = 0,
66  SINK_HDMI = 0x01,
67  SINK_EDID = 0x02
Definition: tda998x.h:64
Definition: tda998x.h:65
Definition: tda998x.h:66

◆ tda998x_state

#include <projects/lib/tda998x.h>

TDA998X state.

Enumerator
TDA998X_STATE_ON 

Powered on

TDA998X_STATE_STANDBY 

Device standby

TDA998X_STATE_SUSPEND 

Device suspend

TDA998X_STATE_OFF 

Powered off

476  {
Definition: tda998x.h:476
Definition: tda998x.h:477
Definition: tda998x.h:479
Definition: tda998x.h:478

◆ tda998x_sync_src

#include <projects/lib/tda998x.h>

Enumerator
SYNCSRC_EMBEDDED 

Embedded sync

SYNCSRC_EXT_VREF 

External sync Vref, Href, Fref

SYNCSRC_EXT_VS 

External sync Vs, Hs

135  {
136  SYNCSRC_EMBEDDED = 0,
137  SYNCSRC_EXT_VREF = 1,
138  SYNCSRC_EXT_VS = 2
Definition: tda998x.h:136
Definition: tda998x.h:137
Definition: tda998x.h:135

◆ tda998x_vid_fmt

#include <projects/lib/tda998x.h>

EIA/CEA-861B video format type.

Enumerator
VFMT_INVALID 

Invalid

VFMT_01_640x480p_60Hz 

Format 01 640 x 480p 60Hz

VFMT_02_720x480p_60Hz 

Format 02 720 x 480p 60Hz

VFMT_03_720x480p_60Hz 

Format 03 720 x 480p 60Hz

VFMT_04_1280x720p_60Hz 

Format 04 1280 x 720p 60Hz

VFMT_05_1920x1080i_60Hz 

Format 05 1920 x 1080i 60Hz

VFMT_06_720x480i_60Hz 

Format 06 720 x 480i 60Hz

VFMT_07_720x480i_60Hz 

Format 07 720 x 480i 60Hz

VFMT_08_720x240p_60Hz 

Format 08 720 x 240p 60Hz

VFMT_09_720x240p_60Hz 

Format 09 720 x 240p 60Hz

VFMT_10_720x480i_60Hz 

Format 10 720 x 480i 60Hz

VFMT_11_720x480i_60Hz 

Format 11 720 x 480i 60Hz

VFMT_12_720x240p_60Hz 

Format 12 720 x 240p 60Hz

VFMT_13_720x240p_60Hz 

Format 13 720 x 240p 60Hz

VFMT_14_1440x480p_60Hz 

Format 14 1440 x 480p 60Hz

VFMT_15_1440x480p_60Hz 

Format 15 1440 x 480p 60Hz

VFMT_16_1920x1080p_60Hz 

Format 16 1920 x 1080p 60Hz

VFMT_17_720x576p_50Hz 

Format 17 720 x 576p 50Hz

VFMT_18_720x576p_50Hz 

Format 18 720 x 576p 50Hz

VFMT_19_1280x720p_50Hz 

Format 19 1280 x 720p 50Hz

VFMT_20_1920x1080i_50Hz 

Format 20 1920 x 1080i 50Hz

VFMT_21_720x576i_50Hz 

Format 21 720 x 576i 50Hz

VFMT_22_720x576i_50Hz 

Format 22 720 x 576i 50Hz

VFMT_23_720x288p_50Hz 

Format 23 720 x 288p 50Hz

VFMT_24_720x288p_50Hz 

Format 24 720 x 288p 50Hz

VFMT_25_720x576i_50Hz 

Format 25 720 x 576i 50Hz

VFMT_26_720x576i_50Hz 

Format 26 720 x 576i 50Hz

VFMT_27_720x288p_50Hz 

Format 27 720 x 288p 50Hz

VFMT_28_720x288p_50Hz 

Format 28 720 x 288p 50Hz

VFMT_29_1440x576p_50Hz 

Format 29 1440 x 576p 50Hz

VFMT_30_1440x576p_50Hz 

Format 30 1440 x 576p 50Hz

VFMT_31_1920x1080p_50Hz 

Format 31 1920 x 1080p 50Hz

VFMT_32_1920x1080p_24Hz 

Format 32 1920 x 1080p 24Hz

VFMT_33_1920x1080p_25Hz 

Format 33 1920 x 1080p 25Hz

VFMT_34_1920x1080p_30Hz 

Format 34 1920 x 1080p 30Hz

VFMT_35_2880x480p_60Hz 

Format 35 2880 x 480p 60Hz 4:3

VFMT_36_2880x480p_60Hz 

Format 36 2880 x 480p 60Hz 16:9

VFMT_37_2880x576p_50Hz 

Format 37 2880 x 576p 50Hz 4:3

VFMT_38_2880x576p_50Hz 

Format 38 2880 x 576p 50Hz 16:9

VFMT_60_1280x720p_24Hz 

Format 60 1280 x 720p 23.97/24Hz 16:9

VFMT_61_1280x720p_25Hz 

Format 61 1280 x 720p 25Hz 16:9

VFMT_62_1280x720p_30Hz 

Format 60 1280 x 720p 29.97/30Hz 16:9

VFMT_PC_640x480p_60Hz 

PC format 128

VFMT_PC_800x600p_60Hz 

PC format 129

VFMT_PC_1152x960p_60Hz 

PC format 130

VFMT_PC_1024x768p_60Hz 

PC format 131

VFMT_PC_1280x768p_60Hz 

PC format 132

VFMT_PC_1280x1024p_60Hz 

PC format 133

VFMT_PC_1366x768p_60Hz 

PC format 134

VFMT_PC_1400x1050p_60Hz 

PC format 135

VFMT_PC_1600x1200p_60Hz 

PC format 136

VFMT_PC_1920x1200p_60Hz 

PC format custom

73  {
74  VFMT_INVALID = 0,
100  VFMT_26_720x576i_50Hz = 26,
101  VFMT_27_720x288p_50Hz = 27,
102  VFMT_28_720x288p_50Hz = 28,
116  VFMT_PC_640x480p_60Hz = 128,
117  VFMT_PC_800x600p_60Hz = 129,
118  VFMT_PC_1152x960p_60Hz = 130,
119  VFMT_PC_1024x768p_60Hz = 131,
120  VFMT_PC_1280x768p_60Hz = 132,
122  VFMT_PC_1366x768p_60Hz = 134,
Definition: tda998x.h:113
Definition: tda998x.h:101
Definition: tda998x.h:117
Definition: tda998x.h:109
Definition: tda998x.h:73
Definition: tda998x.h:89
Definition: tda998x.h:102
Definition: tda998x.h:118
Definition: tda998x.h:114
Definition: tda998x.h:120
Definition: tda998x.h:74
Definition: tda998x.h:122
Definition: tda998x.h:107
Definition: tda998x.h:92
Definition: tda998x.h:76
Definition: tda998x.h:84
Definition: tda998x.h:97
Definition: tda998x.h:91
Definition: tda998x.h:98
Definition: tda998x.h:95
Definition: tda998x.h:86
Definition: tda998x.h:110
Definition: tda998x.h:81
Definition: tda998x.h:116
Definition: tda998x.h:112
Definition: tda998x.h:119
Definition: tda998x.h:77
Definition: tda998x.h:87
Definition: tda998x.h:78
Definition: tda998x.h:99
Definition: tda998x.h:82
Definition: tda998x.h:80
Definition: tda998x.h:94
Definition: tda998x.h:83
Definition: tda998x.h:93
Definition: tda998x.h:85
Definition: tda998x.h:103
Definition: tda998x.h:96
Definition: tda998x.h:88
Definition: tda998x.h:105
Definition: tda998x.h:100
Definition: tda998x.h:108
Definition: tda998x.h:123
Definition: tda998x.h:115
Definition: tda998x.h:121
Definition: tda998x.h:79
Definition: tda998x.h:124
Definition: tda998x.h:106
Definition: tda998x.h:111
Definition: tda998x.h:90
Definition: tda998x.h:104
Definition: tda998x.h:75

◆ tda998x_vidin_mode

#include <projects/lib/tda998x.h>

Enumerator
VINMODE_CCIR656 

CCIR656

VINMODE_RGB444 

RGB444

VINMODE_YUV444 

YUV444

VINMODE_YUV422 

YUV422

128  {
129  VINMODE_CCIR656 = 0,
130  VINMODE_RGB444 = 1,
131  VINMODE_YUV444 = 2,
132  VINMODE_YUV422 = 3,
Definition: tda998x.h:131
Definition: tda998x.h:130
Definition: tda998x.h:129
Definition: tda998x.h:128

◆ tda998x_vidout_mode

#include <projects/lib/tda998x.h>

Enumerator
VOUTMODE_RGB444 

RGB444

VOUTMODE_YUV422 

YUV422

VOUTMODE_YUV444 

YUV444

196  {
197  VOUTMODE_RGB444 = 0,
198  VOUTMODE_YUV422 = 1,
199  VOUTMODE_YUV444 = 2
Definition: tda998x.h:196
Definition: tda998x.h:198
Definition: tda998x.h:197

◆ tda998x_vqr

#include <projects/lib/tda998x.h>

Video quantization range.

Enumerator
VQR_DEFAULT 

Follow HDMI spec.

VQR_RGB_FULL 

Force RGB FULL, DVI only

VQR_RGB_LIMITED 

Force RGB LIMITED, DVI only

218  {
219  VQR_DEFAULT = 0,
220  VQR_RGB_FULL = 1,
221  VQR_RGB_LIMITED = 2
Definition: tda998x.h:218
Definition: tda998x.h:219
Definition: tda998x.h:220

Function Documentation

◆ tda998x_edid_get_block()

int tda998x_edid_get_block ( struct tda998x_dev dev,
uint8_t *  block,
int  nblocks,
int  len 
)

#include <projects/lib/tda998x.h>

Get EDID Block Data.

Parameters
devTDA998x device structure pointer
Returns
0 on success, non-zero error status otherwise
2751 {
2752  int ret;
2753  struct tda998x_edid *edid;
2754 
2755  if ((dev == NULL) || (dev->edid == NULL))
2756  return ERR_NULL_PARAM;
2757 
2758  /* Enable EDID read */
2759  ret = write_reg(dev, INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD);
2760  if (ret < 0)
2761  return ret;
2762 
2763  edid = dev->edid;
2764 
2765  if (!edid->read_started) {
2766  /* Reset the EdidStatus in the Device Instance Structure */
2767  edid->state = EDID_NOT_READ;
2768 
2769  edid->read_started = true;
2770 
2771  /* Reset stored parameters from EDID in the Device Instance Structure */
2772  dev->sink = SINK_DVI;
2773 
2774  /* Enable the T0 interrupt for detecting the Read_EDID failure */
2775  ret = write_reg(dev, INT_FLAGS_0, INT_FLAGS_0_T0);
2776  if (ret < 0)
2777  return ret;
2778 
2779  /* Launch the read of first EDID block into Device Instance workspace */
2780  edid->req_id = 0;
2781  ret = request_edid_block(dev);
2782  if (ret < 0)
2783  return ret;
2784  } else {
2785  /* Not allowed if read edid is on going */
2786  return ERR_RESOURCE_NOT_AVAILABLE;
2787  }
2788 
2789  return 0;
2790 }
static int write_reg(struct tda998x_dev *dev, enum tda998x_hdmi_reg reg, uint8_t data)
Write Register.
Definition: tda998x.c:1283
int req_id
Definition: tda998x.h:317
Definition: tda998x.h:64
Definition: tda998x.h:313

◆ tda998x_set_input_output()

int tda998x_set_input_output ( struct tda998x_dev dev,
struct tda998x_vidin_cfg vidin_cfg,
struct tda998x_vidout_cfg vidout_cfg,
struct tda998x_audin_cfg audin_cfg,
enum tda998x_sink  sink 
)

#include <projects/lib/tda998x.h>

Set Input and Output.

Parameters
devTDA998x device structure pointer
vidin_cfgVideo input configuration structure pointer
vidout_cfgVideo output configuration structure pointer
audin_cfgAudio input configuration structure pointer
Returns
0 on success, non-zero error status otherwise

< Pixel repetition






< Data path bit width





< Pixel sampling edge




< Sync method



< Toggling


< Subpacket synchronization

< Blanking source

Todo:
BEGIN VIDO INPUT SYNCHRONIZATION
4809 {
4810  int ret;
4811  uint8_t pix_rpt;
4812  enum tda998x_dwidth dwidth;
4813  enum vip_cntrl_3_edge pix_edge;
4814  enum tbg_cntrl_0_sync_mthd sync_mthd;
4815  enum tda998x_pix_tgl toggle;
4816  uint8_t sync;
4817  enum vip_cntrl_3_sp_sync sp_sync;
4818  enum vip_cntrl_4_blnkit blankit;
4819  uint16_t ref_pix;
4820  uint16_t ref_line;
4821  const struct vidfmt_desc *desc;
4822 
4823  const enum vip_cntrl_swap *swap = NULL;
4824  const enum vip_cntrl_mirr *mirr = NULL;
4825 
4826 // if (sink == SINK_EDID) {
4827 // /* Change sink type with the currently defined in EDID */
4828 // ret = tda998x_edid_get_sinktype(dev, &sinktype);
4829 // if (ret < 0)
4830 // return ret;
4831 // }
4832 
4833  desc = get_vidfmt_desc(vidout_cfg->format);
4834  if (desc == NULL)
4835  return ERR_NOT_FOUND;
4836 
4837  /* Pixel repetition for DVI not allowed */
4838  if (sink == SINK_DVI) {
4839  if (((vidout_cfg->format >= VFMT_06_720x480i_60Hz) && (vidout_cfg->format <= VFMT_15_1440x480p_60Hz)) ||
4840  ((vidout_cfg->format >= VFMT_21_720x576i_50Hz) && (vidout_cfg->format <= VFMT_30_1440x576p_50Hz)) ||
4841  ((vidout_cfg->format >= VFMT_35_2880x480p_60Hz)&& (vidout_cfg->format <= VFMT_38_2880x576p_50Hz)))
4842  return ERR_BAD_PARAM;
4843  }
4844 
4845  /* Set the TMDS outputs to a forced state */
4846  ret = tda998x_set_tmds_output(dev, TMDSOUT_FORCED0);
4847  if (ret < 0)
4848  return ret;
4849 
4850  dev->vin_cfg = vidin_cfg;
4851  dev->vout_cfg = vidout_cfg;
4852 
4853  /* Set video output configuration */
4854  ret = tda998x_vidout_set_config(dev, sink, vidout_cfg->mode, PREFIL_OFF, YUVBLK_16, QRANGE_FS);
4855  if (ret < 0)
4856  return ret;
4857 
4858  /* Default config */
4859  pix_rpt = PIXREP_DEFAULT;
4860  dwidth = VOUT_DBITS_12;
4861  pix_edge = PIXEDGE_CLK_POS;
4862  sync_mthd = SYNCMTHD_V_XDE;
4863  toggle = PIXTOGL_ENABLE;
4864 
4865  /* Set sync details */
4866  if (vidin_cfg->sync_src == SYNCSRC_EMBEDDED) {
4867  sync = 1; /* Embedded sync */
4868  sp_sync = SPSYNC_HEMB;
4869  blankit = BLNKSRC_VS_HEMB_VEMB;
4870  sync_mthd = SYNCMTHD_V_XDE;
4871  } else {
4872  sync = 0; /* External sync */
4873 
4874  /* DE is available */
4875  sp_sync = SPSYNC_RISING_DE;
4876  blankit = BLNKSRC_NOT_DE;
4877  }
4878 
4879  /* Port swap table */
4880  switch(vidin_cfg->mode) {
4881 // case VINMODE_CCIR656:
4882 // dwidth = VOUT_DBITS_8;
4883 // pix_edge = PIXEDGE_CLK_NEG;
4884 // swap = port_map_ccir656;
4885 // mirr = mirr_map_ccir656;
4886 // break;
4887 
4888  case VINMODE_RGB444:
4889  swap = port_map_rgb444;
4890  mirr = mirr_map_rgb444;
4891  break;
4892 
4893 // case VINMODE_YUV444:
4894 // swap = port_map_yuv444;
4895 // mirr = mirr_map_yuv444;
4896 // break;
4897 
4898 // case VINMODE_YUV422:
4899 // swap = port_map_yuv422;
4900 // mirr = mirr_map_yuv422;
4901 // break;
4902 
4903  default:
4904  return ERR_BAD_PARAM;
4905  }
4906 
4907  /* Set the audio and video input port configuration */
4908  ret = tda998x_vidin_set_port_enable(dev);
4909  if (ret < 0)
4910  return ret;
4911 
4912  ret = tda998x_vidin_set_mapping(dev, swap, mirr);
4913  if (ret < 0)
4914  return ret;
4915 
4916  ret = tda998x_vidin_set_fine(dev, sp_sync, 0, TGLCLK_HIGH);
4917  if (ret < 0)
4918  return ret;
4919 
4920  /* Set input blanking */
4921  ret = tda998x_vidin_set_blanking(dev, blankit, BLNKCODE_RGB444);
4922  if (ret < 0)
4923  return ret;
4924 
4925  ret = tda998x_vidin_set_config(dev,
4926  vidin_cfg->mode,
4927  vidout_cfg->format,
4928  vidin_cfg->format_3d,
4929  pix_edge,
4930  vidin_cfg->pix_rate,
4931  UPSAMPLE_AUTO);
4932  if (ret < 0)
4933  return ret;
4934 
4935  /* Set input output */
4936  ret = tda998x_video_set_inout(dev,
4937  vidin_cfg->format,
4938  vidin_cfg->format_3d,
4940  vidout_cfg->format,
4941  0,
4942  MTX_MODE_AUTO,
4943  dwidth,
4944  vidout_cfg->vqr);
4945  if (ret < 0)
4946  return ret;
4947 
4948  /* Only set audio for HDMI, not DVI */
4949  if (sink == SINK_HDMI) {
4950  /* Set audio parameters */
4951  ret = tda998x_aud_set_input(dev, audin_cfg);
4952  if (ret < 0)
4953  return ret;
4954  }
4955 
4956  if (sync == 0) {
4957  /* External synchronization */
4958  switch (vidin_cfg->format) {
4963  if ((vidout_cfg->format == VFMT_16_1920x1080p_60Hz) ||
4964  (vidout_cfg->format == VFMT_31_1920x1080p_50Hz)) {
4965  toggle = PIXTOGL_NO_ACTION;
4966  }
4967  break;
4968  default:
4969  toggle = PIXTOGL_ENABLE;
4970  break;
4971  }
4972  }
4973 
4977  ret = write_reg_mask(dev,
4978  VIP_CNTRL_3,
4979  VIP_CNTRL_3_EMB,
4980  (uint8_t) vidin_cfg->sync_src);
4981  if (ret < 0)
4982  return ret;
4983 
4984  ret = write_reg_mask(dev,
4985  TBG_CNTRL_0,
4986  TBG_CNTRL_0_SYNC_MTHD,
4987  (uint8_t) sync_mthd);
4988  if (ret < 0)
4989  return ret;
4990 
4991  /* Toggle DE */
4992  ret = write_reg_mask(dev,
4993  VIP_CNTRL_3,
4994  VIP_CNTRL_3_V_TGL | VIP_CNTRL_3_H_TGL | VIP_CNTRL_3_X_TGL,
4995  VIP_CNTRL_3_X_TGL);
4996  if (ret < 0)
4997  return ret;
4998 
4999  if (desc->reg_fmt >= VIDFORMAT_800x600p_60Hz) {
5000  set_video_config(dev, &vidformat_pc[desc->reg_fmt - VIDFORMAT_800x600p_60Hz]);
5001  }
5002 
5003  ref_pix = desc->hfp + 2;
5004  ref_line = desc->vfp;
5005 
5006  if ((ref_pix >= REFPIX_MIN) &&
5007  (ref_pix <= REFPIX_MAX)) {
5008  ret = write_reg16(dev, REFPIX_MSB, ref_pix);
5009  if (ret < 0)
5010  return ret;
5011  }
5012 
5013  if ((ref_line >= REFLINE_MIN) &&
5014  (ref_line <= REFLINE_MAX)) {
5015  ret = write_reg16(dev, REFLINE_MSB, ref_line);
5016  if (ret < 0)
5017  return ret;
5018  }
5019 
5020 // ret = tda998x_vidin_set_sync(dev,
5021 // vidin_cfg->sync_src,
5022 // sync_mthd,
5023 // false,
5024 // false,
5025 // true,
5026 // ref_pix,
5027 // ref_line);
5028 // if (ret < 0)
5029 // return ret;
5030 
5031 // toggle = HDMITX_PIXTOGL_ENABLE;
5032 // ref_pix = 0;
5033 // ref_line = 0;
5034 // sync_mthd = 0;
5035 
5036  /* Not found so assume non-scaler and auto-configure input */
5037 // ret = tda998x_vidin_set_sync_auto(dev,
5038 // vidin_cfg->sync_src,
5039 // vidin_cfg->format,
5040 // vidin_cfg->mode,
5041 // vidin_cfg->format_3d);
5042 // if (ret < 0)
5043 // return ret;
5044 
5045  /* Set infoframes for HDMI only */
5046 // if (sink == SINK_HDMI) {
5047 // /* Set infoframe */
5048 // ret = tda998x_vidout_set_infofram(dev, vidout_cfg->format, vidout_cfg->mode);
5049 // if (ret < 0)
5050 // return ret;
5051 // }
5052 
5053  /* Set video synchronization */
5054  ret = tda998x_vidout_set_sync(dev,
5058  VS_TGL_TABLE,
5059  SYNC_EACH_FRAME);
5060  if (ret < 0)
#define PIXREP_DEFAULT
Definition: tda998x.c:363
Definition: tda998x.h:89
Definition: tda998x.h:168
enum tda998x_vid_fmt format
Definition: tda998x.h:272
static int tda998x_vidin_set_port_enable(struct tda998x_dev *dev)
Set Video Input Port Pin Enable.
Definition: tda998x.c:3238
vip_cntrl_3_sp_sync
Video Input Port Control Subpacket Synchronization Enumeration.
Definition: tda998x.c:268
Definition: tda998x.h:154
static int tda998x_vidin_set_fine(struct tda998x_dev *dev, enum vip_cntrl_3_sp_sync sp_sync, uint8_t sp_cnt, enum vip_cntrl_5_clkpol clkpol)
Set Video Input Fine.
Definition: tda998x.c:3147
Definition: tda998x.c:501
Definition: tda998x.h:92
static int tda998x_vidin_set_blanking(struct tda998x_dev *dev, enum vip_cntrl_4_blnkit src, enum vip_cntrl_4_blc code)
Set Video Input Blanking Source and Code.
Definition: tda998x.c:2983
Definition: tda998x.h:158
Definition: tda998x.c:289
Definition: tda998x.c:647
Definition: tda998x.h:64
static int set_video_config(struct tda998x_dev *dev, struct tda998x_vid_frm *vid)
Set Video Configuration.
Definition: tda998x.c:1699
Definition: tda998x.c:447
static int tda998x_vidout_set_config(struct tda998x_dev *dev, enum tda998x_sink sink, enum tda998x_vidout_mode vout_mode, enum hvf_cntrl_0_prefil prefil, enum hvf_cntrl_1_yuv_blk yuv_blk, enum hvf_cntrl_1_vqr vqr)
Set Video Output Configuration.
Definition: tda998x.c:3366
Definition: tda998x.c:351
enum tda998x_vqr vqr
Definition: tda998x.h:294
enum tda998x_vidin_mode mode
Definition: tda998x.h:273
static int tda998x_set_tmds_output(struct tda998x_dev *dev, enum buffer_out_srl_force tmds)
Set TMDS Output.
Definition: tda998x.c:2952
Definition: tda998x.h:77
Definition: tda998x.h:202
vip_cntrl_3_edge
Definition: tda998x.c:277
enum tda998x_vidout_mode mode
Definition: tda998x.h:292
static int write_reg_mask(struct tda998x_dev *dev, enum tda998x_hdmi_reg reg, uint8_t mask, uint8_t val)
Register Mask Write Write a value with mask bits to a register.
Definition: tda998x.c:1371
Definition: tda998x.h:65
Definition: tda998x.c:932
Definition: tda998x.h:78
enum tda998x_vid_fmt format
Definition: tda998x.h:291
tbg_cntrl_0_sync_mthd
Definition: tda998x.c:499
Definition: tda998x.c:303
vip_cntrl_mirr
Definition: tda998x.c:249
Definition: tda998x.c:437
Definition: tda998x.h:94
Definition: tda998x.h:93
static int write_reg16(struct tda998x_dev *dev, enum tda998x_hdmi_reg reg, uint16_t data)
Write 16-bit Register.
Definition: tda998x.c:1299
Definition: tda998x.c:1121
tda998x_dwidth
Definition: tda998x.h:201
tda998x_pix_tgl
Definition: tda998x.h:157
Definition: tda998x.c:300
Definition: tda998x.h:103
Definition: tda998x.h:88
Definition: tda998x.h:108
enum tda998x_sync_src sync_src
Definition: tda998x.h:274
enum tda998x_pix_rate pix_rate
Definition: tda998x.h:275
Definition: tda998x.h:135
enum tda998x_format_3d format_3d
Definition: tda998x.h:276
Definition: tda998x.h:79
Definition: tda998x.c:903
Definition: tda998x.h:129
Definition: tda998x.h:159
static int tda998x_vidout_set_sync(struct tda998x_dev *dev, bool h_ext, bool v_ext, bool de_ext, uint8_t tgl, enum tbg_cntrl_0_sync sync)
Set Video Output Synchronization.
Definition: tda998x.c:3454
static int tda998x_vidin_set_mapping(struct tda998x_dev *dev, const enum vip_cntrl_swap *swap, const enum vip_cntrl_mirr *mirr)
Set Video Input Port Mapping.
Definition: tda998x.c:3206
Definition: tda998x.h:111
int tda998x_aud_set_input(struct tda998x_dev *dev, struct tda998x_audin_cfg *audin_cfg)
Definition: tda998x.c:2465
vip_cntrl_4_blnkit
Video Input Port Control Blanking Source Enumeration.
Definition: tda998x.c:299
Definition: tda998x.h:104
Definition: tda998x.h:177
Definition: tda998x.c:898