Skip to content

Anan Jaser's Galaxy S9+ cameras (rear, front, telephoto) as the S9+'s own driver; unification with the S9's deferred - #296

Merged
claudiusthebot merged 7 commits into
mainfrom
contrib/anan-jaser-camera
Nov 12, 2026
Merged

claudiusthebot merged 7 commits into
mainfrom
contrib/anan-jaser-camera

Conversation

@claudiusthebot

Copy link
Copy Markdown
Collaborator

@ananjaser1211, these are your three camera commits (74ad0778, 03c2ed23, 6014ef87), the ones left out of #292. Thank you for them: front, rear and telephoto on an S9+ is more than this tree had.

What this does

The same day you wrote them, main got its own Galaxy S9 rear camera, lens driver, aperture and stabiliser, in the same file, built differently (one camera chosen at boot, three files) from yours (a table of three camera paths the reader switches between, one file). Making one driver of the two means choosing one structure, carrying the other's features across about five thousand lines, and then running the result on both phones. Neither phone can be run today. So the unification is deliberately deferred, and each phone keeps the code that was seen working on it:

  • hakios.exynos_camera_star2.c is your driver: the file your commits were written on (main's at 13c4fce, added byte for byte in the first commit here), then your three commits applied to it with your authorship and dates, their messages kept with a note of what was left out.
  • It is built for star2lte only; main's driver (hakios.exynos_camera.c, hakios.exynos_camera_rear.c, hakios.ak737x.c) is built for every other configuration and for the ios-27 tree, unchanged. Same configuration symbol, same three kernel entry points, same /dev/hakios-camera. A kernel has exactly one: tools/hakios-config.py writes HAKIOS_DEVICE_IS_<DEVICE> into the generated header and each driver's files compile to nothing in the other's kernel. Checked in the built kernels: star2lte has your driver's symbols and none of the other's; starlte and crownlte the reverse.

What was left out of 74ad077, and why

  • The two generated headers hakios.s5k2l3_setfiles.h and hakios.s5k3m3_setfiles.h. Besides mode tables they hold each sensor's RAM patch (the burst writes to 0x6F12). That is firmware, and this tree never commits firmware, whatever form it comes in (main's own S9 rear work left the same patch out for that reason). Instead tools/mk-star2-setfiles.sh makes them when a star2lte kernel is built: the three Samsung headers (GPL-2.0) are fetched from your Apollo repository at a pinned commit (30656faf), checked by SHA-256, and run through your two extract tools, which are here unchanged. The result is byte for byte the two files of your commit (checked). They live in the build directory only. Without a network the script says which three files to put where.
  • Its hakios.exynos_hsi2c.c hunk: main already has the same change, made independently (a dedicated camera HSI2C has no USI selector).
  • Its drivers/map lines (written anew for the new file name).

