@@ -62,12 +62,6 @@ namespace ipa::ipu3::algorithms {
LOG_DEFINE_CATEGORY(IPU3Af)
-/**
- * Maximum focus steps of the VCM control
- * \todo should be obtained from the VCM driver
- */
-static constexpr uint32_t kMaxFocusSteps = 1023;
-
/* Minimum focus step for searching appropriate focus */
static constexpr uint32_t kCoarseSearchStep = 30;
static constexpr uint32_t kFineSearchStep = 1;
@@ -179,7 +173,8 @@ int Af::configure(IPAContext &context, const IPAConfigInfo &configInfo)
grid.y_start |= IPU3_UAPI_GRID_Y_START_EN;
/* Initial max focus step */
- maxStep_ = kMaxFocusSteps;
+ maxStep_ = configInfo.sensorInfo.maxVcmSteps;
+ maxFocusSteps_ = configInfo.sensorInfo.maxVcmSteps;
/* Initial frame ignore counter */
afIgnoreFrameReset();
@@ -217,7 +212,7 @@ void Af::afCoarseScan(IPAContext &context)
context.frameContext.af.focus = focus_;
previousVariance_ = 0;
maxStep_ = std::clamp(focus_ + static_cast<uint32_t>((focus_ * kFineRange)),
- 0U, kMaxFocusSteps);
+ 0U, maxFocusSteps_);
}
}
@@ -262,7 +257,7 @@ void Af::afReset(IPAContext &context)
previousVariance_ = 0.0;
coarseCompleted_ = false;
fineCompleted_ = false;
- maxStep_ = kMaxFocusSteps;
+ maxStep_ = maxFocusSteps_;
}
/**
@@ -45,6 +45,8 @@ private:
bool afIsOutOfFocus(IPAContext context);
+ /* Maximum VCM steps */
+ uint32_t maxFocusSteps_;
/* VCM step configuration. It is the current setting of the VCM step. */
uint32_t focus_;
/* The best VCM step. It is a local optimum VCM step during scanning. */
The hardcoded VCM step variable was removed and was replaced by the configInfo. Signed-off-by: Kate Hsuan<hpa@redhat.com> --- src/ipa/ipu3/algorithms/af.cpp | 13 ++++--------- src/ipa/ipu3/algorithms/af.h | 2 ++ 2 files changed, 6 insertions(+), 9 deletions(-)