/* must be called with audio->lock held */
static int audio_enable(struct audio *audio)
{
	struct audmgr_config cfg;
	int rc;

	pr_info("audio_mp3_enable()\n");

	if (audio->enabled)
		return 0;

	audio->out_tail = 0;
	audio->out_needed = 0;

	cfg.tx_rate = RPC_AUD_DEF_SAMPLE_RATE_NONE;
	cfg.rx_rate = RPC_AUD_DEF_SAMPLE_RATE_48000;
	cfg.def_method = RPC_AUD_DEF_METHOD_PLAYBACK;
	cfg.codec = RPC_AUD_DEF_CODEC_MP3;
	cfg.snd_method = RPC_SND_METHOD_MIDI;

	audio_prevent_sleep(audio);
	audio->audmgr.cb = audio_mp3_audmgr_cb;
	rc = audmgr_enable(&audio->audmgr, &cfg);
	if (rc < 0) {
		pr_err("audio_mp3: audmgr_enable() failed\n");
		audio_allow_sleep(audio);
		return rc;
	}

	if (msm_adsp_get("AUDPLAY0TASK", &audio->audplay,
				&audplay_adsp_ops, audio)) {
		pr_err("audio_mp3: failed to get audplay0 dsp module\n");
		goto err_get_adsp;
	}

	if (msm_adsp_enable(audio->audplay)) {
		pr_err("audio_mp3: msm_adsp_enable(audplay) failed\n");
		goto err_enable_adsp;
	}

	if (audpp_enable(audio->dec_id, audio_dsp_event,
				audio_modem_event, audio)) {
		pr_err("audio_mp3: audpp_enable() failed\n");
		goto err_enable_audpp;
	}

	atomic_set(&audio->image_swap, 0);
	audio->enabled = 1;
	htc_pwrsink_audio_set(PWRSINK_AUDIO_MP3, 100);
	return 0;

err_enable_audpp:
	msm_adsp_disable(audio->audplay);
err_enable_adsp:
	msm_adsp_put(audio->audplay);
err_get_adsp:
	audmgr_disable(&audio->audmgr);
	audio_allow_sleep(audio);
	return -ENODEV;
}
Beispiel #2
0
/* must be called with audio->lock held */
static int audio_enable(struct audio *audio)
{
	struct audmgr_config cfg;
	int rc;

	MM_INFO("[CLK]\n"); /* Macro prints the file name and function */

	if (audio->enabled)
		return 0;	

	/* refuse to start if we're not ready */
	if (!audio->out[0].used || !audio->out[1].used)
		return -EIO;

	/* we start buffers 0 and 1, so buffer 0 will be the
	 * next one the dsp will want
	 */
	audio->out_tail = 0;
	audio->out_needed = 0;

	cfg.tx_rate = RPC_AUD_DEF_SAMPLE_RATE_NONE;
	cfg.rx_rate = RPC_AUD_DEF_SAMPLE_RATE_48000;
	cfg.def_method = RPC_AUD_DEF_METHOD_HOST_PCM;
	cfg.codec = RPC_AUD_DEF_CODEC_PCM;
	cfg.snd_method = RPC_SND_METHOD_MIDI;

	audio_prevent_sleep(audio);	
	rc = audmgr_enable(&audio->audmgr, &cfg);
	if (rc < 0) {
		audio_allow_sleep(audio);
		return rc;
	}

#ifdef CONFIG_CCI_SPEAKER
	/*cci.johnny_lee, for pop-noise issue */
	MM_INFO("[CLK] speaker_audmgr_enable(true)\n");
	if (speaker_audmgr_enable(true) < 0)
	{
		MM_ERR("[CLK] speaker_audmgr_enable return failed, we will retry after 600ms\n");
	}
	else
	{
		msleep(80);
	}
#endif

	if (audpp_enable(-1, audio_dsp_event, audio)) {
		MM_ERR("audpp_enable() failed\n");
		audmgr_disable(&audio->audmgr);
		audio_allow_sleep(audio);
		return -ENODEV;
	}

	audio->enabled = 1;
	htc_pwrsink_set(PWRSINK_AUDIO, 100);
	return 0;
}
Beispiel #3
0
/* must be called with audio->lock held */
static int audio_enable(struct audio *audio)
{
	struct audmgr_config cfg;
	int rc;

	MM_INFO("\n"); /* Macro prints the file name and function */

	if (audio->enabled)
		return 0;	

	/* refuse to start if we're not ready */
	if (!audio->out[0].used || !audio->out[1].used)
		return -EIO;

	/* we start buffers 0 and 1, so buffer 0 will be the
	 * next one the dsp will want
	 */
	audio->out_tail = 0;
	audio->out_needed = 0;

	cfg.tx_rate = RPC_AUD_DEF_SAMPLE_RATE_NONE;
	cfg.rx_rate = RPC_AUD_DEF_SAMPLE_RATE_48000;
	cfg.def_method = RPC_AUD_DEF_METHOD_HOST_PCM;
	cfg.codec = RPC_AUD_DEF_CODEC_PCM;
	cfg.snd_method = RPC_SND_METHOD_MIDI;

	audio_prevent_sleep(audio);	
	rc = audmgr_enable(&audio->audmgr, &cfg);
	if (rc < 0) {
		audio_allow_sleep(audio);
		return rc;
	}

#ifdef CONFIG_AMP_MAX97000
	if(!audio_enabled)
	{
		audio_enabled = 1;
		//max97000_resume();
	}
#endif
	if (audpp_enable(-1, audio_dsp_event, audio)) {
		MM_ERR("audpp_enable() failed\n");
		audmgr_disable(&audio->audmgr);
		audio_allow_sleep(audio);
		return -ENODEV;
	}

	audio->enabled = 1;
	htc_pwrsink_set(PWRSINK_AUDIO, 100);
	return 0;
}
/* must be called with audio->lock held */
static int audio_enable(struct audio *audio)
{
	pr_info("audio_enable\n");

	if (audio->enabled)
		return 0;

	/* refuse to start if we're not ready */
	if (!audio->out[0].used || !audio->out[1].used)
		return -EIO;

	/* we start buffers 0 and 1, so buffer 0 will be the
	 * next one the dsp will want
	 */
	audio->out_tail = 0;
	audio->out_needed = 0;

	audio_prevent_sleep(audio);

	if (audpp_enable(-1, audio_dsp_event, audio)) {
		MM_ERR("audpp_enable() failed\n");
		audio_allow_sleep(audio);
		return -ENODEV;
	}

	audio->enabled = 1;
	htc_pwrsink_set(PWRSINK_AUDIO, 100);
	return 0;
}
Beispiel #5
0
/* must be called with audio->lock held */
static int audio_enable(struct audio *audio)
{
	struct audmgr_config cfg;
	int rc;

	pr_info("audio_enable()\n");

	if (audio->enabled)
		return 0;	

	/* refuse to start if we're not ready */
	if (!audio->out[0].used || !audio->out[1].used)
		return -EIO;

	/* we start buffers 0 and 1, so buffer 0 will be the
	 * next one the dsp will want
	 */
	audio->out_tail = 0;
	audio->out_needed = 0;

	cfg.tx_rate = RPC_AUD_DEF_SAMPLE_RATE_NONE;
	cfg.rx_rate = RPC_AUD_DEF_SAMPLE_RATE_48000;
	cfg.def_method = RPC_AUD_DEF_METHOD_HOST_PCM;
	cfg.codec = RPC_AUD_DEF_CODEC_PCM;
	cfg.snd_method = RPC_SND_METHOD_MIDI;

	audio_prevent_sleep(audio);	
	rc = audmgr_enable(&audio->audmgr, &cfg);
	if (rc < 0) {
		audio_allow_sleep(audio);
		return rc;
	}

	if (audpp_enable(-1, audio_dsp_event, audio)) {
		pr_err("audio: audpp_enable() failed\n");
		audmgr_disable(&audio->audmgr);
		audio_allow_sleep(audio);
		return -ENODEV;
	}

	audio->enabled = 1;
	htc_pwrsink_set(PWRSINK_AUDIO, 100);
	return 0;
}
Beispiel #6
0
int q6audio_close(struct audio_client *ac)
{
    audio_close(ac);
    if (ac->flags & AUDIO_FLAG_WRITE)
        audio_rx_path_enable(0, 0);
    else
        audio_tx_path_enable(0, 0);

    audio_client_free(ac);
    audio_allow_sleep();
    return 0;
}
/* must be called with audio->lock held */
static int audio_disable(struct audio *audio)
{
	pr_info("audio_disable\n");
	if (audio->enabled) {
		audio->enabled = 0;
		audio_dsp_out_enable(audio, 0);

		audpp_disable(-1, audio);

		wake_up(&audio->wait);
		audio->out_needed = 0;
		audio_allow_sleep(audio);
	}
	return 0;
}
Beispiel #8
0
/* must be called with audio->lock held */
static int audio_disable(struct audio *audio)
{
	MM_DBG("\n"); /* Macro prints the file name and function */
	if (audio->enabled) {
		audio->enabled = 0;
		audio_dsp_out_enable(audio, 0);

		audpp_disable(-1, audio);

		wake_up(&audio->wait);
		audio->out_needed = 0;
		audio_allow_sleep(audio);
	}
	return 0;
}
static int msm8k_pcm_release(struct inode *inode, struct file *f)
{
	int rc = CAD_RES_SUCCESS;
	struct pcm *pcm = f->private_data;
	D("%s\n", __func__);

	mutex_lock(&pcm_lock);
	cad_close(pcm->cad_w_handle);
	kfree(pcm);
	audio_allow_sleep();
	pcm_opened = 0;
	mutex_unlock(&pcm_lock);

	return rc;
}
static int msm8k_pcm_open(struct inode *inode, struct file *f)
{
	struct pcm *pcm;
	struct cad_open_struct_type  cos;
	int rc;

	D("%s\n", __func__);

	mutex_lock(&pcm_lock);

	if (pcm_opened) {
		pr_err("pcm: busy\n");
		rc = -EBUSY;
		goto done;
	}

	pcm = kmalloc(sizeof(struct pcm), GFP_KERNEL);
	if (pcm == NULL) {
		pr_err("Could not allocate memory for pcm driver\n");
		return CAD_RES_FAILURE;
	}

	f->private_data = pcm;

	memset(pcm, 0, sizeof(struct pcm));
	pcm->cfg.buffer_size = 4096;
	pcm->cfg.buffer_count = 2;
	pcm->cfg.channel_count = 1;
	pcm->cfg.sample_rate = 48000;

	audio_prevent_sleep();
	cos.format = CAD_FORMAT_PCM;
	cos.op_code = CAD_OPEN_OP_WRITE;

	pcm->cad_w_handle = cad_open(&cos);

	if (pcm->cad_w_handle == 0) {
		audio_allow_sleep();
		rc = CAD_RES_FAILURE;
	} else {
		pcm_opened = 1;
		rc = CAD_RES_SUCCESS;
	}
done:
	mutex_unlock(&pcm_lock);
	return rc;
}
/* must be called with audio->lock held */
static int audio_disable(struct audio *audio)
{
	MM_DBG("\n"); /* Macro prints the file name and function */
	if (audio->enabled) {
		MM_AUD_INFO("audio_disable()\n");
		audio->enabled = 0;
		audio_dsp_out_enable(audio, 0);

		audpp_disable(-1, audio);

		audio->stopped = 1;
		wake_up(&audio->wait);
		audmgr_disable(&audio->audmgr);
		audio->out_needed = 0;
		audio_allow_sleep(audio);
		htc_pwrsink_audio_set(PWRSINK_AUDIO_PCM, 0);
	}
	return 0;
}
Beispiel #12
0
/* must be called with audio->lock held */
static int audio_disable(struct audio *audio)
{
	MM_INFO("\n"); /* Macro prints the file name and function */
	if (audio->enabled) {
		audio->enabled = 0;
		
		isAudioEn = 0;			//JRD added.
		audio_opal_spkr_pa_enable();

		audio_dsp_out_enable(audio, 0);

		audpp_disable(-1, audio);

		wake_up(&audio->wait);
		audmgr_disable(&audio->audmgr);
		audio->out_needed = 0;
		audio_allow_sleep(audio);
	}
	return 0;
}
Beispiel #13
0
/* must be called with audio->lock held */
static int audio_disable(struct audio *audio)
{
	MM_INFO("\n"); /* Macro prints the file name and function */
	if (audio->enabled) {

#ifdef CONFIG_AMP_MAX97000
		audio_enabled = 0;
		//max97000_suspend();
#endif
		audio->enabled = 0;
		audio_dsp_out_enable(audio, 0);

		audpp_disable(-1, audio);

		wake_up(&audio->wait);
		audmgr_disable(&audio->audmgr);
		audio->out_needed = 0;
		audio_allow_sleep(audio);
	}
	return 0;
}
/* must be called with audio->lock held */
static int audio_disable(struct audio *audio)
{
	if (audio->enabled) {
		pr_info("audio_mp3_disable()\n");
		audio->enabled = 0;
		auddec_dsp_config(audio, 0);
		wake_up(&audio->wait);
		audpp_disable(audio->dec_id, audio);
		msm_adsp_disable(audio->audplay);
		msm_adsp_put(audio->audplay);
		audmgr_disable(&audio->audmgr);
		atomic_set(&audio->image_swap, 0);
		audio->sent_bytes = 0;
		audio->consumed_bytes = 0;
		audio->total_consumed_bytes = 0;
		audio->out_needed = 0;
		audio->paused = 0;
		audio_allow_sleep(audio);
		htc_pwrsink_audio_set(PWRSINK_AUDIO_MP3, 0);
	}
	return 0;
}
/* must be called with audio->lock held */
static int audio_disable(struct audio *audio)
{
    MM_DBG("\n"); /* Macro prints the file name and function */
    if (audio->enabled) {
        audio->enabled = 0;
//added by john
        isAudioEn = audio->enabled;
        if(!isIncallMode) {
            audio_opal_spkr_pa_enable(false);
        }
//added by john
        audio_dsp_out_enable(audio, 0);

        audpp_disable(-1, audio);

        wake_up(&audio->wait);
        audmgr_disable(&audio->audmgr);
        audio->out_needed = 0;
        audio_allow_sleep(audio);
    }
    return 0;
}
Beispiel #16
0
/* must be called with audio->lock held */
static int audio_disable(struct audio *audio)
{
	MM_INFO("[CLK]\n"); /* Macro prints the file name and function */
	if (audio->enabled) {
		audio->enabled = 0;
#ifdef CONFIG_CCI_SPEAKER
	MM_INFO("[CLK] speaker_audmgr_enable(false)\n");
	/*cci.johnny_lee, for pop-noise issue */
	if (speaker_audmgr_enable(false) < 0)
	{
		MM_ERR("[CLK] speaker_audmgr_enable return failed, we will retry after 600ms\n");
	}
#endif
		audio_dsp_out_enable(audio, 0);

		audpp_disable(-1, audio);

		wake_up(&audio->wait);
		audmgr_disable(&audio->audmgr);
		audio->out_needed = 0;
		audio_allow_sleep(audio);
	}
	return 0;
}