Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4334862ybx; Mon, 4 Nov 2019 11:36:01 -0800 (PST) X-Google-Smtp-Source: APXvYqy1M9CQrFYA/H6hX3EEIvYEjyMIicCM+DxJUR8O/yiRAdmXnoweaGUYKn1HWHpely+DxSQH X-Received: by 2002:a17:906:f1c7:: with SMTP id gx7mr3844316ejb.265.1572896161662; Mon, 04 Nov 2019 11:36:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572896161; cv=none; d=google.com; s=arc-20160816; b=GRHiTBuUcXq4xbQwco6QGC6oR518BeVWwoAkea9uRxyln/1vkQD7i15t/Rft+ww1Yw +Z3cRDEr/KTQVFNcO1XxZtfLSi+LC3hEt3IEy3WBYZ3cWtRTEDK6sXOvaj8K508YtdeH 4xiVjD81WHrEsLfNsYClXjyQd/EgpD8+thBx+baS3wSFYC2u9wh6gPRtrhu/ywK1rDwd iOaUVBwjj0pA5xfhg4n3zcmFvfYSwmTPzOVQPy7fWLgK3NXU+aU372vrezqoxkkEAlJB pg5hTQcNaCRdYX9/ecsNqSUOtwg01okE5nyDgUhSYuwncWZoRfEL0APP6LfN6WrE8SUq OnAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Z07YzElBjrHCm7soDpyKSRlehI1yRBoN2QBEWyWKCgA=; b=uaXVK3FDIKM+Lowa8fp5p+KuMgy2xUyb3BzOG/5G6Db/N7OgCqy1cY4oKfsL5QJldu XXuuT8pXSBFzJRR1E1JjQZy6UMS00uHdaDozyvEZvNHpeYrmOL7L2Hn2iJWQKY8k3Jdd tRX4J3Oj5nFNpDWgeggWmmj6sKmHD0cTRd8Ssbcb40Ays64sv3LRPfIOVteGft0cIUIG wQrp3u/0kClSm7j87JCtpJD8bNKc+Aua5E938Wemr6CNNmpKBCIQaKjZ6rhlQdFz6BLz d/g2dk70fbWXE8O4wUS+BOpWeOX5dBigZlxggxKfmBFfB4yx8ZC9+MBH74vFaaYI+Sya 79mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=KaLmBzOv; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si7931743edf.428.2019.11.04.11.35.38; Mon, 04 Nov 2019 11:36:01 -0800 (PST) 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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=KaLmBzOv; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729728AbfKDTcK (ORCPT + 99 others); Mon, 4 Nov 2019 14:32:10 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:47524 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729704AbfKDTcI (ORCPT ); Mon, 4 Nov 2019 14:32:08 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id xA4JW6Jq000758; Mon, 4 Nov 2019 13:32:06 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1572895926; bh=Z07YzElBjrHCm7soDpyKSRlehI1yRBoN2QBEWyWKCgA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=KaLmBzOvwe1j1uhldli9rGRW7tGBZQ7OCAEg8vp4smLaziU09e1I9AgrIfa01WSPE ftF9nTU2yvyM4Zjpf9xbpkk8yPIvS78jZE8cQHtv+8Biflh07NiadNXAsKmhjikDxJ FDTIbGnXLTBCMeQPWMKxIlz4il0twOjA8u7LadJI= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xA4JW6dR126716 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 4 Nov 2019 13:32:06 -0600 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 4 Nov 2019 13:32:05 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Mon, 4 Nov 2019 13:31:51 -0600 Received: from ula0869644.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id xA4JVmd8096934; Mon, 4 Nov 2019 13:32:05 -0600 From: Benoit Parrot To: Hans Verkuil CC: , Rob Herring , , , Benoit Parrot Subject: [Patch v2 09/20] media: ti-vpe: cal: Fix pixel processing parameters Date: Mon, 4 Nov 2019 13:31:29 -0600 Message-ID: <20191104193140.31145-10-bparrot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191104193140.31145-1-bparrot@ti.com> References: <20191104193140.31145-1-bparrot@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The pixel processing unit was hard coded to only handle 8 bits per pixel from input to output. We now add handling for 10, 12 and 16 bits per pixel at the source and setting the in-memory size (i.e. container size) to 16 bits for these 3 cases. Signed-off-by: Benoit Parrot --- drivers/media/platform/ti-vpe/cal.c | 41 ++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c index 1abcdd98c33f..1b7dcf9ba9e2 100644 --- a/drivers/media/platform/ti-vpe/cal.c +++ b/drivers/media/platform/ti-vpe/cal.c @@ -803,13 +803,48 @@ static void csi2_ctx_config(struct cal_ctx *ctx) static void pix_proc_config(struct cal_ctx *ctx) { - u32 val; + u32 val, extract, pack; + + switch (ctx->fmt->bpp) { + case 8: + extract = CAL_PIX_PROC_EXTRACT_B8; + pack = CAL_PIX_PROC_PACK_B8; + break; + case 10: + extract = CAL_PIX_PROC_EXTRACT_B10_MIPI; + pack = CAL_PIX_PROC_PACK_B16; + break; + case 12: + extract = CAL_PIX_PROC_EXTRACT_B12_MIPI; + pack = CAL_PIX_PROC_PACK_B16; + break; + case 16: + extract = CAL_PIX_PROC_EXTRACT_B16_LE; + pack = CAL_PIX_PROC_PACK_B16; + break; + default: + /* + * If you see this warning then it means that you added + * some new entry in the cal_formats[] array with a different + * bit per pixel values then the one supported below. + * Either add support for the new bpp value below or adjust + * the new entry to use one of the value below. + * + * Instead of failing here just use 8 bpp as a default. + */ + dev_warn_once(&ctx->dev->pdev->dev, + "%s:%d:%s: bpp:%d unsupported! Overwritten with 8.\n", + __FILE__, __LINE__, __func__, ctx->fmt->bpp); + extract = CAL_PIX_PROC_EXTRACT_B8; + pack = CAL_PIX_PROC_PACK_B8; + break; + } val = reg_read(ctx->dev, CAL_PIX_PROC(ctx->csi2_port)); - set_field(&val, CAL_PIX_PROC_EXTRACT_B8, CAL_PIX_PROC_EXTRACT_MASK); + set_field(&val, extract, CAL_PIX_PROC_EXTRACT_MASK); set_field(&val, CAL_PIX_PROC_DPCMD_BYPASS, CAL_PIX_PROC_DPCMD_MASK); set_field(&val, CAL_PIX_PROC_DPCME_BYPASS, CAL_PIX_PROC_DPCME_MASK); - set_field(&val, CAL_PIX_PROC_PACK_B8, CAL_PIX_PROC_PACK_MASK); + set_field(&val, pack, CAL_PIX_PROC_PACK_MASK); set_field(&val, ctx->csi2_port, CAL_PIX_PROC_CPORT_MASK); set_field(&val, CAL_GEN_ENABLE, CAL_PIX_PROC_EN_MASK); reg_write(ctx->dev, CAL_PIX_PROC(ctx->csi2_port), val); -- 2.17.1