Skip to content

Add Sony IMX662 sensor to build system - #2241

Open
diegok3 wants to merge 2 commits into
OpenIPC:masterfrom
diegok3:imx662-support
Open

Add Sony IMX662 sensor to build system#2241
diegok3 wants to merge 2 commits into
OpenIPC:masterfrom
diegok3:imx662-support

Conversation

@diegok3

@diegok3 diegok3 commented Aug 5, 2026

Copy link
Copy Markdown
  • Point opensdk to diegok3/openhisilicon@6c46247 (IMX662 driver)
  • Add sony_imx662/libsns_imx662 to HISILICON_OPENSDK_SENSORS_hi3516cv6xx
  • Sensor will compile from source and install to /usr/lib/sensors/

- Point opensdk to diegok3/openhisilicon@6c46247 (IMX662 driver)
- Add sony_imx662/libsns_imx662 to HISILICON_OPENSDK_SENSORS_hi3516cv6xx
- Sensor will compile from source and install to /usr/lib/sensors/
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add Sony IMX662 sensor build support for hi3516cv6xx

✨ Enhancement ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Switch Hisilicon OpenSDK source to diegok3/openhisilicon pinned at IMX662 driver commit.
• Register sony_imx662/libsns_imx662 in the hi3516cv6xx sensor build list.
• Ensure IMX662 sensor library is built and installed to /usr/lib/sensors/.
Diagram

