diff options
Diffstat (limited to 'drivers/media/video/tvaudio.c')
-rw-r--r-- | drivers/media/video/tvaudio.c | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index b582943a0d3e..6d03b9b05c6e 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
@@ -159,7 +159,7 @@ static int chip_write(struct CHIPSTATE *chip, int subaddr, int val) | |||
159 | unsigned char buffer[2]; | 159 | unsigned char buffer[2]; |
160 | 160 | ||
161 | if (-1 == subaddr) { | 161 | if (-1 == subaddr) { |
162 | v4l_dbg(1, &chip->c, "%s: chip_write: 0x%x\n", | 162 | v4l_dbg(1, debug, &chip->c, "%s: chip_write: 0x%x\n", |
163 | chip->c.name, val); | 163 | chip->c.name, val); |
164 | chip->shadow.bytes[1] = val; | 164 | chip->shadow.bytes[1] = val; |
165 | buffer[0] = val; | 165 | buffer[0] = val; |
@@ -169,7 +169,7 @@ static int chip_write(struct CHIPSTATE *chip, int subaddr, int val) | |||
169 | return -1; | 169 | return -1; |
170 | } | 170 | } |
171 | } else { | 171 | } else { |
172 | v4l_dbg(1, &chip->c, "%s: chip_write: reg%d=0x%x\n", | 172 | v4l_dbg(1, debug, &chip->c, "%s: chip_write: reg%d=0x%x\n", |
173 | chip->c.name, subaddr, val); | 173 | chip->c.name, subaddr, val); |
174 | chip->shadow.bytes[subaddr+1] = val; | 174 | chip->shadow.bytes[subaddr+1] = val; |
175 | buffer[0] = subaddr; | 175 | buffer[0] = subaddr; |
@@ -204,7 +204,7 @@ static int chip_read(struct CHIPSTATE *chip) | |||
204 | chip->c.name); | 204 | chip->c.name); |
205 | return -1; | 205 | return -1; |
206 | } | 206 | } |
207 | v4l_dbg(1, &chip->c, "%s: chip_read: 0x%x\n",chip->c.name, buffer); | 207 | v4l_dbg(1, debug, &chip->c, "%s: chip_read: 0x%x\n",chip->c.name, buffer); |
208 | return buffer; | 208 | return buffer; |
209 | } | 209 | } |
210 | 210 | ||
@@ -222,7 +222,7 @@ static int chip_read2(struct CHIPSTATE *chip, int subaddr) | |||
222 | v4l_warn(&chip->c, "%s: I/O error (read2)\n", chip->c.name); | 222 | v4l_warn(&chip->c, "%s: I/O error (read2)\n", chip->c.name); |
223 | return -1; | 223 | return -1; |
224 | } | 224 | } |
225 | v4l_dbg(1, &chip->c, "%s: chip_read2: reg%d=0x%x\n", | 225 | v4l_dbg(1, debug, &chip->c, "%s: chip_read2: reg%d=0x%x\n", |
226 | chip->c.name, subaddr,read[0]); | 226 | chip->c.name, subaddr,read[0]); |
227 | return read[0]; | 227 | return read[0]; |
228 | } | 228 | } |
@@ -235,7 +235,7 @@ static int chip_cmd(struct CHIPSTATE *chip, char *name, audiocmd *cmd) | |||
235 | return 0; | 235 | return 0; |
236 | 236 | ||
237 | /* update our shadow register set; print bytes if (debug > 0) */ | 237 | /* update our shadow register set; print bytes if (debug > 0) */ |
238 | v4l_dbg(1, &chip->c, "%s: chip_cmd(%s): reg=%d, data:", | 238 | v4l_dbg(1, debug, &chip->c, "%s: chip_cmd(%s): reg=%d, data:", |
239 | chip->c.name, name,cmd->bytes[0]); | 239 | chip->c.name, name,cmd->bytes[0]); |
240 | for (i = 1; i < cmd->count; i++) { | 240 | for (i = 1; i < cmd->count; i++) { |
241 | if (debug) | 241 | if (debug) |
@@ -274,7 +274,7 @@ static int chip_thread(void *data) | |||
274 | 274 | ||
275 | daemonize("%s", chip->c.name); | 275 | daemonize("%s", chip->c.name); |
276 | allow_signal(SIGTERM); | 276 | allow_signal(SIGTERM); |
277 | v4l_dbg(1, &chip->c, "%s: thread started\n", chip->c.name); | 277 | v4l_dbg(1, debug, &chip->c, "%s: thread started\n", chip->c.name); |
278 | 278 | ||
279 | for (;;) { | 279 | for (;;) { |
280 | add_wait_queue(&chip->wq, &wait); | 280 | add_wait_queue(&chip->wq, &wait); |
@@ -286,7 +286,7 @@ static int chip_thread(void *data) | |||
286 | try_to_freeze(); | 286 | try_to_freeze(); |
287 | if (chip->done || signal_pending(current)) | 287 | if (chip->done || signal_pending(current)) |
288 | break; | 288 | break; |
289 | v4l_dbg(1, &chip->c, "%s: thread wakeup\n", chip->c.name); | 289 | v4l_dbg(1, debug, &chip->c, "%s: thread wakeup\n", chip->c.name); |
290 | 290 | ||
291 | /* don't do anything for radio or if mode != auto */ | 291 | /* don't do anything for radio or if mode != auto */ |
292 | if (chip->radio || chip->mode != 0) | 292 | if (chip->radio || chip->mode != 0) |
@@ -299,7 +299,7 @@ static int chip_thread(void *data) | |||
299 | mod_timer(&chip->wt, jiffies+2*HZ); | 299 | mod_timer(&chip->wt, jiffies+2*HZ); |
300 | } | 300 | } |
301 | 301 | ||
302 | v4l_dbg(1, &chip->c, "%s: thread exiting\n", chip->c.name); | 302 | v4l_dbg(1, debug, &chip->c, "%s: thread exiting\n", chip->c.name); |
303 | complete_and_exit(&chip->texit, 0); | 303 | complete_and_exit(&chip->texit, 0); |
304 | return 0; | 304 | return 0; |
305 | } | 305 | } |
@@ -312,7 +312,7 @@ static void generic_checkmode(struct CHIPSTATE *chip) | |||
312 | if (mode == chip->prevmode) | 312 | if (mode == chip->prevmode) |
313 | return; | 313 | return; |
314 | 314 | ||
315 | v4l_dbg(1, &chip->c, "%s: thread checkmode\n", chip->c.name); | 315 | v4l_dbg(1, debug, &chip->c, "%s: thread checkmode\n", chip->c.name); |
316 | chip->prevmode = mode; | 316 | chip->prevmode = mode; |
317 | 317 | ||
318 | if (mode & VIDEO_SOUND_STEREO) | 318 | if (mode & VIDEO_SOUND_STEREO) |
@@ -359,7 +359,7 @@ static int tda9840_getmode(struct CHIPSTATE *chip) | |||
359 | if (val & TDA9840_ST_STEREO) | 359 | if (val & TDA9840_ST_STEREO) |
360 | mode |= VIDEO_SOUND_STEREO; | 360 | mode |= VIDEO_SOUND_STEREO; |
361 | 361 | ||
362 | v4l_dbg(1, &chip->c, "tda9840_getmode(): raw chip read: %d, return: %d\n", | 362 | v4l_dbg(1, debug, &chip->c, "tda9840_getmode(): raw chip read: %d, return: %d\n", |
363 | val, mode); | 363 | val, mode); |
364 | return mode; | 364 | return mode; |
365 | } | 365 | } |
@@ -655,7 +655,7 @@ static int tda9873_getmode(struct CHIPSTATE *chip) | |||
655 | mode |= VIDEO_SOUND_STEREO; | 655 | mode |= VIDEO_SOUND_STEREO; |
656 | if (val & TDA9873_DUAL) | 656 | if (val & TDA9873_DUAL) |
657 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | 657 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; |
658 | v4l_dbg(1, &chip->c, "tda9873_getmode(): raw chip read: %d, return: %d\n", | 658 | v4l_dbg(1, debug, &chip->c, "tda9873_getmode(): raw chip read: %d, return: %d\n", |
659 | val, mode); | 659 | val, mode); |
660 | return mode; | 660 | return mode; |
661 | } | 661 | } |
@@ -666,12 +666,12 @@ static void tda9873_setmode(struct CHIPSTATE *chip, int mode) | |||
666 | /* int adj_data = chip->shadow.bytes[TDA9873_AD+1] ; */ | 666 | /* int adj_data = chip->shadow.bytes[TDA9873_AD+1] ; */ |
667 | 667 | ||
668 | if ((sw_data & TDA9873_INP_MASK) != TDA9873_INTERNAL) { | 668 | if ((sw_data & TDA9873_INP_MASK) != TDA9873_INTERNAL) { |
669 | v4l_dbg(1, &chip->c, "tda9873_setmode(): external input\n"); | 669 | v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): external input\n"); |
670 | return; | 670 | return; |
671 | } | 671 | } |
672 | 672 | ||
673 | v4l_dbg(1, &chip->c, "tda9873_setmode(): chip->shadow.bytes[%d] = %d\n", TDA9873_SW+1, chip->shadow.bytes[TDA9873_SW+1]); | 673 | v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): chip->shadow.bytes[%d] = %d\n", TDA9873_SW+1, chip->shadow.bytes[TDA9873_SW+1]); |
674 | v4l_dbg(1, &chip->c, "tda9873_setmode(): sw_data = %d\n", sw_data); | 674 | v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): sw_data = %d\n", sw_data); |
675 | 675 | ||
676 | switch (mode) { | 676 | switch (mode) { |
677 | case VIDEO_SOUND_MONO: | 677 | case VIDEO_SOUND_MONO: |
@@ -692,7 +692,7 @@ static void tda9873_setmode(struct CHIPSTATE *chip, int mode) | |||
692 | } | 692 | } |
693 | 693 | ||
694 | chip_write(chip, TDA9873_SW, sw_data); | 694 | chip_write(chip, TDA9873_SW, sw_data); |
695 | v4l_dbg(1, &chip->c, "tda9873_setmode(): req. mode %d; chip_write: %d\n", | 695 | v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): req. mode %d; chip_write: %d\n", |
696 | mode, sw_data); | 696 | mode, sw_data); |
697 | } | 697 | } |
698 | 698 | ||
@@ -831,7 +831,7 @@ static int tda9874a_setup(struct CHIPSTATE *chip) | |||
831 | chip_write(chip, TDA9874A_SDACOSR, (tda9874a_mode) ? 0x81:0x80); | 831 | chip_write(chip, TDA9874A_SDACOSR, (tda9874a_mode) ? 0x81:0x80); |
832 | chip_write(chip, TDA9874A_AOSR, 0x00); /* or 0x10 */ | 832 | chip_write(chip, TDA9874A_AOSR, 0x00); /* or 0x10 */ |
833 | } | 833 | } |
834 | v4l_dbg(1, &chip->c, "tda9874a_setup(): %s [0x%02X].\n", | 834 | v4l_dbg(1, debug, &chip->c, "tda9874a_setup(): %s [0x%02X].\n", |
835 | tda9874a_modelist[tda9874a_STD].name,tda9874a_STD); | 835 | tda9874a_modelist[tda9874a_STD].name,tda9874a_STD); |
836 | return 1; | 836 | return 1; |
837 | } | 837 | } |
@@ -874,7 +874,7 @@ static int tda9874a_getmode(struct CHIPSTATE *chip) | |||
874 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | 874 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; |
875 | } | 875 | } |
876 | 876 | ||
877 | v4l_dbg(1, &chip->c, "tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n", | 877 | v4l_dbg(1, debug, &chip->c, "tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n", |
878 | dsr, nsr, necr, mode); | 878 | dsr, nsr, necr, mode); |
879 | return mode; | 879 | return mode; |
880 | } | 880 | } |
@@ -920,7 +920,7 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode) | |||
920 | chip_write(chip, TDA9874A_AOSR, aosr); | 920 | chip_write(chip, TDA9874A_AOSR, aosr); |
921 | chip_write(chip, TDA9874A_MDACOSR, mdacosr); | 921 | chip_write(chip, TDA9874A_MDACOSR, mdacosr); |
922 | 922 | ||
923 | v4l_dbg(1, &chip->c, "tda9874a_setmode(): req. mode %d; AOSR=0x%X, MDACOSR=0x%X.\n", | 923 | v4l_dbg(1, debug, &chip->c, "tda9874a_setmode(): req. mode %d; AOSR=0x%X, MDACOSR=0x%X.\n", |
924 | mode, aosr, mdacosr); | 924 | mode, aosr, mdacosr); |
925 | 925 | ||
926 | } else { /* dic == 0x07 */ | 926 | } else { /* dic == 0x07 */ |
@@ -955,7 +955,7 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode) | |||
955 | chip_write(chip, TDA9874A_FMMR, fmmr); | 955 | chip_write(chip, TDA9874A_FMMR, fmmr); |
956 | chip_write(chip, TDA9874A_AOSR, aosr); | 956 | chip_write(chip, TDA9874A_AOSR, aosr); |
957 | 957 | ||
958 | v4l_dbg(1, &chip->c, "tda9874a_setmode(): req. mode %d; FMMR=0x%X, AOSR=0x%X.\n", | 958 | v4l_dbg(1, debug, &chip->c, "tda9874a_setmode(): req. mode %d; FMMR=0x%X, AOSR=0x%X.\n", |
959 | mode, fmmr, aosr); | 959 | mode, fmmr, aosr); |
960 | } | 960 | } |
961 | } | 961 | } |
@@ -969,7 +969,7 @@ static int tda9874a_checkit(struct CHIPSTATE *chip) | |||
969 | if(-1 == (sic = chip_read2(chip,TDA9874A_SIC))) | 969 | if(-1 == (sic = chip_read2(chip,TDA9874A_SIC))) |
970 | return 0; | 970 | return 0; |
971 | 971 | ||
972 | v4l_dbg(1, &chip->c, "tda9874a_checkit(): DIC=0x%X, SIC=0x%X.\n", dic, sic); | 972 | v4l_dbg(1, debug, &chip->c, "tda9874a_checkit(): DIC=0x%X, SIC=0x%X.\n", dic, sic); |
973 | 973 | ||
974 | if((dic == 0x11)||(dic == 0x07)) { | 974 | if((dic == 0x11)||(dic == 0x07)) { |
975 | v4l_info(&chip->c, "found tda9874%s.\n", (dic == 0x11) ? "a":"h"); | 975 | v4l_info(&chip->c, "found tda9874%s.\n", (dic == 0x11) ? "a":"h"); |
@@ -1184,7 +1184,7 @@ static int ta8874z_getmode(struct CHIPSTATE *chip) | |||
1184 | }else if (!(val & TA8874Z_B0)){ | 1184 | }else if (!(val & TA8874Z_B0)){ |
1185 | mode |= VIDEO_SOUND_STEREO; | 1185 | mode |= VIDEO_SOUND_STEREO; |
1186 | } | 1186 | } |
1187 | /* v4l_dbg(1, &chip->c, "ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); */ | 1187 | /* v4l_dbg(1, debug, &chip->c, "ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); */ |
1188 | return mode; | 1188 | return mode; |
1189 | } | 1189 | } |
1190 | 1190 | ||
@@ -1197,7 +1197,7 @@ static void ta8874z_setmode(struct CHIPSTATE *chip, int mode) | |||
1197 | { | 1197 | { |
1198 | int update = 1; | 1198 | int update = 1; |
1199 | audiocmd *t = NULL; | 1199 | audiocmd *t = NULL; |
1200 | v4l_dbg(1, &chip->c, "ta8874z_setmode(): mode: 0x%02x\n", mode); | 1200 | v4l_dbg(1, debug, &chip->c, "ta8874z_setmode(): mode: 0x%02x\n", mode); |
1201 | 1201 | ||
1202 | switch(mode){ | 1202 | switch(mode){ |
1203 | case VIDEO_SOUND_MONO: | 1203 | case VIDEO_SOUND_MONO: |
@@ -1468,17 +1468,16 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind) | |||
1468 | struct CHIPSTATE *chip; | 1468 | struct CHIPSTATE *chip; |
1469 | struct CHIPDESC *desc; | 1469 | struct CHIPDESC *desc; |
1470 | 1470 | ||
1471 | chip = kmalloc(sizeof(*chip),GFP_KERNEL); | 1471 | chip = kzalloc(sizeof(*chip),GFP_KERNEL); |
1472 | if (!chip) | 1472 | if (!chip) |
1473 | return -ENOMEM; | 1473 | return -ENOMEM; |
1474 | memset(chip,0,sizeof(*chip)); | ||
1475 | memcpy(&chip->c,&client_template,sizeof(struct i2c_client)); | 1474 | memcpy(&chip->c,&client_template,sizeof(struct i2c_client)); |
1476 | chip->c.adapter = adap; | 1475 | chip->c.adapter = adap; |
1477 | chip->c.addr = addr; | 1476 | chip->c.addr = addr; |
1478 | i2c_set_clientdata(&chip->c, chip); | 1477 | i2c_set_clientdata(&chip->c, chip); |
1479 | 1478 | ||
1480 | /* find description for the chip */ | 1479 | /* find description for the chip */ |
1481 | v4l_dbg(1, &chip->c, "chip found @ 0x%x\n", addr<<1); | 1480 | v4l_dbg(1, debug, &chip->c, "chip found @ 0x%x\n", addr<<1); |
1482 | for (desc = chiplist; desc->name != NULL; desc++) { | 1481 | for (desc = chiplist; desc->name != NULL; desc++) { |
1483 | if (0 == *(desc->insmodopt)) | 1482 | if (0 == *(desc->insmodopt)) |
1484 | continue; | 1483 | continue; |
@@ -1490,12 +1489,12 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind) | |||
1490 | break; | 1489 | break; |
1491 | } | 1490 | } |
1492 | if (desc->name == NULL) { | 1491 | if (desc->name == NULL) { |
1493 | v4l_dbg(1, &chip->c, "no matching chip description found\n"); | 1492 | v4l_dbg(1, debug, &chip->c, "no matching chip description found\n"); |
1494 | return -EIO; | 1493 | return -EIO; |
1495 | } | 1494 | } |
1496 | v4l_info(&chip->c, "%s found @ 0x%x (%s)\n", desc->name, addr<<1, adap->name); | 1495 | v4l_info(&chip->c, "%s found @ 0x%x (%s)\n", desc->name, addr<<1, adap->name); |
1497 | if (desc->flags) { | 1496 | if (desc->flags) { |
1498 | v4l_dbg(1, &chip->c, "matches:%s%s%s.\n", | 1497 | v4l_dbg(1, debug, &chip->c, "matches:%s%s%s.\n", |
1499 | (desc->flags & CHIP_HAS_VOLUME) ? " volume" : "", | 1498 | (desc->flags & CHIP_HAS_VOLUME) ? " volume" : "", |
1500 | (desc->flags & CHIP_HAS_BASSTREBLE) ? " bass/treble" : "", | 1499 | (desc->flags & CHIP_HAS_BASSTREBLE) ? " bass/treble" : "", |
1501 | (desc->flags & CHIP_HAS_INPUTSEL) ? " audiomux" : ""); | 1500 | (desc->flags & CHIP_HAS_INPUTSEL) ? " audiomux" : ""); |
@@ -1583,7 +1582,7 @@ static int chip_command(struct i2c_client *client, | |||
1583 | struct CHIPSTATE *chip = i2c_get_clientdata(client); | 1582 | struct CHIPSTATE *chip = i2c_get_clientdata(client); |
1584 | struct CHIPDESC *desc = chiplist + chip->type; | 1583 | struct CHIPDESC *desc = chiplist + chip->type; |
1585 | 1584 | ||
1586 | v4l_dbg(1, &chip->c, "%s: chip_command 0x%x\n", chip->c.name, cmd); | 1585 | v4l_dbg(1, debug, &chip->c, "%s: chip_command 0x%x\n", chip->c.name, cmd); |
1587 | 1586 | ||
1588 | switch (cmd) { | 1587 | switch (cmd) { |
1589 | case AUDC_SET_INPUT: | 1588 | case AUDC_SET_INPUT: |