All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Harvey <tharvey@gateworks.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	 Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Adam Ford <aford173@gmail.com>,
	arm-soc <linux-arm-kernel@lists.infradead.org>,
	 Schrempf Frieder <frieder.schrempf@kontron.de>,
	linux-media <linux-media@vger.kernel.org>,
	 Adam Ford-BE <aford@beaconembedded.com>,
	cstevens@beaconembedded.com,
	 Jagan Teki <jagan@amarulasolutions.com>,
	Rob Herring <robh+dt@kernel.org>,
	 Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	 Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	 NXP Linux Team <linux-imx@nxp.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	 Will Deacon <will@kernel.org>,
	Lucas Stach <l.stach@pengutronix.de>, Peng Fan <peng.fan@nxp.com>,
	devicetree <devicetree@vger.kernel.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: (EXT) Re: [PATCH V2 4/5] arm64: dts: imx8mm-beacon: Enable OV5640 Camera
Date: Mon, 29 Nov 2021 10:56:45 -0800	[thread overview]
Message-ID: <CAJ+vNU3BtKABmBNcqdcrXmmqHzkoOZ9hJwEhC11WLh4w2popyA@mail.gmail.com> (raw)
In-Reply-To: <YZy4nFgkIyNXpIo3@pendragon.ideasonboard.com>

On Tue, Nov 23, 2021 at 1:47 AM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi Alexander,
>
> On Tue, Nov 23, 2021 at 08:38:47AM +0100, Alexander Stein wrote:
> > Am Dienstag, dem 23.11.2021 um 02:15 +0200 schrieb Laurent Pinchart:
> > > On Sun, Nov 21, 2021 at 09:07:26PM -0600, Adam Ford wrote:
> > > > On Sun, Nov 21, 2021 at 5:18 PM Laurent Pinchart wrote:
> > > > > On Sat, Nov 06, 2021 at 10:54:26AM -0500, Adam Ford wrote:
> > > > > > The baseboard has support for a TDNext 5640 Camera which
> > > > > > uses an OV5640 connected to a 2-lane CSI2 interface.
> > > > > >
> > > > > > With the CSI and mipi_csi2 drivers pointing to an OV5640 camera, the media
> > > > > > pipeline can be configured with the following:
> > > > > >
> > > > > >     media-ctl --links "'ov5640 1-003c':0->'imx7-mipi-csis.0':0[1]"
> > > > > >
> > > > > > The camera and various nodes in the pipeline can be configured for UYVY:
> > > > > >     media-ctl -v -V "'ov5640 1-003c':0 [fmt:UYVY8_1X16/640x480 field:none]"
> > > > > >     media-ctl -v -V "'csi':0 [fmt:UYVY8_1X16/640x480 field:none]"
> > > > > >
> > > > > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > > > >
> > > > > As the ov5640 is on an add-on module, would a DT overlay be better ?
> > > >
> > > > At least for the Beacon / LogicPD boards, I would prefer to avoid the
> > > > overlays.  We have an i.M6Q and an OMAP3 board with cameras enabled in
> > > > our development kit device trees.  If the cameras are not connected,
> > > > they just display a message that the cameras are not communicating and
> > > > move on.  I'm OK with that.
> > >
> > > You know the board better than I do, so I won't push against this, but I
> > > still think it may not lead to the best user experience, especially if a
> > > user wanted to connect a different sensor to the development board.
> >
> > I see the advantages of overlays compared to "stacked" .dts files. But
> > is there any general supported interface how to actually apply an overlay?
> > Documentation/devicetree/overlay-notes.rst
> > states of_overlay_fdt_apply() but there is only exactly one user in-
> > kernel (rcar-du). Is it expected that the bootloader like u-boot shall
> > apply the .dtbo files?
>
> I believe the boot loader is expected to apply overlays nowadays, yes.
> That's my personal workflow.
>

That is my understanding as well. I believe the support to apply dt
overlays within Linux (which the rpi kernel still uses) never got
merged due to race conditions so the focus was moved to bootloader.

