summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Endriss <o.endriss@gmx.de>2009-12-12 14:09:14 +0100
committerOliver Endriss <o.endriss@gmx.de>2009-12-12 14:09:14 +0100
commita00f99bd7db531165340b8f8d6913ba5666de92e (patch)
tree53dab14464f809ecd469a4b2ec5d47d2fa2648f0
parent37bdd4a1ba291779215c8bc8cc6be5c7a59837e3 (diff)
downloadmediapointer-dvb-s2-a00f99bd7db531165340b8f8d6913ba5666de92e.tar.gz
mediapointer-dvb-s2-a00f99bd7db531165340b8f8d6913ba5666de92e.tar.bz2
lnbp21: Implement 22 kHz tone control
Support 22 kHz tone control for lnbp21 and lnbh24. (Overrides the 'set_tone' hook of the frontend driver.) Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
-rw-r--r--linux/drivers/media/dvb/frontends/lnbp21.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/linux/drivers/media/dvb/frontends/lnbp21.c b/linux/drivers/media/dvb/frontends/lnbp21.c
index 71f607fe8..b181bf023 100644
--- a/linux/drivers/media/dvb/frontends/lnbp21.c
+++ b/linux/drivers/media/dvb/frontends/lnbp21.c
@@ -1,7 +1,7 @@
/*
* lnbp21.c - driver for lnb supply and control ic lnbp21
*
- * Copyright (C) 2006 Oliver Endriss
+ * Copyright (C) 2006, 2009 Oliver Endriss <o.endriss@gmx.de>
* Copyright (C) 2009 Igor M. Liplianin <liplianin@netup.ru>
*
* This program is free software; you can redistribute it and/or
@@ -91,6 +91,31 @@ static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
return (i2c_transfer(lnbp21->i2c, &msg, 1) == 1) ? 0 : -EIO;
}
+static int lnbp21_set_tone(struct dvb_frontend *fe,
+ fe_sec_tone_mode_t tone)
+{
+ struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->sec_priv;
+ struct i2c_msg msg = { .addr = lnbp21->i2c_addr, .flags = 0,
+ .buf = &lnbp21->config,
+ .len = sizeof(lnbp21->config) };
+
+ switch (tone) {
+ case SEC_TONE_OFF:
+ lnbp21->config &= ~LNBP21_TEN;
+ break;
+ case SEC_TONE_ON:
+ lnbp21->config |= LNBP21_TEN;
+ break;
+ default:
+ return -EINVAL;
+ };
+
+ lnbp21->config |= lnbp21->override_or;
+ lnbp21->config &= lnbp21->override_and;
+
+ return (i2c_transfer(lnbp21->i2c, &msg, 1) == 1) ? 0 : -EIO;
+}
+
static void lnbp21_release(struct dvb_frontend *fe)
{
/* LNBP power off */
@@ -133,6 +158,7 @@ static struct dvb_frontend *lnbx2x_attach(struct dvb_frontend *fe,
/* override frontend ops */
fe->ops.set_voltage = lnbp21_set_voltage;
fe->ops.enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage;
+ fe->ops.set_tone = lnbp21_set_tone;
printk(KERN_INFO "LNBx2x attached on addr=%x\n", lnbp21->i2c_addr);
return fe;