From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: Igor Paunovic <royalnet026@gmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-arm-kernel@lists.infradead.org, kernel@collabora.com,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/4] media: synopsys: hdmirx: add HDMI audio capture support
Date: Thu, 23 Jul 2026 23:50:09 +0300 [thread overview]
Message-ID: <58b7f1fd-997c-48af-9a7c-a0a5738a5d42@collabora.com> (raw)
In-Reply-To: <20260721064115.64809-3-royalnet026@gmail.com>
On 7/21/26 09:41, Igor Paunovic wrote:
> The Synopsys DesignWare HDMI RX controller extracts the audio stream
> embedded in the incoming HDMI signal and feeds it to an on-SoC I2S
> controller. Expose it as an ALSA capture device by registering the
> generic hdmi-codec as a child of the controller, so that a
> simple-audio-card in the device tree can bind the HDMI RX audio DAI.
>
> The sample rate is recovered from the ACR N/CTS values together with the
> measured TMDS character rate. A periodic worker keeps the local audio
> reference clock locked to the source by nudging it in small ppm steps to
> hold the audio FIFO fill level near its target, which avoids FIFO
> under/overflow and the resulting dropped samples.
>
> Across system suspend the worker is stopped before the controller
> clocks are gated. Resume fully resets the controller, wiping the audio
> configuration, so when a capture stream is active it re-programs the
> audio path from the last known sample rate and re-arms the worker,
> whose rate change and FIFO error paths resynchronize once the source
> delivers audio again.
>
> Signed-off-by: Igor Paunovic <royalnet026@gmail.com>
> ---
> Changes in v4:
> - use swab32() for the ACR word reversal: readl() already abstracts
> bus endianness, so the reversal must be unconditional (be32_to_cpu
> is a no-op on big-endian)
> - support system suspend: stop the worker in suspend before the
> clocks are gated; resume fully resets the controller, so re-program
> the audio path and re-arm the worker while a capture stream is
> active, through a hdmirx_audio_setup() helper shared with
> hw_params() (Dmitry Osipenko; validated with an active capture
> stream across suspend/resume)
>
> Changes in v3:
> - restore the v1 audio teardown in remove(): audio_shutdown() already
> stops the worker when the stream closes, so the extra flag clear
> and trailing cancel added in v2 were redundant (Dmitry Osipenko)
> - rename the ACR read locals and add a comment documenting the
> register byte packing
> - drop the get_dai_id stub so OF-graph cards resolve the DAI index
> from the reg property
>
> Changes in v2:
> - register the S/PDIF DAI so the indexes match the binding and reject
> it with -EOPNOTSUPP until wired up (Sebastian Reichel)
> - use platform_device_register_data() and drop the fixed 32-bit DMA
> mask (Dmitry Osipenko)
> - don't leave an ERR_PTR in audio_pdev on registration failure
> - fix teardown ordering in remove()
> - stop the worker before reprogramming shared state in hw_params()
> - look up the "audio" clock by name instead of indexing clks[1]
> - keep the worker on system_unbound_wq when re-arming
> .../platform/synopsys/hdmirx/snps_hdmirx.c | 306 ++++++++++++++++++
> .../platform/synopsys/hdmirx/snps_hdmirx.h | 8 +
> 2 files changed, 314 insertions(+)
Note: Current variant of audio support requires userspace to manually
select appropriate audio freq on capture. This needs to be improved
later on for regular userspace apps by dynamically registering audio
CODEC on HDMI cable plug event and reading out actual audio freq on the
wire, restricting the CODEC's rate, which might require extension of the
hdmi_codec_ops.
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
--
Best regards,
Dmitry
next prev parent reply other threads:[~2026-07-23 20:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 6:41 [PATCH v4 0/4] media: synopsys: hdmirx: add HDMI audio capture support Igor Paunovic
2026-07-21 6:41 ` [PATCH v4 1/4] dt-bindings: media: snps,dw-hdmi-rx: add #sound-dai-cells Igor Paunovic
2026-07-21 15:13 ` Sebastian Reichel
2026-07-22 7:10 ` Krzysztof Kozlowski
2026-07-23 21:07 ` Dmitry Osipenko
2026-07-21 6:41 ` [PATCH v4 2/4] media: synopsys: hdmirx: add HDMI audio capture support Igor Paunovic
[not found] ` <20260721070036.51C371F000E9@smtp.kernel.org>
2026-07-21 7:51 ` Igor Paunovic
2026-07-23 20:59 ` Dmitry Osipenko
2026-07-23 20:50 ` Dmitry Osipenko [this message]
2026-07-21 6:41 ` [PATCH v4 3/4] arm64: dts: rockchip: add HDMI RX audio on RK3588 Igor Paunovic
2026-07-21 15:13 ` Sebastian Reichel
2026-07-23 21:08 ` Dmitry Osipenko
2026-07-21 6:41 ` [PATCH v4 4/4] arm64: dts: rockchip: enable HDMI RX audio capture on Orange Pi 5 Plus Igor Paunovic
2026-07-21 15:15 ` Sebastian Reichel
2026-07-23 21:08 ` Dmitry Osipenko
2026-08-05 15:40 ` [PATCH v4 0/4] media: synopsys: hdmirx: add HDMI audio capture support Igor Paunovic
2026-08-11 14:01 ` Dmitry Osipenko
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=58b7f1fd-997c-48af-9a7c-a0a5738a5d42@collabora.com \
--to=dmitry.osipenko@collabora.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=kernel@collabora.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=royalnet026@gmail.com \
--cc=sebastian.reichel@collabora.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