25 #include <linux/module.h>
26 #include <linux/kernel.h>
27 #include <linux/sched.h>
28 #include <linux/string.h>
31 #include <linux/errno.h>
32 #include <linux/slab.h>
33 #include <linux/videodev2.h>
34 #include <linux/i2c.h>
52 MODULE_AUTHOR(
"Eric Sandeen, Steve VanDeBogart, Greg Alexander, Gerd Knorr");
85 #define CHIP_HAS_VOLUME 1
86 #define CHIP_HAS_BASSTREBLE 2
87 #define CHIP_HAS_INPUTSEL 4
88 #define CHIP_NEED_CHECKMODE 8
156 v4l2_warn(sd,
"I/O error (write 0x%x)\n", val);
162 "Tried to access a non-existent register: %d\n",
173 v4l2_warn(sd,
"I/O error (write reg%d=0x%x)\n",
181 static int chip_write_masked(
struct CHIPSTATE *chip,
182 int subaddr,
int val,
int mask)
188 val = (chip->
shadow.
bytes[1] & ~mask) | (val & mask);
192 "Tried to access a non-existent register: %d\n",
197 val = (chip->
shadow.
bytes[subaddr+1] & ~mask) | (val & mask);
200 return chip_write(chip, subaddr, val);
203 static int chip_read(
struct CHIPSTATE *chip)
206 struct i2c_client *c = v4l2_get_subdevdata(sd);
217 static int chip_read2(
struct CHIPSTATE *chip,
int subaddr)
220 struct i2c_client *c = v4l2_get_subdevdata(sd);
221 unsigned char write[1];
222 unsigned char read[1];
251 struct i2c_client *c = v4l2_get_subdevdata(sd);
259 "Tried to access a non-existent register range: %d to %d\n",
268 name, cmd->
bytes[0]);
269 for (i = 1; i < cmd->
count; i++) {
292 static void chip_thread_wake(
unsigned long data)
298 static int chip_thread(
void *
data)
339 if (mode & V4L2_TUNER_SUB_LANG1)
347 else if (mode & V4L2_TUNER_SUB_STEREO)
351 if (mode & V4L2_TUNER_SUB_LANG2)
353 else if (mode & V4L2_TUNER_SUB_STEREO)
369 #define TDA9840_SW 0x00
370 #define TDA9840_LVADJ 0x02
371 #define TDA9840_STADJ 0x03
372 #define TDA9840_TEST 0x04
374 #define TDA9840_MONO 0x10
375 #define TDA9840_STEREO 0x2a
376 #define TDA9840_DUALA 0x12
377 #define TDA9840_DUALB 0x1e
378 #define TDA9840_DUALAB 0x1a
379 #define TDA9840_DUALBA 0x16
380 #define TDA9840_EXTERNAL 0x7a
382 #define TDA9840_DS_DUAL 0x20
383 #define TDA9840_ST_STEREO 0x40
384 #define TDA9840_PONRES 0x80
386 #define TDA9840_TEST_INT1SN 0x1
387 #define TDA9840_TEST_INTFU 0x02
389 static int tda9840_getrxsubchans(
struct CHIPSTATE *chip)
394 val = chip_read(chip);
402 "tda9840_getrxsubchans(): raw chip read: %d, return: %d\n",
407 static void tda9840_setaudmode(
struct CHIPSTATE *chip,
int mode)
436 static int tda9840_checkit(
struct CHIPSTATE *chip)
439 rc = chip_read(chip);
441 return ((rc & 0x1f) == 0) ? 1 : 0;
448 #define TDA9855_VR 0x00
449 #define TDA9855_VL 0x01
450 #define TDA9855_BA 0x02
451 #define TDA9855_TR 0x03
452 #define TDA9855_SW 0x04
455 #define TDA9850_C4 0x04
458 #define TDA985x_C5 0x05
459 #define TDA985x_C6 0x06
460 #define TDA985x_C7 0x07
461 #define TDA985x_A1 0x08
462 #define TDA985x_A2 0x09
463 #define TDA985x_A3 0x0a
494 #define TDA9855_MUTE 1<<7
495 #define TDA9855_AVL 1<<6
496 #define TDA9855_LOUD 1<<5
497 #define TDA9855_SUR 1<<3
501 #define TDA9855_EXT 1<<2
502 #define TDA9855_INT 0
511 #define TDA985x_SAP 3<<6
512 #define TDA985x_MONOSAP 2<<6
513 #define TDA985x_STEREO 1<<6
514 #define TDA985x_MONO 0
515 #define TDA985x_LMU 1<<3
518 #define TDA9855_TZCM 1<<5
519 #define TDA9855_VZCM 1<<4
520 #define TDA9855_LINEAR 0
521 #define TDA9855_PSEUDO 1
522 #define TDA9855_SPAT_30 2
523 #define TDA9855_SPAT_50 3
524 #define TDA9855_E_MONO 7
535 #define TDA985x_STP 1<<5
536 #define TDA985x_SAPP 1<<6
537 #define TDA985x_STS 1<<7
543 #define TDA985x_ADJ 1<<7
545 static int tda9855_volume(
int val) {
return val/0x2e8+0x27; }
546 static int tda9855_bass(
int val) {
return val/0xccc+0x06; }
547 static int tda9855_treble(
int val) {
return (val/0x1c71+0x3)<<1; }
549 static int tda985x_getrxsubchans(
struct CHIPSTATE *chip)
556 val = chip_read(chip);
564 static void tda985x_setaudmode(
struct CHIPSTATE *chip,
int mode)
596 #define TDA9873_SW 0x00
597 #define TDA9873_AD 0x01
598 #define TDA9873_PT 0x02
608 #define TDA9873_INP_MASK 3
609 #define TDA9873_INTERNAL 0
610 #define TDA9873_EXT_STEREO 2
611 #define TDA9873_EXT_MONO 1
624 #define TDA9873_TR_MASK (7 << 2)
625 #define TDA9873_TR_MONO 4
626 #define TDA9873_TR_STEREO 1 << 4
627 #define TDA9873_TR_REVERSE ((1 << 3) | (1 << 2))
628 #define TDA9873_TR_DUALA 1 << 2
629 #define TDA9873_TR_DUALB 1 << 3
630 #define TDA9873_TR_DUALAB 0
638 #define TDA9873_GAIN_NORMAL 1 << 5
639 #define TDA9873_MUTE 1 << 6
640 #define TDA9873_AUTOMUTE 1 << 7
648 #define TDA9873_STEREO_ADJ 0x06
661 #define TDA9873_DK1 2
662 #define TDA9873_DK2 3
663 #define TDA9873_DK3 4
668 #define TDA9873_IDR_NORM 0
669 #define TDA9873_IDR_FAST 1 << 7
681 #define TDA9873_PORTS 3
684 #define TDA9873_TST_PORT 1 << 2
693 #define TDA9873_MOUT_MONO 0
694 #define TDA9873_MOUT_FMONO 0
695 #define TDA9873_MOUT_DUALA 0
696 #define TDA9873_MOUT_DUALB 1 << 3
697 #define TDA9873_MOUT_ST 1 << 4
698 #define TDA9873_MOUT_EXTM ((1 << 4) | (1 << 3))
699 #define TDA9873_MOUT_EXTL 1 << 5
700 #define TDA9873_MOUT_EXTR ((1 << 5) | (1 << 3))
701 #define TDA9873_MOUT_EXTLR ((1 << 5) | (1 << 4))
702 #define TDA9873_MOUT_MUTE ((1 << 5) | (1 << 4) | (1 << 3))
705 #define TDA9873_PONR 0
706 #define TDA9873_STEREO 2
707 #define TDA9873_DUAL 4
709 static int tda9873_getrxsubchans(
struct CHIPSTATE *chip)
714 val = chip_read(chip);
721 "tda9873_getrxsubchans(): raw chip read: %d, return: %d\n",
726 static void tda9873_setaudmode(
struct CHIPSTATE *chip,
int mode)
734 "tda9873_setaudmode(): external input\n");
739 "tda9873_setaudmode(): chip->shadow.bytes[%d] = %d\n",
741 v4l2_dbg(1,
debug, sd,
"tda9873_setaudmode(): sw_data = %d\n",
766 "tda9873_setaudmode(): req. mode %d; chip_write: %d\n",
770 static int tda9873_checkit(
struct CHIPSTATE *chip)
774 if (-1 == (rc = chip_read2(chip,254)))
776 return (rc & ~0x1f) == 0x80;
785 #define TDA9874A_AGCGR 0x00
786 #define TDA9874A_GCONR 0x01
787 #define TDA9874A_MSR 0x02
788 #define TDA9874A_C1FRA 0x03
789 #define TDA9874A_C1FRB 0x04
790 #define TDA9874A_C1FRC 0x05
791 #define TDA9874A_C2FRA 0x06
792 #define TDA9874A_C2FRB 0x07
793 #define TDA9874A_C2FRC 0x08
794 #define TDA9874A_DCR 0x09
795 #define TDA9874A_FMER 0x0a
796 #define TDA9874A_FMMR 0x0b
797 #define TDA9874A_C1OLAR 0x0c
798 #define TDA9874A_C2OLAR 0x0d
799 #define TDA9874A_NCONR 0x0e
800 #define TDA9874A_NOLAR 0x0f
801 #define TDA9874A_NLELR 0x10
802 #define TDA9874A_NUELR 0x11
803 #define TDA9874A_AMCONR 0x12
804 #define TDA9874A_SDACOSR 0x13
805 #define TDA9874A_AOSR 0x14
806 #define TDA9874A_DAICONR 0x15
807 #define TDA9874A_I2SOSR 0x16
808 #define TDA9874A_I2SOLAR 0x17
809 #define TDA9874A_MDACOSR 0x18
810 #define TDA9874A_ESP 0xFF
813 #define TDA9874A_DSR 0x00
814 #define TDA9874A_NSR 0x01
815 #define TDA9874A_NECR 0x02
816 #define TDA9874A_DR1 0x03
817 #define TDA9874A_DR2 0x04
818 #define TDA9874A_LLRA 0x05
819 #define TDA9874A_LLRB 0x06
820 #define TDA9874A_SIFLR 0x07
821 #define TDA9874A_TR2 252
822 #define TDA9874A_TR1 253
823 #define TDA9874A_DIC 254
824 #define TDA9874A_SIC 255
827 static int tda9874a_mode = 1;
828 static int tda9874a_GCONR = 0xc0;
829 static int tda9874a_NCONR = 0x01;
830 static int tda9874a_ESP = 0x07;
831 static int tda9874a_dic = -1;
834 static unsigned int tda9874a_SIF =
UNSET;
835 static unsigned int tda9874a_AMSEL =
UNSET;
836 static unsigned int tda9874a_STD =
UNSET;
849 static struct tda9874a_MODES {
852 } tda9874a_modelist[9] = {
854 { 9, {
TDA9874A_C1FRA, 0x72,0x95,0x55, 0x77,0xA0,0x00, 0x00,0x00 }} },
856 { 9, {
TDA9874A_C1FRA, 0x5D,0xC0,0x00, 0x62,0x6A,0xAA, 0x20,0x22 }} },
858 { 9, {
TDA9874A_C1FRA, 0x87,0x6A,0xAA, 0x82,0x60,0x00, 0x00,0x00 }} },
860 { 9, {
TDA9874A_C1FRA, 0x87,0x6A,0xAA, 0x8C,0x75,0x55, 0x00,0x00 }} },
862 { 9, {
TDA9874A_C1FRA, 0x87,0x6A,0xAA, 0x77,0xA0,0x00, 0x00,0x00 }} },
864 { 9, {
TDA9874A_C1FRA, 0x7D,0x00,0x00, 0x88,0x8A,0xAA, 0x08,0x33 }} },
866 { 9, {
TDA9874A_C1FRA, 0x72,0x95,0x55, 0x79,0xEA,0xAA, 0x08,0x33 }} },
868 { 9, {
TDA9874A_C1FRA, 0x87,0x6A,0xAA, 0x79,0xEA,0xAA, 0x08,0x33 }} },
870 { 9, {
TDA9874A_C1FRA, 0x87,0x6A,0xAA, 0x79,0xEA,0xAA, 0x09,0x33 }} }
873 static int tda9874a_setup(
struct CHIPSTATE *chip)
879 chip_write(chip,
TDA9874A_MSR, (tda9874a_mode) ? 0x03:0x02);
880 if(tda9874a_dic == 0x11) {
883 chip_cmd(chip,
"tda9874_modelist",&tda9874a_modelist[tda9874a_STD].cmd);
896 if(tda9874a_dic == 0x11) {
908 tda9874a_modelist[tda9874a_STD].name,tda9874a_STD);
912 static int tda9874a_getrxsubchans(
struct CHIPSTATE *chip)
952 "tda9874a_getrxsubchans(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n",
953 dsr, nsr, necr, mode);
957 static void tda9874a_setaudmode(
struct CHIPSTATE *chip,
int mode)
965 tda9874a_NCONR &= 0xfe;
967 tda9874a_NCONR |= 0x01;
977 if(tda9874a_dic == 0x11) {
979 int mdacosr = (tda9874a_mode) ? 0x82:0x80;
987 mdacosr = (tda9874a_mode) ? 0x82:0x80;
991 mdacosr = (tda9874a_mode) ? 0x83:0x81;
995 mdacosr = (tda9874a_mode) ? 0x82:0x80;
1004 "tda9874a_setaudmode(): req. mode %d; AOSR=0x%X, MDACOSR=0x%X.\n",
1005 mode, aosr, mdacosr);
1020 fmmr = (tda9874a_ESP == 1) ? 0x05 : 0x04;
1043 "tda9874a_setaudmode(): req. mode %d; FMMR=0x%X, AOSR=0x%X.\n",
1048 static int tda9874a_checkit(
struct CHIPSTATE *chip)
1058 v4l2_dbg(1,
debug, sd,
"tda9874a_checkit(): DIC=0x%X, SIC=0x%X.\n", dic, sic);
1060 if((dic == 0x11)||(dic == 0x07)) {
1061 v4l2_info(sd,
"found tda9874%s.\n", (dic == 0x11) ?
"a" :
"h");
1068 static int tda9874a_initialize(
struct CHIPSTATE *chip)
1070 if (tda9874a_SIF > 2)
1072 if (tda9874a_STD >=
ARRAY_SIZE(tda9874a_modelist))
1074 if(tda9874a_AMSEL > 1)
1077 if(tda9874a_SIF == 1)
1078 tda9874a_GCONR = 0xc0;
1080 tda9874a_GCONR = 0xc1;
1082 tda9874a_ESP = tda9874a_STD;
1083 tda9874a_mode = (tda9874a_STD < 5) ? 0 : 1;
1085 if(tda9874a_AMSEL == 0)
1086 tda9874a_NCONR = 0x01;
1088 tda9874a_NCONR = 0x05;
1090 tda9874a_setup(chip);
1103 #define TDA9875_MUT 0x12
1104 #define TDA9875_CFG 0x01
1105 #define TDA9875_DACOS 0x13
1106 #define TDA9875_LOSR 0x16
1108 #define TDA9875_CH1V 0x0c
1109 #define TDA9875_CH2V 0x0d
1110 #define TDA9875_SC1 0x14
1111 #define TDA9875_SC2 0x15
1113 #define TDA9875_ADCIS 0x17
1114 #define TDA9875_AER 0x19
1115 #define TDA9875_MCS 0x18
1116 #define TDA9875_MVL 0x1a
1117 #define TDA9875_MVR 0x1b
1118 #define TDA9875_MBA 0x1d
1119 #define TDA9875_MTR 0x1e
1120 #define TDA9875_ACS 0x1f
1121 #define TDA9875_AVL 0x20
1122 #define TDA9875_AVR 0x21
1123 #define TDA9875_ABA 0x22
1124 #define TDA9875_ATR 0x23
1126 #define TDA9875_MSR 0x02
1127 #define TDA9875_C1MSB 0x03
1128 #define TDA9875_C1MIB 0x04
1129 #define TDA9875_C1LSB 0x05
1130 #define TDA9875_C2MSB 0x06
1131 #define TDA9875_C2MIB 0x07
1132 #define TDA9875_C2LSB 0x08
1133 #define TDA9875_DCR 0x09
1134 #define TDA9875_DEEM 0x0a
1135 #define TDA9875_FMAT 0x0b
1138 #define TDA9875_MUTE_ON 0xff
1139 #define TDA9875_MUTE_OFF 0xcc
1141 static int tda9875_initialize(
struct CHIPSTATE *chip)
1178 static int tda9875_volume(
int val) {
return (
unsigned char)(val / 602 - 84); }
1179 static int tda9875_bass(
int val) {
return (
unsigned char)(
max(-12, val / 2115 - 15)); }
1180 static int tda9875_treble(
int val) {
return (
unsigned char)(val / 2622 - 12); }
1189 static int tda9875_checkit(
struct CHIPSTATE *chip)
1194 dic = chip_read2(chip, 254);
1195 rev = chip_read2(chip, 255);
1197 if (dic == 0 || dic == 2) {
1198 v4l2_info(sd,
"found tda9875%s rev. %d.\n",
1199 dic == 0 ?
"" :
"A", rev);
1208 #define TEA6300_VL 0x00
1209 #define TEA6300_VR 0x01
1210 #define TEA6300_BA 0x02
1211 #define TEA6300_TR 0x03
1212 #define TEA6300_FA 0x04
1213 #define TEA6300_S 0x05
1215 #define TEA6300_S_SA 0x01
1216 #define TEA6300_S_SB 0x02
1217 #define TEA6300_S_SC 0x04
1218 #define TEA6300_S_GMU 0x80
1220 #define TEA6320_V 0x00
1221 #define TEA6320_FFR 0x01
1222 #define TEA6320_FFL 0x02
1223 #define TEA6320_FRR 0x03
1224 #define TEA6320_FRL 0x04
1225 #define TEA6320_BA 0x05
1226 #define TEA6320_TR 0x06
1227 #define TEA6320_S 0x07
1229 #define TEA6320_S_SA 0x07
1230 #define TEA6320_S_SB 0x06
1231 #define TEA6320_S_SC 0x05
1232 #define TEA6320_S_SD 0x04
1233 #define TEA6320_S_GMU 0x80
1235 #define TEA6420_S_SA 0x00
1236 #define TEA6420_S_SB 0x01
1237 #define TEA6420_S_SC 0x02
1238 #define TEA6420_S_SD 0x03
1239 #define TEA6420_S_SE 0x04
1240 #define TEA6420_S_GMU 0x05
1242 static int tea6300_shift10(
int val) {
return val >> 10; }
1243 static int tea6300_shift12(
int val) {
return val >> 12; }
1247 static int tea6320_volume(
int val) {
return (val / (65535/(63-12)) + 12) & 0x3f; }
1248 static int tea6320_shift11(
int val) {
return val >> 11; }
1249 static int tea6320_initialize(
struct CHIPSTATE * chip)
1263 #define TDA8425_VL 0x00
1264 #define TDA8425_VR 0x01
1265 #define TDA8425_BA 0x02
1266 #define TDA8425_TR 0x03
1267 #define TDA8425_S1 0x08
1269 #define TDA8425_S1_OFF 0xEE
1270 #define TDA8425_S1_CH1 0xCE
1271 #define TDA8425_S1_CH2 0xCF
1272 #define TDA8425_S1_MU 0x20
1273 #define TDA8425_S1_STEREO 0x18
1274 #define TDA8425_S1_STEREO_SPATIAL 0x18
1275 #define TDA8425_S1_STEREO_LINEAR 0x08
1276 #define TDA8425_S1_STEREO_PSEUDO 0x10
1277 #define TDA8425_S1_STEREO_MONO 0x00
1278 #define TDA8425_S1_ML 0x06
1279 #define TDA8425_S1_ML_SOUND_A 0x02
1280 #define TDA8425_S1_ML_SOUND_B 0x04
1281 #define TDA8425_S1_ML_STEREO 0x06
1282 #define TDA8425_S1_IS 0x01
1285 static int tda8425_shift10(
int val) {
return (val >> 10) | 0xc0; }
1286 static int tda8425_shift12(
int val) {
return (val >> 12) | 0xf0; }
1288 static void tda8425_setaudmode(
struct CHIPSTATE *chip,
int mode)
1324 #define PIC16C54_REG_KEY_CODE 0x01
1325 #define PIC16C54_REG_MISC 0x02
1328 #define PIC16C54_MISC_RESET_REMOTE_CTL 0x01
1330 #define PIC16C54_MISC_MTS_MAIN 0x02
1331 #define PIC16C54_MISC_MTS_SAP 0x04
1332 #define PIC16C54_MISC_MTS_BOTH 0x08
1333 #define PIC16C54_MISC_SND_MUTE 0x10
1334 #define PIC16C54_MISC_SND_NOTMUTE 0x20
1335 #define PIC16C54_MISC_SWITCH_TUNER 0x40
1336 #define PIC16C54_MISC_SWITCH_LINE 0x80
1342 #define TA8874Z_LED_STE 0x80
1343 #define TA8874Z_LED_BIL 0x40
1344 #define TA8874Z_LED_EXT 0x20
1345 #define TA8874Z_MONO_SET 0x10
1346 #define TA8874Z_MUTE 0x08
1347 #define TA8874Z_F_MONO 0x04
1348 #define TA8874Z_MODE_SUB 0x02
1349 #define TA8874Z_MODE_MAIN 0x01
1353 #define TA8874Z_SEPARATION 0x3f
1354 #define TA8874Z_SEPARATION_DEFAULT 0x10
1357 #define TA8874Z_B1 0x80
1358 #define TA8874Z_B0 0x40
1359 #define TA8874Z_CHAG_FLAG 0x20
1367 static int ta8874z_getrxsubchans(
struct CHIPSTATE *chip)
1371 val = chip_read(chip);
1390 static void ta8874z_setaudmode(
struct CHIPSTATE *chip,
int mode)
1396 v4l2_dbg(1,
debug, sd,
"ta8874z_setaudmode(): mode: 0x%02x\n", mode);
1403 t = &ta8874z_stereo;
1419 chip_cmd(chip,
"TA8874Z", t);
1422 static int ta8874z_checkit(
struct CHIPSTATE *chip)
1425 rc = chip_read(chip);
1426 return ((rc & 0x1f) == 0x1f) ? 1 : 0;
1433 static int tda8425 = 1;
1434 static int tda9840 = 1;
1435 static int tda9850 = 1;
1436 static int tda9855 = 1;
1437 static int tda9873 = 1;
1438 static int tda9874a = 1;
1439 static int tda9875 = 1;
1442 static int tea6420 = 1;
1443 static int pic16c54 = 1;
1459 static struct CHIPDESC chiplist[] = {
1462 .insmodopt = &tda9840,
1469 .checkit = tda9840_checkit,
1470 .getrxsubchans = tda9840_getrxsubchans,
1471 .setaudmode = tda9840_setaudmode,
1478 .insmodopt = &tda9873,
1485 .checkit = tda9873_checkit,
1486 .getrxsubchans = tda9873_getrxsubchans,
1487 .setaudmode = tda9873_setaudmode,
1489 .init = { 4, {
TDA9873_SW, 0xa4, 0x06, 0x03 } },
1492 .inputmap = {0xa0, 0xa2, 0xa0, 0xa0},
1497 .name =
"tda9874h/a",
1498 .insmodopt = &tda9874a,
1504 .initialize = tda9874a_initialize,
1505 .checkit = tda9874a_checkit,
1506 .getrxsubchans = tda9874a_getrxsubchans,
1507 .setaudmode = tda9874a_setaudmode,
1511 .insmodopt = &tda9875,
1517 .initialize = tda9875_initialize,
1518 .checkit = tda9875_checkit,
1519 .volfunc = tda9875_volume,
1520 .bassfunc = tda9875_bass,
1521 .treblefunc = tda9875_treble,
1531 .insmodopt = &tda9850,
1536 .getrxsubchans = tda985x_getrxsubchans,
1537 .setaudmode = tda985x_setaudmode,
1543 .insmodopt = &tda9855,
1555 .volfunc = tda9855_volume,
1556 .bassfunc = tda9855_bass,
1557 .treblefunc = tda9855_treble,
1558 .getrxsubchans = tda985x_getrxsubchans,
1559 .setaudmode = tda985x_setaudmode,
1561 .init = { 12, { 0, 0x6f, 0x6f, 0x0e, 0x07<<1, 0x8<<2,
1564 0x07, 0x10, 0x10, 0x03 }}
1568 .insmodopt = &tea6300,
1580 .volfunc = tea6300_shift10,
1581 .bassfunc = tea6300_shift12,
1582 .treblefunc = tea6300_shift12,
1590 .insmodopt = &tea6320,
1602 .initialize = tea6320_initialize,
1603 .volfunc = tea6320_volume,
1604 .bassfunc = tea6320_shift11,
1605 .treblefunc = tea6320_shift11,
1613 .insmodopt = &tea6420,
1625 .insmodopt = &tda8425,
1637 .volfunc = tda8425_shift10,
1638 .bassfunc = tda8425_shift12,
1639 .treblefunc = tda8425_shift12,
1640 .setaudmode = tda8425_setaudmode,
1648 .name =
"pic16c54 (PV951)",
1649 .insmodopt = &pic16c54,
1664 .checkit = ta8874z_checkit,
1665 .insmodopt = &ta8874z,
1671 .getrxsubchans = ta8874z_getrxsubchans,
1672 .setaudmode = ta8874z_setaudmode,
1742 chip_write_masked(chip,desc->
inputreg,
1775 balance = ctrl->
value;
1776 chip->
left = (
min(65536 - balance, 32768) *
volume) / 32768;
1777 chip->
right = (
min(balance, volume * (
__u16)32768)) / 32768;
1806 static int tvaudio_s_radio(
struct v4l2_subdev *sd)
1844 static int tvaudio_s_routing(
struct v4l2_subdev *sd,
1858 chip_write_masked(chip, desc->
inputreg,
1950 .g_chip_ident = tvaudio_g_chip_ident,
1951 .queryctrl = tvaudio_queryctrl,
1952 .g_ctrl = tvaudio_g_ctrl,
1953 .s_ctrl = tvaudio_s_ctrl,
1954 .s_std = tvaudio_s_std,
1958 .s_radio = tvaudio_s_radio,
1959 .s_frequency = tvaudio_s_frequency,
1960 .s_tuner = tvaudio_s_tuner,
1961 .g_tuner = tvaudio_g_tuner,
1965 .s_routing = tvaudio_s_routing,
1969 .core = &tvaudio_core_ops,
1970 .tuner = &tvaudio_tuner_ops,
1971 .audio = &tvaudio_audio_ops,
1986 printk(
KERN_INFO "tvaudio: TV audio decoder + audio/video mux driver\n");
1988 for (desc = chiplist; desc->
name !=
NULL; desc++)
1989 printk(
"%s%s", (desc == chiplist) ?
"" :
", ", desc->
name);
2001 for (desc = chiplist; desc->
name !=
NULL; desc++) {
2012 v4l2_dbg(1,
debug, sd,
"no matching chip description found\n");
2036 chip_cmd(chip,
"init", &desc->
init);
2043 v4l2_info(sd,
"volume callback undefined!\n");
2048 chip_write(chip, desc->
leftreg,
2059 v4l2_info(sd,
"bass/treble callbacks undefined!\n");
2066 chip_write(chip, desc->
bassreg,
2080 v4l2_info(sd,
"set/get mode callbacks undefined!\n");
2084 chip->
wt.function = chip_thread_wake;
2085 chip->
wt.data = (
unsigned long)chip;
2087 if (IS_ERR(chip->
thread)) {
2088 v4l2_warn(sd,
"failed to create kthread\n");
2095 static int tvaudio_remove(
struct i2c_client *client)
2097 struct v4l2_subdev *sd = i2c_get_clientdata(client);
2126 .probe = tvaudio_probe,
2127 .remove = tvaudio_remove,
2128 .id_table = tvaudio_id,