From patchwork Mon Feb 8 01:39:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 11182 X-Patchwork-Delegate: laurent.pinchart@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 059A5BD162 for ; Mon, 8 Feb 2021 01:39:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C6F5360300; Mon, 8 Feb 2021 02:39:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="UHvHTQa6"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E23EE60106 for ; Mon, 8 Feb 2021 02:39:30 +0100 (CET) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7F6683D7 for ; Mon, 8 Feb 2021 02:39:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1612748370; bh=2D8K6fHSmazw1XqYdcg51KXaE4nCsli32T8qtrz+Ycs=; h=From:To:Subject:Date:From; b=UHvHTQa6lpjNOqDpfjIfZmbbFfiM666Dq5w/DLQvyLYBTXWHbBcKbTxRNMewxDYOh JFw90SWcfm4BY6NlTXZK2REHbFh/qs4GOlLm9Xu3+BAXFbEWhEJyet5BD/iTRS5Pvd FdPan+gkKZMBf/CBWqHKJrzZBwx3nr8lmcrT5BfQ= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 8 Feb 2021 03:39:03 +0200 Message-Id: <20210208013903.30915-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH/RFC] libcamera: camera_sensor: Accept entities exposing the ISP function X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Camera sensors can include an ISP, which may be reported as a separate entity from the pixel array in the media graph. Support such sensors by accepting MEDIA_ENT_F_PROC_VIDEO_ISP as a valid entity type. This allows using sensors that can be fully (or at least meaningfully) configured through the ISP's source pad only. Sensors that require further configuration, on the ISP sink pad and/or on the pixel array's source pad, will require further extension to the CameraSensor class. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/camera_sensor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) This patch depends on the new MEDIA_ENT_F_PROC_VIDEO_ISP entity function, which will be available in v5.12-rc1. I'll update the kernel headers when that kernel will be released, in a few weeks from now. diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 59834ffcdd94..8158a84b63db 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -198,7 +198,12 @@ int CameraSensor::init() return -EINVAL; } - if (entity_->function() != MEDIA_ENT_F_CAM_SENSOR) { + switch (entity_->function()) { + case MEDIA_ENT_F_CAM_SENSOR: + case MEDIA_ENT_F_PROC_VIDEO_ISP: + break; + + default: LOG(CameraSensor, Error) << "Invalid sensor function " << utils::hex(entity_->function());