Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2012798ybi; Sat, 13 Jul 2019 05:04:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxnYUI+0JG0ODZMDpcc7clnIZ8FkmEfAnh5s8kFMsoizfOE15Z8ZSpN8pyWSIRrCa2i5KR X-Received: by 2002:a17:90a:2506:: with SMTP id j6mr18490681pje.129.1563019498814; Sat, 13 Jul 2019 05:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563019498; cv=none; d=google.com; s=arc-20160816; b=RamnLzEl7VOUdhyNoblnBKRBdvjkxI8GqNft4PRkFbUmFa/7hzaUjiAgTLa2cHGmg2 GwEqxeXwZk6ckT3jbYtBLvOnBhzOmcoUU7MPXEGPy/FCcI1g6+eolTwMWdBpGbvKyq6S pUTA2eA5ZDvY7EHyz3pmfzTXFZ3QvtRwcv2glihNSm4jqzyGfJbDAoQEvDWks/OmOnDx aGCBYuo+EpNaGMUL16RJ1JZKq4qCPzLEQIrGUj6DkjIaMauXJ/A61bBsxBfV6EwkIeVx 80V7rIcQjN/P7Wx3C4GkW/2ikrhVRRqwmG05ad3ZosQVigeLGD1HY3erYl0Y48IQ5Wpt cODw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=laaXw9XFTBX1cIq5c2caDfG0hocBnM6S/bVz2gZUgRY=; b=E9X4Z+kFjGUSwWlsxygLc5D+fqgSP145MXfdzSwTnPlK2jraxcDMB8vDdU4eR6jcXC xbyb8kWSEY1lyD8j43MVOUU60OGueUb8fM5zl9am4sIvqc3GJmU7ioclnOQCm17KVULF Xi8Bmmn22b6wVmbbeLWCmwo5/tUmHDgL9yxSxz528JgkbdbyoDrdm2Is1g+fHPJFk3Vs GWiy/hL3jN4v+vZNFfeJ/WYLx5iHqKZrY5xzTnBRoTxfTQWK4Dwt42qth2NcOCwNMbTB 7JTO58OoMXTxlfeHKD8EtDYR69J1+qRNWWEQNx7Tn1visHL4jNTDKABYwgrDI2Tay3DR RoCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siol.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g13si11484459pfo.22.2019.07.13.05.04.31; Sat, 13 Jul 2019 05:04:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siol.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727831AbfGMMEF (ORCPT + 99 others); Sat, 13 Jul 2019 08:04:05 -0400 Received: from mailoutvs3.siol.net ([185.57.226.194]:35176 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727776AbfGMMEE (ORCPT ); Sat, 13 Jul 2019 08:04:04 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTP id C04B8520797; Sat, 13 Jul 2019 14:04:01 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta12.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta12.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 9JqdsLTKX2Ig; Sat, 13 Jul 2019 14:04:01 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTPS id 7B44B5214F8; Sat, 13 Jul 2019 14:04:01 +0200 (CEST) Received: from localhost.localdomain (cpe-194-152-11-237.cable.triera.net [194.152.11.237]) (Authenticated sender: 031275009) by mail.siol.net (Zimbra) with ESMTPSA id 0A2A9520797; Sat, 13 Jul 2019 14:03:59 +0200 (CEST) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org Cc: airlied@linux.ie, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH 2/3] drm/sun4i: sun8i_csc: Simplify register writes Date: Sat, 13 Jul 2019 14:03:45 +0200 Message-Id: <20190713120346.30349-3-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190713120346.30349-1-jernej.skrabec@siol.net> References: <20190713120346.30349-1-jernej.skrabec@siol.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It turns out addition of 0x200 to constant parts (+0.5) is not really necessary. Besides, we can consider that before and fix value in CSC matrix. This simplifies register writes quiet a bit. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_csc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_csc.c b/drivers/gpu/drm/sun4i/su= n8i_csc.c index b8c059f1a118..e07b7876d89b 100644 --- a/drivers/gpu/drm/sun4i/sun8i_csc.c +++ b/drivers/gpu/drm/sun4i/sun8i_csc.c @@ -69,7 +69,7 @@ static void sun8i_csc_set_coefficients(struct regmap *m= ap, u32 base, enum sun8i_csc_mode mode) { const u32 *table; - int i, data; + u32 base_reg; =20 switch (mode) { case SUN8I_CSC_MODE_YUV2RGB: @@ -83,13 +83,8 @@ static void sun8i_csc_set_coefficients(struct regmap *= map, u32 base, return; } =20 - for (i =3D 0; i < 12; i++) { - data =3D table[i]; - /* For some reason, 0x200 must be added to constant parts */ - if (((i + 1) & 3) =3D=3D 0) - data +=3D 0x200; - regmap_write(map, SUN8I_CSC_COEFF(base, i), data); - } + base_reg =3D SUN8I_CSC_COEFF(base, 0); + regmap_bulk_write(map, base_reg, table, 12); } =20 static void sun8i_de3_ccsc_set_coefficients(struct regmap *map, int laye= r, --=20 2.22.0