Devicetree
 help / color / mirror / Atom feed
* [PATCH v4 0/2] media: i2c: Add Samsung S5K5E8 camera sensor driver
@ 2026-12-01 11:02 Tuan Kiet Huynh
  2026-12-01 11:02 ` [PATCH v4 1/2] dt-bindings: media: i2c: Add Samsung S5K5E8 image sensor Tuan Kiet Huynh
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tuan Kiet Huynh @ 2026-12-01 11:02 UTC (permalink / raw)
  To: linux-media, devicetree
  Cc: sakari.ailus, mchehab, robh, krzk+dt, conor+dt, chernyav.a,
	hikmahgumelar, Tuan Kiet Huynh

This is v4 of the Samsung S5K5E8 sensor driver, previously posted as
[PATCH v3 0/2] on 2026-11-22:
Link: https://lore.kernel.org/all/20261122034656.1093369-1-huynhtuankiet33@gmail.com/
v1 and v2 were posted on 2026-11-21:
Link: https://lore.kernel.org/all/20261121091907.1190346-1-huynhtuankiet33@gmail.com/
Link: https://lore.kernel.org/all/20261121120731.2028810-1-huynhtuankiet33@gmail.com/
(v1 had no cover letter; the first link is to its 1/2 patch.)

A note on the competing series first, because it matters more than
the changelog: Hikmah Gumelar posted a separate samsung,s5k5e8 series
for the Xiaomi Mi A1 (tissot) a day later, on 2026-11-23, and it is now
at v5 ([PATCH v5 0/7], 2026-11-27). Both series claim the same
compatible ("samsung,s5k5e8"), the same binding file, the same driver
file and the same Kconfig symbol, and neither series mentions the
other. I only became aware of the overlap when a reviewer pointed me
at it, and I would rather coordinate than race: I am happy to rebase
this series onto a single shared driver, or to carry Hikmah's driver
forward with the pieces below merged in -- whichever base the
maintainers prefer. For the record, where the two stand:

- This series is ahead on: HFLIP/VFLIP controls, a 1304x980 59.81 fps
  binned mode, a tested device-tree node for the Redmi Note 4X (mido)
  in the local downstream tree, an in-flight libcamera sensor
  properties and helper series on libcamera-devel (v2 sent
  2026-11-29, v3 to follow), hardware verification on mido, and
  test-pattern colour controls (registers 0x0602-0x0608, verified on
  mido). It also already uses the V4L2 CCI helpers, the active subdev
  state with the state lock as the control-handler lock,
  enable_streams/disable_streams with the s_stream helper, and
  v4l2_link_freq_to_bitmap() -- all things the Nov 27 reviews of
  Hikmah's v5 asked Hikmah to adopt (Sakari Ailus on the state lock,
  enable_streams and the link-frequency bitmap; Vladimir Zapolskiy on
  CCI).
- Hikmah's series is ahead on: human review (v5 was reviewed on
  Nov 27 by Sakari Ailus, Vladimir Zapolskiy and Bryan O'Donoghue,
  and Krzysztof Kozlowski reviewed the cover and DT binding on
  Dec 1), and a device-tree node plus rear-camera (OV12A10) and
  clock-fix support for tissot. Hikmah has also had the camera path
  running on 7.1.3, and on Nov 28 reported a physical Mi A1 booting
  7.4.0-rc1 and validating the camera pipeline (CAMSS, OV12A10,
  S5K5E8) on the device; no camera results have been reported yet.
  Hikmah is splitting the series and addressing the review feedback
  before v6.

One more incompatibility between the series, in the binding itself:
"the same binding file" above is true only as a filename. Hikmah's
binding (v5 2/7) requires avdd/dvdd/dovdd supplies and defines
reset-gpios as its only GPIO, while this series requires vdda/vddd/vddio
and adds optional powerdown-gpios, so no single device-tree node can
satisfy both bindings at once. This series follows the supply naming of
the upstream Samsung bindings (samsung,s5kjn1.yaml and
samsung,s5k3m5.yaml both use vdda/vddd/vddio), but that is a
precedent, not a ruling: if the two series are merged, the
maintainer will have to pick one naming, and I am happy to rename
to whichever is chosen.

One difference between the series I want to flag rather than silently
adopt: Hikmah's driver declares a 418 MHz link frequency. The mode
tables program 0x0820/0x0821 = 0x0344, which we read as 836 Mbps/lane,
i.e. 418 MHz -- but Hikmah never states that derivation, so it is our
inference, not his claim. I tried that value and measured the result on
mido hardware: with the PLL/timing tables unchanged, the sensor streams
at 29.89 fps at 2592x1944 and ~59.8 fps at 1304x980, which proves a
168.0 Mpix/s VT pixel clock -- but that is all it proves. The D-PHY
lane clock was not measured, and 168 Mpix/s does not by itself settle
the lane rate either way: the pixel data of a 2592-pixel RAW10 line is
transmitted only during the active 15.43 us of the 17.0 us line time, so
the peak lane rate is 12,960 bits/lane / 15.43 us = 840 Mbps/lane, i.e.
420 MHz -- exactly the driver's pixel-rate formula (420 MHz x 2 lanes
x 2 bits / 10). Spreading the same bits over the whole 17.0 us line
time would need only 762.4 Mbps/lane, i.e. 381.2 MHz, so that is a
lower bound on the lane rate, not the rate itself. Note
V4L2_CID_PIXEL_RATE is derived from LINK_FREQ, so the 0.48% figure
below is the error 418 MHz would introduce against the measured
168.0 Mpix/s VT clock, not an independent measurement. This version
keeps 420 MHz because it avoids a 0.48% error in V4L2_CID_PIXEL_RATE
(168.0 vs 167.2 Mpix/s at 418 MHz), not because the lane rate was
measured. The meaning of 0x0820/0x0821 = 0x0344 is evidently not
settled by that register alone; I would welcome a datasheet reference
either way.

On the driver name: v3 renamed s5k5e8yx to s5k5e8. The sensor reports
chip ID 0x5e80 and I have found no evidence of a distinct YX variant,
so the plain S5K5E8 name is used throughout.

Changes in v4 (all in 2/2; 1/2 is unchanged from v3):
- Add test pattern mode 4, PN9. Verified on the Redmi Note 4X: mode 4
  captures a deterministic pseudo-random 10-bit frame (mean 512.5,
  std 295.0, mid-row lag-1 autocorrelation 0.004 at 1304x980,
  whole-frame -0.006, two frames byte-identical), distinct from
  modes 0-3, which were re-checked and still work.
  v4l2-compliance still passes 46/46. (Hikmah's v5 already has PN9
  at index 4, so this is parity between the series, not an advantage.)
- Use the 16-bit test-pattern register 0x0600 instead of the
  8-bit 0x0601, and add test-pattern colour controls for registers
  0x0602-0x0608. Verified on mido: writing 0x03ff to 0x0602 with the
  others at 0x0000 turned the solid-colour frame red, and the inverse
  turned it green/blue; defaults are 0x200, the sensor reset value, so
  reset behaviour is unchanged.
- Fix the pm_runtime handling in set_ctrl: proceed unless
  pm_runtime_get_if_active() returns zero (device not active), and
  only drop the reference when one was actually taken.
- CROP_DEFAULT stays the constant modes[0] crop, (8,8)/2592x1944: it
  is the suggested crop covering the whole picture, not the crop of
  the currently selected mode.
- The extra stream-on sequence from the Hikmah driver (msleep 80 plus
  0x3c16/0x3c0d/0x0100/0x3c22 writes) was evaluated and is not adopted:
  the sensor streamed without it before, and hardware testing on mido
  after removing it (stream start/stop cycles at both modes, fps and
  test patterns re-checked) shows no regression, so v4 keeps the plain
  MODE_SELECT write.
- Two small cleanups: the s5k5e8_subdev_entity_ops struct (which only
  set link_validate) is removed, and S5K5E8_NUM_SUPPLIES is replaced
  by ARRAY_SIZE(s5k5e8_supply_names) at the use sites.
- Link frequency stays at 420 MHz, for the reason above.

Changes in v3:
- Renamed s5k5e8yx to s5k5e8 throughout (driver, binding, Kconfig
  symbol, compatible, MAINTAINERS); renamed standby-gpios to
  powerdown-gpios; sequential regulator enable (vddio -> vdda ->
  vddd) with powerdown-then-reset deassertion.
- Adopted full V4L2 subdev active state; RUNTIME_PM_OPS() with
  pm_ptr(); HFLIP/VFLIP handling with active-pad Bayer update;
  aligned the binned mode's MIPI link PLL registers (0x0306, 0x0308,
  0x0820/21 = 0x0344) with the Samsung OEM binned preview.
- Binding now requires vdda/vddd/vddio supplies and endpoint
  data-lanes; binding maintainer added.

Changes in v2:
- Rebased onto linux-media/media-committers next; updated .set_fmt
  and .get_selection for const struct v4l2_subdev_client_info *ci;
  converted PM ops to DEFINE_RUNTIME_DEV_PM_OPS() with pm_ptr();
  checkpatch --strict fixes; DT binding MAINTAINERS entry moved
  into 1/2.

One open question from downstream review, for the maintainers: a
reviewer of the downstream mido branch mentioned a work-in-progress
generic CCS driver covering "almost all s5kxxx sensors" and I asked
for a link to it, which was never supplied. I could not locate a CCS
driver covering the S5K5E8 (the mainline CCS driver lists no Samsung
sensor). Dedicated Samsung sensor drivers (s5kjn1, s5k3m5) have been
accepted upstream, so I proceeded with a dedicated driver, but please
say if CCS coverage is expected for this sensor instead.

Cc: Hikmah Gumelar <hikmahgumelar@gmail.com>

Andrii Cherniavskyi (2):
  dt-bindings: media: i2c: Add Samsung S5K5E8 image sensor
  media: i2c: Add Samsung S5K5E8 camera sensor driver

 .../bindings/media/i2c/samsung,s5k5e8.yaml    |  109 ++
 MAINTAINERS                                   |    9 +
 drivers/media/i2c/Kconfig                     |   10 +
 drivers/media/i2c/Makefile                    |    1 +
 drivers/media/i2c/s5k5e8.c                    | 1108 ++++++++++++++++++++
 5 files changed, 1237 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/samsung,s5k5e8.yaml
 create mode 100644 drivers/media/i2c/s5k5e8.c


base-commit: ccf78740d
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-01 12:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 11:02 [PATCH v4 0/2] media: i2c: Add Samsung S5K5E8 camera sensor driver Tuan Kiet Huynh
2026-12-01 11:02 ` [PATCH v4 1/2] dt-bindings: media: i2c: Add Samsung S5K5E8 image sensor Tuan Kiet Huynh
2026-12-01 11:02 ` [PATCH v4 2/2] media: i2c: Add Samsung S5K5E8 camera sensor driver Tuan Kiet Huynh
2026-12-01 11:16   ` sashiko-bot
2026-12-01 12:52 ` [PATCH v4 0/2] " Hikmah Gumelar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox