From patchwork Mon May 23 14:17:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 12859126 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 33D7AC433EF for ; Mon, 23 May 2022 14:18:53 +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: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:In-Reply-To:References: List-Owner; bh=XAoaQqC1cGKy5Kn4J5aP1FJ8VIUEDb77LVPlxWUg+xE=; b=p58zSRPj75An5K t+jbw8kgP27gCaJE/M6pLfUeRmXTIhdgLcLfKI4iZKEVZOg84dHU9DanwtfHkVs8txkXesvcALHzb riaY3P3sYHIVTtx/XswR2vPhd0ViX8JRTq+4xwpXnRp2VUJGfTzeN/QlsDwnkXCuNLijk4DAO9P5j YXKcRKwPXJbN080ORyrwyV1xAwLCha33yrhYvw05eKfDnFEjvxjHRX2M7tGqteRYcQ43WGbPWuvON I4mhOYUrGbPwr/qxDWnJqsTLQaV8QEZmeQtj+95Jhp1QKxq7Y02u66gABkq7E2HQ83w2pyxLmqax4 bLbpOOeQNplHoy4s2CzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nt8sF-004fqo-9O; Mon, 23 May 2022 14:17:31 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nt8sC-004fo7-2k for linux-arm-kernel@lists.infradead.org; Mon, 23 May 2022 14:17:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1653315448; x=1684851448; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=JI0lcN9SHVIzgJehontYp/EcHZi0BmK64pGfGXgA72E=; b=rau19untkT+RI4yl3cefaBZGvjefXbphmZYynf8ZdinRUN+Au3IcwNKM ITXcgY83Ov1Ju0W2gDywrp1VgOHRNpp/rD2tTv8R/37pPxrNHPx8RX/Kz H0APvgTzX/SkbNYmXd4mRWOUERvu8u4pduMi84txYFa2dNt496EDqOO+q JQgqYnkA+jRqkitFPogrgskGRNFjpKEq7YfsokCrz9Ysnngd9bwfOgh0m o+xtwaJqzZKBV20/9QgFJg7V77rFWcB27bmRU99bzo9lZfixpAj7OmK39 kPxf5O5Gy6QKcOUE0/IkSVeu/qwMz0r5cWFiW5GNDK1PFtnTXMq8q1/q1 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220523_071728_265642_E55CF513 X-CRM114-Status: GOOD ( 10.68 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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);