CHROMIUM: video: tegra_camera: deal with unsupported resolutions

try_format is always executed before set_format and set_format is allowed to change resolution when native support is not available. we need to adjust bytesperline and sizeimage too in this case.

Change-Id: I06009469ca86036945966901ba52e2fbae248c33
Signed-off-by: Jie Sun <jiesun@chromium.org>

BUG=None
TEST=on kaen, use 352x288 which is not supported, verify the it capture at 640x480, the byteperline=1280.

Review URL: http://codereview.chromium.org/6775007
CHROMIUM: media: tegra: Change to correct bus type

This driver hangs off of the nvhost bus, not the platform bus.

Change-Id: I88e47dffd365ddb2e25c725c7747c87728f00d23

BUG=none
TEST=System loads this driver automatically at bootup (needs an accompanying nvhost modification).
Signed-off-by: Andrew Chew <achew@nvidia.com>
Signed-off-by: Olof Johansson <olof@lixom.net>

Review URL: http://codereview.chromium.org/6778031
CHROMIUM: media: tegra: Added timeout logic

Added line timeout, so if a short frame arrives, we pad the rest of the frame.
Shortened syncpt timeout.  Syncpts should no longer time out now, so print
some diagnostics if it does.

Change-Id: Iec8377565be07b63c2ddd220ecf5fa5cbc4005d8

BUG=none
TEST=Tested on Seaboard with the OV9740 sensor.  All resolutions work.
Signed-off-by: Andrew Chew <achew@nvidia.com>
Signed-off-by: Olof Johansson <olof@lixom.net>

Review URL: http://codereview.chromium.org/6677119
CHROMIUM: media: tegra: Fix output format

Prior to this, we were programming the sensor with the wrong output format,
and then renormalizing at the camera host layer.  After fixing the sensor
YUYV ordering, this change is needed so that the camera host layer outputs
in the proper YUYV ordering.  After this change, h_flip works as expected.

Change-Id: I3660936a5fee7e15837ece21b22bd55c6fe84c02
Signed-off-by: Andrew Chew <achew@nvidia.com>

BUG=hflip didn't work
TEST=Tested that hflip now works.

Review URL: http://codereview.chromium.org/6816039
Patch from Andrew Chew <achew@nvidia.com>.
CHROMIUM: media: tegra: Implemented suspend/resume

We turn off the camera subsystem on suspend (power rail, clocks, GPIOs).
Restore on resume.

Change-Id: Ib38412a8904d18d2ed11fb63b90f1575033cfa77
Signed-off-by: Andrew Chew <achew@nvidia.com>

BUG=none
TEST=Suspend/resume can work now.  Some instabilities under investigation.

Review URL: http://codereview.chromium.org/6821063
Patch from Andrew Chew <achew@nvidia.com>.
CHROMIUM: media: tegra: Fixed suspend/resume

The Tegra camera host driver needs to call nvhost_module_busy() before using
nvhost stuff, and nvhost_module_idle() afterwards, to ensure that nvhost
doesn't shut stuff down until the camera host driver is ready.

Change-Id: I5bf45617a535ad140409d23602a9e22cf605684b

BUG=Suspend/resume while camera is active was failing one out of every two trials, approximately.
TEST=Suspend/resume while camera is active was tried about two dozen times, without incident.  Camera resumes operation on system resume as expected.
Signed-off-by: Andrew Chew <achew@nvidia.com>
Signed-off-by: Olof Johansson <olofj@chromium.org>

Review URL: http://codereview.chromium.org/6881036
CHROMIUM: media: tegra: Use discontinuous clock

This saves power when the camera is in use.

Change-Id: Ic1bd88f3e94f3e783772171ad6682ce1be1b6fbd

BUG=none
TEST=Tested that camera still works.
Signed-off-by: Andrew Chew <achew@nvidia.com>
Signed-off-by: Olof Johansson <olofj@chromium.org>

Review URL: http://codereview.chromium.org/6881064
CHROMIUM: media: tegra: Added more output formats.

All YUYV order variants supported for both input and output.
I420 (YUV planar) output also now supported.

In the process of this, there was some nontrivial code refactoring and cleanup.
Kind of hard to separate, because the additional format support relies on this
refactoring.

Signed-off-by: Andrew Chew <achew@nvidia.com>

BUG=none
TEST=Used the audiovideo_V4L2 test to capture at YUYV, YVYU, UYVY, VYUY, and
YU12. YU12 doesn't look correct right now because of a bug in the
testbench when doing the conversion between YU12 and RGB. I used a
separate program to do the conversion, and the images look fine.

Change-Id: Ia72ef430e8d3a6e98fdf88785b2d10e2111e6de7
Reviewed-on: http://gerrit.chromium.org/gerrit/394
Tested-by: Jie Sun <jiesun@chromium.org>
Reviewed-by: Jie Sun <jiesun@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Merge branch 'camera' of github.com:TeamDRH/android-tegra-nv-2.6.39-rel-14r7 into camera