Esempio n. 1
0
void audio_input_mux(int source, unsigned flags)
{
    static int last_source = AUDIO_SRC_PLAYBACK;
    static bool last_recording = false;
    bool recording = flags & SRCF_RECORDING;

    switch (source)
    {
        default:                        /* playback - no recording */
            source = AUDIO_SRC_PLAYBACK;
        case AUDIO_SRC_PLAYBACK:
            audio_channels = 2;
            if (source != last_source)
            {
                audiohw_set_monitor(false);
                audiohw_disable_recording();
            }
            break;

        case AUDIO_SRC_MIC:             /* recording only */
            audio_channels = 1;
            if (source != last_source)
            {
                audiohw_set_monitor(false);
                audiohw_enable_recording(true);  /* source mic */
            }
            break;

        case AUDIO_SRC_FMRADIO:         /* recording and playback */
            audio_channels = 2;

            if (source == last_source && recording == last_recording)
                break;

            last_recording = recording;

            if (recording)
            {
                audiohw_set_monitor(false);
                audiohw_enable_recording(false);
            }
            else
            {
                audiohw_disable_recording();
                audiohw_set_monitor(true); /* line 1 analog audio path */
            }
            break;
    } /* end switch */

    last_source = source;
} /* audio_input_mux */
Esempio n. 2
0
void audio_input_mux(int source, unsigned flags)
{
    (void)flags;
    /* Prevent pops from unneeded switching */
    static int last_source = AUDIO_SRC_PLAYBACK;

    switch (source)
    {
        default:                        /* playback - no recording */
            source = AUDIO_SRC_PLAYBACK;
        case AUDIO_SRC_PLAYBACK:
#ifdef HAVE_RECORDING
            if (source != last_source)
            {
                audiohw_set_monitor(false);
                audiohw_disable_recording();
            }
#endif
        break;
#ifdef HAVE_LINE_REC
        case AUDIO_SRC_LINEIN:          /* recording only */
            if (source != last_source)
            {
                audiohw_set_monitor(false);
                audiohw_enable_recording(false); /* source line */
            }
        break;
#endif
    } /* end switch */

    last_source = source;
} /* audio_input_mux */
Esempio n. 3
0
static void select_audio_path(void)
{
    const bool recording = input_flags & SRCF_RECORDING;
    (void) recording; // it is not always used

    switch(input_source)
    {
        default:
            /* playback and no recording */
            input_source = AUDIO_SRC_PLAYBACK;
            /* fallthrough */
        case AUDIO_SRC_PLAYBACK:
            audiohw_set_monitor(false);
#if defined(HAVE_RECORDING)
            audiohw_disable_recording();
#endif
            break;

#if defined(HAVE_RECORDING) && (INPUT_SRC_CAPS & SRC_CAP_MIC)
        /* recording only */
        case AUDIO_SRC_MIC:
            audiohw_set_monitor(false);
            audiohw_enable_recording(true);
            break;
#endif

#if (INPUT_SRC_CAPS & SRC_CAP_FMRADIO)
        /* recording and playback */
        case AUDIO_SRC_FMRADIO:
            audiohw_set_monitor(true);
#if defined(HAVE_RECORDING)
            if(recording)
                audiohw_enable_recording(false);
            else
                audiohw_disable_recording();
#endif
            break;
#endif /* (INPUT_SRC_CAPS & SRC_CAP_FMRADIO) */
    }
}
void audio_input_mux(int source, unsigned flags)
{
    (void)flags;
    /* Prevent pops from unneeded switching */
    static int last_source = AUDIO_SRC_PLAYBACK;
#ifdef HAVE_FMRADIO_REC 
    bool recording = flags & SRCF_RECORDING;
    static bool last_recording = false;
#endif

#if defined(IPOD_COLOR) || defined (IPOD_4G)
    /* The usual magic from IPL - I'm guessing this configures the headphone
       socket to be input or output. */
    if ((flags & SRCF_RECORDING) && source != AUDIO_SRC_PLAYBACK)
    {
        /* input */
        GPIO_CLEAR_BITWISE(GPIOI_OUTPUT_VAL, 0x40);
        GPIO_CLEAR_BITWISE(GPIOA_OUTPUT_VAL, 0x04);
    }
    else
    {
        /* output */
        GPIO_SET_BITWISE(GPIOI_OUTPUT_VAL, 0x40);
        GPIO_SET_BITWISE(GPIOA_OUTPUT_VAL, 0x04);
    }
#endif /* IPOD_COLOR || IPOD_4G */

    switch (source)
    {
        default:                        /* playback - no recording */
            source = AUDIO_SRC_PLAYBACK;
        case AUDIO_SRC_PLAYBACK:
#ifdef HAVE_RECORDING
            if (source != last_source)
            {
                audiohw_set_monitor(false);
                audiohw_disable_recording();
            }
#endif
        break;
#ifdef HAVE_MIC_REC
        case AUDIO_SRC_MIC:             /* recording only */
            if (source != last_source)
            {
                audiohw_set_monitor(false);
                audiohw_enable_recording(true);  /* source mic */
            }
        break;
#endif
#ifdef HAVE_LINE_REC
        case AUDIO_SRC_LINEIN:          /* recording only */
#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
            /* Switch line in source to line-in */
            GPIO_SET_BITWISE(GPIOB_OUTPUT_VAL, 0x04);
#endif
            if (source != last_source)
            {
                audiohw_set_monitor(false);
                audiohw_enable_recording(false); /* source line */
            }
        break;
#endif
#ifdef HAVE_FMRADIO_REC
        case AUDIO_SRC_FMRADIO:         /* recording and playback */
#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
            /* Switch line in source to tuner */
            GPIO_CLEAR_BITWISE(GPIOB_OUTPUT_VAL, 0x04);
            /* Set line-in vol to +12dB, which is proper for H10's */
            if (!recording)
                audiohw_set_recvol(0x1f, 0x1f, AUDIO_GAIN_LINEIN);
#else            /* Set line-in vol to 0dB*/
            if (!recording)
                audiohw_set_recvol(0x17, 0x17, AUDIO_GAIN_LINEIN);
#endif

            if (source == last_source && recording == last_recording)
                break;

            last_recording = recording;

#if CONFIG_TUNER & IPOD_REMOTE_TUNER
            /* Ipod FM tuner is in the remote connected to line-in */
                audiohw_enable_recording(false); /* source line */
                audiohw_set_monitor(true);  /* enable bypass mode */
#else
            if (recording)
            {
                audiohw_set_monitor(false);  /* disable bypass mode */
                audiohw_enable_recording(false); /* select line-in source */
            }
            else
            {
                audiohw_disable_recording();
                audiohw_set_monitor(true);  /* enable bypass mode */
            }
#endif
        break;
#endif
    } /* end switch */

    last_source = source;
} /* audio_input_mux */
Esempio n. 5
0
void audio_input_mux(int source, unsigned flags)
{
    (void)flags;
    /* Prevent pops from unneeded switching */
    static int last_source = AUDIO_SRC_PLAYBACK;

    switch (source)
    {
        default:                        /* playback - no recording */
            source = AUDIO_SRC_PLAYBACK;
        case AUDIO_SRC_PLAYBACK:
#ifdef HAVE_RECORDING
            if (source != last_source)
            {
                audiohw_set_monitor(false);
                audiohw_disable_recording();

                /* Vcodec = 1800mV (900mV + value*100mV) */
                pmu_ldo_set_voltage(3, 0x9);

                if (rec_hw_ver == 1)
                    GPIOCMD = 0xe070e;
            }
#endif
        break;

#ifdef HAVE_MIC_REC
        case AUDIO_SRC_MIC:             /* recording only */
            if (source != last_source)
            {
                if (rec_hw_ver == 1)
                    GPIOCMD = 0xe070f;

                /* Vcodec = 2400mV (900mV + value*100mV) */
                pmu_ldo_set_voltage(3, 0xf);

                audiohw_set_monitor(false);
                audiohw_enable_recording(true);  /* source mic */
            }
        break;
#endif

#ifdef HAVE_LINE_REC
        case AUDIO_SRC_LINEIN:          /* recording only */
            if (source != last_source)
            {
                if (rec_hw_ver == 1)
                    GPIOCMD = 0xe070e;

                /* Vcodec = 2400mV (900mV + value*100mV) */
                pmu_ldo_set_voltage(3, 0xf);

                audiohw_set_monitor(false);
                audiohw_enable_recording(false); /* source line */
            }
        break;
#endif
    } /* end switch */

    last_source = source;
} /* audio_input_mux */
void audio_input_mux(int source, unsigned flags)
{
    /* Prevent pops from unneeded switching */
    static int last_source = AUDIO_SRC_PLAYBACK;
#ifdef HAVE_FMRADIO_IN
    static bool last_recording = false;

    bool recording = flags & SRCF_RECORDING;
#else
    (void)flags;
#endif

    switch (source)
    {
        default:                            /* playback - no recording */
            source = AUDIO_SRC_PLAYBACK;
        case AUDIO_SRC_PLAYBACK:
            if (source != last_source)
            {
                audiohw_disable_recording();
                audiohw_set_monitor(false);
                coldfire_set_dataincontrol(0);
            }
        break;

        case AUDIO_SRC_MIC:                 /* recording only */
            if (source != last_source)
            {
                audiohw_enable_recording(true);  /* source mic */
                /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
                coldfire_set_dataincontrol((3 << 14) | (4 << 3));
            }
        break;

        case AUDIO_SRC_LINEIN:              /* recording only */
            if (source != last_source)
            {
                audiohw_enable_recording(false); /* source line */
                /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
                coldfire_set_dataincontrol((3 << 14) | (4 << 3));
            }
        break;

#ifdef HAVE_FMRADIO_IN
        case AUDIO_SRC_FMRADIO:             /* recording and playback */
            if (!recording)
                audiohw_set_recvol(23, 23, AUDIO_GAIN_LINEIN);

            /* I2S recording and analog playback */
            if (source == last_source && recording == last_recording)
                break;

            last_recording = recording;

            if (recording)
            {
                /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
                coldfire_set_dataincontrol((3 << 14) | (4 << 3));
                audiohw_enable_recording(false); /* source line */
            }
            else
            {
                audiohw_disable_recording();
                audiohw_set_monitor(true);       /* analog bypass */
                coldfire_set_dataincontrol(0);
            }
        break;
#endif /* HAVE_FMRADIO_IN */
    } /* end switch */

    /* set line multiplexer */
#ifdef IAUDIO_M3
#ifdef HAVE_FMRADIO_IN
    if (source == AUDIO_SRC_FMRADIO)
        and_l(~(1 << 25), &GPIO1_OUT);  /* FM radio */
    else
#endif
        or_l((1 << 25), &GPIO1_OUT);    /* Line In */

    or_l((1 << 25), &GPIO1_ENABLE);
    or_l((1 << 25), &GPIO1_FUNCTION);

#else /* iAudio M5, X5 */
#ifdef HAVE_FMRADIO_IN
    if (source == AUDIO_SRC_FMRADIO)
        and_l(~(1 << 29), &GPIO_OUT);   /* FM radio */
    else
#endif
        or_l((1 << 29), &GPIO_OUT);     /* Line In */

    or_l((1 << 29), &GPIO_ENABLE);
    or_l((1 << 29), &GPIO_FUNCTION);

#endif /* iAudio M5, X5 */

    last_source = source;
} /* audio_input_mux */
Esempio n. 7
0
void audio_input_mux(int source, unsigned flags)
{
    static int last_source = AUDIO_SRC_PLAYBACK;
#ifdef HAVE_RECORDING
    static bool last_recording = false;
    bool recording = flags & SRCF_RECORDING;
#else
    (void) flags;
#endif

    switch (source)
    {
        default:                        /* playback - no recording */
            source = AUDIO_SRC_PLAYBACK;
        case AUDIO_SRC_PLAYBACK:
            audio_channels = 2;
            if (source != last_source)
            {
#if defined(HAVE_RECORDING) || defined(HAVE_FMRADIO_IN)
                audiohw_set_monitor(false);
#endif
#ifdef HAVE_RECORDING
                audiohw_disable_recording();
#endif
            }
            break;

#if defined(HAVE_RECORDING) && (INPUT_SRC_CAPS & SRC_CAP_MIC)
        case AUDIO_SRC_MIC:             /* recording only */
            audio_channels = 1;
            if (source != last_source)
            {
                audiohw_set_monitor(false);
                audiohw_enable_recording(true);  /* source mic */
            }
            break;
#endif

#if (INPUT_SRC_CAPS & SRC_CAP_FMRADIO)
        case AUDIO_SRC_FMRADIO:         /* recording and playback */
            audio_channels = 2;

            if (source == last_source
#ifdef HAVE_RECORDING
                    && recording == last_recording
#endif
                )
                break;

#ifdef HAVE_RECORDING
            last_recording = recording;
            if (recording)
            {
                audiohw_set_monitor(false);
                audiohw_enable_recording(false);
            }
#endif
            else
            {
#ifdef HAVE_RECORDING
                audiohw_disable_recording();
#endif
#if defined(HAVE_RECORDING) || defined(HAVE_FMRADIO_IN)
                audiohw_set_monitor(true); /* line 1 analog audio path */
#endif

            }
            break;
#endif /* (INPUT_SRC_CAPS & SRC_CAP_FMRADIO) */
    } /* end switch */

    last_source = source;
} /* audio_input_mux */