graph TD
  A["Build system"] --> B["hisilicon-opensdk.mk"] --> C{{"openhisilicon (diegok3@6c46247)"}}
  B --> D["Sensors list (hi3516cv6xx)"] --> E["sony_imx662/libsns_imx662"] --> F["/usr/lib/sensors/"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Keep upstream OpenSDK and apply an IMX662 patch in-tree
  • ➕ Avoids switching to a forked dependency (clearer provenance, fewer surprises).
  • ➕ Easier to upstream/track changes if OpenIPC remains the canonical source.
  • ➖ Requires maintaining a patch stack and rebasing as OpenSDK changes.
  • ➖ More build-system plumbing if multiple patches/sensors accumulate.
2. Pin to a tagged release/branch instead of a raw commit SHA
  • ➕ More discoverable and repeatable dependency updates.
  • ➕ Improves traceability for consumers and downstream packagers.
  • ➖ May not be available if the IMX662 change is not tagged.
  • ➖ Still depends on the fork if tags are fork-only.

Recommendation: The current approach is reasonable for quickly enabling IMX662 support: pinning to a known-good commit plus adding the sensor module keeps the change minimal. If this is intended for long-term maintenance, consider migrating to either an upstreamed OpenSDK change or an in-tree patch approach to reduce reliance on a forked dependency and to make updates/audits easier.

Files changed (1) +4 / -3

Enhancement (1) +4 / -3
hisilicon-opensdk.mkPin OpenSDK fork/commit and add IMX662 to hi3516cv6xx sensors +4/-3

Pin OpenSDK fork/commit and add IMX662 to hi3516cv6xx sensors

• Switches HISILICON_OPENSDK_SITE to diegok3/openhisilicon and pins the version to commit 6c46247. Extends HISILICON_OPENSDK_SENSORS_hi3516cv6xx to include sony_imx662/libsns_imx662 so it is built and installed with other sensor libraries.

general/package/hisilicon-opensdk/hisilicon-opensdk.mk

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Fork affects all configs 🐞 Bug ☼ Reliability
Description
The PR switches HISILICON_OPENSDK_SITE/HISILICON_OPENSDK_VERSION globally, so every build that
selects hisilicon-opensdk (across multiple HiSilicon SoC families) will now consume
diegok3/openhisilicon@6c46247, not just hi3516cv6xx. This broadens the compatibility/provenance
risk well beyond the stated IMX662 addition.
Code

general/package/hisilicon-opensdk/hisilicon-opensdk.mk[R7-8]

+HISILICON_OPENSDK_SITE = $(call github,diegok3,openhisilicon,$(HISILICON_OPENSDK_VERSION))
+HISILICON_OPENSDK_VERSION = 6c46247
Evidence
The package source is set once (global variables), while the same package file contains dependency
and install branches for many SoC families; therefore changing the source impacts all those
configurations that enable the package.

general/package/hisilicon-opensdk/hisilicon-opensdk.mk[7-40]
general/package/hisilicon-opensdk/hisilicon-opensdk.mk[350-577]

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

### Issue description
`hisilicon-opensdk` is used for multiple SoC families, but the PR changes the package download source globally to a third-party fork/commit to add IMX662 support.

### Issue Context
The makefile contains dependency wiring and install logic for many `OPENIPC_SOC_FAMILY` values, meaning the package is not specific to hi3516cv6xx.

### Fix Focus Areas
- general/package/hisilicon-opensdk/hisilicon-opensdk.mk[7-40]

### Suggested fix
- If only hi3516cv6xx needs the fork, make the site/version conditional on `OPENIPC_SOC_FAMILY` (use the fork for `hi3516cv6xx`, keep `openipc/openhisilicon` for others).
- Alternatively, mirror/cherry-pick the IMX662 change into the canonical upstream used by the project and keep the package pointing at that upstream.

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



Informational

2. Abbreviated commit pin 🐞 Bug ⚙ Maintainability
Description
HISILICON_OPENSDK_VERSION is shortened to a 7-character SHA (6c46247), which is less robust for
long-term reproducibility than a full commit hash and is weaker than the prior 8-character pin. If
the abbreviation ever becomes ambiguous/unresolvable, the GitHub archive download will fail.
Code

general/package/hisilicon-opensdk/hisilicon-opensdk.mk[8]

+HISILICON_OPENSDK_VERSION = 6c46247
Evidence
The package fetches a GitHub archive using the HISILICON_OPENSDK_VERSION string as the ref; making
that string shorter reduces the strength of the pin.

general/package/hisilicon-opensdk/hisilicon-opensdk.mk[7-8]

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 package version is pinned to a 7-character abbreviated commit hash.

### Issue Context
The download URL is derived from `$(call github,...)` using `HISILICON_OPENSDK_VERSION` as the archive ref.

### Fix Focus Areas
- general/package/hisilicon-opensdk/hisilicon-opensdk.mk[7-8]

### Suggested fix
Replace `HISILICON_OPENSDK_VERSION = 6c46247` with the full 40-character commit SHA (or a stable tag) to ensure unambiguous, reproducible fetches.

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


3. Source URL inconsistency 🐞 Bug ⚙ Maintainability
Description
The Kconfig help text still points to https://github.com/OpenIPC/openhisilicon while the package
now downloads from diegok3/openhisilicon, creating a provenance/documentation mismatch. This makes
it harder to determine the actual audited source for builds from the menuconfig help alone.
Code

general/package/hisilicon-opensdk/hisilicon-opensdk.mk[7]

+HISILICON_OPENSDK_SITE = $(call github,diegok3,openhisilicon,$(HISILICON_OPENSDK_VERSION))
Evidence
The Config.in help URL and the actual download site now point at different GitHub orgs, and that
mismatch is introduced by this PR’s site change.

general/package/hisilicon-opensdk/Config.in[6-9]
general/package/hisilicon-opensdk/hisilicon-opensdk.mk[7-8]

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 package download source repo changed to `diegok3/openhisilicon`, but the help text still references `OpenIPC/openhisilicon`.

### Issue Context
In Buildroot-style packages, `Config.in` help often serves as the human-facing pointer for where the source comes from.

### Fix Focus Areas
- general/package/hisilicon-opensdk/Config.in[6-9]
- general/package/hisilicon-opensdk/hisilicon-opensdk.mk[7-8]

### Suggested fix
Either:
- Update the help URL to the fork while this fork is authoritative for builds, or
- Keep the OpenIPC URL but add a note in the help text stating that builds currently fetch from `diegok3/openhisilicon@<sha>` (and why).

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


To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

Comment on lines +7 to +8
HISILICON_OPENSDK_SITE = $(call github,diegok3,openhisilicon,$(HISILICON_OPENSDK_VERSION))
HISILICON_OPENSDK_VERSION = 6c46247

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Fork affects all configs 🐞 Bug ☼ Reliability

The PR switches HISILICON_OPENSDK_SITE/HISILICON_OPENSDK_VERSION globally, so every build that
selects hisilicon-opensdk (across multiple HiSilicon SoC families) will now consume
diegok3/openhisilicon@6c46247, not just hi3516cv6xx. This broadens the compatibility/provenance
risk well beyond the stated IMX662 addition.
Agent Prompt
### Issue description
`hisilicon-opensdk` is used for multiple SoC families, but the PR changes the package download source globally to a third-party fork/commit to add IMX662 support.

### Issue Context
The makefile contains dependency wiring and install logic for many `OPENIPC_SOC_FAMILY` values, meaning the package is not specific to hi3516cv6xx.

### Fix Focus Areas
- general/package/hisilicon-opensdk/hisilicon-opensdk.mk[7-40]

### Suggested fix
- If only hi3516cv6xx needs the fork, make the site/version conditional on `OPENIPC_SOC_FAMILY` (use the fork for `hi3516cv6xx`, keep `openipc/openhisilicon` for others).
- Alternatively, mirror/cherry-pick the IMX662 change into the canonical upstream used by the project and keep the package pointing at that upstream.

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

HISILICON_OPENSDK_SITE = $(call github,openipc,openhisilicon,$(HISILICON_OPENSDK_VERSION))
HISILICON_OPENSDK_VERSION = ff20187b
HISILICON_OPENSDK_SITE = $(call github,diegok3,openhisilicon,$(HISILICON_OPENSDK_VERSION))
HISILICON_OPENSDK_VERSION = 6c46247

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Informational

2. Abbreviated commit pin 🐞 Bug ⚙ Maintainability

HISILICON_OPENSDK_VERSION is shortened to a 7-character SHA (6c46247), which is less robust for
long-term reproducibility than a full commit hash and is weaker than the prior 8-character pin. If
the abbreviation ever becomes ambiguous/unresolvable, the GitHub archive download will fail.
Agent Prompt
### Issue description
The package version is pinned to a 7-character abbreviated commit hash.

### Issue Context
The download URL is derived from `$(call github,...)` using `HISILICON_OPENSDK_VERSION` as the archive ref.

### Fix Focus Areas
- general/package/hisilicon-opensdk/hisilicon-opensdk.mk[7-8]

### Suggested fix
Replace `HISILICON_OPENSDK_VERSION = 6c46247` with the full 40-character commit SHA (or a stable tag) to ensure unambiguous, reproducible fetches.

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


HISILICON_OPENSDK_SITE = $(call github,openipc,openhisilicon,$(HISILICON_OPENSDK_VERSION))
HISILICON_OPENSDK_VERSION = ff20187b
HISILICON_OPENSDK_SITE = $(call github,diegok3,openhisilicon,$(HISILICON_OPENSDK_VERSION))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Informational

3. Source url inconsistency 🐞 Bug ⚙ Maintainability

The Kconfig help text still points to https://github.com/OpenIPC/openhisilicon while the package
now downloads from diegok3/openhisilicon, creating a provenance/documentation mismatch. This makes
it harder to determine the actual audited source for builds from the menuconfig help alone.
Agent Prompt
### Issue description
The package download source repo changed to `diegok3/openhisilicon`, but the help text still references `OpenIPC/openhisilicon`.

### Issue Context
In Buildroot-style packages, `Config.in` help often serves as the human-facing pointer for where the source comes from.

### Fix Focus Areas
- general/package/hisilicon-opensdk/Config.in[6-9]
- general/package/hisilicon-opensdk/hisilicon-opensdk.mk[7-8]

### Suggested fix
Either:
- Update the help URL to the fork while this fork is authoritative for builds, or
- Keep the OpenIPC URL but add a note in the help text stating that builds currently fetch from `diegok3/openhisilicon@<sha>` (and why).

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

- S70vendor: pass '-s imx662' to load_hisilicon
- load_hisilicon: default SNS_TYPE0=imx662, add imx662 to available list
- tools/imx662: vi_raw_capture.c, recv_raw.py, i2c_recovery.c, i2c_test.c
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