I also have begun submitting some dt overlay files [1] [2] which I
will likely repost later this week removing the RFC.

My understanding is that these should be '.dtbo' files in the Linux
Makefile which are handled. My boards use the U-Boot bootloader and to
handle the dt overlays there you need to:
- set CONFIG_OF_LIBFDT_OVERLAY=y which gives you the 'fdt apply' command
- use 'fdt addr <addr> && fdt resize && fdt apply <loadaddr>' prior to
booting with booti
- Note that there is some support at the FIT level as well for
overlays if you need them applied to U-Boot's live dt (I don't for my
needs)

In my U-Boot environment I use scripts for loading the fdt and
applying the overlays. For example for booting kernel/dtb from network
I use:
boot_net setenv fsload tftpboot; run loadfdt && run apply_overlays &&
$fsload $kernel_addr_r venice/Image && booti $kernel_addr_r -
$fdt_addr_r
loadfdt if $fsload $fdt_addr_r $dir/$fdt_file1; then echo loaded
$fdt_file1; elif $fsload $fdt_addr_r $dir/$fdt_file2; then echo loaded
$fdt_file2; elif $fsload $fdt_addr_r $dir/$fdt_file3; then echo loaded
$fdt_file3; elif $fsload $fdt_addr_r $dir/$fdt_file4; then echo loaded
$fdt_file4; elif $fsload $fdt_addr_r $dir/$fdt_file5; then echo loaded
$fdt_file5; fi
apply_overlays fdt addr $fdt_addr_r && fdt resize && for i in
"$fdt_overlays"; do $fsload $loadaddr $dir/$i && fdt apply $loadaddr
&& echo applied $i...; done

Best regards,

Tim
[1] https://www.spinics.net/lists/arm-kernel/msg933447.html
[2] https://www.spinics.net/lists/arm-kernel/msg933638.html

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Tim Harvey <tharvey@gateworks.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Adam Ford <aford173@gmail.com>,
	arm-soc <linux-arm-kernel@lists.infradead.org>,
	Schrempf Frieder <frieder.schrempf@kontron.de>,
	linux-media <linux-media@vger.kernel.org>,
	Adam Ford-BE <aford@beaconembedded.com>,
	cstevens@beaconembedded.com,
	Jagan Teki <jagan@amarulasolutions.com>,
	Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Lucas Stach <l.stach@pengutronix.de>, Peng Fan <peng.fan@nxp.com>,
	devicetree <devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: (EXT) Re: [PATCH V2 4/5] arm64: dts: imx8mm-beacon: Enable OV5640 Camera
Date: Mon, 29 Nov 2021 10:56:45 -0800	[thread overview]
Message-ID: <CAJ+vNU3BtKABmBNcqdcrXmmqHzkoOZ9hJwEhC11WLh4w2popyA@mail.gmail.com> (raw)
In-Reply-To: <YZy4nFgkIyNXpIo3@pendragon.ideasonboard.com>

