diff options
-rw-r--r-- | include/libcamera/ipa/rkisp1.mojom | 2 | ||||
-rw-r--r-- | src/ipa/rkisp1/rkisp1.cpp | 19 | ||||
-rw-r--r-- | src/libcamera/pipeline/rkisp1/rkisp1.cpp | 18 |
3 files changed, 30 insertions, 9 deletions
diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom index 95fa0d93..29f726e1 100644 --- a/include/libcamera/ipa/rkisp1.mojom +++ b/include/libcamera/ipa/rkisp1.mojom @@ -25,7 +25,7 @@ struct RkISP1Action { }; interface IPARkISP1Interface { - init(IPASettings settings) => (int32 ret); + init(uint32 hwRevision) => (int32 ret); start() => (int32 ret); stop(); diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 7d37645b..d2a10bb9 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -31,10 +31,7 @@ LOG_DEFINE_CATEGORY(IPARkISP1) class IPARkISP1 : public ipa::rkisp1::IPARkISP1Interface { public: - int init([[maybe_unused]] const IPASettings &settings) override - { - return 0; - } + int init(unsigned int hwRevision) override; int start() override { return 0; } void stop() override {} @@ -69,6 +66,20 @@ private: uint32_t maxGain_; }; +int IPARkISP1::init(unsigned int hwRevision) +{ + /* \todo Add support for other revisions */ + if (hwRevision != RKISP1_V10) { + LOG(IPARkISP1, Error) + << "Hardware revision " << hwRevision + << " is currently not supported"; + return -ENODEV; + } + + LOG(IPARkISP1, Debug) << "Hardware revision is " << hwRevision; + return 0; +} + /** * \todo The RkISP1 pipeline currently provides an empty CameraSensorInfo * if the connected sensor does not provide enough information to properly diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 34814f62..4376d720 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -85,7 +85,7 @@ public: { } - int loadIPA(); + int loadIPA(unsigned int hwRevision); Stream mainPathStream_; Stream selfPathStream_; @@ -300,7 +300,7 @@ RkISP1FrameInfo *RkISP1Frames::find(Request *request) return nullptr; } -int RkISP1CameraData::loadIPA() +int RkISP1CameraData::loadIPA(unsigned int hwRevision) { ipa_ = IPAManager::createIPA<ipa::rkisp1::IPAProxyRkISP1>(pipe_, 1, 1); if (!ipa_) @@ -309,7 +309,11 @@ int RkISP1CameraData::loadIPA() ipa_->queueFrameAction.connect(this, &RkISP1CameraData::queueFrameAction); - ipa_->init(IPASettings{}); + int ret = ipa_->init(hwRevision); + if (ret < 0) { + LOG(RkISP1, Error) << "IPA initialization failure"; + return ret; + } return 0; } @@ -952,7 +956,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) isp_->frameStart.connect(data->delayedCtrls_.get(), &DelayedControls::applyControls); - ret = data->loadIPA(); + ret = data->loadIPA(media_->hwRevision()); if (ret) return ret; @@ -984,6 +988,12 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator) if (!media_) return false; + if (!media_->hwRevision()) { + LOG(RkISP1, Error) + << "The rkisp1 driver is too old, v5.11 or newer is required"; + return false; + } + /* Create the V4L2 subdevices we will need. */ isp_ = V4L2Subdevice::fromEntityName(media_, "rkisp1_isp"); if (isp_->open() < 0) |