Skip to content

Commit

Permalink
Imported L4T 32.5.1-2.1.0 sources
Browse files Browse the repository at this point in the history
  • Loading branch information
fkesseler committed Nov 26, 2021
1 parent 65a8a85 commit 7360486
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 22 deletions.
35 changes: 28 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,39 @@ The scripts require Git on the host PC.

## Prerequisites: Install JetPack 4.5.1 to Jetson Nano, Nano 2GB, TX2, AGX Xavier or Xavier NX

Install JetPack 4.5.1 (L4T 32.5.1) as per NVIDIA's instructions https://developer.nvidia.com/embedded/jetpack
Recommendation: Use NVIDIA SDK Manager to install JetPack and useful tools such as CUDA.
https://docs.nvidia.com/sdk-manager/
Install JetPack 4.5.1 (L4T 32.5.1) as per NVIDIA's instructions https://developer.nvidia.com/embedded/jetpack

Recommendation: Use NVIDIA SDK Manager to install JetPack and useful tools such as CUDA.
https://docs.nvidia.com/sdk-manager/

**Nano and Nano 2GB: The driver installation requires JetPack 4.5.1 without any upgrades**.
If your Jetson Nano board has a higher JetPack version, please downgrade
it to JetPack 4.5.1 with NVIDIA's SDK Manager before installing the driver.

### Accidental overwriting of the driver
As of JetPack 4.4, users can update L4T directly on the board with `apt-upgrade`.
Doing this may install newer L4T kernel and device tree files, which overwrite the driver for Allied Vision cameras.
If you use `apt-upgrade` nevertheless, please prevent overwriting the driver with `sudo apt-mark hold nvidia-l4t-kernel nvidia-l4t-kernel-dtbs`.
If you use `apt-upgrade` nevertheless, please prevent overwriting the driver with:

`sudo apt-mark hold 'nvidia-l4t-*'`

Note that both reinstalling the driver or putting the update on hold may cause unavailable features or bugfixes from NVIDIA.

## Install Alvium CSI-2 driver to Jetson Nano, Nano 2GB, TX2, AGX Xavier or Xavier NX

**Cross-compile binaries from source**
These scripts require a host PC with Ubuntu (18.04) installed.
**Method A: Use precompiled binaries**

Install the precompiled kernel including driver and installation instructions.
For Jetson Nano, please use the file containing "a02" for A02 carrier boards and the other file for B01 carrier boards.

1. Extract the tarball on a host PC.

2. The tarball contains helper scripts and another tarball with the precompiled binaries named AlliedVision_NVidia_L4T_32.5.1_<git-rev>.tar.gz.
Copy the tarball to the target board. On the target board, extract the tarball and run the included install script.
Reboot the board. Now you can use the driver.

**Method B: Cross-compile binaries from source**
The scripts require a host PC with Ubuntu (we recommend version 18.04) installed.

1. Download sources and scripts from https://github.com/alliedvision/linux_nvidia_jetson to the host PC.
On the host PC:
Expand All @@ -50,4 +69,6 @@ Note that both reinstalling the driver or putting the update on hold may cause u

## Additional information
:open_book:
https://github.com/alliedvision/documentation/blob/master/NVIDIA.md
https://github.com/alliedvision/documentation/blob/master/NVIDIA.rst


