aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio
diff options
context:
space:
mode:
authorOndrej Zary <linux@rainbow-software.org>2012-06-13 16:25:32 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-06-25 10:07:27 -0400
commit72a770c94deb158fbb1b804c7d0395623c568272 (patch)
tree8d748bbcbebe0549e39d42850f325cd4d3dd0588 /drivers/media/radio
parentf6d1b15c154d07c88829426d2c83c6321fe31cf3 (diff)
[media] radio: Add Sanyo LM7000 tuner driver
Add very simple driver for Sanyo LM7000 AM/FM tuner chip. Only FM is supported as there is no known HW with AM implemented. This will be used by radio-aimslab and radio-sf16fmi. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio')
-rw-r--r--drivers/media/radio/lm7000.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/media/radio/lm7000.h b/drivers/media/radio/lm7000.h
new file mode 100644
index 000000000000..139cd6b68824
--- /dev/null
+++ b/drivers/media/radio/lm7000.h
@@ -0,0 +1,43 @@
1#ifndef __LM7000_H
2#define __LM7000_H
3
4/* Sanyo LM7000 tuner chip control
5 *
6 * Copyright 2012 Ondrej Zary <linux@rainbow-software.org>
7 * based on radio-aimslab.c by M. Kirkwood
8 * and radio-sf16fmi.c by M. Kirkwood and Petr Vandrovec
9 */
10
11#define LM7000_DATA (1 << 0)
12#define LM7000_CLK (1 << 1)
13#define LM7000_CE (1 << 2)
14
15#define LM7000_FM_100 (0 << 20)
16#define LM7000_FM_50 (1 << 20)
17#define LM7000_FM_25 (2 << 20)
18#define LM7000_BIT_FM (1 << 23)
19
20static inline void lm7000_set_freq(u32 freq, void *handle,
21 void (*set_pins)(void *handle, u8 pins))
22{
23 int i;
24 u8 data;
25 u32 val;
26
27 freq += 171200; /* Add 10.7 MHz IF */
28 freq /= 400; /* Convert to 25 kHz units */
29 val = freq | LM7000_FM_25 | LM7000_BIT_FM;
30 /* write the 24-bit register, starting with LSB */
31 for (i = 0; i < 24; i++) {
32 data = val & (1 << i) ? LM7000_DATA : 0;
33 set_pins(handle, data | LM7000_CE);
34 udelay(2);
35 set_pins(handle, data | LM7000_CE | LM7000_CLK);
36 udelay(2);
37 set_pins(handle, data | LM7000_CE);
38 udelay(2);
39 }
40 set_pins(handle, 0);
41}
42
43#endif /* __LM7000_H */