diff options
| author | Bhanu Murthy V <bmurthyv@nvidia.com> | 2017-09-22 14:30:01 -0400 |
|---|---|---|
| committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-10-13 16:43:04 -0400 |
| commit | 8d691affacfda4b58afcbfdb5a0bdffccc219798 (patch) | |
| tree | 5bceb3986fbdc09a540ae13144c44d862f7ff6fd | |
| parent | 11d2647af2b38fc5b40db76871d97dcfd0eec833 (diff) | |
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 <bmurthyv@nvidia.com>
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 <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
| -rw-r--r-- | drivers/media/platform/tegra/camera/vi/vi4_fops.c | 11 |
1 files 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) | |||
| 672 | unsigned long request_pixelrate; | 672 | unsigned long request_pixelrate; |
| 673 | struct v4l2_subdev_frame_interval fie; | 673 | struct v4l2_subdev_frame_interval fie; |
| 674 | unsigned long csi_freq = 0; | 674 | unsigned long csi_freq = 0; |
| 675 | unsigned int num_ppc = NUM_PPC; | 675 | unsigned int ppc_multiplier = 1; |
| 676 | 676 | ||
| 677 | /* if bytes per pixel is greater than 2, then num_ppc is 4 */ | 677 | /* if bytes per pixel is greater than 2, then num_ppc is 4 */ |
| 678 | /* since num_ppc in nvhost framework is always 8, use multiplier */ | ||
| 678 | if (chan->fmtinfo->bpp.numerator > 2) | 679 | if (chan->fmtinfo->bpp.numerator > 2) |
| 679 | num_ppc = (NUM_PPC >> 1); | 680 | ppc_multiplier = 2; |
| 680 | 681 | ||
| 681 | fie.interval.denominator = DEFAULT_FRAMERATE; | 682 | fie.interval.denominator = DEFAULT_FRAMERATE; |
| 682 | fie.interval.numerator = 1; | 683 | fie.interval.numerator = 1; |
| @@ -713,6 +714,7 @@ static int tegra_channel_update_clknbw(struct tegra_channel *chan, u8 on) | |||
| 713 | return ret; | 714 | return ret; |
| 714 | request_pixelrate = csi_freq * PG_BITRATE / | 715 | request_pixelrate = csi_freq * PG_BITRATE / |
| 715 | chan->fmtinfo->width; | 716 | chan->fmtinfo->width; |
| 717 | request_pixelrate *= ppc_multiplier; | ||
| 716 | } else { | 718 | } else { |
| 717 | /** | 719 | /** |
| 718 | * TODO: use real sensor pixelrate | 720 | * TODO: use real sensor pixelrate |
| @@ -721,10 +723,7 @@ static int tegra_channel_update_clknbw(struct tegra_channel *chan, u8 on) | |||
| 721 | request_pixelrate = (long long)(chan->format.width | 723 | request_pixelrate = (long long)(chan->format.width |
| 722 | * chan->format.height | 724 | * chan->format.height |
| 723 | * fie.interval.denominator / 100) | 725 | * fie.interval.denominator / 100) |
| 724 | * VI_CSI_CLK_SCALE; | 726 | * VI_CSI_CLK_SCALE * ppc_multiplier; |
| 725 | csi_freq = ((long long)chan->format.width | ||
| 726 | * chan->format.height | ||
| 727 | * fie.interval.denominator) / num_ppc; | ||
| 728 | } | 727 | } |
| 729 | 728 | ||
| 730 | /* VI clk should be slightly faster than CSI clk*/ | 729 | /* VI clk should be slightly faster than CSI clk*/ |
