@@ -1346,17 +1346,7 @@ void IpaBase::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls)
ctrls.set(V4L2_CID_EXPOSURE, exposureLines);
ctrls.set(V4L2_CID_ANALOGUE_GAIN, gainCode);
- /*
- * At present, there is no way of knowing if a control is read-only.
- * As a workaround, assume that if the minimum and maximum values of
- * the V4L2_CID_HBLANK control are the same, it implies the control
- * is read-only. This seems to be the case for all the cameras our IPA
- * works with.
- *
- * \todo The control API ought to have a flag to specify if a control
- * is read-only which could be used below.
- */
- if (mode_.minLineLength != mode_.maxLineLength)
+ if (!sensorCtrls_.at(V4L2_CID_HBLANK).readOnly())
ctrls.set(V4L2_CID_HBLANK, static_cast<int32_t>(hblank));
/*
@@ -188,20 +188,10 @@ int CameraSensor::init()
* Set HBLANK to the minimum to start with a well-defined line length,
* allowing IPA modules that do not modify HBLANK to use the sensor
* minimum line length in their calculations.
- *
- * At present, there is no way of knowing if a control is read-only.
- * As a workaround, assume that if the minimum and maximum values of
- * the V4L2_CID_HBLANK control are the same, it implies the control
- * is read-only.
- *
- * \todo The control API ought to have a flag to specify if a control
- * is read-only which could be used below.
*/
const ControlInfo hblank = ctrls.infoMap()->at(V4L2_CID_HBLANK);
- const int32_t hblankMin = hblank.min().get<int32_t>();
- const int32_t hblankMax = hblank.max().get<int32_t>();
-
- if (hblankMin != hblankMax) {
+ if (!hblank.readOnly()) {
+ const int32_t hblankMin = hblank.min().get<int32_t>();
ControlList ctrl(subdev_->controls());
ctrl.set(V4L2_CID_HBLANK, hblankMin);