Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/sensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,17 @@ static int detect_sony_sensor(sensor_ctx_t *ctx, int fd,
return true;
}

// Sony IMX662 (Starvis 2). 0x3B00 reads 0x41 at power-on reset -- the
// state at boot-time auto-detection -- and the standard init sets it to
// 0x39 ("Set to 39h", IMX662 Standard Register Setting v2.0); both are
// distinct from IMX415's 0x2E/0x28 ruled out just above. 0x341C=0x01
// (IMX334 reads 0x47 there) holds in either state and guards a stray
// 0x3B00 match. Verified on a live IMX662 on a Hi3516CV610.
if ((r3B00 == 0x41 || r3B00 == 0x39) && READ(0x41C) == 0x01) {
sprintf(ctx->sensor_id, "IMX662");
return true;
}

// HINT: possible check 0x3015 == 0x3c
int r33B4 = READ(0x3B4);
if (r33B4 == 0x96 || r33B4 == 0xFE) {
Expand Down
23 changes: 23 additions & 0 deletions src/sensors_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,29 @@ static void check_sony(void) {
mock_set(0x316a, 2, 1, 0x7e);
mock_set(0x3b00, 2, 1, -1);
CHECK(!detect_sony_sensor(&ctx, 0, mock_addr));

/* IMX662 (Starvis 2): 0x3b00 is 0x41 at power-on reset -- what boot-time
* auto-detection sees -- and the standard init sets it to 0x39; both are
* distinct from IMX415's 0x2e/0x28. 0x341c=0x01 (IMX334 reads 0x47)
* confirms, and 0x316a=0x00 keeps the IMX335 path from firing. */
memset(&ctx, 0, sizeof(ctx));
mock_clear();
mock_set(0x316a, 2, 1, 0x00);
mock_set(0x3b00, 2, 1, 0x41);
mock_set(0x341c, 2, 1, 0x01);
CHECK(detect_sony_sensor(&ctx, 0, mock_addr));
CHECK(!strcmp(ctx.sensor_id, "IMX662"));
if (strcmp(ctx.sensor_id, "IMX662"))
fprintf(stderr, " (IMX662 reset default: got \"%s\")\n",
ctx.sensor_id);

memset(&ctx, 0, sizeof(ctx));
mock_clear();
mock_set(0x316a, 2, 1, 0x00);
mock_set(0x3b00, 2, 1, 0x39);
mock_set(0x341c, 2, 1, 0x01);
CHECK(detect_sony_sensor(&ctx, 0, mock_addr));
CHECK(!strcmp(ctx.sensor_id, "IMX662"));
}

/* TechPoint is a rule, not a table: it whitelists nothing and turns any
Expand Down
Loading