mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-11 06:05:21 -05:00
Avoid radio interference from the MAS internal clock on devices with the Samsung tuner (FM recorder, old Ondio FM) by slightly shifting it away when necessary.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6531 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
8ca1831a5e
commit
7a977b833f
3 changed files with 44 additions and 0 deletions
|
|
@ -50,6 +50,9 @@ void mpeg_set_recording_options(int frequency, int quality,
|
||||||
int source, int channel_mode,
|
int source, int channel_mode,
|
||||||
bool editable, int prerecord_time);
|
bool editable, int prerecord_time);
|
||||||
void mpeg_set_recording_gain(int left, int right, bool use_mic);
|
void mpeg_set_recording_gain(int left, int right, bool use_mic);
|
||||||
|
#if CONFIG_TUNER & S1A0903X01
|
||||||
|
int mpeg_get_mas_pllfreq(void);
|
||||||
|
#endif
|
||||||
unsigned long mpeg_recorded_time(void);
|
unsigned long mpeg_recorded_time(void);
|
||||||
unsigned long mpeg_num_recorded_bytes(void);
|
unsigned long mpeg_num_recorded_bytes(void);
|
||||||
void mpeg_pause_recording(void);
|
void mpeg_pause_recording(void);
|
||||||
|
|
|
||||||
|
|
@ -2382,6 +2382,22 @@ void mpeg_set_recording_gain(int left, int right, bool use_mic)
|
||||||
mas_codec_writereg(0x0, shadow_codec_reg0);
|
mas_codec_writereg(0x0, shadow_codec_reg0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_TUNER & S1A0903X01
|
||||||
|
/* Get the (unpitched) MAS PLL frequency, for avoiding FM interference with the
|
||||||
|
* Samsung tuner. Zero means unknown. Currently handles recording from analog
|
||||||
|
* input only. */
|
||||||
|
int mpeg_get_mas_pllfreq(void)
|
||||||
|
{
|
||||||
|
if (mpeg_mode != MPEG_ENCODER)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (rec_frequency_index == 0) /* 44.1 kHz / 22.05 kHz */
|
||||||
|
return 22579000;
|
||||||
|
else
|
||||||
|
return 24576000;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* try to make some kind of beep, also in recording mode */
|
/* try to make some kind of beep, also in recording mode */
|
||||||
void audio_beep(int duration)
|
void audio_beep(int duration)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,11 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "config.h"
|
||||||
#include "tuner.h" /* tuner abstraction interface */
|
#include "tuner.h" /* tuner abstraction interface */
|
||||||
#include "fmradio.h" /* physical interface driver */
|
#include "fmradio.h" /* physical interface driver */
|
||||||
|
#include "mpeg.h"
|
||||||
|
#include "sound.h"
|
||||||
|
|
||||||
#define DEFAULT_IN1 0x100003 /* Mute */
|
#define DEFAULT_IN1 0x100003 /* Mute */
|
||||||
#define DEFAULT_IN2 0x140884 /* 5kHz, 7.2MHz crystal */
|
#define DEFAULT_IN2 0x140884 /* 5kHz, 7.2MHz crystal */
|
||||||
|
|
@ -49,6 +52,28 @@ void samsung_set(int setting, int value)
|
||||||
case RADIO_FREQUENCY:
|
case RADIO_FREQUENCY:
|
||||||
{
|
{
|
||||||
int pll_cnt;
|
int pll_cnt;
|
||||||
|
#if CONFIG_HWCODEC == MAS3587F
|
||||||
|
/* Shift the MAS internal clock away for certain frequencies to
|
||||||
|
* avoid interference. */
|
||||||
|
int pitch = 1000;
|
||||||
|
|
||||||
|
/* 4th harmonic falls in the FM frequency range */
|
||||||
|
int if_freq = 4 * mpeg_get_mas_pllfreq();
|
||||||
|
|
||||||
|
/* shift the mas harmonic >= 300 kHz away using the direction
|
||||||
|
* which needs less shifting. */
|
||||||
|
if (value < if_freq)
|
||||||
|
{
|
||||||
|
if (if_freq - value < 300000)
|
||||||
|
pitch = 1003 - (if_freq - value) / 100000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (value - if_freq < 300000)
|
||||||
|
pitch = 997 + (value - if_freq) / 100000;
|
||||||
|
}
|
||||||
|
sound_set_pitch(pitch);
|
||||||
|
#endif
|
||||||
/* We add the standard Intermediate Frequency 10.7MHz
|
/* We add the standard Intermediate Frequency 10.7MHz
|
||||||
** before calculating the divisor
|
** before calculating the divisor
|
||||||
** The reference frequency is set to 50kHz, and the VCO
|
** The reference frequency is set to 50kHz, and the VCO
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue