コード例 #1
0
static void audio_out_listener(u32 evt_id, union auddev_evt_data *evt_payload,
				void *private_data)
{
	struct audio *audio = private_data;
	switch (evt_id) {
	case AUDDEV_EVT_DEV_RDY:
		MM_DBG(":AUDDEV_EVT_DEV_RDY\n");
		audio->source |= (0x1 << evt_payload->routing_id);
		if (audio->running == 1 && audio->enabled == 1)
			audpp_route_stream(audio->dec_id, audio->source);
		break;
	case AUDDEV_EVT_DEV_RLS:
		MM_DBG(":AUDDEV_EVT_DEV_RLS\n");
		audio->source &= ~(0x1 << evt_payload->routing_id);
		if (audio->running == 1 && audio->enabled == 1)
			audpp_route_stream(audio->dec_id, audio->source);
		break;
	case AUDDEV_EVT_STREAM_VOL_CHG:
		audio->vol_pan.volume = evt_payload->session_vol;
		MM_DBG(":AUDDEV_EVT_STREAM_VOL_CHG, stream vol %d\n",
				audio->vol_pan.volume);
		if (audio->running)
			audpp_dsp_set_vol_pan(audio->dec_id, &audio->vol_pan,
					POPP);
		break;
	default:
		MM_ERR("ERROR:wrong event\n");
		break;
       }
}
コード例 #2
0
ファイル: audio_out.c プロジェクト: 0987363/BMW-OpenSource
void audio_commit_pending_pp_params(void *priv, unsigned id, uint16_t *msg)
{
	struct audio_copp *audio_copp = priv;

	if (AUDPP_MSG_CFG_MSG == id && msg[0] == AUDPP_MSG_ENA_DIS)
		return;

	if (!audio_copp->status)
		return;

	audpp_dsp_set_mbadrc(COMMON_OBJ_ID, audio_copp->mbadrc_enable,
						&audio_copp->mbadrc);

	audpp_dsp_set_eq(COMMON_OBJ_ID, audio_copp->eq_enable,
						&audio_copp->eq);

	audpp_dsp_set_rx_iir(COMMON_OBJ_ID, audio_copp->rx_iir_enable,
							&audio_copp->iir);
	audpp_dsp_set_vol_pan(COMMON_OBJ_ID, &audio_copp->vol_pan);

	audpp_dsp_set_qconcert_plus(COMMON_OBJ_ID,
				audio_copp->qconcert_plus_enable,
				&audio_copp->qconcert_plus);
	audio_enable_srs_trumedia(audio_copp, true);
}
コード例 #3
0
ファイル: audio_out.c プロジェクト: Adrioid83/GT-I9505
static void audio_out_listener(u32 evt_id, union auddev_evt_data *evt_payload,
				void *private_data)
{
	struct audio *audio = private_data;
	switch (evt_id) {
	case AUDDEV_EVT_DEV_RDY:
		MM_DBG(":AUDDEV_EVT_DEV_RDY\n");
		audio->source |= (0x1 << evt_payload->routing_id);
		if (audio->running == 1 && audio->enabled == 1)
			audpp_route_stream(audio->dec_id, audio->source);
		break;
	case AUDDEV_EVT_DEV_RLS:
		MM_DBG(":AUDDEV_EVT_DEV_RLS\n");
		audio->source &= ~(0x1 << evt_payload->routing_id);
		if (audio->running == 1 && audio->enabled == 1)
			audpp_route_stream(audio->dec_id, audio->source);
		break;
	case AUDDEV_EVT_STREAM_VOL_CHG:
		audio->vol_pan.volume = evt_payload->session_vol;
		MM_DBG(":AUDDEV_EVT_STREAM_VOL_CHG, stream vol %d\n",
				audio->vol_pan.volume);
		if (audio->running)
			audpp_dsp_set_vol_pan(audio->dec_id, &audio->vol_pan,
					POPP);
		break;
	case AUDDEV_EVT_VOICE_STATE_CHG:
		MM_DBG("AUDDEV_EVT_VOICE_STATE_CHG, state = %d\n",
						evt_payload->voice_state);
		audio->voice_state = evt_payload->voice_state;
		/* Voice uplink Rx case */
		if (audio->running &&
			(audio->source & AUDPP_MIXER_UPLINK_RX) &&
			(audio->voice_state == VOICE_STATE_OFFCALL)) {
			MM_DBG("Voice is terminated, Wake up write: %x %x\n",
					audio->voice_state, audio->source);
			wake_up(&audio->wait);
		}
		break;
	default:
		MM_ERR("ERROR:wrong event\n");
		break;
       }
}
コード例 #4
0
void alsa_dsp_event(void *data, unsigned id, uint16_t *msg)
{
	struct msm_audio *prtd = data;
	struct buffer *frame;
	unsigned long flag = 0;

	MM_DBG("\n");
	switch (id) {
	case AUDPP_MSG_HOST_PCM_INTF_MSG: {
		unsigned id = msg[3];
		unsigned idx = msg[4] - 1;

		MM_DBG("HOST_PCM id %d idx %d\n", id, idx);
		if (id != AUDPP_MSG_HOSTPCM_ID_ARM_RX) {
			MM_ERR("bogus id\n");
			break;
		}
		if (idx > 1) {
			MM_ERR("bogus buffer idx\n");
			break;
		}

		/* Update with actual sent buffer size */
		if (prtd->out[idx].used != BUF_INVALID_LEN)
			prtd->pcm_irq_pos += prtd->out[idx].used;

		if (prtd->pcm_irq_pos > prtd->pcm_size)
			prtd->pcm_irq_pos = prtd->pcm_count;

		if (prtd->ops->playback)
			prtd->ops->playback(prtd);

		if (prtd->mmap_flag)
			break;

		spin_lock_irqsave(&the_locks.write_dsp_lock, flag);
		if (prtd->running) {
			prtd->out[idx].used = 0;
			frame = prtd->out + prtd->out_tail;
			if (frame->used) {
				alsa_dsp_send_buffer(
					prtd, prtd->out_tail, frame->used);
				/* Reset eos_ack flag to avoid stale
				 * PCMDMAMISS been considered
				 */
				prtd->eos_ack = 0;
				prtd->out_tail ^= 1;
			} else {
				prtd->out_needed++;
			}
			wake_up(&the_locks.write_wait);
		}
		spin_unlock_irqrestore(&the_locks.write_dsp_lock, flag);
		break;
	}
	case AUDPP_MSG_PCMDMAMISSED:
		MM_INFO("PCMDMAMISSED %d\n", msg[0]);
		prtd->eos_ack++;
		MM_DBG("PCMDMAMISSED Count per Buffer %d\n", prtd->eos_ack);
		wake_up(&the_locks.eos_wait);
		break;
	case AUDPP_MSG_CFG_MSG:
		if (msg[0] == AUDPP_MSG_ENA_ENA) {
			MM_DBG("CFG_MSG ENABLE\n");
			prtd->out_needed = 0;
			prtd->running = 1;
			audpp_dsp_set_vol_pan(prtd->session_id, &prtd->vol_pan,
					POPP);
			audpp_route_stream(prtd->session_id,
				msm_snddev_route_dec(prtd->session_id));
			audio_dsp_out_enable(prtd, 1);
		} else if (msg[0] == AUDPP_MSG_ENA_DIS) {
			MM_DBG("CFG_MSG DISABLE\n");
			prtd->running = 0;
		} else {
			MM_DBG("CFG_MSG %d?\n", msg[0]);
		}
		break;
	default:
		MM_DBG("UNKNOWN (%d)\n", id);
	}
}