Esempio n. 1
0
static void _audio_tx_path_enable(int reconf, uint32_t acdb_id)
{
    audio_tx_analog_enable(1);

    adie_enable();
    adie_set_path(adie, audio_tx_path_id, ADIE_PATH_TX);

    if (tx_clk_freq > 8000)
        adie_set_path_freq_plan(adie, ADIE_PATH_TX, 48000);
    else
        adie_set_path_freq_plan(adie, ADIE_PATH_TX, 8000);

    adie_proceed_to_stage(adie, ADIE_PATH_TX, ADIE_STAGE_DIGITAL_READY);
    adie_proceed_to_stage(adie, ADIE_PATH_TX, ADIE_STAGE_DIGITAL_ANALOG_READY);


    if (!reconf)
        qdsp6_devchg_notify(ac_control, ADSP_AUDIO_TX_DEVICE,
                            audio_tx_device_id);
    audio_update_acdb(audio_tx_device_id, acdb_id);
    qdsp6_standby(ac_control);
    qdsp6_start(ac_control);

    audio_tx_mute(ac_control, audio_tx_device_id, tx_mute_status);
}
Esempio n. 2
0
static void adie_rx_path_enable(uint32_t acdb_id)
{
	adie_enable();
	adie_set_path(adie, audio_rx_path_id, ADIE_PATH_RX);
	adie_set_path_freq_plan(adie, ADIE_PATH_RX, 48000);

	adie_proceed_to_stage(adie, ADIE_PATH_RX,
			ADIE_STAGE_DIGITAL_READY);
	adie_proceed_to_stage(adie, ADIE_PATH_RX,
			ADIE_STAGE_DIGITAL_ANALOG_READY);
}
Esempio n. 3
0
struct audio_client *q6audio_open_pcm(uint32_t bufsz, uint32_t rate,
                                      uint32_t channels, uint32_t flags, uint32_t acdb_id)
{
    int rc, retry = 5;
    struct audio_client *ac;

    if (q6audio_init())
        return 0;

    ac = audio_client_alloc(bufsz);
    if (!ac)
        return 0;

    ac->flags = flags;

    mutex_lock(&audio_path_lock);

    if (ac->flags & AUDIO_FLAG_WRITE) {
        audio_rx_path_refcount++;
        if (audio_rx_path_refcount == 1) {
            _audio_rx_clk_enable();
#ifdef CONFIG_MSM_QDSP6_CALLREC
            q6_rx_path_enable(0, acdb_id);
            adie_rx_path_enable(acdb_id);
#else
            audio_update_acdb(audio_rx_device_id, acdb_id);
            qdsp6_devchg_notify(ac_control, ADSP_AUDIO_RX_DEVICE, audio_rx_device_id);
            qdsp6_standby(ac_control);
            qdsp6_start(ac_control);
#endif
        }
    } else {
        /* TODO: consider concurrency with voice call */
#ifdef CONFIG_MSM_QDSP6_CALLREC
        if (audio_tx_path_refcount > 0) {
            tx_clk_freq = 8000;
        } else {
            tx_clk_freq = rate;
        }
#else
        tx_clk_freq = rate;
#endif
        audio_tx_path_refcount++;
        if (audio_tx_path_refcount == 1) {
#ifdef CONFIG_MSM_QDSP6_CALLREC
            tx_clk_freq = rate;
#endif
            _audio_tx_clk_enable();
            _audio_tx_path_enable(0, acdb_id);
        }
    }

    for (retry = 5;; retry--) {
        if (ac->flags & AUDIO_FLAG_WRITE)
            rc = audio_out_open(ac, bufsz, rate, channels);
        else
#ifdef CONFIG_MSM_QDSP6_CALLREC
            rc = audio_in_open(ac, bufsz, flags, rate, channels);
#else
            rc = audio_in_open(ac, bufsz, rate, channels);
#endif
        if (rc == 0)
            break;
        if (retry == 0)
            q6audio_dsp_not_responding();
        pr_err("q6audio: open pcm error %d, retrying\n", rc);
        msleep(1);
    }

    if (ac->flags & AUDIO_FLAG_WRITE) {
        if (audio_rx_path_refcount == 1) {
#ifndef CONFIG_MSM_QDSP6_CALLREC
            adie_enable();
            adie_set_path(adie, audio_rx_path_id, ADIE_PATH_RX);
            adie_set_path_freq_plan(adie, ADIE_PATH_RX, 48000);

            adie_proceed_to_stage(adie, ADIE_PATH_RX, ADIE_STAGE_DIGITAL_READY);
            adie_proceed_to_stage(adie, ADIE_PATH_RX, ADIE_STAGE_DIGITAL_ANALOG_READY);

#endif
            audio_rx_analog_enable(1);
        }
    }

    mutex_unlock(&audio_path_lock);

    for (retry = 5;; retry--) {
        rc = audio_command(ac, ADSP_AUDIO_IOCTL_CMD_SESSION_START);
        if (rc == 0)
            break;
        if (retry == 0)
            q6audio_dsp_not_responding();
        pr_err("q6audio: stream start error %d, retrying\n", rc);
    }

    if (!(ac->flags & AUDIO_FLAG_WRITE)) {
        ac->buf[0].used = 1;
        ac->buf[1].used = 1;
        q6audio_read(ac, &ac->buf[0]);
        q6audio_read(ac, &ac->buf[1]);
    }

    audio_prevent_sleep();
    return ac;
}