Also here

  • docs/exynos9810-cameras.md: the two drivers side by side, where they agree (the lens: 0x0C, first position 120, 10 ms before active; the rear link: CSIS0, four lanes, 1352 Mb/s, settle 66, SC_CON2 = 1), where they differ (the front's DMA mux write, a hand-written rear sequence against Samsung's tables, the RAM patch used or not, the S2MPB02 bus lock, argument names), and what was not compared (the S5K2L3's registers one by one). The later job starts from that page.
  • NOTICE and THIRD_PARTY_LICENSES.md: the build-time setfiles (Samsung, GPL-2.0, via Apollo; not in the repository) and a row for the S9+ panel table that came with Anan Jaser's work: the Galaxy S9+ on hardware, DVFS tables, audio tone, Location, GNSS bring-up (37 commits, his authorship) #292.
  • The catalogues made again; two scripts' executable bits restored.

Your userland camera commit (already on main, 9461d3f)

It was written against this driver, and this driver is as you wrote it. Every request it uses (HAKIOS_CAMERA_SENSOR, _FOCUS, _NO_FOCUS, _EXPOSURE, _KEEP, the frame's magic) is also answered by the S9's driver, by reading; how the S9's driver behaves with your user space's rear and telephoto requests has not been run.

Checked (build machine; no phone)

  • The 16.5 gate: all six configurations build (star2lte with the tables fetched and made during the build), the catalogue checks pass, and all 27 steps of the check workflow pass locally.
  • ios-27: the kernel from a fresh clone of this branch against main's, function by function: see the comment below.
  • Not run on any phone. On the S9+ this is your code plus a compile-time guard; on the S9 the driver's code is unchanged but the flashlight driver (hakios.s2mpb02_torch.c) now has your bus lock and torch_flash_ms, which the S9 has not run.

npm run preflight does not apply (no Node project).

🤖 Generated with Claude Code

claudiusthebot and others added 6 commits November 12, 2026 17:21
…s hakios.exynos_camera_star2.c

This is drivers/camera/exynos/hakios.exynos_camera.c of 13c4fce, byte for byte, under a second name: the file Anan Jaser's
three Galaxy S9+ camera commits were written on. Main's own file has since gone another way (the S9's rear camera in
hakios.exynos_camera_rear.c, the lens in hakios.ak737x.c). His commits follow, applied to this copy, so that his work lands as
he ran it; the commit after them wires it into the build for star2lte only. Not built yet.
… streams, AK737x focus, CSIS DMA input mux

- Rear S5K2L3 on CSIS0 and telephoto S5K3M3 on CSIS2 from Apollo's star2 tree (rails, resets, D-PHY isolation,
  setfiles A/B extracted from Apollo's fimc-is-cis headers by tools/extract-*-setfile.py)
- Lens motors: rear OIS logic rails, front USI09 selector 0x34 (was USI08's 0x30), telephoto on I2C_CAM3
- SYSREG_ISPPRE SC_CON2/4/6: each CSIS DMA takes its own CSIS (fimc-is-v6_0_0 hw-chain); the telephoto's DMA2
  had no input and wrote nothing. SC_CON8 is the secure camera's and is never touched (reading it aborts)
- The S2MPB02 bus shared with the flashlight is locked; the flashlight starts after the camera; boot flash test off

(cherry picked from commit 74ad077; applied to hakios.exynos_camera_star2.c, the copy of the file this was written on,
without its drivers/map and hakios.exynos_hsi2c.c hunks and without the two generated files hakios.s5k2l3_setfiles.h and
hakios.s5k3m3_setfiles.h, which hold the sensors' RAM patches: firmware is not committed to this tree; the build makes them
with the two extract tools of this commit. The commit after his three says how)
…023, the macro end)

(cherry picked from commit 03c2ed2; applied to hakios.exynos_camera_star2.c, the copy of the file this was written on,
without its drivers/map and hakios.exynos_hsi2c.c hunks: the next commit says why)
…ndor_first_delay, star2lte/starlte DT)

(cherry picked from commit 6014ef8; applied to hakios.exynos_camera_star2.c, the copy of the file this was written on,
without its drivers/map and hakios.exynos_hsi2c.c hunks: the next commit says why)
…rything else; its two table headers are made at build time

Anan Jaser's three camera commits (before this one) are his Galaxy S9+ driver, applied to a copy of the file they were written
on (hakios.exynos_camera_star2.c). Main's own driver went another way on the same day and was run on a Galaxy S9. Making one
of the two means running the result on both phones, and neither can be run now, so for the time being each phone keeps the
code seen working on it (docs/exynos9810-cameras.md: what the two share, where they differ, what was not compared).

- One of them in a kernel, never both: tools/hakios-config.py writes HAKIOS_DEVICE_IS_<DEVICE> into dev/hakios.drivers.h; the
  S9's three files compile to nothing for star2lte, the S9+'s file to nothing for everything else. Same configuration symbol
  (EXYNOS_CAMERA), same three entry points, so no device configuration changes. The ios-27 tree has no such header and takes
  the S9's files only: its kernel is unchanged.
- Not taken from 74ad077: its drivers/map lines (written here) and its hakios.exynos_hsi2c.c hunk (main already has the same
  change, made independently: a dedicated camera HSI2C has no USI selector).
- Not committed: hakios.s5k2l3_setfiles.h and hakios.s5k3m3_setfiles.h. They hold the sensors' RAM patches, which is
  firmware, and firmware is not kept in this tree. tools/mk-star2-setfiles.sh makes them when a star2lte kernel is built:
  three headers of Samsung's GPL-2.0 kernel fetched from github.com/ananjaser1211/Apollo at a pinned commit, checked by
  SHA-256, run through his two extract tools (the result is byte for byte the files of his commit); xnu-build.sh lays them
  beside the driver in the kernel tree. NOTICE and THIRD_PARTY_LICENSES.md say so, and the latter now names the S9+ panel table.
- tools/hakios-config.py and tools/extract-2l3-setfile.py are executable in git again (the patch had recorded 644).

Built for every configuration; not run on a phone.
…rear, cam_s9_tele and their probes, torch_flash_ms; drivers.md)
@claudiusthebot

Copy link
Copy Markdown
Collaborator Author

ios-27 check (no phone): OS_PROFILE=ios-27 make kernel from a fresh clone of this branch, rc 0. Against main's ios-27 kernel: all 53,328 functions are byte-identical, none added, none removed. The ios-27 tree takes only the S9 driver's files, and the guard added to them is a no-op there.

@claudiusthebot
claudiusthebot merged commit 2a79ef8 into main Nov 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants