From 8d691affacfda4b58afcbfdb5a0bdffccc219798 Mon Sep 17 00:00:00 2001 From: Bhanu Murthy V Date: Fri, 22 Sep 2017 11:30:01 -0700 Subject: drivers: camera: Add multiplier for 32bit formats Add multiplier for 32 bit formats to adjust for the calculations in the nvhost framework. This avoids any race conditions or timing issues for kernel and userspace driver requests. Fix multiplier issue for TPG formats as well and cleanup unnecessary calculations. Bug 200333190 Change-Id: I7ee6a2323566e57ba04dbcf14da0295bfb659cec Signed-off-by: Bhanu Murthy V Reviewed-on: https://git-master.nvidia.com/r/1566661 (cherry picked from commit b46edc34e4b3bdb6fafc9318088e1e5a6c8bcfee) Reviewed-on: https://git-master.nvidia.com/r/1576549 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/media/platform/tegra/camera/vi/vi4_fops.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/tegra/camera/vi/vi4_fops.c b/drivers/media/platform/tegra/camera/vi/vi4_fops.c index d6c6860ae..3d56dd685 100644 --- a/drivers/media/platform/tegra/camera/vi/vi4_fops.c +++ b/drivers/media/platform/tegra/camera/vi/vi4_fops.c @@ -672,11 +672,12 @@ static int tegra_channel_update_clknbw(struct tegra_channel *chan, u8 on) unsigned long request_pixelrate; struct v4l2_subdev_frame_interval fie; unsigned long csi_freq = 0; - unsigned int num_ppc = NUM_PPC; + unsigned int ppc_multiplier = 1; /* if bytes per pixel is greater than 2, then num_ppc is 4 */ + /* since num_ppc in nvhost framework is always 8, use multiplier */ if (chan->fmtinfo->bpp.numerator > 2) - num_ppc = (NUM_PPC >> 1); + ppc_multiplier = 2; fie.interval.denominator = DEFAULT_FRAMERATE; fie.interval.numerator = 1; @@ -713,6 +714,7 @@ static int tegra_channel_update_clknbw(struct tegra_channel *chan, u8 on) return ret; request_pixelrate = csi_freq * PG_BITRATE / chan->fmtinfo->width; + request_pixelrate *= ppc_multiplier; } else { /** * TODO: use real sensor pixelrate @@ -721,10 +723,7 @@ static int tegra_channel_update_clknbw(struct tegra_channel *chan, u8 on) request_pixelrate = (long long)(chan->format.width * chan->format.height * fie.interval.denominator / 100) - * VI_CSI_CLK_SCALE; - csi_freq = ((long long)chan->format.width - * chan->format.height - * fie.interval.denominator) / num_ppc; + * VI_CSI_CLK_SCALE * ppc_multiplier; } /* VI clk should be slightly faster than CSI clk*/ -- cgit v1.2.2