summary refs log tree commit diff
path: root/drivers/media
diff options
context:
space:
mode:
authorVadim Catana <skystar@moldova.cc>2006-01-09 15:25:08 -0200
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 15:25:08 -0200
commit1c956a3ac087b7590296f5a0be2cdab2666158cd (patch)
tree6816932312c50640beec0ab807a26dd04fbc2845 /drivers/media
parente3b152bc9ee2b7f841565dc93a042f527cf3116c (diff)
downloadlinux-1c956a3ac087b7590296f5a0be2cdab2666158cd.tar.gz
DVB (2451): Add support for KWorld DVB-S 100, based on the same chips as Hauppauge
- Add support for KWorld DVB-S 100, based on the same chips as Hauppauge
Nova-S Plus (CX23883/CX24123/CX24109), without the Intersil ISL6421,
which is used for LNB control.
- LNB voltage and tone are controled by LNBDC and LNBTone bits from
register 0x29 of the CX24123 demodulator.
- The MO_GP0_IO register from CX23883 is used to turn LNB power on and off.

Signed-off-by: Vadim Catana <skystar@moldova.cc>
Acked-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/cx24123.c98
-rw-r--r--drivers/media/dvb/frontends/cx24123.h9
2 files changed, 86 insertions, 21 deletions
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c
index cfb7d2edd5a9..3e230fc59cac 100644
--- a/drivers/media/dvb/frontends/cx24123.c
+++ b/drivers/media/dvb/frontends/cx24123.c
@@ -3,6 +3,8 @@
 
     Copyright (C) 2005 Steven Toth <stoth@hauppauge.com>
 
+    Support for KWorld DVB-S 100 by Vadim Catana <skystar@moldova.cc>
+
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
@@ -573,7 +575,8 @@ static int cx24123_initfe(struct dvb_frontend* fe)
 		state->config->pll_init(fe);
 
 	/* Configure the LNB for 14V */
-	cx24123_writelnbreg(state, 0x0, 0x2a);
+	if (state->config->use_isl6421)
+		cx24123_writelnbreg(state, 0x0, 0x2a);
 
 	return 0;
 }
@@ -583,18 +586,49 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage
 	struct cx24123_state *state = fe->demodulator_priv;
 	u8 val;
 
-	val = cx24123_readlnbreg(state, 0x0);
+	switch (state->config->use_isl6421) {
 
-	switch (voltage) {
-	case SEC_VOLTAGE_13:
-		return cx24123_writelnbreg(state, 0x0, val & 0x32); /* V 13v */
-	case SEC_VOLTAGE_18:
-		return cx24123_writelnbreg(state, 0x0, val | 0x04); /* H 18v */
-	case SEC_VOLTAGE_OFF:
-		return cx24123_writelnbreg(state, 0x0, val & 0x30);
-	default:
-		return -EINVAL;
-	};
+	case 1:
+
+		val = cx24123_readlnbreg(state, 0x0);
+
+		switch (voltage) {
+		case SEC_VOLTAGE_13:
+			return cx24123_writelnbreg(state, 0x0, val & 0x32); /* V 13v */
+		case SEC_VOLTAGE_18:
+			return cx24123_writelnbreg(state, 0x0, val | 0x04); /* H 18v */
+		case SEC_VOLTAGE_OFF:
+			return cx24123_writelnbreg(state, 0x0, val & 0x30);
+		default:
+			return -EINVAL;
+		};
+
+	case 0:
+
+		val = cx24123_readreg(state, 0x29);
+
+		switch (voltage) {
+		case SEC_VOLTAGE_13:
+			dprintk("%s: setting voltage 13V\n", __FUNCTION__);
+			if (state->config->enable_lnb_voltage)
+				state->config->enable_lnb_voltage(fe, 1);
+			return cx24123_writereg(state, 0x29, val | 0x80);
+		case SEC_VOLTAGE_18:
+			dprintk("%s: setting voltage 18V\n", __FUNCTION__);
+			if (state->config->enable_lnb_voltage)
+				state->config->enable_lnb_voltage(fe, 1);
+			return cx24123_writereg(state, 0x29, val & 0x7f);
+		case SEC_VOLTAGE_OFF:
+			dprintk("%s: setting voltage off\n", __FUNCTION__);
+			if (state->config->enable_lnb_voltage)
+				state->config->enable_lnb_voltage(fe, 0);
+			return 0;
+		default:
+			return -EINVAL;
+		};
+	}
+
+	return 0;
 }
 
 static int cx24123_send_diseqc_msg(struct dvb_frontend* fe,
@@ -729,17 +763,39 @@ static int cx24123_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
 	struct cx24123_state *state = fe->demodulator_priv;
 	u8 val;
 
-	val = cx24123_readlnbreg(state, 0x0);
+	switch (state->config->use_isl6421) {
+	case 1:
+
+		val = cx24123_readlnbreg(state, 0x0);
 
-	switch (tone) {
-	case SEC_TONE_ON:
-		return cx24123_writelnbreg(state, 0x0, val | 0x10);
-	case SEC_TONE_OFF:
-		return cx24123_writelnbreg(state, 0x0, val & 0x2f);
-	default:
-		printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone);
-		return -EINVAL;
+		switch (tone) {
+		case SEC_TONE_ON:
+			return cx24123_writelnbreg(state, 0x0, val | 0x10);
+		case SEC_TONE_OFF:
+			return cx24123_writelnbreg(state, 0x0, val & 0x2f);
+		default:
+			printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone);
+			return -EINVAL;
+		}
+
+	case 0:
+
+		val = cx24123_readreg(state, 0x29);
+
+		switch (tone) {
+		case SEC_TONE_ON:
+			dprintk("%s: setting tone on\n", __FUNCTION__);
+			return cx24123_writereg(state, 0x29, val | 0x10);
+		case SEC_TONE_OFF:
+			dprintk("%s: setting tone off\n",__FUNCTION__);
+			return cx24123_writereg(state, 0x29, val & 0xef);
+		default:
+			printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone);
+			return -EINVAL;
+		}
 	}
+
+	return 0;
 }
 
 static void cx24123_release(struct dvb_frontend* fe)
diff --git a/drivers/media/dvb/frontends/cx24123.h b/drivers/media/dvb/frontends/cx24123.h
index a6b85d517578..0c922b5e9263 100644
--- a/drivers/media/dvb/frontends/cx24123.h
+++ b/drivers/media/dvb/frontends/cx24123.h
@@ -28,12 +28,21 @@ struct cx24123_config
 	/* the demodulator's i2c address */
 	u8 demod_address;
 
+	/*
+	   cards like Hauppauge Nova-S Plus/Nova-SE2 use an Intersil ISL6421 chip
+	   for LNB control, while KWorld DVB-S 100 use the LNBDC and LNBTone bits
+	   from register 0x29 of the CX24123 demodulator
+	*/
+	int use_isl6421;
+
 	/* PLL maintenance */
 	int (*pll_init)(struct dvb_frontend* fe);
 	int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
 
 	/* Need to set device param for start_dma */
 	int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
+
+	void (*enable_lnb_voltage)(struct dvb_frontend* fe, int on);
 };
 
 extern struct dvb_frontend* cx24123_attach(const struct cx24123_config* config,