Exemplo n.º 1
0
int
snd_bebob_stream_get_rate(struct snd_bebob *bebob, unsigned int *curr_rate)
{
	unsigned int tx_rate, rx_rate, trials;
	int err;

	trials = 0;
	do {
		err = avc_general_get_sig_fmt(bebob->unit, &tx_rate,
					      AVC_GENERAL_PLUG_DIR_OUT, 0);
	} while (err == -EAGAIN && ++trials < 3);
	if (err < 0)
		goto end;

	trials = 0;
	do {
		err = avc_general_get_sig_fmt(bebob->unit, &rx_rate,
					      AVC_GENERAL_PLUG_DIR_IN, 0);
	} while (err == -EAGAIN && ++trials < 3);
	if (err < 0)
		goto end;

	*curr_rate = rx_rate;
	if (rx_rate == tx_rate)
		goto end;

	/* synchronize receive stream rate to transmit stream rate */
	err = avc_general_set_sig_fmt(bebob->unit, rx_rate,
				      AVC_GENERAL_PLUG_DIR_IN, 0);
end:
	return err;
}
Exemplo n.º 2
0
int snd_bebob_get_rate(struct snd_bebob *bebob, unsigned int *rate,
		       enum avc_general_plug_dir dir)
{
	int err;

	err = avc_general_get_sig_fmt(bebob->unit, rate, dir, 0);
	if (err < 0)
		goto end;

	/* IMPLEMENTED/STABLE is OK */
	if (err != 0x0c) {
		dev_err(&bebob->unit->device,
			"failed to get sampling rate\n");
		err = -EIO;
	}
end:
	return err;
}