Re: [PATCH v7 11/12] media: Add subdevice driver for the Mstar MST3367 HDMI receiver

From: Hans Verkuil

Date: Wed Nov 25 2026 - 08:25:30 EST


Hi Matthew,

On 21/11/2026 04:55, Matthew Laux wrote:
> Implement a V4L2 subdevice driver for the MST3367. This was developed
> through reverse engineering the Windows driver, and capturing USB packets.
> The driver supports both HDMI and analog component inputs. YPbPr and RGB
> HDMI sources have been tested. I also added a couple custom DV timings
> for non-interlaced 240p and 288p over component, which are also tested and
> working with this chip.
>
> I tested this with a ThinkPad's video output, MacBook (10-bit deep color),
> Nintendo Switch (both full and limited range) and PS4 720p/1080i/1080p.

Nice work!

There is just one issue with InfoFrames:

>
> Signed-off-by: Matthew Laux <matthew.laux@xxxxxxxxx>
> ---
> MAINTAINERS | 7 +
> drivers/media/i2c/Kconfig | 11 +
> drivers/media/i2c/Makefile | 1 +
> drivers/media/i2c/mst3367.c | 1134 +++++++++++++++++++++++++++++++++++
> include/media/i2c/mst3367.h | 27 +
> 5 files changed, 1180 insertions(+)
> create mode 100644 drivers/media/i2c/mst3367.c
> create mode 100644 include/media/i2c/mst3367.h
>

<snip>

> diff --git a/drivers/media/i2c/mst3367.c b/drivers/media/i2c/mst3367.c
> new file mode 100644
> index 000000000000..0d71807a2a5d
> --- /dev/null
> +++ b/drivers/media/i2c/mst3367.c

<snip>

> +/*
> + * Fill @avi from the AVI InfoFrame registers. Returns -ENODATA if no
> + * InfoFrame has been received, e.g. from a DVI source.
> + */
> +static int mst3367_read_avi(struct mst3367 *mst,
> + struct hdmi_avi_infoframe *avi)
> +{
> + u8 pb[5];
> + int k, ret;
> +
> + ret = mst_bank(mst, 0x02);
> + if (ret)
> + return ret;
> +
> + ret = mst3367_read(mst, MST3367_PKT_STATUS);
> + if (ret < 0)
> + return ret;
> + if (!(ret & MST3367_PKT_STATUS_AVI))
> + return -ENODATA;
> +
> + for (k = 0; k < ARRAY_SIZE(pb); k++) {
> + ret = mst3367_read(mst, MST3367_AVI_PB1 + k);
> + if (ret < 0)
> + return ret;
> + pb[k] = ret;
> + }
> +
> + avi->colorspace = (pb[0] >> 5) & 0x3;
> + avi->colorimetry = (pb[1] >> 6) & 0x3;
> + avi->itc = !!(pb[2] & BIT(7));
> + avi->extended_colorimetry = (pb[2] >> 4) & 0x7;
> + avi->quantization_range = (pb[2] >> 2) & 0x3;
> + avi->video_code = pb[3];
> + avi->ycc_quantization_range = (pb[4] >> 6) & 0x3;
> + avi->content_type = (pb[4] >> 4) & 0x3;
> + avi->pixel_repeat = pb[4] & 0xf;

InfoFrame data must also be exported to debugfs. See v4l2_debugfs_if_alloc etc.
in v4l2-dv-timings.h.

It's implemented in most/all HDMI receivers, so you can take a look at how it is
done.

The exported InfoFrame data can be parsed by edid-decode.

> +
> + return 0;
> +}
> +
Regards,

Hans