From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 872BA33E5 for ; Wed, 27 Apr 2022 18:50:14 +0000 (UTC) Received: by mail-ej1-f46.google.com with SMTP id i19so5150813eja.11 for ; Wed, 27 Apr 2022 11:50:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D9r0h1m2vNnq39XzwLF8H3AjdnE9ECGsJT/LxPF6Djc=; b=Hr2nxqWb+dWmu2gue0be4PA5VozC92i9QKWr0B1EuHb+1byxvxk06zLICmQpncB93A pZiZ2qj+UYl/dj5/frfi5nznQVfb7LqlY7f0kS+jhUp72MgJVNTWjMGsOippShvP3/46 UztM8QZBxGs0azBztCU+LZBx7lAuE+Ls5hB9LmFVZdlHzvrCQwXPeqCVUxlKB3iKo7K8 o/QSJuMQt8xp/YXLyhCIUG0SmJKtFqAiYj+bgEfdOPhrBMK2tw86Hy+DoxGBik92tkLS 6mCMe2wY7S0fkBnaoIhCwIZLXiDru7hmV877xGl6+t1i2dd4hwfgifgIt4P5zp6XViug s8lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D9r0h1m2vNnq39XzwLF8H3AjdnE9ECGsJT/LxPF6Djc=; b=razXkGgRBGU8qKn9PBzfTL1fgIsxQU537WC4NbE32TRUoK+oRs04ja26kAdKoEAh6S xSDLXKbSXpKYxP5d/At5/pjdrG7tSQTr0riyJ3px+HOi3YG6Vtinbn9n4LiLmCUAgid+ UkMwZHegtlVbANhwnfSXQ/PtHUPq4Z/QsAbyUq8KEzSOBPOnew7znCqDHKUsQwW9MeYD HyT/VHc/6McBqFIn/Sgcmvv1a9RBCe8oFYxcuEYooLAtmAQ8o3TqdvPHBnGhgqugiG/w 4q3NyatjzgEVTip2jZpyCxvzFeQjJF4x50ZY71gswHvZGNuAC381vXKRhon2Y0HBaawT 418Q== X-Gm-Message-State: AOAM532zOp2EQ3l+FcY9uklQm5n4A6+9BtesgLkqImvxnjxCKIG7I1+L 4u4SitA5YTL7qhLrhhSlMsw= X-Google-Smtp-Source: ABdhPJz+brgVBqm9C/gglS6f/N2+uM4+55+5HUDLgxqlAU/cS9RI56zbJCvFv5hb3txjLfdOvvaOug== X-Received: by 2002:a17:907:6e07:b0:6f3:c01b:4890 with SMTP id sd7-20020a1709076e0700b006f3c01b4890mr5774743ejc.678.1651085412875; Wed, 27 Apr 2022 11:50:12 -0700 (PDT) Received: from jernej-laptop.localnet (89-212-118-115.static.t-2.net. [89.212.118.115]) by smtp.gmail.com with ESMTPSA id bl20-20020a170906c25400b006efeef97b1esm7046602ejb.206.2022.04.27.11.50.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 11:50:12 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Paul Kocialkowski Cc: Yong Deng , Paul Kocialkowski , 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 Date: Wed, 27 Apr 2022 20:50:11 +0200 Message-ID: <13001485.uLZWGnKmhe@jernej-laptop> In-Reply-To: <20220415152811.636419-14-paul.kocialkowski@bootlin.com> References: <20220415152811.636419-1-paul.kocialkowski@bootlin.com> <20220415152811.636419-14-paul.kocialkowski@bootlin.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Dne petek, 15. april 2022 ob 17:27:39 CEST je Paul Kocialkowski napisal(a): > Introduce some helpers for buffer and general video configuration. > > Signed-off-by: Paul Kocialkowski > --- > .../platform/sunxi/sun6i-csi/sun6i_video.c | 46 +++++++++++-------- > 1 file changed, 28 insertions(+), 18 deletions(-) > > 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; > } > > +/* Video */ > + > +static void sun6i_video_buffer_configure(struct sun6i_csi_device *csi_dev, > + struct sun6i_csi_buffer *csi_buffer) > +{ > + csi_buffer->queued_to_csi = 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 = &csi_dev->video; > + struct sun6i_csi_config config = { 0 }; > + > + config.pixelformat = video->format.fmt.pix.pixelformat; > + config.code = video->mbus_code; > + config.field = video->format.fmt.pix.field; > + config.width = video->format.fmt.pix.width; > + config.height = video->format.fmt.pix.height; > + > + sun6i_csi_update_config(csi_dev, &config); > +} > + > /* Queue */ > > static int sun6i_video_queue_setup(struct vb2_queue *queue, > @@ -160,7 +183,6 @@ static int sun6i_video_start_streaming(struct vb2_queue > *queue, struct video_device *video_dev = &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; > } > > - config.pixelformat = video->format.fmt.pix.pixelformat; > - config.code = video->mbus_code; > - config.field = video->format.fmt.pix.field; > - config.width = video->format.fmt.pix.width; > - config.height = video->format.fmt.pix.height; > - > - ret = sun6i_csi_update_config(csi_dev, &config); > - if (ret < 0) > - goto error_media_pipeline; > + sun6i_video_configure(csi_dev); What happened to that error handling? New helper function ignores return value of sun6i_csi_update_config(). Why? Best regards, Jernej > > spin_lock_irqsave(&video->dma_queue_lock, flags); > > buf = list_first_entry(&video->dma_queue, > struct sun6i_csi_buffer, list); > - buf->queued_to_csi = true; > - sun6i_csi_update_buf_addr(csi_dev, buf->dma_addr); > + sun6i_video_buffer_configure(csi_dev, buf); > > sun6i_csi_set_stream(csi_dev, true); > > @@ -219,8 +232,7 @@ static int sun6i_video_start_streaming(struct vb2_queue > *queue, * would also drop frame when lacking of queued buffer. > */ > next_buf = list_next_entry(buf, list); > - next_buf->queued_to_csi = true; > - sun6i_csi_update_buf_addr(csi_dev, next_buf->dma_addr); > + sun6i_video_buffer_configure(csi_dev, next_buf); > > spin_unlock_irqrestore(&video->dma_queue_lock, flags); > > @@ -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 = 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 = list_next_entry(next_buf, list); > - next_buf->queued_to_csi = 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"); > } 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 22D45C433F5 for ; Wed, 27 Apr 2022 18:51:49 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=577ItoCXBi5umqqvDABs6eMWW76kg6Qdqj1zy4T0fSU=; b=rIiWGQjptCbJsE 5cwLGPhGplAWVYMUxCQUh5CLvj6MIzG513/Wl7RZhKYxDQLQ4xLM9zhp9VHUehcjJUxjZRoDNBoh1 W5RVIZVU7tCuZCBOFeBphlHAi31Hid/mYCLhdOB1NL3kSLIUl1p/N5lxNOZlrEKxczzRVZwoj4s3j xi/n1krxnXd36TFZHv3/Bxa5HCyEevwwVDBce4VKgS60bkom2rVXUjEnDSW+IM+6mTY7c4QFUJvz2 IskkDPj0SFhERTYeu4gFG99Q/CUZdZEd8QKkwMj5NHDL96Bqx1ZRYvtvL3b2qxwTAKPf3abMRQgV6 wnTkbIGs0QZWepKcy3qA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1njmkG-0038VA-K3; Wed, 27 Apr 2022 18:50:37 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1njmju-0038M0-Ab for linux-arm-kernel@lists.infradead.org; Wed, 27 Apr 2022 18:50:16 +0000 Received: by mail-ej1-x632.google.com with SMTP id j6so5136683ejc.13 for ; Wed, 27 Apr 2022 11:50:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D9r0h1m2vNnq39XzwLF8H3AjdnE9ECGsJT/LxPF6Djc=; b=Hr2nxqWb+dWmu2gue0be4PA5VozC92i9QKWr0B1EuHb+1byxvxk06zLICmQpncB93A pZiZ2qj+UYl/dj5/frfi5nznQVfb7LqlY7f0kS+jhUp72MgJVNTWjMGsOippShvP3/46 UztM8QZBxGs0azBztCU+LZBx7lAuE+Ls5hB9LmFVZdlHzvrCQwXPeqCVUxlKB3iKo7K8 o/QSJuMQt8xp/YXLyhCIUG0SmJKtFqAiYj+bgEfdOPhrBMK2tw86Hy+DoxGBik92tkLS 6mCMe2wY7S0fkBnaoIhCwIZLXiDru7hmV877xGl6+t1i2dd4hwfgifgIt4P5zp6XViug s8lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D9r0h1m2vNnq39XzwLF8H3AjdnE9ECGsJT/LxPF6Djc=; b=rhBCyhpMOqtCR8bT+EndSdyaT/8Lw7Y7OrYTteu5CnOwYBEtP9b17WdbreEL3G5hl8 qT8lXhDURlc6l5FnqJZGIo2fLbbu3Is7i7w2gfTCEJLYr4yX/jHUKoAcKfD6NA8l8k/2 ky0Fv6wuolgKQo4COFR2iz5pS5jrRYU1Jg5ag/imSvbAEPziKSylIJsfyaH0t/fSS8H8 jIZQnY1EBlRR3bScoCfFhpyR4eB94ehX1Osd+44RooizW2/qJtg2lEBgtfXhlj2G2+RP kFiIDsFFP1bfBW5mUAHtb8yyGwTlychYd5kqlYFnEkg7uyK0CDMKHyeR9mN8AypfCZWm etDg== X-Gm-Message-State: AOAM533/5IOB+gqrZadzFT7GQbMWyNW3oESEsjFiIKDUaqaGU11gmVWa GxXcpwF2SLrZLaPTO73zigNSlDimLj1UGg== X-Google-Smtp-Source: ABdhPJz+brgVBqm9C/gglS6f/N2+uM4+55+5HUDLgxqlAU/cS9RI56zbJCvFv5hb3txjLfdOvvaOug== X-Received: by 2002:a17:907:6e07:b0:6f3:c01b:4890 with SMTP id sd7-20020a1709076e0700b006f3c01b4890mr5774743ejc.678.1651085412875; Wed, 27 Apr 2022 11:50:12 -0700 (PDT) Received: from jernej-laptop.localnet (89-212-118-115.static.t-2.net. [89.212.118.115]) by smtp.gmail.com with ESMTPSA id bl20-20020a170906c25400b006efeef97b1esm7046602ejb.206.2022.04.27.11.50.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 11:50:12 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Paul Kocialkowski Cc: Yong Deng , Paul Kocialkowski , 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 Date: Wed, 27 Apr 2022 20:50:11 +0200 Message-ID: <13001485.uLZWGnKmhe@jernej-laptop> In-Reply-To: <20220415152811.636419-14-paul.kocialkowski@bootlin.com> References: <20220415152811.636419-1-paul.kocialkowski@bootlin.com> <20220415152811.636419-14-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220427_115014_463287_C0F5C481 X-CRM114-Status: GOOD ( 21.07 ) 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: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Dne petek, 15. april 2022 ob 17:27:39 CEST je Paul Kocialkowski napisal(a): > Introduce some helpers for buffer and general video configuration. > > Signed-off-by: Paul Kocialkowski > --- > .../platform/sunxi/sun6i-csi/sun6i_video.c | 46 +++++++++++-------- > 1 file changed, 28 insertions(+), 18 deletions(-) > > 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; > } > > +/* Video */ > + > +static void sun6i_video_buffer_configure(struct sun6i_csi_device *csi_dev, > + struct sun6i_csi_buffer *csi_buffer) > +{ > + csi_buffer->queued_to_csi = 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 = &csi_dev->video; > + struct sun6i_csi_config config = { 0 }; > + > + config.pixelformat = video->format.fmt.pix.pixelformat; > + config.code = video->mbus_code; > + config.field = video->format.fmt.pix.field; > + config.width = video->format.fmt.pix.width; > + config.height = video->format.fmt.pix.height; > + > + sun6i_csi_update_config(csi_dev, &config); > +} > + > /* Queue */ > > static int sun6i_video_queue_setup(struct vb2_queue *queue, > @@ -160,7 +183,6 @@ static int sun6i_video_start_streaming(struct vb2_queue > *queue, struct video_device *video_dev = &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; > } > > - config.pixelformat = video->format.fmt.pix.pixelformat; > - config.code = video->mbus_code; > - config.field = video->format.fmt.pix.field; > - config.width = video->format.fmt.pix.width; > - config.height = video->format.fmt.pix.height; > - > - ret = sun6i_csi_update_config(csi_dev, &config); > - if (ret < 0) > - goto error_media_pipeline; > + sun6i_video_configure(csi_dev); What happened to that error handling? New helper function ignores return value of sun6i_csi_update_config(). Why? Best regards, Jernej > > spin_lock_irqsave(&video->dma_queue_lock, flags); > > buf = list_first_entry(&video->dma_queue, > struct sun6i_csi_buffer, list); > - buf->queued_to_csi = true; > - sun6i_csi_update_buf_addr(csi_dev, buf->dma_addr); > + sun6i_video_buffer_configure(csi_dev, buf); > > sun6i_csi_set_stream(csi_dev, true); > > @@ -219,8 +232,7 @@ static int sun6i_video_start_streaming(struct vb2_queue > *queue, * would also drop frame when lacking of queued buffer. > */ > next_buf = list_next_entry(buf, list); > - next_buf->queued_to_csi = true; > - sun6i_csi_update_buf_addr(csi_dev, next_buf->dma_addr); > + sun6i_video_buffer_configure(csi_dev, next_buf); > > spin_unlock_irqrestore(&video->dma_queue_lock, flags); > > @@ -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 = 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 = list_next_entry(next_buf, list); > - next_buf->queued_to_csi = 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"); > } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel