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
5 changes: 5 additions & 0 deletions src/hal/gm.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ static unsigned char omni_addrs[] = {0x6c, 0x42, 0};
#else
static unsigned char omni_addrs[] = {0x6c, 0};
#endif
#ifndef STANDALONE_LIBRARY
/* 0xBA: the Aptina MT9P006, on GM8128 cameras */
static unsigned char onsemi_addrs[] = {0x20, 0xba, 0};
#else
static unsigned char onsemi_addrs[] = {0x20, 0};
#endif
static unsigned char gc_addrs[] = {0x6e, 0};

static sensor_addr_t gm_possible_i2c_addrs[] = {
Expand Down
17 changes: 17 additions & 0 deletions src/sensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,23 @@ static int detect_onsemi_sensor(sensor_ctx_t *ctx, int fd,
// sensor_write_register(0x301A, 1);
// msDelay(100);

#if defined(IPCHW_VENDOR_GM) && !defined(STANDALONE_LIBRARY)
/* The Aptina MT9P0xx have one-byte register addresses and two-byte data,
* and CHIP_VERSION at 0x00: 0x1801 on the MT9P001, MT9P031 and MT9P006
* alike, so the register cannot tell them apart. The GM8128 camera of
* #305 runs an MT9P006 (its firmware loads isp_mt9p031.cfg for it) at
* 0xBA. The second value is the same reading with the bytes swapped, as
* the universal reader assembles two bytes. */
if (i2c_addr == 0xBA) {
int ver = i2c_read_register(fd, i2c_addr, 0x00, 1, 2);
if (ver != 0x1801 && ver != 0x0118)
return false;
strcpy(ctx->sensor_id, "MT9P006");
ctx->reg_width = 1;
return true;
}
#endif

int pid = i2c_read_register(fd, i2c_addr, 0x3000, 2, 2);
int sid = 0;

Expand Down