On Tue, Nov 23, 2021 at 1:47 AM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi Alexander,
>
> On Tue, Nov 23, 2021 at 08:38:47AM +0100, Alexander Stein wrote:
> > Am Dienstag, dem 23.11.2021 um 02:15 +0200 schrieb Laurent Pinchart:
> > > On Sun, Nov 21, 2021 at 09:07:26PM -0600, Adam Ford wrote:
> > > > On Sun, Nov 21, 2021 at 5:18 PM Laurent Pinchart wrote:
> > > > > On Sat, Nov 06, 2021 at 10:54:26AM -0500, Adam Ford wrote:
> > > > > > The baseboard has support for a TDNext 5640 Camera which
> > > > > > uses an OV5640 connected to a 2-lane CSI2 interface.
> > > > > >
> > > > > > With the CSI and mipi_csi2 drivers pointing to an OV5640 camera, the media
> > > > > > pipeline can be configured with the following:
> > > > > >
> > > > > >     media-ctl --links "'ov5640 1-003c':0->'imx7-mipi-csis.0':0[1]"
> > > > > >
> > > > > > The camera and various nodes in the pipeline can be configured for UYVY:
> > > > > >     media-ctl -v -V "'ov5640 1-003c':0 [fmt:UYVY8_1X16/640x480 field:none]"
> > > > > >     media-ctl -v -V "'csi':0 [fmt:UYVY8_1X16/640x480 field:none]"
> > > > > >
> > > > > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > > > >
> > > > > As the ov5640 is on an add-on module, would a DT overlay be better ?
> > > >
> > > > At least for the Beacon / LogicPD boards, I would prefer to avoid the
> > > > overlays.  We have an i.M6Q and an OMAP3 board with cameras enabled in
> > > > our development kit device trees.  If the cameras are not connected,
> > > > they just display a message that the cameras are not communicating and
> > > > move on.  I'm OK with that.
> > >
> > > You know the board better than I do, so I won't push against this, but I
> > > still think it may not lead to the best user experience, especially if a
> > > user wanted to connect a different sensor to the development board.
> >
> > I see the advantages of overlays compared to "stacked" .dts files. But
> > is there any general supported interface how to actually apply an overlay?
> > Documentation/devicetree/overlay-notes.rst
> > states of_overlay_fdt_apply() but there is only exactly one user in-
> > kernel (rcar-du). Is it expected that the bootloader like u-boot shall
> > apply the .dtbo files?
>
> I believe the boot loader is expected to apply overlays nowadays, yes.
> That's my personal workflow.
>

That is my understanding as well. I believe the support to apply dt
overlays within Linux (which the rpi kernel still uses) never got
merged due to race conditions so the focus was moved to bootloader.

I also have begun submitting some dt overlay files [1] [2] which I
will likely repost later this week removing the RFC.

My understanding is that these should be '.dtbo' files in the Linux
Makefile which are handled. My boards use the U-Boot bootloader and to
handle the dt overlays there you need to:
- set CONFIG_OF_LIBFDT_OVERLAY=y which gives you the 'fdt apply' command
- use 'fdt addr <addr> && fdt resize && fdt apply <loadaddr>' prior to
booting with booti
- Note that there is some support at the FIT level as well for
overlays if you need them applied to U-Boot's live dt (I don't for my
needs)

In my U-Boot environment I use scripts for loading the fdt and
applying the overlays. For example for booting kernel/dtb from network
I use:
boot_net setenv fsload tftpboot; run loadfdt && run apply_overlays &&
$fsload $kernel_addr_r venice/Image && booti $kernel_addr_r -
$fdt_addr_r
loadfdt if $fsload $fdt_addr_r $dir/$fdt_file1; then echo loaded
$fdt_file1; elif $fsload $fdt_addr_r $dir/$fdt_file2; then echo loaded
$fdt_file2; elif $fsload $fdt_addr_r $dir/$fdt_file3; then echo loaded
$fdt_file3; elif $fsload $fdt_addr_r $dir/$fdt_file4; then echo loaded
$fdt_file4; elif $fsload $fdt_addr_r $dir/$fdt_file5; then echo loaded
$fdt_file5; fi
apply_overlays fdt addr $fdt_addr_r && fdt resize && for i in
"$fdt_overlays"; do $fsload $loadaddr $dir/$i && fdt apply $loadaddr
&& echo applied $i...; done

Best regards,

