Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.169 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796122962; b=ektTHtriFEDLAiI6DaJBeSQcrRF8AY2eyRXzoeWMmxbO5p5NSRY4SDOFDDxqr8mniaXF Ul58Y//zpAIJGYDqeAorsm11YqYp+91anOkxMft+Dm/R6P1DNH2pGO001pNX9NEr7baMt TYlj8zAI4u0XRaGLD1Vdr/Eh/9y54EaigbGDkePg0gGVMi1AVkw4vktwghX9UFYXOEeaW sckWiZXKV4ZQmfDU8NeeR7uSNlwuBkfr3S1bkRBSW9xx2ym1U1z2exPNwRZ79IkhiUv5y PBE1YbKvZxMh35Ut0i1kdXMPzKZ2Mf2LJU5hxj+786FWyPDavpbSGWIwcyuY8ET+WYQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796122962; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=cI8xfXGNXRwiQXmRqrvlUVqpwgNB/CsRwo7o8YMWJ/E=; b=0KQa/EJ6ArkyALvZLIjb6jaGwdS9cZN4Iro1EF6Jm9VxXsaeoX/JN73BQBZxRfYg0vKk ZFDPDVRuw4bRSEINfunkkTiM8eSt/CC3vPas9OdZUuG1skalSA0KoNVRnUhPD6GYpU9Us jdrKit7eQcel53kIV4ZqjJAKezy/YEZz29ieTUCfusdtFHVTlNIXn/LYEINX4rwSrNcL0 Pxndz2P0xaVoMpwRHsyvEYNMk+IonYEjtP5xPFIeORORbKT9+5XSuVJ1yJJjtdGwdb6l3 Dq0rvi/1S5hAo5OMnMM/AW4GSUt3PBZI4qGPRK2M5XRX6fAaTiGm05LogMCpwYUQLVw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=M9in3EMp; arc=none smtp.remote-ip=209.85.214.169 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E56EC606A31A for ; Tue, 1 Dec 2026 11:02:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E56EC606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=M9in3EMp Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2f02b9c1f6fso78504725ad.0 for ; Tue, 01 Dec 2026 03:02:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796122961; x=1796727761; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=cI8xfXGNXRwiQXmRqrvlUVqpwgNB/CsRwo7o8YMWJ/E=; b=M9in3EMpQSpvoIVUIVjZcc7dLqPv8LoOT+nFHGV16AIXr86kEaU5hLaf3OhJc3+IzN xW+JVYSRc/+dnmYOlbj42kNTiynIYMAgwTSK+Pb/r/i43pcRiodJOnD9WDa4EYmzpeqz vRfJLPfGRZf6+qz4OALQ3zMfK4kn8TdNL5SOzSYZt5KxYy1sPAw7M9+uhQg7N68i0IpH ycffebUbWYAy+gAX/boZw8dEK3qPlPm37nRBJP+/RrDhkCwvMxIgD21e9Mb8mqJ2Yaa1 FMWGRV8bD8xztMcA8XMdT7nNl8zxS8rWwYqX+W8MwehCj5eHMp+ES5+P3p2vo4eSwDtl t6nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796122961; x=1796727761; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=cI8xfXGNXRwiQXmRqrvlUVqpwgNB/CsRwo7o8YMWJ/E=; b=a283FNLZ7YV+LZyMulqhzWJTiZZf26RlXuvZhmvwJ9l1zUbbEGNizoadDqkKrACKXp 4eWT2QBFuXKead3r74GNZZC0UrCbgMdZsuGlWJa80oi1XZw9LmpgR5VvMOAe+6ffG4s9 w9c74wO8Yn9zyV8pXZYEbenCOh1NUXgmA7b0X1ahWGjml7lfCic2L8bGdythVFOWEq7T mIyriAxwso99LOx+GZsx4XtdmkHzqEzEom7opK9ey4d/yTEnRNXEbYjSRWUvl8WCxk5D HCw0VH0yREUn6WB1Au3kP8vhAnODDiNZSgfFhlGCRV+qNvXfuHe8dWT4yrPlhVGrIV47 oQ9Q== X-Forwarded-Encrypted: i=1; AL+hErHrL2o6jLFnadDOKibijRocnGqwpgP6DmD6bC6Wzhe3hVYvoRFgTqTcxYh+9YLbJEjOUM8uvhiKyNjn@vger.kernel.org X-Gm-Message-State: APuU4Z8DTmUgrQr2/SZUz3iMm2bFIS88HZTXuqAvU/n2VO7qKGZg7cNB VEDcsqIzQohBECr4Rxa7t1h5JWlTyCmyyMv3QxfrqZxok/2+MR1efMLn X-Gm-Gg: AZFdTZdb7x9as4E+spgLMbyKc10VlhLnLCq2IobViQ39g4grfX1dxFjyIKc0VVIJtgg mcf9el0fwmQdhRgXfSb/Ln/cp2Gdr7dmjpMBNpBRxf5OgQ7UOFhNqHCVCFNsgKNIpXXdVwE0z/p uVNX3hXDUVtjFyRSPpmR1lOmroQy0qKzkYiuIbihoUpA1iaWJHWlz1oRGYdthlTwfaA4ydkRrmj n2vveaSc3OvqrORtQ/Pt9IrCisPefve7smpRQife1CSyXJFC85NzmJfUrVvqEGirGGJcZvt6jYs h0tyadFXHeFd/AdE5hurflT8ybnIGs6f53hTvMxhW0Dxyxr7rxWuBiv4exHokeouHiPw7OxROsY Rf1XiAQUaFNcAuWVdz/kEkWreGRls1eJndROJ1K1t4Woz2YyRoo1rvupjFCXmHvHR/1gIX29N5+ OHo9GSYuOECqfZkP93W1rc2EtEZJEnlyg8K2B9D370QQo+5urpw1DcpX5FyyraGm4Leh4py10gj cS/YnR/9IRKKhRNS0xVFbkcQym6Q2tROjvBAMJCaXR79DM/1We5Ghkgtji+tvg+aJ3R1MEc0/l6 XRRKdjyIgjuHktqIY1kbHEZ9kiFnri1tLokeuLJ7cYgpBmZyD1qX3hn2rtUGoYXfjCJue3be7ns G2kjm8UvdtkM2e+dC8T3obZ5RMj0abDIY0Wd76uLrdQI2VqgExw== X-Received: by 2002:a17:903:b4b:b0:2ed:238b:7db1 with SMTP id d9443c01a7336-2f03f18f3a2mr270687505ad.13.1796122960760; Tue, 01 Dec 2026 03:02:40 -0800 (PST) Received: from default-vnic.defaultvcn.oraclevcn.com ([161.118.211.100]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f0ea7aca93sm94095575ad.44.2026.12.01.03.02.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 03:02:40 -0800 (PST) From: Tuan Kiet Huynh To: linux-media@vger.kernel.org, devicetree@vger.kernel.org Cc: sakari.ailus@linux.intel.com, mchehab@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, chernyav.a@gmail.com, hikmahgumelar@gmail.com, Tuan Kiet Huynh Subject: [PATCH v4 0/2] media: i2c: Add Samsung S5K5E8 camera sensor driver Date: Tue, 1 Dec 2026 18:02:33 +0700 Message-ID: <20261201110235.3327189-1-huynhtuankiet33@gmail.com> X-Mailer: git-send-email 2.43.0 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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