From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v2 2/4] media: v4l: fwnode: Parse MiPI DisCo for C-PHY line-orders
Date: Sat, 4 Jan 2025 13:17:56 +0100 [thread overview]
Message-ID: <20250104121756.GG808684@ragnatech.se> (raw)
In-Reply-To: <CAMuHMdXwqb7vhUeoMKDDJO5dp-V3LmnURZLSC1_ko=YL=cNyUA@mail.gmail.com>
Hi Geert,
Thanks for your review.
On 2024-12-27 14:31:11 +0100, Geert Uytterhoeven wrote:
> Hi Niklas,
>
> On Thu, Nov 21, 2024 at 2:41 PM Niklas Söderlund
> <niklas.soderlund+renesas@ragnatech.se> wrote:
> > Extend the fwnode parsing to validate and fill in the CSI-2 C-PHY
> > line-orders order properties as defined in MIPI Discovery and
> > Configuration (DisCo) Specification for Imaging.
> >
> > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> > ---
> > * Changes since v1
> > - Use array instead of switch to get printable line order string for
> > debug output.
> > - Wrap lines harder for 80 chars instead of 100, but keep string formats
> > on same line even if they break the 80 chars.
>
> Thanks for your patch, which is now commit 573b4adddbd22baf
> ("media: v4l: fwnode: Parse MiPI DisCo for C-PHY line-orders") in
> media/master.
>
> > --- a/drivers/media/v4l2-core/v4l2-fwnode.c
> > +++ b/drivers/media/v4l2-core/v4l2-fwnode.c
> > @@ -250,6 +261,36 @@ static int v4l2_fwnode_endpoint_parse_csi2_bus(struct fwnode_handle *fwnode,
> > } else {
> > pr_debug("no lane polarities defined, assuming not inverted\n");
> > }
> > +
> > + if (have_line_orders) {
> > + fwnode_property_read_u32_array(fwnode,
> > + "line-orders", array,
> > + num_data_lanes);
> > +
> > + for (i = 0; i < num_data_lanes; i++) {
> > + static const char * const orders[] = {
> > + "ABC", "ACB", "BAC", "BCA", "CAB", "CBA"
> > + };
> > +
> > + if (array[i] > 5) {
> > + pr_warn("lane %u invalid line-order assuming ABC (got %u)\n",
> > + i, array[i]);
> > + bus->line_orders[i] =
> > + V4L2_MBUS_CSI2_CPHY_LINE_ORDER_ABC;
> > + continue;
> > + }
> > +
> > + bus->line_orders[i] = array[i];
>
> This does not do any translation (unlike v4l2_fwnode_bus_type_to_mbus()
> to translate from MEDIA_BUS_TYPE_* to V4L2_MBUS_* definitions) ...
>
> > + pr_debug("lane %u line order %s", i,
> > + orders[array[i]]);
> > + }
> > + } else {
> > + for (i = 0; i < num_data_lanes; i++)
> > + bus->line_orders[i] =
> > + V4L2_MBUS_CSI2_CPHY_LINE_ORDER_ABC;
> > +
> > + pr_debug("no line orders defined, assuming ABC\n");
> > + }
> > }
> >
> > return 0;
> > diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
> > index 5bce6e423e94..e7f019f68c8d 100644
> > --- a/include/media/v4l2-mediabus.h
> > +++ b/include/media/v4l2-mediabus.h
> > @@ -73,6 +73,24 @@
> >
> > #define V4L2_MBUS_CSI2_MAX_DATA_LANES 8
> >
> > +/**
> > + * enum v4l2_mbus_csi2_cphy_line_orders_type - CSI-2 C-PHY line order
> > + * @V4L2_MBUS_CSI2_CPHY_LINE_ORDER_ABC: C-PHY line order ABC (default)
> > + * @V4L2_MBUS_CSI2_CPHY_LINE_ORDER_ACB: C-PHY line order ACB
> > + * @V4L2_MBUS_CSI2_CPHY_LINE_ORDER_BAC: C-PHY line order BAC
> > + * @V4L2_MBUS_CSI2_CPHY_LINE_ORDER_BCA: C-PHY line order BCA
> > + * @V4L2_MBUS_CSI2_CPHY_LINE_ORDER_CAB: C-PHY line order CAB
> > + * @V4L2_MBUS_CSI2_CPHY_LINE_ORDER_CBA: C-PHY line order CBA
> > + */
> > +enum v4l2_mbus_csi2_cphy_line_orders_type {
> > + V4L2_MBUS_CSI2_CPHY_LINE_ORDER_ABC,
> > + V4L2_MBUS_CSI2_CPHY_LINE_ORDER_ACB,
> > + V4L2_MBUS_CSI2_CPHY_LINE_ORDER_BAC,
> > + V4L2_MBUS_CSI2_CPHY_LINE_ORDER_BCA,
> > + V4L2_MBUS_CSI2_CPHY_LINE_ORDER_CAB,
> > + V4L2_MBUS_CSI2_CPHY_LINE_ORDER_CBA,
> > +};
>
> ... hence these values must be identical to the corresponding
> MEDIA_BUS_CSI2_CPHY_LINE_ORDER_* in
> include/dt-bindings/media/video-interfaces.h.
> So please provide a safe-guard to make sure they do not become out
> of sync.
This is a good point, I will create a follow up patch to address this.
Thanks for spotting it!
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
--
Kind Regards,
Niklas Söderlund
next prev parent reply other threads:[~2025-01-04 12:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-21 13:41 [PATCH v2 0/4] media: v4l: fwnode: Add support for CSI-2 C-PHY line orders Niklas Söderlund
2024-11-21 13:41 ` [PATCH v2 1/4] media: dt-bindings: Add property to describe " Niklas Söderlund
2024-11-27 13:30 ` Rob Herring (Arm)
2024-11-21 13:41 ` [PATCH v2 2/4] media: v4l: fwnode: Parse MiPI DisCo for C-PHY line-orders Niklas Söderlund
2024-12-12 7:25 ` Sakari Ailus
2024-12-12 10:00 ` Niklas Söderlund
2024-12-27 13:31 ` Geert Uytterhoeven
2025-01-04 12:17 ` Niklas Söderlund [this message]
2024-11-21 13:41 ` [PATCH v2 3/4] arm64: dts: renesas: white-hawk-csi-dsi: Define CSI-2 data line orders Niklas Söderlund
2024-12-27 13:22 ` Geert Uytterhoeven
2025-01-04 12:17 ` Niklas Söderlund
2025-01-06 9:45 ` Geert Uytterhoeven
2025-01-06 10:02 ` Niklas Söderlund
2025-01-06 10:47 ` Niklas Söderlund
2024-11-21 13:41 ` [PATCH v2 4/4] media: rcar-csi2: Allow specifying C-PHY line order Niklas Söderlund
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=20250104121756.GG808684@ragnatech.se \
--to=niklas.soderlund+renesas@ragnatech.se \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.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