aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c106
1 files changed, 77 insertions, 29 deletions
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index a29d800616b1..8e55c7572b4b 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -33,6 +33,7 @@
33#include "saa7134.h" 33#include "saa7134.h"
34#include <media/v4l2-common.h> 34#include <media/v4l2-common.h>
35#include "dvb-pll.h" 35#include "dvb-pll.h"
36#include <dvb_frontend.h>
36 37
37#include "mt352.h" 38#include "mt352.h"
38#include "mt352_priv.h" /* FIXME */ 39#include "mt352_priv.h" /* FIXME */
@@ -94,7 +95,7 @@ static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
94 saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28)); 95 saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28));
95 udelay(10); 96 udelay(10);
96 ok = saa_readl(SAA7134_GPIO_GPSTATUS0) & (1 << 27); 97 ok = saa_readl(SAA7134_GPIO_GPSTATUS0) & (1 << 27);
97 dprintk("%s %s\n", __FUNCTION__, ok ? "on" : "off"); 98 dprintk("%s %s\n", __func__, ok ? "on" : "off");
98 99
99 if (!ok) 100 if (!ok)
100 saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26)); 101 saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26));
@@ -114,7 +115,7 @@ static int mt352_pinnacle_init(struct dvb_frontend* fe)
114 static u8 irq_cfg [] = { INTERRUPT_EN_0, 0x00, 0x00, 0x00, 0x00 }; 115 static u8 irq_cfg [] = { INTERRUPT_EN_0, 0x00, 0x00, 0x00, 0x00 };
115 struct saa7134_dev *dev= fe->dvb->priv; 116 struct saa7134_dev *dev= fe->dvb->priv;
116 117
117 dprintk("%s called\n", __FUNCTION__); 118 dprintk("%s called\n", __func__);
118 119
119 mt352_write(fe, clock_config, sizeof(clock_config)); 120 mt352_write(fe, clock_config, sizeof(clock_config));
120 udelay(200); 121 udelay(200);
@@ -882,6 +883,33 @@ static int md8800_set_high_voltage(struct dvb_frontend *fe, long arg)
882 return res; 883 return res;
883}; 884};
884 885
886static int md8800_set_voltage2(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
887{
888 struct saa7134_dev *dev = fe->dvb->priv;
889 u8 wbuf[2] = { 0x1f, 00 };
890 u8 rbuf;
891 struct i2c_msg msg[] = { { .addr = 0x08, .flags = 0, .buf = wbuf, .len = 1 },
892 { .addr = 0x08, .flags = I2C_M_RD, .buf = &rbuf, .len = 1 } };
893
894 if (i2c_transfer(&dev->i2c_adap, msg, 2) != 2)
895 return -EIO;
896 /* NOTE: this assumes that gpo1 is used, it might be bit 5 (gpo2) */
897 if (voltage == SEC_VOLTAGE_18)
898 wbuf[1] = rbuf | 0x10;
899 else
900 wbuf[1] = rbuf & 0xef;
901 msg[0].len = 2;
902 i2c_transfer(&dev->i2c_adap, msg, 1);
903 return 0;
904}
905
906static int md8800_set_high_voltage2(struct dvb_frontend *fe, long arg)
907{
908 struct saa7134_dev *dev = fe->dvb->priv;
909 wprintk("%s: sorry can't set high LNB supply voltage from here\n", __func__);
910 return -EIO;
911}
912
885/* ================================================================== 913/* ==================================================================
886 * nxt200x based ATSC cards, helper functions 914 * nxt200x based ATSC cards, helper functions
887 */ 915 */
@@ -1003,11 +1031,11 @@ static int dvb_init(struct saa7134_dev *dev)
1003 if (dev->dvb.frontend) { 1031 if (dev->dvb.frontend) {
1004 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, 1032 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63,
1005 &dev->i2c_adap, 0) == NULL) { 1033 &dev->i2c_adap, 0) == NULL) {
1006 wprintk("%s: Lifeview Trio, No tda826x found!\n", __FUNCTION__); 1034 wprintk("%s: Lifeview Trio, No tda826x found!\n", __func__);
1007 } 1035 }
1008 if (dvb_attach(isl6421_attach, dev->dvb.frontend, &dev->i2c_adap, 1036 if (dvb_attach(isl6421_attach, dev->dvb.frontend, &dev->i2c_adap,
1009 0x08, 0, 0) == NULL) { 1037 0x08, 0, 0) == NULL) {
1010 wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __FUNCTION__); 1038 wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __func__);
1011 } 1039 }
1012 } 1040 }
1013 } 1041 }
@@ -1036,27 +1064,35 @@ static int dvb_init(struct saa7134_dev *dev)
1036 dev->dvb.frontend = dvb_attach(tda10086_attach, 1064 dev->dvb.frontend = dvb_attach(tda10086_attach,
1037 &flydvbs, &dev->i2c_adap); 1065 &flydvbs, &dev->i2c_adap);
1038 if (dev->dvb.frontend) { 1066 if (dev->dvb.frontend) {
1039 struct dvb_frontend *fe; 1067 struct dvb_frontend *fe = dev->dvb.frontend;
1068 u8 dev_id = dev->eedata[2];
1069 u8 data = 0xc4;
1070 struct i2c_msg msg = {.addr = 0x08, .flags = 0, .len = 1};
1071
1040 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 1072 if (dvb_attach(tda826x_attach, dev->dvb.frontend,
1041 0x60, &dev->i2c_adap, 0) == NULL) 1073 0x60, &dev->i2c_adap, 0) == NULL)
1042 wprintk("%s: Medion Quadro, no tda826x " 1074 wprintk("%s: Medion Quadro, no tda826x "
1043 "found !\n", __FUNCTION__); 1075 "found !\n", __func__);
1044 /* Note 10.2. Hac 1076 if (dev_id != 0x08) {
1045 * up to here. configuration for ctx948 and and one branch 1077 /* we need to open the i2c gate (we know it exists) */
1046 * of md8800 should be identical 1078 fe->ops.i2c_gate_ctrl(fe, 1);
1047 */ 1079 if (dvb_attach(isl6405_attach, fe,
1048 /* we need to open the i2c gate (we know it exists) */ 1080 &dev->i2c_adap, 0x08, 0, 0) == NULL)
1049 fe = dev->dvb.frontend; 1081 wprintk("%s: Medion Quadro, no ISL6405 "
1050 fe->ops.i2c_gate_ctrl(fe, 1); 1082 "found !\n", __func__);
1051 if (dvb_attach(isl6405_attach, fe, 1083 /* fire up the 2nd section of the LNB supply since we can't do
1052 &dev->i2c_adap, 0x08, 0, 0) == NULL) 1084 this from the other section */
1053 wprintk("%s: Medion Quadro, no ISL6405 " 1085 msg.buf = &data;
1054 "found !\n", __FUNCTION__); 1086 i2c_transfer(&dev->i2c_adap, &msg, 1);
1055 fe->ops.i2c_gate_ctrl(fe, 0); 1087 fe->ops.i2c_gate_ctrl(fe, 0);
1056 dev->original_set_voltage = fe->ops.set_voltage; 1088 dev->original_set_voltage = fe->ops.set_voltage;
1057 fe->ops.set_voltage = md8800_set_voltage; 1089 fe->ops.set_voltage = md8800_set_voltage;
1058 dev->original_set_high_voltage = fe->ops.enable_high_lnb_voltage; 1090 dev->original_set_high_voltage = fe->ops.enable_high_lnb_voltage;
1059 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage; 1091 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage;
1092 } else {
1093 fe->ops.set_voltage = md8800_set_voltage2;
1094 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage2;
1095 }
1060 } 1096 }
1061 } 1097 }
1062 break; 1098 break;
@@ -1082,11 +1118,11 @@ static int dvb_init(struct saa7134_dev *dev)
1082 if (dev->dvb.frontend) { 1118 if (dev->dvb.frontend) {
1083 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, 1119 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60,
1084 &dev->i2c_adap, 0) == NULL) { 1120 &dev->i2c_adap, 0) == NULL) {
1085 wprintk("%s: No tda826x found!\n", __FUNCTION__); 1121 wprintk("%s: No tda826x found!\n", __func__);
1086 } 1122 }
1087 if (dvb_attach(isl6421_attach, dev->dvb.frontend, 1123 if (dvb_attach(isl6421_attach, dev->dvb.frontend,
1088 &dev->i2c_adap, 0x08, 0, 0) == NULL) { 1124 &dev->i2c_adap, 0x08, 0, 0) == NULL) {
1089 wprintk("%s: No ISL6421 found!\n", __FUNCTION__); 1125 wprintk("%s: No ISL6421 found!\n", __func__);
1090 } 1126 }
1091 } 1127 }
1092 break; 1128 break;
@@ -1138,10 +1174,10 @@ static int dvb_init(struct saa7134_dev *dev)
1138 if (dev->dvb.frontend) { 1174 if (dev->dvb.frontend) {
1139 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, 1175 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60,
1140 &dev->i2c_adap, 0) == NULL) 1176 &dev->i2c_adap, 0) == NULL)
1141 wprintk("%s: No tda826x found!\n", __FUNCTION__); 1177 wprintk("%s: No tda826x found!\n", __func__);
1142 if (dvb_attach(lnbp21_attach, dev->dvb.frontend, 1178 if (dvb_attach(lnbp21_attach, dev->dvb.frontend,
1143 &dev->i2c_adap, 0, 0) == NULL) 1179 &dev->i2c_adap, 0, 0) == NULL)
1144 wprintk("%s: No lnbp21 found!\n", __FUNCTION__); 1180 wprintk("%s: No lnbp21 found!\n", __func__);
1145 } 1181 }
1146 break; 1182 break;
1147 case SAA7134_BOARD_CREATIX_CTX953: 1183 case SAA7134_BOARD_CREATIX_CTX953:
@@ -1164,14 +1200,14 @@ static int dvb_init(struct saa7134_dev *dev)
1164 if (dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, 1200 if (dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60,
1165 &dev->i2c_adap, DVB_PLL_PHILIPS_SD1878_TDA8261) == NULL) 1201 &dev->i2c_adap, DVB_PLL_PHILIPS_SD1878_TDA8261) == NULL)
1166 wprintk("%s: MD7134 DVB-S, no SD1878 " 1202 wprintk("%s: MD7134 DVB-S, no SD1878 "
1167 "found !\n", __FUNCTION__); 1203 "found !\n", __func__);
1168 /* we need to open the i2c gate (we know it exists) */ 1204 /* we need to open the i2c gate (we know it exists) */
1169 fe = dev->dvb.frontend; 1205 fe = dev->dvb.frontend;
1170 fe->ops.i2c_gate_ctrl(fe, 1); 1206 fe->ops.i2c_gate_ctrl(fe, 1);
1171 if (dvb_attach(isl6405_attach, fe, 1207 if (dvb_attach(isl6405_attach, fe,
1172 &dev->i2c_adap, 0x08, 0, 0) == NULL) 1208 &dev->i2c_adap, 0x08, 0, 0) == NULL)
1173 wprintk("%s: MD7134 DVB-S, no ISL6405 " 1209 wprintk("%s: MD7134 DVB-S, no ISL6405 "
1174 "found !\n", __FUNCTION__); 1210 "found !\n", __func__);
1175 fe->ops.i2c_gate_ctrl(fe, 0); 1211 fe->ops.i2c_gate_ctrl(fe, 0);
1176 dev->original_set_voltage = fe->ops.set_voltage; 1212 dev->original_set_voltage = fe->ops.set_voltage;
1177 fe->ops.set_voltage = md8800_set_voltage; 1213 fe->ops.set_voltage = md8800_set_voltage;
@@ -1239,8 +1275,20 @@ static int dvb_fini(struct saa7134_dev *dev)
1239 1275
1240 /* otherwise we don't detect the tuner on next insmod */ 1276 /* otherwise we don't detect the tuner on next insmod */
1241 saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &tda9887_cfg); 1277 saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &tda9887_cfg);
1278 } else if (dev->board == SAA7134_BOARD_MEDION_MD8800_QUADRO) {
1279 if ((dev->eedata[2] != 0x08) && use_frontend) {
1280 /* turn off the 2nd lnb supply */
1281 u8 data = 0x80;
1282 struct i2c_msg msg = {.addr = 0x08, .buf = &data, .flags = 0, .len = 1};
1283 struct dvb_frontend *fe;
1284 fe = dev->dvb.frontend;
1285 if (fe->ops.i2c_gate_ctrl) {
1286 fe->ops.i2c_gate_ctrl(fe, 1);
1287 i2c_transfer(&dev->i2c_adap, &msg, 1);
1288 fe->ops.i2c_gate_ctrl(fe, 0);
1289 }
1290 }
1242 } 1291 }
1243
1244 videobuf_dvb_unregister(&dev->dvb); 1292 videobuf_dvb_unregister(&dev->dvb);
1245 return 0; 1293 return 0;
1246} 1294}