devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jyri Sarha <jsarha@ti.com>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
	peter.ujfalusi@ti.com, airlied@linux.ie, tomi.valkeinen@ti.com,
	dri-devel@lists.freedesktop.org, liam.r.girdwood@linux.intel.com,
	tony@atomide.com, broonie@kernel.org, bcousson@baylibre.com,
	linux-omap@vger.kernel.org
Subject: Re: [PATCH 1/3] drm/i2c: tda998x: Improve tda998x_configure_audio() audio related pdata
Date: Fri, 5 Aug 2016 12:02:27 +0300	[thread overview]
Message-ID: <98a2279c-019d-7393-06a4-0b51c1229be5@ti.com> (raw)
In-Reply-To: <20160804133135.GN5783@n2100.arm.linux.org.uk>

On 08/04/16 16:31, Russell King - ARM Linux wrote:
> On Tue, Aug 02, 2016 at 03:05:07PM +0300, Jyri Sarha wrote:
>> @@ -787,19 +792,13 @@ tda998x_configure_audio(struct tda998x_priv *priv,
>>  	reg_clear(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_RST_CTS);
>>  
>>  	/* Write the channel status */
>> -	buf[0] = IEC958_AES0_CON_NOT_COPYRIGHT;
>> -	buf[1] = 0x00;
>> -	buf[2] = IEC958_AES3_CON_FS_NOTID;
>> -	buf[3] = IEC958_AES4_CON_ORIGFS_NOTID |
>> -			IEC958_AES4_CON_MAX_WORDLEN_24;
>> -	reg_write_range(priv, REG_CH_STAT_B(0), buf, 4);
>> +	reg_write_range(priv, REG_CH_STAT_B(0), params->status, 4);
> 
> Take a close look at the code you are replacing here - the buffer
> contents is not AES bytes 0, 1, 2, 3, 4, but AES bytes 0, 1, 3, 4
> - byte 2 is not present in this array.  I don't think you've noticed
> this as your second patch merely copies verboten the IEC status:
> 
> +       memcpy(audio.status, params->iec.status,
> +              min(sizeof(audio.status), sizeof(params->iec.status)));
> 
> assuming that it is bytes 0-3.  Byte 2 is stored separately for each
> I2S channel in the following registers.
> 

Oh, yes. I missed that. I think it would be better to increase
tda998x_audio_params status buffer length by one and keep it otherwise
as it is. Then just write the bytes 0-1 and 3-4 separately into channel
status registers, with appropriate comments. I guess the the AES byte 2
can remain 0 for now (source and channel unspecified, with assumption of
consumer stream).

>> diff --git a/include/drm/i2c/tda998x.h b/include/drm/i2c/tda998x.h
>> index 3e419d9..24be7aa 100644
>> --- a/include/drm/i2c/tda998x.h
>> +++ b/include/drm/i2c/tda998x.h
>> @@ -1,6 +1,19 @@
>>  #ifndef __DRM_I2C_TDA998X_H__
>>  #define __DRM_I2C_TDA998X_H__
>>  
>> +#define AFMT_UNUSED	0
>> +#define AFMT_SPDIF	1
>> +#define AFMT_I2S	2
> 
> I'd prefer this to stay an enum please.
> 

Ok.

>> +struct tda998x_audio_params {
>> +	u8 config;
>> +	u8 format;
>> +	unsigned sample_width;
>> +	unsigned sample_rate;
>> +	struct hdmi_audio_infoframe cea;
> 
> With this addition, this file will need to include linux/hdmi.h.
> 

Oh yes, thanks.

>> +	u8 status[4];
> 
> A comment here about the missing byte 2 would probably be a good idea.
> 

As I said earlier, I'd rather keep this as plain channel status buffer
and just increase its size by one.

Thanks a lot for the review!

Best reagards,
Jyri

  reply	other threads:[~2016-08-05  9:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-02 12:05 [PATCH 0/3] drm/i2c: tda998x ASoC hdmi-codec support + BeagleBoneBlack audio support Jyri Sarha
2016-08-02 12:05 ` [PATCH 1/3] drm/i2c: tda998x: Improve tda998x_configure_audio() audio related pdata Jyri Sarha
     [not found]   ` <5adcd94104080abcd5b072a5d6a85b85c5ea0584.1470129989.git.jsarha-l0cyMroinI0@public.gmane.org>
2016-08-04 13:31     ` Russell King - ARM Linux
2016-08-05  9:02       ` Jyri Sarha [this message]
2016-08-06 16:57   ` Russell King - ARM Linux
2016-08-06 17:56   ` Russell King - ARM Linux
2016-08-02 12:05 ` [PATCH 2/3] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding Jyri Sarha
     [not found]   ` <ce10548e1c28270d80ee99a525e117d0d25f5656.1470129989.git.jsarha-l0cyMroinI0@public.gmane.org>
2016-08-04 14:07     ` Russell King - ARM Linux
2016-08-05  9:02       ` Jyri Sarha
     [not found]         ` <3a3dcfa4-cec8-53f8-eddb-9a0e04c10ac9-l0cyMroinI0@public.gmane.org>
2016-08-05 16:48           ` Russell King - ARM Linux
     [not found]             ` <20160805164845.GP5783-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2016-08-05 16:59               ` Mark Brown
     [not found]                 ` <20160805165959.GA10383-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-08-05 17:04                   ` Russell King - ARM Linux
2016-08-05 17:59                     ` Mark Brown
2016-08-05 22:19                       ` Russell King - ARM Linux
     [not found]                         ` <20160805221944.GR5783-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2016-08-08 12:15                           ` Jyri Sarha
2016-08-02 12:05 ` [PATCH 3/3] ARM: dts: am335x-boneblack: Add HDMI audio support Jyri Sarha

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=98a2279c-019d-7393-06a4-0b51c1229be5@ti.com \
    --to=jsarha@ti.com \
    --cc=airlied@linux.ie \
    --cc=alsa-devel@alsa-project.org \
    --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=linux@armlinux.org.uk \
    --cc=peter.ujfalusi@ti.com \
    --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).