Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1921015lqz; Tue, 2 Apr 2024 01:30:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXS7nBO5ryfY866Tjx5B/FECQM+RiVmolrfDXHcYsDiIrX8qmxFHJEhyGqijVCljE4hsbBeHc8CaBlZvdn1SEKiLUtUEjN8Wu85/bNREw== X-Google-Smtp-Source: AGHT+IGQ0ztsDQA+dqB8UkLu/5XJ3z3vkp5DlOilxWhL+K7tRNnNZd4698B5hQc3dSlEvu/KDs9A X-Received: by 2002:a05:620a:584a:b0:788:7299:e79a with SMTP id wn10-20020a05620a584a00b007887299e79amr11944462qkn.28.1712046637077; Tue, 02 Apr 2024 01:30:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712046637; cv=pass; d=google.com; s=arc-20160816; b=HQtfl2LspRJ6DjVfB5gxx0BYhboeyVZsrAAUITq7scXXK8wEm+NVcH1Aj1YuKyDe5h mYnNEOUHymi/q5W1qZfuBMZylstTKe8uEAcV1QiN6pZZ8sWK1AJ52TNs38MtkqWBBjnf 39DRFeTcI8Dgxc6VZ/i7yuHXLWFXFN44wJW2xG2WkC3lhLtMm+TeKmVy0lr23rJS3tYY Rax8fH06rr66/F9rglrk3lDVo6FeAFvN+D+WwAjxzjqAZFFEmkNVgar1KuGRpYtmkBV3 upBu5jdImfkeToHt2tWb+ZN6oo4AQc9GpHGaJ6JwD7JnIaxVqMDYIU6Tors1wKlKRvyH dSmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=Kv39AIPwabdcVHSQ2k/T6PqPgqJVocaKlEMzKul77OQ=; fh=wKbLPge7qIfaLzuLkkKITfGyExPpgOwa87V/obnUYok=; b=wgSmMADjIAhIFlebBA7TbLDbC9xdjz9VC93H6OhTnH5+HhZ6lP3/D2DcIeskFAOcX3 m9p03CwA5cGqmPkUweddc6CcF+mhsByuEjtVOClRr+NEbARJr3UUg8WF9aewZ6YiD2FF 9Vd2r4+QcBUnx/nB3fTLTD094z6QdEBZ9RIpbkA+8RUnJBBWRw9PI9IKdcFywwv1I42C ovSj8Fn9sc9OSeQrFENMOklTZBKzXnirLtwng178BmJ0QZlj8ghFxV4xbBW9QL4FR/m0 M3JWU7nTZZoLR1c2da2bnhwnfEdHSWeKnK081gXfHSSugGtD7OwgMfG8oQxLFCgKWCU1 TASw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=AvmNUIA4; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-127547-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127547-linux.lists.archive=gmail.com@vger.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 bi31-20020a05620a319f00b0078a46362745si12863687qkb.136.2024.04.02.01.30.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 01:30:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127547-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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=AvmNUIA4; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-127547-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127547-linux.lists.archive=gmail.com@vger.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 B32DD1C20F42 for ; Tue, 2 Apr 2024 08:30:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D1F0A57329; Tue, 2 Apr 2024 08:29:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="AvmNUIA4" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 8A13856459; Tue, 2 Apr 2024 08:29:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712046588; cv=none; b=hqrUtFgQ5PtupwXftAsZVVVnKiO5nsvPMHZJ5qZOVU4edET43NLB5Zs04Y15rylTKxcJf5TjWlGGd3CgyNgOzmEY5AfTuRm59rqKzfBCFAAIty5fWbH/k1bK3vJN21UESMionogw4zO5FUbdgO5UyPg7dHyhmss9PK5XET7cXEU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712046588; c=relaxed/simple; bh=w5Y4HAhWpPFs303OWWtOgDs1po79LqgdLoTPOFnYzS8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CjAvhIB4IdkZtya7x0TbWemJg9zDzJW+glBjqrxoRoBHtobTcCnQDEJEd3eB8Hj+vOraFRW9mSqWDV7b+rupRpZU32a8eixEg6mOfWlCwI+BZM0uVmEQ1/nf7I0auToYb7GSL7jeeF1tz3brFW/sFtws9+yAlvr4giUQtfSW2sM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=AvmNUIA4; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from [192.168.1.118] (unknown [103.86.18.232]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AFE6F3A2; Tue, 2 Apr 2024 10:29:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1712046548; bh=w5Y4HAhWpPFs303OWWtOgDs1po79LqgdLoTPOFnYzS8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=AvmNUIA4nC8tV78ryeJRsGKx9yYGbUtddVBb71TunCHFqoV88GFddPrU48Ew0oF7f /s0U/mxXmEDHaHz27IhcWLHej3ZHwwaAYWh61ZS8ysh/69MtmDP4QKlFsn5dxPOp+C gqt+pJZP47Pdp5XWV4Suh/HhgZZIfXS9RjebXrjk= From: Umang Jain Date: Tue, 02 Apr 2024 13:59:27 +0530 Subject: [PATCH 3/3] fixups Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240402-kernel-name-extraversion-v1-3-57bb38de841b@ideasonboard.com> References: <20240402-kernel-name-extraversion-v1-0-57bb38de841b@ideasonboard.com> In-Reply-To: <20240402-kernel-name-extraversion-v1-0-57bb38de841b@ideasonboard.com> To: Kieran Bingham , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Sakari Ailus Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Umang Jain X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1712046569; l=2587; i=umang.jain@ideasonboard.com; s=20240402; h=from:subject:message-id; bh=w5Y4HAhWpPFs303OWWtOgDs1po79LqgdLoTPOFnYzS8=; b=5IBzj1PKxlH3VdAL+w8r6TYuSlgTEiVJsOLgy1YTyK8k6P6fVvCzwHwcwMkYLt2q0To5bP6gz N1CDL8oEBR/DP8Od0JqI1++81Yub8+bS4U9OQl/qIrbvYUJItUnwfa0 X-Developer-Key: i=umang.jain@ideasonboard.com; a=ed25519; pk=8K9qSAtc2dNF4Ax+jYC0w9dlfptU7wxPBQwOy0nxRoc= --- drivers/media/i2c/imx283.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 81fe2d4fd4d3..ace8f65aa6b3 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -450,12 +450,12 @@ static const struct imx283_mode supported_modes_12bit[] = { .bpp = 12, .width = 2736, .height = 1824, - .min_hmax = 1870, /* Pixels (362 * 360/72 + padding) */ + .min_hmax = 2414, /* Pixels (362 * 480MHz/72MHz + padding) */ .min_vmax = 3840, /* Lines */ /* 50.00 FPS */ - .default_hmax = 1870, /* 362 @ 360MHz/72MHz */ - .default_vmax = 3960, + .default_hmax = 2500, /* 375 @ 480MHz/72Mhz */ + .default_vmax = 3840, .veff = 1824, .vst = 0, @@ -483,7 +483,7 @@ static const struct imx283_mode supported_modes_10bit[] = { .min_vmax = 3793, /* 25.00 FPS */ - .default_hmax = 1500, /* 750 @ 576MHz / 72MHz */ + .default_hmax = 6000, /* 750 @ 576MHz / 72MHz */ .default_vmax = 3840, .min_shr = 10, @@ -568,12 +568,15 @@ static inline void get_mode_table(unsigned int code, static u64 imx283_pixel_rate(struct imx283 *imx283, const struct imx283_mode *mode) { + u64 link_frequency = link_frequencies[__ffs(imx283->link_freq_bitmap)]; unsigned int bpp = mode->bpp; const unsigned int ddr = 2; /* Double Data Rate */ const unsigned int lanes = 4; /* Only 4 lane support */ - u64 link_frequency = link_frequencies[__ffs(imx283->link_freq_bitmap)]; + u64 numerator = link_frequency * ddr * lanes; - return link_frequency * ddr * lanes / bpp; + do_div(numerator, bpp); + + return numerator; } /* Convert from a variable pixel_rate to 72 MHz clock cycles */ @@ -588,8 +591,11 @@ static u64 imx283_internal_clock(unsigned int pixel_rate, unsigned int pixels) */ const u32 iclk_pre = 72; const u32 pclk_pre = pixel_rate / HZ_PER_MHZ; + u64 numerator = pixels * iclk_pre; + + do_div(numerator, pclk_pre); - return pixels * iclk_pre / pclk_pre; + return numerator; } /* Internal clock (72MHz) to Pixel Rate clock (Variable) */ @@ -604,8 +610,11 @@ static u64 imx283_iclk_to_pix(unsigned int pixel_rate, unsigned int cycles) */ const u32 iclk_pre = 72; const u32 pclk_pre = pixel_rate / HZ_PER_MHZ; + u64 numerator = cycles * pclk_pre; + + do_div(numerator, iclk_pre); - return cycles * pclk_pre / iclk_pre; + return numerator; } /* Determine the exposure based on current hmax, vmax and a given SHR */ -- 2.43.0