diff options
author | Bertrik Sikken <bertrik@sikken.nl> | 2011-06-04 20:18:10 +0000 |
---|---|---|
committer | Bertrik Sikken <bertrik@sikken.nl> | 2011-06-04 20:18:10 +0000 |
commit | 1c22bbb1c2b49633ea04c2ccb9afd5e2efc2357b (patch) | |
tree | 738bd3184424248bdcc51329108ca83f18fb4370 | |
parent | 92afc96cc8940be30d257a7a2bafb45271137dc7 (diff) |
FS#12094 - RDA5802 tuner: clean up register 0x4 handling, drop implicitly enabled soft-mute by Stephan Grossklass and me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29959 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/drivers/tuner/rda5802.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/firmware/drivers/tuner/rda5802.c b/firmware/drivers/tuner/rda5802.c index 27166c5e43..f0f449cdf5 100644 --- a/firmware/drivers/tuner/rda5802.c +++ b/firmware/drivers/tuner/rda5802.c @@ -44,7 +44,9 @@ #define SYSCONFIG1 0x4 #define SYSCONFIG2 0x5 #define SYSCONFIG3 0x6 - +#define SYSCONFIG4 0x7 /* undocumented */ +#define SYSCONFIG5 0x8 /* undocumented */ +#define SYSCONFIG6 0x9 /* undocumented */ #define READCHAN 0xA #define STATUSRSSI 0xB #define IDENT 0xC @@ -76,7 +78,7 @@ /* SYSCONFIG1 (0x4) */ #define SYSCONFIG1_DE (0x1 << 11) - #define SYSCONFIG1_SMUTE (0x1 << 9) + #define SYSCONFIG1_SOFTMUTE_EN (0x1 << 9) /* SYSCONFIG2 (0x5) */ #define SYSCONFIG2_VOLUME (0xF << 0) @@ -92,21 +94,25 @@ #define STATUSRSSI_RSSIr(x) (((x) & STATUSRSSI_RSSI) >> 9) #define STATUSRSSI_FM_TRUE (0x1 << 8) -static const uint16_t initvals[16] = { - 0x0000, 0x0000, 0xC401, 0x1B80, - 0x0400, 0x866F, 0x8000, 0x4712, - 0x5EC6, 0x0000, 0x406E, 0x2D80, - 0x5803, 0x5804, 0x5804, 0x5804 -}; - static bool tuner_present = false; -static uint16_t cache[16]; + +static uint16_t cache[16] = { + [POWERCFG] = 0xC401, /* DHIZ, DMUTE, CLK_DIRECT_MODE, ENABLE */ + [CHANNEL] = 0x0000, /* - */ + [SYSCONFIG1] = 0x0200, /* SYSCONFIG1_SOFTMUTE_EN */ + [SYSCONFIG2] = 0x867F, /* INT_MODE (def), SEEKTH=1100b, LNA_PORT_SEL=LNAN, + LNA_ICSEL=3.0mA, VOLUME=max */ + [SYSCONFIG3] = 0x8000, /* I2S slave mode */ + [SYSCONFIG4] = 0x4712, /* undocumented, affects stereo blend */ + [SYSCONFIG5] = 0x5EC6, /* undocumented */ + [SYSCONFIG6] = 0x0000 /* undocumented */ +}; /* reads <len> registers from radio at offset 0x0A into cache */ static void rda5802_read(int len) { int i; - unsigned char buf[128]; + unsigned char buf[sizeof(cache)]; unsigned char *ptr = buf; uint16_t data; @@ -122,7 +128,7 @@ static void rda5802_read(int len) static void rda5802_write(int len) { int i; - unsigned char buf[64]; + unsigned char buf[sizeof(cache)]; unsigned char *ptr = buf; uint16_t data; @@ -186,14 +192,14 @@ void rda5802_init(void) if (rda5802_detect()) { tuner_present = true; - // soft-reset - rda5802_write_reg(POWERCFG, POWERCFG_SOFT_RESET); + /* soft-reset */ + rda5802_write_set(POWERCFG, POWERCFG_SOFT_RESET); rda5802_write(1); + rda5802_write_clear(POWERCFG, POWERCFG_SOFT_RESET); sleep(HZ * 10 / 1000); - // write initialisation values - memcpy(cache, initvals, sizeof(cache)); - rda5802_write(14); + /* write initialisation values */ + rda5802_write(8); sleep(HZ * 70 / 1000); } } @@ -284,8 +290,6 @@ int rda5802_set(int setting, int value) case RADIO_MUTE: rda5802_write_masked(POWERCFG, value ? 0 : POWERCFG_DMUTE, POWERCFG_DMUTE); - rda5802_write_masked(SYSCONFIG1, (3 << 9), (3 << 9)); - rda5802_write_set(SYSCONFIG2, SYSCONFIG2_VOLUME); rda5802_write_cache(); break; |