diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp
index a1fec3aa3dd1..a623ad1bae66 100644
--- a/src/ipa/rpi/common/ipa_base.cpp
+++ b/src/ipa/rpi/common/ipa_base.cpp
@@ -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));
 
 	/*
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index ee1066c680ff..12512341feb6 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -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);
