Beispiel #1
0
static void cpcap_audio_configure_aud_mute(struct cpcap_audio_state *state,
        struct cpcap_audio_state *prev_state)
{
    struct cpcap_regacc reg_changes = { 0 };
    unsigned short int value1 = 0, value2 = 0;

    if (state->codec_mute != prev_state->codec_mute) {
        value1 = cpcap_audio_get_codec_output_amp_switches(
                     prev_state->codec_primary_speaker,
                     prev_state->codec_primary_balance);

        value2 = cpcap_audio_get_codec_output_amp_switches(
                     prev_state->codec_secondary_speaker,
                     prev_state->codec_primary_balance);

        reg_changes.mask = value1 | value2 | CPCAP_BIT_CDC_SW;

        if (state->codec_mute == CPCAP_AUDIO_CODEC_UNMUTE)
            reg_changes.value = reg_changes.mask;

        logged_cpcap_write(state->cpcap, CPCAP_REG_RXCOA,
                           reg_changes.value, reg_changes.mask);
    }

    if (state->stdac_mute != prev_state->stdac_mute) {
        value1 = cpcap_audio_get_stdac_output_amp_switches(
                     prev_state->stdac_primary_speaker,
                     prev_state->stdac_primary_balance);

        value2 = cpcap_audio_get_stdac_output_amp_switches(
                     prev_state->stdac_secondary_speaker,
                     prev_state->stdac_primary_balance);

        reg_changes.mask = value1 | value2 | CPCAP_BIT_ST_DAC_SW;

        if (state->stdac_mute == CPCAP_AUDIO_STDAC_UNMUTE)
            reg_changes.value = reg_changes.mask;

        logged_cpcap_write(state->cpcap, CPCAP_REG_RXSDOA,
                           reg_changes.value, reg_changes.mask);
    }

    /*hack*/
    logged_cpcap_write(state->cpcap, CPCAP_REG_RXCOA,0x1e02,0x1FFF );
}
Beispiel #2
0
static void cpcap_audio_set_output_amp_switches(struct cpcap_audio_state *state)
{
	static unsigned int 	codec_prev_settings = 0,
				stdac_prev_settings = 0,
				ext_prev_settings = 0;

	struct cpcap_regacc reg_changes;
	unsigned short int value1 = 0, value2 = 0;

	/* First set codec output amp switches */
	value1 = cpcap_audio_get_codec_output_amp_switches(state->
			codec_primary_speaker, state->codec_primary_balance);
	value2 = cpcap_audio_get_codec_output_amp_switches(state->
			codec_secondary_speaker, state->codec_primary_balance);

	reg_changes.mask = value1 | value2 | codec_prev_settings;
	reg_changes.value = value1 | value2;
	codec_prev_settings = reg_changes.value;

	logged_cpcap_write(state->cpcap, CPCAP_REG_RXCOA, reg_changes.value,
							reg_changes.mask);

	/* Second Stdac switches */
	value1 = cpcap_audio_get_stdac_output_amp_switches(state->
			stdac_primary_speaker, state->stdac_primary_balance);
	value2 = cpcap_audio_get_stdac_output_amp_switches(state->
			stdac_secondary_speaker, state->stdac_primary_balance);

	reg_changes.mask = value1 | value2 | stdac_prev_settings;
	reg_changes.value = value1 | value2;

	if ((state->stdac_primary_speaker == CPCAP_AUDIO_OUT_STEREO_HEADSET &&
		state->stdac_secondary_speaker == CPCAP_AUDIO_OUT_LOUDSPEAKER)
		|| (state->stdac_primary_speaker == CPCAP_AUDIO_OUT_LOUDSPEAKER
		&& state->stdac_secondary_speaker ==
						CPCAP_AUDIO_OUT_STEREO_HEADSET))
		reg_changes.value &= ~(CPCAP_BIT_MONO_DAC0 |
					CPCAP_BIT_MONO_DAC1);

	stdac_prev_settings = reg_changes.value;

	logged_cpcap_write(state->cpcap, CPCAP_REG_RXSDOA, reg_changes.value,
							reg_changes.mask);

	/* Last External source switches */
	value1 =
	    cpcap_audio_get_ext_output_amp_switches(state->
				ext_primary_speaker,
				state->ext_primary_balance);
	value2 =
	    cpcap_audio_get_ext_output_amp_switches(state->
				ext_secondary_speaker,
				state->ext_primary_balance);

	reg_changes.mask = value1 | value2 | ext_prev_settings;
	reg_changes.value = value1 | value2;
	ext_prev_settings = reg_changes.value;

	logged_cpcap_write(state->cpcap, CPCAP_REG_RXEPOA,
			reg_changes.value, reg_changes.mask);
}