Repository navigation
media: apple: isp: read per-module lens shading data from sensor NVM - #3929
Conversation
Each camera module carries its own lens shading measurement in the sensor NVM, and the ISP firmware hands it out on request. Read and cache it during sensor detection so a later change can use it: - Add isp_cmd_send_data() for commands whose reply is larger than the IPC command area; it sends through isp->data_surf. Factor the shared send path out of isp_cmd_send_chan() into isp_cmd_send_buf(). - Add CISP_CMD_CH_SENSOR_PERMODULE_LSC_INFO_GET (0x0507) and CISP_CMD_CH_SENSOR_PERMODULE_LSC_GRID_GET (0x0511) for the legacy (0x10/0xb0-byte header, 8-bit samples) and H17 (0x14/0x114-byte header, 8..16-bit samples) firmware ABIs, and cache the validated grid. A module without the data is not an error; an IPC transport failure is. Nothing consumes the grid yet, so image output does not change. tools/asahi/isp-tests.py: extract isp_cmd_send_buf() too and aim the overwrite control at the lowest sender, which now holds the latch. Add KUnit wire-layout tests for both ABIs. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
satchlj
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 26def99
Blockers:
- CI at head
26def99b4e38is still queued (apple-build,host-tests,KUnit plan,readiness). Ready to approve as soon as CI finishes green (especially verifying the updatedtools/asahi/isp-tests.pyhost-tests).
Checked:
- Full 514-line diff across
isp-drv.h,isp-cmd.h,isp-cmd.c,isp-cam.c,isp-cam-test.c,tools/asahi/isp-tests.py, andtools/asahi/isp/session.c— no code blockers found. isp_cmd_send_buf()cleanly factors out the shared command-channel send path withipc_errorlatching intact, andisp_cmd_send_data()checksisp->ipc_error,!isp->data_surf, and bothinsize/outsizeagainstisp->data_surf->sizebefore copying the reply back intoargs.- Wire structs (
cmd_ch_sensor_lsc_info_{legacy,h17}andcmd_ch_sensor_lsc_grid_{legacy,h17}) are__packedwith exactstatic_assertsizes (0x10,0x14,0xb0,0x114);isp_cmd_ch_sensor_lsc_info_get()validatesnum_x,num_y,bit_depth, anddata_sizebounds beforeisp_cmd_ch_sensor_lsc_grid_get()allocateshdr_size + lsc->data_sizeand copies coordinates/payload. isp_ch_cache_permodule_lsc()clears priorlsc->valid/lsc->databefore querying, treats absent module LSC as non-fatal while propagatingREAD_ONCE(isp->ipc_error)on IPC transport failure, and leaves image output unchanged.tools/asahi/isp-tests.pyextractsisp_cmd_send_bufand aims the overwrite negative control at the lowest sender, andisp_test_permodule_lsc_wireverifies both legacy and H17 wire layouts. Exact-head K114s (26def99b4e38) PASS row is in the PR body.
Evidence
- Diff reviewed:
aurora-silicon/linux#3929@26def99b4e38ab371ad4efdbe240ec492c301c63(7 files, +351/-10). - CI status checked:
pr-textSUCCESS;apple-build,host-tests,KUnit plan,readinessQUEUED. - Exact-head hardware row in PR body: K114s T6050 at
26def99b4e38PASS (per-module LSC 19x17 (8-bit)read, 40/40 frames, 0 firmware errors).
|
Local CI at
Reply layouts: the PR body now says where each field comes from (raw reply dumps on J713 for H17 and J615 for legacy). |
|
J615 (M3 Air), 27.2.0 ISP on saved |
|
J713 (M4 Air) hardware row for |
satchlj
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 26def99 (once queued Actions apple-build and KUnit finish green)
Full diff audited earlier with no code blockers; Actions host-tests (including the updated tools/asahi/isp-tests.py extraction) is green, local arm64 KUnit (60/60) and W=1 build receipts are posted, and exact-head hardware rows now cover both reply layouts (K114s and J713 H17 19x17 8-bit, plus J615 legacy 15x15 8-bit). Clearing the review gate now so merge can proceed as soon as the queued Actions build/KUnit jobs complete.
|
Local PC qualification for Ran Hosted host-tests passed. The author reported 60/60 Arm64 ISP KUnit cases at this head. The K114s target result and the J615 legacy and J713 H17 results cover both grid layouts. KUnit result · J615 · J713 |
What
Each camera module carries its own lens shading measurement in the sensor NVM, and the ISP firmware hands it out on request. Read and cache it during sensor detection, for the follow-up that uses it:
isp_cmd_send_data()sends a command whose reply is larger than the IPC command area throughisp->data_surf; the shared send path moves fromisp_cmd_send_chan()intoisp_cmd_send_buf().CISP_CMD_CH_SENSOR_PERMODULE_LSC_INFO_GET(0x0507) and..._GRID_GET(0x0511) for the legacy (0x10/0xb0-byte header, 8-bit samples) and H17 (0x14/0x114-byte header, 8..16-bit samples) ABIs; the grid is validated and cached. A module without the data is not an error; an IPC transport failure is.tools/asahi/isp-tests.py: extractisp_cmd_send_buf()too and aim the overwrite control at the lowest sender, which now holds the latch (fixes the 5 host-test jobs that failed on media: apple: isp: query per-module lens shading calibration from sensor NVM #3901).Where the reply layouts come from
Our own Linux dumps of the raw 0x0507/0x0511 replies (debug print added locally on top of this code, zero-reboot module swap, stock module restored after):
isp-cmd.h.Nothing reads the grid yet, so image output does not change.
Replaces #3901, without the ideal-percentage command.
Tested: K114s T6050 (
7.3.0-k114sstack9) at 26def99 pass:per-module LSC 19x17 (8-bit)read, setfile unchanged, 40/40 1920x1080 NV12 frames, 0 firmware errors, stock module restored. ARM64 KUnitapple-isp*60/60 pass at this head and 62/62 on the combined tree (CONFIG_WERROR=y); W=1 build adds no warnings over main; ISP host tests: session/buffers/receive/returns/queue pass, send/overwrite/stop/reset controls fail as they must;checkpatch --strictclean.Risk: two-way · every Mac with an Apple ISP camera: two extra firmware queries at sensor detection, no image change.
Legacy ABI: J615 (
7.3.0-aurora-edge) ran this code (with #3928/#3930 and the local debug print on top) with 0 errors:per-module LSC 15x15 (8-bit), 10/10 frames, stock module restored. Not a byte-exact head row; the same two queries also ran with 0 errors on J413, J615, J713, J616s, Neo and K114s at the replaced PR's heads.