Message ID | 20230324151228.2778112-9-paul.kocialkowski@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp716920vqo; Fri, 24 Mar 2023 08:36:01 -0700 (PDT) X-Google-Smtp-Source: AKy350a11qWrhqwbVwLrNgdvvt1h9WN9G0mUdhIdwFPWkzcYx4YWuItURQnUDQH0hN3bgafhmj3Q X-Received: by 2002:a17:906:a010:b0:932:fc34:88f with SMTP id p16-20020a170906a01000b00932fc34088fmr3816361ejy.11.1679672161122; Fri, 24 Mar 2023 08:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679672161; cv=none; d=google.com; s=arc-20160816; b=DxbXTTk8RAG7bVM9TLPsJpzPcr7Un/s/9+yJhHh9BNDXWvQkpToY+jtnYUs7ZOtxz9 AkghIJN1UYKb8eR/SbwqalmS211Fi5e4WBwcOMQ+F6eOtgnCEqZvT6GLSWkvetvd4Mhg Zn4STm23F77HJtlzvm0B+3tGs1mmLQdnIuWYYG3gfswnvJZpMWlFEISlJ159q/qcwWb+ rVHfWltH0IWaN0ZAvRa3NayQYnos8s3dbOBNqt8+oeiC+H+g3D+IXjdKSV0HYJaT98Q2 bI+WOWg+Mdv9sM43BShg8Eps83AYrrsToWPX/ksUPNH4z23i8k6hxkeiy8CO61pJcRyH 7z/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=enDGYKXiM7Q8LTC31mohdS3fckSaBNzhC8rrVAHdczM=; b=Szx3BmjPS8TX148TrRR+31Decc7QeA4xgR2ehuCz3KHKhb5QmVmiY6+A9XFL4buSzp 7xVOgz/vk0t4t0WetY9QozUC2dXhFdia1AvlzIUwL6/RWWh/PZXNvKP1+pHoiXHVLzNo 4kcWGLbQRmxKuaQ5+CnzHkSmfUmuRaxMeVvvGNm7S5rBWSmps3oG96f7Fdu0u3eeKMOD GuhSPt6V2mKyMtaZcc1tQhXepKYKwR0mHz+KMWd9BZ5rR2BXcoJML9LIseR2tF8+eMmE TXW/b/ITF33n3D1ZzrvI4FxBy0GhY+XPYB7RyWL2aTou+DTVnMvoMNc/9SHSi/IzR6Tu wiuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=CuXi9HpM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a4-20020a17090682c400b00922528b3dcesi20663503ejy.983.2023.03.24.08.35.36; Fri, 24 Mar 2023 08:36:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=CuXi9HpM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232535AbjCXPNb (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Fri, 24 Mar 2023 11:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232394AbjCXPNN (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 24 Mar 2023 11:13:13 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E573E144B0; Fri, 24 Mar 2023 08:12:53 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 2A7AFE0018; Fri, 24 Mar 2023 15:12:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1679670772; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=enDGYKXiM7Q8LTC31mohdS3fckSaBNzhC8rrVAHdczM=; b=CuXi9HpMMawNmx1FJsELZhOeL/RZrZQ7VftiVYaBPSB3jaNIGNsCOclXvviJBNFCJrlDLi x0+54NA2avOS52wW3z+MpNrDKmc2O0aM+rGv3quwOyAQSw33LWwZAIvCjgVJYKnIURIHy3 3rp7hfBKh6ikj4t+KCTQSoQl+pFVarQzbqn8c3fxTkPa7SD09aQsjmW4/3RhvhfCqMTAIL N6Yka5CE4pckxRyIRUwDT+JEg9BKCV9XfLp0zwK2YFab18Zg0YuqMmP28u+QRqx0+1w362 iQeUuB9QqG75evhP/bKkPdp0TMZbUv7tH87DXMowSeDCCFHjN59MaxJgAugTzg== From: Paul Kocialkowski <paul.kocialkowski@bootlin.com> To: linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, Chen-Yu Tsai <wens@csie.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Adam Pigg <adam@piggz.co.uk>, Thomas Petazzoni <thomas.petazzoni@bootlin.com> Subject: [PATCH 8/9] media: sun6i-isp: capture: Implement MC I/O with extended enum_fmt Date: Fri, 24 Mar 2023 16:12:27 +0100 Message-Id: <20230324151228.2778112-9-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230324151228.2778112-1-paul.kocialkowski@bootlin.com> References: <20230324151228.2778112-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761263915824040069?= X-GMAIL-MSGID: =?utf-8?q?1761263915824040069?= |
Series |
media: sun6i-csi/isp: Implement MC I/O support
|
|
Commit Message
Paul Kocialkowski
March 24, 2023, 3:12 p.m. UTC
This driver needs the media-controller API to operate and should not be
considered as a video-device-centric implementation.
Properly report the IO_MC device cap and extend the enum_fmt
implementation to support enumeration with an explicit mbus_code.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
.../staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Comments
Dne petek, 24. marec 2023 ob 16:12:27 CET je Paul Kocialkowski napisal(a): > This driver needs the media-controller API to operate and should not be > considered as a video-device-centric implementation. > > Properly report the IO_MC device cap and extend the enum_fmt > implementation to support enumeration with an explicit mbus_code. > > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> > --- > .../staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c > index 1595a9607775..5160b93b69ff 100644 > --- a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c > +++ b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c > @@ -439,6 +439,12 @@ static int sun6i_isp_capture_enum_fmt(struct file *file, void *private, > struct v4l2_fmtdesc *fmtdesc) > { > u32 index = fmtdesc->index; > + u32 mbus_code = fmtdesc->mbus_code; Nit: reverse christmas tree Other than that: Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Best regards, Jernej > + > + if (mbus_code && !sun6i_isp_proc_format_find(mbus_code)) > + return -EINVAL; > + > + /* Capture format is independent from proc format. */ > > if (index >= ARRAY_SIZE(sun6i_isp_capture_formats)) > return -EINVAL; > @@ -685,7 +691,8 @@ int sun6i_isp_capture_setup(struct sun6i_isp_device *isp_dev) > > strscpy(video_dev->name, SUN6I_ISP_CAPTURE_NAME, > sizeof(video_dev->name)); > - video_dev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; > + video_dev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | > + V4L2_CAP_IO_MC; > video_dev->vfl_dir = VFL_DIR_RX; > video_dev->release = video_device_release_empty; > video_dev->fops = &sun6i_isp_capture_fops; > -- > 2.39.2 > >
Hi Paul, Thank you for the patch. On Fri, Mar 24, 2023 at 04:12:27PM +0100, Paul Kocialkowski wrote: > This driver needs the media-controller API to operate and should not be > considered as a video-device-centric implementation. > > Properly report the IO_MC device cap and extend the enum_fmt > implementation to support enumeration with an explicit mbus_code. > > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> > --- > .../staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c > index 1595a9607775..5160b93b69ff 100644 > --- a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c > +++ b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c > @@ -439,6 +439,12 @@ static int sun6i_isp_capture_enum_fmt(struct file *file, void *private, > struct v4l2_fmtdesc *fmtdesc) > { > u32 index = fmtdesc->index; > + u32 mbus_code = fmtdesc->mbus_code; > + > + if (mbus_code && !sun6i_isp_proc_format_find(mbus_code)) > + return -EINVAL; > + This doesn't look right. As far as I understand, sun6i_isp_proc_format_find() looks up media bus codes for the ISP sink pad. Here you enuemrate pixel formats of the ISP output, so the media bus code given by userspace corresponds to the ISP source pad. I've had a look at sun6i_isp_proc_set_fmt() to see what media bus codes are used on the ISP output, and couldn't figure it out as it seems incorrectly implemented :-) The function doesn't check format->pad. > + /* Capture format is independent from proc format. */ > > if (index >= ARRAY_SIZE(sun6i_isp_capture_formats)) > return -EINVAL; > @@ -685,7 +691,8 @@ int sun6i_isp_capture_setup(struct sun6i_isp_device *isp_dev) > > strscpy(video_dev->name, SUN6I_ISP_CAPTURE_NAME, > sizeof(video_dev->name)); > - video_dev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; > + video_dev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | > + V4L2_CAP_IO_MC; > video_dev->vfl_dir = VFL_DIR_RX; > video_dev->release = video_device_release_empty; > video_dev->fops = &sun6i_isp_capture_fops;
diff --git a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c index 1595a9607775..5160b93b69ff 100644 --- a/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c +++ b/drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c @@ -439,6 +439,12 @@ static int sun6i_isp_capture_enum_fmt(struct file *file, void *private, struct v4l2_fmtdesc *fmtdesc) { u32 index = fmtdesc->index; + u32 mbus_code = fmtdesc->mbus_code; + + if (mbus_code && !sun6i_isp_proc_format_find(mbus_code)) + return -EINVAL; + + /* Capture format is independent from proc format. */ if (index >= ARRAY_SIZE(sun6i_isp_capture_formats)) return -EINVAL; @@ -685,7 +691,8 @@ int sun6i_isp_capture_setup(struct sun6i_isp_device *isp_dev) strscpy(video_dev->name, SUN6I_ISP_CAPTURE_NAME, sizeof(video_dev->name)); - video_dev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; + video_dev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | + V4L2_CAP_IO_MC; video_dev->vfl_dir = VFL_DIR_RX; video_dev->release = video_device_release_empty; video_dev->fops = &sun6i_isp_capture_fops;