Skip to content

sensor/av100: drop vendor prefix from libsns_* LIB_NAME#83

Merged
widgetii merged 3 commits into
mainfrom
sensor/av100-drop-vendor-prefix-from-libname
May 7, 2026
Merged

sensor/av100: drop vendor prefix from libsns_* LIB_NAME#83
widgetii merged 3 commits into
mainfrom
sensor/av100-drop-vendor-prefix-from-libname

Conversation

@widgetii

@widgetii widgetii commented May 5, 2026

Copy link
Copy Markdown
Member

Summary

The hi3516av100 sensor source dirs were the only platform whose Makefile `LIB_NAME` carried a vendor prefix (`libsns_aptina_ar0230`, `libsns_sony_imx123`, …). Every other platform (cv100, cv200, cv300, v101, cv500, ev200/gk7205v200) uses the unprefixed `libsns_` form, and the av100 firmware sensor `.ini` files (`hisilicon-osdrv-hi3516av100/files/sensor/config/*.ini`) already reference the unprefixed names via their `DllFile=` entries.

Renaming aligns av100 with the rest of the platforms and lets the source-built sensors replace the matching binary blobs shipped by `hisilicon-osdrv-hi3516av100`. Without this rename, source-built and binary lib files would land side-by-side under different names.

The vendor prefix only appeared in the `LIB_NAME` declaration; no C symbols, headers, or callers reference it.

Renames

Source dir Before After
aptina_ar0230 libsns_aptina_ar0230 libsns_ar0230
aptina_ar0237 libsns_aptina_ar0237 libsns_ar0237
aptina_ar0237_dc libsns_aptina_ar0237_dc libsns_ar0237_dc
aptina_ar0330 libsns_aptina_ar0330 libsns_ar0330
omnivision_ov4689 libsns_omnivision_ov4689 libsns_ov4689
omnivision_ov5658 libsns_omnivision_ov5658 libsns_ov5658
panasonic_mn34220 libsns_panasonic_mn34220 libsns_mn34220
panasonic_mn34220_mipi libsns_panasonic_mn34220_mipi libsns_mn34220_mipi
smart_sc4236 libsns_smart_sc4236 libsns_sc4236
sony_imx117 libsns_sony_imx117 libsns_imx117
sony_imx123 libsns_sony_imx123 libsns_imx123
sony_imx178 libsns_sony_imx178 libsns_imx178
sony_imx178_37M libsns_sony_imx178_37M libsns_imx178_37M
sony_imx185 libsns_sony_imx185 libsns_imx185

Tracks #82. Required before the firmware-side hisilicon-av100 sensor-wiring PR.

Test plan

  • CI: av100 SDK build job passes
  • CI: ARM cross-compile + symbol verification still passes (no symbol-name impact, only filename)

🤖 Generated with Claude Code

