From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Matthias Weißer" <m.weisser.m@gmail.com>
Cc: linux-media@vger.kernel.org, Rui Miguel Silva <rmfrfs@gmail.com>,
Purism Kernel Team <kernel@puri.sm>,
Martin Kepplinger <martin.kepplinger@puri.sm>
Subject: Re: imx7-media-csi: Adding BT656 format
Date: Tue, 2 Dec 2025 01:23:49 +0900 [thread overview]
Message-ID: <20251201162349.GC32430@pendragon.ideasonboard.com> (raw)
In-Reply-To: <CAO8h3eEz=-LfrHcsGMcQ3kQHZKZgkQw9gwygBmeC1ASdMHg3YQ@mail.gmail.com>
Hi Matthias,
On Tue, Nov 18, 2025 at 04:39:57PM +0100, Matthias Weißer wrote:
> Hi
>
> I am hoping for some basic help here regarding a feature I want to add to
> to imx7-media-csi.c.
>
> (taking the maintainers in CC, hoping this is okay)
>
> If this is not the right place to ask my stupid questions please advice.
This is the right place, and your question isn't stupid.
> I have a custom board with a TW9990 analog video decoder connected
> to an iMX6SX. For the TW9990 I use a slightly modified version of
> tw9910.c. I use the following DT:
>
> &i2c3 {
> tvin1@44 {
> compatible = "renesas,tw9990";
> reg = <0x44>;
>
> port {
> tw9990_1_to_parallel: endpoint {
> remote-endpoint = <¶llel_from_tw9990_1>;
> bus-width = <8>;
> data-shift = <2>; /* your board wiring */
> hsync-active = <0>;
> vsync-active = <0>;
> pclk-sample = <1>;
> bus-type = <MEDIA_BUS_TYPE_BT656>;
> };
> };
> };
> };
>
> &csi1 {
> pinctrl-names = "default";
> pinctrl-0 = <&pinctrl_csi1>;
> status = "okay";
>
> port {
> parallel_from_tw9990_1: endpoint {
> remote-endpoint = <&tw9990_1_to_parallel>;
> bus-width = <8>;
> bus-type = <MEDIA_BUS_TYPE_BT656>;
> };
> };
> };
>
> Issuing this command
>
> # v4l2-ctl -d /dev/video0 --stream-mmap --stream-count=50 --stream-to=frame.raw
>
> enables the TW9990 and it starts streaming the analog video signal in
> BT656 format to the iMX. I verified that using an osscilloscope.
> But I see no interrupt generated by the CSI module. I am sure I have to
> add BT656 format handling to the driver but have no idea where to start.
The driver indeed doesn't seem to support BT656.
> I have also verified that the hardware is working correctly by implementing
> a simple capture driver, not in the context of v4l2, but with my own very
> hakish uio implementation.
Does that mean that you know what register values to set to get it
working ? If so things shouldn't be too difficult. The driver should
call v4l2_fwnode_endpoint_parse() to parse the endpoint and get the bus
type (external sync or BT656). The information should be stored in the
imx7_csi structure, and the registers should then be configured
accordingly (likely in imx7_csi_configure()).
Interlaced mode seems to be implemented in the driver, so if you're
lucky the above will be all you need. If there are issues with the
interlace implementation (I don't think it has been tested as
extensively as progressive mode) then more work may be required.
> Some maybe helpful outputs:
>
> # media-ctl -v -p
> Opening media device /dev/media0
> Enumerating entities
> looking up device: 81:1
> looking up device: 81:0
> looking up device: 81:2
> Found 3 entities
> Enumerating pads and links
> Media controller API version 6.6.52
>
> Media device information
> ------------------------
> driver imx7-csi
> model imx-media
> serial
> bus info platform:2214000.csi
> hw revision 0x0
> driver version 6.6.52
>
> Device topology
> Streams API not supported
> - entity 1: csi (2 pads, 2 links, 0 routes)
> type V4L2 subdev subtype Unknown flags 0
> device node name /dev/v4l-subdev0
> pad0: SINK
> [stream:0 fmt:UYVY8_2X8/640x480 field:none
> colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]
> <- "tw9910 2-0044":0 [ENABLED,IMMUTABLE]
> pad1: SOURCE
> [stream:0 fmt:UYVY8_2X8/640x480 field:none
> colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]
> -> "csi capture":0 [ENABLED,IMMUTABLE]
>
> - entity 4: csi capture (1 pad, 1 link)
> type Node subtype V4L flags 0
> device node name /dev/video0
> pad0: SINK
> <- "csi":1 [ENABLED,IMMUTABLE]
>
> Streams API not supported
> - entity 10: tw9910 2-0044 (1 pad, 1 link, 0 routes)
> type V4L2 subdev subtype Decoder flags 0
> device node name /dev/v4l-subdev1
> pad0: SOURCE
> [stream:0 fmt:UYVY8_2X8/640x480 field:interlaced-bt
> colorspace:smpte170m
> crop.bounds:(0,0)/640x480
> crop:(0,0)/640x480]
> -> "csi":0 [ENABLED,IMMUTABLE]
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2025-12-01 16:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 15:39 imx7-media-csi: Adding BT656 format Matthias Weißer
2025-12-01 16:23 ` Laurent Pinchart [this message]
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=20251201162349.GC32430@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=kernel@puri.sm \
--cc=linux-media@vger.kernel.org \
--cc=m.weisser.m@gmail.com \
--cc=martin.kepplinger@puri.sm \
--cc=rmfrfs@gmail.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