Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2567190lqp; Mon, 25 Mar 2024 02:53:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVsXpm0nKJNQjnV7i6rKwf+4719p/+LaPYsbe5WFLHt6idFTzeoXDhAKCZXJK4F9nYt0a3tAsRw+ne9ovimn+5sq39h3QL4HPGDbzT5Ug== X-Google-Smtp-Source: AGHT+IH2SRhOWPKMVO1L2UoZy6KtO4B3G2ZTgUncu7S7gh6G8DOW0WpxELldcTl0/HnUz5BaujYC X-Received: by 2002:a37:e20c:0:b0:78a:1a9c:2222 with SMTP id g12-20020a37e20c000000b0078a1a9c2222mr7522145qki.72.1711360439594; Mon, 25 Mar 2024 02:53:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711360439; cv=pass; d=google.com; s=arc-20160816; b=a+DYQ+fH8k+rac4E0hx0hOJtgio1Y3RtT7VIPzMIoXnIMs7gaLhiJUFwZs2vpunZ4/ C+TR+d+g5+f30ZoeZfNI5HNPI4JYELQ9cO5Xj1yqG+CbYqpvYdMuJ0E2XWiylo7J2zTP I1cF+2ivsQOfAMJaUi+yAi3TadgfHIa/kUWCminleoyF11N1dAdFbE/lwpiwFW65P6Sv 1XGNNZbUdIrrTMCVYpQBn0nbe0NiqXwJkEqX2+hN5LTYakvNYLWHJoQvcGVRawpdYqDb DpmJSCGsCh1r9BP2v70Jbs5PvvXu8LKTT9kAarpOmdyg9p1i/FOMRaVY5aGqbMMNXJbX bcPg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=gOHBvb0oHQJoldYOuT6CQY5SeUt9m0fn1DxClZQFayQ=; fh=qPC/o307FcKMX9e48ELEOR3WX9/nitAnIX4Zc73R9i4=; b=StZF/KC8P5jDMnP3IiTFTYwP6jRhMfwW01JfwU8c5SOBaCaVrLAobovRpXB67lT4Wg DLHeOyNjIbzfWkSsZwpLMXNQ2fWK1gazSmL/EK7wovI+G9G0JV74hMhWpV4T6ws+4YQX T7rFfXAWqRG4vc4c8BYl38JDGEB09K5Nza+75jWsMOgzb6PAQZ0DNNLo9b7R0cvbxgzm FIWICaPGLvIJhIkhJsKnvMHh2gDMUZeNIiWGnkK7CAVe6RmL6COr+FNqAXAQqgzmz5f/ MfN9oH9aJPybWTVdyzV7bmqrZNDuWikYgFrFvKHg/4B5wsnWTPiK1WO+ENfr9sIFDl0l NaIQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FylXEPhu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115957-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115957-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z4-20020a05620a260400b0078a57c1d0bfsi1561186qko.674.2024.03.25.02.53.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:53:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115957-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FylXEPhu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115957-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115957-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4FC331C30CAD for ; Mon, 25 Mar 2024 09:53:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66C1439280A; Mon, 25 Mar 2024 03:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FylXEPhu" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 708A622F8DC; Sun, 24 Mar 2024 23:16:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322218; cv=none; b=kqEAOkGjt4va5Z1rrDd8ReiH4HKi6IqAcaQGciC19a0EfDjkpDZWgFnLcao7kTyA+vRuLJymz4xQvGWDtCoK8giuiNAwEC8bVnwcj6c7Jqoo9lOYjipCK2bUwIpQ53jo6i/T7sKCgEqwfmyD9BgZjVqHnxycThQtFS/0QpEBavs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322218; c=relaxed/simple; bh=B+k/pamiQ3ClBsewrFWTZB1vez8WkRKZdU4MS94GbvE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CXGATR+I1mb62xOVKN5UEuR6vVZWH0GAmOoKrOLIusvAb+0cu0GJmLRCi57mr3vlIGFvFSqIiKycQe+/2MvA3ml0A7IPBtmsD4G7yWIeP9iWZf4oskkoPCn00ljJoiqVQtZyVapXXACV4JlLA4uoyVz0MMM0qV/9inU4YNbk2Do= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FylXEPhu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB72DC433B2; Sun, 24 Mar 2024 23:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322218; bh=B+k/pamiQ3ClBsewrFWTZB1vez8WkRKZdU4MS94GbvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FylXEPhurJ1lKpT1Vde0AEawz3LJ+XmfCtqPYtjjkSVvaOvgEue/lv/LeASRXEcvc oBVmDHPuAznUrXGkzk89WvJv1FCYWYP3dpvA9veacqwgmxSbEYVx12QsEQCR7oEtd7 7eUAxogf2ZUdD9igA9f7/CcRb7ebfOuOaM+PKEPBxDpuoBgX4D6FOWBrQdWzpxqndY rWcTdFJV5JYhAX5ibGS+UXYvRdPwby+O9jCITbyKY8KoTPbv2J5dbaeKRmBukk8JA5 k6slQa6GrKCJuiyMpWoFbWvkYYjBwEb+150XWDPqZVgJk5cshdOSIX55SzZSa0+GRr Mj9gXwQYNoXIw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jernej Skrabec , Hans Verkuil , Sasha Levin Subject: [PATCH 6.1 298/451] media: sun8i-di: Fix coefficient writes Date: Sun, 24 Mar 2024 19:09:34 -0400 Message-ID: <20240324231207.1351418-299-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Jernej Skrabec [ Upstream commit 794b581f8c6eb7b60fe468ccb96dd3cd38ff779f ] Currently coefficients are applied only once, since they don't change. However, this is done before enable bit is set and thus it doesn't get applied properly. Fix that by applying coefficients after enable bit is set. While this means that it will be done evey time, it doesn't bring much time penalty. Fixes: a4260ea49547 ("media: sun4i: Add H3 deinterlace driver") Signed-off-by: Jernej Skrabec Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- .../media/platform/sunxi/sun8i-di/sun8i-di.c | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c index aa65d70b6270a..3e58de58cd89d 100644 --- a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +++ b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c @@ -66,6 +66,7 @@ static void deinterlace_device_run(void *priv) struct vb2_v4l2_buffer *src, *dst; unsigned int hstep, vstep; dma_addr_t addr; + int i; src = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); dst = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); @@ -160,6 +161,26 @@ static void deinterlace_device_run(void *priv) deinterlace_write(dev, DEINTERLACE_CH1_HORZ_FACT, hstep); deinterlace_write(dev, DEINTERLACE_CH1_VERT_FACT, vstep); + /* neutral filter coefficients */ + deinterlace_set_bits(dev, DEINTERLACE_FRM_CTRL, + DEINTERLACE_FRM_CTRL_COEF_ACCESS); + readl_poll_timeout(dev->base + DEINTERLACE_STATUS, val, + val & DEINTERLACE_STATUS_COEF_STATUS, 2, 40); + + for (i = 0; i < 32; i++) { + deinterlace_write(dev, DEINTERLACE_CH0_HORZ_COEF0 + i * 4, + DEINTERLACE_IDENTITY_COEF); + deinterlace_write(dev, DEINTERLACE_CH0_VERT_COEF + i * 4, + DEINTERLACE_IDENTITY_COEF); + deinterlace_write(dev, DEINTERLACE_CH1_HORZ_COEF0 + i * 4, + DEINTERLACE_IDENTITY_COEF); + deinterlace_write(dev, DEINTERLACE_CH1_VERT_COEF + i * 4, + DEINTERLACE_IDENTITY_COEF); + } + + deinterlace_clr_set_bits(dev, DEINTERLACE_FRM_CTRL, + DEINTERLACE_FRM_CTRL_COEF_ACCESS, 0); + deinterlace_clr_set_bits(dev, DEINTERLACE_FIELD_CTRL, DEINTERLACE_FIELD_CTRL_FIELD_CNT_MSK, DEINTERLACE_FIELD_CTRL_FIELD_CNT(ctx->field)); @@ -248,7 +269,6 @@ static irqreturn_t deinterlace_irq(int irq, void *data) static void deinterlace_init(struct deinterlace_dev *dev) { u32 val; - int i; deinterlace_write(dev, DEINTERLACE_BYPASS, DEINTERLACE_BYPASS_CSC); @@ -285,26 +305,6 @@ static void deinterlace_init(struct deinterlace_dev *dev) deinterlace_clr_set_bits(dev, DEINTERLACE_CHROMA_DIFF, DEINTERLACE_CHROMA_DIFF_TH_MSK, DEINTERLACE_CHROMA_DIFF_TH(5)); - - /* neutral filter coefficients */ - deinterlace_set_bits(dev, DEINTERLACE_FRM_CTRL, - DEINTERLACE_FRM_CTRL_COEF_ACCESS); - readl_poll_timeout(dev->base + DEINTERLACE_STATUS, val, - val & DEINTERLACE_STATUS_COEF_STATUS, 2, 40); - - for (i = 0; i < 32; i++) { - deinterlace_write(dev, DEINTERLACE_CH0_HORZ_COEF0 + i * 4, - DEINTERLACE_IDENTITY_COEF); - deinterlace_write(dev, DEINTERLACE_CH0_VERT_COEF + i * 4, - DEINTERLACE_IDENTITY_COEF); - deinterlace_write(dev, DEINTERLACE_CH1_HORZ_COEF0 + i * 4, - DEINTERLACE_IDENTITY_COEF); - deinterlace_write(dev, DEINTERLACE_CH1_VERT_COEF + i * 4, - DEINTERLACE_IDENTITY_COEF); - } - - deinterlace_clr_set_bits(dev, DEINTERLACE_FRM_CTRL, - DEINTERLACE_FRM_CTRL_COEF_ACCESS, 0); } static inline struct deinterlace_ctx *deinterlace_file2ctx(struct file *file) -- 2.43.0