From: sashiko-bot@kernel.org
To: "Hikmah Gumelar" <hikmahgumelar@gmail.com>
Cc: devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH v5 3/7] media: i2c: add s5k5e8 image sensor driver
Date: Fri, 27 Nov 2026 14:01:50 +0000 [thread overview]
Message-ID: <sashiko-outbox-237529@kernel.org> (raw)
In-Reply-To: <20261127134507.125513-4-hikmahgumelar@gmail.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] media: i2c: s5k5e8: control writes skipped when !CONFIG_PM in
s5k5e8_set_ctrl()
- [Low] media: i2c: s5k5e8: unused V4L2_CCI_I2C select and duplicate I2C
helpers
- [Low] media: i2c: s5k5e8: deprecated s_stream op used instead of
enable_streams
--
commit f8cb2239802ac8d357b8e34b78a9d168603a7bc8
Author: Hikmah Gumelar <hikmahgumelar@gmail.com>
media: i2c: add s5k5e8 image sensor driver
This commit adds a V4L2 subdevice driver for the Samsung S5K5E8 5MP
MIPI CSI-2 CMOS image sensor.
> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
> index 162b8ea026018..4c622e5eef73f 100644
> --- a/drivers/media/i2c/Kconfig
> +++ b/drivers/media/i2c/Kconfig
> @@ -879,6 +879,16 @@ config VIDEO_S5K3M5
> To compile this driver as a module, choose M here: the
> module will be called s5k3m5.
>
> +config VIDEO_S5K5E8
> + tristate "Samsung S5K5E8 sensor support"
> + select V4L2_CCI_I2C
> + help
> + This is a Video4Linux2 sensor-level driver for the Samsung
> + S5K5E8 5MP camera.
> +
> + To compile this driver as a module, choose M here: the
> + module will be called s5k5e8.
> +
> config VIDEO_S5K5BAF
> tristate "Samsung S5K5BAF sensor support"
> help
> diff --git a/drivers/media/i2c/s5k5e8.c b/drivers/media/i2c/s5k5e8.c
> new file mode 100644
> index 0000000000000..d25b978d7eda6
> --- /dev/null
> +++ b/drivers/media/i2c/s5k5e8.c
> @@ -0,0 +1,567 @@
[ ... ]
> +static int s5k5e8_read_reg(struct s5k5e8 *s5k5e8, u16 reg, u32 len, u32 *val)
> +{
> + struct i2c_client *client = v4l2_get_subdevdata(&s5k5e8->sd);
> + struct i2c_msg msgs[2];
> + u8 addr_buf[2], data_buf[4] = { 0 };
> + int ret;
> +
> + put_unaligned_be16(reg, addr_buf);
> + msgs[0].addr = client->addr;
> + msgs[0].flags = 0;
> + msgs[0].len = 2;
> + msgs[0].buf = addr_buf;
> + msgs[1].addr = client->addr;
> + msgs[1].flags = I2C_M_RD;
> + msgs[1].len = len;
> + msgs[1].buf = &data_buf[4 - len];
> + ret = i2c_transfer(client->adapter, msgs, 2);
> + if (ret != 2)
> + return ret < 0 ? ret : -EIO;
> + *val = get_unaligned_be32(data_buf);
> + return 0;
> +}
> +
> +static int s5k5e8_write_reg(struct s5k5e8 *s5k5e8, u16 reg, u32 len, u32 val)
> +{
> + struct i2c_client *client = v4l2_get_subdevdata(&s5k5e8->sd);
> + u8 buf[6];
> + int ret;
> +
> + put_unaligned_be16(reg, buf);
> + put_unaligned_be32(val << (8 * (4 - len)), buf + 2);
> + ret = i2c_master_send(client, buf, len + 2);
> + return ret == len + 2 ? 0 : (ret < 0 ? ret : -EIO);
> +}
> +
> +static int s5k5e8_write_regs(struct s5k5e8 *s5k5e8, const struct s5k5e8_reg *regs, u32 len)
> +{
> + u32 i;
> + int ret;
> +
> + for (i = 0; i < len; i++) {
> + ret = s5k5e8_write_reg(s5k5e8, regs[i].address, 1, regs[i].val);
> + if (ret)
> + return ret;
> + }
> + return 0;
> +}
[Severity: Low]
Could this driver use the V4L2 CCI helpers (devm_cci_regmap_init_i2c(),
cci_read(), cci_write() and cci_multi_reg_write()) instead of open-coding
raw I2C transfers? VIDEO_S5K5E8 already selects V4L2_CCI_I2C in Kconfig,
which is currently unused.
[ ... ]
> +static int s5k5e8_set_ctrl(struct v4l2_ctrl *ctrl)
> +{
> + struct s5k5e8 *s5k5e8 = container_of(ctrl->handler, struct s5k5e8, ctrl_handler);
> + int ret = 0;
> +
> + if (ctrl->id == V4L2_CID_VBLANK) {
> + s64 exp_max = s5k5e8->cur_mode->height + ctrl->val - 4;
> + s64 exp_def = min_t(s64, 1960, exp_max);
> +
> + ret = __v4l2_ctrl_modify_range(s5k5e8->exposure, 4, exp_max, 1,
> + exp_def);
> + if (ret)
> + return ret;
> + }
> +
> + ret = pm_runtime_get_if_active(s5k5e8->dev);
> + if (ret <= 0)
> + return 0;
[Severity: Medium]
Does checking ret <= 0 here skip all control register writes when
CONFIG_PM is disabled?
When CONFIG_PM is disabled, pm_runtime_get_if_active() returns -EINVAL, so
s5k5e8_set_ctrl() returns 0 without writing any registers during both
__v4l2_ctrl_handler_setup() and runtime control updates. Checking
!pm_runtime_get_if_active(s5k5e8->dev) (or using
pm_runtime_get_if_in_use()) allows register writes to proceed when runtime
PM is disabled.
[ ... ]
> +static int s5k5e8_set_stream(struct v4l2_subdev *sd, int enable)
> +{
> + struct s5k5e8 *s5k5e8 = to_s5k5e8(sd);
> + int ret = 0;
> +
> + mutex_lock(&s5k5e8->mutex);
> + if (s5k5e8->streaming == enable) {
> + mutex_unlock(&s5k5e8->mutex);
> + return 0;
> + }
[ ... ]
> +static const struct v4l2_subdev_video_ops s5k5e8_video_ops = { .s_stream = s5k5e8_set_stream };
[Severity: Low]
Should this driver implement v4l2_subdev_pad_ops.enable_streams and
.disable_streams with v4l2_subdev_s_stream_helper instead of implementing
the deprecated .s_stream callback directly? Using the pad stream
callbacks with the active subdev state lock also avoids manual
s5k5e8->streaming tracking and the separate s5k5e8->mutex.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127134507.125513-1-hikmahgumelar@gmail.com?part=3
next prev parent reply other threads:[~2026-11-27 14:01 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <__OIHsqpwOqb8kxVYcd2PoPvNYDhN8XO6vyXiYMCCK6o3sfyJ1gl1GNdhcGYhdfBf43tQmn6Dt6cWXcSD1uiPA==@protonmail.internalid>
2026-11-27 13:45 ` [PATCH v5 0/7] Enable front and rear cameras on Xiaomi Mi A1 (tissot) Hikmah Gumelar
2026-11-27 13:45 ` [PATCH v5 1/7] clk: qcom: gcc-msm8953: fix csi_phytimer_clk_src 100MHz parent Hikmah Gumelar
2026-11-27 16:11 ` Bryan O'Donoghue
2026-11-27 16:57 ` Hikmah Gumelar
2026-11-27 13:45 ` [PATCH v5 2/7] media: dt-bindings: media: i2c: add Samsung S5K5E8 Hikmah Gumelar
2026-12-01 5:47 ` Krzysztof Kozlowski
2026-11-27 13:45 ` [PATCH v5 3/7] media: i2c: add s5k5e8 image sensor driver Hikmah Gumelar
2026-11-27 14:01 ` sashiko-bot [this message]
2026-11-27 17:13 ` Vladimir Zapolskiy
2026-11-27 18:03 ` Sakari Ailus
2026-11-27 18:47 ` Hikmah Gumelar
2026-11-28 19:38 ` Hikmah Gumelar
2026-11-27 13:45 ` [PATCH v5 4/7] media: dt-bindings: media: i2c: add OmniVision OV12A10 Hikmah Gumelar
2026-11-27 13:45 ` [PATCH v5 5/7] media: i2c: add ov12a10 image sensor driver Hikmah Gumelar
2026-11-27 13:59 ` sashiko-bot
2026-11-27 17:12 ` Vladimir Zapolskiy
2026-11-27 13:45 ` [PATCH v5 6/7] arm64: dts: qcom: msm8953: add CAMSS node and MCLK pinctrl states Hikmah Gumelar
2026-11-27 13:45 ` [PATCH v5 7/7] arm64: dts: qcom: msm8953-xiaomi-tissot: enable front and rear cameras Hikmah Gumelar
2026-11-27 13:58 ` sashiko-bot
2026-11-27 16:14 ` [PATCH v5 0/7] Enable front and rear cameras on Xiaomi Mi A1 (tissot) Bryan O'Donoghue
2026-11-27 16:32 ` Hikmah Gumelar
2026-11-28 10:35 ` Bryan O'Donoghue
2026-12-01 5:43 ` Krzysztof Kozlowski
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=sashiko-outbox-237529@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hikmahgumelar@gmail.com \
--cc=linux-clk@vger.kernel.org \
--cc=media-ci@linuxtv.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.