From: Hans Verkuil <hverkuil@xs4all.nl>
To: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
Shreeya Patel <shreeya.patel@collabora.com>,
Heiko Stuebner <heiko@sntech.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
jose.abreu@synopsys.com, nelson.costa@synopsys.com,
shawn.wen@rock-chips.com, nicolas.dufresne@collabora.com,
Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: kernel@collabora.com, linux-media@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rockchip@lists.infradead.org, Tim Surber <me@timsurber.de>
Subject: Re: [PATCH v6 4/6] media: platform: synopsys: Add support for HDMI input driver
Date: Mon, 17 Feb 2025 19:45:36 +0100 [thread overview]
Message-ID: <3e8a6fea-0ee9-4667-b8a9-8f2f02df3c91@xs4all.nl> (raw)
In-Reply-To: <cd40ca74-fe5b-4942-9da8-1117303dd0c4@collabora.com>
On 17/02/2025 19:26, Dmitry Osipenko wrote:
> On 2/17/25 21:21, Dmitry Osipenko wrote:
>> On 2/17/25 18:44, Hans Verkuil wrote:
>>> On 2/17/25 16:36, Dmitry Osipenko wrote:
>>>> On 2/17/25 11:31, Hans Verkuil wrote:
>>>>> On 15/02/2025 22:04, Dmitry Osipenko wrote:
>>>>>> From: Shreeya Patel <shreeya.patel@collabora.com>
>>>>>>
>>>>>> Add initial support for the Synopsys DesignWare HDMI RX
>>>>>> Controller Driver used by Rockchip RK3588. The driver
>>>>>> supports:
>>>>>> - HDMI 1.4b and 2.0 modes (HDMI 4k@60Hz)
>>>>>> - RGB888, YUV422, YUV444 and YCC420 pixel formats
>>>>>> - CEC
>>>>>> - EDID configuration
>>>>>>
>>>>>> The hardware also has Audio and HDCP capabilities, but these are
>>>>>> not yet supported by the driver.
>>>>>>
>>>>>> Co-developed-by: Dingxian Wen <shawn.wen@rock-chips.com>
>>>>>> Signed-off-by: Dingxian Wen <shawn.wen@rock-chips.com>
>>>>>> Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>
>>>>>> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
>>>>>> ---
>>>>>> drivers/media/platform/Kconfig | 1 +
>>>>>> drivers/media/platform/Makefile | 1 +
>>>>>> drivers/media/platform/synopsys/Kconfig | 3 +
>>>>>> drivers/media/platform/synopsys/Makefile | 2 +
>>>>>> .../media/platform/synopsys/hdmirx/Kconfig | 27 +
>>>>>> .../media/platform/synopsys/hdmirx/Makefile | 4 +
>>>>>> .../platform/synopsys/hdmirx/snps_hdmirx.c | 2715 +++++++++++++++++
>>>>>> .../platform/synopsys/hdmirx/snps_hdmirx.h | 394 +++
>>>>>> .../synopsys/hdmirx/snps_hdmirx_cec.c | 284 ++
>>>>>> .../synopsys/hdmirx/snps_hdmirx_cec.h | 44 +
>>>>>> 10 files changed, 3475 insertions(+)
>>>>>> create mode 100644 drivers/media/platform/synopsys/Kconfig
>>>>>> create mode 100644 drivers/media/platform/synopsys/Makefile
>>>>>> create mode 100644 drivers/media/platform/synopsys/hdmirx/Kconfig
>>>>>> create mode 100644 drivers/media/platform/synopsys/hdmirx/Makefile
>>>>>> create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
>>>>>> create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h
>>>>>> create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c
>>>>>> create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h
>>>>>>
>>>>>
>>>>> <snip>
>>>>>
>>>>>> +static ssize_t
>>>>>> +hdmirx_debugfs_if_read(u32 type, void *priv, struct file *filp,
>>>>>> + char __user *ubuf, size_t count, loff_t *ppos)
>>>>>> +{
>>>>>> + struct snps_hdmirx_dev *hdmirx_dev = priv;
>>>>>> + u8 aviif[3 + 7 * 4];
>>>>>> + int len;
>>>>>> +
>>>>>> + if (type != V4L2_DEBUGFS_IF_AVI)
>>>>>> + return 0;
>>>>>> +
>>>>>> + hdmirx_read_avi_infoframe(hdmirx_dev, aviif);
>>>>>> +
>>>>>> + len = simple_read_from_buffer(ubuf, count, ppos,
>>>>>> + aviif, ARRAY_SIZE(aviif));
>>>>>> +
>>>>>> + return len < 0 ? 0 : len;
>>>>>> +}
>>>>>
>>>>> Have you tested this with 'edid-decode -c -I /path/to/avi'? Also test that it is
>>>>> empty if there is no AVI InfoFrame (e.g. when there is no incoming video). I don't see
>>>>> a test for that in the code.
>>>>>
>>>>> I also see no sanity check regarding the length of the InfoFrame, it just outputs
>>>>> the full array, meaning you get padding as well since the AVI InfoFrame is smaller
>>>>> than ARRAY_SIZE(aviif). In fact, edid-decode will fail about that if the -c option
>>>>> is used.
>>>>>
>>>>> See tc358743_debugfs_if_read of how this is typically handled.
>>>>
>>>> I've tested with 'edid-decode -I /path/to/avi', including the empty AVI
>>>> InfoFrame. But without the '-c option'. I'd expect that debugfs should
>>>> provide a full-sized raw InfoFrame data, rather than a parsed version.
>>>> The parsed data isn't much useful for debugging purposes, IMO. I
>>>> intentionally removed the size check that tc358743_debugfs_if_read does
>>>> because it appeared wrong to me. Will re-check with '-c option', thanks!
>>>
>>> The HDMI header contains the actual length that was received. So debugfs should
>>> export the actual payload, not the maximum possible payload.
>>>
>>> It is common for hardware to reserve room in the register map for the maximum
>>> payload, but you only want to export what was actually received.
>>
>> If payload is corrupted, it should be handy to see a full payload.
>> Otherwise you won't be able to debug anything because driver returns
>> zero payload to userspace since it can't parse the header :)
>
> Note those tc358743 and other drivers are parsing the IF header data.
> I'm pretty sure this is not what InfoFrame debugfs is intended to do,
It's exactly what it is intended to do (I know, I wrote it :-) ).
The HDMI interface transmits the InfoFrame data with that HDMI header, the
receiver captures that and stores the InfoFrame data. You have no control
over that, it is all implemented in hardware since it is transmitted over
the high-speed video lanes. If the header is corrupt, then the video is
almost certainly also corrupt.
The reason for storing the InfoFrame in debugfs is to see what the transmitter
is sending us in the InfoFrame: does the InfoFrame contents make sense? Is it
consistent with the EDID?
If for example the transmitter is sending us a video format that isn't supported
in the EDID, then it is helpful to see what the AVI InfoFrame says.
Regards,
Hans
> Will revisit it all again in a more details for v7.
>
next prev parent reply other threads:[~2025-02-17 18:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-15 21:04 [PATCH v6 0/6] Add Synopsys DesignWare HDMI RX Controller Dmitry Osipenko
2025-02-15 21:04 ` [PATCH v6 1/6] MAINTAINERS: Add entry for Synopsys DesignWare HDMI RX Driver Dmitry Osipenko
2025-02-15 21:04 ` [PATCH v6 2/6] dt-bindings: media: Document bindings for HDMI RX Controller Dmitry Osipenko
2025-02-15 21:04 ` [PATCH v6 3/6] arm64: dts: rockchip: Add device tree support " Dmitry Osipenko
2025-02-15 21:04 ` [PATCH v6 4/6] media: platform: synopsys: Add support for HDMI input driver Dmitry Osipenko
2025-02-17 8:31 ` Hans Verkuil
2025-02-17 15:36 ` Dmitry Osipenko
2025-02-17 15:44 ` Hans Verkuil
2025-02-17 18:21 ` Dmitry Osipenko
2025-02-17 18:26 ` Dmitry Osipenko
2025-02-17 18:45 ` Hans Verkuil [this message]
2025-02-15 21:04 ` [PATCH v6 5/6] arm64: defconfig: Enable Synopsys HDMI receiver Dmitry Osipenko
2025-02-15 21:04 ` [PATCH v6 6/6] arm64: dts: rockchip: Enable HDMI receiver on rock-5b Dmitry Osipenko
2025-02-17 8:34 ` [PATCH v6 0/6] Add Synopsys DesignWare HDMI RX Controller Hans Verkuil
2025-02-17 18:16 ` 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=3e8a6fea-0ee9-4667-b8a9-8f2f02df3c91@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.osipenko@collabora.com \
--cc=heiko@sntech.de \
--cc=jose.abreu@synopsys.com \
--cc=kernel@collabora.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=me@timsurber.de \
--cc=nelson.costa@synopsys.com \
--cc=nicolas.dufresne@collabora.com \
--cc=robh@kernel.org \
--cc=sebastian.reichel@collabora.com \
--cc=shawn.wen@rock-chips.com \
--cc=shreeya.patel@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
all inboxes | Powered by JetHome®