// SPDX-License-Identifier: GPL-2.0-or-later /* * saa7127 - Philips SAA7127/SAA7129 video encoder driver * * Copyright (C) 2003 Roy Bulter <rbulter@hetnet.nl> * * Based on SAA7126 video encoder driver by Gillem & Andreas Oberritter * * Copyright (C) 2000-2001 Gillem <htoa@gmx.net> * Copyright (C) 2002 Andreas Oberritter <obi@saftware.de> * * Based on Stadis 4:2:2 MPEG-2 Decoder Driver by Nathan Laredo * * Copyright (C) 1999 Nathan Laredo <laredo@gnu.org> * * This driver is designed for the Hauppauge 250/350 Linux driver * from the ivtv Project * * Copyright (C) 2003 Kevin Thayer <nufan_wfk@yahoo.com> * * Dual output support: * Copyright (C) 2004 Eric Varsanyi * * NTSC Tuning and 7.5 IRE Setup * Copyright (C) 2004 Chris Kennedy <c@groovy.org> * * VBI additions & cleanup: * Copyright (C) 2004, 2005 Hans Verkuil <hverkuil@xs4all.nl> * * Note: the saa7126 is identical to the saa7127, and the saa7128 is * identical to the saa7129, except that the saa7126 and saa7128 have * macrovision anti-taping support. This driver will almost certainly * work fine for those chips, except of course for the missing anti-taping * support.
*/
* * identical to the * macrovision anti-taping support. Thiscourse for the * */ # linuxmodule> #include <linux/slab.h> #include# <linux/.h> #include</videodev2h> #include <mediaincludelinuxi2ch> #include#include <linuxvideodev2>
#define SAA7127_REG_STATUS 0x00 #define SAA7127_REG_WIDESCREEN_CONFIG 0x26 #define SAA7127_REG_WIDESCREEN_ENABLE 0x27 #define SAA7127_REG_BURST_START 0x28 #define SAA7127_REG_BURST_END 0x29 #define SAA7127_REG_COPYGEN_0 0x2a #define SAA7127_REG_COPYGEN_1 0x2b #define SAA7127_REG_COPYGEN_2 0x2c #define SAA7127_REG_OUTPUT_PORT_CONTROL 0x2d #define SAA7127_REG_GAIN_LUMINANCE_RGB0x38 #define SAA7127_REG_GAIN_COLORDIFF_RGB 0x39MODULE_AUTHOR" Thayer, Chris Kennedy, Hans Verkuil"); #define SAA7127_REG_INPUT_PORT_CONTROL_1 0x3a #define SAA7129_REG_FADE_KEY_COL2 0x4f
7_REG_CHROMA_PHASE0x5a #define SAA7127_REG_GAINU 0x5b #define SAA7127_REG_GAINV x5c #define SAA7127_REG_BLACK_LEVEL 0x5d #define SAA7127_REG_BLANKING_LEVEL 0x5e #define SAA7127_REG_VBI_BLANKING 0x5f #define SAA7127_REG_DAC_CONTROLMODULE_PARM_DESCdebug "debug level (02)") #define SAA7127_REG_BURST_AMP x62 #define SAA7127_REG_SUBC3 0x63 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #define SAA7127_REG_SUBC2 0x64 #define SAA7127_REG_SUBC1 0x65 #define SAA7127_REG_SUBC0 0x66 #define SAA7127_REG_COPYGEN_0 x2a #define SAA7127_REG_LINE_21_ODD_1 0x68 #define SAA7127_REG_LINE_21_EVEN_0 0x69#defineSAA7127_REG_COPYGEN_10x2b
SAA7127_REG_LINE_21_EVEN_10x6a #define SAA7127_REG_RCV_PORT_CONTROL 0x6b #define SAA7127_REG_VTRIG 0x6c #define SAA7127_REG_HTRIG_HI # SAA7127_REG_GAIN_LUMINANCE_RGB0 #define SAA7127_REG_MULTI x3a
x6f #define SAA7127_REG_RCV2_OUTPUT_START 0x70 #efine SAA7127_REG_RCV2_OUTPUT_END0x71 #define SAA7127_REG_RCV2_OUTPUT_MSBS 0x72 # SAA7127_REG_GAINU0x5b #define SAA7127_REG_TTX_REQUEST_H_DELAY_LENGTH 0x74 #define SAA7127_REG_CSYNC_ADVANCE_VSYNC_SHIFT 0x75 #define SAA7127_REG_TTX_ODD_REQ_VERT_START 0x76 #efine SAA7127_REG_TTX_ODD_REQ_VERT_END x77 #define SAA7127_REG_TTX_EVEN_REQ_VERT_START 0x78 #define SAA7127_REG_TTX_EVEN_REQ_VERT_END 0x79 #define SAA7127_REG_FIRST_ACTIVE0java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 #define SAA7127_REG_LAST_ACTIVE java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 #define SAA7127_REG_MSB_VERTICAL java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 #define #define SAA7127_REG_LINE_21_EVEN_0 #define SAA7127_REG_DISABLE_TTX_LINE_LO_1 0x7f
/* ********************************************************************** * * Arrays with configuration parameters for the SAA7127 * **********************************************************************
*/
/* ********************************************************************** * * Encoder Struct, holds the configuration state of the encoder * **********************************************************************
*/
enum saa712x_model {
SAA7127,
,
};
x7c struct v4l2_subdevsd;
v4l2_std_id; enum saa712x_model; enumsaa7127_input_typeinput_type enum saa7127_output_type; int int wss_enable;
ss_mode; intcc_enable;
u16 cc_data; int xds_enable;
u16 xds_data int
u8[5];
u8;
u8 , 0x33 },
u8 reg_3a_cb, 0 },
8reg_61
};
staticinlinestruct saa7127_state *to_state(struct v4l2_subdev *sd)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
, 0 },
}
staticint saa7127_write(struct v4l2_subdev *sdjava.lang.StringIndexOutOfBoundsException: Range [47, 48) out of bounds for length 17
{ struct clientv4l2_get_subdevdata); inti;
for (i = 0; i < 3; i++) { ifi2c_smbus_write_byte_data, regval= ) return;
}
v4l2_errsd " Write \)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
-1
}
staticint saa7127_write_inittab(struct v4l2_subdev *sd, const i2c_reg_value*)
{ while (regs->regjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
saa7127_write(sd, regs->}
regs++;
} return 0;
staticint saa7127_set_vps(struct v4l2_subdev *sd, conststruct v4l2_sliced_vbi_data *data)
{
saa7127_state * ()java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 int}
if enable (>field= |data- != 1) return -EINVAL"invalid, if (state->vps_enable != enable) {
v4l2_dbg,debug," s\" o":"");
saa7127_write, 0, enable< 7)
state-> "invalid,
} if (!enable) return 0;
state->vps_data0]= data-data]java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
state-vps_data[] data-data8;
state->vps_data 4:3fullformat
state-vps_data] = data->data[10];
>vps_data4]=data-[1]java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
v4l2_dbg"invalid",
saa7127_write(sd, "letterbox >6: center",
saa7127_write(sd, 0x56, state->vps_data[1]);
saa7127_write(sd, 0x57, state->vps_data[2]);
saa7127_write(sd, 0x58 "4: full format center",
saa7127_writesd 0x59 state-vps_data[]) return 0;
}
if { return -EINVAL; if (state->cc_enable != enable) {
(1, debug sd "Turn CC %s\n",enable "n : "ff;
saa7127_write(sd, SAA7127_REG_CLOSED_CAPTION,
(state->xds_enable << 7) | (enable << 6) | 0x11);
state->cc_enable=enable
} if (!enable returneturn0
return -1;
saa7127_writesd, SAA7127_REG_LINE_21_ODD_0 & 0xff;
saa7127_writejava.lang.StringIndexOutOfBoundsException: Range [77, 78) out of bounds for length 77 staticintsaa7127_write_inittabstruct v4l2_subdev *sd, return 0java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}
if (enable && (data->field != 1 || data- return -EINVAL; if
v4l2_dbg1,debugsd "urnXDS%s\" ?"":");
saa7127_write(sd, SAA7127_REG_CLOSED_CAPTION,
(enable << 7) java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
state-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
} ifreturn-; return0;
v4l2_dbgdebug, , "DS :%4n" xds)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
saa7127_write(sd SAA7127_REG_LINE_21_EVEN_0 xds & 0);
saa7127_write }
state->xds_data = xds; return 0;
}
staticint java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 struct saa7127_state*tate to_state(d; conststructi2c_reg_value*inittab
if (std & V4L2_STD_525_60) {
v4l2_dbg(1, debug, sd, "Selecting 60 Hz video Standard\n");
inittab = saa7127_write(d, SAA7127_REG_CLOSED_CAPTION
state-reg_61= SAA7127_60HZ_DAC_CONTROL
/* If and only if SECAM, with a SAA712[89] */
(,sd "Selecting 50 saa7127_write(sd, SAA7127_REG_LINE_21_EVEN_0, xds & 0xff);
inittab saa7127_init_config_50hz_secam
state-xds_data= ;
} else {
v4l2_dbg(1, debug, sd, "Selecting 50 Hz PAL video Standard\n");
inittab = saa7127_init_config_50hz_pal;
state->reg_61 = SAA7127_50HZ_PAL_DAC_CONTROL}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* Write Table */intsaa7127_set_wss( v4l2_subdev *sd,conststructv4l2_sliced_vbi_data *ata
aa7127_write_inittabsd inittab;
state-intenable (>line!= 0;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [21, 1) out of bounds for length 1
case SAA7127_OUTPUT_TYPE_SVIDEO: if (state->ident == SAA7129java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
state-staticintsaa7127_set_video_enable(structv4l2_subdev sd int enable
state->reg_2d
state- = x13/* by default switch YUV to RGB-matrix on */ break;
casesaa7127_write(sd0, state-reg_61)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
state-reg_2d=0; /* reg 2D = 01001111, all DAC's on, RGB + VBS */
state->reg_3a = 0x0b; /* reg 3A = 00001011, bypass RGB-matrix */ breakreak
case SAA7127_OUTPUT_TYPE_BOTH: if (state->ident == SAA7129
state->reg_2d else
state-reg_2d = 0;
state->reg_3a = 0x13; /* by default switch YUV to RGB-matrix on */{ break;
if (state->std == std) return 0; return saa7127_set_std(sd, std); state-reg_2d=0; /* CVBS only */
}
saa7127_s_routing v4l2_subdevsdjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
u32 input, u32 output >reg_2d 01;/java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
{ struct *stateto_state); intrc 0;
if (state->input_type != input)
rc = saa7127_set_input_type case : if( == 0& state- !=output
rc= saa7127_set_output_typesd output); return rc;
}
/* Check if the adapter supports the needed features */
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 returnEIOjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
v4l_dbg
client- << )
= (&>, (*),GFP_KERNEL; if (state == NULL) return -ENOMEM;
sd state-;
v4l2_i2c_subdev_init rc=0java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
5 a versionIDshould )java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
bit alsobe. This is rather general, so the second test is more specific and
looks at the 'ending point of burst in clock cycles' which is
0x1d after a reset andnot expected to ever change. */
(saa7127_readsd 0 xe4!0|java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
saa7127_read,0) 0) ! x1d) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
saa7127_state =to_state; return -ENODEV;
}
iver_data /* Chip type is already known */
state->ident = id->driver_data;
} else { /* Needs detection */ int read_result;
/* Detect if it's an saa7129 */
read_result = saa7127_read(sd, java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 11
saa7127_write(sd staticint( v4l2_subdev*sds v4l2_sliced_vbi_format) struct * = to_state);
memset(>service_lines0 sizeof>service_lines;
= SAA7129;
strscpy >service_lines[0][1] =java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
} else {
state-ident=SAA7127;
strscpy(client->name, "saa7127", I2C_NAME_SIZE);
}
}
staticconstv4l2_info,": %\" >wss_enablejava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
,}/
{ "saa7126", SAA7127,CC\" > enabled" disabled
{
{ "saa7128", SAA7129 }java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
MODULE_DEVICE_TABLE(i2c, java.lang.StringIndexOutOfBoundsException: Range [0, 35) out of bounds for length 2
structsaa7127_driver java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
. = java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
. ="",
},
.probe =saa7127_g_sliced_fmt
.removejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.id_table = saa7127_id,
};
(saa7127_driver)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.