lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dee642fd-e50e-44b2-8482-a1ffc7948517@cherry.de>
Date: Fri, 7 Feb 2025 09:46:53 +0100
From: Quentin Schulz <quentin.schulz@...rry.de>
To: Detlev Casanova <detlev.casanova@...labora.com>,
 linux-kernel@...r.kernel.org
Cc: Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
 Conor Dooley <conor+dt@...nel.org>, Heiko Stuebner <heiko@...ech.de>,
 Andrzej Hajda <andrzej.hajda@...el.com>,
 Neil Armstrong <neil.armstrong@...aro.org>, Robert Foss <rfoss@...nel.org>,
 Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
 Jonas Karlman <jonas@...boo.se>, Jernej Skrabec <jernej.skrabec@...il.com>,
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
 Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
 David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
 Sebastian Reichel <sebastian.reichel@...labora.com>,
 Alexey Charkov <alchark@...il.com>,
 Cristian Ciocaltea <cristian.ciocaltea@...labora.com>,
 Dragan Simic <dsimic@...jaro.org>, Jianfeng Liu <liujianfeng1994@...il.com>,
 Niklas Cassel <cassel@...nel.org>, FUKAUMI Naoki <naoki@...xa.com>,
 Kever Yang <kever.yang@...k-chips.com>, Johan Jonker <jbx6244@...il.com>,
 Geert Uytterhoeven <geert+renesas@...der.be>,
 Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
 Algea Cao <algea.cao@...k-chips.com>, Chen-Yu Tsai <wens@...e.org>,
 Sugar Zhang <sugar.zhang@...k-chips.com>, devicetree@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org, linux-rockchip@...ts.infradead.org,
 dri-devel@...ts.freedesktop.org, kernel@...labora.com
Subject: Re: [PATCH v5 1/3] drm/bridge: synopsys: Add audio support for
 dw-hdmi-qp

Hi Detlev,

On 2/6/25 9:40 PM, Detlev Casanova wrote:
> Hi Quentin,
> 
> On Tuesday, 4 February 2025 04:59:12 EST Quentin Schulz wrote:
>> Hi Detlev,
>>
>> Just some drive-by comment inline.
>>
>> On 2/3/25 6:16 PM, Detlev Casanova wrote:
[...]
>>> +static void dw_hdmi_qp_set_audio_interface(struct dw_hdmi_qp *hdmi,
>>> +					   struct hdmi_codec_daifmt
> *fmt,
>>> +					   struct hdmi_codec_params
> *hparms)
>>> +{
>>> +	u32 conf0 = 0;
>>> +
>>> +	/* Reset the audio data path of the AVP */
>>> +	dw_hdmi_qp_write(hdmi, AVP_DATAPATH_PACKET_AUDIO_SWINIT_P,
>>> GLOBAL_SWRESET_REQUEST); +
>>> +	/* Disable AUDS, ACR, AUDI */
>>> +	dw_hdmi_qp_mod(hdmi, 0,
>>> +		  PKTSCHED_ACR_TX_EN | PKTSCHED_AUDS_TX_EN |
> PKTSCHED_AUDI_TX_EN,
>>> +		  PKTSCHED_PKT_EN);
>>> +
>>> +	/* Clear the audio FIFO */
>>> +	dw_hdmi_qp_write(hdmi, AUDIO_FIFO_CLR_P, AUDIO_INTERFACE_CONTROL0);
>>> +
>>> +	/* Select I2S interface as the audio source */
>>> +	dw_hdmi_qp_mod(hdmi, AUD_IF_I2S, AUD_IF_SEL_MSK,
>>> AUDIO_INTERFACE_CONFIG0); +
>>> +	/* Enable the active i2s lanes */
>>> +	switch (hparms->channels) {
>>> +	case 7 ... 8:
>>> +		conf0 |= I2S_LINES_EN(3);
>>> +		fallthrough;
>>> +	case 5 ... 6:
>>> +		conf0 |= I2S_LINES_EN(2);
>>> +		fallthrough;
>>> +	case 3 ... 4:
>>> +		conf0 |= I2S_LINES_EN(1);
>>> +		fallthrough;
>>> +	default:
>>> +		conf0 |= I2S_LINES_EN(0);
>>> +		break;
>>> +	}
>>> +
>>> +	dw_hdmi_qp_mod(hdmi, conf0, I2S_LINES_EN_MSK,
> AUDIO_INTERFACE_CONFIG0);
>>> +
>>> +	/*
>>> +	 * Enable bpcuv generated internally for L-PCM, or received
>>> +	 * from stream for NLPCM/HBR.
>>> +	 */
>>> +	switch (fmt->bit_fmt) {
>>> +	case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE:
>>> +		conf0 = (hparms->channels == 8) ? AUD_HBR : AUD_ASP;
>>> +		conf0 |= I2S_BPCUV_RCV_EN;
>>> +		break;
>>> +	default:
>>> +		conf0 = AUD_ASP | I2S_BPCUV_RCV_DIS;
>>> +		break;
>>> +	}
>>> +
>>> +	dw_hdmi_qp_mod(hdmi, conf0, I2S_BPCUV_RCV_MSK | AUD_FORMAT_MSK,
>>> +		  AUDIO_INTERFACE_CONFIG0);
>>> +
>>> +	/* Enable audio FIFO auto clear when overflow */
>>> +	dw_hdmi_qp_mod(hdmi, AUD_FIFO_INIT_ON_OVF_EN,
> AUD_FIFO_INIT_ON_OVF_MSK,
>>> +		  AUDIO_INTERFACE_CONFIG0);
>>
>> This is all very I2S-centric while the HDMI controllers on RK3588 do
>> have the ability (according to the TRM) to use S/PDIF instead of I2S. I
>> assume the driver should be able to know which format to use based on
>> simple-audio-card,format property? Is that correct? Then current support
>> which doesn't even check for I2S would be fine and not conflict with a
>> later commit which would add support for S/PDIF? (Essentially asking if
>> we need another DT property for the HDMI controller node or elsewhere to
>> specify which mode to run in instead of expecting it to always be I2S).
> 
> The hdmi_codec_daifmt::fmt field already has this information, based on the
> simple-audio-card,format = "i2s"; field in the device tree.
> 
> I could add a condition in dw_hdmi_qp_audio_prepare() to fail with -EINVAL if
> the devicetree specifies anything else than "i2s" for now.
> 

All I was asking is whether we can (easily) check this property is set 
to i2s the day we want to implement support for S/PDIF :) If that's the 
case, then I don't think we necessarily need to check it right now, but 
a -EINVAL would be fine too, up to you.

> I'm not willing to implement support for the SPDIF path for now, mainly
> because there's no need for that yet (I2S works well) and the downstream
> kernel doesn't implemented it, meaning it hasn't been tested a lot anyway.
> 

That's fine, just wanted to know if a "backward-compatible" 
implementation for S/PDIF would be possible in the future would we want 
to support it :)

Cheers,
Quentin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