Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2387440lqp; Sun, 24 Mar 2024 17:10:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWMuqnEwvhgz0M8rxJuOVSK1nk6MjuuKCP+By3Bf90oL1B4KPY16qSbK8UjMRXKDd4v9tMDRp5A9EAyw3ga3t/rN1IX5HPUlMN4kc4tSQ== X-Google-Smtp-Source: AGHT+IGlR2awB7JWji92oTzi2MQWOOF1suDj6QtEWaP5Yjk3HOQBVDuFeIf6zChb0kW3QVFfkOFD X-Received: by 2002:a50:d7d1:0:b0:56b:f2d2:eb8d with SMTP id m17-20020a50d7d1000000b0056bf2d2eb8dmr3598493edj.29.1711325459673; Sun, 24 Mar 2024 17:10:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711325459; cv=pass; d=google.com; s=arc-20160816; b=Z7OZxL/u2VPz1GtIcn2fxN5rAkxuTs34LjC0JCjElPqw3FEynRcFlUIfJZR/n9wrQS jLpgAk6KvARE8YFYu6XpPivKZnSi9VOGfct36TxiWTJLCNVo24zMHLU3GWDCOnOLgwZD cE5MfbiFJ1/UCiL7yshe9/m+D8XjJfJwEe699viEKZovDfe2r5mOI89CJMUGxosp9ZPP pb+/o5T39JNM/lT/NSexmMxAnESg4W9Uj8Sl0wgZpf/hD+jLoQZiMOAx+xv38Q2kTLq3 Er1Ne3dppShWPpmsbtr2G+v3jmDzNOBKRSe1yelfcJiNn+UQcCieioj+YoFl/LHEJk73 4pqg== 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=u16x5Y0sC8Clm4focRbUO/CuJHmz1nUldgWMLjaf4Ss=; fh=qPC/o307FcKMX9e48ELEOR3WX9/nitAnIX4Zc73R9i4=; b=UfSAKVAdVMOSNzYTj3i6oUMmB5G8NEk7YTyf6Dw7N/qdStY8BaSVevRqXIUxtSw3B8 xBrpc3kL+h84/d0KTY6N9AtYJeEs3eTwj9RK3EEquRVVYUx0hcO2y17LrJ2oGFkIUrk4 YbCOTik0DlrJLiqvQKDEAAIJlEb2pT3FTUls29Rxhji849eh3lAWI9M9hbSMG6db1WEN nYUuLjRm6mVipfS+mOu1f6AsPO+jzqiQhMxmIwOktY9AWM0A/80eKh2h0tNaISBI3U45 S6YJlldCVZFRPwN7SyIqoc5RPUGsPcanpTDGdkiAUPAkipGFYUVqGYdYv443e7h6VD1h 5s2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kj2aYIKg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113325-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113325-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id x2-20020a05640226c200b0056bf33635d6si2001502edd.61.2024.03.24.17.10.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:10:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113325-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kj2aYIKg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113325-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113325-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 45C001F21F55 for ; Mon, 25 Mar 2024 00:10:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4640413CEFF; Sun, 24 Mar 2024 22:42:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kj2aYIKg" 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 5961113CEDF; Sun, 24 Mar 2024 22:42:07 +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=1711320127; cv=none; b=rz3V1NrEoVkDudsou6OVnX2TqE8tXW+iqevG1+n1SYMAK8Rsp4xGXRG5B3ZpKoWpxAZia64BlxWpuBPidLmbFT4hzvv38hgX5V5Fop4050tZ+rnF2i4/CiC3gSL47xkmlLe2yC1n1Aq2ZwuLAry9m+1rmGpO3mVkEqEl0PnM2pg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320127; c=relaxed/simple; bh=hEewbwq3o+dVYyStCmcX6ltbWIVhAQnW6rrYsn2EJWg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MIQLzEFTRG0Ic5U0qUkXhTj/llakIxds0HkBCsfsEa6AebI4/7yBomC7iir8B1MUhpOqkXtr0oH1xfuYrIuHoPCFvNrLziA3ucOBO7q00HJSa8PRQnEeRKAEu9eVV2ZnwC2cvNEgPRMWkJyZBa4UU9FVlA38afcr6O6p9ewiaUw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kj2aYIKg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C0AAC43394; Sun, 24 Mar 2024 22:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320126; bh=hEewbwq3o+dVYyStCmcX6ltbWIVhAQnW6rrYsn2EJWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kj2aYIKgTxoWcG1Ujw5FstumM9nXJX74y/3bwpiyjbrCJf2o1JUx+tbzWz5o3fErj W+614fW7qUOaahLFxQcNgt8WaEl1TBNOq4SwAy6xQycannOzGPKzciGl5VqOWYf+C+ Uc9axXfKGr7F5OCjGZeIzLzN+r1Y69C+0rT9r1rtHSP+MHGqVAjxdN0TIgsVl/4ca6 k0zDCA2BwJNqSonqJR5sGZrcIpvWKdJPIRT2m46X40rm/Oj7Lx3UGm6kOvWXxqekYT 62E5revc+1pQ0WPQGIcsueQL7Du2UtlpuULjft3e5BcYumsC6z07LaTpeff8Re36Ce LLuaTF6AuQfeA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jernej Skrabec , Hans Verkuil , Sasha Levin Subject: [PATCH 6.8 434/715] media: sun8i-di: Fix coefficient writes Date: Sun, 24 Mar 2024 18:30:13 -0400 Message-ID: <20240324223455.1342824-435-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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 954fabec27f63..26f6964996f2c 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