aboutsummaryrefslogtreecommitdiffstats
path: root/src/tuner_fc0012.c
diff options
context:
space:
mode:
authorSteve Markgraf <steve@steve-m.de>2012-06-09 00:17:09 +0200
committerSteve Markgraf <steve@steve-m.de>2012-06-09 00:17:09 +0200
commite5afd9894d730dd012ad6b73e6e56cf99e6266a2 (patch)
treeacd787d7898decaaeb7faaf6660e836b87adadf3 /src/tuner_fc0012.c
parent6aec27c6d0830459e13f8781ad32a9c8345dcd5e (diff)
tuner_fc0012: add manual gain support
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Diffstat (limited to 'src/tuner_fc0012.c')
-rw-r--r--src/tuner_fc0012.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/tuner_fc0012.c b/src/tuner_fc0012.c
index c1ad73c..91ac882 100644
--- a/src/tuner_fc0012.c
+++ b/src/tuner_fc0012.c
@@ -307,6 +307,33 @@ exit:
int fc0012_set_gain(void *dev, int gain)
{
- /* TODO add gain regulation */
- return 0;
+ int ret;
+ uint8_t tmp = 0;
+
+ ret = fc0012_readreg(dev, 0x13, &tmp);
+
+ /* mask bits off */
+ tmp &= 0xe0;
+
+ switch (gain) {
+ case -99: /* -9.9 dB */
+ tmp |= 0x02;
+ break;
+ case -40: /* -4 dB */
+ break;
+ case 71:
+ tmp |= 0x08; /* 7.1 dB */
+ break;
+ case 179:
+ tmp |= 0x17; /* 17.9 dB */
+ break;
+ case 192:
+ default:
+ tmp |= 0x10; /* 19.2 dB */
+ break;
+ }
+
+ ret = fc0012_writereg(dev, 0x13, tmp);
+
+ return ret;
}