Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: dvb-kernel stv0299b / alps_bsrv2 SEC_VOLTAGE_OFF



On Saturday 08 February 2003 11:13 am, Matt Davis wrote:
> I am submitting this patch because we find it benificial in some
> environments. It explicitely turns off the LNB voltage for the stv0299 and
> alps_bsrv2 frontends.  There are a couple of advantages to this feature. 
> It allows the connection of multiple cards to one LNB without frying cards
> (if you don't have a switch).  It also allows you to turn off the receiver
> card without shutting down the entire machine if you are changing cables
> (and trying to reduce the chances of shorting various devices).


Oops... forgot to attach the patch!  Here it is.

Matt
diff -rpu dvb-kernel/linux/drivers/media/dvb/frontends/alps_bsrv2.c dvb-kernel.no_voltage/linux/drivers/media/dvb/frontends/alps_bsrv2.c
--- dvb-kernel/linux/drivers/media/dvb/frontends/alps_bsrv2.c	Thu Jan  2 05:57:23 2003
+++ dvb-kernel.no_voltage/linux/drivers/media/dvb/frontends/alps_bsrv2.c	Fri Feb  7 15:45:49 2003
@@ -289,14 +289,19 @@ int ves1893_set_symbolrate (struct dvb_i
 static
 int ves1893_set_voltage (struct dvb_i2c_bus *i2c, fe_sec_voltage_t voltage)
 {
-	switch (voltage) {
-	case SEC_VOLTAGE_13:
-		return ves1893_writereg (i2c, 0x1f, 0x20);
-	case SEC_VOLTAGE_18:
-		return ves1893_writereg (i2c, 0x1f, 0x30);
-	default:
-		return -EINVAL;
-	}
+        if (voltage != SEC_VOLTAGE_OFF) {
+	        switch (voltage) {
+		case SEC_VOLTAGE_13:
+		        return ves1893_writereg (i2c, 0x1f, 0x20);
+		case SEC_VOLTAGE_18:
+		        return ves1893_writereg (i2c, 0x1f, 0x30);
+		default:
+		        return -EINVAL;
+		}
+
+	} else
+	        return ves1893_writereg (i2c, 0x1f, 0x10);
+
 }
 
 
diff -rpu dvb-kernel/linux/drivers/media/dvb/frontends/stv0299.c dvb-kernel.no_voltage/linux/drivers/media/dvb/frontends/stv0299.c
--- dvb-kernel/linux/drivers/media/dvb/frontends/stv0299.c	Mon Feb  3 15:15:32 2003
+++ dvb-kernel.no_voltage/linux/drivers/media/dvb/frontends/stv0299.c	Fri Feb  7 15:44:13 2003
@@ -555,16 +555,20 @@ int stv0299_set_voltage (struct dvb_i2c_
 
 	val = stv0299_readreg (i2c, 0x0c);
 	val &= 0x0f;
-	val |= 0x40;   /* LNB power on */
 
-	switch (voltage) {
-	case SEC_VOLTAGE_13:
-		return stv0299_writereg (i2c, 0x0c, val);
-	case SEC_VOLTAGE_18:
-		return stv0299_writereg (i2c, 0x0c, val | 0x10);
-	default:
-		return -EINVAL;
-	};
+	if (voltage != SEC_VOLTAGE_OFF) {
+	        val |= 0x40;   /* LNB power on */
+		switch (voltage) {
+		case SEC_VOLTAGE_13:
+		        return stv0299_writereg (i2c, 0x0c, val);
+		case SEC_VOLTAGE_18:
+		        return stv0299_writereg (i2c, 0x0c, val | 0x10);
+		default:
+		        return -EINVAL;
+		}
+	} else
+	        return stv0299_writereg (i2c, 0x0c, val);
+
 }
 
 
diff -rpu dvb-kernel/linux/include/linux/dvb/frontend.h dvb-kernel.no_voltage/linux/include/linux/dvb/frontend.h
--- dvb-kernel/linux/include/linux/dvb/frontend.h	Mon Nov 18 22:02:17 2002
+++ dvb-kernel.no_voltage/linux/include/linux/dvb/frontend.h	Fri Feb  7 14:32:11 2003
@@ -102,7 +102,8 @@ struct dvb_diseqc_slave_reply {
 
 typedef enum {
         SEC_VOLTAGE_13,
-        SEC_VOLTAGE_18
+        SEC_VOLTAGE_18,
+	SEC_VOLTAGE_OFF         /* should probably be first enum value */
 } fe_sec_voltage_t;
 
 

Home | Main Index | Thread Index