Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Liam Girdwood <lrg@ti.com>, Simon <horms@verge.net.au>,
	Kuninori Morimoto <kuninori.morimoto.gx@gmail.com>
Subject: Re: [RFC][PATCH 1/2] ASoC: add snd_soc_of_parse_daifmt()
Date: Tue, 04 Dec 2012 13:18:35 -0700	[thread overview]
Message-ID: <50BE5A9B.1020500@wwwdotorg.org> (raw)
In-Reply-To: <87sj7snd0z.wl%kuninori.morimoto.gx@renesas.com>

On 11/29/2012 05:35 PM, Kuninori Morimoto wrote:
> 
> Hi Stephen
> 
>> I think it'd be more typical to represent as a single integer property,
>> where the value is an enumeration indicating the type.
> 
> Sorry, I couldn't understand correctly this.
> Do you mean like this ?
>
>   snd.soc.daifmt.format      = <3> /* SND_SOC_DAIFMT_LEFT_J */
>   snd.soc.daifmt.clock_gate  = <1> /* SND_SOC_DAIFMT_CONT */
>   snd.soc.daifmt.inversion   = <3> /* SND_SOC_DAIFMT_IB_NF */
>   snd.soc.daifmt.hw_clock    = <2> /* SND_SOC_DAIFMT_CBS_CFM */

Sorry for the slow response.

What I meant was that rather than:

> +	ret |= __snd_soc_of_parse_daifmt(np, prefix, fmt,
> +					 "i2s", SND_SOC_DAIFMT_I2S);
> +	ret |= __snd_soc_of_parse_daifmt(np, prefix, fmt,
> +					 "right_j", SND_SOC_DAIFMT_RIGHT_J);
> +	ret |= __snd_soc_of_parse_daifmt(np, prefix, fmt,
> +					 "left_j", SND_SOC_DAIFMT_LEFT_J);
> +	ret |= __snd_soc_of_parse_daifmt(np, prefix, fmt,
> +					 "dsp_a", SND_SOC_DAIFMT_DSP_A);
> +	ret |= __snd_soc_of_parse_daifmt(np, prefix, fmt,
> +					 "dsp_b", SND_SOC_DAIFMT_DSP_B);

I'd expect to see something more like:

fmt = of_property_read_u32_array(np, "bit-format");

But perhaps your binding is representing the set of possible legal
formats? I had assumed it was attempting to represent the single
specific format to choose.

Related, I also wasn't suggesting combining format, clock-gate,
inversion, ... into a single property.

> I added SND_SOC_DAIFMT_xxx here,
> but this style is not readable/understandable for me.
> And it is difficult to keep compatible if the number was changed.
> (never happen ? I'm not sure)

Well, once a DT binding is created, you can't change the numbers, or you
would break the ability for an old DT to work with a newer kernel.

> How about to use string ?
> 
>   snd.soc.daifmt.format      = "left_j"
>   snd.soc.daifmt.clock_gate  = "cont"
>   snd.soc.daifmt.inversion   = "ib_nf"
>   snd.soc.daifmt.hw_clock    = "cbs_cfm"

That's probably the best we can do for now. Using a pre-processor would
be best:

#define SND_SOC_DAIFMT_LEFT_J 3

snd.soc.daifmt.format = <SND_SOC_DAIFMT_LEFT_J>;

... but we can't do that yet...

  reply	other threads:[~2012-12-04 20:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29  4:31 [RFC][PATCH 0/2] ASoC: add DT support on simple-card Kuninori Morimoto
2012-11-29  4:31 ` [RFC][PATCH 1/2] ASoC: add snd_soc_of_parse_daifmt() Kuninori Morimoto
2012-11-29  5:21   ` Stephen Warren
2012-11-29 15:12     ` Mark Brown
2012-11-30  0:35     ` Kuninori Morimoto
2012-12-04 20:18       ` Stephen Warren [this message]
2012-12-05  7:55         ` Kuninori Morimoto
2012-12-05 20:42           ` Stephen Warren
2012-12-06  9:02             ` Kuninori Morimoto
2012-11-29  4:32 ` [RFC][PATCH 2/2] ASoC: simple-card: add DT support Kuninori Morimoto
2012-11-29  5:20   ` Stephen Warren
2012-11-29  6:05     ` Kuninori Morimoto
2012-11-30 10:38   ` Daniel Mack
2012-12-03  0:18     ` Kuninori Morimoto

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=50BE5A9B.1020500@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=horms@verge.net.au \
    --cc=kuninori.morimoto.gx@gmail.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lrg@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox