Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1968903ioo; Mon, 23 May 2022 07:17:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypF7/OGOZ1tfYC0yfI3i55FKw8/6XXKQKkvj3TjNZ7PG0cUKK3TcjvuleOp7pxUlTdPQUC X-Received: by 2002:a63:a4d:0:b0:3db:7de7:58b0 with SMTP id z13-20020a630a4d000000b003db7de758b0mr20891698pgk.128.1653315456217; Mon, 23 May 2022 07:17:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653315456; cv=none; d=google.com; s=arc-20160816; b=zQrslXT/exQJ0fBAK+LJJzBGYi+qDDVX3UOrqJDBtX1ickBYx2IHYAMkKChulJwmjY HlQjelXm60x3AfcY9zSEfekdTGr2rqd8k7HVJIgKteuzponohWoyBqUI9hnqa4/0+3zW 9ZKJow1F9F053FHAUncu1fNdXA2JVvFDpgWHtPDuSiZeht5WioPn+3zwWIx2pm+/Wjtz G79TX1IShuChqS03RaSkQJhwPnwtz9yQwKm6jU4azkJRGwNrRMw52QFBydH/zC/E2CbD Y4iANiOClBkShg1mjLFEGiaKqDBokzqFy0mHklIGZQatAhx8wI1oOtCXHn1K1vx7KuZJ JJ1g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=8+tWWGdUUqXU3k+3mlTOTF7zQnrbpz/Cfc5DG2fG8JY=; b=YJCgT3DG19kraQHDbkff9BafDaFyx2m8JYvoQXQ0vLO0H2XRpT3qCSLgdJiDdSbrsY uM0FE8jvRYLdeTXkZ7CPtpRqC/4yh3kCtXeNGChgLOxcsJdoUOJaDQkZ3lRTN2ZMYsQR aQWcEpFquUlRfgGmbW9a8m99HQWei+lGDcTBYPToFsRsOLRWipWdDgdUnPHGW9rKa6di +UqhyWULfGRtAEO58cjfH1W7Pccyf1kt23Xr63ckjhXo1dO6Zarlc7WKeNiYt/YPGVks 8yLOWD5NU9TxVoCckf+bYv0QVu+1cN0s5AW4S5LEhOsBPJtshsGPFS9fLpIiMaaJl5Ci kDUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=Zj9miZlR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o18-20020a170903009200b0015ed1a33028si9158719pld.495.2022.05.23.07.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 07:17:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=Zj9miZlR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 72BCE5A08E; Mon, 23 May 2022 07:17:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237059AbiEWOR0 (ORCPT + 99 others); Mon, 23 May 2022 10:17:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236939AbiEWORZ (ORCPT ); Mon, 23 May 2022 10:17:25 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B938359BA0; Mon, 23 May 2022 07:17:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1653315443; x=1684851443; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=JI0lcN9SHVIzgJehontYp/EcHZi0BmK64pGfGXgA72E=; b=Zj9miZlRKkO1Gr6cHEAKTFiWI0+4eIOsyjdcAgTnv6eHdOZHqYRyYS9F tNp2E2rLrEby161sVsFzPqvElXrDeOMg8dCmAN2hShwSqUrqRTRBQSy6c 3/rPvoRYFx+KZ4s0wUrsGa6gO3vALgo7S5Pj8nXy3TZVkpWHgBFHS5mzx 6GnSZ+wOSUXTAx+vH8Y1/+Wp9gTHkIYoB+ygy2mQKrFXMYFZomQpW0Ybq SKyE5o0j6upL4YDf5yxjupbYyFx226FtTZ/71EZNrec46g5aAXy7uqvSk jsaf90S8GvRW4y0mkZDFxa1DGmt2U4hjouEKSyoxKextTvIiAiz48J5NO Q==; X-IronPort-AV: E=Sophos;i="5.91,246,1647327600"; d="scan'208";a="96932993" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 May 2022 07:17:13 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 23 May 2022 07:17:13 -0700 Received: from ROB-ULT-M18282.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Mon, 23 May 2022 07:17:12 -0700 From: Eugen Hristev To: CC: , , Eugen Hristev Subject: [PATCH] media: atmel: atmel-isc-base: move cropping settings outside start_dma Date: Mon, 23 May 2022 17:17:05 +0300 Message-ID: <20220523141705.98121-1-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: X-Mailing-List: linux-kernel@vger.kernel.org The cropping configuration of the Parallel Front Engine (PFE) can be done just once when the streaming starts. The ISC configuration is in place and will not be changed while streaming. It is not effective to keep rewriting the crop registers configuration everytime start_dma is called, as this can be called for each queued buffer. Thus we can configure the cropping at start_streaming time. This change moves the code to a dedicated function. Signed-off-by: Eugen Hristev --- drivers/media/platform/atmel/atmel-isc-base.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c index 894c22081397..01a2e7f626d0 100644 --- a/drivers/media/platform/atmel/atmel-isc-base.c +++ b/drivers/media/platform/atmel/atmel-isc-base.c @@ -127,12 +127,9 @@ static int isc_buffer_prepare(struct vb2_buffer *vb) return 0; } -static void isc_start_dma(struct isc_device *isc) +static void isc_crop_pfe(struct isc_device *isc) { struct regmap *regmap = isc->regmap; - u32 sizeimage = isc->fmt.fmt.pix.sizeimage; - u32 dctrl_dview; - dma_addr_t addr0; u32 h, w; h = isc->fmt.fmt.pix.height; @@ -167,6 +164,14 @@ static void isc_start_dma(struct isc_device *isc) regmap_update_bits(regmap, ISC_PFE_CFG0, ISC_PFE_CFG0_COLEN | ISC_PFE_CFG0_ROWEN, ISC_PFE_CFG0_COLEN | ISC_PFE_CFG0_ROWEN); +} + +static void isc_start_dma(struct isc_device *isc) +{ + struct regmap *regmap = isc->regmap; + u32 sizeimage = isc->fmt.fmt.pix.sizeimage; + u32 dctrl_dview; + dma_addr_t addr0; addr0 = vb2_dma_contig_plane_dma_addr(&isc->cur_frm->vb.vb2_buf, 0); regmap_write(regmap, ISC_DAD0 + isc->offsets.dma, addr0); @@ -371,6 +376,7 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count) struct isc_buffer, list); list_del(&isc->cur_frm->list); + isc_crop_pfe(isc); isc_start_dma(isc); spin_unlock_irqrestore(&isc->dma_queue_lock, flags); -- 2.25.1