All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <lrg@ti.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 4/4] ASoC: firmware core: Add core support to create and destroy firmware components.
Date: Tue, 20 Nov 2012 15:14:30 +0000	[thread overview]
Message-ID: <50AB9E56.5050509@ti.com> (raw)
In-Reply-To: <20121120032659.GC4483@opensource.wolfsonmicro.com>

On 20/11/12 03:27, Mark Brown wrote:

> One thing I'm missing is signal generator widgets - those seem like
> something that's likely to be often software defined.  It'd also be good
> to see a bit more documentation for the file format, like an explanation
> of what things like coefficients are since we're going to make it an
> ABI.

The coefficients atm can either be a vendor blob or can be a vendor blob 
attached to a generic kcontrol e.g. and EQU kcontrol with texts that 
correspond to the coefficients. I'll detail this more in documentation.

>
> With coefficeints we have been moving towards a model where we just
> expose them as binary controls rather than doing the enumeration thing.
>

For ABE we have different coefficients tied to each enumerated EQU kcontrol 
setting and just configure the ABE coefficient depending on the kcontrol 
value. We load the coefficients and EQU kcontrol at the same time since it's 
enumerated text strings are coupled to the coefficients.

>
>> +struct snd_soc_fw_ctl_tlv {
>> +	u32 numid;	/* control element numeric identification */
>> +	u32 length;	/* in bytes aligned to 4 */
>> +	/* tlv data starts here */
>> +};
>
> This is just raw ALSA TLV data (it's already an ABI after all).

True and I think it will be in the new include/uapi/sound too. I may just go 
and create and move the ASoC userspace stuff into a new ASoC userspace header 
file that can also be included by soc.h, etc (a bit like asound.h)

>
>> +struct snd_soc_fw_enum_control {
>> +	struct snd_soc_fw_control_hdr hdr;
>> +	u32 reg;
>> +	u32 reg2;
>> +	u32 shift_l;
>> +	u32 shift_r;
>> +	u32 max;
>> +	u32 mask;
>> +	union {	/* both texts and values are the same size */
>> +		char texts[SND_SOC_FW_NUM_TEXTS][SND_SOC_FW_TEXT_SIZE];
>> +		u32 values[SND_SOC_FW_NUM_TEXTS * SND_SOC_FW_TEXT_SIZE / 4];
>
> I'm having a hard time visualising how this will get filled in - I'd
> expect we'd have something more like:
>
> 	u32 num_values;
> 	struct {
> 		u32 value;
> 		char text[SND_SOC_FW_TEXT_SIZE];
> 	};
>
> - I can't visualise how something with only values would work?  But
> perhaps I'm just missing something.
>

We need to store on file, either an array of strings or an array of u32 values 
for the enumerated kcontrols (based on soc_enum). This gives us a fixed size 
file entry which is easy to read, write and count. But maybe I'm missing 
something from your question...

>
>> +static int soc_fw_widget_load(struct soc_fw *sfw, struct snd_soc_dapm_widget *w)
>> +{
>> +	if (sfw->codec && sfw->codec_ops && sfw->codec_ops->widget_load)
>> +		return sfw->codec_ops->widget_load(sfw->codec, w);
>> +
>> +	if (sfw->platform && sfw->platform_ops && sfw->platform_ops->widget_load)
>> +		return sfw->platform_ops->widget_load(sfw->platform, w);
>> +
>> +	if (sfw->card && sfw->card_ops && sfw->card_ops->widget_load)
>> +		return sfw->card_ops->widget_load(sfw->card, w);
>> +
>> +	dev_info(sfw->dev, "ASoC: no handler specified for ext widget %s\n",
>> +		w->name);
>> +	return 0;
>
> Shouldn't this be returning an error?  The same is true for a bunch of
> other functions.  Or shouild it be a dev_dbg()?

It should probably have a comment. This is an optional callback to component 
drivers in case they want to use set the widgets private data at widget init time.

>
>> +		dev_dbg(sfw->dev, "ASoC: adding mixer kcontrol %s with access"
>> +			" 0x%x\n", mc->hdr.name, mc->hdr.access);
>
> Don't split log messages like this, makes it harder to grep - just break
> the 80 columns or wrap after sfw->dev.
>
>> +			if (ext) {
>> +				dev_err(sfw->dev, "ASoC: no complete mixer IO"
>> +					"handler for %s type (g,p,i) %d:%d:%d\n",
>
> This one is going to be especially bad for example.
>
>> +	if (se->dvalues)
>> +		kfree(se->dvalues);
>> +	else {
>
> Braces on both sides if they're needed on one.
>

The last three points are personal taste, I don't mind too much so I'll change 
them ;)

Liam

  reply	other threads:[~2012-11-20 15:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19 18:12 [PATCH 1/4] ASoC: firmware: Add support for FW based kcontrols Liam Girdwood
2012-11-19 18:12 ` [PATCH 2/4] ASoC: firmware: Add support for FW based widgets Liam Girdwood
2012-11-20  2:16   ` Mark Brown
2012-11-19 18:12 ` [PATCH 3/4] ASoC: firmware core: Add core support for dynamic kcontrols and widgets Liam Girdwood
2012-11-20  2:36   ` Mark Brown
2012-11-20 12:19     ` Liam Girdwood
2012-11-19 18:12 ` [PATCH 4/4] ASoC: firmware core: Add core support to create and destroy firmware components Liam Girdwood
2012-11-19 18:46   ` Takashi Iwai
2012-11-20 12:03     ` Liam Girdwood
2012-11-20 12:05       ` Takashi Iwai
2012-11-21  0:30       ` Mark Brown
2012-11-21  6:43         ` Takashi Iwai
2012-11-21  6:49           ` Mark Brown
2012-11-20  3:27   ` Mark Brown
2012-11-20 15:14     ` Liam Girdwood [this message]
2012-11-21  0:43       ` Mark Brown
2012-11-21 10:21         ` Liam Girdwood
2012-11-21 10:37           ` Mark Brown
2012-11-21 11:16             ` Liam Girdwood
2012-11-21 11:52               ` Mark Brown
2012-11-19 18:36 ` [PATCH 1/4] ASoC: firmware: Add support for FW based kcontrols Takashi Iwai
2012-11-29 12:08   ` Liam Girdwood
2012-11-29 15:15     ` Takashi Iwai
2012-11-29 15:51       ` Liam Girdwood
2012-11-29 16:01         ` Liam Girdwood
2012-11-29 17:35           ` Takashi Iwai
2012-11-29 17:39             ` Liam Girdwood
2012-11-20  2:11 ` 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=50AB9E56.5050509@ti.com \
    --to=lrg@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.