static int saa7111_init_decoder (struct i2c_client *client, struct video_decoder_init *init) { return saa7111_write_block(client, init->data, init->len); }
static int saa7111_attach(struct i2c_device *device) { int i; struct saa7111 *decoder; static const unsigned char init[] = { 0x00, 0x00, /* 00 - ID byte */ 0x01, 0x00, /* 01 - reserved */ /*front end */ 0x02, 0xd0, /* 02 - FUSE=3, GUDL=2, MODE=0 */ 0x03, 0x23, /* 03 - HLNRS=0, VBSL=1, WPOFF=0, HOLDG=0, GAFIX=0, GAI1=256, GAI2=256 */ 0x04, 0x00, /* 04 - GAI1=256 */ 0x05, 0x00, /* 05 - GAI2=256 */ /* decoder */ 0x06, 0xf3, /* 06 - HSB at 13(50Hz) / 17(60Hz) pixels after end of last line */ 0x07, 0x13, /* 07 - HSS at 113(50Hz) / 117(60Hz) pixels after end of last line */ 0x08, 0xc8, /* 08 - AUFD=1, FSEL=1, EXFIL=0, VTRC=1, HPLL=0, VNOI=0 */ 0x09, 0x01, /* 09 - BYPS=0, PREF=0, BPSS=0, VBLB=0, UPTCV=0, APER=1 */ 0x0a, 0x80, /* 0a - BRIG=128 */ 0x0b, 0x47, /* 0b - CONT=1.109 */ 0x0c, 0x40, /* 0c - SATN=1.0 */ 0x0d, 0x00, /* 0d - HUE=0 */ 0x0e, 0x01, /* 0e - CDTO=0, CSTD=0, DCCF=0, FCTC=0, CHBW=1 */ 0x0f, 0x00, /* 0f - reserved */ 0x10, 0x48, /* 10 - OFTS=1, HDEL=0, VRLN=1, YDEL=0 */ 0x11, 0x1c, /* 11 - GPSW=0, CM99=0, FECO=0, COMPO=1, OEYC=1, OEHV=1, VIPB=0, COLO=0 */ 0x12, 0x00, /* 12 - output control 2 */ 0x13, 0x00, /* 13 - output control 3 */ 0x14, 0x00, /* 14 - reserved */ 0x15, 0x00, /* 15 - VBI */ 0x16, 0x00, /* 16 - VBI */ 0x17, 0x00, /* 17 - VBI */ }; MOD_INC_USE_COUNT; device->data = decoder = kmalloc(sizeof(struct saa7111), GFP_KERNEL); if (decoder == NULL) { MOD_DEC_USE_COUNT; return -ENOMEM; } memset(decoder, 0, sizeof(struct saa7111)); strcpy(device->name, "saa7111"); decoder->bus = device->bus; decoder->addr = device->addr; decoder->norm = VIDEO_MODE_NTSC; decoder->input = 0; decoder->enable = 1; decoder->bright = 32768; decoder->contrast = 32768; decoder->hue = 32768; decoder->sat = 32768; i = saa7111_write_block(decoder, init, sizeof(init)); if (i < 0) { printk(KERN_ERR "%s_attach: init status %d\n", device->name, i); } else { printk(KERN_INFO "%s_attach: chip version %x\n", device->name, saa7111_read(decoder, 0x00) >> 4); } return 0; }