From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 215B6C433F5 for ; Thu, 28 Apr 2022 08:06:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MGwigfJPF2+zon2n9Cyw7Ft8NxVFZpGE5OfJPGq2Ui8=; b=neaxk6gmjmoBIoroudlLF4OVEC tOM8xDx6EPWds9mYlIhlb3ZdZDtVFF+GdBkORrjldwsFMfk9K8zxyhXi7QovJe3oCzVOYAveY0cQc risr9gGzT/UbzdeufdPO9rySYXk8SYmUXPkIHg9+o0oxst42DpwvO8vj2XiGbaYW+qs/OjVIw3d+n /06B/tfVLKdDuRPFyXu6anijSfWEwqJOmfxDlhGoO9KNMw2/eYw6m1Gy9xM5OwqcPy/A56pMxoB9Q WdLeRheUMxcIO581POBENHBrbFgdsTtWFxu8h+zTEBIRc1BW88E7kpqrAkNTScIdH4W1KdpMcfy4u LKDOA7dA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1njz96-005OnA-EJ; Thu, 28 Apr 2022 08:05:04 +0000 Received: from relay3-d.mail.gandi.net ([2001:4b98:dc4:8::223]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1njz91-005OgM-2A for linux-arm-kernel@lists.infradead.org; Thu, 28 Apr 2022 08:05:03 +0000 Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id CE5A46000D; Thu, 28 Apr 2022 08:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1651133085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XFs4BoPFxxMdlDnM4BwqsNcAhqErhYQfhGYqvICNnic=; b=mp/2iSH7tfbe8g/5WJ3MiWav+wygO0D+A4ld69PaCo5bU9jE9M5pyY2WpYYMvhE10xe2lY mtIvqWtsvYA3PCbxGlgXbTbEDoqEG1m+xDzrUovm1CYfVOBaDNQlYzpwe8lvXiyCafaVS3 zVFguuWu/SLdpeqvTHVavojWQydWEfBNw8iZXfOrE9pQSnsWUulwrG2eCKsZyEImte8tyK 6ik1cj/nbQTTh61UqFA6YA35nBhqLAaK3S8EffM1M7DY96sDD45Yk7P4sDV/NlEvf4MhvE v+/ppmeXSHhl2abOjUsm1EvUIdFzWMCYUPK1wMEUTRrKmkKyhIAS/FtvjazP6A== Date: Thu, 28 Apr 2022 10:04:37 +0200 From: Paul Kocialkowski To: Jernej =?utf-8?Q?=C5=A0krabec?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Yong Deng , Mauro Carvalho Chehab , Chen-Yu Tsai , Samuel Holland , Laurent Pinchart , Maxime Ripard , Thomas Petazzoni Subject: Re: [PATCH v4 13/45] media: sun6i-csi: Introduce and use video helper functions Message-ID: References: <20220415152811.636419-1-paul.kocialkowski@bootlin.com> <20220415152811.636419-14-paul.kocialkowski@bootlin.com> <13001485.uLZWGnKmhe@jernej-laptop> MIME-Version: 1.0 In-Reply-To: <13001485.uLZWGnKmhe@jernej-laptop> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220428_010459_432593_B7415D86 X-CRM114-Status: GOOD ( 25.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============6160616939922252446==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============6160616939922252446== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hbLKg0yuMi8/nDoQ" Content-Disposition: inline --hbLKg0yuMi8/nDoQ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Jernej, On Wed 27 Apr 22, 20:50, Jernej =C5=A0krabec wrote: > Dne petek, 15. april 2022 ob 17:27:39 CEST je Paul Kocialkowski napisal(a= ): > > Introduce some helpers for buffer and general video configuration. > >=20 > > Signed-off-by: Paul Kocialkowski > > --- > > .../platform/sunxi/sun6i-csi/sun6i_video.c | 46 +++++++++++-------- > > 1 file changed, 28 insertions(+), 18 deletions(-) > >=20 > > diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c > > b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c index > > e6c85fcc65bb..e47eeb27dc4e 100644 > > --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c > > +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c > > @@ -92,6 +92,29 @@ static bool sun6i_video_format_check(u32 format) > > return false; > > } > >=20 > > +/* Video */ > > + > > +static void sun6i_video_buffer_configure(struct sun6i_csi_device *csi_= dev, > > + struct sun6i_csi_buffer=20 > *csi_buffer) > > +{ > > + csi_buffer->queued_to_csi =3D true; > > + sun6i_csi_update_buf_addr(csi_dev, csi_buffer->dma_addr); > > +} > > + > > +static void sun6i_video_configure(struct sun6i_csi_device *csi_dev) > > +{ > > + struct sun6i_video *video =3D &csi_dev->video; > > + struct sun6i_csi_config config =3D { 0 }; > > + > > + config.pixelformat =3D video->format.fmt.pix.pixelformat; > > + config.code =3D video->mbus_code; > > + config.field =3D video->format.fmt.pix.field; > > + config.width =3D video->format.fmt.pix.width; > > + config.height =3D video->format.fmt.pix.height; > > + > > + sun6i_csi_update_config(csi_dev, &config); > > +} > > + > > /* Queue */ > >=20 > > static int sun6i_video_queue_setup(struct vb2_queue *queue, > > @@ -160,7 +183,6 @@ static int sun6i_video_start_streaming(struct vb2_q= ueue > > *queue, struct video_device *video_dev =3D &video->video_dev; > > struct sun6i_csi_buffer *buf; > > struct sun6i_csi_buffer *next_buf; > > - struct sun6i_csi_config config; > > struct v4l2_subdev *subdev; > > unsigned long flags; > > int ret; > > @@ -182,22 +204,13 @@ static int sun6i_video_start_streaming(struct > > vb2_queue *queue, goto error_media_pipeline; > > } > >=20 > > - config.pixelformat =3D video->format.fmt.pix.pixelformat; > > - config.code =3D video->mbus_code; > > - config.field =3D video->format.fmt.pix.field; > > - config.width =3D video->format.fmt.pix.width; > > - config.height =3D video->format.fmt.pix.height; > > - > > - ret =3D sun6i_csi_update_config(csi_dev, &config); > > - if (ret < 0) > > - goto error_media_pipeline; > > + sun6i_video_configure(csi_dev); >=20 > What happened to that error handling? New helper function ignores return = value=20 > of sun6i_csi_update_config(). Why? Ah that's a good point, the error value is still being returned by sun6i_csi_update_config so it should be kept around at this stage. Note that this is a transitional commit and sun6i_video_configure (which gets renamed to sun6i_csi_capture_configure) is eventually reworked to only configure registers (no checks) and returns void. If you think it's important to keep it in the meantime I can do that. Paul > Best regards, > Jernej >=20 > >=20 > > spin_lock_irqsave(&video->dma_queue_lock, flags); > >=20 > > buf =3D list_first_entry(&video->dma_queue, > > struct sun6i_csi_buffer, list); > > - buf->queued_to_csi =3D true; > > - sun6i_csi_update_buf_addr(csi_dev, buf->dma_addr); > > + sun6i_video_buffer_configure(csi_dev, buf); > >=20 > > sun6i_csi_set_stream(csi_dev, true); > >=20 > > @@ -219,8 +232,7 @@ static int sun6i_video_start_streaming(struct vb2_q= ueue > > *queue, * would also drop frame when lacking of queued buffer. > > */ > > next_buf =3D list_next_entry(buf, list); > > - next_buf->queued_to_csi =3D true; > > - sun6i_csi_update_buf_addr(csi_dev, next_buf->dma_addr); > > + sun6i_video_buffer_configure(csi_dev, next_buf); > >=20 > > spin_unlock_irqrestore(&video->dma_queue_lock, flags); > >=20 > > @@ -294,8 +306,7 @@ void sun6i_video_frame_done(struct sun6i_csi_device > > *csi_dev) * for next ISR call. > > */ > > if (!next_buf->queued_to_csi) { > > - next_buf->queued_to_csi =3D true; > > - sun6i_csi_update_buf_addr(csi_dev, next_buf->dma_addr); > > + sun6i_video_buffer_configure(csi_dev, next_buf); > > dev_dbg(csi_dev->dev, "Frame dropped!\n"); > > goto complete; > > } > > @@ -309,8 +320,7 @@ void sun6i_video_frame_done(struct sun6i_csi_device > > *csi_dev) /* Prepare buffer for next frame but one. */ > > if (!list_is_last(&next_buf->list, &video->dma_queue)) { > > next_buf =3D list_next_entry(next_buf, list); > > - next_buf->queued_to_csi =3D true; > > - sun6i_csi_update_buf_addr(csi_dev, next_buf->dma_addr); > > + sun6i_video_buffer_configure(csi_dev, next_buf); > > } else { > > dev_dbg(csi_dev->dev, "Next frame will be dropped!\n"); > > } >=20 >=20 >=20 >=20 --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --hbLKg0yuMi8/nDoQ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAmJqSpUACgkQ3cLmz3+f v9F9WQf/Yw9U3I/o7JqV+HsxUfKaf4gX6vbH1O2ZCv4jD06TNpE+RVR8CE2SjqVo wI0w+RbVZMBT64ueuuqr2dRPuYlJ15WVCgMKU21N8vEAXDxfYVQr4f3/7cj8CBzK x6vCvWs5dbqKF3ek3S3h7y9iMhDQ9nbVh7dZlJnQfwcAWK+K/aQEfpqnTBKpL3km MCk9PxVjRtk23TS1pS/GtDids1vtMMNjnaDvfRR/NWd3dfEL25wC72N+7bxNv0fX 06IcEdCHll0ZanSeo/2Rdpy4KFCtC8LI+5xmv4lOZ7M/4+1UdlhI9ArYZvseiK3N u8wy39tlfO0JuXma+sRGdMQDtSWPQQ== =30KN -----END PGP SIGNATURE----- --hbLKg0yuMi8/nDoQ-- --===============6160616939922252446== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============6160616939922252446==--