diff options
Diffstat (limited to 'linux/drivers/media/video/msp3400-driver.c')
-rw-r--r-- | linux/drivers/media/video/msp3400-driver.c | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c index 2527681bc..3e59e05e7 100644 --- a/linux/drivers/media/video/msp3400-driver.c +++ b/linux/drivers/media/video/msp3400-driver.c @@ -76,7 +76,7 @@ static int stereo_threshold = 0x190; /* a2 threshold for stereo/bilingual struct msp3400c { int rev1,rev2; - + int opmode; int mode; int norm; @@ -168,14 +168,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 @@ -311,15 +311,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" } }; @@ -390,7 +390,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); } @@ -415,7 +415,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; @@ -423,24 +423,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) { @@ -566,7 +566,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 @@ -741,7 +741,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 (!kthread_should_stop()) { if (timeout < 0) { @@ -780,7 +780,7 @@ static int msp3400c_thread(void *data) struct msp3400c *msp = i2c_get_clientdata(client); struct CARRIER_DETECT *cd; int count, max1,max2,val1,val2, val,this; - + printk("msp3400: kthread started\n"); for (;;) { d2printk("msp3400: thread: sleep\n"); @@ -834,7 +834,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 */ @@ -851,7 +851,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; @@ -988,7 +988,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++) @@ -1004,9 +1004,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; @@ -1022,7 +1022,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; @@ -1030,13 +1030,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; - + printk("msp3410: daemon started\n"); for (;;) { d2printk(KERN_DEBUG "msp3410: thread: sleep\n"); @@ -1128,7 +1128,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; @@ -1205,7 +1205,7 @@ static int msp3410d_thread(void *data) 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_init(struct i2c_client *client) @@ -1227,9 +1227,9 @@ static int msp34xxg_init(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; @@ -1260,7 +1260,7 @@ static int msp34xxg_thread(void *data) struct i2c_client *client = data; struct msp3400c *msp = i2c_get_clientdata(client); int val, std, i; - + printk("msp34xxg: daemon started\n"); for (;;) { d2printk(KERN_DEBUG "msp34xxg: thread: sleep\n"); @@ -1304,11 +1304,11 @@ static int msp34xxg_thread(void *data) /* unmute: dispatch sound to scart output, set scart volume */ dprintk("msp34xxg: unmute\n"); - + msp3400c_setbass(client, msp->bass); msp3400c_settreble(client, msp->treble); msp3400c_setvolume(client, msp->muted, msp->volume, msp->balance); - + /* restore ACB */ if (msp3400c_write(client, I2C_MSP3400C_DFP, @@ -1320,7 +1320,7 @@ static int msp34xxg_thread(void *data) 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 * @@ -1331,25 +1331,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 @@ -1365,8 +1365,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; @@ -1385,7 +1385,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); } @@ -1441,7 +1441,7 @@ static struct i2c_driver driver = { }, }; -static struct i2c_client client_template = +static struct i2c_client client_template = { I2C_DEVNAME("(unset)"), .flags = I2C_CLIENT_ALLOW_USE, @@ -1461,7 +1461,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) 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)); @@ -1469,7 +1469,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) kfree(c); return -ENOMEM; } - + memset(msp,0,sizeof(struct msp3400c)); msp->volume = 58880; /* 0db gain */ msp->balance = 32768; @@ -1487,7 +1487,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) 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); @@ -1771,7 +1771,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_wake_thread(client); |