alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: Liam Girdwood <lrg@slimlogic.co.uk>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	ALSA development <alsa-devel@alsa-project.org>
Subject: asoc: problem with snd_soc_dai_set_fmt()
Date: Thu, 29 Apr 2010 16:22:17 -0500	[thread overview]
Message-ID: <4BD9F889.4010106@freescale.com> (raw)

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

             reply	other threads:[~2010-04-29 21:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-29 21:22 Timur Tabi [this message]
2010-04-29 22:18 ` asoc: problem with snd_soc_dai_set_fmt() Mark Brown
2010-04-29 23:30   ` Timur Tabi
2010-04-30 10:37     ` Mark Brown
2010-04-30  1:28   ` jassi brar
2010-04-30  8:58     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BD9F889.4010106@freescale.com \
    --to=timur@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lrg@slimlogic.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).