Vixand and others added 3 commits May 7, 2026 16:50
The hi3516av100 sensor source dirs were the only platform whose
Makefile LIB_NAME carried a vendor prefix (libsns_aptina_ar0230,
libsns_sony_imx123, etc.). Every other platform — cv200, cv300,
v101, cv500, ev200/gk7205v200, cv100 — uses the unprefixed
libsns_<model> form, and the av100 firmware sensor .ini files
(general/package/hisilicon-osdrv-hi3516av100/files/sensor/config/*.ini
in OpenIPC/firmware) already reference the unprefixed names via
their DllFile= entries.

Renaming aligns av100 with the rest of the platforms and lets the
source-built sensors replace the matching binary blobs shipped by
hisilicon-osdrv-hi3516av100. Without this rename, source-built and
binary lib files would land side-by-side under different names.

The vendor prefix only appeared in the LIB_NAME declaration; no C
symbols, headers, or callers reference it.

  aptina_ar0230            -> libsns_ar0230
  aptina_ar0237            -> libsns_ar0237
  aptina_ar0237_dc         -> libsns_ar0237_dc
  aptina_ar0330            -> libsns_ar0330
  omnivision_ov4689        -> libsns_ov4689
  omnivision_ov5658        -> libsns_ov5658
  panasonic_mn34220        -> libsns_mn34220
  panasonic_mn34220_mipi   -> libsns_mn34220_mipi
  smart_sc4236             -> libsns_sc4236
  sony_imx117              -> libsns_imx117
  sony_imx123              -> libsns_imx123
  sony_imx178              -> libsns_imx178
  sony_imx178_37M          -> libsns_imx178_37M
  sony_imx185              -> libsns_imx185

Tracks #82. Required before the firmware-side hisilicon-av100
sensor wiring PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two pre-existing latent bugs that the libraries/Makefile's
"|| true" suppressed are now blocking the firmware-side install
phase. Both were waiting for a real consumer.

1. sony_imx117: imx117_sensor_ctl.c includes "pwm.h" which lives
   at kernel/pwm/hi3516av100/pwm.h. The Makefile only added
   kernel/include/hi3516av100 and kernel/isp/arch/hi3516av100/
   to the include path. Add kernel/pwm/hi3516av100 alongside.

2. kernel/include/hi3516av100/hi_spi.h uses _IOC_SIZEBITS in its
   SPI_MSGSIZE macro without including <sys/ioctl.h>. glibc's
   <sys/ioctl.h> is implicitly transitively pulled in by the
   sensor_ctl includes, but musl is stricter and the symbol is
   undeclared, breaking sony_imx123 and sony_imx185 (and any
   future SPI-using sensor) under arm-openipc-linux-musleabi-gcc.
   Include <sys/ioctl.h> directly in the header.

Both fixes are no-ops under glibc (Header guards / pre-existing
declarations) and resolve the musl errors. Verified:
arm-openipc-linux-gnueabi-gcc 13.3.0 still produces identical .so
output for the affected sensors.

The smart_sc4236 source is broken in a deeper way (stSnsSc4236Obj
struct uses ISP_SNS_OBJ_S fields that don't exist in V2A; the
sensor_register_callback signature is V3-style not V2A-style).
That's a real port issue, not a header / Makefile fix — left for
a follow-up. The firmware-side PR (#2056) drops smart_sc4236 from
HISILICON_OPENSDK_SENSORS_hi3516av100 in the meantime.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The directory was imported as part of the original av100 SoC support
in #40 but never built — the source uses V4-era ABI that doesn't
match V2A SDK headers:

- registration callback signature
  GK_S32 sensor_register_callback(VI_PIPE, ALG_LIB_S*, ALG_LIB_S*)
  is V3+/V4 (V2A uses int sensor_register_callback(void))
- ISP_SNS_OBJ_S struct initialiser uses .pfnSetBusInfo and
  .pfnSetInit fields that exist in V4 (ev200) but not in the
  V2A struct definition

The right home for sc4236 is hi3516ev200/smart_sc4236/ — which
already exists and works (1115 lines, current). The av100 copy
(1006 lines, older revision) is a stale partial duplicate; nothing
references it outside its own dir.

Removing the dir lets us drop the libraries/Makefile "|| true"
workaround eventually — silent build failures are exactly what
that workaround masked here.
@widgetii widgetii force-pushed the sensor/av100-drop-vendor-prefix-from-libname branch from 767b8ee to cf8f933 Compare May 7, 2026 13:50
@widgetii widgetii merged commit 690e2be into main May 7, 2026
24 checks passed
@widgetii widgetii deleted the sensor/av100-drop-vendor-prefix-from-libname branch May 7, 2026 14:14
widgetii added a commit to OpenIPC/firmware that referenced this pull request May 7, 2026
Adds HISILICON_OPENSDK_SENSORS_hi3516av100 with 14 sensors — every
av100 sensor that has source in the openhisilicon repo:

  aptina_ar0230            panasonic_mn34220       sony_imx123
  aptina_ar0237            panasonic_mn34220_mipi  sony_imx178
  aptina_ar0237_dc         smart_sc4236            sony_imx178_37M
  aptina_ar0330            sony_imx117             sony_imx185
  omnivision_ov4689
  omnivision_ov5658

Wires the av100 INSTALL_TARGET_CMDS block to install them via the
standard sensor foreach. The block was previously kernel-modules-
only (no sensor install at all).

Bumps openhisilicon pin from 680085e to c895c26 to consume the
av100 LIB_NAME rename (drops the libsns_aptina_ / libsns_sony_ /
libsns_omnivision_ etc. vendor prefix that was unique to av100,
landed in OpenIPC/openhisilicon#83). The pin bump also picks up
two unrelated openhisilicon commits already on main:

  bad4243 hi3516cv500: kernel 5.0–7.0 compat for OSAL, init
          wrappers, and drivers (openhisilicon#61)
  3ccbffa osal/cv500: default to "cma" allocator and gracefully
          fall back (openhisilicon#81)

Both already merged on openhisilicon main; this is the first
firmware PR to consume them. Cv500 builds may pick up minor
behavioural changes from these.

Deletes 9 binary blobs from
general/package/hisilicon-osdrv-hi3516av100/files/sensor/ — every
source-built libname that exact-matches a binary blob (only
possible after the openhisilicon rename):
  libsns_ar0230.so       libsns_imx123.so
  libsns_ar0237.so       libsns_imx178.so
  libsns_ar0237_dc.so    libsns_imx185.so
  libsns_ar0330.so       libsns_ov4689.so
  libsns_ov5658.so

Twelve binary blobs without source counterparts remain (intentional):
  libsns_ar0330_dc.so    libsns_imx290.so       libsns_imx385.so
  libsns_imx122.so       libsns_imx291.so       libsns_os05a10.so
  libsns_imx224.so       libsns_imx291_dc.so    libsns_ov2718.so
  libsns_imx225.so                              libsns_sc2310.so
                                                libsns_sc5235.so

The av100 osdrv .mk uses files/sensor/*.so glob, so blob deletion
is sufficient. The .ini files in files/sensor/config/ already
reference unprefixed names (DllFile=libsns_ar0237.so etc.), so no
.ini edits needed.

Tracks OpenIPC/openhisilicon#82.

  Depends on: OpenIPC/openhisilicon#83 (must be merged + pin updated
              to canonical main hash before this PR can land)
widgetii added a commit that referenced this pull request May 7, 2026
Take 2 of the musl fix from #83. The previous attempt added
<sys/ioctl.h>, which works under glibc (transitively pulls in
<asm-generic/ioctl.h> with _IOC_SIZEBITS) but not under musl on
arm — musl's <sys/ioctl.h> -> <bits/ioctl.h> chain doesn't
re-export the kernel UAPI _IOC_SIZEBITS macro.

Match the pattern that hi3516cv200/hi_spi.h and hi3516cv300/hi_spi.h
already use:

  #include <linux/ioctl.h>

This is the kernel UAPI header that defines _IOC_SIZEBITS directly
(both libcs forward to it). No-op under glibc, fixes the musl build
of imx117, imx123, imx185 (every av100 sensor whose *_sensor_ctl.c
issues SPI_IOC_MESSAGE).

Surfaced when OpenIPC/firmware#2056 wired the av100 source-built
sensors via HISILICON_OPENSDK_SENSORS_hi3516av100 — the install
foreach failed with "cannot stat libsns_imx117.so" / imx123 / imx185
because the libraries Makefile's "|| true" hid the per-sensor build
failures, so #83 looked green but the install step couldn't find
the missing .so files.

Co-authored-by: Vasiliy Yakovlev <vixand@openipc.org>
widgetii added a commit that referenced this pull request May 9, 2026
Both libraries/Makefile and libraries/sensor/hi3516cv500/Makefile
iterated subdirs with `make ... || true`, which silently swallowed
per-sensor compile failures. Three musl-only header bugs surfaced
this way during the per-platform sensor source migration:

  cv300/imx323         missing <linux/ioctl.h> -> _IOC_SIZEBITS  fixed in #84
  av100/imx117          missing -I kernel/pwm/hi3516av100        fixed in #83
  av100/imx123/imx185   av100 hi_spi.h <sys/ioctl.h> vs musl     fixed in #90

In each case the `Build SDK (chiparch)` CI job stayed green because
the libraries Makefile reported success even when individual sensors
didn't link. The breakage was only caught when the firmware-side
INSTALL_TARGET_CMDS step couldn't stat the missing .so. For cv300
that even slipped past CI entirely (the install foreach uses `;`
so its exit code is the LAST install's exit code) — only sysupgrading
a real camera surfaced the missing libsns_imx323.so.

Replace `|| true` with a fail-late accumulator: keep iterating so
all errors surface in one CI run, then exit 1 with a summary list
of failing dirs at the end. Verified locally:

  - all 7 platforms still build clean under arm-openipc-linux-gnueabi-gcc
  - injecting `#error` into one sensor source causes:
      * the surrounding sensors continue to build
      * the loop reports "Build failed for: ./sensor/.../"
      * make exits 1 (CI red)

The libraries/Makefile and libraries/sensor/hi3516cv500/Makefile
are independent invocation paths (the latter is reached when
CHIPARCH=hi3516cv500 since the outer SUBDIRS filter pulls in
./sensor/hi3516cv500/ alongside its subsensors), so both need the
same fix.

Co-authored-by: Vasiliy Yakovlev <vixand@openipc.org>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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