From: Umang Jain <umang.jain@ideasonboard.com>
To: Kieran Bingham <kieran.bingham@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Umang Jain <umang.jain@ideasonboard.com>
Subject: [PATCH 3/3] fixups
Date: Tue, 02 Apr 2024 13:59:27 +0530 [thread overview]
Message-ID: <20240402-kernel-name-extraversion-v1-3-57bb38de841b@ideasonboard.com> (raw)
In-Reply-To: <20240402-kernel-name-extraversion-v1-0-57bb38de841b@ideasonboard.com>
---
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-04-02 8:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 8:29 [PATCH 0/3] media: i2c: Add imx283 camera sensor driver Umang Jain
2024-04-02 8:29 ` [PATCH 1/3] media: dt-bindings: media: Add bindings for IMX283 Umang Jain
2024-04-02 8:29 ` [PATCH 2/3] media: i2c: Add imx283 camera sensor driver Umang Jain
2024-04-02 8:29 ` Umang Jain [this message]
2024-04-02 8:30 ` [PATCH 3/3] fixups Krzysztof Kozlowski
2024-04-02 8:31 ` [PATCH 0/3] media: i2c: Add imx283 camera sensor driver Umang Jain
2024-04-02 14:15 ` Konstantin Ryabitsev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240402-kernel-name-extraversion-v1-3-57bb38de841b@ideasonboard.com \
--to=umang.jain@ideasonboard.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=kieran.bingham@ideasonboard.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=sakari.ailus@linux.intel.com \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).