V4L/DVB (7575): mt312: add attach-time setting to invert lnb-voltage
authorMatthias Schwarzott <zzam@gentoo.org>
Sat, 12 Apr 2008 18:04:50 +0000 (15:04 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:09:40 +0000 (14:09 -0300)
Add a setting to config struct for inversion of lnb-voltage.
Needed for support of Avermedia A700 cards.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/frontends/mt312.c
drivers/media/dvb/frontends/mt312.h

index e17a36180f9c2160f1f077eefc0eef77499c961e..081ca3398c76b074012f4fa99d7f41910d30e165 100644 (file)
@@ -422,11 +422,16 @@ static int mt312_set_voltage(struct dvb_frontend *fe, const fe_sec_voltage_t v)
 {
        struct mt312_state *state = fe->demodulator_priv;
        const u8 volt_tab[3] = { 0x00, 0x40, 0x00 };
+       u8 val;
 
        if (v > SEC_VOLTAGE_OFF)
                return -EINVAL;
 
-       return mt312_writereg(state, DISEQC_MODE, volt_tab[v]);
+       val = volt_tab[v];
+       if (state->config->voltage_inverted)
+               val ^= 0x40;
+
+       return mt312_writereg(state, DISEQC_MODE, val);
 }
 
 static int mt312_read_status(struct dvb_frontend *fe, fe_status_t *s)
index afe24fd822bd6123516e7ec956d8af7043011f8b..96338f0c4dd47268d60727b9a35b251d62b469ad 100644 (file)
@@ -31,6 +31,9 @@
 struct mt312_config {
        /* the demodulator's i2c address */
        u8 demod_address;
+
+       /* inverted voltage setting */
+       int voltage_inverted:1;
 };
 
 #if defined(CONFIG_DVB_MT312) || (defined(CONFIG_DVB_MT312_MODULE) && defined(MODULE))