Beispiel #1
0
static int init_mixer_values(struct lola *chip)
{
	int i;

	/* all sample rate converters on */
	lola_set_src_config(chip, (1 << chip->pin[CAPT].num_pins) - 1, false);

	/* clear all mixer matrix settings */
	memset_io(chip->mixer.array, 0, sizeof(*chip->mixer.array));
	/* inform firmware about all updated matrix columns - capture part */
	for (i = 0; i < chip->mixer.dest_stream_ins; i++)
		lola_codec_write(chip, chip->mixer.nid,
				 LOLA_VERB_SET_DESTINATION_GAIN,
				 i, 0);
	/* inform firmware about all updated matrix columns - output part */
	for (i = 0; i < chip->mixer.dest_phys_outs; i++)
		lola_codec_write(chip, chip->mixer.nid,
				 LOLA_VERB_SET_DESTINATION_GAIN,
				 chip->mixer.dest_phys_out_ofs + i, 0);

	/* set all digital input source (master) gains to 0dB */
	for (i = 0; i < chip->mixer.src_phys_ins; i++)
		lola_mixer_set_src_gain(chip, i, 336, true); /* 0dB */

	/* set all digital playback source (master) gains to 0dB */
	for (i = 0; i < chip->mixer.src_stream_outs; i++)
		lola_mixer_set_src_gain(chip,
					i + chip->mixer.src_stream_out_ofs,
					336, true); /* 0dB */
	/* set gain value 0dB diagonally in matrix - part INPUT -> CAPTURE */
	for (i = 0; i < chip->mixer.dest_stream_ins; i++) {
		int src = i % chip->mixer.src_phys_ins;
		lola_mixer_set_mapping_gain(chip, src, i, 336, true);
	}
	/* set gain value 0dB diagonally in matrix , part PLAYBACK -> OUTPUT
	 * (LoLa280 : playback channel 0,2,4,6 linked to output channel 0)
	 * (LoLa280 : playback channel 1,3,5,7 linked to output channel 1)
	 */
	for (i = 0; i < chip->mixer.src_stream_outs; i++) {
		int src = chip->mixer.src_stream_out_ofs + i;
		int dst = chip->mixer.dest_phys_out_ofs +
			i % chip->mixer.dest_phys_outs;
		lola_mixer_set_mapping_gain(chip, src, dst, 336, true);
	}
	return 0;
}
Beispiel #2
0
static int lola_src_gain_put(struct snd_kcontrol *kcontrol,
			     struct snd_ctl_elem_value *ucontrol)
{
	struct lola *chip = snd_kcontrol_chip(kcontrol);
	unsigned int ofs = kcontrol->private_value & 0xff;
	unsigned int count = (kcontrol->private_value >> 8) & 0xff;
	int i, err;

	for (i = 0; i < count; i++) {
		unsigned int idx = ofs + i;
		unsigned short val = ucontrol->value.integer.value[i];
		if (val)
			val--;
		err = lola_mixer_set_src_gain(chip, idx, val, !!val);
		if (err < 0)
			return err;
	}
	return 0;
}