Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp255157pxy; Wed, 5 May 2021 01:08:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdFdBUyoDQHpixbr6y5H8wKgbESUky7xFOmPFERHuSpItrAJIs4V51476OJmo0P0s67NQk X-Received: by 2002:a05:6402:3109:: with SMTP id dc9mr31037446edb.13.1620202085966; Wed, 05 May 2021 01:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620202085; cv=none; d=google.com; s=arc-20160816; b=c5ZP6RA8TjvtbOs2VSs6MvOKQ9SV1U3j9LTUaYDbOjtUCbDSz4oU+WuOa+ougQYIzd 6m1GrLFWRjndWrPvHShGgj2Tl/VaaG3yNuaQlUekL/SHbmVyOsj3Mfn6vL7kBkD1FtbR gCwF6hpUMMl61VMAopXvAdMcAooQ2/h7meb8EP0i0gsv0kVyRRHJTHA313DGSGHepv97 bkqbViwLQH5lQmeMqa4APhpP4ESBkZfNhamrPLAaqRjGMpJPjixkjDNEsPHLZOm7cF2h sPOG9ffrcOQ8quoL37hbcKkTJqCbhUIpFklZu6n3OeQdwIHVYEah8hXaf5wthfo3KhOU 0ofg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=DNGRc2010GXoc3zYnFV3cZXpCgTkADh0FH+ZDspSUTQ=; b=j92EHbM6gzktb2rLnRvcueeMyIduKy2s5xQUOr9htIAaBZjMRWvkeMQmq7Lj4y5lIi Yr/VNX2ajAZ9XC9CQK+HByu7AXJwRaSe8O6if38/DtQzY5ea+rHm5pGuGhACnsHPBkkC vHGn8BcYuK9Z6+vU8cvU7a9FzsCPOr2D39+XDeUhAvEtMb842EvmuLNDACwT5ymc2CCh 9JjvM6gUydopeRfGJumygoWi6kCnjgEJP8EZrihXWOBXm6wRMYwvD75KrByrsQRO9RnJ GIaoLWpMhsAUroJnAVVHswcAxJyd4NvVQmW/aOFovkezqIRdpP1EFR3k3bbahvSEAeLL uG+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b25si13462791edx.120.2021.05.05.01.07.42; Wed, 05 May 2021 01:08:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231936AbhEEIHd (ORCPT + 99 others); Wed, 5 May 2021 04:07:33 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:37452 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S231671AbhEEIHa (ORCPT ); Wed, 5 May 2021 04:07:30 -0400 X-UUID: e3176c72c0d64f268c2e6d0a75354e85-20210505 X-UUID: e3176c72c0d64f268c2e6d0a75354e85-20210505 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 943048906; Wed, 05 May 2021 16:06:30 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 16:06:28 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 5 May 2021 16:06:29 +0800 From: Louis Kuo To: , , , , , , , , , , CC: , , , , Subject: [RFC PATCH V0 0/4] media: some framework interface extension for new feature of Mediatek Camsys driver Date: Wed, 5 May 2021 16:06:22 +0800 Message-ID: <20210505080626.15432-1-louis.kuo@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, This is the first version of the RFC patch series extending V4L2 and media framework to support some advanced camera function, for example, to change the sensor when ISP is still streaming. A typical scenario is the wide-angle sensor and telephoto sensor switching in camera application. When the user is using the zooming UI, the application needs to switch the sensor from wide-angle sensor to telephoto sensor smoothly. To finish the function, we may need to modify the links of a pipeline and the format of pad and video device per request. Currently, the link, pad and video device format and selection settings are not involved in media request's design. Therefore, we try to extend the related interface to support the request-based operations. In the early version, we added request fd to the parameters of MEDIA_IOC_SETUP_LINK, VIDIOC_S_FMT, VIDIOC_SUBDEV_S_SELECTION, VIDIOC_SUBDEV_S_FMT. The driver uses media_request_get_by_fd() to retrieve the media request and save the pending change in it, so that we can apply the pending change in req_queue() callback then. Here is an example: int mtk_cam_vidioc_s_selection(struct file *file, void *fh, struct v4l2_selection *s) { struct mtk_cam_device *cam = video_drvdata(file); struct mtk_cam_video_device *node = file_to_mtk_cam_node(file); struct mtk_cam_request_stream_data *stream_data; struct mtk_cam_request *cam_req; struct media_request *req; s32 fd; fd = s->request_fd; if (fd < 0) return -EINVAL; req = media_request_get_by_fd(&cam->media_dev, fd); /* .... */ cam_req = to_mtk_cam_req(req); stream_data = &cam_req->stream_data[node->uid.pipe_id]; stream_data->vdev_selection_update |= (1 << node->desc.id); stream_data->vdev_selection[node->desc.id] = *s; /* .... */ media_request_put(req); return 0; } I posted interface change as RFC to discuss first and would like some review comments. Thank you very much. media: v4l2-core: extend the v4l2 format to support request media: subdev: support which in v4l2_subdev_frame_interval media: v4l2-ctrl: Add ISP Camsys user control media: pixfmt: Add ISP Camsys formats drivers/media/mc/mc-device.c | 7 +- drivers/media/v4l2-core/v4l2-ioctl.c | 153 ++++++++++++++++++++++++++- include/media/media-entity.h | 3 + include/uapi/linux/media.h | 3 +- include/uapi/linux/v4l2-controls.h | 4 + include/uapi/linux/v4l2-subdev.h | 8 +- include/uapi/linux/videodev2.h | 109 ++++++++++++++++++- 7 files changed, 275 insertions(+), 12 deletions(-)