From patchwork Tue Jul 7 17:08:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 11649387 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D492F13B4 for ; Tue, 7 Jul 2020 17:09:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AE6B0206F6 for ; Tue, 7 Jul 2020 17:09:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PnJKSY5y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE6B0206F6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IQBcowU8gDMCfpVDOdK/kdef3rQw9zhwczb8cKnuB4k=; b=PnJKSY5y9XTgl4VMtIgYpQj5Cg 0bqVD9HmQexOaJH/0KTtNy/CbtDS1b+6DmKYRzHhnkq9JqFiZJfsus05TsYDYU00aAxnMHhBahnJH qKOnFa4RhHxXMU9uNCXoNInNdV0QYKis8RWWjIB4VuLJ6YjVWRaP1XglOr/h1Ga9zloMZNXn+HptA /HFmDHB0ILkfO6dXBlMrloz/tJ5RV8pIYF/1cFFiK7Rr0PHCtmhR9sinLi/xOZmYN9A35q82em56Q BgAVFDfC+KQP9Gb0TVosiZOIiH281f+x3zMuH9BON8wQQXcwOOJs1nEeIgBeqZr7Vy52gYNp6GcXQ t6G/T/Hw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsr5Y-0006nt-86; Tue, 07 Jul 2020 17:09:00 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsr5V-0006le-Ql for linux-rockchip@lists.infradead.org; Tue, 07 Jul 2020 17:08:58 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dafna) with ESMTPSA id 72AD22A236F From: Dafna Hirschfeld To: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com Subject: [PATCH 1/2] media: staging: rkisp1: replace 9 coeff* fields with a 3x3 array Date: Tue, 7 Jul 2020 19:08:44 +0200 Message-Id: <20200707170845.28845-2-dafna.hirschfeld@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200707170845.28845-1-dafna.hirschfeld@collabora.com> References: <20200707170845.28845-1-dafna.hirschfeld@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200707_130857_998871_65232BAA X-CRM114-Status: UNSURE ( 9.28 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [46.235.227.227 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mchehab@kernel.org, dafna.hirschfeld@collabora.com, dafna3@gmail.com, tfiga@chromium.org, hverkuil@xs4all.nl, linux-rockchip@lists.infradead.org, helen.koike@collabora.com, sakari.ailus@linux.intel.com, kernel@collabora.com, ezequiel@collabora.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org The struct rkisp1_cif_isp_ctk_config has 9 fields 'coeff*' for the 3x3 color correction matrix. Replace these fields with one 3x3 array coeff[3][3] and document the field. Signed-off-by: Dafna Hirschfeld Acked-by: Helen Koike --- drivers/staging/media/rkisp1/rkisp1-params.c | 15 ++++++--------- drivers/staging/media/rkisp1/uapi/rkisp1-config.h | 14 ++++---------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/staging/media/rkisp1/rkisp1-params.c b/drivers/staging/media/rkisp1/rkisp1-params.c index 797e79de659c..00b102eb67b6 100644 --- a/drivers/staging/media/rkisp1/rkisp1-params.c +++ b/drivers/staging/media/rkisp1/rkisp1-params.c @@ -402,15 +402,12 @@ static void rkisp1_goc_config(struct rkisp1_params *params, static void rkisp1_ctk_config(struct rkisp1_params *params, const struct rkisp1_cif_isp_ctk_config *arg) { - rkisp1_write(params->rkisp1, arg->coeff0, RKISP1_CIF_ISP_CT_COEFF_0); - rkisp1_write(params->rkisp1, arg->coeff1, RKISP1_CIF_ISP_CT_COEFF_1); - rkisp1_write(params->rkisp1, arg->coeff2, RKISP1_CIF_ISP_CT_COEFF_2); - rkisp1_write(params->rkisp1, arg->coeff3, RKISP1_CIF_ISP_CT_COEFF_3); - rkisp1_write(params->rkisp1, arg->coeff4, RKISP1_CIF_ISP_CT_COEFF_4); - rkisp1_write(params->rkisp1, arg->coeff5, RKISP1_CIF_ISP_CT_COEFF_5); - rkisp1_write(params->rkisp1, arg->coeff6, RKISP1_CIF_ISP_CT_COEFF_6); - rkisp1_write(params->rkisp1, arg->coeff7, RKISP1_CIF_ISP_CT_COEFF_7); - rkisp1_write(params->rkisp1, arg->coeff8, RKISP1_CIF_ISP_CT_COEFF_8); + unsigned int i, j, k = 0; + + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) + rkisp1_write(params->rkisp1, arg->coeff[i][j], + RKISP1_CIF_ISP_CT_COEFF_0 + 4 * k++); rkisp1_write(params->rkisp1, arg->ct_offset_r, RKISP1_CIF_ISP_CT_OFFSET_R); rkisp1_write(params->rkisp1, arg->ct_offset_g, diff --git a/drivers/staging/media/rkisp1/uapi/rkisp1-config.h b/drivers/staging/media/rkisp1/uapi/rkisp1-config.h index ca0d031b14ac..a01711a668da 100644 --- a/drivers/staging/media/rkisp1/uapi/rkisp1-config.h +++ b/drivers/staging/media/rkisp1/uapi/rkisp1-config.h @@ -417,19 +417,13 @@ struct rkisp1_cif_isp_bdm_config { /** * struct rkisp1_cif_isp_ctk_config - Configuration used by Cross Talk correction * - * @coeff: color correction matrix + * @coeff: color correction matrix. Values are 11-bit signed fixed-point numbers with 4 bit integer + * and 7 bit fractional part, ranging from -8 (0x400) to +7.992 (0x3FF). 0 is + * represented by 0x000 and a coefficient value of 1 as 0x080. * @ct_offset_b: offset for the crosstalk correction matrix */ struct rkisp1_cif_isp_ctk_config { - __u16 coeff0; - __u16 coeff1; - __u16 coeff2; - __u16 coeff3; - __u16 coeff4; - __u16 coeff5; - __u16 coeff6; - __u16 coeff7; - __u16 coeff8; + __u16 coeff[3][3]; __u16 ct_offset_r; __u16 ct_offset_g; __u16 ct_offset_b;