Tim
[1] https://www.spinics.net/lists/arm-kernel/msg933447.html
[2] https://www.spinics.net/lists/arm-kernel/msg933638.html

  reply	other threads:[~2021-11-29 19:03 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-06 15:54 [PATCH V2 1/5] soc: imx: imx8m-blk-ctrl: Fix imx8mm mipi reset Adam Ford
2021-11-06 15:54 ` Adam Ford
2021-11-06 15:54 ` [PATCH V2 2/5] arm64: dts: imx8mm: Add CSI nodes Adam Ford
2021-11-06 15:54   ` Adam Ford
2021-11-07 12:58   ` Fabio Estevam
2021-11-07 12:58     ` Fabio Estevam
2021-11-06 15:54 ` [PATCH V2 3/5] arm64: defconfig: Enable VIDEO_IMX_MEDIA Adam Ford
2021-11-06 15:54   ` Adam Ford
2021-11-07 13:01   ` Fabio Estevam
2021-11-07 13:01     ` Fabio Estevam
2021-11-06 15:54 ` [PATCH V2 4/5] arm64: dts: imx8mm-beacon: Enable OV5640 Camera Adam Ford
2021-11-06 15:54   ` Adam Ford
2021-11-07 13:01   ` Fabio Estevam
2021-11-07 13:01     ` Fabio Estevam
2021-11-21 23:18   ` Laurent Pinchart
2021-11-21 23:18     ` Laurent Pinchart
2021-11-22  3:07     ` Adam Ford
2021-11-22  3:07       ` Adam Ford
2021-11-23  0:15       ` Laurent Pinchart
2021-11-23  0:15         ` Laurent Pinchart
2021-11-23  7:38         ` (EXT) " Alexander Stein
2021-11-23  7:38           ` Alexander Stein
2021-11-23  9:47           ` Laurent Pinchart
2021-11-23  9:47             ` Laurent Pinchart
2021-11-29 18:56             ` Tim Harvey [this message]
2021-11-29 18:56               ` Tim Harvey
2021-11-06 15:54 ` [PATCH V2 5/5] arm64: defconfig: Enable OV5640 Adam Ford
2021-11-06 15:54   ` Adam Ford
2021-11-07 13:03   ` Fabio Estevam
2021-11-07 13:03     ` Fabio Estevam
2021-11-07 12:58 ` [PATCH V2 1/5] soc: imx: imx8m-blk-ctrl: Fix imx8mm mipi reset Fabio Estevam
2021-11-07 12:58   ` Fabio Estevam
2021-11-08  8:56 ` Lucas Stach
2021-11-08  8:56   ` Lucas Stach
2021-11-12  6:54 ` Jagan Teki
2021-11-12  6:54   ` Jagan Teki
2021-11-19 23:51   ` Tim Harvey
2021-11-19 23:51     ` Tim Harvey
2021-11-20 18:33     ` Adam Ford
2021-11-20 18:33       ` Adam Ford
2021-11-21 23:13       ` Laurent Pinchart
2021-11-21 23:13         ` Laurent Pinchart
2021-11-21 22:25 ` Laurent Pinchart
2021-11-21 22:25   ` Laurent Pinchart
2021-11-21 22:30   ` Laurent Pinchart
2021-11-21 22:30     ` Laurent Pinchart
2021-11-23 13:59   ` Adam Ford
2021-11-23 13:59     ` Adam Ford
2021-11-25  5:42     ` Jagan Teki
2021-11-25  5:42       ` Jagan Teki
2021-11-25 15:18       ` Adam Ford
2021-11-25 15:18         ` Adam Ford
2021-11-26  0:33         ` Laurent Pinchart
2021-11-26  0:33           ` Laurent Pinchart
2021-11-27 13:50           ` Adam Ford
2021-11-27 13:50             ` Adam Ford
2021-11-27 15:02             ` Laurent Pinchart
2021-11-27 15:02               ` Laurent Pinchart

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=CAJ+vNU3BtKABmBNcqdcrXmmqHzkoOZ9hJwEhC11WLh4w2popyA@mail.gmail.com \
    --to=tharvey@gateworks.com \
    --cc=aford173@gmail.com \
    --cc=aford@beaconembedded.com \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=catalin.marinas@arm.com \
    --cc=cstevens@beaconembedded.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=frieder.schrempf@kontron.de \
    --cc=jagan@amarulasolutions.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=will@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.