From patchwork Tue Apr 20 12:04:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 424802 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5AC6C433B4 for ; Tue, 20 Apr 2021 12:05:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 833A9613BF for ; Tue, 20 Apr 2021 12:05:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232206AbhDTMF6 (ORCPT ); Tue, 20 Apr 2021 08:05:58 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:57972 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232177AbhDTMF5 (ORCPT ); Tue, 20 Apr 2021 08:05:57 -0400 Received: from deskari.lan (91-157-208-71.elisa-laajakaista.fi [91.157.208.71]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6E0511172; Tue, 20 Apr 2021 14:05:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1618920323; bh=8vEjMRbTVoZMFNafGW4iohz7s3We09O1Pnh+Or34MMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m2ByTn+hPbPGaJyfMqlD+UnsUcw42uaJQZiwE9dnYwt/Xal+9u+witB3892o5exlJ WuR7y7TRj4HvzWncNOHO5zxykJJrGvYiqC38QNylYAQXA2/nSmBXGQ+gqkPXkpq78L +zaMW8pvmKcq7tN2dU74dvB5Gx4DU7LEjvpUsHTE= From: Tomi Valkeinen To: Benoit Parrot , Laurent Pinchart , Pratyush Yadav , Lokesh Vutla , linux-media@vger.kernel.org Cc: Tomi Valkeinen Subject: [PATCH v2 18/35] media: ti-vpe: cal: add 'use_pix_proc' field Date: Tue, 20 Apr 2021 15:04:16 +0300 Message-Id: <20210420120433.902394-19-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210420120433.902394-1-tomi.valkeinen@ideasonboard.com> References: <20210420120433.902394-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org We already have functions to reserve and release a pix proc unit, but we always reserve such and the code expects the pix proc unit to be used. Add a new field, 'use_pix_proc', to indicate if the pix prox unit has been reserved and should be used. Use the flag to skip programming pix proc unit when not needed. Note that we still always set the use_pix_proc flag to true. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/media/platform/ti-vpe/cal.c | 10 +++++++--- drivers/media/platform/ti-vpe/cal.h | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c index 5ab87c9d3707..c1a6e23ff713 100644 --- a/drivers/media/platform/ti-vpe/cal.c +++ b/drivers/media/platform/ti-vpe/cal.c @@ -473,13 +473,15 @@ int cal_ctx_prepare(struct cal_ctx *ctx) } ctx->pix_proc = ret; + ctx->use_pix_proc = true; return 0; } void cal_ctx_unprepare(struct cal_ctx *ctx) { - cal_release_pix_proc(ctx->cal, ctx->pix_proc); + if (ctx->use_pix_proc) + cal_release_pix_proc(ctx->cal, ctx->pix_proc); } void cal_ctx_start(struct cal_ctx *ctx) @@ -489,7 +491,8 @@ void cal_ctx_start(struct cal_ctx *ctx) /* Configure the CSI-2, pixel processing and write DMA contexts. */ cal_ctx_csi2_config(ctx); - cal_ctx_pix_proc_config(ctx); + if (ctx->use_pix_proc) + cal_ctx_pix_proc_config(ctx); cal_ctx_wr_dma_config(ctx); /* Enable IRQ_WDMA_END and IRQ_WDMA_START. */ @@ -530,7 +533,8 @@ void cal_ctx_stop(struct cal_ctx *ctx) cal_write(ctx->cal, CAL_CSI2_CTX(ctx->phy->instance, ctx->csi2_ctx), 0); /* Disable pix proc */ - cal_write(ctx->cal, CAL_PIX_PROC(ctx->pix_proc), 0); + if (ctx->use_pix_proc) + cal_write(ctx->cal, CAL_PIX_PROC(ctx->pix_proc), 0); } /* ------------------------------------------------------------------ diff --git a/drivers/media/platform/ti-vpe/cal.h b/drivers/media/platform/ti-vpe/cal.h index 5d8b3193be7d..d7cc399f47da 100644 --- a/drivers/media/platform/ti-vpe/cal.h +++ b/drivers/media/platform/ti-vpe/cal.h @@ -223,6 +223,8 @@ struct cal_ctx { u8 cport; u8 csi2_ctx; u8 pix_proc; + + bool use_pix_proc; }; extern unsigned int cal_debug;