aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Endriss <o.endriss@gmx.de>2009-12-13 06:58:38 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-16 06:27:42 -0500
commit9efc1bdd25d9cd95362416674d8165b89f12b79f (patch)
treea617fb70d47f4b29ffeb1972df6baf766e6229dd
parente6641c80b042461fb8d4a231a95fafdba167c28d (diff)
V4L/DVB (13673): 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> Acked-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/dvb/frontends/lnbp21.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/media/dvb/frontends/lnbp21.c b/drivers/media/dvb/frontends/lnbp21.c
index 71f607fe8fc7..b181bf023ada 100644
--- a/drivers/media/dvb/frontends/lnbp21.c
+++ b/drivers/media/dvb/frontends/lnbp21.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * lnbp21.c - driver for lnb supply and control ic lnbp21 2 * lnbp21.c - driver for lnb supply and control ic lnbp21
3 * 3 *
4 * Copyright (C) 2006 Oliver Endriss 4 * Copyright (C) 2006, 2009 Oliver Endriss <o.endriss@gmx.de>
5 * Copyright (C) 2009 Igor M. Liplianin <liplianin@netup.ru> 5 * Copyright (C) 2009 Igor M. Liplianin <liplianin@netup.ru>
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * 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)
91 return (i2c_transfer(lnbp21->i2c, &msg, 1) == 1) ? 0 : -EIO; 91 return (i2c_transfer(lnbp21->i2c, &msg, 1) == 1) ? 0 : -EIO;
92} 92}
93 93
94static int lnbp21_set_tone(struct dvb_frontend *fe,
95 fe_sec_tone_mode_t tone)
96{
97 struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->sec_priv;
98 struct i2c_msg msg = { .addr = lnbp21->i2c_addr, .flags = 0,
99 .buf = &lnbp21->config,
100 .len = sizeof(lnbp21->config) };
101
102 switch (tone) {
103 case SEC_TONE_OFF:
104 lnbp21->config &= ~LNBP21_TEN;
105 break;
106 case SEC_TONE_ON:
107 lnbp21->config |= LNBP21_TEN;
108 break;
109 default:
110 return -EINVAL;
111 };
112
113 lnbp21->config |= lnbp21->override_or;
114 lnbp21->config &= lnbp21->override_and;
115
116 return (i2c_transfer(lnbp21->i2c, &msg, 1) == 1) ? 0 : -EIO;
117}
118
94static void lnbp21_release(struct dvb_frontend *fe) 119static void lnbp21_release(struct dvb_frontend *fe)
95{ 120{
96 /* LNBP power off */ 121 /* LNBP power off */
@@ -133,6 +158,7 @@ static struct dvb_frontend *lnbx2x_attach(struct dvb_frontend *fe,
133 /* override frontend ops */ 158 /* override frontend ops */
134 fe->ops.set_voltage = lnbp21_set_voltage; 159 fe->ops.set_voltage = lnbp21_set_voltage;
135 fe->ops.enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; 160 fe->ops.enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage;
161 fe->ops.set_tone = lnbp21_set_tone;
136 printk(KERN_INFO "LNBx2x attached on addr=%x\n", lnbp21->i2c_addr); 162 printk(KERN_INFO "LNBx2x attached on addr=%x\n", lnbp21->i2c_addr);
137 163
138 return fe; 164 return fe;