28 changes: 15 additions & 13 deletions kernel/kernel-4.9/drivers/media/i2c/avt_csi2.c
Original file line number Diff line number Diff line change
Expand Up @@ -5369,30 +5369,32 @@ static int cci_version_check(struct i2c_client *client)
{
struct camera_common_data *s_data = to_camera_common_data(&client->dev);
struct avt_csi2_priv *priv = (struct avt_csi2_priv *)s_data->priv;
uint32_t cci_minver, cci_majver;
uint32_t cci_minor_ver, cci_major_ver;

cci_minver = (priv->cci_reg.layout_version & CCI_REG_LAYOUT_MINVER_MASK)
cci_minor_ver = (priv->cci_reg.layout_version & CCI_REG_LAYOUT_MINVER_MASK)
>> CCI_REG_LAYOUT_MINVER_SHIFT;

if (cci_minver == CCI_REG_LAYOUT_MINVER) {
dev_dbg(&client->dev, "%s: correct cci register minver: %d (0x%x)\n",
__func__, cci_minver, priv->cci_reg.layout_version);
/* We need at least the minor version defined */
if (cci_minor_ver >= CCI_REG_LAYOUT_MINVER) {
dev_dbg(&client->dev, "%s: valid cci register minor version: read: %d, expected minimum: %d\n",
__func__, cci_minor_ver, CCI_REG_LAYOUT_MINVER);
} else {
dev_err(&client->dev, "%s: cci reg minver mismatch! read: %d (0x%x) expected: %d\n",
__func__, cci_minver, priv->cci_reg.layout_version,
dev_err(&client->dev, "%s: cci reg minor version mismatch! read: %d (0x%x), expected: %d\n",
__func__, cci_minor_ver, priv->cci_reg.layout_version,
CCI_REG_LAYOUT_MINVER);
return -EINVAL;
}

cci_majver = (priv->cci_reg.layout_version & CCI_REG_LAYOUT_MAJVER_MASK)
cci_major_ver = (priv->cci_reg.layout_version & CCI_REG_LAYOUT_MAJVER_MASK)
>> CCI_REG_LAYOUT_MAJVER_SHIFT;

if (cci_majver == CCI_REG_LAYOUT_MAJVER) {
dev_dbg(&client->dev, "%s: correct cci register majver: %d (0x%x)\n",
__func__, cci_majver, priv->cci_reg.layout_version);
/* We need the exact major version */
if (cci_major_ver == CCI_REG_LAYOUT_MAJVER) {
dev_dbg(&client->dev, "%s: valid cci register major version: read: %d, expected: %d)\n",
__func__, cci_major_ver, CCI_REG_LAYOUT_MAJVER);
} else {
dev_err(&client->dev, "%s: cci reg majver mismatch! read: %d (0x%x) expected: %d\n",
__func__, cci_majver, priv->cci_reg.layout_version,
dev_err(&client->dev, "%s: cci reg major version mismatch! read: %d (0x%x), expected: %d\n",
__func__, cci_major_ver, priv->cci_reg.layout_version,
CCI_REG_LAYOUT_MAJVER);
return -EINVAL;
}
Expand Down
2 changes: 1 addition & 1 deletion kernel/kernel-4.9/drivers/media/i2c/avt_csi2.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ struct avt_ctrl {

/* Driver release version */
#define DRV_VER_MAJOR 2
#define DRV_VER_MINOR 0
#define DRV_VER_MINOR 1
#define DRV_VER_PATCH 0
#define DRV_VER_BUILD 0
#define DRIVER_VERSION STR(DRV_VER_MAJOR) "." STR(DRV_VER_MINOR) "." STR(DRV_VER_PATCH) "." STR(DRV_VER_BUILD)
Expand Down
12 changes: 11 additions & 1 deletion kernel/nvidia/drivers/media/platform/tegra/camera/vi/capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,17 @@ int vi_capture_status(struct tegra_vi_channel *chan,

/* negative timeout means wait forever */
if (timeout_ms < 0) {
wait_for_completion(&capture->capture_resp);
// This is workaround for issue on Xavier that was
// rebooting the device after about 3 minutes.
// When we are executing wait_for_completion without timeout,
// waiting thread is marked as stalled and whole system is rebooted.
// In case of wait_for_completion_timeout we are executing
// schedule() after timeout, that fixes this problem.
do {
ret = wait_for_completion_timeout(
&capture->capture_resp,
msecs_to_jiffies(120000)); // set timeout to 2min
} while (ret == 0); // wait until return value is not timeout
} else {
ret = wait_for_completion_timeout(
&capture->capture_resp,
Expand Down

0 comments on commit 7360486

Please sign in to comment.