Skip to content

sensor: six recovered hi3516cv6xx drivers, checked against Sony's sheets and upstream STARVIS 2 - #301

Merged
widgetii merged 10 commits into
mainfrom
cv6xx-recovered-sensors
Nov 13, 2026
Merged

widgetii merged 10 commits into
mainfrom
cv6xx-recovered-sensors

Conversation

@widgetii

Copy link
Copy Markdown
Member

Six sensor drivers for Hi3516CV610/CV608, recovered from the SIP-K662C6S module's stock firmware and sibling SDKs, on the cv6xx cis framework with sony_imx662's structure and hardening (#296/#298):

Sensor Mode(s) Clock Source
IMX675 2592x1944 / 2592x1520, 30 fps RAW10, 4 lanes 37.125 MHz firmware bring-up; the rest from imx664
IMX664 2688x1520 30 fps RAW12, 2 lanes 37.125 MHz firmware driver
IMX678 3840x2160 30 fps RAW12, 4 lanes 37.125 MHz Hi3519DV500 driver, rewritten onto cis_info
IMX415 3840x2160 / 1080p binning, 30 fps RAW10, 4 lanes 37.125 MHz firmware bring-up, CV500 AE/AWB
SC850SL 8 MP, 4 lanes RAW12 27 MHz firmware driver
GC2063 1920x1080 30 fps RAW10 27 MHz firmware bring-up (= CV500 GC2053 table)

The vendor day-scene IQ for these sensors goes to the OpenIPC firmware as iq/<sensor>.ini, in a follow-up there.

Register validation (OpenIPC/firmware#2736)

The init tables were checked against Sony's Standard Register Setting sheets and the upstream Linux sony-starvis2 v7 series. The method was first run on sony_imx662, which works on hardware.

  • IMX662 (control). Against Sony Ver2.0 and upstream: one value differs and two registers are missing. This shows how far a vendor table can lag Sony's latest sheet and still run fine.
  • IMX675. It is Sony's "4lane, 10bit, 594Mbps, 30fps" column, apart from 25 analog values from an earlier sheet revision (0x3c0a-f, 0x4550-64, 0x347b). Sony and upstream agree on those, so the driver follows Sony; each value is marked with the vendor's. LANEMODE is left at reset (4 lanes), where HMAX 1125 clears both references' shortest line.
  • IMX678. No value mismatches against upstream over about 370 registers; the 13 registers upstream adds are included. The source's 60 fps mode is dropped, because its init only ever wrote the 4K30 table. The source's HCG switch at index 27 would also have written gain codes below 34, which Sony's reference forbids.
  • IMX415. No mismatches against mainline imx415.c (its init table, the 891 Mbps link table and the 37.125 MHz clock parameters). The CFA is GBRG, not the RGGB the extraction had carried over.
  • Exposure. Sony and upstream allow SHR in [4, VMAX-1]. The new drivers hold SHR0 >= 6. sony_imx662 clamped at 3 and told AE VMAX-2; it now uses 4 on both sides (its own commit).

Other fixes made during the port:

Verification

  • make CHIPARCH=hi3516cv6xx with the cv6xx toolchain builds all 20 sensor libraries with no warnings.
  • The six new drivers and imx662 also build with -Wall -Wextra -Werror.
  • Each new .so exports g_sns_<sensor>_obj and needs only libc.

None of the six has run on its sensor yet. The lab module carries an IMX662.

An IMX675 (STARVIS 2, 5 MP) driver on the cv6xx cis framework. The SIP-K662C6S
module's stock firmware has no MPP driver for it, only the register bring-up,
inlined (sub_AB358 for 5M, sub_ABB80 for 4M). Those tables are taken as they
stand. The register map, exposure and gain model, AWB and ISP tables come from
sony_imx664, the nearest STARVIS 2 sibling the firmware carries, and are
untuned for the IMX675.

- 2592x1944 and 2592x1520 (an even, centred crop), 30 fps RAW10, 4 lanes at
  594 Mbps, 37.125 MHz; VMAX 2200, HMAX 1125.
- Mirror and flip on HREVERSE/VREVERSE, kept per pipe, written in standby by
  every bring-up and live by the callback.
- The imx662 hardening: sensor lock around bring-up, SHR0 underflow guard,
  VMAX/SHR0 seeded before AE, checked bring-up, _Static_assert on each ISP
  byte image, and the Bayer NR re-lay of #296.

Checked against Sony's IMX675 Standard Register Setting Ver1.0 (column 4lane,
10bit, 594Mbps, 30fps) and the upstream Linux sony-starvis2 v7 series
(OpenIPC/firmware#2736). Every register the sheet sets matches, except 25
analog values where the vendor table is an earlier revision: 0x3c0a-0x3c0f,
0x4550-0x4564 and 0x347b. Both references agree on those, so they follow Sony;
each is marked with the vendor's value. LANEMODE is left at reset (4 lanes),
where HMAX 1125 clears both references' shortest line.

Not run on an IMX675 yet.
The IMX664 (STARVIS 2, 4 MP) driver of the SIP-K662C6S module's stock firmware,
recovered from that firmware and rebuilt against this tree's sensor interface
and common/sensor_common.c, as sony_imx662 was in #296: its power-on table,
exposure and gain model (0.3 dB ladder, high conversion gain above analog index
99), AWB calibration and ISP default tables.

- 2688x1520 30 fps RAW12, 2 lanes at 1188 Mbps, 37.125 MHz.
- Mirror and flip on HREVERSE/VREVERSE, per pipe, as sony_imx662.
- The imx662 hardening, and the same Bayer NR re-lay: the vendor's NR image is
  byte-identical to imx662's.

The table is the vendor's, byte for byte. Neither Sony's IMX662 sheet nor the
upstream STARVIS 2 driver covers the IMX664, so it has no register oracle. Its
ADBIT (0x3022) value 2 is not one the sibling sheets define; it is kept and
noted.

Not run on an IMX664 yet.
…2 driver

The K662C6S firmware has only scene tuning for the IMX678 (STARVIS 2, 8 MP),
no driver. This one starts from Sony's Hi3519DV500 driver, a self-contained
driver with its own I2C layer, and is rewritten onto the cv6xx cis framework
with sony_imx662's structure and hardening.

- One mode: 3840x2160 30 fps RAW12, 4 lanes at 1188 Mbps, 37.125 MHz;
  VMAX 2250, HMAX 1100. The source's 60 fps mode is dropped: its init only
  ever wrote the 4K30 table.
- The init table is the source's, with SHR0 seeded at 4 (Sony's minimum, not
  3). It also adds the 13 registers the upstream Linux sony-starvis2 v7 table
  sets and the source did not. Against that table there are no value
  mismatches over its ~370 registers (OpenIPC/firmware#2736).
- Gain: the IMX678's own 27-step HCG offset, switched above analog index 99.
  The source switched at 27, which would write gain codes below 34 under
  HCG, and Sony's reference forbids those.
- The IMX678's own AWB, colour matrix and DNG colour. Its Bayer NR, DRC, LSC
  and ACS are imx664 byte images, and its CA is sc450ai's; each is a
  _Static_assert-guarded b[N]. Mesh shading off, as the vendor ships every
  CV610 sensor. The sharpen fields CV610 has and the Hi3519DV500 lacks are
  filled from imx664.
- Mirror and flip on HREVERSE/VREVERSE; RGGB in every orientation, as
  upstream.

Not run on an IMX678 yet, and 4K30 throughput on CV610 is unmeasured.
The K662C6S board's default sensor, the IMX415 (original STARVIS, 8 MP). The
bring-up is the stock firmware's (sub_A9278 8M, sub_A9A8C 2M binning). The
gen-1 exposure and gain model (no conversion gain) and the AWB come from the
Hi3516CV500 driver, and the ISP tables are the firmware's IMX335 tables,
untuned for the IMX415.

- 3840x2160 and 1920x1080 2x2 binning, 30 fps RAW10, 4 lanes at 891 Mbps,
  37.125 MHz; VMAX 2250, HMAX 1100.
- The CFA is GBRG, as the CV500 driver, mainline Linux (SGBRG10) and the
  OpenIPC CV500 profile have it; the extraction had carried RGGB over from
  its IMX335 template.
- Mirror and flip on 0x3030. The inverted readout starts one pixel further in,
  so the Bayer phase stays put.
- The imx662 hardening and Bayer NR re-lay; mesh shading off, since the
  IMX335 grid fits no IMX415 mode (#299).

Checked against mainline drivers/media/i2c/imx415.c (its init table, the
891 Mbps link table and the 37.125 MHz clock parameters): no value mismatches.
HMAX 1100 is the 4-lane shortest line at that rate. 0x30c0/0x30c1 (sync pin
outputs) stay at reset, high impedance, as the vendor runs them.

Not run on an IMX415 yet.
The SmartSens SC850SL (8 MP) driver of the SIP-K662C6S stock firmware, which
has no SDK counterpart. Its init is unrolled in the firmware, not a table, and
was recovered write by write. Its ISP default tables come byte for byte from
the firmware's callback set (sub_B4538); the gain tables are SmartSens-standard
and were checked against the binary. Laid out as smart_sc450ai.

- 27 MHz sensor clock ("27MInput_4lane_1080Mbps_12bit").
- Both Bayer NR images had the #296 layout skew and are re-laid.
- Hardening as sony_imx662. Standby and restart drive 0x0100; the vendor's were
  empty.
- Mirror and flip on 0x3221, relative to the 0x66 the init writes (the module
  is mounted rotated). BGGR in every orientation, as the XMedia SC850SL driver
  reports it.

Not run on an SC850SL yet.
The GalaxyCore GC2063 (2 MP, GC2053 register-compatible), laid out as
galaxycore_gc4653. The init is the stock firmware's (sub_AE770), and it is
write for write the Hi3516CV500 GC2053 1080p30 sequence. The exposure and gain
model and the AWB come from that driver. The ISP tables are gc4023's, untuned
for the GC2063.

- 1920x1080 30 fps RAW10, 27 MHz ("gc2063 27Mclk 2M30fps(MIPI)").
- AE as the GC2053 drivers and gc4653 sync it: shutter and gain one frame
  after VMAX.
- RGGB, the order the OpenIPC GC2053 profiles run this same table with.
- Mirror and flip on page-0 0x17. The GC2053 references move no window for
  it. Not verified on a GC2063.
- Hardening as sony_imx662. Standby and restart use 0xf2/0xfc, as the CV500
  driver does.

Not run on a GC2063 yet.
Sony's IMX662 register setting sheet and the upstream Linux STARVIS 2 driver
(since v7's exposure fix) put SHR0 in [4, VMAX - 1]. The driver clamped it at
3, and it told AE that VMAX - 2 lines was the longest exposure, which that
clamp never allowed. Both are now 4. The longest exposure is one line shorter,
and AE is told exactly what it gets.

Found while checking the cv6xx STARVIS 2 drivers against those references
(OpenIPC/firmware#2736).
…mx675, imx678

GC2063 and SC850SL run at 27 MHz, as their vendor banners say. The four Sony
sensors run at 37.125 MHz, as INCK_SEL in each init table says. Without an
entry, the sensor clock is written 0 and the sensor stays dark.
Adds the six drivers above, and GC4653, MIS20S1, CV2003 and VS4388, which had drivers but no rows.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add six recovered Hi3516CV6xx sensor drivers

✨ Enhancement 🐞 Bug fix 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Add six CV6xx sensor drivers with recovered modes, exposure controls, and ISP defaults.
Diagram

graph TD
  CLK["Sensor clocks"] --> DRV["Six sensor drivers"] --> CIS["CIS common"] --> ISP["ISP and 3A"]
  TABLE["Mode tables"] --> CTRL["Bring-up control"] --> CIS
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Extract a shared Sony driver core
  • ➕ Could consolidate repeated STARVIS exposure, gain, and callback logic across four new drivers.
  • ➖ Adds a new abstraction to an existing per-sensor framework and complicates sensor-specific timing and tuning review.

Recommendation: Keep the per-sensor drivers for this recovery: they follow the existing CIS conventions and preserve the provenance of each register table. Consider extracting shared Sony logic after hardware validation establishes which behaviors are genuinely identical.

Files changed (51) +16334 / -5

Enhancement (41) +15784 / -0
MakefileBuild GC2063 sensor libraries +35/-0

Build GC2063 sensor libraries

• Adds shared and static GC2063 library targets using the CV6xx includes and common CIS source.

libraries/sensor/hi3516cv6xx/galaxycore_gc2063/Makefile

gc2063_cfg.hAdd GC2063 1080p register sequence +103/-0

Add GC2063 1080p register sequence

• Defines the recovered paged-register power-on sequence for the 30 fps RAW10 mode.

libraries/sensor/hi3516cv6xx/galaxycore_gc2063/gc2063_cfg.h

gc2063_cmos.cImplement GC2063 CIS and 3A callbacks +935/-0

Implement GC2063 CIS and 3A callbacks

• Adds mode selection, frame and exposure updates, gain conversion, ISP/AWB defaults, and sensor registration. Seeds initial AE writes and uses a one-frame shutter/gain delay.

libraries/sensor/hi3516cv6xx/galaxycore_gc2063/gc2063_cmos.c

gc2063_cmos.hDefine GC2063 register and timing constants +149/-0

Define GC2063 register and timing constants

• Declares the sensor ID, paged I2C format, 1080p timing, exposure limits, and gain parameters derived from GC2053.

libraries/sensor/hi3516cv6xx/galaxycore_gc2063/gc2063_cmos.h

gc2063_cmos_param.hSupply GC2063 ISP defaults +3964/-0

Supply GC2063 ISP defaults

• Adds GC4023-derived ISP parameter images as an explicitly untuned starting point for GC2063.

libraries/sensor/hi3516cv6xx/galaxycore_gc2063/gc2063_cmos_param.h

gc2063_sensor_ctrl.cControl GC2063 bring-up and orientation +138/-0

Control GC2063 bring-up and orientation

• Applies the recovered table and initial AE registers with checked writes, and retains mirror/flip requests per pipe under the CIS mutex.

libraries/sensor/hi3516cv6xx/galaxycore_gc2063/gc2063_sensor_ctrl.c

gc2063_sensor_ctrl.hDeclare GC2063 control entry points +20/-0

Declare GC2063 control entry points

• Exposes mode initialization and per-pipe orientation operations to the driver.

libraries/sensor/hi3516cv6xx/galaxycore_gc2063/gc2063_sensor_ctrl.h

MakefileBuild SC850SL sensor libraries +35/-0

Build SC850SL sensor libraries

• Adds shared and static SC850SL targets linked with the common CIS implementation.

libraries/sensor/hi3516cv6xx/smart_sc850sl/Makefile

sc850sl_cfg.hAdd SC850SL linear and WDR register tables +422/-0

Add SC850SL linear and WDR register tables

• Defines firmware-recovered power-on sequences for the 8 MP RAW12 linear and RAW10 two-to-one WDR modes.

libraries/sensor/hi3516cv6xx/smart_sc850sl/sc850sl_cfg.h

sc850sl_cmos.cImplement SC850SL linear and WDR callbacks +1706/-0

Implement SC850SL linear and WDR callbacks

• Adds mode-dependent AE, gain, WDR exposure ranges, AWB/ISP defaults, register synchronization, and exported sensor callbacks. Seeds bring-up registers before AE runs.

libraries/sensor/hi3516cv6xx/smart_sc850sl/sc850sl_cmos.c

sc850sl_cmos.hDefine SC850SL registers and mode limits +218/-0

Define SC850SL registers and mode limits

• Declares linear/WDR frame geometry, half-line exposure and gain constants, I2C addressing, and stream/orientation registers.

libraries/sensor/hi3516cv6xx/smart_sc850sl/sc850sl_cmos.h

sc850sl_sensor_ctrl.cInitialize SC850SL modes with checked writes +174/-0

Initialize SC850SL modes with checked writes

• Resets and programs the selected mode, replays seeded AE values, and starts streaming only after successful initialization. Preserves per-pipe orientation through bring-up.

libraries/sensor/hi3516cv6xx/smart_sc850sl/sc850sl_sensor_ctrl.c

sc850sl_sensor_ctrl.hDeclare SC850SL mode and orientation controls +25/-0

Declare SC850SL mode and orientation controls

• Exposes linear, WDR, and per-pipe orientation entry points.

libraries/sensor/hi3516cv6xx/smart_sc850sl/sc850sl_sensor_ctrl.h

MakefileBuild IMX415 sensor libraries +35/-0

Build IMX415 sensor libraries

• Adds CV6xx shared and static IMX415 builds using the common CIS source.

libraries/sensor/hi3516cv6xx/sony_imx415/Makefile

imx415_cfg.hAdd IMX415 all-pixel and binning tables +314/-0

Add IMX415 all-pixel and binning tables

• Defines the recovered register sequences for RAW10 4K and 1080p binning at 30 fps.

libraries/sensor/hi3516cv6xx/sony_imx415/imx415_cfg.h

imx415_cmos.cImplement IMX415 sensor and 3A integration +929/-0

Implement IMX415 sensor and 3A integration

• Adds linear-mode selection, bounded exposure and gain handling, AE/AWB/ISP callbacks, and initial register seeding for both readouts.

libraries/sensor/hi3516cv6xx/sony_imx415/imx415_cmos.c

imx415_cmos.hDefine IMX415 timing and gain model +140/-0

Define IMX415 timing and gain model

• Declares sensor-specific registers, 4K/binning geometry, exposure bounds, RAW10 metadata, and first-generation Sony gain limits.

libraries/sensor/hi3516cv6xx/sony_imx415/imx415_cmos.h

imx415_cmos_param.hAdd IMX335-derived IMX415 ISP baseline +111/-0

Add IMX335-derived IMX415 ISP baseline

• Supplies firmware-recovered ISP defaults and byte-image size assertions, including the corrected Bayer NR layout. These defaults are not IMX415-specific tuning.

libraries/sensor/hi3516cv6xx/sony_imx415/imx415_cmos_param.h

imx415_sensor_ctrl.cSequence IMX415 bring-up and flips +146/-0

Sequence IMX415 bring-up and flips

• Programs either mode in standby, checks register writes, restores per-pipe orientation, and starts the sensor after the stabilization delay.

libraries/sensor/hi3516cv6xx/sony_imx415/imx415_sensor_ctrl.c

imx415_sensor_ctrl.hDeclare IMX415 bring-up operations +21/-0

Declare IMX415 bring-up operations

• Exposes the all-pixel and binning initializers plus orientation controls.

libraries/sensor/hi3516cv6xx/sony_imx415/imx415_sensor_ctrl.h

MakefileBuild IMX664 sensor libraries +35/-0

Build IMX664 sensor libraries

• Adds shared and static IMX664 builds against the CV6xx SDK and common CIS source.

libraries/sensor/hi3516cv6xx/sony_imx664/Makefile

imx664_cfg.hAdd IMX664 4 MP register table +222/-0

Add IMX664 4 MP register table

• Defines the firmware-recovered 2688×1520, 30 fps RAW12 initialization sequence.

libraries/sensor/hi3516cv6xx/sony_imx664/imx664_cfg.h

imx664_cmos.cImplement IMX664 CIS callbacks +916/-0

Implement IMX664 CIS callbacks

• Provides sensor registration, linear-mode AE/AWB/ISP defaults, frame-length and shutter updates, and analog/digital gain with high-conversion-gain switching.

libraries/sensor/hi3516cv6xx/sony_imx664/imx664_cmos.c

imx664_cmos.hDefine IMX664 sensor constants +121/-0

Define IMX664 sensor constants

• Declares the STARVIS 2 register map, 4 MP frame timing, shutter limits, gain model, and sensor metadata.

libraries/sensor/hi3516cv6xx/sony_imx664/imx664_cmos.h

imx664_cmos_param.hProvide firmware-derived IMX664 ISP defaults +103/-0

Provide firmware-derived IMX664 ISP defaults

• Adds recovered ISP byte images with size assertions and re-lays the Bayer NR image for the CV6xx structure.

libraries/sensor/hi3516cv6xx/sony_imx664/imx664_cmos_param.h

imx664_sensor_ctrl.cAdd checked IMX664 bring-up +131/-0

Add checked IMX664 bring-up

• Writes the mode and initial AE registers in standby, restores synchronized per-pipe orientation, then releases standby and starts readout.

libraries/sensor/hi3516cv6xx/sony_imx664/imx664_sensor_ctrl.c

imx664_sensor_ctrl.hDeclare IMX664 control functions +20/-0

Declare IMX664 control functions

• Exposes mode initialization and orientation operations to the CMOS callbacks.

libraries/sensor/hi3516cv6xx/sony_imx664/imx664_sensor_ctrl.h

MakefileBuild IMX675 sensor libraries +35/-0

Build IMX675 sensor libraries

• Adds shared and static IMX675 targets using the CV6xx headers and common CIS implementation.

libraries/sensor/hi3516cv6xx/sony_imx675/Makefile

imx675_cfg.hAdd Sony-checked IMX675 register tables +339/-0

Add Sony-checked IMX675 register tables

• Defines 5 MP all-pixel and centered 4 MP crop sequences, replacing identified older vendor analog values with Sony sheet values.

libraries/sensor/hi3516cv6xx/sony_imx675/imx675_cfg.h

imx675_cmos.cImplement IMX675 mode and 3A callbacks +929/-0

Implement IMX675 mode and 3A callbacks

• Adds both linear readouts, bounded shutter and gain updates, AE/AWB/ISP defaults, and exported CIS sensor registration.

libraries/sensor/hi3516cv6xx/sony_imx675/imx675_cmos.c

imx675_cmos.hDefine IMX675 geometry and STARVIS 2 limits +142/-0

Define IMX675 geometry and STARVIS 2 limits

• Declares sensor registers, timing for both RAW10 modes, exposure bounds, and IMX664-derived gain and calibration constants.

libraries/sensor/hi3516cv6xx/sony_imx675/imx675_cmos.h

imx675_cmos_param.hReuse IMX664 ISP defaults for IMX675 +107/-0

Reuse IMX664 ISP defaults for IMX675

• Provides an explicitly untuned ISP baseline with byte-image assertions and corrected Bayer NR structure layout.

libraries/sensor/hi3516cv6xx/sony_imx675/imx675_cmos_param.h

imx675_sensor_ctrl.cControl IMX675 mode bring-up +141/-0

Control IMX675 mode bring-up

• Applies the chosen table and initial AE registers with checked writes, retaining orientation per pipe before starting the sensor.

libraries/sensor/hi3516cv6xx/sony_imx675/imx675_sensor_ctrl.c

imx675_sensor_ctrl.hDeclare IMX675 mode and orientation entry points +21/-0

Declare IMX675 mode and orientation entry points

• Exposes the 5 MP and cropped 4 MP initializers and per-pipe orientation functions.

libraries/sensor/hi3516cv6xx/sony_imx675/imx675_sensor_ctrl.h

MakefileBuild IMX678 sensor libraries +35/-0

Build IMX678 sensor libraries

• Adds shared and static IMX678 builds using the CV6xx includes and existing common CIS source.

libraries/sensor/hi3516cv6xx/sony_imx678/Makefile

imx678_cfg.hAdd validated IMX678 4K30 table +411/-0

Add validated IMX678 4K30 table

• Ports the RAW12 initialization sequence and includes additional registers set by the upstream STARVIS 2 driver.

libraries/sensor/hi3516cv6xx/sony_imx678/imx678_cfg.h

imx678_cmos.cImplement IMX678 linear sensor callbacks +937/-0

Implement IMX678 linear sensor callbacks

• Adds 4K30 registration, bounded exposure, 3A and ISP defaults, and gain switching that avoids unsupported high-conversion-gain codes. Does not expose the source driver’s ineffective 60 fps mode.

libraries/sensor/hi3516cv6xx/sony_imx678/imx678_cmos.c

imx678_cmos.hDefine IMX678 register and gain limits +130/-0

Define IMX678 register and gain limits

• Declares 4K RAW12 timing, sensor register addresses, AWB calibration, exposure bounds, and revised high-conversion-gain parameters.

libraries/sensor/hi3516cv6xx/sony_imx678/imx678_cmos.h

imx678_cmos_param.hAdapt IMX678 ISP data to CV6xx +1197/-0

Adapt IMX678 ISP data to CV6xx

• Ports usable ISP defaults from the Hi3519DV500 driver, substitutes compatible CV6xx structures where layouts differ, and guards byte images with size assertions.

libraries/sensor/hi3516cv6xx/sony_imx678/imx678_cmos_param.h

imx678_sensor_ctrl.cSequence IMX678 bring-up and restart +167/-0

Sequence IMX678 bring-up and restart

• Programs the checked 4K table and AE slots in standby, applies per-pipe orientation, and waits for regulator stabilization before master start. Adds explicit standby and restart operations.

libraries/sensor/hi3516cv6xx/sony_imx678/imx678_sensor_ctrl.c

imx678_sensor_ctrl.hDeclare IMX678 sensor control operations +25/-0

Declare IMX678 sensor control operations

• Exposes initialization, standby/restart, orientation, and the regulator stabilization delay.

libraries/sensor/hi3516cv6xx/sony_imx678/imx678_sensor_ctrl.h

Bug fix (2) +6 / -3
imx662_cmos.cClarify IMX662 SHR0 clamp comment +1/-1

Clarify IMX662 SHR0 clamp comment

• Changes the exposure comment to reference the named clamp constants; the behavioral adjustment is in the header.

libraries/sensor/hi3516cv6xx/sony_imx662/imx662_cmos.c

imx662_cmos.hAlign IMX662 AE limit with SHR0 minimum +5/-2

Align IMX662 AE limit with SHR0 minimum

• Raises the SHR0 minimum and AE frame offset to four lines, aligning the advertised maximum exposure with the Sony-supported shutter bound.

libraries/sensor/hi3516cv6xx/sony_imx662/imx662_cmos.h

Documentation (7) +528 / -1
README.mdList additional CV6xx sensors +10/-1

List additional CV6xx sensors

• Adds the six new drivers to the sensor support matrix and records several other CV6xx sensors already present.

README.md

README.mdDocument GC2063 recovery and limitations +53/-0

Document GC2063 recovery and limitations

• Records the firmware table’s GC2053 equivalence, 1080p mode, borrowed ISP defaults, orientation behavior, and lack of hardware verification.

libraries/sensor/hi3516cv6xx/galaxycore_gc2063/README.md

README.mdDocument SC850SL modes and provenance +65/-0

Document SC850SL modes and provenance

• Describes the recovered linear and virtual-channel WDR modes, firmware tuning, exposure conventions, orientation, and unverified hardware status.

libraries/sensor/hi3516cv6xx/smart_sc850sl/README.md

README.mdDocument IMX415 sources and register checks +106/-0

Document IMX415 sources and register checks

• Describes 4K and 1080p binning, mainline register comparisons, corrected GBRG CFA, borrowed IMX335 ISP defaults, and lack of sensor testing.

libraries/sensor/hi3516cv6xx/sony_imx415/README.md

README.mdDocument recovered IMX664 driver +72/-0

Document recovered IMX664 driver

• Records its firmware provenance, RAW12 mode, gain and orientation behavior, ISP table layout correction, and unresolved vendor ADBIT setting.

libraries/sensor/hi3516cv6xx/sony_imx664/README.md

README.mdDocument IMX675 modes and Sony comparisons +106/-0

Document IMX675 modes and Sony comparisons

• Explains the two recovered readouts, Sony-aligned analog register corrections, IMX664-derived untuned defaults, and untested hardware status.

libraries/sensor/hi3516cv6xx/sony_imx675/README.md

README.mdDocument IMX678 port and validation +116/-0

Document IMX678 port and validation

• Describes the CV500-derived 4K30 mode, upstream register comparison, corrected high-conversion-gain threshold, adapted ISP tables, and hardware uncertainties.

libraries/sensor/hi3516cv6xx/sony_imx678/README.md

Other (1) +16 / -1
sys_cfg.cSelect clocks for the six new sensors +16/-1

Select clocks for the six new sensors

• Maps GC2063 and SC850SL to 27 MHz, and IMX415, IMX664, IMX675, and IMX678 to 37.125 MHz.

kernel/sys_config/hi3516cv6xx/sys_cfg.c

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. WDR starts with zero exposure settings ✓ Resolved
Description
cmos_comm_sns_reg_info_init() seeds exposure and gain only for linear mode, leaving the WDR
exposure, gain, and short-exposure-limit slots at zero. During normal WDR initialization,
sc850sl_default_reg_init() replays those slots after the recovered mode table, replacing its
nonzero exposure and short-exposure-limit values before streaming starts.


Remediation recommended

2. GC2063 cannot use its highest gain step 🐞 Bug ≡ Correctness
Description
GC2063_AGAIN_MAX advertises 113168 even though the last analog-gain table entry is 123568. When AE
requests gain within its advertised limit, cmos_again_calc_table() selects at most the preceding
entry, leaving the final sensor gain setting unreachable.
Code

libraries/sensor/hi3516cv6xx/galaxycore_gc2063/gc2063_cmos.h[71]

+#define GC2063_AGAIN_MAX      113168
Evidence
The table ends at 123568, but AE receives 113168 as both its maximum gain and maximum target. The
conversion callback selects the final table index only for requests of at least 123568.

libraries/sensor/hi3516cv6xx/galaxycore_gc2063/gc2063_cmos.h[68-75]
libraries/sensor/hi3516cv6xx/galaxycore_gc2063/gc2063_cmos.c[75-79]
libraries/sensor/hi3516cv6xx/galaxycore_gc2063/gc2063_cmos.c[147-153]
libraries/sensor/hi3516cv6xx/galaxycore_gc2063/gc2063_cmos.c[278-299]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The advertised GC2063 analog-gain maximum falls below the last gain-table value, making that setting unreachable through AE.
## Fix Focus Areas
- libraries/sensor/hi3516cv6xx/galaxycore_gc2063/gc2063_cmos.h[68-75]
- libraries/sensor/hi3516cv6xx/galaxycore_gc2063/gc2063_cmos.c[75-79]
## Recommended Fix
Set the advertised analog-gain maximum to the final supported table value, 123568, so AE can request and select the last entry.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. IMX675 AE gets less exposure than it asks for ✓ Resolved
Description
In IMX675 and IMX664, FL_OFFSET_LINEAR is 2, so AE advertises a maximum exposure of VMAX-2 while
cmos_inttime_update keeps SHR0 at SHR0_MIN (6) or above. Requests in the top four lines, VMAX-5
through VMAX-2, therefore produce at most VMAX-6 lines of exposure while AE believes the requested
exposure was applied.

4. Pixel calibration on SC850SL leaves a wrong frame rate ✓ Resolved
Description
cmos_isp_set_pixel_detect writes VMAX low byte first to 0x320E, but 0x320E is the high byte, and
it writes the exposure as low/high bytes instead of the 4/8/4-bit half-line split used in the normal
path. On exit it writes fl_std back without the >> 1, even though fl_std is stored as `VMAX <<
1`, so leaving calibration programs a scrambled VMAX and the sensor runs at the wrong frame timing.

Grey Divider

Tip of the day
💡 Did you know, you can start a comment with 'qodo' or '@qodo' to chat about any finding

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

- sc850sl: the bring-up seeded only the linear-mode slots, so a 2-to-1 WDR
  bring-up replayed zero long and short exposure, gains and short-exposure
  limit over the WDR table. Each is now seeded from the WDR table's own
  values (long 0x1000, short 0x100, limit 0x10a, 1x gain), and only where AE
  has not written yet.
- sc850sl: the pixel-calibration hooks wrote VMAX low byte first to 0x320e,
  its high byte, and the exposure as plain bytes. On leaving they wrote back
  fl_std, which is in half lines. They now write VMAX high byte first and the
  exposure in half lines with the 4/8/4 split cmos_inttime_update_linear()
  uses, and leave with fl_std >> 1.
- imx675, imx664, imx415: AE was told the longest exposure was VMAX - 2
  (VMAX - 8 on the IMX415), but SHR0 stays at 6 (9) or above, so the longest
  is VMAX - 6 (VMAX - 9). FL_OFFSET_LINEAR now equals SHR0_MIN, and AE is
  told what it gets.
- gc2063: the analog-gain ceiling stays at 113168, below the table's last
  entry, as the Hi3516CV500 GC2053 driver has it; now said beside the define.
@widgetii

Copy link
Copy Markdown
Member Author

Review round (Qodo):

  1. SC850SL WDR starts with zero exposure: fixed. The bring-up now seeds the WDR slots from the WDR table's own values: long exposure 0x1000, short 0x100, short-exposure limit 0x10a, and 1x long and short gains. Slots AE has already written are left alone.
  2. GC2063 top gain step unreachable: kept on purpose. 113168 is the ceiling of the Hi3516CV500 GC2053 driver this table comes from (u32MaxAgain = 113168), so the last step is unused there too. There is now a comment saying so.
  3. IMX675/IMX664 AE gets less exposure than it asks for: fixed, and IMX415 had the same mismatch (VMAX-8 advertised, SHR0 >= 9). FL_OFFSET_LINEAR now equals SHR0_MIN in all three. IMX678 was already consistent (8 vs 6).
  4. SC850SL pixel calibration scrambles VMAX: fixed. VMAX is written high byte first, the exposure goes in half lines with the 4/8/4 split, and exit writes fl_std >> 1.

All six drivers still build with -Wall -Wextra -Werror.

@widgetii
widgetii merged commit 055c553 into main Nov 13, 2026
37 checks passed
@widgetii
widgetii deleted the cv6xx-recovered-sensors branch November 13, 2026 16:25
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.

1 participant