summaryrefslogtreecommitdiff
path: root/firmware/drivers/tuner
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2008-03-27 11:53:51 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2008-03-27 11:53:51 +0000
commitb2ec13d8f1fc44e8e7076808b57b64365714a6f3 (patch)
tree8c8e716b0ae627a60fc8aebd9e64afd8d8d4e0e3 /firmware/drivers/tuner
parentf8690231bf82cf46b26efe68d4696d1cd18d1737 (diff)
Revert "initial Meizu M6SL port"
This reverts commit b7bd17ce1715c3a8acbf74a63694c28b6075da5b. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16846 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/tuner')
-rw-r--r--firmware/drivers/tuner/tea5760uk.c135
1 files changed, 0 insertions, 135 deletions
diff --git a/firmware/drivers/tuner/tea5760uk.c b/firmware/drivers/tuner/tea5760uk.c
deleted file mode 100644
index 8ac6cb2dbc..0000000000
--- a/firmware/drivers/tuner/tea5760uk.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- * Tuner "middleware" for Philips TEA5760 chip
- *
- * Copyright (C) 2004 Jörg Hohensohn
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-#include "config.h"
-#include <stdbool.h>
-#include <string.h>
-#include <stdlib.h>
-#include "kernel.h"
-#include "tuner.h" /* tuner abstraction interface */
-#include "fmradio.h"
-#include "fmradio_i2c.h" /* physical interface driver */
-
-#define I2C_ADR 0xC0
-static unsigned char write_bytes[7] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
-static void tea5760uk_set_clear(int byte, unsigned char bits, int set)
-{
- write_bytes[byte] &= ~bits;
- if (set)
- write_bytes[byte] |= bits;
-}
-
-/* tuner abstraction layer: set something to the tuner */
-int tea5760uk_set(int setting, int value)
-{
- switch(setting)
- {
- case RADIO_SLEEP:
- /* init values */
- write_bytes[0] |= (1<<7); /* mute */
-#if CONFIG_TUNER_XTAL == 32768
- /* 32.768kHz, soft mute, stereo noise cancelling */
- write_bytes[3] |= (1<<4) | (1<<3) | (1<<1);
-#else
- /* soft mute, stereo noise cancelling */
- write_bytes[3] |= (1<<3) | (1<<1);
-#endif
- /* sleep / standby mode */
- tea5760uk_set_clear(3, (1<<6), value);
- break;
-
- case RADIO_FREQUENCY:
- {
- int n;
-#if CONFIG_TUNER_XTAL == 32768
- n = (4 * (value - 225000) + 16384) / 32768;
-#else
- n = (4 * (value - 225000)) / 50000;
-#endif
- write_bytes[6] = (write_bytes[6] & 0xC0) | (n >> 8);
- write_bytes[7] = n;
- }
- break;
-
- case RADIO_SCAN_FREQUENCY:
- tea5760uk_set(RADIO_FREQUENCY, value);
- sleep(HZ/30);
- return tea5760uk_get(RADIO_TUNED);
-
- case RADIO_MUTE:
- tea5760uk_set_clear(3, (1<<2), value);
- break;
-
- case RADIO_REGION:
- {
- const struct tea5760uk_region_data *rd =
- &tea5760uk_region_data[value];
-
- tea5760uk_set_clear(4, (1<<1), rd->deemphasis);
- tea5760uk_set_clear(3, (1<<5), rd->band);
- break;
- }
- case RADIO_FORCE_MONO:
- tea5760uk_set_clear(4, (1<<3), value);
- break;
- default:
- return -1;
- }
-
- fmradio_i2c_write(I2C_ADR, write_bytes, sizeof(write_bytes));
- return 1;
-}
-
-/* tuner abstraction layer: read something from the tuner */
-int tea5760uk_get(int setting)
-{
- unsigned char read_bytes[16];
- int val = -1; /* default for unsupported query */
-
- fmradio_i2c_read(I2C_ADR, read_bytes, sizeof(read_bytes));
-
- switch(setting)
- {
- case RADIO_PRESENT:
- val = 1; /* true */
- break;
-
- case RADIO_TUNED:
- val = 0;
- if (read_bytes[0] & (1<<4)) /* IF count correct */
- {
- val = read_bytes[8] >> 1; /* IF counter */
- val = (abs(val - 0x36) < 2); /* close match */
- }
- break;
-
- case RADIO_STEREO:
- val = read_bytes[9] >> 2;
- break;
- }
-
- return val;
-}
-
-void tea5760uk_dbg_info(struct tea5760uk_dbg_info *info)
-{
- fmradio_i2c_read(I2C_ADR, info->read_regs, 5);
- memcpy(info->write_regs, write_bytes, 5);
-}