ipa: mojom: raspberrypi: Add setLensControls() function

Add a setLensControls() function to the IPA/pipeline handler interface. This
will be used in a future commit to control the lens actuator position from an
autofocus algorithm.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Nick Hollinghurst 2023-01-23 15:49:25 +00:00 committed by Kieran Bingham
parent b9923747ad
commit 6290deea02
2 changed files with 13 additions and 0 deletions

View file

@ -131,4 +131,5 @@ interface IPARPiEventInterface {
embeddedComplete(uint32 bufferId);
setIspControls(libcamera.ControlList controls);
setDelayedControls(libcamera.ControlList controls, uint32 delayContext);
setLensControls(libcamera.ControlList controls);
};

View file

@ -208,6 +208,7 @@ public:
void embeddedComplete(uint32_t bufferId);
void setIspControls(const ControlList &controls);
void setDelayedControls(const ControlList &controls, uint32_t delayContext);
void setLensControls(const ControlList &controls);
void setSensorControls(ControlList &controls);
void unicamTimeout();
@ -1496,6 +1497,7 @@ int RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result)
ipa_->embeddedComplete.connect(this, &RPiCameraData::embeddedComplete);
ipa_->setIspControls.connect(this, &RPiCameraData::setIspControls);
ipa_->setDelayedControls.connect(this, &RPiCameraData::setDelayedControls);
ipa_->setLensControls.connect(this, &RPiCameraData::setLensControls);
/*
* The configuration (tuning file) is made from the sensor name unless
@ -1743,6 +1745,16 @@ void RPiCameraData::setDelayedControls(const ControlList &controls, uint32_t del
handleState();
}
void RPiCameraData::setLensControls(const ControlList &controls)
{
CameraLens *lens = sensor_->focusLens();
if (lens && controls.contains(V4L2_CID_FOCUS_ABSOLUTE)) {
ControlValue const &focusValue = controls.get(V4L2_CID_FOCUS_ABSOLUTE);
lens->setFocusPosition(focusValue.get<int32_t>());
}
}
void RPiCameraData::setSensorControls(ControlList &controls)
{
/*