From: Frank Li <Frank.li@nxp.com>
To: Michael Riesch <michael.riesch@collabora.com>
Cc: Chaoyi Chen <chaoyi.chen@rock-chips.com>,
Kever Yang <kever.yang@rock-chips.com>,
Mehdi Djait <mehdi.djait@linux.intel.com>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Hans Verkuil <hverkuil@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
Philipp Zabel <p.zabel@pengutronix.de>,
Sebastian Reichel <sebastian.reichel@collabora.com>,
Nicolas Dufresne <nicolas.dufresne@collabora.com>,
Collabora Kernel Team <kernel@collabora.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/3] media: synopsys: add driver for the designware mipi csi-2 receiver
Date: Mon, 19 Jan 2026 10:35:08 -0500 [thread overview]
Message-ID: <aW5PLIv2w+OY7xJD@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <db2f0c20-ca7e-41c9-be08-67fd1f92c2af@collabora.com>
On Mon, Jan 19, 2026 at 10:49:20AM +0100, Michael Riesch wrote:
> Hi Frank,
>
> Thanks for your review.
>
> On 1/16/26 17:08, Frank Li wrote:
> > On Fri, Jan 16, 2026 at 02:02:47PM +0100, Michael Riesch wrote:
> >> The Synopsys DesignWare MIPI CSI-2 Receiver is a CSI-2 bridge with
> >> one input port and one output port. It receives the data with the
> >> help of an external MIPI PHY (C-PHY or D-PHY) and passes it to e.g.,
> >> the Rockchip Video Capture (VICAP) block on recent Rockchip SoCs.
> >>
> >> Add a V4L2 subdevice driver for this unit.
> >>
> >> Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
> >> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> >> Reviewed-by: Mehdi Djait <mehdi.djait@linux.intel.com>
> >> Signed-off-by: Michael Riesch <michael.riesch@collabora.com>
> >> ---
> > ...
> >> +
> >> +static inline struct dw_mipi_csi2_device *to_csi2(struct v4l2_subdev *sd)
> >> +{
> >> + return container_of(sd, struct dw_mipi_csi2_device, sd);
> >> +}
> >> +
> >> +static inline __maybe_unused void
> >
> > why need '__maybe_unused', needn't inline. compiler can auto decide and
> > report unused function if no 'inline'.
>
> The __maybe_unused was helpful during development and is not really
> required now. It doesn't hurt either, so I left it in. I can remove it
> if you wish.
>
> >
> >> +
> >> + ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), 0, 0, 0);
> >
> > use struct fwnode_handle *ep __free(fwnode_handle) can simplify err
> > handler.
>
> Sorry, I don't see the benefit of that.
>
I remember reduce one goto
> >
> >> + if (!ep)
> >> + return dev_err_probe(dev, -ENODEV, "failed to get endpoint\n");
> >> +
> > ...
> >> +{
> >> + struct media_pad *pads = csi2->pads;
> >> + struct v4l2_subdev *sd = &csi2->sd;
> >> + int ret;
> >> +
> >> + ret = dw_mipi_csi2_register_notifier(csi2);
> >> + if (ret)
> >> + goto err;
> >> +
> >> + v4l2_subdev_init(sd, &dw_mipi_csi2_ops);
> >> + sd->dev = csi2->dev;
> >> + sd->entity.ops = &dw_mipi_csi2_media_ops;
> >> + sd->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
> >> + sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_STREAMS;
> >> +
> >> +static int dw_mipi_csi2_runtime_resume(struct device *dev)
> >> +{
> >> + struct dw_mipi_csi2_device *csi2 = dev_get_drvdata(dev);
> >> + int ret;
> >> +
> >> + reset_control_assert(csi2->reset);
> >> + udelay(5);
> >
> > Now prefer use fsleep(), which auto choose difference sleep function
> > according to delay number.
>
> I'll keep that in mind, but here the first thing that fsleep does is to
> check whether the parameter is <= 10 and (since this is true) call
> udelay. So here I don't see the point really.
Thank.
>
> >
> >> + reset_control_deassert(csi2->reset);
> >> +
> >> + ret = clk_bulk_prepare_enable(csi2->clks_num, csi2->clks);
> >> + if (ret) {
> >> + dev_err(dev, "failed to enable clocks\n");
> >> + return ret;
> >> + }
> >> +
> >> + return 0;
> >> +}
> >> +
> >> +static DEFINE_RUNTIME_DEV_PM_OPS(dw_mipi_csi2_pm_ops,
> >> + dw_mipi_csi2_runtime_suspend,
> >> + dw_mipi_csi2_runtime_resume, NULL);
> >> +
> >> +static struct platform_driver dw_mipi_csi2_drv = {
> >> + .driver = {
> >> + .name = "dw-mipi-csi2",
> >> + .of_match_table = dw_mipi_csi2_of_match,
> >> + .pm = &dw_mipi_csi2_pm_ops,
> >
> > pm_ptr( &dw_mipi_csi2_pm_ops)
>
> Shouldn't make a difference here since this driver depends on CONFIG_PM.
>
Avoid some static scan tools to report the problem, no harmful to add
pm_ptr().
Frank
> Best regards,
> Michael
>
> >
> > Frank
> >> + },
> >> + .probe = dw_mipi_csi2_probe,
> >> + .remove = dw_mipi_csi2_remove,
> >> +};
> >> +module_platform_driver(dw_mipi_csi2_drv);
> >> +
> >> +MODULE_DESCRIPTION("Synopsys DesignWare MIPI CSI-2 Receiver platform driver");
> >> +MODULE_LICENSE("GPL");
> >>
> >> --
> >> 2.39.5
> >>
>
next prev parent reply other threads:[~2026-01-19 15:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 13:02 [PATCH v5 0/3] media: rockchip: add driver for the rockchip mipi csi-2 receiver Michael Riesch via B4 Relay
2026-01-16 13:02 ` [PATCH v5 1/3] media: dt-bindings: add " Michael Riesch via B4 Relay
2026-01-16 13:02 ` [PATCH v5 2/3] media: synopsys: add driver for the designware " Michael Riesch via B4 Relay
2026-01-16 16:08 ` Frank Li
2026-01-19 9:49 ` Michael Riesch
2026-01-19 9:56 ` Sakari Ailus
2026-01-19 12:01 ` Laurent Pinchart
2026-01-19 15:35 ` Frank Li [this message]
2026-01-19 15:40 ` Michael Riesch
2026-01-16 13:02 ` [PATCH v5 3/3] arm64: defconfig: enable " Michael Riesch via B4 Relay
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=aW5PLIv2w+OY7xJD@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=bryan.odonoghue@linaro.org \
--cc=chaoyi.chen@rock-chips.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=hverkuil@kernel.org \
--cc=kernel@collabora.com \
--cc=kever.yang@rock-chips.com \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=mehdi.djait@linux.intel.com \
--cc=michael.riesch@collabora.com \
--cc=nicolas.dufresne@collabora.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=sebastian.reichel@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