diff options
Diffstat (limited to 'linux/drivers/media/video/msp3400-old.c')
-rw-r--r-- | linux/drivers/media/video/msp3400-old.c | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/linux/drivers/media/video/msp3400-old.c b/linux/drivers/media/video/msp3400-old.c index c0f090a91..2703b2c3d 100644 --- a/linux/drivers/media/video/msp3400-old.c +++ b/linux/drivers/media/video/msp3400-old.c @@ -80,7 +80,7 @@ static int stereo_threshold = 0x190; /* a2 threshold for stereo/bilingual struct msp3400c { int rev1,rev2; - + int opmode; int mode; int norm; @@ -178,14 +178,14 @@ static int msp3400c_reset(struct i2c_client *client) { client->addr, 0, 3, write }, { client->addr, I2C_M_RD, 2, read }, }; - + if ( (1 != i2c_transfer(client->adapter,&reset[0],1)) || (1 != i2c_transfer(client->adapter,&reset[1],1)) || (2 != i2c_transfer(client->adapter,test,2)) ) { printk(KERN_ERR "msp3400: chip reset failed\n"); return -1; } - return 0; + return 0; } static int @@ -321,15 +321,15 @@ struct CARRIER_DETECT { static struct CARRIER_DETECT carrier_detect_main[] = { /* main carrier */ - { MSP_CARRIER(4.5), "4.5 NTSC" }, - { MSP_CARRIER(5.5), "5.5 PAL B/G" }, + { MSP_CARRIER(4.5), "4.5 NTSC" }, + { MSP_CARRIER(5.5), "5.5 PAL B/G" }, { MSP_CARRIER(6.0), "6.0 PAL I" }, { MSP_CARRIER(6.5), "6.5 PAL D/K + SAT + SECAM" } }; static struct CARRIER_DETECT carrier_detect_55[] = { /* PAL B/G */ - { MSP_CARRIER(5.7421875), "5.742 PAL B/G FM-stereo" }, + { MSP_CARRIER(5.7421875), "5.742 PAL B/G FM-stereo" }, { MSP_CARRIER(5.85), "5.85 PAL B/G NICAM" } }; @@ -400,7 +400,7 @@ static void msp3400c_setvolume(struct i2c_client *client, muted ? "on" : "off", volume, balance, val>>8, bal); msp3400c_write(client,I2C_MSP3400C_DFP, 0x0000, val); /* loudspeaker */ msp3400c_write(client,I2C_MSP3400C_DFP, 0x0006, val); /* headphones */ - msp3400c_write(client,I2C_MSP3400C_DFP, 0x0007, + msp3400c_write(client,I2C_MSP3400C_DFP, 0x0007, muted ? 0x01 : (val | 0x01)); msp3400c_write(client,I2C_MSP3400C_DFP, 0x0001, bal << 8); } @@ -425,7 +425,7 @@ static void msp3400c_setmode(struct i2c_client *client, int type) { struct msp3400c *msp = i2c_get_clientdata(client); int i; - + dprintk(KERN_DEBUG "msp3400: setmode: %d\n",type); msp->mode = type; msp->audmode = V4L2_TUNER_MODE_MONO; @@ -433,24 +433,24 @@ static void msp3400c_setmode(struct i2c_client *client, int type) msp3400c_write(client,I2C_MSP3400C_DEM, 0x00bb, /* ad_cv */ msp_init_data[type].ad_cv); - + for (i = 5; i >= 0; i--) /* fir 1 */ msp3400c_write(client,I2C_MSP3400C_DEM, 0x0001, msp_init_data[type].fir1[i]); - + msp3400c_write(client,I2C_MSP3400C_DEM, 0x0005, 0x0004); /* fir 2 */ msp3400c_write(client,I2C_MSP3400C_DEM, 0x0005, 0x0040); msp3400c_write(client,I2C_MSP3400C_DEM, 0x0005, 0x0000); for (i = 5; i >= 0; i--) msp3400c_write(client,I2C_MSP3400C_DEM, 0x0005, msp_init_data[type].fir2[i]); - + msp3400c_write(client,I2C_MSP3400C_DEM, 0x0083, /* MODE_REG */ msp_init_data[type].mode_reg); - + msp3400c_setcarrier(client, msp_init_data[type].cdo1, msp_init_data[type].cdo2); - + msp3400c_write(client,I2C_MSP3400C_DEM, 0x0056, 0); /*LOAD_REG_1/2*/ if (dolby) { @@ -576,7 +576,7 @@ static void msp3400c_set_audmode(struct i2c_client *client, int audmode) switch (audmode) { case V4L2_TUNER_MODE_STEREO: src = 0x0020 | nicam; -#if 0 +#if 0 /* spatial effect */ msp3400c_write(client,I2C_MSP3400C_DFP, 0x0005,0x4000); #endif @@ -751,7 +751,7 @@ autodetect_stereo(struct i2c_client *client) static int msp34xx_sleep(struct msp3400c *msp, int timeout) { DECLARE_WAITQUEUE(wait, current); - + add_wait_queue(&msp->wq, &wait); if (!msp->rmmod) { if (timeout < 0) { @@ -788,10 +788,10 @@ static int msp3400c_thread(void *data) { struct i2c_client *client = data; struct msp3400c *msp = i2c_get_clientdata(client); - + struct CARRIER_DETECT *cd; int count, max1,max2,val1,val2, val,this; - + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61) lock_kernel(); daemonize(); @@ -821,7 +821,7 @@ static int msp3400c_thread(void *data) /* some time for the tuner to sync */ if (msp34xx_sleep(msp,200)) goto done; - + restart: if (VIDEO_MODE_RADIO == msp->norm || MSP_MODE_EXTERN == msp->mode) { @@ -864,7 +864,7 @@ static int msp3400c_thread(void *data) val1 = val, max1 = this; dprintk("msp3400: carrier1 val: %5d / %s\n", val,cd[this].name); } - + /* carrier detect pass #2 -- second (stereo) carrier */ switch (max1) { case 1: /* 5.5 */ @@ -881,7 +881,7 @@ static int msp3400c_thread(void *data) cd = NULL; count = 0; break; } - + if (amsound && (msp->norm == VIDEO_MODE_SECAM)) { /* autodetect doesn't work well with AM ... */ cd = NULL; count = 0; max2 = 0; @@ -983,7 +983,7 @@ static int msp3400c_thread(void *data) if (debug) msp3400c_print_mode(msp); - + msp->active = 0; } @@ -1024,7 +1024,7 @@ static struct MODES { { -1, 0, 0, NULL }, /* EOF */ }; -static inline const char *msp34xx_standard_mode_name(int mode) +static inline const char *msp34xx_standard_mode_name(int mode) { int i; for (i = 0; modelist[i].name != NULL; i++) @@ -1040,9 +1040,9 @@ static int msp34xx_modus(int norm) return 0x1003; case VIDEO_MODE_NTSC: /* BTSC */ return 0x2003; - case VIDEO_MODE_SECAM: + case VIDEO_MODE_SECAM: return 0x0003; - case VIDEO_MODE_RADIO: + case VIDEO_MODE_RADIO: return 0x0003; case VIDEO_MODE_AUTO: return 0x2003; @@ -1058,7 +1058,7 @@ static int msp34xx_standard(int norm) return 1; case VIDEO_MODE_NTSC: /* BTSC */ return 0x0020; - case VIDEO_MODE_SECAM: + case VIDEO_MODE_SECAM: return 1; case VIDEO_MODE_RADIO: return 0x0040; @@ -1066,13 +1066,13 @@ static int msp34xx_standard(int norm) return 1; } } - + static int msp3410d_thread(void *data) { struct i2c_client *client = data; struct msp3400c *msp = i2c_get_clientdata(client); int mode,val,i,std; - + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61) lock_kernel(); daemonize(); @@ -1098,7 +1098,7 @@ static int msp3410d_thread(void *data) msp->active = 0; continue; } - + /* some time for the tuner to sync */ if (msp34xx_sleep(msp,200)) goto done; @@ -1183,7 +1183,7 @@ static int msp3410d_thread(void *data) msp->watch_stereo = 1; msp3400c_set_audmode(client,V4L2_TUNER_MODE_STEREO); break; - case 0x0009: + case 0x0009: msp->mode = MSP_MODE_AM_NICAM; msp->rxsubchans = V4L2_TUNER_SUB_MONO; msp->nicam_on = 1; @@ -1262,7 +1262,7 @@ done: static void msp34xxg_set_source(struct i2c_client *client, int source); -/* (re-)initialize the msp34xxg, according to the current norm in msp->norm +/* (re-)initialize the msp34xxg, according to the current norm in msp->norm * return 0 if it worked, -1 if it failed */ static int msp34xxg_reset(struct i2c_client *client) @@ -1286,9 +1286,9 @@ static int msp34xxg_reset(struct i2c_client *client) modus = msp34xx_modus(msp->norm); modus &= ~0x03; /* STATUS_CHANGE=0 */ modus |= 0x01; /* AUTOMATIC_SOUND_DETECTION=1 */ - if (msp3400c_write(client, - I2C_MSP3400C_DEM, - 0x30/*MODUS*/, + if (msp3400c_write(client, + I2C_MSP3400C_DEM, + 0x30/*MODUS*/, modus)) return -1; @@ -1315,7 +1315,7 @@ static int msp34xxg_reset(struct i2c_client *client) if (std == 0x01) { - dprintk("msp34xxg: triggered autodetect, waiting for result\n"); + dprintk("msp34xxg: triggered autodetect, waiting for result\n"); /* triggered autodetect */ for (i = 0; i < 10; i++) { @@ -1337,7 +1337,7 @@ static int msp34xxg_reset(struct i2c_client *client) dprintk("msp34xxg: detection still in progress after 10 tries. giving up.\n"); return -1; } - } + } dprintk("msp34xxg: current mode: %s (0x%04x)\n", msp34xx_standard_mode_name(std), std); @@ -1358,7 +1358,7 @@ static int msp34xxg_reset(struct i2c_client *client) return 0; } -/* set the same 'source' for the loudspeaker, scart and quasi-peak detector +/* set the same 'source' for the loudspeaker, scart and quasi-peak detector * the value for source is the same as bit 15:8 of DFP registers 0x08, * 0x0a and 0x0c: 0=mono, 1=stereo or A|B, 2=SCART, 3=stereo or A, 4=stereo or B * @@ -1369,25 +1369,25 @@ static void msp34xxg_set_source(struct i2c_client *client, int source) struct msp3400c *msp = i2c_get_clientdata(client); /* fix matrix mode to stereo and let the msp choose what - * to output according to 'source', as recommended + * to output according to 'source', as recommended */ - int value = (source&0x07)<<8|(source==0 ? 0x00:0x20); + int value = (source&0x07)<<8|(source==0 ? 0x00:0x20); dprintk("msp34xxg: set source to %d (0x%x)\n", source, value); - msp3400c_write(client, + msp3400c_write(client, I2C_MSP3400C_DFP, 0x08, /* Loudspeaker Output */ value); - msp3400c_write(client, + msp3400c_write(client, I2C_MSP3400C_DFP, 0x0a, /* SCART1 DA Output */ value); - msp3400c_write(client, + msp3400c_write(client, I2C_MSP3400C_DFP, 0x0c, /* Quasi-peak detector */ value); - /* - * set identification threshold. Personally, I - * I set it to a higher value that the default + /* + * set identification threshold. Personally, I + * I set it to a higher value that the default * of 0x190 to ignore noisy stereo signals. * this needs tuning. (recommended range 0x00a0-0x03c0) * 0x7f0 = forced mono mode @@ -1403,8 +1403,8 @@ static void msp34xxg_detect_stereo(struct i2c_client *client) { struct msp3400c *msp = i2c_get_clientdata(client); - int status = msp3400c_read(client, - I2C_MSP3400C_DEM, + int status = msp3400c_read(client, + I2C_MSP3400C_DEM, 0x0200 /* STATUS */); int is_bilingual = status&0x100; int is_stereo = status&0x40; @@ -1423,7 +1423,7 @@ static void msp34xxg_detect_stereo(struct i2c_client *client) * this is a problem, I'll handle SAP just like lang1/lang2. */ } - dprintk("msp34xxg: status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", + dprintk("msp34xxg: status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", status, is_stereo, is_bilingual, msp->rxsubchans); } @@ -1479,7 +1479,7 @@ static struct i2c_driver driver = { .command = msp_command, }; -static struct i2c_client client_template = +static struct i2c_client client_template = { I2C_DEVNAME("(unset)"), .flags = I2C_CLIENT_ALLOW_USE, @@ -1504,7 +1504,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, dprintk("msp3400: no chip found\n"); return -1; } - + if (NULL == (c = kmalloc(sizeof(struct i2c_client),GFP_KERNEL))) return -ENOMEM; memcpy(c,&client_template,sizeof(struct i2c_client)); @@ -1512,7 +1512,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, kfree(c); return -ENOMEM; } - + memset(msp,0,sizeof(struct msp3400c)); msp->volume = 58880; /* 0db gain */ msp->balance = 32768; @@ -1530,7 +1530,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, dprintk("msp3400: no chip found\n"); return -1; } - + msp->rev1 = msp3400c_read(c, I2C_MSP3400C_DFP, 0x1e); if (-1 != msp->rev1) msp->rev2 = msp3400c_read(c, I2C_MSP3400C_DFP, 0x1f); @@ -1863,7 +1863,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) case VIDIOCSCHAN: { struct video_channel *vc = arg; - + dprintk(KERN_DEBUG "msp34xx: VIDIOCSCHAN (norm=%d)\n",vc->norm); msp->norm = vc->norm; msp_any_rescan(client); |