From: <Hermes.Wu@ite.com.tw>
To: <sakari.ailus@iki.fi>
Cc: <mchehab@kernel.org>, <robh@kernel.org>, <krzk+dt@kernel.org>,
<conor+dt@kernel.org>, <linux-media@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v10 2/2] media: i2c: add driver for ITE IT6625/IT6626
Date: Thu, 17 Sep 2026 03:30:22 +0000 [thread overview]
Message-ID: <834ad400ea0849b785c08938070c3950@ite.com.tw> (raw)
In-Reply-To: <aqp3MYVynMUMVvcy@valkosipuli.retiisi.eu>
Hi Sakari,
Thank you for the review. I'll address these in follow-up patches.
> Why is the default to enable printing all debug information? Shouldn't this
> be 0?
Yes, I'll change the default debug level to 0.
> You have a single sub-device. Why not to use the sub-device state lock for
> this? This driver should also fully switch to sub-device state (related
> comments below).
Agreed. I'll use the driver mutex as the sub-device state lock and move the
active pad-format state into the centralized sub-device state.
The separate EDID and InfoFrame locks will remain, as they serialize
independent multi-step transactions rather than pad-format state.
> This seems to be unused.
Correct. I'll remove the unused bus member.
> Avoid storing state information outside sub-devie state.
Agreed. I'll move csi_format/mbus_fmt_code into the active pad format and
derive the hardware CSI data type from the media-bus code when needed.
> You won't be switching PHYs at runtime, will you? You should have two
> arrays in this case, selected based on PHY type.
Correct, the PHY type is fixed by firmware configuration. I'll use separate
single-entry link-frequency arrays for D-PHY and C-PHY.
> Please drop, minimum is 8.1 nowadays.
Will do.
> Ditto.
I'll remove the redundant reserved initializers from both timing capability
structures.
> unsigned int and you can declare it here.
Agreed. I'll update both lookup loops accordingly.
> Please make variable declarations look like a reverse Christmas tree.
> Applies to the rest of the driver, too.
Will do. I'll audit the driver rather than limiting the cleanup to this
function.
> s/1000/USEC_PER_MSEC/
>
> Ditto.
Agreed. I'll use the unit macros and include <linux/units.h>.
> No need to cast rval.
>
> Is this useful? Shouldn't this be dev_dbg()?
Agreed on both points. I'll remove the cast and change the normal status
message to dev_dbg().
> Redundant parentheses.
>
> Ditto.
Agreed. I'll simplify all four boolean helpers.
> static const?
Yes, I'll make the lookup table static const.
> s/4/sizeof(ck)/
Will do.
> pclk = get_unaligned_be32(ck);
>
> And include linux/unaligned.h. I guess it'd be safe to assume this would be
> aligned though.
Agreed. I'll use get_unaligned_be32() and include <linux/unaligned.h>.
> s/1000/KHZ_PER_MHZ/
>
> And include linux/units.h.
Will do.
> unsigned int i...?
Agreed.
> unsigned int except for err?
Agreed. I'll retain a signed type for the returned error and use unsigned
types for the block and bank indices.
> Either align the latter line to start after the opening parenthesis or wrap
> after '=' instead.
Will fix.
> width = get_unaligned_be16(buffer);
>
> height = get_unaligned_be16(buffer + 2);
>
> It'd be nicer to define a struct for this actually.
>
> Same for this one.
Agreed. I'll define structures matching the contiguous timing-register
layouts and use the unaligned big-endian accessors for their fields.
> Don't do bitwise or on error codes!
Agreed. This function also currently discards the accumulated result by
returning 0. I'll execute the updates sequentially and return the first
error.
> You can assign these in declaration as you do below.
Will do.
> { Spaces inside braces, please. }
Will fix.
> Do you need this? V4L2 already has names for formats.
This helper is only used by log_status(). I could not find an in-kernel
helper in the current tree that converts MEDIA_BUS_FMT_* values to printable
names; the fourcc helpers do not apply to media-bus codes.
Did you mean that the status output should use the standard MEDIA_BUS_FMT_*
representation instead of these custom descriptions? If so, I'll drop the
helper and report the media-bus code instead.
> return 0;
>
> return -ERANGE;
>
> return 1;
>
> And drop the else's.
Agreed. I'll convert this to early returns.
> Error checks are missing.
>
> The s_stream() video op is deprecated, please switch to enable_streams and
> disable_streams pad ops.
Agreed. I'll convert the register helpers to return errors, implement the pad
enable_streams and disable_streams operations, and use
v4l2_subdev_s_stream_helper for legacy callers.
> unsigned int i?
Agreed.
> These values come from DT -- see my comments on the 1st patch, too.
Agreed. I'll remove the default lane count, output-port count, and PHY type.
They will be set only from the firmware graph.
> Please don't add this, the driver should assume the configuration *is*
> available in DT. Also the NULL check is redundant;
> v4l2_fwnode_endpoint_alloc_parse() does it.
Agreed. The binding requires port@0 and its data-lanes, so silently
continuing without an endpoint is inconsistent with the binding. I'll remove
the fallback and let endpoint parsing report the error.
> Either combine the error checks or add a label for error handling, use goto
> here and below.
Agreed. I'll consolidate endpoint cleanup through a common error path.
> I wonder if it'd be cleaner to have this in probe -- error handling becomes
> difficult with these intermediate initialisation helpers that do apprently
> unrelated things.
Agreed. I'll move the sub-device, control, media-entity and state
initialization sequence into probe so the unwind path is explicit.
> You'll need to call v4l2_subdev_init_finalize() here to fully initialise
> the sub-device state.
>
> Similarly, call v4l2_subdev_cleanup() on error path after finalize() as
> well as in remove.
Agreed. I'll call v4l2_subdev_init_finalize() after initializing the media
entity and before registering the sub-device. I'll add
v4l2_subdev_cleanup() to the corresponding probe error path and the remove
path.
Kind regards,
Hermes
prev parent reply other threads:[~2026-09-17 3:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 10:31 [PATCH v10 0/2] media: i2c: add support for ITE IT6625/IT6626 HDMI to MIPI CSI-2 bridge Hermes Wu via B4 Relay
2026-08-11 10:31 ` [PATCH v10 1/2] dt-bindings: media: add ITE IT6625/IT6626 HDMI bridge Hermes Wu via B4 Relay
2026-08-11 10:31 ` [PATCH v10 2/2] media: i2c: add driver for ITE IT6625/IT6626 Hermes Wu via B4 Relay
2026-09-16 11:02 ` Sakari Ailus
2026-09-17 3:30 ` Hermes.Wu [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=834ad400ea0849b785c08938070c3950@ite.com.tw \
--to=hermes.wu@ite.com.tw \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=sakari.ailus@iki.fi \
/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
all inboxes | Powered by JetHome®