-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 320038 b: refs/heads/master c: 4ecbb69 h: refs/heads/master v: v3
- Loading branch information
Ondrej Zary
authored and
Mauro Carvalho Chehab
committed
Jun 21, 2012
1 parent
e484b2b
commit c40d549
Showing
5 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 61bdbef063d2300f706133e677c61a1bec097ff8 | ||
refs/heads/master: 4ecbb69414c61af3594209e081d6e834ea68a16d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* Sanyo LM7000 tuner chip driver | ||
* | ||
* Copyright 2012 Ondrej Zary <linux@rainbow-software.org> | ||
* based on radio-aimslab.c by M. Kirkwood | ||
* and radio-sf16fmi.c by M. Kirkwood and Petr Vandrovec | ||
*/ | ||
|
||
#include <linux/delay.h> | ||
#include <linux/module.h> | ||
#include "lm7000.h" | ||
|
||
MODULE_AUTHOR("Ondrej Zary <linux@rainbow-software.org>"); | ||
MODULE_DESCRIPTION("Routines for Sanyo LM7000 AM/FM radio tuner chip"); | ||
MODULE_LICENSE("GPL"); | ||
|
||
/* write the 24-bit register, starting with LSB */ | ||
static void lm7000_write(struct lm7000 *lm, u32 val) | ||
{ | ||
int i; | ||
u8 data; | ||
|
||
for (i = 0; i < 24; i++) { | ||
data = val & (1 << i) ? LM7000_DATA : 0; | ||
lm->set_pins(lm, data | LM7000_CE); | ||
udelay(2); | ||
lm->set_pins(lm, data | LM7000_CE | LM7000_CLK); | ||
udelay(2); | ||
lm->set_pins(lm, data | LM7000_CE); | ||
udelay(2); | ||
} | ||
lm->set_pins(lm, 0); | ||
} | ||
|
||
void lm7000_set_freq(struct lm7000 *lm, u32 freq) | ||
{ | ||
freq += 171200; /* Add 10.7 MHz IF */ | ||
freq /= 400; /* Convert to 25 kHz units */ | ||
lm7000_write(lm, freq | LM7000_FM_25 | LM7000_BIT_FM); | ||
} | ||
EXPORT_SYMBOL(lm7000_set_freq); | ||
|
||
static int __init lm7000_module_init(void) | ||
{ | ||
return 0; | ||
} | ||
|
||
static void __exit lm7000_module_exit(void) | ||
{ | ||
} | ||
|
||
module_init(lm7000_module_init) | ||
module_exit(lm7000_module_exit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef __LM7000_H | ||
#define __LM7000_H | ||
|
||
#define LM7000_DATA (1 << 0) | ||
#define LM7000_CLK (1 << 1) | ||
#define LM7000_CE (1 << 2) | ||
|
||
#define LM7000_FREQ_MASK 0x3fff | ||
#define LM7000_BIT_T0 (1 << 14) | ||
#define LM7000_BIT_T1 (1 << 15) | ||
#define LM7000_BIT_B0 (1 << 16) | ||
#define LM7000_BIT_B1 (1 << 17) | ||
#define LM7000_BIT_B2 (1 << 18) | ||
#define LM7000_BIT_TB (1 << 19) | ||
#define LM7000_FM_100 (0 << 20) | ||
#define LM7000_FM_50 (1 << 20) | ||
#define LM7000_FM_25 (2 << 20) | ||
#define LM7000_AM_5 (3 << 20) | ||
#define LM7000_AM_10 (4 << 20) | ||
#define LM7000_AM_9 (5 << 20) | ||
#define LM7000_AM_1 (6 << 20) | ||
#define LM7000_AM_5_ (7 << 20) | ||
#define LM7000_BIT_FM (1 << 23) | ||
|
||
|
||
struct lm7000 { | ||
void (*set_pins)(struct lm7000 *lm, u8 pins); | ||
}; | ||
|
||
void lm7000_set_freq(struct lm7000 *lm, u32 freq); | ||
|
||
#endif /* __LM7000_H */ |