asoc: problem with snd_soc_dai_set_fmt()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is a problem with snd_soc_dai_set_fmt():

int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{
	if (dai->driver && dai->driver->ops->set_fmt)
		return dai->driver->ops->set_fmt(dai, fmt);
	else
		return -EINVAL;
}

Let's say the DAI driver has not defined a .set_fmt() function.  This means
that if the fabric driver does this:

ret = snd_soc_dai_set_fmt(cpu_dai, machine_data->dai_format);
if (ret < 0) {
	dev_err(dev, "could not set CPU driver audio format\n");
	return ret;
}

It's going to think that the DAI driver *rejected* the DAI format.  What
this means is that I cannot make this function optional.  I have to define
this function in my CPU driver.

May I propose this:

int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{
	if (dai->driver && dai->driver->ops->set_fmt)
		return dai->driver->ops->set_fmt(dai, fmt);
	else
		return 0;
}

-- 
Timur Tabi
Linux kernel developer at Freescale
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux