Skip to content
Open
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
1 change: 1 addition & 0 deletions config/linux/ipu8/libcamhal_configs.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"availableSensors": [
"ov13b10-wf-0",
"ov13b10-uf-2",
"ov08x40-uf-0",
"lt6911gxd-1-0",
"lt6911gxd-2-2",
"isx031-1-0",
Expand Down
14 changes: 13 additions & 1 deletion config/linux/ipu8/sensors/ov08x40-uf.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,26 @@
"name": "ov08x40 $I2CBUS", "pad": 0, "width": 3856, "height": 2176,
"format": "V4L2_MBUS_FMT_SGRBG10_1X10"
},
{
"name": "Intel CVS", "pad": 0, "width": 3856, "height": 2176,
"format": "V4L2_MBUS_FMT_SGRBG10_1X10"
},
{
"name": "Intel CVS", "pad": 1, "width": 3856, "height": 2176,
"format": "V4L2_MBUS_FMT_SGRBG10_1X10"
},
{
"name": "Intel IPU7 CSI2 $CSI_PORT", "pad": 0, "width": 3856, "height": 2176,
"format": "V4L2_MBUS_FMT_SGRBG10_1X10"
}
],
"link": [
{
"srcName": "ov08x40 $I2CBUS", "srcPad": 0, "sinkName": "Intel IPU7 CSI2 $CSI_PORT",
"srcName": "ov08x40 $I2CBUS", "srcPad": 0, "sinkName": "Intel CVS",
"sinkPad": 0, "enable": true
},
{
"srcName": "Intel CVS", "srcPad": 1, "sinkName": "Intel IPU7 CSI2 $CSI_PORT",
"sinkPad": 0, "enable": true
},
{
Expand Down
43 changes: 29 additions & 14 deletions src/v4l2/MediaControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,24 +1119,39 @@ int MediaControl::getI2CBusAddress(const string& sensorEntityName, const string&
sinkEntityName.c_str());
CheckAndLogError(!i2cBus, UNKNOWN_ERROR, "i2cBus is nullptr");

const std::string sensorEntityNamePrefix = sensorEntityName + " ";
const size_t sensorEntityNamePrefixLen = sensorEntityNamePrefix.length();

MediaEntity* sink = nullptr;
for (auto& entity : mEntities) {
int linksCount = entity.info.links;
MediaLink* links = entity.links;
char* entityName = nullptr;
size_t sensorEntityNameLen = sensorEntityName.length();
for (int i = 0; i < linksCount; i++) {
if (strcmp(links[i].sink->entity->info.name, sinkEntityName.c_str()) == 0) {
entityName = entity.info.name;
break;
}
if (strcmp(sinkEntityName.c_str(), entity.info.name) == 0) {
sink = &entity;
break;
}
}

// entityName example: "imx319 10-0010", sensorEntityName example: "imx319"
if (entityName && (strlen(entityName) > (sensorEntityNameLen + 1U))) {
*i2cBus = entityName + sensorEntityNameLen + 1;
LOG1("i2cBus is %s", i2cBus->c_str());
return OK;
while (sink) {
MediaEntity* nextSink = nullptr;
for (unsigned int i = 0U; i < sink->numLinks; ++i) {
if (sink->links[i].sink->entity != sink) {
continue;
}

MediaEntity* source = sink->links[i].source->entity;
const char* sourceName = source->info.name;
if ((strncmp(sensorEntityNamePrefix.c_str(), sourceName, sensorEntityNamePrefixLen) == 0) &&
(strlen(sourceName) > sensorEntityNamePrefixLen)) {
*i2cBus = sourceName + sensorEntityNamePrefixLen;
LOG1("i2cBus is %s", i2cBus->c_str());
return OK;
}

if (!isMediaSourceEntity(source)) {
nextSink = source;
break;
}
}
sink = nextSink;
}

return UNKNOWN_ERROR;
Expand Down