sensor: fix IMX335 misdetected as IMX347 after WDR cycle (#157)#167
Merged
Conversation
0x3057 is Y_OUT_SIZE[12:0] MSB (host-writable, V-reflection), not a chip ID — Sony image sensors have no dedicated chip ID register. After majestic configures IMX335 for WDR with vertical cropping, Y_OUT_SIZE drops to ~0x0604 and 0x3057 reads 0x06, colliding with IMX347's reset default, so detect_sony_sensor commits to IMX347 and majestic fails with "No matches for 'imx347_i2c'". Cross-check with OB cropping registers 0x3072 (AREA2_WIDTH_1 LSB) and 0x3074 (AREA3_ST_ADR_1 LSB), which have distinct datasheet defaults (IMX335: 0x28/0xB0, IMX347: 0x14/0x3C) and survive majestic init. When they match the IMX335 fingerprint, fall through to the existing 0x316A IMX335 path instead of committing to IMX347. The originally proposed (0x316A & 0xFC) == 0x7C check alone is not a discriminator: IMX347's datasheet (p.40) shows the same fixed bits as IMX335 — it's an INCKSEL4 shape, not a chip identifier. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
0x3057isY_OUT_SIZE[12:0]MSB (host-writable per both datasheets), not a chip ID — Sony sensors have no dedicated chip ID register. WDR vertical cropping on IMX335 reprograms Y_OUT_SIZE so the MSB reads0x06, colliding with IMX347's reset default, and the unconditional0x3057 == 0x06 → IMX347short-circuit misdetects.0x3072=0x28, 0x3074=0xB0; IMX347 reads0x3072=0x14, 0x3074=0x3C. When the IMX335 fingerprint matches, fall through to the existing0x316AIMX335 path.(0x316A & 0xFC) == 0x7Ccross-check: IMX347 datasheet p.40 shows the same fixed bits as IMX335, so that check alone is not a discriminator — it's an INCKSEL4 shape, not a chip identifier.Test plan
imx347_i2c, this PR reportsimx335_i2cfrom the same registers, same boot.killall majestic(sensor retains register state without a power-cycle); behaviour is consistent.0x3072 == 0x28 && 0x3074 == 0xB0(IMX335 factory OB defaults); a real IMX347 reading those exact values would have to be deliberately programmed that way, and no published profile does, so false-positive risk is low — but a confirmation from anyone with the part would be welcome.🤖 Generated with Claude Code