devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jyri Sarha <jsarha@ti.com>
To: Arnaud Pouliquen <arnaud.pouliquen@st.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"airlied@linux.ie" <airlied@linux.ie>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"bcousson@baylibre.com" <bcousson@baylibre.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Cc: "peter.ujfalusi@ti.com" <peter.ujfalusi@ti.com>,
	"tony@atomide.com" <tony@atomide.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"liam.r.girdwood@linux.intel.com"
	<liam.r.girdwood@linux.intel.com>,
	"tomi.valkeinen@ti.com" <tomi.valkeinen@ti.com>,
	"rmk+kernel@arm.linux.org.uk" <rmk+kernel@arm.linux.org.uk>
Subject: Re: [PATCH v6 1/6] ALSA: pcm: add IEC958 channel status helper for hw_params
Date: Wed, 9 Mar 2016 16:38:59 +0200	[thread overview]
Message-ID: <56E03583.3030907@ti.com> (raw)
In-Reply-To: <56DFF636.9090304@st.com>

On 03/09/16 12:08, Arnaud Pouliquen wrote:
> Hello Jyri,
>
> Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
>
> With few nitpicking remarks on form.
>
> Regards
> Arnaud
>
> On 03/08/2016 09:14 PM, Jyri Sarha wrote:
>> Add IEC958 channel status helper that gets the audio properties from
>> snd_pcm_hw_params instead of snd_pcm_runtime. This is needed to
>> produce the channel status bits already in audio stream configuration
>> phase.
>>
>> Signed-off-by: Jyri Sarha <jsarha@ti.com>
>> ---
>>   include/sound/pcm_iec958.h |  2 ++
>>   sound/core/pcm_iec958.c    | 53 +++++++++++++++++++++++++++++++---------------
>>   2 files changed, 38 insertions(+), 17 deletions(-)
>>
>> diff --git a/include/sound/pcm_iec958.h b/include/sound/pcm_iec958.h
>> index 0eed397..36f023a 100644
>> --- a/include/sound/pcm_iec958.h
>> +++ b/include/sound/pcm_iec958.h
>> @@ -6,4 +6,6 @@
>>   int snd_pcm_create_iec958_consumer(struct snd_pcm_runtime *runtime, u8 *cs,
>>   	size_t len);
>>
>> +int snd_pcm_create_iec958_consumer_hw_params(struct snd_pcm_hw_params *params,
>> +					     u8 *cs, size_t len);
>>   #endif
>> diff --git a/sound/core/pcm_iec958.c b/sound/core/pcm_iec958.c
>> index 36b2d7a..27e0981 100644
>> --- a/sound/core/pcm_iec958.c
>> +++ b/sound/core/pcm_iec958.c
>> @@ -9,30 +9,18 @@
>>   #include <linux/types.h>
>>   #include <sound/asoundef.h>
>>   #include <sound/pcm.h>
>> +#include <sound/pcm_params.h>
>>   #include <sound/pcm_iec958.h>
>>
>> -/**
>> - * snd_pcm_create_iec958_consumer - create consumer format IEC958 channel status
>> - * @runtime: pcm runtime structure with ->rate filled in
>> - * @cs: channel status buffer, at least four bytes
>> - * @len: length of channel status buffer
>> - *
>> - * Create the consumer format channel status data in @cs of maximum size
>> - * @len corresponding to the parameters of the PCM runtime @runtime.
>> - *
>> - * Drivers may wish to tweak the contents of the buffer after creation.
>> - *
>> - * Returns: length of buffer, or negative error code if something failed.
>> - */
>> -int snd_pcm_create_iec958_consumer(struct snd_pcm_runtime *runtime, u8 *cs,
>> -	size_t len)
>> +static int create_iec958_consumer(uint rate, uint sample_width,
>> +				  u8 *cs, size_t len)
>>   {
>>   	unsigned int fs, ws;
>>
>>   	if (len < 4)
>>   		return -EINVAL;
>>
>> -	switch (runtime->rate) {
>> +	switch (rate) {
>>   	case 32000:
>>   		fs = IEC958_AES3_CON_FS_32000;
>>   		break;
>> @@ -59,7 +47,7 @@ int snd_pcm_create_iec958_consumer(struct snd_pcm_runtime *runtime, u8 *cs,
>>   	}
>>
>>   	if (len > 4) {
>> -		switch (snd_pcm_format_width(runtime->format)) {
>> +		switch (sample_width) {
>>   		case 16:
>>   			ws = IEC958_AES4_CON_WORDLEN_20_16;
>>   			break;
>> @@ -71,6 +59,7 @@ int snd_pcm_create_iec958_consumer(struct snd_pcm_runtime *runtime, u8 *cs,
>>   			     IEC958_AES4_CON_MAX_WORDLEN_24;
>>   			break;
>>   		case 24:
>> +		case 32: /* Assume 24-bit width for 32-bit samples. */
>>   			ws = IEC958_AES4_CON_WORDLEN_24_20 |
>>   			     IEC958_AES4_CON_MAX_WORDLEN_24;
>>   			break;
>> @@ -92,4 +81,34 @@ int snd_pcm_create_iec958_consumer(struct snd_pcm_runtime *runtime, u8 *cs,
>>
>>   	return len;
>>   }
>> +
>> +/**
>> + * snd_pcm_create_iec958_consumer - create consumer format IEC958 channel status
>> + * @runtime: pcm runtime structure with ->rate filled in
>> + * @cs: channel status buffer, at least four bytes
>> + * @len: length of channel status buffer
>> + *
>> + * Create the consumer format channel status data in @cs of maximum size
>> + * @len corresponding to the parameters of the PCM runtime @runtime.
>> + *
>> + * Drivers may wish to tweak the contents of the buffer after creation.
>> + *
>> + * Returns: length of buffer, or negative error code if something failed.
>> + */
>> +int snd_pcm_create_iec958_consumer(struct snd_pcm_runtime *runtime, u8 *cs,
>> +	size_t len)
> should be aligned on parenthesis
>> +{
>> +	return create_iec958_consumer(runtime->rate,
>> +				      snd_pcm_format_width(runtime->format),
>> +				      cs, len);
>> +}
>>   EXPORT_SYMBOL(snd_pcm_create_iec958_consumer);
>> +
>> +
> No kernel-doc comment?

Oh yes. It'll be mostly redundant with snd_pcm_create_iec958_consumer() 
but still it should be there.

>> +int snd_pcm_create_iec958_consumer_hw_params(struct snd_pcm_hw_params *params,
> Could be snd_pcm_hw_params_create_iec958_consumer to be coherent with
> functions declared in pcm.h

I feel that iec958 should be earlier in the name because it is the 
common denominator in this c-file. Then again I have no strong opinions 
about this.

>> +					     u8 *cs, size_t len)
> should be aligned on parenthesis

But it is. It just that the diff '+'-sign pushes the line above one char 
right, but the line bellow is not pushed because it indented with tabs 
(like it should be).

>> +{
>> +	return create_iec958_consumer(params_rate(params), params_width(params),
>> +				      cs, len);
>> +}
>> +EXPORT_SYMBOL(snd_pcm_create_iec958_consumer_hw_params);
>>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-03-09 14:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-08 20:14 [PATCH v6 0/6] Implement generic ASoC HDMI codec and use it in tda998x Jyri Sarha
2016-03-08 20:14 ` [PATCH v6 1/6] ALSA: pcm: add IEC958 channel status helper for hw_params Jyri Sarha
2016-03-09 10:08   ` Arnaud Pouliquen
2016-03-09 14:38     ` Jyri Sarha [this message]
2016-03-10  5:24   ` Mark Brown
2016-03-08 20:14 ` [PATCH v6 2/6] ASoC: hdmi-codec: Add hdmi-codec for external HDMI-encoders Jyri Sarha
2016-03-09 10:17   ` Arnaud Pouliquen
2016-03-09 15:12   ` Philipp Zabel
     [not found]   ` <6269edecc567c7b1431b023bc812f0309db99273.1457465383.git.jsarha-l0cyMroinI0@public.gmane.org>
2016-03-09 15:28     ` Philipp Zabel
2016-03-08 20:14 ` [PATCH v6 3/6] ASoC: hdmi-codec: Add audio abort() callback for video side to use Jyri Sarha
2016-03-08 20:14 ` [PATCH v6 4/6] drm/i2c: tda998x: Improve tda998x_configure_audio() audio related pdata Jyri Sarha
2016-03-08 20:14 ` [PATCH v6 5/6] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding Jyri Sarha
     [not found]   ` <7e2cd007e1ea3217c817fb4e7782b0bfe11ea56c.1457465383.git.jsarha-l0cyMroinI0@public.gmane.org>
2016-03-09  0:15     ` kbuild test robot
2016-03-09  0:15     ` [PATCH] drm/i2c: tda998x: fix ptr_ret.cocci warnings kbuild test robot
2016-03-09 13:52     ` [PATCH v6 5/6] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding kbuild test robot
2016-03-10 12:44       ` Jyri Sarha
2016-03-08 20:14 ` [PATCH v6 6/6] ARM: dts: am335x-boneblack: Add HDMI audio support Jyri Sarha
2016-03-09  3:27 ` [PATCH v6 0/6] Implement generic ASoC HDMI codec and use it in tda998x Mark Brown
     [not found] ` <cover.1457465383.git.jsarha-l0cyMroinI0@public.gmane.org>
2016-03-09  3:29   ` 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=56E03583.3030907@ti.com \
    --to=jsarha@ti.com \
    --cc=airlied@linux.ie \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnaud.pouliquen@st.com \
    --cc=bcousson@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=peter.ujfalusi@ti.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=tomi.valkeinen@ti.com \
    --cc=tony@atomide.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;
as well as URLs for NNTP newsgroup(s).