aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tvaudio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/tvaudio.c')
-rw-r--r--drivers/media/video/tvaudio.c132
1 files changed, 132 insertions, 0 deletions
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index faa9e3dd782f..8333efab8685 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -1047,6 +1047,116 @@ static int tda9874a_initialize(struct CHIPSTATE *chip)
1047 return 0; 1047 return 0;
1048} 1048}
1049 1049
1050/* ---------------------------------------------------------------------- */
1051/* audio chip description - defines+functions for tda9875 */
1052/* The TDA9875 is made by Philips Semiconductor
1053 * http://www.semiconductors.philips.com
1054 * TDA9875: I2C-bus controlled DSP audio processor, FM demodulator
1055 *
1056 */
1057
1058/* subaddresses for TDA9875 */
1059#define TDA9875_MUT 0x12 /*General mute (value --> 0b11001100*/
1060#define TDA9875_CFG 0x01 /* Config register (value --> 0b00000000 */
1061#define TDA9875_DACOS 0x13 /*DAC i/o select (ADC) 0b0000100*/
1062#define TDA9875_LOSR 0x16 /*Line output select regirter 0b0100 0001*/
1063
1064#define TDA9875_CH1V 0x0c /*Channel 1 volume (mute)*/
1065#define TDA9875_CH2V 0x0d /*Channel 2 volume (mute)*/
1066#define TDA9875_SC1 0x14 /*SCART 1 in (mono)*/
1067#define TDA9875_SC2 0x15 /*SCART 2 in (mono)*/
1068
1069#define TDA9875_ADCIS 0x17 /*ADC input select (mono) 0b0110 000*/
1070#define TDA9875_AER 0x19 /*Audio effect (AVL+Pseudo) 0b0000 0110*/
1071#define TDA9875_MCS 0x18 /*Main channel select (DAC) 0b0000100*/
1072#define TDA9875_MVL 0x1a /* Main volume gauche */
1073#define TDA9875_MVR 0x1b /* Main volume droite */
1074#define TDA9875_MBA 0x1d /* Main Basse */
1075#define TDA9875_MTR 0x1e /* Main treble */
1076#define TDA9875_ACS 0x1f /* Auxilary channel select (FM) 0b0000000*/
1077#define TDA9875_AVL 0x20 /* Auxilary volume gauche */
1078#define TDA9875_AVR 0x21 /* Auxilary volume droite */
1079#define TDA9875_ABA 0x22 /* Auxilary Basse */
1080#define TDA9875_ATR 0x23 /* Auxilary treble */
1081
1082#define TDA9875_MSR 0x02 /* Monitor select register */
1083#define TDA9875_C1MSB 0x03 /* Carrier 1 (FM) frequency register MSB */
1084#define TDA9875_C1MIB 0x04 /* Carrier 1 (FM) frequency register (16-8]b */
1085#define TDA9875_C1LSB 0x05 /* Carrier 1 (FM) frequency register LSB */
1086#define TDA9875_C2MSB 0x06 /* Carrier 2 (nicam) frequency register MSB */
1087#define TDA9875_C2MIB 0x07 /* Carrier 2 (nicam) frequency register (16-8]b */
1088#define TDA9875_C2LSB 0x08 /* Carrier 2 (nicam) frequency register LSB */
1089#define TDA9875_DCR 0x09 /* Demodulateur configuration regirter*/
1090#define TDA9875_DEEM 0x0a /* FM de-emphasis regirter*/
1091#define TDA9875_FMAT 0x0b /* FM Matrix regirter*/
1092
1093/* values */
1094#define TDA9875_MUTE_ON 0xff /* general mute */
1095#define TDA9875_MUTE_OFF 0xcc /* general no mute */
1096
1097static int tda9875_initialize(struct CHIPSTATE *chip)
1098{
1099 chip_write(chip, TDA9875_CFG, 0xd0); /*reg de config 0 (reset)*/
1100 chip_write(chip, TDA9875_MSR, 0x03); /* Monitor 0b00000XXX*/
1101 chip_write(chip, TDA9875_C1MSB, 0x00); /*Car1(FM) MSB XMHz*/
1102 chip_write(chip, TDA9875_C1MIB, 0x00); /*Car1(FM) MIB XMHz*/
1103 chip_write(chip, TDA9875_C1LSB, 0x00); /*Car1(FM) LSB XMHz*/
1104 chip_write(chip, TDA9875_C2MSB, 0x00); /*Car2(NICAM) MSB XMHz*/
1105 chip_write(chip, TDA9875_C2MIB, 0x00); /*Car2(NICAM) MIB XMHz*/
1106 chip_write(chip, TDA9875_C2LSB, 0x00); /*Car2(NICAM) LSB XMHz*/
1107 chip_write(chip, TDA9875_DCR, 0x00); /*Demod config 0x00*/
1108 chip_write(chip, TDA9875_DEEM, 0x44); /*DE-Emph 0b0100 0100*/
1109 chip_write(chip, TDA9875_FMAT, 0x00); /*FM Matrix reg 0x00*/
1110 chip_write(chip, TDA9875_SC1, 0x00); /* SCART 1 (SC1)*/
1111 chip_write(chip, TDA9875_SC2, 0x01); /* SCART 2 (sc2)*/
1112
1113 chip_write(chip, TDA9875_CH1V, 0x10); /* Channel volume 1 mute*/
1114 chip_write(chip, TDA9875_CH2V, 0x10); /* Channel volume 2 mute */
1115 chip_write(chip, TDA9875_DACOS, 0x02); /* sig DAC i/o(in:nicam)*/
1116 chip_write(chip, TDA9875_ADCIS, 0x6f); /* sig ADC input(in:mono)*/
1117 chip_write(chip, TDA9875_LOSR, 0x00); /* line out (in:mono)*/
1118 chip_write(chip, TDA9875_AER, 0x00); /*06 Effect (AVL+PSEUDO) */
1119 chip_write(chip, TDA9875_MCS, 0x44); /* Main ch select (DAC) */
1120 chip_write(chip, TDA9875_MVL, 0x03); /* Vol Main left 10dB */
1121 chip_write(chip, TDA9875_MVR, 0x03); /* Vol Main right 10dB*/
1122 chip_write(chip, TDA9875_MBA, 0x00); /* Main Bass Main 0dB*/
1123 chip_write(chip, TDA9875_MTR, 0x00); /* Main Treble Main 0dB*/
1124 chip_write(chip, TDA9875_ACS, 0x44); /* Aux chan select (dac)*/
1125 chip_write(chip, TDA9875_AVL, 0x00); /* Vol Aux left 0dB*/
1126 chip_write(chip, TDA9875_AVR, 0x00); /* Vol Aux right 0dB*/
1127 chip_write(chip, TDA9875_ABA, 0x00); /* Aux Bass Main 0dB*/
1128 chip_write(chip, TDA9875_ATR, 0x00); /* Aux Aigus Main 0dB*/
1129
1130 chip_write(chip, TDA9875_MUT, 0xcc); /* General mute */
1131 return 0;
1132}
1133
1134static int tda9875_volume(int val) { return (unsigned char)(val / 602 - 84); }
1135static int tda9875_bass(int val) { return (unsigned char)(max(-12, val / 2115 - 15)); }
1136static int tda9875_treble(int val) { return (unsigned char)(val / 2622 - 12); }
1137
1138/* ----------------------------------------------------------------------- */
1139
1140
1141/* *********************** *
1142 * i2c interface functions *
1143 * *********************** */
1144
1145static int tda9875_checkit(struct CHIPSTATE *chip)
1146{
1147 struct v4l2_subdev *sd = &chip->sd;
1148 int dic, rev;
1149
1150 dic = chip_read2(chip, 254);
1151 rev = chip_read2(chip, 255);
1152
1153 if (dic == 0 || dic == 2) { /* tda9875 and tda9875A */
1154 v4l2_info(sd, "found tda9875%s rev. %d.\n",
1155 dic == 0 ? "" : "A", rev);
1156 return 1;
1157 }
1158 return 0;
1159}
1050 1160
1051/* ---------------------------------------------------------------------- */ 1161/* ---------------------------------------------------------------------- */
1052/* audio chip descriptions - defines+functions for tea6420 */ 1162/* audio chip descriptions - defines+functions for tea6420 */
@@ -1280,6 +1390,7 @@ static int tda9850 = 1;
1280static int tda9855 = 1; 1390static int tda9855 = 1;
1281static int tda9873 = 1; 1391static int tda9873 = 1;
1282static int tda9874a = 1; 1392static int tda9874a = 1;
1393static int tda9875 = 1;
1283static int tea6300; /* default 0 - address clash with msp34xx */ 1394static int tea6300; /* default 0 - address clash with msp34xx */
1284static int tea6320; /* default 0 - address clash with msp34xx */ 1395static int tea6320; /* default 0 - address clash with msp34xx */
1285static int tea6420 = 1; 1396static int tea6420 = 1;
@@ -1292,6 +1403,7 @@ module_param(tda9850, int, 0444);
1292module_param(tda9855, int, 0444); 1403module_param(tda9855, int, 0444);
1293module_param(tda9873, int, 0444); 1404module_param(tda9873, int, 0444);
1294module_param(tda9874a, int, 0444); 1405module_param(tda9874a, int, 0444);
1406module_param(tda9875, int, 0444);
1295module_param(tea6300, int, 0444); 1407module_param(tea6300, int, 0444);
1296module_param(tea6320, int, 0444); 1408module_param(tea6320, int, 0444);
1297module_param(tea6420, int, 0444); 1409module_param(tea6420, int, 0444);
@@ -1349,6 +1461,26 @@ static struct CHIPDESC chiplist[] = {
1349 .setmode = tda9874a_setmode, 1461 .setmode = tda9874a_setmode,
1350 }, 1462 },
1351 { 1463 {
1464 .name = "tda9875",
1465 .insmodopt = &tda9875,
1466 .addr_lo = I2C_ADDR_TDA9875 >> 1,
1467 .addr_hi = I2C_ADDR_TDA9875 >> 1,
1468 .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE,
1469
1470 /* callbacks */
1471 .initialize = tda9875_initialize,
1472 .checkit = tda9875_checkit,
1473 .volfunc = tda9875_volume,
1474 .bassfunc = tda9875_bass,
1475 .treblefunc = tda9875_treble,
1476 .leftreg = TDA9875_MVL,
1477 .rightreg = TDA9875_MVR,
1478 .bassreg = TDA9875_MBA,
1479 .treblereg = TDA9875_MTR,
1480 .leftinit = 58880,
1481 .rightinit = 58880,
1482 },
1483 {
1352 .name = "tda9850", 1484 .name = "tda9850",
1353 .insmodopt = &tda9850, 1485 .insmodopt = &tda9850,
1354 .addr_lo = I2C_ADDR_TDA985x_L >> 1, 1486 .addr_lo = I2C_ADDR_TDA985x_L >> 1,